ID: 46701 Comment by: maxhex at hotmail dot com Reported By: testuzer at hotmail dot com Status: Open Bug Type: Arrays related Operating System: Linux 32bit - ubuntu PHP Version: 5CVS, 6CVS (2008-11-28) New Comment:
MIX Previous Comments: ------------------------------------------------------------------------ [2009-01-03 05:03:24] sh...@php.net Proposed patches to make $array[$double] perform the same as $array[intval($double)]... http://tekrat.com/patches/bug46701.php6.patch http://tekrat.com/patches/bug46701.php53.patch http://tekrat.com/patches/bug46701.php52.patch ------------------------------------------------------------------------ [2008-12-04 01:43:46] msara...@php.net Array ( [-2147483648] => 1 ) Reproduced here. ------------------------------------------------------------------------ [2008-12-01 01:49:09] cyberquoter at gmail dot com OS: Debian Linux 2.6.18-6-686 (32bit) PHP: 5.2.0-8+etch13 Result: Array ( [-2147483648] => 1 ) ------------------------------------------------------------------------ [2008-11-29 06:56:11] testuzer at hotmail dot com Can also confirm Linux -ubuntu 64bit works. Actual result Linux 64bit (php 5.2.4): -------------- Array ( [3428599296] => 1 [3459455488] => 1 [3459616768] => 1 ) Obviously the 32bit os treats it as a signed 32bit value and a 64bit os as a 64bit value..... so you get a positive value. The array key handling is _only_ broken on linux 32bit. ------------------------------------------------------------------------ [2008-11-29 06:18:33] testuzer at hotmail dot com Here is a simple test: Reproduce code: --------------- echo 0xcc5c4600; var_dump( 0xcc5c4600 ); print_r( 0xcc5c4600 ); For both Windows and Linux - ubuntu the result is the same. Actual result Windows 32bit: -------------- 3428599296 float(3428599296) 3428599296 Actual result Linux 32bit: -------------- 3428599296 float 3428599296 3428599296 So it is not a hex to long conversion problem. Running the same array test using decimals and same values. Reproduce code: --------------- $test_array = array( 3428599296 => 1, 3459455488 => 1, 3459616768 => 1 ); print_r( $test_array ); Actual result Windows 32bit: -------------- Array ( [-866368000] => 1 [-835511808] => 1 [-835350528] => 1 ) Actual result Linux 32bit: -------------- Array ( [-2147483648] => 1 ) ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/46701 -- Edit this bug report at http://bugs.php.net/?id=46701&edit=1