Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(3.1.32 and 3.1.33) @last property not working inside foreach on an object #529

Closed
sveldhuisen opened this issue Jan 14, 2019 · 3 comments
Closed
Labels
waiting Waiting for answer

Comments

@sveldhuisen
Copy link

sveldhuisen commented Jan 14, 2019

I just tried to upgrade from 3.1.31 to 3.1.33 and every place I use the @last property inside a foreach iteration on an object is broken with the following error:

Undefined property: Smarty_Variable::$last

After downgrading to 3.1.31 everything works fine.

@wisskid wisskid added the waiting Waiting for answer label Feb 19, 2020
@wisskid
Copy link
Contributor

wisskid commented Feb 19, 2020

Cannot reproduce this in any recent version (including 3.1.31) with:

<?php
require_once './vendor/autoload.php';
$smarty = new Smarty();

class B {
	public $a = 1;
	public $b = 2;
}

$smarty->assign('test', new B());

$smarty->display('string:
{foreach $test as $key => $val}
 {$key}: {$val}
 {if $val@last}last{/if}
{/foreach}
');

Do you have a reproduction scenario?

@wisskid
Copy link
Contributor

wisskid commented Feb 7, 2021

Closed because of inactivity.

@wisskid wisskid closed this as completed Feb 7, 2021
@ecourtial
Copy link

I have the same issue with 3.1.31, 3.1.43 and the 4.x version.
The warning appeared after a migration from PHP 7.4 to 8.1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
waiting Waiting for answer
Projects
None yet
Development

No branches or pull requests

3 participants