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

TomChiverton - June 6, 2009 - 18:36

Rolling back to 3.4 also removes the error

#2

Arancaytar - June 6, 2009 - 18:48
Status:active» needs review

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.

AttachmentSize
dhtml_menu-is-array-483920-2.patch 644 bytes

#3

silurius - June 11, 2009 - 21:37

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

#4

darthclue - June 15, 2009 - 00:49
Status:needs review» reviewed & tested by the community

Confirmed that this patch removes the error.

#5

silurius - June 16, 2009 - 16:10

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

Arancaytar - June 17, 2009 - 08:57

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

sanjanaa - June 17, 2009 - 08:58
AttachmentSize
Page1.jpg 92.77 KB
Page2.jpg 53.19 KB

#8

TomChiverton - June 25, 2009 - 17:47

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

#9

strellman - July 22, 2009 - 12:45

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

SMonsen - July 22, 2009 - 20:01

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

carvalhar - August 20, 2009 - 14:07

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

#12

pimentoski - August 25, 2009 - 11:10

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

pimentoski - August 25, 2009 - 11:11

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

AttachmentSize
dhtml_menu.zip 3.03 KB

#14

Ole Martin - September 11, 2009 - 17:38

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

#15

lizuka - October 1, 2009 - 09:29

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

AlexisWilke - October 11, 2009 - 03:40
Title:3.5 causes red error box on Drupal 6» Problem when no child menu is visible (D6, 3.5+)
Assigned to:Anonymous» AlexisWilke
Status:reviewed & tested by the community» needs review

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

AttachmentSize
dhtml-no_array-6.x.patch 391 bytes
 
 

Drupal is a registered trademark of Dries Buytaert.