You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{% set x = null %}
{{ dump(x|default()) }} => outputs an empty string
{{ dump(x|default(null)) }} => outputs null
{{ dimp(y|default()) }} => outputs null
|default and |default() are expected to be synonymous with |default(null), so one would not expect to specify the null but why would |default of a defined variable with a null value output an empty string ?
This discussion was converted from issue #3723 on December 26, 2022 16:46.
Heading
Bold
Italic
Quote
Code
Link
Numbered list
Unordered list
Task list
Attach files
Mention
Reference
Menu
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
|default
and|default()
are expected to be synonymous with|default(null)
, so one would not expect to specify thenull
but why would|default
of a defined variable with a null value output an empty string ?Twig v2.x & v3.0
Beta Was this translation helpful? Give feedback.
All reactions