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

Compiler issue concerning array keys and constants #253

Closed
michaelbeckius opened this issue Jun 30, 2016 · 2 comments
Closed

Compiler issue concerning array keys and constants #253

michaelbeckius opened this issue Jun 30, 2016 · 2 comments

Comments

@michaelbeckius
Copy link

In Smarty 2
$constants.COUNTRY
compiles to
$_smarty_tpl->tpl_vars['constants']->value['COUNTRY']

But in Smarty 3 it compiles to
$_smarty_tpl->tpl_vars['constants']->value[COUNTRY]

The reason is that I also have a constant named COUNTRY and for some reason Smarty takes the value of the constant and use it as the array key instead of literal 'COUNTRY'.

Is this a bug or an intended change from Smarty 2 to Smarty 3? If intended, why, and can the old behaviour be enabled again somehow?

@artcs
Copy link

artcs commented Jul 1, 2016

This is already fixed in the master branch (see #149).
In 3.1.29 you can use $constants['COUNTRY'] instead of the dot syntax as a workaround.

@michaelbeckius
Copy link
Author

Thanks. I found the same workaround. It will do for now.

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