Edit report at https://bugs.php.net/bug.php?id=61967&edit=1
ID: 61967 Comment by: mhitza at gmail dot com Reported by: larue...@php.net Summary: unset array item in array_walk_recursive cause inconsistent array Status: Assigned Type: Bug Package: Arrays related PHP Version: 5.3.12 Assigned To: laruence Block user comment: N Private report: N New Comment: Can be safely closed as it doesn't cause any problems on 5.5 Previous Comments: ------------------------------------------------------------------------ [2012-05-07 02:57:48] larue...@php.net and if someone can make a patch earlier than me, the patch will be appreciated. ------------------------------------------------------------------------ [2012-05-07 02:33:51] larue...@php.net 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 this bug report at https://bugs.php.net/bug.php?id=61967&edit=1