Bug #4051
TagBuilder is not resetted when a view helper is initialized multiple times
Status:
Resolved
Priority:
Must have
Assignee:
Category:
Core
Target version:
Start date:
2009-07-29
Due date:
% Done:
100%
Estimated time:
Has patch:
Description
Since r2895 ViewHelpers that belong to the same ViewHelperNode (inside loops) are only instantiated once. This leads to the side-effect, that $this->tag points to the same reference.
If a tag attribute is set it won't be resetted when initialize() is called.
Example:
<f:for each="{0:1, 1:2, 2:3, 3:4}" as="foo"> <f:link.action class="{f:if('odd' condition='{foo} % 2')}">{foo}</f:link.action> </f:for>
Expected result:
<a class="odd" href="viewhelpertest/standard">1</a> <a href="viewhelpertest/standard">2</a> <a class="odd" href="viewhelpertest/standard">3</a> <a href="viewhelpertest/standard">4</a>
Actual result:
<a class="odd" href="viewhelpertest/standard">1</a> <a class="odd" href="viewhelpertest/standard">2</a> <a class="odd" href="viewhelpertest/standard">3</a> <a class="odd" href="viewhelpertest/standard">4</a>
Solution:
Reset TagBuilder instance in initialize()
And we should check, whether there are more side-effects!
Files
Related issues