Re: AW: [PHP-DEV] FILTER_VALIDATE_INT and +0/-0

From: Date: Fri, 08 Feb 2013 19:04:35 +0000
Subject: Re: AW: [PHP-DEV] FILTER_VALIDATE_INT and +0/-0
References: 1 2 3 4 5  Groups: php.internals 
Request: Send a blank email to internals+get-65729@lists.php.net to get a copy of this message
----- Ursprüngliche Message ----- > Von: Gustavo Lopes <glopes@nebm.ist.utl.pt> > An: 'Patrick Schaaf' <php@bof.de>; internals@lists.php.net; Frank Liepert > <Frank.Liepert@gmx.de> > CC: 'Derick Rethans' <derick@php.net>; 'Martin Jansen' > <martin@divbyzero.net> > Gesendet: 12:32 Montag, 4.Februar 2013 > Betreff: Re: AW: [PHP-DEV] FILTER_VALIDATE_INT and +0/-0 > > 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. My ±0*2 cents here. -- hakre

« previous php.internals (#65729) next »