Closed (outdated)
Project:
Drupal core
Version:
7.x-dev
Component:
menu system
Priority:
Major
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
4 Mar 2011 at 15:06 UTC
Updated:
9 Jul 2019 at 18:57 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
tedfordgif commentedAt first glance, this seems like it's related to something in your navigation menu, not the site name and slogan. Are you sure the bug only shows up when you toggle those options off? Does the notice go away if you clear your menu cache (admin/config/development/performance)?
Comment #2
droplet commentedmaybe same erro: #1018614: Inaccessible menu items in navigation links cause "Notice: Undefined index: localized_options"
Comment #3
yugongtian commented+
Comment #4
gregunit commentedDrupal 7 upgrade error - Please help - Notice: Undefined index: localized_options in menu_navigation_links()
Drupal 7 Site: activeblognews.com
Upgrade from 6.20 (I followed directions – uninstalling all but core modules and switching to garland theme first)
I never used local
I followed all suggestion found in post http://drupal.org/node/1081384
I changed themes, went from fixed with to fluid and back.
Turned on local and turned it back off
What can I try next?
Theme: Kanji
Notice: Undefined index: localized_options in menu_navigation_links() (line 1780 of /home/activebl/public_html/includes/menu.inc)
menu.inc:
// Create a single level of links.
$router_item = menu_get_item();
$links = array();
foreach ($tree as $item) {
if (!$item['link']['hidden']) {
$class = '';
$l = $item['link']['localized_options']; /* This is line 1780 in menu.inc
$l['href'] = $item['link']['href'];
$l['title'] = $item['link']['title'];
if ($item['link']['in_active_trail']) {
$class = ' active-trail';
$l['attributes']['class'][] = 'active-trail';
}
// Normally, l() compares the href of every link with $_GET['q'] and sets
// the active class accordingly. But local tasks do not appear in menu
// trees, so if the current path is a local task, and this link is its
// tab root, then we have to set the class manually.
if ($item['link']['href'] == $router_item['tab_root_href'] && $item['link']['href'] != $_GET['q']) {
$l['attributes']['class'][] = 'active';
}
// Keyed with the unique mlid to generate classes in theme_links().
$links['menu-' . $item['link']['mlid'] . $class] = $l;
}
}
return $links;
}
Comment #5
kpoirier commentedRan into the same issue with upgrading from 6.19 to 7.2.
Comment #6
pdeclarens commentedI have the following errors with the 7.4 version:
Notice : Undefined index: access dans _menu_translate() (ligne 778 dans/homepages/42/d141549472/htdocs/mbc/drupal-7.4/includes/menu.inc).
Notice : Undefined index: access dans menu_contextual_links() (ligne 2117 dans/homepages/42/d141549472/htdocs/mbc/drupal-7.4/includes/menu.inc).
Notice : Undefined index: access dans _menu_translate() (ligne 778 dans/homepages/42/d141549472/htdocs/mbc/drupal-7.4/includes/menu.inc).
Notice : Undefined index: access dans menu_contextual_links() (ligne 2117 dans/homepages/42/d141549472/htdocs/mbc/drupal-7.4/includes/menu.inc).
Notice : Undefined index: access dans _menu_translate() (ligne 778 dans/homepages/42/d141549472/htdocs/mbc/drupal-7.4/includes/menu.inc).
Notice : Undefined index: access dans menu_contextual_links() (ligne 2117 dans/homepages/42/d141549472/htdocs/mbc/drupal-7.4/includes/menu.inc).
Notice : Undefined index: access dans _menu_translate() (ligne 778 dans/homepages/42/d141549472/htdocs/mbc/drupal-7.4/includes/menu.inc).
Notice : Undefined index: access dans menu_contextual_links() (ligne 2117 dans/homepages/42/d141549472/htdocs/mbc/drupal-7.4/includes/menu.inc).
Notice : Undefined index: access dans _menu_translate() (ligne 778 dans/homepages/42/d141549472/htdocs/mbc/drupal-7.4/includes/menu.inc).
Notice : Undefined index: access dans menu_contextual_links() (ligne 2117 dans/homepages/42/d141549472/htdocs/mbc/drupal-7.4/includes/menu.inc).
Seems problem is in the menu.inc file
thanks for help
Comment #7
pdeclarens commentedI followed a suggestion and cleared all caches... seems it woks
administration/configuration/developement/performance "clear all caches"
Comment #8
saysilence commentedWill this ever get fixed? drupal 7.7:
Notice: Undefined index: localized_options in menu_navigation_links() (line 1782 of /var/www/includes/menu.inc).the issue seems to show up when main menu links source is set to anything else than Main menu.
in #1018614: Putting Navigation menu as source for secondary_links, gives me "Notice: Undefined index..."
was a patch supplied, why it's not integrated yet?
Is it unsafe or what?
This is kind of annoying...
Comment #9
rhip commentedI changed the Source for the Secondary links to Main Menu in: admin/structure/menu/settings and the error has gone away.
Comment #10
texas-bronius commentedThanks for the tip, @RhiannonAmyBuck. Looks like I can consistently reproduce the error when:
* Source for Main Links == Main Menu
* Source for Secondary == Main Menu
* and Visiting a page that is a subitem (what we would usually expect to show as a submenu)
Removing Main Menu from either Main or Secondary, the issue goes away.
This is Drupal 7.8, default theme.
[edit: Could be only for menu subitems created by a View, as is my current case, it appears. Another, normal page as a submenu doesn't seem to throw the notice]
Comment #11
texas-bronius commentedAhoy! More discoveries: In addition to the being, in my case at least, limited only to menus generated by a specific View, enabling the menublock module, I see that it is actually trying to link "gallery/%25"-- maybe it's using that argument placeholder and confusing something somewhere thus causing the notice to show?
Comment #12
jessicakoh commented+
Comment #13
acoustika commentedI had this error also...... Using Zen theme, and have a custom menu in region navigation so have disabled "Main menu" in theme settings...., The error went away when i thought og ALSO disabling "Main menu" in global settings.... :-)
Comment #14
ShakyM commentedThank you for your tip. It helped
Comment #15
fmesco commentedIn my case, I had Source for Main Links = Main Menu and source for Secondary Links = Custom Menu. Changing just the Secondary Links to No Secondary Links solved the persistent errors for me.
Comment #16
willvincent commentedThe problem is that -- right or wrong -- the function is assuming that localized_options will always be present and in the proper format. This seems to happen a lot throughout core. While things like this *should* always be set, and in the proper format, having a check to ensure they are before just assuming so would probably be wise.
The attached patch adds a check to see if localized_options is set, and is an array (with at least a title element), if not, it attempts to use $item['options'], and if that too is missing or malformed, skips inclusion of the menu item because clearly that menu item is broken at that point.
I think it's probably reasonable to accept that occassionally a menu item might not include localized_options, but I'd be surprised if one ever didn't have options.
Comment #18
jdanthinne commentedPatch #16 working fine for me, no more notices…
But I had to do the exact same patch for the i18n_menu.module, so the initial problem is perhaps somewhere else, and this seems a temporary cure…
Comment #19
Robin Millette commented#1018614: Inaccessible menu items in navigation links cause "Notice: Undefined index: localized_options" and #1470830: Notice: Undefined index: localized_options in menu_navigation_links() (line 1860 of /home/user/public_html/includes/menu.inc are also related. There's a patch in progress in the former too, although it hasn't been touched since January.
Comment #20
mayiaba commentedHi fmesco. Woud you bother telling me, how exactly did you do this? Where are your "secondary links"? Do you mean the "Second Menu"?
Thanks in advance!
Comment #21
mayur.pimple commentedBut whem Again Set Secondary menu, then errorr shown . The wrong '%/user' entry is save in database. So if we remove this entry i think error will not shown again.
Comment #22
thatjustin commentedI successfully used the patch in #16, but in /modules/toolbar/toolbar.module to solve a similar, possibly the same issue.
Comment #23
pdeclarens commentedComment #24
bmango commentedThe patch in #16 fixed the problem for me. I had set a menu path to a views page with a contextual filter that had an argument placeholder in the path. Every time I included the argument I was getting the error. I am on Drupal 7.51.
The patch seems fine. Is there a possibility of setting this to RTBC, with a view to having it committed?
Many thanks for the patch :)
Comment #25
alexverb commentedLike mentioned in #18 the problem doesn't seem to be from menu. It's expecting localized_options, and I think it should receive them. My best guess is since I have the same issue when using wildcards in the menu link path of a view, it's most likely views (or ctools) related.
Comment #26
Michael G commentedMy "contribution"...
Have similar issue.
I get: Notice: Undefined index: localized_options in menu_navigation_links() (line 1871 of /home1/inlowgea/public_html/includes/menu.inc).
The "Navigation" menu is a MUST when using "Rooms" booking for anonymous users...
Can't allow potential customers getting red error message on every page they open...
Thank you for any workaround?...
Comment #27
hass commentedThis is not minor and really suxxx
Comment #28
solideogloria commentedFollowing this comment didn't work for me: https://www.drupal.org/project/drupal/issues/1020364#comment-8386983