Bug #55379 [NEW]: can't iterate multidimensional array when referring to an object
| From: | rsk82 at live dot com | Date: | Sun, 07 Aug 2011 14:50:34 +0000 |
| Subject: | Bug #55379 [NEW]: can't iterate multidimensional array when referring to an object | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-162460@lists.php.net to get a copy of this message | ||
From:
Operating system: Windows XP SP3
PHP version: 5.3.7RC4
Package: Class/Object related
Bug Type: Bug
Bug description:can't iterate multidimensional array when referring to an object
Description:
------------
affected versions:
php-5.3.6-Win32-VC9-x86
php-5.3.7RC4-Win32-VC9-x86
php-5.3-ts-windows-vc9-x86-r314352
php-5.3-ts-windows-vc9-x86-r314419
php-5.4-ts-windows-vc9-x86-r314420
operating system:
Windows XP SP3
description in code
Test script:
---------------
<?php
$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) {
$obj->show_message($val);
},$this);
}
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
--
Edit bug report at https://bugs.php.net/bug.php?id=55379&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=55379&r=trysnapshot54
Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=55379&r=trysnapshot53
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=55379&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=55379&r=fixed
Fixed in SVN and need be documented: https://bugs.php.net/fix.php?id=55379&r=needdocs
Fixed in release: https://bugs.php.net/fix.php?id=55379&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=55379&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=55379&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=55379&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=55379&r=support
Expected behavior: https://bugs.php.net/fix.php?id=55379&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=55379&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=55379&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=55379&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=55379&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=55379&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=55379&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=55379&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=55379&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=55379&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=55379&r=mysqlcfg