ID:               49510
 Updated by:       sjo...@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

Reply via email to