I think I found a bug in PHP 5.4.23, but I suppose it is possible expected behavior as well. I am expecting a filter_var call to return null
, but it isn't. Is this code correct, and is my assumption that this is a bug and not a recent change correct as well?
Test code
var_dump(filter_var(null, FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE));
PHP 5.3.28 Results:
NULL
PHP 5.4.23 Results:
bool(false)
Bug #49510: Boolean validation fails with FILTER_NULL_ON_FAILURE with empty string or false.
– Solenoid