-
-
Notifications
You must be signed in to change notification settings - Fork 112
Description
Version: 2.9.2
Bug Description
I'm updating dependencies on an older(-ish) project and noticed some unannounced breaking changes. In the previous version the project used (2.6.2), it was possible to use the {else} tag with the {last} tags in a {foreach} in the same way you would use {if}...{else}...{/if} and I used it as a shorthand for {if $counter->isLast()}...{else}...{/if}.
This is no longer possible, probably due to the addition of {else} with {foreach} and throws Tag {else} is unexpected here in ... and there is no (I can't find any) mention of it anywhere.
Steps To Reproduce
For example you could write something like this:
{foreach $items as $item}
{last}
I'm the last {$item} :(
{else}
I'm NOT the last {$item} :P
{/last}
{/foreach}Expected Behavior
Compile and work as before (if $last ?: else).
Possible Solution
Due to the fact that I couldn't find any mention of this change (or for that matter the behavior itself), I'm starting to think that this behavior was actually a bug, not a feature and was undiscovered? Maybe because the {last} tag was compiled to a regular if statement, it didn't throw any error, because else is completely valid after an if/else if?
{if} that's the case, then I guess you can change the issue from a Bug report to a Feature request to bring this feature back, even though it was never officially a feature, because it was a bug, but wasn't know about and fix the new bug that is actually not a bug, but a feature, but accidentally fixed (or broke) the previous real bug and turn that bug into a real feature, without breaking any existing features or accidentally fixing more bugs. *gasps for air* I don't know, I'm confused as well...