Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:65628 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 8647 invoked from network); 4 Feb 2013 11:14:56 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 4 Feb 2013 11:14:56 -0000 Authentication-Results: pb1.pair.com header.from=Frank.Liepert@gmx.de; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=frank.liepert@gmx.de; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmx.de designates 212.227.15.18 as permitted sender) X-PHP-List-Original-Sender: frank.liepert@gmx.de X-Host-Fingerprint: 212.227.15.18 mout.gmx.net Received: from [212.227.15.18] ([212.227.15.18:55730] helo=mout.gmx.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id ED/55-14611-F289F015 for ; Mon, 04 Feb 2013 06:14:56 -0500 Received: from mailout-de.gmx.net ([10.1.76.24]) by mrigmx.server.lan (mrigmx002) with ESMTP (Nemesis) id 0Lb7El-1UhjYj0oaf-00kiO8 for ; Mon, 04 Feb 2013 12:14:52 +0100 Received: (qmail invoked by alias); 04 Feb 2013 11:14:52 -0000 Received: from p549B356B.dip.t-dialin.net (EHLO FrankNotebook) [84.155.53.107] by mail.gmx.net (mp024) with SMTP; 04 Feb 2013 12:14:52 +0100 X-Authenticated: #18131098 X-Provags-ID: V01U2FsdGVkX19HjJIg+w5HuIGVyZnQFwRZYB26HfJzRz7sUc3X58 1+4iz+Akag9Ubw To: "'Patrick Schaaf'" , Cc: "'Derick Rethans'" , "'Martin Jansen'" References: <510EA95F.40503@divbyzero.net> <2835262.zO39iNXCyM@rofl> In-Reply-To: <2835262.zO39iNXCyM@rofl> Date: Mon, 4 Feb 2013 12:14:50 +0100 Message-ID: <002d01ce02c8$dbb6d430$93247c90$@Liepert@gmx.de> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Mailer: Microsoft Office Outlook 12.0 Thread-Index: Ac4CvSmUkhSLAPtoTtOsZwL2jZjLwwABq/5w Content-Language: de X-Y-GMX-Trusted: 0 Subject: AW: [PHP-DEV] FILTER_VALIDATE_INT and +0/-0 From: Frank.Liepert@gmx.de ("Frank Liepert") The change to FILTER_VALIDATE_INT seems to be inconsistent. First of all, take the following bug = (https://bugs.php.net/bug.php?id=3D54096) 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 =E2=84=A4 =3D {..., -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=3D42477) To sum it up:=20 - FILTER_VALIDATE_INT should never treat "+0" or "-0" as valid integers. - Instead, var_dump needs to be corrected.=20 - It could be even gone further in adding support for signed zero = arithmetic (see IEEE754). Kind regards, Frank -----Urspr=C3=BCngliche Nachricht----- Von: Patrick Schaaf [mailto:php@bof.de]=20 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.=20 > +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