[php-src] Issue #7894: filter_var("false", FILTER_VALIDATE_BOOL returns the set default value
| From: | TobiGr | Date: | Tue, 11 Jan 2022 08:34:50 +0000 |
| Subject: | [php-src] Issue #7894: filter_var("false", FILTER_VALIDATE_BOOL returns the set default value | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-238956@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/7894
Comment Author: TobiGr
I am sorry to bother you again, but I looked deeper into the issue and still got return values which
I do not expect.
``` php
var_dump(filter_var(null, FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE));
var_dump(filter_var(null, FILTER_VALIDATE_BOOLEAN, ['options' => ['default'
=> 2], 'flags' => FILTER_NULL_ON_FAILURE]));
```
results in
```
bool(false)
bool(false)
```
although the docs say
> If FILTER_NULL_ON_FAILURE is set, false is returned only for "0", "false",
> "off", "no", and "", and
null is
> returned for all non-boolean values.