Details
-
Bug
-
Resolution: Fixed
-
Medium
-
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
Issue Links
- relates to
-
EZP-13158 [regression] {skip} is broken
- Closed