Bug #4051

TagBuilder is not resetted when a view helper is initialized multiple times

Added by Bastian Waidelich about 13 years ago. Updated almost 12 years ago.

Status:
Resolved
Priority:
Must have
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

4051.patch (3.62 KB) 4051.patch Bastian Waidelich, 2009-07-29 14:01

Related issues

Related to TYPO3.Fluid - Bug #3994: Viewhelpers are instanciated multiple times in ViewHelperNodeResolvedSebastian Kurfuerst2009-07-27

Actions
#1

Updated by Bastian Waidelich about 13 years ago

  • File 4051.patch 4051.patch added
  • Status changed from New to Needs Feedback
  • Assignee set to Robert Lemke

The attached patch fixes the issue for me.
Robert Lemke: Please have a look and commit if there are no objections

#2

Updated by Robert Lemke about 13 years ago

  • Target version set to 1.0.0 alpha 3
#3

Updated by Bastian Waidelich almost 13 years ago

  • Assignee changed from Robert Lemke to Bastian Waidelich
#4

Updated by Bastian Waidelich almost 13 years ago

  • Status changed from Needs Feedback to Resolved
  • % Done changed from 0 to 100

Applied in changeset r3119.

#5

Updated by Robert Lemke almost 13 years ago

  • Target version changed from 1.0.0 alpha 3 to 1.0.0 alpha 4

Also available in: Atom PDF