|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #67176 adding a new element in an array after array_shift uses the wrong id
Submitted: 2014-05-02 03:33 UTC Modified: 2014-05-02 04:38 UTC
From: stof at notk dot org Assigned:
Status: Duplicate Package: Arrays related
PHP Version: 5.6.0beta1 OS:
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
Solve the problem:
42 + 43 = ?
Subscribe to this entry?

 [2014-05-02 03:33 UTC] stof at notk dot org
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:

$a = array();
$a[] = 1;
$a[] = 1;

Expected result:
array(1) { [0]=> int(0) } 
array(1) { [0]=> int(0) }

Actual result:
array(1) { [0]=> int(0) } 
array(1) { [0]=> int(1) }


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2014-05-02 04:38 UTC]
-Status: Open +Status: Duplicate
 [2014-05-02 04:38 UTC]
Duplicate of bug #67169
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Fri Aug 14 16:01:25 2020 UTC