ID: 45877 Updated by: matt...@php.net Reported By: henryptung at gmail dot com -Status: Bogus +Status: Assigned Bug Type: Arrays related Operating System: CentOS 4 PHP Version: 5.2.6 -Assigned To: +Assigned To: mattwil New Comment:
I had also noticed this issue awhile back. Finally created a simple fix so it works consistently and as expected, and will apply it soon, hopefully. http://realplain.com/php/array_key_limit.diff http://realplain.com/php/array_key_limit_5_3.diff Previous Comments: ------------------------------------------------------------------------ [2008-08-21 07:18:04] johan...@php.net Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php use a 64bit machine for big integers ------------------------------------------------------------------------ [2008-08-21 03:04:14] henryptung at gmail dot com Description: ------------ I believe '2147483647' (= 2^31 - 1) should be the standard representation of a valid integer, but using the string form as an array key stores the key as a string, not an integer. The integer key 2147483647 can be used separately to refer to a different value, and both are stored. See repro code below: Note: this bug is admittedly duplicate of bug #13407, but the bug still exists, and I fail to understand why the original bug was marked bogus. Thanks for your time. Reproduce code: --------------- $v = array('2147483647' => 'b', '2147483646' => 'c', 2147483647 => 'd'); var_dump($v); Expected result: ---------------- array(2) { [2147483647]=> string(1) "d" [2147483646]=> string(1) "c" } Actual result: -------------- array(3) { ["2147483647"]=> string(1) "b" [2147483646]=> string(1) "c" [2147483647]=> string(1) "d" } ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=45877&edit=1