Re: AW: [PHP-DEV] FILTER_VALIDATE_INT and +0/-0
| From: | Gustavo Lopes | Date: | Fri, 08 Feb 2013 20:19:46 +0000 |
| Subject: | Re: AW: [PHP-DEV] FILTER_VALIDATE_INT and +0/-0 | ||
| References: | 1 2 3 4 5 6 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-65730@lists.php.net to get a copy of this message | ||
On Fri, 08 Feb 2013 20:04:35 +0100, hakre <hanskrentel@yahoo.de> wrote:
----- Ursprüngliche Message -----By special case, I meant a deviation to the general rule on how the code handles the input. The code handles the characters 0-9 prefixed by an optional sign. The PLUS-MINUS SIGN -- or, for that matter, all the other numeric characters in the Unicode repertoire -- are irrelevant.Von: Gustavo Lopes <glopes@nebm.ist.utl.pt> So the question is only whether "+0" or "-0" (or "+0", etc.) should be accepted as integers by FILTER_VALIDATE_INT. I think they should, because we also accept non-canonical inputs such as "+5", i.e., we always accept a sign. It's true that 0 is neither positive or negative, but I don't think "accepts a leading sign, except if it's 0" is a good option. It's an unnecessary special case.A special case still left is "±0". It is with the 'PLUS-MINUS SIGN' (U+00B1).
It's an equally incorrect sign for the number 0 as "-" or "+" is incorrect. Available in internet standards ISO-8859-1 and more as "\xB1" (UTF-8 as "\xC2\xB1"), FILTER_VALIDATE_INT should reflect hidden dependency of input encoding here.I'm not sure what you're arguing for here. -- Gustavo Lopes