Method for validating call-back functions

From: Date: Fri, 27 Aug 2004 10:10:13 +0000
Subject: Method for validating call-back functions
Groups: php.internals 
Request: Send a blank email to internals+get-12417@lists.php.net to get a copy of this message
Hey, I was messing around with array_walk[_recursive] and found the behaviour it uses to validate callback functions completely different to other standard functions. array_walk_recursive http://lxr.php.net/source/php-src/ext/standard/array.c#1111 array_filter http://lxr.php.net/source/php-src/ext/standard/array.c#3973 array_map http://lxr.php.net/source/php-src/ext/standard/array.c#4065 Now, apart from the internal differences, the external differences are quite apparent. array_walk[_recursive] called with an array('foo','bar') as a callback will throw a E_FATAL * reproduce: php -r '$var=array('foo','bar'); array_walk_recursive($var, array('foo','bar'));' Compared to only an E_WARNING for other functions. * reproduce: php -r '$var=array('foo','bar'); array_filter($var, array('foo','bar'));' Is there a good reason for this? Perhaps we could implement a standard method for such validation? On a side note, with php_error_docref errors, please don't add a full stop to the end of the error message! Kind Regards, Aidan Lister

« previous php.internals (#12417) next »