You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Create a Fluid Template containing a simple f:switch:
<f:switchexpression="1"><f:casevalue="1">
Case 1<br><f:renderpartial="Test" arguments="{val: 1}" /></f:case><f:defaultCase>
Default 1<br></f:defaultCase></f:switch>
Create Partial Test:
<f:switchexpression="{val}"><f:casevalue="2">
Case 2
</f:case><f:defaultCase>
Default 2
<f:renderpartial="Test" arguments="{val: 2}" /></f:defaultCase></f:switch>
Expected output:
Case 1 Default 2 Case 2
Actual output:
Default 1
This happens because in the ViewHelperVariableContainer the break variable of the OriginalSwitchViewHelper is getting overridden.
I have tried the following permutations of ViewHelpers. Note: Render2 is another partial called Test2.
No Errors:
Switch -> Case -> Switch -> Case
Switch -> Case -> Switch -> Default
Switch -> Default -> Switch -> Case
Switch -> Default -> Switch -> Default
Switch -> Case -> Switch -> Case -> Switch -> Case
Switch -> Case -> Switch -> Case -> Switch -> Default
Switch -> Case -> Render -> Switch -> Case
Switch -> Case -> Render -> Switch -> Default
Switch -> Default -> Render -> Switch -> Case
Switch -> Default -> Render -> Switch -> Default
Switch -> Case -> Render -> Render2 -> Switch -> Case
Switch -> Case -> Render -> Render2 -> Switch -> Default
Switch -> Case -> Render -> Render -> Case
Switch -> Case -> Render -> Render -> Default
Switch -> Case -> Render -> Switch -> Case -> Render -> Switch -> Case
Switch -> Case -> Render -> Switch -> Case -> Render -> Switch -> Default
Switch -> Case -> Render -> Switch -> Case -> Render2 -> Switch -> Case
Switch -> Case -> Render -> Switch -> Case -> Render2 -> Switch -> Default
Switch -> Case -> Render -> Switch -> Default -> Render2 -> Switch -> Case
Switch -> Case -> Render -> Switch -> Default -> Render2 -> Switch -> Default
The following parmutations produce the error:
Switch -> Case -> Render -> Switch -> Default -> Render -> Switch -> Case
Switch -> Case -> Render -> Switch -> Default -> Render -> Switch -> Default
Now the funny part begins. This permutations produces the expected output:
Switch -> Case -> Render -> If -> Then -> Switch -> Default -> Render -> If -> Else -> Switch -> Case
Here is the fluid content for partial 'Test' for this permutation:
<f:ifcondition="{val} != 2"><f:then><f:switchexpression="{val}"><f:casevalue="2">
Case 2
</f:case><f:defaultCase>
Default 2
<f:renderpartial="Test" arguments="{val: 2}" /></f:defaultCase></f:switch></f:then><f:else><f:switchexpression="1"><f:casevalue="1">
Case 3
</f:case><f:defaultCase>Default 3</f:defaultCase></f:switch></f:else></f:if>
But the following variant prduces the error:
Switch -> Case -> Render -> If -> Then -> Switch -> Default -> Render -> If -> Then -> Switch -> Case
<f:ifcondition="{val} != 2"><f:then><f:switchexpression="{val}"><f:casevalue="3">
Case 2
</f:case><f:defaultCase>
Default 2
<f:renderpartial="Test" arguments="{val: 3}" /></f:defaultCase></f:switch></f:then><f:else><f:switchexpression="1"><f:casevalue="1">
Case 3
</f:case><f:defaultCase>Default 3</f:defaultCase></f:switch></f:else></f:if>
It seems that it has something to do with equal instances of the switch ViewHelper. So I tried the following code inside a partial (the template only renders the partial with val=1, without any other code in it):
Render -> Switch -> Case -> Render -> Switch -> Default -> Render -> Switch -> Case
<f:switchexpression="{val}"><f:casevalue="1">
Case 1
<f:renderpartial="Test" arguments="{val: 3}" /></f:case><f:casevalue="2">
Case 2
</f:case><f:defaultCase>
Default 1
<f:renderpartial="Test" arguments="{val: 2}" /></f:defaultCase></f:switch>
Expected output:
Case 1 Default 1 Case 2
Actual output:
Default 1 Case 2
Again, this permutations work:
Render -> Switch -> Case -> Render-> Switch -> Default
Render -> Switch -> Case -> Render -> Switch -> Case -> Render -> Switch -> Default
Adding another Rendering with switch/case to the non working example produces the expected output again:
Render -> Switch -> Case -> Render -> Switch -> Default -> Render -> Switch -> Case -> Switch -> Case
<f:switchexpression="{val}"><f:casevalue="1">
Case 1
<f:renderpartial="Test" arguments="{val: 3}" /></f:case><f:casevalue="2">
Case 2
<f:renderpartial="Test" arguments="{val: 4}" /></f:case><f:casevalue="4">
Case 3
</f:case><f:defaultCase>
Default 1
<f:renderpartial="Test" arguments="{val: 2}" /></f:defaultCase></f:switch>
Expected and actual output:
Case 1 Default 1 Case 2 Case 3
The text was updated successfully, but these errors were encountered:
Me too.
Could this be a duplicate of this report? #428
in my case I get an exception saying
Fluid parse error in template partial_List/Cards-Item-TextOverlay_2dfc4d21e136809d3560113a54808794ca8636d8, line 10 at character 42. Error: You closed a templating tag which you never opened! (error code 1224485838). Template source chunk: </f:case>
This is a copy of https://forge.typo3.org/issues/86425
Setup:
Create a Fluid Template containing a simple f:switch:
Create Partial Test:
Expected output:
Case 1 Default 2 Case 2
Actual output:
Default 1
This happens because in the ViewHelperVariableContainer the
break
variable of the OriginalSwitchViewHelper is getting overridden.I have tried the following permutations of ViewHelpers. Note: Render2 is another partial called Test2.
No Errors:
Switch -> Case -> Switch -> Case
Switch -> Case -> Switch -> Default
Switch -> Default -> Switch -> Case
Switch -> Default -> Switch -> Default
Switch -> Case -> Switch -> Case -> Switch -> Case
Switch -> Case -> Switch -> Case -> Switch -> Default
Switch -> Case -> Render -> Switch -> Case
Switch -> Case -> Render -> Switch -> Default
Switch -> Default -> Render -> Switch -> Case
Switch -> Default -> Render -> Switch -> Default
Switch -> Case -> Render -> Render2 -> Switch -> Case
Switch -> Case -> Render -> Render2 -> Switch -> Default
Switch -> Case -> Render -> Render -> Case
Switch -> Case -> Render -> Render -> Default
Switch -> Case -> Render -> Switch -> Case -> Render -> Switch -> Case
Switch -> Case -> Render -> Switch -> Case -> Render -> Switch -> Default
Switch -> Case -> Render -> Switch -> Case -> Render2 -> Switch -> Case
Switch -> Case -> Render -> Switch -> Case -> Render2 -> Switch -> Default
Switch -> Case -> Render -> Switch -> Default -> Render2 -> Switch -> Case
Switch -> Case -> Render -> Switch -> Default -> Render2 -> Switch -> Default
The following parmutations produce the error:
Switch -> Case -> Render -> Switch -> Default -> Render -> Switch -> Case
Switch -> Case -> Render -> Switch -> Default -> Render -> Switch -> Default
Now the funny part begins. This permutations produces the expected output:
Switch -> Case -> Render -> If -> Then -> Switch -> Default -> Render -> If -> Else -> Switch -> Case
Here is the fluid content for partial 'Test' for this permutation:
But the following variant prduces the error:
Switch -> Case -> Render -> If -> Then -> Switch -> Default -> Render -> If -> Then -> Switch -> Case
It seems that it has something to do with equal instances of the switch ViewHelper. So I tried the following code inside a partial (the template only renders the partial with val=1, without any other code in it):
Render -> Switch -> Case -> Render -> Switch -> Default -> Render -> Switch -> Case
Expected output:
Case 1 Default 1 Case 2
Actual output:
Default 1 Case 2
Again, this permutations work:
Render -> Switch -> Case -> Render-> Switch -> Default
Render -> Switch -> Case -> Render -> Switch -> Case -> Render -> Switch -> Default
Adding another Rendering with switch/case to the non working example produces the expected output again:
Render -> Switch -> Case -> Render -> Switch -> Default -> Render -> Switch -> Case -> Switch -> Case
Expected and actual output:
Case 1 Default 1 Case 2 Case 3
The text was updated successfully, but these errors were encountered: