key problem in foreach when using TemplateCompile (eZ 3.7.3)

Author Message

Marko Žmak

Thursday 19 January 2006 4:35:15 am

The key variable in the foreach loop is not the same in the {delimit} section and outside of it.

This code outputs:

{foreach $child_nodes as $index => $child_node}

{$index} -

{delimiter}
{$index}
{/delimiter}

{/foreach}

0 - 1
1 - 2
2 - 3

and so on...

Is this a feature or a bug?

It happens in eZ 3.7.3, and only when TemplateCompile is enabled. I'm not sure, but I think it worked in earlier versions.

--
Nothing is impossible. Not if you can imagine it!

Hubert Farnsworth

Marko Žmak

Sunday 22 January 2006 3:06:44 am

Can anyone confirm this as a BUG?

--
Nothing is impossible. Not if you can imagine it!

Hubert Farnsworth

Hans Melis

Sunday 22 January 2006 5:07:01 am

Hi Marko,

If there is a difference between compiled mode and processed mode, there is a bug. The only question that remains is whether it's a compilation bug or a processing bug.

From my understanding, the delimiter should be executed at the end of a pass through a loop and not in the beginning of the next pass. That implies that $index is the same through the whole pass which in turn implies the bug is in compiled mode.

Hans
http://blog.hansmelis.be

Marko Žmak

Sunday 22 January 2006 10:37:55 am

I reported this as a bug:

http://ez.no/bugs/view/7719

--
Nothing is impossible. Not if you can imagine it!

Hubert Farnsworth

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.