Problem when no child menu is visible (D6, 3.5+)
TomChiverton - June 6, 2009 - 18:34
| Project: | DHTML Menu |
| Version: | 6.x-3.5 |
| Component: | PHP Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | AlexisWilke |
| Status: | needs review |
Description
The box says "warning: Invalid argument supplied for foreach() in /home/drupal/includes/menu.inc on line 743.".
Disabling the DHTML Menu module in /admin/build/modules makes the box go away.

#1
Rolling back to 3.4 also removes the error
#2
Another annoying traversal issue, likely caused by another buggy contrib module. I don't know what it's caused by, but I can stop the warning from appearing.
#3
I can confirm that this patch corrects the problem. Thanks, Arancaytar.
#4
Confirmed that this patch removes the error.
#5
I'm not sure why, but somehow the message resurfaced again after I applied the patch above, and I had to reapply it. Hopefully it was user error on my part but I don't see any evidence that it was and thought I should mention it here just in case. Error is gone again for now.
#6
If you were able (and had) to reapply the patch, that means your code must somehow have been reverted to the unpatched version, since you can't apply the same patch twice.
#7
#8
Rather than just patching around the error, could some logging be added to try and indicate what (other module ?) has caused the problem ?
#9
Well it has been a month and 3.5 still has the big error msg. Do I try the dev version an older version or a different module?
#10
I'm a noob, so sorry for the dumb question, but can someone explain how to apply this patch? do I place the code somewhere or install the .patch file in the module directory...
#11
i had the same problem and this patch solved it, nice work :)
#12
for all the people that can not execute the path just replace the "dhtml_menu.module" by the one in attachment. it's already patched.
#13
i forgot the file... sorry. it's here
#14
@pimentoski ;
BIG BIG thanks, you save my day!!
#15
thanks for the patch, it seems to be working.
Just for information, the error appeared after I created a new entry on my primary-links menu that is using some superfish js and css...
the entry wasn't the first one, it was generated via a vocabulary item and using the taxonomy menu module.
maybe this can help you find out a bit more about this.
#16
Hi guys,
I got this problem using http://drupal.org/project/bookmarks
They have a menu admin/build/bookmarks where you can setup different things for the bookmarks module.
Then they have many sub-menus such as admin/build/bookmarks/list which have a type other than the default (i.e. this one is a MENU_DEFAULT_LOCAL_TASK, some are MENU_CALLBACK).
This means you call the function _dhtml_menu_subtree() expecting to get some menu items, but since they all are hidden items, you are expected to return an empty array. This would work if your test at the end of that function was correct which it isn't. The attached patch is a fix for that purpose.
The patch offered in #2 is correct too, but really it is the called function that's "broken" and expected to always return some kind of an array, possibly empty.
If you have any question, feel free to ask.
Thank you.
Alexis Wilke