|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #62607 array_walk_recursive move internal pointer
Submitted: 2012-07-19 08:52 UTC Modified: 2016-07-29 22:21 UTC
Avg. Score:4.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: tito at miarroba dot net Assigned: nikic (profile)
Status: Closed Package: Arrays related
PHP Version: 5.3.14 OS:
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
From: tito at miarroba dot net
New email:
PHP Version: OS:


 [2012-07-19 08:52 UTC] tito at miarroba dot net
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


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2012-07-19 10:27 UTC] reeze dot xia at gmail dot com
Yes, it did after the fix for
 [2012-07-19 14:18 UTC]
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 
 [2012-07-19 14:18 UTC]
-Status: Open +Status: Analyzed
 [2012-11-04 14:12 UTC] xmak at studioartlan dot com
This also happens for regular array_walk()
 [2016-07-29 22:21 UTC]
-Status: Analyzed +Status: Closed -Assigned To: +Assigned To: nikic
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Mar 05 06:01:31 2024 UTC