Bug #61967 [NEW]: unset array item cause inconsistent array
| From: | laruence@php.net | Date: | Mon, 07 May 2012 02:33:51 +0000 |
| Subject: | Bug #61967 [NEW]: unset array item cause inconsistent array | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-170271@lists.php.net to get a copy of this message | ||
From: laruence
Operating system:
PHP version: 5.3.12
Package: Arrays related
Bug Type: Bug
Bug description:unset array item cause inconsistent array
Description:
------------
when you unset the array which you are iterating. array inconsistent will
be
reported.
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.
thanks
Test script:
---------------
<?php
$arr = array(
range(1, 10),
range(1, 10),
range(1, 10),
range(1, 10),
range(1, 10),
);
array_walk_recursive($arr,
function (&$value, $key) use(&$arr) {
unset($arr[$key]);
});
Expected result:
----------------
nothing wrong
Actual result:
--------------
Zend/zend_hash.c(1085) : ht=0x25f5b78 is inconsistent
--
Edit bug report at https://bugs.php.net/bug.php?id=61967&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=61967&r=trysnapshot54
Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=61967&r=trysnapshot53
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=61967&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=61967&r=fixed
Fixed in SVN and need be documented: https://bugs.php.net/fix.php?id=61967&r=needdocs
Fixed in release: https://bugs.php.net/fix.php?id=61967&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=61967&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=61967&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=61967&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=61967&r=support
Expected behavior: https://bugs.php.net/fix.php?id=61967&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=61967&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=61967&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=61967&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=61967&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=61967&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=61967&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=61967&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=61967&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=61967&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=61967&r=mysqlcfg