Bug #62607 [Ana->Csd]: array_walk_recursive move internal pointer
| From: | nikic@php.net | Date: | Fri, 29 Jul 2016 22:21:17 +0000 |
| Subject: | Bug #62607 [Ana->Csd]: array_walk_recursive move internal pointer | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-202708@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
Updated by: nikic@php.net
Reported by: tito at miarroba dot net
Summary: array_walk_recursive move internal pointer
-Status: Analyzed
+Status: Closed
Type: Bug
Package: Arrays related
PHP Version: 5.3.14
-Assigned To:
+Assigned To: nikic
Block user comment: N
Private report: N
New Comment:
Fixed as a side-effect of https://github.com/php/php-src/commit/11e050920d3052d2b14a9cff6c4c5764d674fc46,
for 7.1.
Previous Comments:
------------------------------------------------------------------------
[2012-11-04 14:12:26] xmak at studioartlan dot com
This also happens for regular array_walk()
------------------------------------------------------------------------
[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