I have an error after upgrading from 5.2 to 5.3. The server is running Apache/PHP5.
There is no error on my test system which is running Apache/PHP4.
The message on the PHP5 server sounds like
warning: array_merge() [function.array-merge]: Argument #1 is not an array in /srv/www/vhosts/oekoportal.net/subdomains/test/httpdocs/includes/menu.inc on line 415.
The line in MENU.INC is
$arguments = array_merge( $arguments, explode('/', $arg));
It seems as if $arguments is in some cases an array in some not. PHP4 was more tolerant in acting with array_merge() an accepted non-array parameters. This was changed in PHP5 with giving a message with a critical error.
After changing the line above to
$arguments = array_merge( (array) $arguments, explode('/', $arg));
it is secured that the parameter is an array and the error message is gone.
Fascinating that this error is NOT found in 5.2. Seems as if the array data is modified somewhere before.
Maybe this hint may help those who have the same problem I had.
Nevertheless I hate to patch the core. Am I wrong and the error is based on a totally different location?
Best wishes to all Drupal developers.
Comments
Comment #1
drummThis is caused by a module, probably contributed. There would be a line something like
'arguments' => $not_an_arrayin the {module name}_menu() function.
Comment #2
ricabrantes commentedNo activity, Close..
Comment #3
geo_ego commentedI had this error when I moved to PHP 5.1 from 4.x. According to http://ca.php.net/manual/tr/migration5.incompatible.php array_merge() in PHP 5 was changed to accept only arrays.
PHP 5 starts trowing this warning message about /includes/menu.inc line 415 if in your hook_menu() there are callback arguments defined like this:
Replacing those lines with
fixed the problem.
Please note: in order to see effect of this change you have to temporarily comment out all $may_cache conditions in your hook_menu() to refresh cached menus. Otherwise that warning won't disappear until menu cache expires. After first run, DO NOT forget to remove comments around $may_cache.