Bug #79694
closedPHP warning on using inline Fluid syntax with object
0%
Description
Using the tag-based view-helper <f:format.date date="{user.dateOfBirth}" />
works like a charm.
However, using {f:format.date(date:'{user.dateOfBirth}')}
leads to the following PHP warning:
The property dateOfBirth
is a \DateTime
object in this example.
#1476107295: PHP Warning: htmlspecialchars() expects parameter 1 to be string, object given in ~/vendor/typo3fluid/fluid/src/Core/Parser/SyntaxTree/EscapingNode.php line 45
Working on dev-master with commit 12fd6b6ae7a14ca22d9f0cfa6cf9bcaa62046f4a
Updated by Oliver Hader almost 8 years ago
- Sprint Focus set to Stabilization Sprint
Updated by Georg Ringer almost 8 years ago
however using something like {f:format.date(date:newsItem.datetime)}
(without single quotes) works fine
Updated by Claus Due almost 8 years ago
This 5-minute video explains why and how to avoid it: https://vimeo.com/167666466
TL;DR: `'{variable}'` is the same as `(string) $variable` in PHP.
Updated by Georg Ringer almost 8 years ago
- Status changed from New to Needs Feedback
should we close it then?
Updated by Claus Due over 7 years ago
I would close this as "by design". Hopefully people will catch on that this intentional wrapping in TextNode implies you absolutely want a string value.
Updated by Riccardo De Contardi over 7 years ago
- Status changed from Needs Feedback to Closed
Closing it as suggested by Claus Due and in agreement with the issue reporter.
@todo: mention this (IMHO useful) information in the documentation