Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:43391 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 60772 invoked from network); 18 Mar 2009 15:05:26 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 18 Mar 2009 15:05:26 -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.151.69.1 cause and error) X-PHP-List-Original-Sender: php_lists@realplain.com X-Host-Fingerprint: 209.151.69.1 liberty.vosn.net Linux 2.4/2.6 Received: from [209.151.69.1] ([209.151.69.1:48792] helo=liberty.vosn.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 55/9D-26222-5BD01C94 for ; Wed, 18 Mar 2009 10:05:26 -0500 Received: from 72-161-148-24.dyn.centurytel.net ([72.161.148.24]:54534 helo=pc1) by liberty.vosn.net with smtp (Exim 4.69) (envelope-from ) id 1LjxKa-0004hf-PG; Wed, 18 Mar 2009 09:05:21 -0600 Message-ID: <12E613FAA1C9422B948F00B61AD32366@pc1> To: , "Dmitry Stogov" Cc: "Lukas Kahwe Smith" , =?iso-8859-1?Q?Johannes_Schl=FCter?= References: <1113CE12226949C2939A31971420991F@pc1> <49C0A7C7.8000804@zend.com> Date: Wed, 18 Mar 2009 10:05:18 -0500 MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset="iso-8859-1"; reply-type=response Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2900.5512 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5579 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - liberty.vosn.net X-AntiAbuse: Original Domain - lists.php.net X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - realplain.com Subject: Re: [PATCH] Bug #45877: LONG_MAX/MIN array key as string/int From: php_lists@realplain.com ("Matt Wilmas") Hi Dmitry, ----- Original Message ----- From: "Dmitry Stogov" Sent: Wednesday, March 18, 2009 > BTW may be we should eliminate strtol() at all. > There's no need to scan the string twice. Your change to remove strtol() [1] is not checking for overflow correctly (for example, zend_u_strtol()'s checks are more complicated). This breaks handling of keys above ULONG_MAX (it's correct again after ULONG_MAX+LONG_MAX, until ULONG_MAX * 2, etc.). See: var_dump(array('5000000000' => 1)); array(1) { [705032704]=> int(1) } And of course the new code is a bit slower for keys that aren't fully numeric, e.g. "123a" [1] http://news.php.net/php.zend-engine.cvs/7465 > Dmitry. - Matt > Matt Wilmas wrote: >> Hi all, >> >> Assuming there are no objections, I'll commit this fix in a few hours... >> >> Besides the bug report(s), I had also found awhile ago that currently an >> array key can be LONG_MAX or LONG_MIN as a string and/or integer because >> of a check in ZEND_HANDLE_NUMERIC() (I assume to avoid a slow errno check >> for ERANGE originally). I changed it to use the *same method* that's >> used in the scanner, is_numeric_string(), etc., and those 2 values are >> now treated as an integer. >> >> It's just a few lines changed in zend_hash.h, although I had to move some >> of the definitions from zend_operators.h to zend.h (is that OK?). >> >> Patches (didn't check HEAD's yet): >> http://realplain.com/php/array_key_limit.diff >> http://realplain.com/php/array_key_limit_5_3.diff >> >> >> - Matt