Closed (duplicate)
Project:
Drupal core
Version:
6.10
Component:
menu system
Priority:
Critical
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
7 Mar 2009 at 03:14 UTC
Updated:
18 May 2012 at 15:25 UTC
Hi,
I'm getting a lot of these errors in the watchdog logs:
Invalid argument supplied for foreach() /includes/menu.inc on line 258.
I have checked the arguments for the menu and I could not find any problems with the arguments for menu items - all are set up according to the d6 specs for specifying menu items.
Is something else causing this problem?
I have just updated from Drupal 5.16 to Drupal 6.10 when I noticed the errors.
I have done a search for erroneous menu items but all were using array(). All menu items are appearing properly on the site as well.
My current setup is:
Drupal 6.10
Ubuntu
Apache2
Mysql5
PHP5
Thanks
Comments
Comment #1
nagarajanl commentedHi,
Make sure all your 'page arguments' and 'access arguments' are arrays().
(ie) 'page arguments' => array('system_admin_theme_settings'),
'access arguments' => array('access administration pages')
Comment #2
xanoYou probably have a module with a buggy hook_menu() implementation. Please try to locate the module that causes the problem by disabling them one by one.
Comment #3
h3000 commentedHi,
Thanks for your replies.
should the code on that line be changed to add a check on the $data variable?
something like:
Comment #4
h3000 commentedAnyway,
I ended up modifying menu.inc to add the check before the foreach statement:
original was:
this was changed to:
not sure if this should be committed but it helped a lot to track down where the problem was.
Comment #5
xanoHave you even read #2? This is veyr likely not a problem in the menu system, but in one of the modules you are using.
Comment #6
h3000 commentedYes I've read your comments - it was a problem with some 'page arguments' not using array() in a custom module.
But what I'm saying is that it would have been easier if the menu module had a check on the $data variable and output a more informative error message instead of letting users find out where the problem is by disabling / enabling modules one by one. This one is a huge problem especially if the site is using a lot of modules.
So I think that menu.inc line should be changed to add the check on the variable. I've seen other system modules with checks on variables before running the foreach() command - why can't this line have a check? - saves users/developers a lot of time.
Comment #7
xanoNo, developers should read the documentation and test their code. If we are going to add checks like this to core you can kiss performance goodbye.
Comment #8
achilles085 commentedthis works with me http://drupal.org/node/393720#comment-1325998
THANKS!!!
arnel
Comment #9
Ole Martin commentedI had this error on 1 of 10 pages that had the same system. I discovered that the side that had the error had "Smartqueue taxonomy" active, none of the others had it. In addition, I had also disabled "Node Words - basic meta tags" . After I disabled "Smartqueue taxonomy" and enabled "Node Words" the error disappeared.
I do not have any knowledge of programming, so I do not know more than the error disappeared, not "Why"
I also tried #4 and it worked fine, but what about updates, etc. then the error will be back?
Comment #10
pillarsdotnet commentedAlso see #277018: Warning: Invalid argument supplied for foreach() in menu_unserialize() if unserialize returns non-array value