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

Allow/Deny inline constants #585

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open

Allow/Deny inline constants #585

wants to merge 5 commits into from

Conversation

artcs
Copy link

@artcs artcs commented Apr 14, 2020

Adding var $allow_inline_constants to SmartyClass and using it in templateparser. This way you can globally deny use of inline constants without $smarty.const. prefix to avoid various ambiguities. Just set $Smarty->allow_inline_constants = false. Defaults to true for backwards compatibility.
Closes #554

@AnrDaemon
Copy link
Contributor

Missing tests.

@artcs
Copy link
Author

artcs commented May 10, 2020

I found function calls like {if strpos(…) !== false} broken with my first version, so I changed it a bit. But this is only speculative trial and error, cause I honestly don't know exactly how the templateparser works. So this should definitely be reviewed by someone, who is familiar with the parser syntax. This one could then also write the corresponding tests.

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

Successfully merging this pull request may close these issues.

Direct access to php constants breaking smarty
2 participants