Twig icon indicating copy to clipboard operation
Twig copied to clipboard

Issue with |default

Open adamrgray opened this issue 3 years ago • 0 comments

{% 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 ?

Twig v2.x & v3.0

adamrgray avatar Jul 14 '22 11:07 adamrgray