Project

General

Profile

Actions

Bug #83812

closed

Fluid-If-Conditions with conjunctions not working for countables

Added by Peter Rauber about 6 years ago. Updated over 5 years ago.

Status:
Closed
Priority:
Must have
Assignee:
-
Category:
Fluid
Target version:
Start date:
2018-02-08
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
8
PHP Version:
Tags:
Complexity:
Is Regression:
Yes
Sprint Focus:

Description

Fluid-If-Conditions that evalutates empty countable-objects treat them as "true" when used in a conjunction (&& or ||). When evaluated alone, they are correctly evaluated to false.

This seems to be a small bug, but it has huge effects after we rolled out TYPO3 8.7.10 as we often use the inline-if-viewhelper to generate class-names.

It happens in fluid-templates like this:

<f:if condition="{canBeCounted} || {false}">
    <f:then>
        <p><strong>Wrong: empty canBeCounted or false evaluates to true</strong></p>
    </f:then>
    <f:else>
        <p>Correct: empty canBeCounted or false evaluates to false</p>
    </f:else>
</f:if>
<h2>Inline-Version</h2>
<p>canBeCounted or false: {f:if(condition:'{canBeCounted} || {false}',then:'<strong>Wrong: true</strong>',else:'Correct: false')}</p>

In both examples (inline and not inline) it happens. In 8.7.9 (and before) the inline-code worked correctly, but the not-inline-version also failed.

To easily reproduce this bug, I attached a small demo-extension that shows what is happening. The output looks like this to me:
In TYPO3 8.7.10:

In TYPO3 8.7.9:


Files

nezzotest8710.zip (3.18 KB) nezzotest8710.zip Peter Rauber, 2018-02-08 16:29
8-7-9.png (48.2 KB) 8-7-9.png Peter Rauber, 2018-02-08 16:31
8-7-10.png (47.7 KB) 8-7-10.png Peter Rauber, 2018-02-08 16:31
Actions

Also available in: Atom PDF