Fluid icon indicating copy to clipboard operation
Fluid copied to clipboard

Bug: f:else inside f:else always executed

Open linawolf opened this issue 1 year ago • 1 comments

TYPO3 11.5 - 13.4

I would have expected, the following would give me an error:

<f:if condition="{link.link_icon_custom}">
	<f:then>
		<span class="link-icon"><i class="{link.link_icon_custom}"></i></span>
	</f:then>
	<f:else>
		<f:if condition="{link.link_icon}">
			<span class="link-icon"><i class="{link.link_icon}"></i></span>
		</f:if>
		<f:else>
			<span class="link-icon"><i class="fas fa-chevron-double-right"></i></span>
		</f:else>
	</f:else>
</f:if>

However the inner else is not only executed but always executed.

linawolf avatar Nov 28 '24 12:11 linawolf

Notice that the error is not exactly the f:else within f:else but that the 2nd one is not within the 2nd f:if. This would be perfectly valid:

<f:if condition="{link.link_icon_custom}">
	<f:then>
		<span class="link-icon"><i class="{link.link_icon_custom}"></i></span>
	</f:then>
	<f:else>
		<f:if condition="{link.link_icon}">
			<f:then>
				<span class="link-icon"><i class="{link.link_icon}"></i></span>
			</f:then>
			<f:else>
				<span class="link-icon"><i class="fas fa-chevron-double-right"></i></span>
			</f:else>
		</f:if>
	</f:else>
</f:if>

(Yes, this could be optimized to use f:else if="...".)

mbrodala avatar Nov 28 '24 13:11 mbrodala