|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #55379 can't iterate multidimensional array when referring to an object inside closure
Submitted: 2011-08-07 14:50 UTC Modified: 2013-02-18 00:34 UTC
Avg. Score:4.0 ± 1.0
Reproduced:3 of 3 (100.0%)
Same Version:3 (100.0%)
Same OS:0 (0.0%)
From: rsk82 at live dot com Assigned:
Status: No Feedback Package: Class/Object related
PHP Version: 5.3.7 OS: Windows XP SP3
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
Solve the problem:
13 - 4 = ?
Subscribe to this entry?

 [2011-08-07 14:50 UTC] rsk82 at live dot com
affected versions:

 operating system:
 Windows XP SP3

description in code

Test script:

$test_data1 = array('one','two','three');
// all is ok

$test_data2 = array(array('one','two','three'));
// windows error:
// #The instruction at '<address>' referenced memory at '<address>'.
// #The memory could not be read.
// #Click OK to terminate the program.
// No error shows up in console, sometimes script stops without error but sometimes executes like nothing is happening.

$test_data3 = array(array('one','two','three'),array('four','five','six'));
// error in PHP console:
// Fatal error: Call to a member function show_message() on a non-object in c:\scripts\found-error.php on line xx
// values one two three are displayed, four five and six are ommitted.

class myClass {

	function iterate_multidim_array($array) {
		array_walk_recursive($array,function(&$val,$key,&$obj) {
	function show_message($msg) {
		echo $msg."\n";


echo phpversion()."\n\n";
$myInstance = new MyClass();
$myInstance-> iterate_multidim_array($test_data3);

Expected result:
see no errors

Actual result:
comments in code


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2011-08-19 16:33 UTC] rsk82 at live dot com
-Summary: can't iterate multidimensional array when referring to an object +Summary: can't iterate multidimensional array when referring to an object inside closure -PHP Version: 5.3.7RC4 +PHP Version: 5.3.7
 [2011-08-19 16:33 UTC] rsk82 at live dot com
I nowadays released 5.3.7 this bug wasn't repaired.
 [2012-09-08 15:29 UTC] reeze dot xia at gmail dot com
Hi rsk82,

please try lastest version,

from the follow result, 
it it didn't crash on Linux, but the result output changed. so it 
might been fixed already.

please refer to:
 [2012-09-09 09:35 UTC]
-Status: Open +Status: Feedback
 [2012-09-09 09:35 UTC]
Please try using this snapshot:
For Windows:

I can not reproduce on windows
 [2013-02-18 00:34 UTC] php-bugs at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon May 20 12:01:33 2024 UTC