Skip to content

Error using {breakIf} in nested foreach loop #340

Description

@janda-quitec

Version: 3.0.6

Bug Description:
If {breakIf} is used, additional </span> is inserted into HTML code

Steps To Reproduce - paste this code to https://fiddle.nette.org/latte:

<span n:foreach="[0=>'a',1=>'b'] as $key=>$value">
{foreach ['a'=>'A','b'=>'B'] as $k=>$v}
{if $k == $value}
{$v}
{breakIf TRUE} {* chybu nadbytecneho </span> zpusobuje tento radek *}
{/if}
{/foreach}
</span>

Activity

  1. MartinStepar commented on Sep 14, 2023

    @MartinStepar

    Persists in 3.0.9. As workaround (before fix) you can use outer {foreach} instead of n:foreach:

    {foreach [0=>'a',1=>'b'] as $key=>$value} {* added outer foreach *}
        <span> {* removed n:foreach *}
            {foreach ['a'=>'A','b'=>'B'] as $k=>$v}
                {if $k == $value}
                    {$v}
                    {breakIf TRUE} {* no close tag anymore *}
                {/if}
            {/foreach}
        </span>
    {/foreach}
  2. added 7 commits that reference this issue on Nov 8, 2023
    520178e
    b7a4e6e
    d300ddc
    310b2a4
    57ef627
    4176989
    d52eb0c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions