Suggestion for Twig 4: Change the `|default()` filter to respect `false`
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 8.4k
- Forks
- 1.3k
- Avg merge
- 1d 13h
- Merged PRs (30d)
- 37
Description
{{ 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 https://github.com/twigphp/Twig/issues/3951 is already closed.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
No implementation file or test is named. Start by reading the documented default() filter behavior and the closed issue #3951; clarify the intended Twig 4 semantics and acceptance criteria there before determining the affected code and tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- web-dev
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100