Hello,

when I switch off the Site Name and Site Slogan checkboxes, to give more space to my logo, then I get the warning:

Notice: Undefined index: localized_options in menu_navigation_links() (line 1780 of /var/www/html/drupal/includes/menu.inc).

Please see the attached screenshot.

Regards
Alex

Comments

tedfordgif’s picture

At 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)?

droplet’s picture

yugongtian’s picture

+

gregunit’s picture

Drupal 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;
}

kpoirier’s picture

Version: 7.0 » 7.2

Ran into the same issue with upgrading from 6.19 to 7.2.

pdeclarens’s picture

Version: 7.2 » 7.4
Assigned: Unassigned » pdeclarens

I 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

pdeclarens’s picture

I followed a suggestion and cleared all caches... seems it woks
administration/configuration/developement/performance "clear all caches"

saysilence’s picture

Will 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...

rhip’s picture

I changed the Source for the Secondary links to Main Menu in: admin/structure/menu/settings and the error has gone away.

texas-bronius’s picture

Thanks 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]

texas-bronius’s picture

Ahoy! 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?

jessicakoh’s picture

+

acoustika’s picture

I 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.... :-)

ShakyM’s picture

Thank you for your tip. It helped

fmesco’s picture

In 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.

willvincent’s picture

Version: 7.4 » 7.x-dev
Status: Closed (duplicate) » Needs review
StatusFileSize
new815 bytes

The 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.

Status: Needs review » Needs work

The last submitted patch, missing_index_localized_options-1081384-d7-16.patch, failed testing.

jdanthinne’s picture

Patch #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…

mayiaba’s picture

Hi 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!

mayur.pimple’s picture

But 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.

thatjustin’s picture

Issue summary: View changes

I successfully used the patch in #16, but in /modules/toolbar/toolbar.module to solve a similar, possibly the same issue.

pdeclarens’s picture

Assigned: pdeclarens » Unassigned
bmango’s picture

The 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 :)

alexverb’s picture

Like 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.

Michael G’s picture

My "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?...

hass’s picture

Priority: Minor » Major

This is not minor and really suxxx

solideogloria’s picture

Status: Needs work » Closed (outdated)

Automatically closed because Drupal 7 security and bugfix support has ended as of 5 January 2025. If the issue verifiably applies to later versions, please reopen with details and update the version.