Recursive calls to section with nested viewhelper yield unexpected results
Duplicate of https://forge.typo3.org/issues/88440, still confirmed in v14
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.
Thanks! I was able to reproduce it in a test. Currently, cached templates behave correctly, but uncached templates have the unwanted behavior you describe.