This may be related to a few other bugs I saw in the queue about clearing the cache. This one in particular is a result of the map element not being present on the $menu_item. Dumping a quick dump of the menu item object, I saw four or five that were related to the media module (1.x). A quick isset seemed to supress the error without any different in behavior (I think):

        $menu_item = menu_get_item($bundle_info['admin']['real path']);
        if (isset($menu_item['map'])) {
          $access_arguments = menu_unserialize(serialize($access_arguments), $menu_item['map']);
        }

That of course leaves $access_arguments undefined for the next bit of code, but it seems like that would make it just continue anyway.

Here's a dump of those menu items:

Array
(
    [path] => admin/config/media/file-types/manage/%
    [load_functions] => Array
        (
            [5] => 
        )

    [to_arg_functions] => 
    [access_callback] => 0
    [access_arguments] => a:0:{}
    [page_callback] => file_entity_list_types_page
    [page_arguments] => a:0:{}
    [delivery_callback] => 
    [fit] => 62
    [number_parts] => 6
    [context] => 0
    [tab_parent] => 
    [tab_root] => admin/config/media/file-types/manage/%
    [title] => Manage file types
    [title_callback] => t
    [title_arguments] => 
    [theme_callback] => 
    [theme_arguments] => a:0:{}
    [type] => 6
    [description] => Manage files used on your site.
    [position] => 
    [weight] => 0
    [include_file] => sites/all/modules/media/file_entity/file_entity.admin.inc
    [href] => admin/config/media/file-types/manage/audio
    [tab_root_href] => admin/config/media/file-types/manage/audio
    [tab_parent_href] => 
    [options] => Array
        (
        )

    [access] => 
    [original_map] => Array
        (
            [0] => admin
            [1] => config
            [2] => media
            [3] => file-types
            [4] => manage
            [5] => audio
        )

)
Array
(
    [path] => admin/config/media/file-types/manage/%
    [load_functions] => Array
        (
            [5] => 
        )

    [to_arg_functions] => 
    [access_callback] => 0
    [access_arguments] => a:0:{}
    [page_callback] => file_entity_list_types_page
    [page_arguments] => a:0:{}
    [delivery_callback] => 
    [fit] => 62
    [number_parts] => 6
    [context] => 0
    [tab_parent] => 
    [tab_root] => admin/config/media/file-types/manage/%
    [title] => Manage file types
    [title_callback] => t
    [title_arguments] => 
    [theme_callback] => 
    [theme_arguments] => a:0:{}
    [type] => 6
    [description] => Manage files used on your site.
    [position] => 
    [weight] => 0
    [include_file] => sites/all/modules/media/file_entity/file_entity.admin.inc
    [href] => admin/config/media/file-types/manage/image
    [tab_root_href] => admin/config/media/file-types/manage/image
    [tab_parent_href] => 
    [options] => Array
        (
        )

    [access] => 
    [original_map] => Array
        (
            [0] => admin
            [1] => config
            [2] => media
            [3] => file-types
            [4] => manage
            [5] => image
        )

)
Array
(
    [path] => admin/config/media/file-types/manage/%
    [load_functions] => Array
        (
            [5] => 
        )

    [to_arg_functions] => 
    [access_callback] => 0
    [access_arguments] => a:0:{}
    [page_callback] => file_entity_list_types_page
    [page_arguments] => a:0:{}
    [delivery_callback] => 
    [fit] => 62
    [number_parts] => 6
    [context] => 0
    [tab_parent] => 
    [tab_root] => admin/config/media/file-types/manage/%
    [title] => Manage file types
    [title_callback] => t
    [title_arguments] => 
    [theme_callback] => 
    [theme_arguments] => a:0:{}
    [type] => 6
    [description] => Manage files used on your site.
    [position] => 
    [weight] => 0
    [include_file] => sites/all/modules/media/file_entity/file_entity.admin.inc
    [href] => admin/config/media/file-types/manage/video
    [tab_root_href] => admin/config/media/file-types/manage/video
    [tab_parent_href] => 
    [options] => Array
        (
        )

    [access] => 
    [original_map] => Array
        (
            [0] => admin
            [1] => config
            [2] => media
            [3] => file-types
            [4] => manage
            [5] => video
        )

)
Array
(
    [path] => admin/config/media/file-types/manage/%
    [load_functions] => Array
        (
            [5] => 
        )

    [to_arg_functions] => 
    [access_callback] => 0
    [access_arguments] => a:0:{}
    [page_callback] => file_entity_list_types_page
    [page_arguments] => a:0:{}
    [delivery_callback] => 
    [fit] => 62
    [number_parts] => 6
    [context] => 0
    [tab_parent] => 
    [tab_root] => admin/config/media/file-types/manage/%
    [title] => Manage file types
    [title_callback] => t
    [title_arguments] => 
    [theme_callback] => 
    [theme_arguments] => a:0:{}
    [type] => 6
    [description] => Manage files used on your site.
    [position] => 
    [weight] => 0
    [include_file] => sites/all/modules/media/file_entity/file_entity.admin.inc
    [href] => admin/config/media/file-types/manage/default
    [tab_root_href] => admin/config/media/file-types/manage/default
    [tab_parent_href] => 
    [options] => Array
        (
        )

    [access] => 
    [original_map] => Array
        (
            [0] => admin
            [1] => config
            [2] => media
            [3] => file-types
            [4] => manage
            [5] => default
        )

)
Files: 
CommentFileSizeAuthor
#3 admin_menu-issetmapfix-2502695-3.patch758 bytesseanbfuller
PASSED: [[SimpleTest]]: [MySQL] 228 pass(es). View

Comments

sonicthoughts’s picture

+1 this continues to happen with 2015-Mar-20 dev version

Hopian’s picture

Hey guys,

I am pretty new to drupal.
So i dont know what the rules are for making
a patch.

Neither do i know the perfect solution to this bug.
But i know how the errors would be gonna and
wont change anything to the script.

here it is
file : admin_menu.map.inc
line : 86

$access_arguments = menu_unserialize(serialize($access_arguments), $menu_item['map']);

change to

if(!isset($menu_item['map']))
     $menu_item['map'] = "";
$access_arguments = menu_unserialize(serialize($access_arguments), $menu_item['map']);

Hope this will help you guys untill its proper fixed.
greetz Hopian

seanbfuller’s picture

Status: Active » Needs review
FileSize
758 bytes
PASSED: [[SimpleTest]]: [MySQL] 228 pass(es). View

Here's a quick patch that adds the isset check. Needs review.

hitfactory’s picture

Also seeing this on an install with Media module. Confirming patch in #3 removes the error.

sonicthoughts’s picture

Confirming patch in #3 removes the error.

biguzis’s picture

Thanks, #3 works also for me.

Mario Steinitz’s picture

#3 works for us as well. So far, we didn't experience any side effects.

Thanks

sonicthoughts’s picture

Please commit.

doxigo’s picture

#3 works just fine and there's no issues so far, I guess we can commit it.

maranjo’s picture

#3 patch worked for me. Thank you.

Dave Reid’s picture

Status: Needs review » Postponed (maintainer needs more info)

I think this is actually fixed by updating the File Entity module to the latest version (7.x-2.x-dev): http://cgit.drupalcode.org/file_entity/commit/?id=d0d2ac85ff8bc09ebb2251.... I'm not sure this is a bug in Admin menu.

RoSk0’s picture

Status: Postponed (maintainer needs more info) » Reviewed & tested by the community

I'm pretty sure that there could be other situations when "map" may be not set so it's a good thing to have this check in place not have PHP notices.

rozh’s picture

I can confirm that problem still exist with latest dev of file_entity.

danyalejandro’s picture

Dec 28 2015 This bug still happens even when using latest file entity dev version. Please commit.

t.a. barnhart’s picture

i tried to apply the patch (on my desktop) but it simply hung up and admin_menu.map.inc file just disappeared. i was able to find the right lines in the api file to make the change manually.

aimeerae’s picture

Patch from #3 worked for me. No other modules needed to be changed. +1 on committing this patch. Thank you!

Note: for any other people reading this thread, in our use case, the error was only showing up for non-admin level users. The error surfaced in role-based testing. We also are using Masquerade, but the error was duplicated using both Masquerade and a direct login with a non-admin account.

glynster’s picture

RTBC fixes the problem.

mario_prkos’s picture

This problem rise when some user don't have access to some menus. At that point as it visible from function menu_get_item() the map index of $router_item will not be defined and when it comes to function field_ui_admin_menu_map() brings notice that is undefined.

In my opinion it will be safer to set this value to null ($router_item['map'] = null) and let the line
$access_arguments = menu_unserialize(serialize($access_arguments), $menu_item['map']) execute anyway.

That will not change any logic eventually lies beneath but remove unwanted notice. For those one that don't want to use patch. That can be done using hook.

/**
* Implements hook_menu_get_item_alter().
*/
function mymodule_menu_get_item_alter(&$router_item, $path, $original_map) {
if (empty($router_item['map'])) {
$router_item['map'] = NULL;
}
}

4kant’s picture

Solution #19 works for me.
Thanks!

salvis’s picture

Priority: Minor » Normal

I agree with the analysis in #19, but not with the conclusion. Forcing the values to NULL may cause obscure issues in other modules that expect them to be not set.

The patch in #3 works just fine, without any potential side effects. (I don't have File Entity module at all.) Please commit.

I'm increasing the Priority because getting a dozen notices in watchdog after every cache clear is not funny.

klonos’s picture

I'm getting this error on a fresh installation of core 7.50+1-dev (2016-Jul-08) with admin_menu 7.x-3.0-rc5+3-dev (2015-Mar-21).

I don't have file_entity installed either - only Entity API 7.x-1.7+10-dev (2016-Mar-18) and it doesn't happen only on cache clear - even just visiting pages like /admin/reports/updates (but checking the log it seems that it is always after a cron run). But that is really random, while cache clear brings the error up each time, so I guess it's the best way to reproduce this.

As I said, fresh installation with a fairly small amount of basic modules installed (14 in total but usual suspects like views, rules, entity, pathauto, token, date etc).

Confirming that #3 fixes the issue. Please commit so that the annoyance stops and you can iterate on a better fix.

loopduplicate’s picture

Hi @klonos , re: #22, I couldn't reproduce with just core 7.50+1-dev, admin_menu 7.x-3.0-rc5+3-dev, and Entity API 7.x-1.7+10-dev. I guess one of the other modules you have installed has to be installed for this to happen? My guess is you are using Media 1.x?

mvdve’s picture

I have the same issue, which is probably caused by multifield (I have this issue after installing the multifield module).
Solved with patch #3 so i agree with RTBC.

4kant’s picture

Thanks for #3.
In my case the error was shown when logged in as a user with different roles - one of those with, the other without permissions to use admin menu.
Maybe a trace...

[edit]:Huups - I had already commented solution #19 where this use case is mentioned....