Bug #81530
closedCondition evaluation for <f:if> viewhelper fails in inline notation
0%
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.
Updated by Michael Stopp over 7 years ago
- Priority changed from Should have to Must have
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.
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?
Updated by Riccardo De Contardi over 7 years ago
this kind of thing has been documented here: https://docs.typo3.org/typo3cms/Snippets/2017/Index.html#fluid-inline-syntax-how-to-pass-arguments-to-viewhelpers am I right?
Updated by Michael Stopp over 7 years ago
Yes, you're right. I think this issue could be closed now.
Updated by Riccardo De Contardi over 7 years ago
- Status changed from Needs Feedback to Closed
@Michael Stopp thank you for your feedback! Closing.