Both statements are wrong, since the purpose of the filter extension
is to validate strings. I found this information in BR #52884 (see
last comment). Maybe it should be added to the docs? It's nonsense to
say, that FILTER_VALIDATE_INT must work like var_dump() since they
are both serving different purposes.
With this information I agree on your opinion.
var_dump(filter_var('-0',FILTER_VALIDATE_INT)); // int(0) instead of
the prior bool(false) var_dump('-0'); // string(2) "-0"
var_dump(is_int('-0')); // bool(false)
var_dump does not attempt to convert a string into an integer when
possible. FILTER_VALIDATE_INT does. This is much more analagous to
FILTER_VALIDATE_INT IMO.
$ php -r "echo (is_numeric('-0')) ? (int)'-0' : null;"
0
I am not intimately familiar with the internals of filter, but I
replaced code in userland like this with filter calls.
Brian Moon
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php