ID: 48254
Updated by: [email protected]
Reported By: for-bugs at hnw dot jp
Status: Open
Bug Type: Arrays related
Operating System: any
PHP Version: 5.2.9
New Comment:
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...
Previous Comments:
------------------------------------------------------------------------
[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