php.net |  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
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: stof at notk dot org
New email:
PHP Version: OS:

 

 [2014-05-02 03:33 UTC] 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) }

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2014-05-02 04:38 UTC] requinix@php.net
-Status: Open +Status: Duplicate
 [2014-05-02 04:38 UTC] requinix@php.net
Duplicate of bug #67169
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 19:01:29 2024 UTC