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.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

TomChiverton’s picture

Rolling back to 3.4 also removes the error

cburschka’s picture

Status: Active » Needs review
FileSize
644 bytes

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.

silurius’s picture

I can confirm that this patch corrects the problem. Thanks, Arancaytar.

Anonymous’s picture

Status: Needs review » Reviewed & tested by the community

Confirmed that this patch removes the error.

silurius’s picture

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.

cburschka’s picture

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.

sanjanaa’s picture

FileSize
53.19 KB
92.77 KB
TomChiverton’s picture

Rather than just patching around the error, could some logging be added to try and indicate what (other module ?) has caused the problem ?

strellman’s picture

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?

SMonsen’s picture

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...

carvalhar’s picture

i had the same problem and this patch solved it, nice work :)

pimentoski’s picture

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.

pimentoski’s picture

FileSize
3.03 KB

i forgot the file... sorry. it's here

Ole Martin’s picture

@pimentoski ;
BIG BIG thanks, you save my day!!

lizuka’s picture

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.

AlexisWilke’s picture

Title: 3.5 causes red error box on Drupal 6 » Problem when no child menu is visible (D6, 3.5+)
Assigned: Unassigned » AlexisWilke
Status: Reviewed & tested by the community » Needs review
FileSize
391 bytes

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

did1979’s picture

Hy,

the problem comes with the Book module. When I choose Menus without DHTML for my book, it works correctly.

I will try the patch.
ciao.
did

asb’s picture

Please have a look at #467770: Book structure disappears repeatedly, if problems with the combination of the contributed 'DHTML Menu' module and the core 'Book' module appear.

Greetings, -asb

drupalusering’s picture

Patch in #16 is perfect

epe’s picture

Patch works fine, hope the next version of module will solve problem, so we dont need to patch again.

silurius’s picture

Any chance dhtml_menu-is-array-483920-2.patch in #3 can get rolled into a new release? I just installed dhtml_menu-6.x-3.x-dev and completely forgot about all this until I searched and discovered it again, which is obviously my own silly oversight, but still, it's been a while! :-)

geerlingguy’s picture

+1 on committing the patch in #16!

I can confirm this fixed the problem for me (was getting LOADS of watchdog errors...).

AlexisWilke’s picture

Status: Needs review » Reviewed & tested by the community

Changing status!

maxchock’s picture

thanks for the patch.

Cleo’s picture

The patch in #2 solved my problem! U save my day! Thnx

enkara’s picture

Thanks for the patch!

guldi’s picture

#16 solves it. thx.

cburschka’s picture

Status: Reviewed & tested by the community » Fixed

Thanks for this patch!

The is_array check still isn't enough, particularly as a replacement for isset, because is_array() will trigger a notice when called on a non-existent array index. So what is needed is an isset before the is_array:


  return isset($tree[$key]['below']) && is_array($tree[$key]['below']) ? $tree[$key]['below'] : array();

That's what I've committed now.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

ekorich’s picture

FileSize
17.57 KB

the patch works but it's add one extra menu when i used with sucker menu from zero point theme.

AlexisWilke’s picture

ekorich,

There is an option in the settings to turn off that extra menu entry. It's there because the top-menu becomes the menu opener. So if not there you actually cannot go to that page.

However, if you're using suckerfish, you may not need DHTML....

Thank you.
Alexis Wilke

ekorich’s picture

I just use dhtml menu cos i can't use sucker menu in my left sidebar so i still use dhtml menu. well i guest i should turn off it for primary menu cos it's already use sucker fish. Thanks Alexis

Ela’s picture

subscribing for any possible updates.. was having this error too.

1661Design’s picture

subscribing.

avior’s picture

#2 patch works great. this solved my problem

thanks