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

Array variable named sid v3.1.27 #76

Closed
billyrud opened this issue Aug 3, 2015 · 1 comment
Closed

Array variable named sid v3.1.27 #76

billyrud opened this issue Aug 3, 2015 · 1 comment

Comments

@billyrud
Copy link

billyrud commented Aug 3, 2015

Recently upgraded from 3.1.21 to 3.1.27 and noticed that if an array variable is named "sid" it doesn't output the value, upon downgrading to 3.1.21 or renaming "sid" to anything else it works again. I then tried version 3.1.23 and it failed, so a change between 3.1.21 and 3.1.23 is preventing this specific variable from working.

Test Info is below.

PHP Code:
array(0 => array("sid" => 38, "some" => "thing"));
array(0 => array("sid" => "38", "some" => "thing"));

Template Code:
{$test[0].sid} - outputs nothing
{$test[0].some} - outputs "thing"

@uwetews
Copy link
Contributor

uwetews commented Aug 23, 2015

The problem is cause by the additional support of constants in Smarty ´templates.
session_start() does create an undocumented constant with name sid.
There is now a naming ambiguity if you write your array access like {$test[0].sid}
{$test[0]['sid']} will work.

See also https://code.google.com/p/smarty-php/issues/detail?id=225#c2

@uwetews uwetews closed this as completed Aug 23, 2015
think-mcunanan pushed a commit to think-mcunanan/smarty that referenced this issue Mar 22, 2023
Merge release-2.0.7.3 into release-2.0.9 branch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants