Bug #83812
closedFluid-If-Conditions with conjunctions not working for countables
100%
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
Updated by Mario Rimann almost 7 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.
Updated by Oliver Hader over 6 years ago
https://github.com/TYPO3/Fluid/pull/370 containing test case in PR
Updated by Oliver Hader over 6 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
Updated by Gerrit Code Review over 6 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
Updated by Gerrit Code Review over 6 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
Updated by Christian Kuhn over 6 years ago
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
Applied in changeset b7d8f6db5da358881bd9d4095b12468c0dbdff4f.