Bug #29004

if viewhelper does not evaluate conditions correctly

Added by Manuel Stofer almost 4 years ago. Updated almost 4 years ago.

Status:Closed Start date:2011-08-16
Priority:Must have Due date:
Assigned To:Bastian Waidelich % Done:

0%

Category:Core
Target version:-
Has patch:No Affected Flow version:

Description

Actually the if viewhelper just typecasts the parameter 'condition' to boolean
which is not what you expect when you read the comments in the header.

In the header of IfViewhelper.php you can find examples like:
<f:if condition="{rank} % 2">
Will be shown if rank % 2 != 0.
</f:if>

But when you do something like this:

<f:if condition="4 % 2">
4 % 2 != 0
</f:if>

<f:if condition="4 5">
4 5
</f:if>

Fluid outputs:

4 % 2 != 0
4 == 5


Related issues

duplicates TYPO3.Fluid - Feature #26665: Fluid: Implement String comparison Resolved 2010-03-10

History

#1 Updated by Manuel Stofer almost 4 years ago

and forge does not escape correct :)

was supposed to be

<f:if condition="4 equals 5">
4 equals 5
</f:if>

( equals = '==' )

#2 Updated by Bastian Waidelich almost 4 years ago

  • Category set to Core
  • Status changed from New to Closed
  • Assigned To set to Bastian Waidelich

Hi,

the actual issue is, that you can't compare two literals at the moment (see #26665).
1<f:if condition="{someNumber} % 2">
should work as expected.

Also available in: Atom PDF