Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:25956 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 85617 invoked by uid 1010); 5 Oct 2006 23:46:13 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 85602 invoked from network); 5 Oct 2006 23:46:12 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 5 Oct 2006 23:46:12 -0000 Authentication-Results: pb1.pair.com smtp.mail=php_lists@realplain.com; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=php_lists@realplain.com; sender-id=unknown Received-SPF: error (pb1.pair.com: domain realplain.com from 209.142.136.132 cause and error) X-PHP-List-Original-Sender: php_lists@realplain.com X-Host-Fingerprint: 209.142.136.132 msa2-mx.centurytel.net Linux 2.4/2.6 Received: from [209.142.136.132] ([209.142.136.132:33302] helo=msa2-mx.centurytel.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id E2/B6-41556-44995254 for ; Thu, 05 Oct 2006 19:46:12 -0400 Received: from pc1 (69-29-175-208.dyn.centurytel.net [69.29.175.208]) by msa2-mx.centurytel.net (8.13.6/8.13.6) with SMTP id k95Nk8Rx007082; Thu, 5 Oct 2006 18:46:08 -0500 Message-ID: <003601c6e8d8$6e81fb30$0201a8c0@pc1> To: , "Andrei Zmievski" References: <016201c6e0ae$a5011240$0201a8c0@pc1> <00e301c6e85b$4ed2e5b0$0201a8c0@pc1> <754cd73041a5eb071a86d6ae0e84eb9a@gravitonic.com> Date: Thu, 5 Oct 2006 18:46:08 -0500 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2800.1807 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1807 Subject: Re: [PHP-DEV] [PATCH] Small typo in zend_u_strtol From: php_lists@realplain.com ("Matt W") Hi Andrei, ----- Original Message ----- From: "Andrei Zmievski" Sent: Thursday, October 05, 2006 > Are you sure this is correct? I copied the source from BSD strtol > implementation. > > http://www.freebsd.org/cgi/cvsweb.cgi/src/lib/libc/stdlib/strtol.c? > rev=1.19&content-type=text/x-cvsweb-markup Well, copied but modified for Unicode use... like half the for loop is changed. In BSD's case, the value of '0', etc. is subtracted from "c" variable, so it then has the actual numeric value of the digit. But PHP's puts the actual numeric value in "val" from u_digit(). "c" is still too high by '0' 's value (48?). Finally, their "acc += c" was changed to "acc += val" for that reason. If PHP's had kept "c" *there*, the problem would've been discovered fast. :-) Do you see the problem in the examples I gave? Numbers between 2147483640 and 2147483647 incorrectly set ERANGE, along with similar negative values. > -Andrei Matt > On Oct 5, 2006, at 1:50 AM, Matt W wrote: > > > Hi, > > > > Was this missed? I'm sure you want to fix it. :-) Maybe should've put > > "bug" instead of "typo" in the subject... > > > > Just also sending to you Andrei since it's Unicode related. > > > > Patch was an attachment: http://news.php.net/php.internals/25820