Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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
)
)
Comment | File | Size | Author |
---|---|---|---|
#3 | admin_menu-issetmapfix-2502695-3.patch | 758 bytes | seanbfuller |
Comments
Comment #1
sonicthoughts CreditAttribution: sonicthoughts as a volunteer commented+1 this continues to happen with 2015-Mar-20 dev version
Comment #2
Hopian CreditAttribution: Hopian as a volunteer commentedHey 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
change to
Hope this will help you guys untill its proper fixed.
greetz Hopian
Comment #3
seanbfuller CreditAttribution: seanbfuller commentedHere's a quick patch that adds the isset check. Needs review.
Comment #4
hitfactory CreditAttribution: hitfactory commentedAlso seeing this on an install with Media module. Confirming patch in #3 removes the error.
Comment #5
sonicthoughts CreditAttribution: sonicthoughts as a volunteer commentedConfirming patch in #3 removes the error.
Comment #6
biguzis CreditAttribution: biguzis commentedThanks, #3 works also for me.
Comment #7
Mario Steinitz#3 works for us as well. So far, we didn't experience any side effects.
Thanks
Comment #8
sonicthoughts CreditAttribution: sonicthoughts as a volunteer commentedPlease commit.
Comment #9
doxigo CreditAttribution: doxigo commented#3 works just fine and there's no issues so far, I guess we can commit it.
Comment #10
nattyweb CreditAttribution: nattyweb commented#3 patch worked for me. Thank you.
Comment #11
Dave ReidI 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.
Comment #13
RoSk0I'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.
Comment #14
rozh CreditAttribution: rozh commentedI can confirm that problem still exist with latest dev of file_entity.
Comment #15
danyalejandro CreditAttribution: danyalejandro commentedDec 28 2015 This bug still happens even when using latest file entity dev version. Please commit.
Comment #16
t.a. barnhart CreditAttribution: t.a. barnhart commentedi 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.
Comment #17
aimeeraePatch 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.
Comment #18
glynster CreditAttribution: glynster commentedRTBC fixes the problem.
Comment #19
mario_prkos CreditAttribution: mario_prkos at Agence Inovae commentedThis 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;
}
}
Comment #20
4kant CreditAttribution: 4kant commentedSolution #19 works for me.
Thanks!
Comment #21
salvisI 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.
Comment #22
klonosI'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.
Comment #23
loopduplicateHi @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?
Comment #24
mvdve CreditAttribution: mvdve commentedI 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.
Comment #25
4kant CreditAttribution: 4kant commentedThanks 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....
Comment #26
joelpittetRTBC bump
Comment #28
truls1502Fixed and added in 7.x-3.x-dev