#48254 [Opn->Asn]: Inconsistent handling of huge numerical keys for array
| From: | jani@php.net | Date: | Wed, 13 May 2009 18:40:52 +0000 |
| Subject: | #48254 [Opn->Asn]: Inconsistent handling of huge numerical keys for array | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-137263@lists.php.net to get a copy of this message | ||
ID: 48254
Updated by: jani@php.net
Reported By: for-bugs at hnw dot jp
-Status: Open
+Status: Assigned
Bug Type: Arrays related
Operating System: *
-PHP Version: 5.2.9
+PHP Version: 5.2, 6CVS (2009-05-13)
-Assigned To:
+Assigned To: mattwil
New Comment:
Matt, bug fixes should go into PHP_5_2. And I guess this is the same
patch needing MFB to HEAD too? :)
Previous Comments:
------------------------------------------------------------------------
[2009-05-13 14:25:42] mattwil@php.net
See Bug #45877.
This has been fixed in PHP 5.3. I didn't backport the change to 5.2
since it's been around forever and didn't know if the fix would be
wanted in 5.2 (primarily by who's in charge of it) at this point in its
lifecycle.
I'll leave this open for now to see if other devs have a comment...
------------------------------------------------------------------------
[2009-05-13 03:47:05] for-bugs at hnw dot jp
Description:
------------
There is inconsistency in dealing with huge numerical array key.
We know PHP normalizes array key with numerical string to integer if
possible. For instance, $a["1"] is equevalent to $a[1]. However, it is
not valid about PHP_INT_MAX and ~PHP_INT_MAX (2147483647 and -2147483648
in 32bit envirionment).
Reproduce code:
---------------
<?php
$a[PHP_INT_MAX]=1;
$a[(string)PHP_INT_MAX]=2;
var_dump($a);
Expected result:
----------------
array(2) {
[2147483647]=>
int(2)
}
Actual result:
--------------
array(2) {
[2147483647]=>
int(1)
["2147483647"]=>
int(2)
}
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=48254&edit=1