Smarty Forum Index Smarty
The discussions here are for Smarty, a template engine for the PHP programming language.

foreach with {continue} in new block

 
Post new topic   Reply to topic    Smarty Forum Index -> Bugs
View previous topic :: View next topic  
Author Message
andyi
Smarty n00b


Joined: 06 Apr 2018
Posts: 1

PostPosted: Fri Apr 06, 2018 6:49 pm    Post subject: foreach with {continue} in new block Reply with quote

I just upgraded to version 3.1.31 and think I've identified a bug.

If I use a {foreach} loop and put a {continue} within a sub block, the fetch will fail with error message "Fatal error: 'continue' not in the 'loop' or 'switch' context in ..."

Am I missing something or is this an intended limitation?

Example:

Code:
{foreach $var_array as $var_val}

{block name=subblock}
{continue}
{/block}

{/foreach}
Back to top
View user's profile Send private message
AnrDaemon
Administrator


Joined: 03 Dec 2012
Posts: 1213

PostPosted: Fri Apr 06, 2018 7:39 pm    Post subject: Reply with quote

It is intended behavior. Blocks are compiler-level elements, {continue} is runtime.
Same as if you #ifdef your continue in C code.
Works as intended, but you should really never do it.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Smarty Forum Index -> Bugs All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP