ID:               26585
 Updated by:       [EMAIL PROTECTED]
 Reported By:      jsabater at linuxsilo dot net
-Status:           Open
+Status:           Bogus
 Bug Type:         Documentation problem
 Operating System: Linux
 PHP Version:      4.3.3
 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

Second parameter of call_user_func_array() is an array of parameters.
Thus you have to call:

call_user_func_array ('myfunc', array(array ("first", "second",
"third")));

to get expected result.


Previous Comments:
------------------------------------------------------------------------

[2003-12-10 11:01:43] jsabater at linuxsilo dot net

Description:
------------
When calling a defined function like this:

call_user_func_array ('myfunc', $myarray);

The $myarray array only contains the first value, but not the whole
array. For instance:

function myfunc ($myarray)
{
  if (is_array($myarray)) print("It's an array");
  else print ("It's not an array");
}

call_user_func_array ('myfunc', array ("first", "second", "third"));

Then you would receive the message "It's not an array". If you print_r
the array, then you would only get "first".

Then, if you change the call to this:

call_user_func_array ('myfunc', array (array ("first", "second",
"third")));

It works as expected. So, the documentation available at
http://es.php.net/manual/en/function.call-user-func-array.php seems to
be wrong.

Thanks for your time. Hope this helps.

Reproduce code:
---------------
function myfunc ($myarray)
{
  if (is_array($myarray)) print("It's an array");
  else print ("It's not an array");
}

call_user_func_array ('myfunc', array ("first", "second", "third"));

Expected result:
----------------
It's an array

Actual result:
--------------
It's not an array


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=26585&edit=1

Reply via email to