Bug #83812

Fluid-If-Conditions with conjunctions not working for countables

Added by Peter Rauber over 3 years ago. Updated about 3 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
#1

Updated by Mathias Schreiber over 3 years ago

  • Is Regression set to Yes
#2

Updated by Mario Rimann over 3 years ago

There was a conversation with one of the Fluid developers on Twitter regarding this issue: https://twitter.com/NamelessCoder/status/960926691190288384

And there's a pull-request for Fluid, that adds tests for this issue, in the hope that this regression can be fixed faster with that.

#3

Updated by Oliver Hader over 3 years ago

https://github.com/TYPO3/Fluid/pull/370 containing test case in PR

#4

Updated by Susanne Moog over 3 years ago

  • Target version set to 8.7.11
#5

Updated by Oliver Hader over 3 years ago

  • Status changed from New to Accepted

Merged in https://github.com/TYPO3/Fluid/pull/380
Next step is to release new Fluid version and adjust composer.lock in in Core

#6

Updated by Gerrit Code Review over 3 years ago

  • Status changed from Accepted to Under Review

Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/56106

#7

Updated by Gerrit Code Review over 3 years ago

Patch set 1 for branch TYPO3_8-7 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/56107

#8

Updated by Christian Kuhn over 3 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100
#9

Updated by Benni Mack about 3 years ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF