-
Notifications
You must be signed in to change notification settings - Fork 712
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
Direct access to php constants breaking smarty #554
Comments
A similar issue with inline constant support regarding array access ( #149) was fixed some years ago. In your case you can hack around this issue similarly by editing the file sysplugins/smarty_internal_templateparser.php. In function yy_r13() (line 2257) change
to
Then the tagnames don't get replaced by defined values. |
Thanks for your reply. Indeed this should be controlled via a setting specially that we're using smarty with composer so it doesn't make sense to hack a specific file in the smarty lib. Would appreciate adding this fix to the upcoming release. |
I also noticed a different parser behaviour for constants with PHP 7.3 early this year, see #534 . |
That's simply untrue. Please don't spread misinformation. Not to mention, this has nothing to do with PHP variables. |
Hi,
We upgraded from Smarty 3.1.21 to 3.1.33
Apparently, if you have a php variable defined as follows :
define("myvar", "My var value");
It can be accessed in the template as
{myvar}
Can we stop this behavior ?
In our app we have a php constant defined named "assign" which breaks the smarty template when the assign tag is used.
There should be a way to not directly "see" these keywords as constants since anyone can break smarty by defining a php variable having the same smarty tag name. And btw the generated exception doesn't say much, it was hard to find.
Thanks !
The text was updated successfully, but these errors were encountered: