I get the following error when I add the 'edit vocabulary' page in a menu, and add sub-items to it: "Warning: Invalid argument supplied for foreach() in admin_menu_merge_tree() (line 210 of admin_menu\admin_menu.inc)."
The error appears 10 times for each submenu-item with each flush of the 'administration menu'-cache. It also appears when it is part of a tree itself.
This is what I do:
- I create a new menu .
- I go to admin/structure/menu/manage/.
- I add the following link: admin/structure/taxonomy/
- I add submenu-items beneath this item.
- I save the menu, ansd flush the admin_menu-cache.

This does'nt happen with any other menu, only the 'edit vocabulary' page.

Comments

realityloop’s picture

I'm experiencing this also

Scatterspell’s picture

I get this whenever I save any kind of configuration change.

Anonymous’s picture

Hi -

I'm seeing this warning on the Status Report page about 20 times in a error/warning window.

Frequency - every time I run:

- Tasks->Flush all caches
- Tasks->Run Cron
- Save changes to a View (Calendar)

This is the behavior I'm seeing for now. Will update if more information is available.

Thanks!

Anonymous’s picture

subscribing. anyone found a solution to this.?

AlternateRoute’s picture

subscribing. it's a PITA

jonathanhuot’s picture

subscribing

rdmunoz’s picture

I got the same: arning: Invalid argument supplied for foreach() in admin_menu_merge_tree() (line 210 of /home/content/67/3783067/html/refuge/sites/all/modules/admin_menu/admin_menu.inc).

after logging in as administrator. I also get the following from admin_menu/admin_menu.inc when I try to go to user preferences.

Fatal error: Unsupported operand types in /home/content/67/3783067/html/refuge/modules/user/user.admin.inc on line 696

This prevents me from going into the user preferences and this time its a site issue that will prevent me from showing content. This is a normal priority? I'm surprised no one else has brought this up?

Help?

stompersly’s picture

This is painful, just hoping it will get assigned to someone. It happens so often when logged in as an Administrator. For example:

Cron ran successfully.
Error message

Warning: Invalid argument supplied for foreach() in admin_menu_merge_tree() (line 210 of drupal/sites/all/modules/admin_menu/admin_menu.inc).

I am on Administration menu 7.x-3.0-rc1, with Drupal core 7.8

As a work around I went to admin/config/development/logging and turned off all warnings and errors.

amcc’s picture

im getting the same thing - any update on this

amcc’s picture

to clarify what i've done to get this:
created a new menu under administration called "add content" and placed links to add different content types there rather than have them in the default place. This was done as these links are missing in the d7 version (they were helpfully there in the d6 version)

This error message started appearing after adding a new content type recently (though they didn't appear previously when adding a new content type). It will reappear when clearing the cache and sometimes when logging back in after a time.

In case anyone else is having this problem please post if you have a similar set of modules to me as this may help narrow down a conflict somewhere:
using: admin_menu-7.x-3.0-rc1.tar.gz

Address Field 7.x-1.0-beta2
Automatic Nodetitles 7.x-1.0
Backup and Migrate 7.x-2.2
Calendar 7.x-3.x-dev (2011-Nov-19)
Chaos tool suite (ctools) 7.x-1.x-dev (2011-Dec-10)
Commerce (Product Display Manager) 7.x-1.0-alpha3
Commerce Bulk Product Creation 7.x-1.0-rc4
Commerce Email 7.x-1.x-dev (2011-Dec-18)
Commerce Invoice 7.x-1.x-dev (2011-Dec-17)
Commerce PayPal 7.x-1.x-dev (2011-Nov-11)
Commerce Product Attributes 7.x-1.0-beta3
Commerce Repair 7.x-1.x-dev (2011-Sep-09)
Commerce VBO Views 7.x-1.1
Custom breadcrumbs 7.x-1.0-alpha1
Date 7.x-2.x-dev (2011-Dec-21)
Drupal Commerce 7.x-1.1
Entity API 7.x-1.0-rc1
Field collection 7.x-1.x-dev (2011-Dec-16)
IMCE 7.x-1.5
IMCE Wysiwyg bridge 7.x-1.0
Mollom 7.x-1.1
Panels 7.x-3.x-dev (2011-Dec-07)
Pathauto 7.x-1.0
References 7.x-2.x-dev (2011-Dec-17)
Rules 7.x-2.0
String Overrides 7.x-1.8
Token 7.x-1.0-beta7
Views 7.x-3.0
Views Bulk Operations (VBO) 7.x-3.0-beta3
Wysiwyg 7.x-2.1

stompersly’s picture

Every time cron would run as mentioned in #8 I would get the following error in Drupal:
Warning: Invalid argument supplied for foreach() in admin_menu_merge_tree() (line 210...

As a work around I went to admin/config/development/logging and turned off all warnings and errors, but it was still filling up my logs. So I researched this php error and found a fix. I edited the file admin_menu.inc and changed from this:

          foreach ($load_functions as $index => $function) {
            if ($function) {
              if (is_array($function)) {
                list($function,) = each($function);
              }
              // Add the loader function name minus "_load".
              $placeholder = '%' . substr($function, 0, -5);
              $path_args[$index] = $placeholder;
            }
          }

to this

       if(is_array($load_functions)){
          foreach ($load_functions as $index => $function) {
            if ($function) {
              if (is_array($function)) {
                list($function,) = each($function);
              }
              // Add the loader function name minus "_load".
              $placeholder = '%' . substr($function, 0, -5);
              $path_args[$index] = $placeholder;
            }
          }
       }

The extra check makes sure there is an array before doing the foreach() call.

It works great now. If I knew how to turn this into a patch I would, if someone else does it would be great!

omega.OFN’s picture

Thank-you stompersly, I tried to ignore the messages, but just kept annoying me. The code change worked excellent!

queenvictoria’s picture

Status: Active » Needs review
StatusFileSize
new1.16 KB

Hi @stompersly. I've created the patch from your work which seems to be working for me too.

You can read about how to create a patch here.
http://drupal.org/node/707484

You can read more about getting the admin_menu source via git here.
http://drupal.org/project/admin_menu/git-instructions

I patched against the D7 version (7.x) which is probably a Bad Idea. So my git clone command was
git clone --branch 7.x-3.x http://git.drupal.org/project/admin_menu.git

then I made your changes and
git diff > admin_menu-invalid-arg-admin_menu_merge_tree-1030856-13.patch

Status: Needs review » Needs work

The last submitted patch, admin_menu-invalid-arg-admin_menu_merge_tree-1030856-13.patch, failed testing.

sun’s picture

Status: Needs work » Fixed

Committed and pushed to 7.x-3.x and 8.x-3.x.

queenvictoria’s picture

Any ideas what I did wrong that caused the patch to fail?

sun’s picture

That particular error was a testbot failure, not related to your patch.

But that said, the admin_menu tests are not functional and known to be broken currently, so at least for this time, don't worry :)

Status: Fixed » Closed (fixed)

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