smarty-php / smarty-php/smarty
Direct access to php constants breaking smarty
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 2.3k
- Forks
- 709
- PR merge metrics
- No merged PRs in 30d
Description
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 !
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the reported behavior with a PHP constant named "assign" and a Smarty template using the assign tag, comparing Smarty 3.1.21 and 3.1.33 if possible. Trace how template identifiers are resolved as PHP constants and inspect the generated exception. Done means constants no longer unexpectedly shadow Smarty tags and the resulting error is informative.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- web-dev
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100