ID: 31720 User updated by: a at b dot c dot de Reported By: a at b dot c dot de Status: Open Bug Type: Reproducible crash Operating System: Windows XP PHP Version: 5.0.3 New Comment:
I guess I could point out that when I found this I was trying to find some way to call a certain method of each of the array's elements, i.e. call $child->show() for each $child in $children. If there's a way to do this with array_walk() that doesn't involve additional wrapper functions then it eludes me. Previous Comments: ------------------------------------------------------------------------ [2005-01-27 13:06:45] a at b dot c dot de Description: ------------ Using array_walk will crash PHP if a method of an uninstantiated object variable is used in the callback method. Other functions that take variables (at least, usort(), array_map(), array_reduce()) error out instead. There has to be at least one element in the array being walked. Reproduce code: --------------- $array = array('at least one element'); array_walk($array, array($nonesuchvar,'show')); Expected result: ---------------- PHP 4.3.10's error message for this situation reads: Warning: array_walk(): Unable to call Array() - function does not exist in ... while PHP 5.0.3 also reports a Notice-level message that $nonesuchvar is undefined. Actual result: -------------- A Notice-level message that $nonesuchvar is undefined, then a Windows core dump. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=31720&edit=1