ID: 48093 Updated by: sni...@php.net Reported By: Marcel dot Glacki at stud dot fh-swf dot de -Status: Open +Status: Bogus Bug Type: Arrays related Operating System: * PHP Version: 5.2.9 New Comment:
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 Previous Comments: ------------------------------------------------------------------------ [2009-04-27 23:02:39] Marcel dot Glacki at stud dot fh-swf dot de Description: ------------ The generated index normally has the highest integer value regarding all integers it has encountered as indexes before. (And is automatically increased by +1) It is possible to reset this index (the internal pointer) not only by the functions intended to do so (like reset()) but also by increasing it above integers' max value (integer overflow). Reproduce code: --------------- <?php $max_int = 2147483647; // Max value for integer on a 32-bit system $arr = array(); $arr[1] = 'one'; // New index: 2 $arr[ $max_int ] = 'two'; // New index: -2147483648 $arr[0] = 'three'; // New index: 1 (already occupied with value 'foo') $arr[] = 'failure here'; // Warning: Cannot add element to the array as the next element is already occupied. ?> ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=48093&edit=1