-
Notifications
You must be signed in to change notification settings - Fork 715
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
Output from false condition #392
Comments
Why don't you use the {eval} tag which has been designed for such use case.
|
Thanks. There are probably lots of other ways to do it, but I just wanted to make you aware that this doesn't work. In my opinion, it should either produce a compilation error, or give the expected result of no output. |
Yes, I will look into it ASAP |
May I ask, what was the original intention of such code? |
@AnrDaemon Actually, I just discovered this issue when trying to make a minimal example for issue #391. So there was no intention behind this code other than that. |
I've seen both reports, but to me, the interpretation of the given template is far from intuitive. Else it looks much like an implicit reevaluation. Which often could be exploited as a recursion bomb. |
@AnrDaemon Sure, As I said, I did not actually use this template for anything. Just discovered the issue when making a minimal example. In order to not mix the issue conversations, please ask on the other issue if you're wondering about the intention of that template. |
No, I mean that I expect the OUTPUT of a provided sample to be LITERAL |
@AnrDaemon Sorry, then I misunderstood you. The literal |
Makes a little bit more sense, thanks for explanation. |
Smarty does allow to embed tags in double quoted strings like In case of block tags opening and closing tags must stay in the same double quoted string otherwise it does break the generated PHP code structure and does not make sense anyway. |
The master branch has been updated to throw a compiler exception for this condition. |
Consider the following smarty template.
It is compiled into the following php template.
When the compiled template is run,
foo
is output, even though it should only be output when the condition is true (which it isn't).Note: running this template also generates an error:
Notice: Undefined variable: _prefixVariable1
, but that issue is already reported here: #391The text was updated successfully, but these errors were encountered: