Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:12417 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 38941 invoked by uid 1010); 27 Aug 2004 10:12:20 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 35321 invoked by uid 1007); 27 Aug 2004 10:10:13 -0000 Message-ID: <20040827101013.35297.qmail@pb1.pair.com> To: internals@lists.php.net Date: Fri, 27 Aug 2004 20:10:13 +1000 Lines: 40 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1437 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441 X-Posted-By: 144.132.78.169 Subject: Method for validating call-back functions From: aidan@php.net ("Aidan Lister") 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