From: dharma dot yp at in dot ibm dot com Operating system: Windows, Linux PHP version: 5.2CVS-2007-12-09 (snap) PHP Bug Type: Arrays related Bug description: Inconsistent behaviour of array_walk_recursive () in PHP 5 and PHP 6.
Description: ------------ In array_walk_recursive(), if we pass non-existent callback function then it gives following output 1)for PHP 5 Warning: array_walk_recursive(): Unable to call echo() - function does not exist in %s on line %d bool(true) 2)for PHP 6 Warning: array_walk_recursive() : Expects parameter 2 to be valid callback, string given in %s on line %d NULL In PHP5, array_walk_recursive() gives warning message the number passed array element times, where as in PHP 6, it gives warning message only once with return value "NULL". This is an inconsistent behavior of array_walk_recursive() with PHP5 and PHP6. The return value of " bool(true)" in PHP5 (1), will misguide/confuse the developers as the documentation says array_walk_recursive() returns TRUE on Success and FALSE on Failure. Reproduce code: --------------- <?php $input = array(array(1,2), array(3), array(4,5)); var_dump( array_walk_recursive($input, 'echo')); ?> Expected result: ---------------- /***** for PHP5 ****/ Warning: array_walk_recursive(): Unable to call echo() - function does not exist in %s on line %d bool(false) /**** for PHP6 ****/ Warning: array_walk_recursive() : Expects parameter 2 to be valid callback, string given in %s on line %d NULL Actual result: -------------- /**** for PHP5 ****/ Warning: array_walk_recursive(): Unable to call echo() - function does not exist in %s on line %d Warning: array_walk_recursive(): Unable to call echo() - function does not exist in %s on line %d Warning: array_walk_recursive(): Unable to call echo() - function does not exist in %s on line %d bool(true) /**** for PHP6 ****/ Warning: array_walk_recursive() : Expects parameter 2 to be valid callback, string given in %s on line %d NULL -- Edit bug report at http://bugs.php.net/?id=43544&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=43544&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=43544&r=trysnapshot52 Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=43544&r=trysnapshot53 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=43544&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=43544&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=43544&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=43544&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=43544&r=needscript Try newer version: http://bugs.php.net/fix.php?id=43544&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=43544&r=support Expected behavior: http://bugs.php.net/fix.php?id=43544&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=43544&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=43544&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=43544&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=43544&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=43544&r=dst IIS Stability: http://bugs.php.net/fix.php?id=43544&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=43544&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=43544&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=43544&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=43544&r=mysqlcfg