Bug #83812

Fluid-If-Conditions with conjunctions not working for countables

Added by Peter Rauber over 1 year ago. Updated 12 months ago.

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

100%

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:

nezzotest8710.zip (3.18 KB) Peter Rauber, 2018-02-08 16:29

8-7-9.png View (48.2 KB) Peter Rauber, 2018-02-08 16:31

8-7-10.png View (47.7 KB) Peter Rauber, 2018-02-08 16:31

Associated revisions

Revision b7d8f6db (diff)
Added by Christian Kuhn over 1 year ago

[BUGFIX] Update fluid from 2.5.2 to 2.5.3

composer update typo3fluid/fluid

This fixes a count bug in if conditions and
a template resolving issue.

Resolves: #83812
Releases: master, 8.7
Change-Id: Ie5845614ffeac50dc5a5796d587d61015c4f1059
Reviewed-on: https://review.typo3.org/56107
Reviewed-by: Oliver Hader <>
Tested-by: TYPO3com <>
Reviewed-by: Susanne Moog <>
Tested-by: Susanne Moog <>
Reviewed-by: Stefan Neufeind <>
Tested-by: Stefan Neufeind <>

Revision cd2eead7 (diff)
Added by Christian Kuhn over 1 year ago

[BUGFIX] Update fluid from 2.5.2 to 2.5.3

composer update typo3fluid/fluid

This fixes a count bug in if conditions and
a template resolving issue.

Resolves: #83812
Releases: master, 8.7
Change-Id: Ie5845614ffeac50dc5a5796d587d61015c4f1059
Reviewed-on: https://review.typo3.org/56106
Tested-by: TYPO3com <>
Reviewed-by: Oliver Hader <>
Reviewed-by: Susanne Moog <>
Tested-by: Susanne Moog <>
Reviewed-by: Stefan Neufeind <>
Tested-by: Stefan Neufeind <>

History

#1 Updated by Mathias Schreiber over 1 year ago

  • Is Regression set to Yes

#2 Updated by Mario Rimann over 1 year 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 1 year ago

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

#4 Updated by Susanne Moog over 1 year ago

  • Target version set to 8.7.11

#5 Updated by Oliver Hader over 1 year 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 1 year 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 1 year 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 1 year ago

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

#9 Updated by Benni Mack 12 months ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF