Bug #66656 [Com]: call_user_func_array does not return FALSE on error

From: Date: Fri, 14 Feb 2014 20:15:26 +0000
Subject: Bug #66656 [Com]: call_user_func_array does not return FALSE on error
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-184299@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=66656&edit=1 ID: 66656 Comment by: cmbecker69 at gmx dot de Reported by: vseticka dot martin at gmail dot com Summary: call_user_func_array does not return FALSE on error Status: Open Type: Bug Package: Unknown/Other Function Operating System: Windows 8.1 PHP Version: 5.5.9 Block user comment: N Private report: N New Comment: IMHO, this is not a bug, because this behavior of built-in functions is documented[1]: | Note: If the parameters given to a function are not what it | expects, such as passing an array where a string is expected, | the return value of the function is undefined. In this case it | will likely return NULL but this is just a convention, and cannot | be relied upon. [1] <http://www.php.net/manual/en/functions.internal.php> Previous Comments: ------------------------------------------------------------------------ [2014-02-06 14:30:29] vseticka dot martin at gmail dot com Description: ------------ Function 'call_user_func_array' does not return FALSE when $param_arr is not an array. Test script: --------------- <?php function testFnc() { echo "testFnc() was called"; return true; } echo "\nAbout to call: call_user_func_array()\n"; $result = call_user_func_array('testFnc', "not an array"); echo "\nAbout to call: var_dump()\n"; var_dump($result); ?> Expected result: ---------------- $result should be FALSE (not NULL) according to the documentation page http://php.net/call_user_func_array. Actual result: -------------- About to call: call_user_func_array() <br /> <b>Warning</b>: call_user_func_array() expects parameter 2 to be array, string given in <b>[...][...]</b> on line <b>8</b><br /> About to call: var_dump() NULL ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=66656&edit=1

« previous php.bugs (#184299) next »