Edit report at https://bugs.php.net/bug.php?id=46229&edit=1

 ID:                 46229
 Updated by:         [email protected]
 Reported by:        brian at nerdlife dot net
 Summary:            call_user_func_array throws misleading warning
-Status:             Open
+Status:             Closed
 Type:               Feature/Change Request
-Package:            Feature/Change Request
+Package:            *General Issues
 Operating System:   N/A
 PHP Version:        5.2.6
-Assigned To:        
+Assigned To:        nikic
 Block user comment: N
 Private report:     N

 New Comment:

Closing as it looks like this has been fixed by now. Your examples gives the 
following error:

call_user_func_array() expects parameter 1 to be a valid callback, first array 
member is not a valid class name or object


Previous Comments:
------------------------------------------------------------------------
[2008-10-04 20:58:46] brian at nerdlife dot net

Description:
------------
If you pass an invalid array as a callback (for example if your object is 
actually just NULL), call_user_func_array warns with a message that implies 
that arrays are not valid callbacks:

Warning: call_user_func_array(): First argument is expected to be a valid 
callback, 'Array' was given in ...

This is misleading.  Perhaps the wording should be changed to match 
call_user_func's warning:

Warning: call_user_func(Array): First argument is expected to be a valid 
callback in ...

Alternatively the error message can be made more specific when passed an array 
as to where in the trail of objects the call failed (and possibly what the 
value/type was).

Reproduce code:
---------------
<?php
$foo = NULL;
call_user_func_array(array($foo, 'foofunc'), array($var1));
call_user_func(array($foo, 'foofunc'), $var1);
?>




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



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

Reply via email to