Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:50168 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 35274 invoked from network); 12 Nov 2010 10:49:54 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 12 Nov 2010 10:49:54 -0000 Authentication-Results: pb1.pair.com header.from=cschneid@cschneid.com; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=cschneid@cschneid.com; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain cschneid.com from 195.226.6.51 cause and error) X-PHP-List-Original-Sender: cschneid@cschneid.com X-Host-Fingerprint: 195.226.6.51 darkcity.gna.ch Linux 2.6 Received: from [195.226.6.51] ([195.226.6.51:34541] helo=mail.gna.ch) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 8D/A1-12252-0DB1DDC4 for ; Fri, 12 Nov 2010 05:49:54 -0500 Received: from localhost (localhost [127.0.0.1]) by darkcity.gna.ch (Postfix) with ESMTP id 97233848D8; Fri, 12 Nov 2010 11:46:58 +0100 (CET) X-Virus-Scanned: amavisd-new at gna.ch Received: from mail.gna.ch ([127.0.0.1]) by localhost (darkcity.gna.ch [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id wqhfjJcwrNlP; Fri, 12 Nov 2010 11:46:43 +0100 (CET) Received: from [10.0.1.5] (178-83-161-240.dclient.hispeed.ch [178.83.161.240]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by darkcity.gna.ch (Postfix) with ESMTPSA id 3F430849A7; Fri, 12 Nov 2010 11:46:43 +0100 (CET) Mime-Version: 1.0 (Apple Message framework v1082) Content-Type: text/plain; charset=us-ascii X-Priority: 3 In-Reply-To: Date: Fri, 12 Nov 2010 11:49:33 +0100 Cc: "PHP internals" Content-Transfer-Encoding: quoted-printable Message-ID: <98CEEC3C-84D8-49FA-829C-BCC774395417@cschneid.com> References: <3667608E-11C3-43B8-B652-CDEF46F87CE5@cschneid.com> To: Stan Vass X-Mailer: Apple Mail (2.1082) Subject: Re: [PHP-DEV] Re: Supporting Binary Notation for Integers From: cschneid@cschneid.com (Christian Schneider) Am 12.11.2010 um 09:22 schrieb Stan Vass: > With regards to parsing numeric strings, only decimal is supported, = and in some cases (unfortunately) hexadecimal, like your comparing = example. But octal is not supported in strings, and neither should = binary. >=20 > 0xF =3D=3D 15 // true > '0xF' =3D=3D 15 // true > 010 =3D=3D 8 // true > '010' =3D=3D 8 // false You're right. (Side-note: '010' =3D=3D 10 // true, i.e. is is parsed as = a decimal number) > It should be a important consideration that numeric string parsing = isn't affected by this patch, and things will be fine. If neither '0b1' =3D=3D 1 nor is_numeric('0b1') is true after this patch = then I see no problem. Sorry for not trying the patch first and assuming that it would be = similar to the other formats. > In fact it should be a separate discussion whether hex should work in = strings at all. It's very counterproductive when parsing user input. While you might be right this cannot be changed now as it would break = compatibility without big benefit. - Chris