Download & Extend

Invalid argument supplied for foreach()

Project:YUI Menu
Version:6.x-1.2
Component:Code
Category:bug report
Priority:normal
Assigned:bakyildiz
Status:active

Issue Summary

warning: Invalid argument supplied for foreach() in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\sites\all\modules\yuimenu\yuimenu.module on line 402

Drupal 6.8 with local library

Comments

#1

Assigned to:Anonymous» bakyildiz
Status:active» postponed (maintainer needs more info)

worked on my local copy with 6.8. Please can you check the YUI Menu Settings page (http://localhost/admin/settings/yuimenu). Is the Root of Menu Tree setted?

#2

Also, please check to make sure that the Access YUI permission is set for the role of the user that is logged in. If it is not, all users who do not have get that error message for all users that that permission set will get that error.

#3

Hi expairiot , still i am getting the warning message:warning: Invalid argument supplied for foreach() in modules\yuimenu\yuimenu.module on line 402.

Why this error happens , its very strange, please help me,Its very critical

Thank u

#4

@exprairiot:

Are you saying that "Access YUI" permissions must be enabled for everyone visiting the site, even guest users? Why is there even a permission for "Access YUI" then?

The root of the menu tree is set at <Primary Links> for me... for what its worth.

#5

Version:6.x-1.1» 6.x-1.1-rc2

#6

Hi,

you can rebuild menu -> http://drupal.org/node/262892

#7

you can rebuild menu -> http://drupal.org/node/262892

This is not a solution for this issue. The pages load just fine, but the menu itself throws PHP errors.

#8

For me works fine

I was truncate all cache tables and force to use "menu_rebuild();" and yui back to normal

#9

Mine is "back to normal" quite often too... it is an intermittent problem though. I still see the php errors in my logs every hour or so. I'm not going to "truncate my caches" every 5 minutes as a workaround for something that should be fixed. :-)

I'm thinking you aren't understanding, as well: The menu ALWAYS works for me. The logs, however, show php errors like the one this thread is about.

#10

#11

actually the menu stopped working all together now.

#12

I went through all my logs and I narrowed it down to when I deleted a item from the menu.

#13

Version:6.x-1.1-rc2» 6.x-1.x-dev

Druapl 6.19
jQuery Update 1.3.4
Yahoo YUI 6.x-1.1-5c2
YUI Menu 6.x.1.x-dev (2010-Jul-11)

I get a template form templatemonster, its came with the Yui Menu module, but send me this message:
warning: Invalid argument supplied for foreach() in .../sites/all/modules/yuimenu/yuimenu.module on line 216.
warning: Invalid argument supplied for foreach() in .../sites/all/modules/yuimenu/yuimenu.module on line 355.
warning: Invalid argument supplied for foreach() in .../sites/all/modules/yuimenu/yuimenu.module on line 237.
warning: Invalid argument supplied for foreach() in .../sites/all/modules/yuimenu/yuimenu.module on line 355.
warning: Invalid argument supplied for foreach() in .../sites/all/modules/yuimenu/yuimenu.module on line 237.

I update the modules and continue the problem.

Any clue?

#14

Hi rojesaga,

Is it possible to access your test environment? I need to see the problem and I need to compose the case in my local environment to solve the issue. Which template are you using?

#15

Yeap, could you give me some email to send you a user and passwrod?

#16

Web: www.remake.com.mx
User: Tester
Password: 123123

You can make any change, there is no content yet.

#17

Hi, drupalhizmetleri

Do you have time to check the problem I posted?

#18

Hi rojesega

I thank you for sharing the login details. I checked your site. The problem is giving a menu item as a root item which is a last menu item in a menu tree. I have attached a picture that show what I did to solve the problem in your site. The

By the way this will help me to reproduce the problem in my local system to fix the bug in yui menu. Thank you for your help again.

AttachmentSize
problem.jpg 187.52 KB

#19

By the way why do you use yui-menu. Your theme do not this module?

#20

Status:postponed (maintainer needs more info)» fixed

#21

Thanks a lot,

I use yui-menu because the template came with it. And in a PDF file said that it need it. I really dont understand what do the yui-menu. In the example of the site the menus scrolldown like a thickbox shadow style, maybe is that?.

#22

Is it possible to share the link of the template that you are using? I want to check it.

#23

I call with the Templatemonster service, and tell me to use the OLD versions of the YUI modules that came with the themplate. Anyway, here is the link:

http://www.templatemonster.com/drupal-themes/30398.html

DEMO
http://osc4.template-help.com/drupal_30398/?q=node/61

#24

Status:fixed» closed (fixed)

The template is using this menu module to have dorpdown menu.

#25

Version:6.x-1.x-dev» 6.x-1.2
Priority:critical» normal
Status:closed (fixed)» active

Similar to rojesaga who commented above, I too purchased a prebuilt template from Template Monster that uses YUI Menu. When I started to build my site in July, YUI Menu module 6.x-1.1 was current and it worked, not quite as smoothly as on the YUI demo pages, but OK. Because it was intermittently flakey, I tried up upgrade to 6.x-1.1-rc2 when it was released, but then the drop downs no longer worked. I had to revert back to 6.x-1.1. The drupal control panel for YUI Menu provides very few controls. I tried again when 6.x-1.2 was released, but still the drop downs don’t work and I don't know how to track down what is missing. I can deal with html, but css style sheets are pushing my upper limit. I am concerned what will happen if there was a required security release and I would have to upgrade. I would really like it to work similar to the demo page examples. (http://developer.yahoo.com/yui/examples/menu/topnavfromjswithanim.html)

My reference to intermittently flakey refers to the condition that when you mouse down a drop down, the drop down often disappears before you can get to a menu item. Turnig off animation seems to help a bit, although still not smooth, like the yahoo examples.

Also, on “some” of the drop downs, there is a 1 or 2 characher high space between the menu and the drop down. It is particularly difficult to mouse down on that drop down before it disappears.

Since YUI Menu is a module incorporated into many drupal templates, others must be having similar problems.

I am not a real programmer, which is why I chose a drupal "template," although I do have dreamweaver and have learned to track down code on the style sheets, use phpMyAdmin and during development, set up a localhost.

Any thoughts?

#26

Same problem as described above.
The problem in my case is that the nodes to bulid the dropdown menu options are restricted when anonymous user so there's no array to get (and then the "foreach" fails)
Here's how I solved:
add this line before the one the error is showing:
  if (count($menu)==0) return "";

In my case is the line 339

337:  ..............
338:  $j=1;
339:  if (count($menu)==0) return "";
340:  foreach ($menu as $menu_item) {
341:  ............

Know this is not proper code writting but it works ;-)

#27

#26 did not work for me. What was causing this for me was a view that was creating a link. When i removed children from the view, I started getting the foreach error. To solve I needed to delete the parent link, remove the menu entry from the view, then re-create it in the drupal menu system. It is definitely a bug with the YUI menu. And upgrading is not recommended, as their is currently no maintainer for the module.

Would be nice if template monster stopped providing templates with a deprecated module. I have asked them about this and they have not gotten back to me.

Good luck.

P.S. You shouldn't really ever hack a module. If you really want to make changes to the current code for the YUI menu module you should create a new module and add code there.

nobody click here