smarty-php / smarty

Smarty is a template engine for PHP, facilitating the separation of presentation (HTML/CSS) from application logic.
Other
2.23k stars 703 forks source link

Function scoped variables overwriting parent scope in v5.0.0-rc3 #952

Closed Snor closed 4 months ago

Snor commented 4 months ago

In this example, the $var assignment inside the function persists outside of the function:

{function name=test}
    {$var="b"}
{/function}

{$var="a"}

{test}

{$var}

So Smarty 4 would output "a" as you'd expect, but Smarty v5.0.0-rc3 outputs "b".