Bug #65428 [Opn->Nab]: call_user_func_array can't accept params correctly
Edit report at https://bugs.php.net/bug.php?id=65428&edit=1
ID: 65428
Updated by: requinix@php.net
Reported by: 1suming at sina dot com
Summary: call_user_func_array can't accept params correctly
-Status: Open
+Status: Not a bug
Type: Bug
Package: Unknown/Other Function
Operating System: windows
PHP Version: 5.4.17
Block user comment: N
Private report: N
New Comment:
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
The second argument to call_user_func_array() is an array of the arguments to
pass. Not an entire argument by itself. That's the whole point of having this
function alongside call_user_func().
Previous Comments:
------------------------------------------------------------------------
[2013-08-09 17:13:03] requinix@php.net
Related To: Bug #65429
------------------------------------------------------------------------
[2013-08-09 16:41:23] 1suming at sina dot com
Description:
------------
---
From manual page: http://www.php.net/function.call-user-func-array#refsect1-
function.call-user-func-array-description
---
class Foo
{
public function printArray(array $arr)
{
var_dump($arr);
}
}
$foo1=new Foo();
call_user_func_array(array($foo1,'printArray'),array(1,2));
when I run,the result is
Catchable fatal error: Argument 1 passed to foo::printArray() must be of the
type array, integer
but when i change call_user_func_array to call_user_func,it's ok.
Don't call_user_func_array accept params?
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=65428&edit=1
Thread (2 messages)