Project

General

Profile

Actions

Bug #81530

closed

Condition evaluation for <f:if> viewhelper fails in inline notation

Added by Michael Stopp over 7 years ago. Updated over 7 years ago.

Status:
Closed
Priority:
Must have
Assignee:
-
Category:
Fluid
Target version:
-
Start date:
2017-06-09
Due date:
% Done:

0%

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

Description

In Fluid 8.7.0, checking if a DateTime property of an object is set, throws an exception if used in the inline notation. One should expect identical output for the following two cases:

<f:if condition="{payment.paidDate}">
    <f:then>set</f:then>
    <f:else>not set</f:else>
</f:if>
{f:if(condition: '{payment.paidDate}', then: 'set', else: 'not set')}

The first version correctly evaluates, if the property is set or not.

The second version results in an uncaught TYPO3 exception:

htmlspecialchars() expects parameter 1 to be string, object given

This used to work in Fluid 6.2.0.

Actions #1

Updated by Michael Stopp over 7 years ago

  • Priority changed from Should have to Must have
Actions #2

Updated by Michael Stopp over 7 years ago

  • Description updated (diff)
Actions #3

Updated by Georg Ringer over 7 years ago

  • Status changed from New to Needs Feedback

please use
{f:if(condition: payment.paidDate, then: 'set', else: 'not set')}, otherwise you are casting the paidDate to a string by using the single quotes. that should work fine.

Actions #4

Updated by Michael Stopp over 7 years ago

Yes, it does work without the single quotes. But I guess in any case, where you need some kind of comparison operator, you will have to use the single quotes, as the condition expression as a whole will be parsed as a string. Thus any DateTime object will have to be formatted as a string, e.g. {payment.dueDate->f:format.date(format:'Ymd')}, correct?

Actions #6

Updated by Michael Stopp over 7 years ago

Yes, you're right. I think this issue could be closed now.

Actions #7

Updated by Riccardo De Contardi over 7 years ago

  • Status changed from Needs Feedback to Closed

@Michael Stopp thank you for your feedback! Closing.

Actions

Also available in: Atom PDF