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

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

Closed
Snor opened this issue Mar 14, 2024 · 0 comments · Fixed by #954
Closed

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

Snor opened this issue Mar 14, 2024 · 0 comments · Fixed by #954
Milestone

Comments

@Snor
Copy link

Snor commented Mar 14, 2024

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".

@wisskid wisskid added this to the 5.0 milestone Mar 14, 2024
wisskid added a commit that referenced this issue Mar 15, 2024
* Fixed that scoped variables would overwrite parent scope.
Fixes #952

* Moved variable stack maintenance to methods and private properties in Data class.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants