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

Endless loop in for-loop nested within foreach and having a break #323

Closed
rvock opened this issue Jan 4, 2017 · 0 comments
Closed

Endless loop in for-loop nested within foreach and having a break #323

rvock opened this issue Jan 4, 2017 · 0 comments

Comments

@rvock
Copy link

rvock commented Jan 4, 2017

If I have a break within a for-loop, that is nested within a foreach loop, I'll end up with an endless loop:

{foreach [1, 2, 3] as $var}
	{for $i=0 to 160}
		{if $i == 20}
			{break}
		{/if}
	{/for}
{/foreach}

The documentation does not mention, if break should work within {for} or {while}-loops. But the generated code will output a break-statement, so I believe it is supported :)

{for $i=0 to 160}
	{if $i == 20}
		{break}
	{/if}
{/for}

But the break-plugin only checks for foreachLevels:
smarty_internal_compile_break.php#L46

uwetews pushed a commit that referenced this issue Nov 22, 2017
…ontain other looping tags like {for}, {section} and {while} #323
@uwetews uwetews closed this as completed Nov 22, 2017
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

No branches or pull requests

2 participants