Bug #67176 [Opn->Dup]: adding a new element in an array after array_shift uses the wrong id
| From: | requinix@php.net | Date: | Fri, 02 May 2014 04:38:36 +0000 |
| Subject: | Bug #67176 [Opn->Dup]: adding a new element in an array after array_shift uses the wrong id | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-185570@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=67176&edit=1
ID: 67176
Updated by: requinix@php.net
Reported by: stof at notk dot org
Summary: adding a new element in an array after array_shift
uses the wrong id
-Status: Open
+Status: Duplicate
Type: Bug
Package: Arrays related
PHP Version: 5.6.0beta1
Block user comment: N
Private report: N
New Comment:
Duplicate of bug #67169
Previous Comments:
------------------------------------------------------------------------
[2014-05-02 03:33:43] stof at notk dot org
Description:
------------
When using array_shift() on an array and then adding new elements in it, the index is incremented in
a wrong way.
this behavior differs from previous PHP versions (working in PHP 5.6-alpha1, broken in beta1 and
beta2)
Test script:
---------------
<?php
$a = array();
$a[] = 1;
var_dump(array_keys($a));
array_shift($a);
$a[] = 1;
var_dump(array_keys($a));
Expected result:
----------------
array(1) { [0]=> int(0) }
array(1) { [0]=> int(0) }
Actual result:
--------------
array(1) { [0]=> int(0) }
array(1) { [0]=> int(1) }
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=67176&edit=1