|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #61967 unset array item in array_walk_recursive cause inconsistent array
Submitted: 2012-05-07 02:33 UTC Modified: 2016-07-29 22:20 UTC
Avg. Score:3.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: Assigned: laruence (profile)
Status: Closed Package: Arrays related
PHP Version: 5.3.12 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.
Block user comment
Status: Assign to:
Bug Type:
New email:
PHP Version: OS:


 [2012-05-07 02:33 UTC]
when you unset the array which you are iterating. array inconsistent will be 

I am looking into it, but sadly it is a little difficult to be fixed. since we 
also allow change the item in the iterator function.


Test script:
$arr = array(
    range(1, 10),
    range(1, 10),
    range(1, 10),
    range(1, 10),
    range(1, 10),

    function (&$value, $key) use(&$arr) {

Expected result:
nothing wrong

Actual result:
Zend/zend_hash.c(1085) : ht=0x25f5b78 is inconsistent


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2012-05-07 02:45 UTC]
-Assigned To: +Assigned To: laruence
 [2012-05-07 02:57 UTC]
and if someone can make a patch earlier than me, the patch will be appreciated.
 [2012-05-07 03:03 UTC]
-Summary: unset array item cause inconsistent array +Summary: unset array item in array_walk_recursive cause inconsistent array
 [2013-07-29 21:00 UTC] mhitza at gmail dot com
Can be safely closed as it doesn't cause any problems on 5.5
 [2016-07-29 22:20 UTC]
-Status: Assigned +Status: Closed
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Jun 25 17:01:31 2024 UTC