php.net |  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
Votes:1
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
 [2012-07-19 08:52 UTC] 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

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2012-07-19 10:27 UTC] 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 14:18 UTC] 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 14:18 UTC] laruence@php.net
-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] nikic@php.net
-Status: Analyzed +Status: Closed -Assigned To: +Assigned To: nikic
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Oct 06 00:01:28 2024 UTC