Skip to content

Suggestion for Twig 4: Change the |default() filter to respect false #4716

@ThomasLandauer

Description

@ThomasLandauer

{{ false|default(true) }} gives true, since default() obviously treats false just like null or undefined.
It's documented at https://twig.symfony.com/doc/3.x/filters/default.html, but still weird ;-)

I just wanted to add this to the wishlist for Twig 4, but the thread at #3951 is already closed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions