|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2014-07-28 07:13 UTC] yohgaki@php.net
-Status: Open
+Status: Analyzed
-Package: Arrays related
+Package: Scripting Engine problem
[2014-07-28 07:13 UTC] yohgaki@php.net
[2014-07-30 10:36 UTC] datibbaw@php.net
[2014-07-30 10:36 UTC] datibbaw@php.net
-Status: Analyzed
+Status: Closed
[2014-08-04 08:26 UTC] ab@php.net
[2014-08-04 08:43 UTC] ab@php.net
[2014-08-04 09:59 UTC] dmitry@php.net
[2014-08-14 00:52 UTC] tyrael@php.net
[2014-10-07 23:13 UTC] stas@php.net
[2014-10-07 23:24 UTC] stas@php.net
|
|||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Oct 30 22:00:01 2025 UTC |
Description: ------------ When the initial one element array, starting with -1 index, is poped, and afterwards two values are pushed into the obtained empty array, the second value index is becoming 2147483647, which is obviously an error. All other starting indexes (-2, 0, 1, 2,...) do not affect array in this way. Also, when starting index is > 0, the index of the first element, pushed into the empty array is kept from the previous key-value pair. Such behaviour may be also considered erroneous. Test script: --------------- <?php $b=array(-1=>0); $c=array_pop($b); assert($c == 0); assert(array_push($b, 0), 1); assert(array_push($b, 0), 2); var_dump($b); assert(array_push($b, 0), 3); ?> Expected result: ---------------- array(2) { [0]=> int(0) [1]=> int(0) } Actual result: -------------- array(2) { [-1]=> int(0) [2147483647]=> int(0) } PHP Warning: array_push(): Cannot add element to the array as the next element is already occupied in /home/dmitri/workspace/cell/temp/array_push_pop_bug.php on line 8