The change to FILTER_VALIDATE_INT seems to be inconsistent. First of all, take the following bug (https://bugs.php.net/bug.php?id=54096) where it says "PHP defines -0 as an int.". Where does PHP define it? The documentation says: "An integer is a number of the set ℤ = {..., -2, -1, 0, 1, 2, ...}."
Secondly, try the following code: var_dump(round(-0.1)); What is the result? Surprise: float(-0) And it is not a bug (https://bugs.php.net/bug.php?id=42477) To sum it up: - FILTER_VALIDATE_INT should never treat "+0" or "-0" as valid integers. - Instead, var_dump needs to be corrected. - It could be even gone further in adding support for signed zero arithmetic (see IEEE754). Kind regards, Frank -----Ursprüngliche Nachricht----- Von: Patrick Schaaf [mailto:p...@bof.de] Gesendet: Montag, 4. Februar 2013 10:51 An: internals@lists.php.net Cc: Derick Rethans; Martin Jansen Betreff: Re: [PHP-DEV] FILTER_VALIDATE_INT and +0/-0 > +0 and -0 don't make sense for integers, where there is only 0. > +Allowing > only 0 was on purpose. +0 and -0 are accepted by sscanf('%d'), intval(), and (int). +0 is produced by sprintf('%+d') Thus, the change to FILTER_VALIDATE_INT seems to make sense. best regards Patrick -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php