Hello,
I am using Drupal 7.8, and when I am in admin website I got the message
Notice: Undefined index: main-menu in menu_block_view() (line 462 of /modules/menu/menu.module).
I can't remember what I have done the last before it error came up, maybe this issue: 1319484 was a reason for it came up.
| Comment | File | Size | Author |
|---|---|---|---|
| #9 | drupal-Undefined_index_main-menu_in_menu_block_view-1319786-9.patch | 537 bytes | Mike Lewis |
Comments
Comment #1
marcingy commentedComment #2
jhammer98 commentedI just finished installing the latest version of the martplug install profile and received pretty much the same error except I got three of them:
Notice: Undefined index: menu-shop in menu_block_view() (line 462 of /var/www/martplug/modules/menu/menu.module).
Notice: Undefined index: menu-about in menu_block_view() (line 462 of /var/www/martplug/modules/menu/menu.module).
Notice: Undefined index: menu-legal in menu_block_view() (line 462 of /var/www/martplug/modules/menu/menu.module).
Right after the install process completed I went to the home page and was immediately greeted with those messages, I haven't done anything else to 'deflower' the system at this point.
The latest drupal core seemed to install just fine...
Comment #3
jhammer98 commentedtruls1502,
This may or may not be related to your issue but check out issue#1266038 about increasing the timeout parameter in your php.ini file...that took care of my problem:
http://drupal.org/node/1266038#
Comment #4
authentictech commentedSimilar problem for me after deleting a custom-made menu. There was still a reference to the deleted menu somewhere in Drupal. For me, I had left a menu block inside a panel on a page somewhere.
I don't know if this describes you as your menu is the main menu and you wouldn't have deleted that (would you?) but it could be a conflict with another module.
You could also try flushing all your Drupal caches (menu cache particularly).
Comment #5
trouble.tribbles commentedHey Authentictech,
I'm having the same issue after deleting menu. Any tricks to finding the reference?
Comment #6
geek-merlini also had this ( with another menu name and in current drupal line 469)
source sais: a menu block that does not exist is tried to display.
how to debug this: (!! change "menu_foo" with your offending menu !!)
* in phpmyadmin do a full search on the offending "%menu-foo%"
this gave me the hint that i left an entry in context.module settings!
if this does not help someone, take the bazooka (not tested):
* install devel.module
* before the offending line insert:
have fun!
Comment #7
truls1502I am going to close this ticket. Please re-open the ticket if you still have issue.
Comment #8
fergusong commentedOkay, I just upgraded to core 7.52 and this issue recurs.
My workaround, is a hack in menu.module.
Which seems to cure it.
I don't think I'll learn the 'right' way to submit
a patch for this bit of code.
If it is useful, please help yourself.
It has been on my 'core hacks' list for
years, but I forget to apply it this time...
around line 480
Cheer, gjf
/**
* Implements hook_block_view().
*/
function menu_block_view($delta = '') {
$menus = menu_get_menus(FALSE);
/* gjf hack adds the empty check */
if (!empty($menus[$delta])) {
$data['subject'] = check_plain($menus[$delta]);
}
// end gjf hack
$data['content'] = menu_tree($delta);
// Add contextual links for this block.
if (!empty($data['content'])) {
$data['content']['#contextual_links']['menu'] = array('admin/structure/menu/manage', array($delta));
}
return $data;
}
Comment #9
Mike Lewis commentedHi,
I just ran into this issue on 7.x-5.2 as well. In my case, I'm trying to load the menu block programmatically for my own purposes. I used devel to print the menu array that it says the index is undefined in, and there's a value in there. I don't know what's going on, but the old "wrap an isset around it" band-aid worked for me.
Here's a patch.
Hope this helps.
Comment #10
sobi3ch commentedSo I fixed this removing
FALSEfrommenu_get_menus(FALSE)(Exact line in code).Reading api for menu_get_menus you can find out that
And I injected programmatically
system(menu) block to my global page tempalte and withFALSEparameter this block (main-menu) is not returned. So removing parameter from function in core module it's obvious hack. The easiest solution I see is to create patch for it.I hope this can help somehow.