Actions
Bug #88440
openRecursive calls to section with nested viewhelper yield unexpected results
Status:
New
Priority:
Should have
Assignee:
-
Category:
Fluid
Target version:
-
Start date:
2019-05-26
Due date:
% Done:
0%
Estimated time:
TYPO3 Version:
10
PHP Version:
Tags:
Complexity:
Is Regression:
Sprint Focus:
Description
Consider the following fluid template:
<f:section name="Test"> <f:link.external uri="{testVar}"> {testVar} <f:if condition="{testVar} == 'outer'"> <f:render section="Test" arguments="{testVar: 'inner'}" /> </f:if> </f:link.external> </f:section> <f:render section="Test" arguments="{testVar: 'outer'}" />
Normally, you would expect it to render as follows:
<a href="http://outer"> outer <a href="http://inner"> inner </a> </a>
But it renders like this instead:
<a href="http://inner"> outer <a href="http://inner"> inner </a> </a>
The reason seems to be that Fluid reuses view helper instances, so the two usages of f:link.external are effectively the same instance, overwriting the arguments.
Do note that the f:link.external is just an example and obviously does not make much sense (in practical terms), but it was just one of the few view helpers that wrap something (condition for this bug to trigger - the recursive call has to be inside the viewhelper content) that I found in core fluid. I usually encounter this issue when rendering menus recursively.
No data to display
Actions