Page 1 of 1

call_user_func_array() error

Posted: Fri Aug 27, 2010 3:45 pm
by dru_nasty
Warning: call_user_func_array() expects parameter 2 to be array, null given in /Applications/MAMP/htdocs/Jet/httpdocs/cakephp/cake/dispatcher.php on line 263

Here's the line 263
$output = call_user_func_array(array(&$controller, $params['action']), empty($params['pass'])? null: $params['pass']);

I'm not sure what to do here. This is part of cakephp.

Re: call_user_func_array() error

Posted: Fri Aug 27, 2010 3:55 pm
by AbraCadaver
Make sure you're using the latest version of cake, not a beta or pre-release. If you are, then open a bug report. I'm not positive, but it should probably look like this:

Code: Select all

$output = call_user_func_array(array(&$controller, $params['action']), empty($params['pass']) ? array(null) : array($params['pass']));

Re: call_user_func_array() error

Posted: Sat Mar 03, 2012 11:15 pm
by rubo77
i think thats wrong, what if $params['pass'] is already an array? and the array(null) doesent work correctly.
first i had a Problem, that the call_user_func_array always expects an array as second argument, so it is not possible with this function a alone to call the function with zero arguments.

I am trying to convert my old CakePHP 0.9 to be prepared for PHP5.3 and repaired it like this:

Code: Select all

			 $functionname=$params['action'];
			 if(empty($params['pass'])) $output = $controller->$functionname();
			 else $output = call_user_func_array(array(&$controller, $params['action']), $params['pass']);

Re: call_user_func_array() error

Posted: Sun Mar 04, 2012 3:25 am
by requinix
rubo77 wrote:so it is not possible with this function a alone to call the function with zero arguments.
Did you try using an empty array? No? Huh.

Re: call_user_func_array() error

Posted: Mon Mar 05, 2012 7:37 am
by rubo77
maybe that would work too.

but array(null) is definitely not working correctly