call_user_func_array() error

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
dru_nasty
Forum Commoner
Posts: 81
Joined: Sat Sep 10, 2005 10:26 am

call_user_func_array() error

Post 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.
User avatar
AbraCadaver
DevNet Master
Posts: 2572
Joined: Mon Feb 24, 2003 10:12 am
Location: The Republic of Texas
Contact:

Re: call_user_func_array() error

Post 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']));
mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.
rubo77
Forum Newbie
Posts: 2
Joined: Sat Mar 03, 2012 11:05 pm

Re: call_user_func_array() error

Post 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']);
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: call_user_func_array() error

Post 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.
rubo77
Forum Newbie
Posts: 2
Joined: Sat Mar 03, 2012 11:05 pm

Re: call_user_func_array() error

Post by rubo77 »

maybe that would work too.

but array(null) is definitely not working correctly
Post Reply