php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #66656 call_user_func_array does not return FALSE on error
Submitted: 2014-02-06 14:30 UTC Modified: 2014-02-16 02:35 UTC
From: vseticka dot martin at gmail dot com Assigned:
Status: Not a bug Package: Unknown/Other Function
PHP Version: 5.5.9 OS: Windows 8.1
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: vseticka dot martin at gmail dot com
New email:
PHP Version: OS:

 

 [2014-02-06 14:30 UTC] 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


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2014-02-14 20:15 UTC] cmbecker69 at gmx dot de
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>
 [2014-02-16 02:35 UTC] johannes@php.net
-Status: Open +Status: Not a bug
 [2014-02-16 02:35 UTC] johannes@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

see above
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun May 05 12:01:32 2024 UTC