Uploaded image for project: 'eZ Publish / Platform'
  1. eZ Publish / Platform
  2. EZP-12023

Delimiter is never executed when using nested loops and template compilation is enabled

    XMLWordPrintable

Details

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Medium Medium
    • 3.10.1, 3.9.5, 4.0.1, 4.1.0alpha1
    • 3.9.4
    • None
    • Operating System:
      PHP Version: 4.4.6
      Database and version: MySQL 5.1.22
      Browser (and version):

    Description

      When you are using nested loops (e.g. foreach) and template compilation is enabled, delimiters are never executed.

      The code in 'Steps to reproduce' should render "1abc,2abc,3abc,4abc,5abc" and it does produce that in template processing mode. As soon as template compilation is enabled, the output becomes "1abc2abc3abc4abc5abc" (without the delimiting comma).

      The problem is that compiled foreach code has a *$skipDelimiter = true* before the start of each loop and this variable does not have a unique name per loop. So as soon as the inner loop starts, the skip variable is reset to *true* preventing the delimiter from showing up before the next iteration of the outer loop.

      Other versions are probably affected as well.

      Steps to reproduce
      {def $outer=array(1,2,3,4,5) $inner=array('a','b','c')} {foreach $outer as $i}

      {$i}

      {foreach $inner as $j}

      {$j}

      {/foreach} {delimiter},{/delimiter}{/foreach}

      Attachments

        Activity

          People

            cyberwolf cyberwolf
            hmelis hmelis
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: