I am using Drupal 5.20 and recently our server upgraded to PHP 5.3. I ran the PHP 5.3. compatibility patch, but I can still not solve two things:

1. warning: call_user_func_array() expects parameter 2 to be array, string given in .../includes/menu.inc on line 418.

2. I am not able to see the settings of certain modules, for example OG User Roles, Advanced front page... when I click on the settings page I get a blank page, WSOD. Did you come across similar problems?

Appreciate any hints!

Comments

ursika’s picture

I am still getting an error form menu.inc line 415.

I get this problem on many different admin settings pages, usually very random, in some cases once I refresh the page the error is gone, but in other cases I get WSOD. Here are some pages that returned this error:

admin/settings/site-maintenance
admin/user/invite
admin/settings/front
admin/og/og_user_roles

In the last 2 cases I get a WSOD, but in the first two I just get a warning message that disappears after refresh. The code that returns error comes from call_user_func_array in this part of the code in menu.inc:

$arguments = isset($menu['callbacks'][$path]['callback arguments']) ? $menu['callbacks'][$path]['callback arguments'] : array();

$arg = substr($_GET['q'], strlen($path) + 1);

if (strlen($arg)) {
$arguments = array_merge($arguments, explode('/', $arg));
}

return call_user_func_array($menu['callbacks'][$path]['callback'], $arguments);

I have tried adding & to $arguments, I also used typecasting (array) before the $arguments, since the behavior of array_merge() was modified in PHP 5. Unlike PHP 4, array_merge() only accepts parameters of type array. But none of that helped.

andrewfn’s picture

Here is a quick and dirty fix to the problem. (Actually it it not dirty, but it is fixing the problem in Drupal core when it is really a problem in some of the contrib modules.)
At line 414 in includes/menu.inc add the extra line that contains the comment:

  if (strlen($arg)) {
    $arguments = array_merge($arguments, explode('/', $arg));
  }
  if ( is_string($arguments) ) $arguments = array($arguments); //clean up bad argument array
  return call_user_func_array($menu['callbacks'][$path]['callback'], $arguments);
}
ressa’s picture

Thank you, no more WSOD!

sheanhoxie’s picture

thanks for this

astra’s picture

My site D5 got the same problem after upgrading to php5.3:

warning: call_user_func_array() expects parameter 2 to be array, string given in .../includes/menu.inc on line 418.

Replace the lines in includes/menu.inc

  if (strlen($arg)) {
    $arguments = array_merge($arguments, explode('/', $arg));
  }
  return call_user_func_array($menu['callbacks'][$path]['callback'], $arguments);

with followings

  if (strlen($arg)) {
    $arguments = array_merge($arguments, explode('/', $arg));
  }
  if ( is_string($arguments) ) $arguments = array($arguments); //clean up bad argument array
  return call_user_func_array($menu['callbacks'][$path]['callback'], $arguments);

It seems to fix this problem.

By the way , this solution also has another problem fixed: the blank node page from the Workflow module can show up again.

nike22’s picture

To reset all settings you can also simply delete the FileZilla Server Interface.xml and FileZilla Server.xml files.