#49510 [Opn->Bgs]: boolean validation fails with FILTER_NULL_ON_FAILURE
From: sjoerd@php.net Date: Wed, 09 Sep 2009 19:55:33 +0000 Subject: #49510 [Opn->Bgs]: boolean validation fails with FILTER_NULL_ON_FAILURE References: 1 Groups: php.bugs Request: Send a blank email to php-bugs+get-142180@lists.php.net to get a copy of this message
ID: 49510
Updated by: sjoerd@php.net
Reported By: m dot kurzyna at crystalpoint dot pl
-Status: Open
+Status: Bogus
Bug Type: Filter related
Operating System: Linux
PHP Version: 5.3.0
New Comment:
This is exactly according to the documentation:
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.
Note that "false" is in the list, but false is not. That is, the string
"false" will give a result, the boolean false will return null.
"Non-boolean" makes this a little bit confusing.
Note that the goal here is to convert a string to a boolean. Because
false is not a string, filter_var does not consider it valid input.
Previous Comments:
------------------------------------------------------------------------
[2009-09-09 11:25:29] m dot kurzyna at crystalpoint dot pl
Description:
------------
filter_var() when validating (boolean)false with FILTER_NULL_ON_FAILURE
returns null instead of false.
Reproduce code:
---------------
var_dump(
filter_var(false, FILTER_VALIDATE_BOOLEAN,
array("flags" => FILTER_NULL_ON_FAILURE)
)
);
Expected result:
----------------
false
Actual result:
--------------
null
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=49510&edit=1
Thread (16 messages)
- #49510 [Opn->Bgs]: boolean validation fails with FILTER_NULL_ON_FAILURE
- #49510 [Bgs]: boolean validation fails with FILTER_NULL_ON_FAILURE
- #49510 [Bgs->Asn]: boolean validation fails with FILTER_NULL_ON_FAILURE
- #49510 [Asn]: boolean validation fails with FILTER_NULL_ON_FAILURE
- #49510 [Asn]: boolean validation fails with FILTER_NULL_ON_FAILURE
- #49510 [Asn]: boolean validation fails with FILTER_NULL_ON_FAILURE
- #49510 [Asn]: boolean validation fails with FILTER_NULL_ON_FAILURE
- #49510 [Asn]: boolean validation fails with FILTER_NULL_ON_FAILURE
- Req #49510 [Com]: boolean validation fails with FILTER_NULL_ON_FAILURE
- Req #49510 [Com]: boolean validation fails with FILTER_NULL_ON_FAILURE
- Req #49510 [Asn]: boolean validation fails with FILTER_NULL_ON_FAILURE
- Req #49510 [Com]: boolean validation fails with FILTER_NULL_ON_FAILURE
- Req #49510 [Com]: boolean validation fails with FILTER_NULL_ON_FAILURE
- Req #49510 [Com]: boolean validation fails with FILTER_NULL_ON_FAILURE
- Req #49510 [Asn->Csd]: boolean validation fails with FILTER_NULL_ON_FAILURE
| « previous | php.bugs (#142180) | next » |
|---|