Bug #62607 [Com]: array_walk_recursive move internal pointer
| From: | xmak at studioartlan dot com | Date: | Sun, 04 Nov 2012 14:12:26 +0000 |
| Subject: | Bug #62607 [Com]: array_walk_recursive move internal pointer | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-174516@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=62607&edit=1
ID: 62607
Comment by: xmak at studioartlan dot com
Reported by: tito at miarroba dot net
Summary: array_walk_recursive move internal pointer
Status: Analyzed
Type: Bug
Package: Arrays related
PHP Version: 5.3.14
Block user comment: N
Private report: N
New Comment:
This also happens for regular array_walk()
Previous Comments:
------------------------------------------------------------------------
[2012-07-19 14:18:09] laruence@php.net
it's a side affect of fixing #61730
before that fix, array_walk_ use a pos to hold iterator position, but that will
cause segfault if the postion become a pending pointer(by unseting the array
element).
------------------------------------------------------------------------
[2012-07-19 10:27:12] reeze dot xia at gmail dot com
Yes, it did after the fix for https://bugs.php.net/bug.php?id=61730.
------------------------------------------------------------------------
[2012-07-19 08:52:53] tito at miarroba dot net
Description:
------------
array_walk_recursive move internal pointer position since 5.3.13 version
Test script:
---------------
$arr = array('a'=>'b');
echo 'Before -> '.current($arr).PHP_EOL;
array_walk_recursive($arr, function(&$val){});
echo 'After -> '.current($arr);
Expected result:
----------------
Before -> b
After -> b
Actual result:
--------------
Before -> b
After -> false
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=62607&edit=1