#31720 [Opn->Csd]: Invalid object callbacks not caught in array_walk()

From: Date: Wed, 02 Feb 2005 10:38:47 +0000
Subject: #31720 [Opn->Csd]: Invalid object callbacks not caught in array_walk()
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-73255@lists.php.net to get a copy of this message
ID: 31720 Updated by: stas@php.net Reported By: a at b dot c dot de -Status: Open +Status: Closed Bug Type: Reproducible crash Operating System: Windows XP PHP Version: 5.0.3 New Comment: This bug has been fixed in CVS. Snapshots of the sources are packaged every three hours; this change will be in the next snapshot. You can grab the snapshot at http://snaps.php.net/. Thank you for the report, and for helping us make PHP better. Previous Comments: ------------------------------------------------------------------------ [2005-01-28 00:27:47] a at b dot c dot de 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. ------------------------------------------------------------------------ [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

« previous php.bugs (#73255) next »