Closed (duplicate)
Project:
Drupal core
Version:
7.2
Component:
menu system
Priority:
Normal
Category:
Support request
Assigned:
Issue tags:
Reporter:
Created:
6 Mar 2012 at 20:10 UTC
Updated:
17 Apr 2017 at 23:19 UTC
Jump to comment: Most recent
Comments
Comment #1
loopzilla commentedSeeing this on all pages....
Notice: Undefined index: localized_options in menu_navigation_links() (line 1858 of /home/username/public_html/includes/menu.inc).
Upgraded from 7.10 to 7.12 and it appeared. But on the same system (different domain) it did not appear. Menus are more complex on the Drupal 7 it appears on.
Comment #2
loopzilla commentedComment #3
sbilde commentedI now have the same exact notice as above on a single page, after I installed the Menu_Token -module. If I create a menulink with path user/[site:current-user:uid]/relationships the link works, and gives me a clean user/1/relationships - path. - But the notice "Notice: Undefined index: localized_options in menu_navigation_links() (line 1858 of /Users/.../includes/menu.inc)." appear.
Comment #4
WhiteWinterWolf commentedHello all,
I'm encountering this issue too. It seems to come from some kind of invalid link in the database (or invalid request returning wrong links, I do not know).
At line 1858, Drupal tries to handle a supplementary, unwanted and invalid link.
This link has not even any title. It is initially mlid 5 in the database. I suppose it represent the default tab showing a node content : it has all standard node operation as children (delete, edit, revision, view).
As a quick and dirty workaround, I edited includes/menu.inc and changed line 1856 from that:
if (!$item['link']['hidden']) {
to that:
if (!$item['link']['hidden'] && $item['link']['title']) {
Side effect: Drupal does not handle anymore menu option without title... But I have no such strange animal on my site so it fits quite nice for the moment.
The clean solution would obviously to know this supplementary link happens to get in the $tree variable. I see that the other menu options have their hidden parameters set to '-1', showing they are callback options, while this particular one has got '0', so it is taken into account by the menu_tree_page_data() function.
However, I tried to set its value manually to '-1' in the database, but it is automatically restored to 0 (thank you Drupal :/ !).
Best regards.
Comment #5
wxman commentedI've been struggling with this same problem also. I placed print_r(array_values($links)); after line 1856. The only time I get the error is when this is in the array:
I can't find anything wrong with my menus, and it only happens when in part of my account section: */user/*. This is on a site I'm converting to D7 and it's stopped me cold in the process.
Comment #6
filijonka commentedasked chx about this and he thinks it's a duplicate of #1018614: Inaccessible menu items in navigation links cause "Notice: Undefined index: localized_options"
Comment #7
wxman commentedThat patch is for version 8.x isn't it?
Comment #8
jlea9378 commentedmy main menu is "main menu" and my secondary menu is "secondary menu".
Comment #9
stephenrobinson commentedme too, just on my user/%/bookmarks page, seems there are quite a few websites with the same issue, see https://www.google.co.uk/search?q=%22Notice:+Undefined+index:+localized_... there are 21 google results pages of Drupal sites with the same issue...
Comment #10
luchoh commentedIn my case there were orphaned menu_items without titles as poster #4 described.
The reason I had them in the first place is that I created Views pages with menus in format
text/%and then somehow (either via Features update or because of a Drupal/module bug), those were left in the table menu_items.Every time I'd visit a page with URL like text/whatever, I was getting the notice.
I cleared the cache, those menu_links persisted in the table.
I deleted them, cleared the cache, they never reappeared and the notice went away.
I hope this helps someone.
Comment #11
michaellenahan commentedWith thanks to everyone on this issue, here's how I fixed the problem in my case.
In: includes/menu.inc
Used print_r() as follows to identify the links being processed.
Added new line at 1858, your line numbering may vary.
Then in the rendered page, I did a view-source in the browser, and discovered the link which did not have localized_options set.
In: Structure > Menus
I found the offending menu item, deleted it and re-created it.
(For the record I'm using the menu token module - the offending item had been incorrectly set as using tokens)
Hope this helps someone.
Comment #12
jlea9378 commentedI followed the advice in post #11, though I added an if statement to only print if localized options wasn't set or not an array. Otherwise the results were too overwhelming to sift through.
My problem was caused by remnants from the accountmenu module:
I went into phpMyAdmin and deleted the row from the menu_links table where mlid = 1313 then cleared my site cache and the problem went away! Thanks!
Comment #13
scampbell70 commentedLike loopzilla I just upgraded my site from 7.10 or 7.12 I forget honestly to 7.14 a few minutes ago and now I am getting this error on every page.
Notice: Undefined index: localized_options in menu_navigation_links() (line 1857 of /home2/asperge6/public_html/scouttroop210/includes/menu.inc).
Can someone please help me fix this?
my site is http://scouttroop210.org/
Comment #14
jlea9378 commentedscampbell70: I suggest following the advice in posts 11 and 12. If you have the Devel module installed you can use dprint_r, otherwise, use print_r. I have Devel installed so I used dprint_r.
Edit includes/menu.inc, function menu_navigation_links() and add these two lines on/around lines 1861-1862:
so that your code looks like this:
Then try to reproduce the notice. The dprint_r (or print_r) function should execute and tell you where the problem is. You can then delete the corresponding record from the menu_links table via phpMyAdmin (assuming you have that). You will need to clear the site cache after you delete the row.
Comment #16
nhanchu commentedI have the same problem...
I suspect this has something with the bug "my account" which is always disable no matter how many times I tried to enable it.
Comment #17
nhanchu commentedOh OMG is it that simple!!!
I have tried several advices but the problem remained.
However, with frustration wth such annoying "line 1857" - I just deleted it.. and guess what..
the problem disappeared !!!!
What the Helllllll...
Comment #18
Alexander Matveev commentedGuys, looks like this performs when you installing Minimal profile of Drupal Installation. And just later enabling Menu module. I just disabled my custom theme and modules, re-enabled Menu module and my themes and modules, and error gone *happy*
Comment #19
granticusiv commentedI encountered this issue when I started playing around with Contextual Filters. I enabled the default Taxonomy view that comes with Views, and then created a new view that followed the same contextual filter options but assigned it as a menu link to the main menu. To get rid of the error message "Undefined index: localized_options in menu_navigation_links" I had to go into phpMyAdmin, find the default taxonomy link in the menu_links table (seems to always have mlid 27) and reset the link_title to "Taxonomy term" and menu_name to "navigation".
Didn't have to make any changes to core Drupal files. Hope this helps someone else. This page also helped me http://drupal.org/node/1018614
Comment #20
FluxRostrum commentedgood call worked for me too. I saved the line of code in case it needs to go back. I'm not doing any localization so... so far so good.
Comment #21
JorgePadron commentedgranticusiv, thank you... Your solution worked OK!
Kerke
Comment #22
mhamed commentedI ve got I think the same notice
but the on drupal:
7.20
trying to make a bilingual site
English/Arabic
i installed all the required modules for the translation
everything goes well i tried to create a :
content type basic page
done
but gives me
Notice: Undefined index: localized_options in menu_navigation_links() (line 1860 of /home/user/public_html/includes/menu.incDeleted everything for both languages content and menus
cleared the cache
create an article type no error
but
on the basic content type
the notice fired
i do not want to change the core menu.inc as suggested that can not be the solution
W'll try other issues
Comment #23
Anonymous (not verified) commentedI have Marinelli theme and drupal 7.21
And I see this bad error report in every pages.. in my site http://www.lavatrici-industriali.eu/
The persistent error is because in http://www.lavatrici-industriali.eu/admin/structure/menu/settings I have this settings for primary and secondary links :
ORIGIN OF THE MAIN MENU
= Main menu
and
ORIGIN OF SECONDARY MENU
= Navigation
now, when i chance in :
ORIGIN OF THE MAIN MENU
= Main menu
and
ORIGIN OF SECONDARY MENU
= no connection to secondary links
for magic ... the problem is resolved ..and all my drupal works magically well
Undefined index: localized_options in menu_navigation_links() (line 1860 ... ??
The error is disappeared forever! Best Solution for me and i think for You.
Comment #24
rooby commentedIs this a duplicate of #1018614: Inaccessible menu items in navigation links cause "Notice: Undefined index: localized_options"?
Comment #25
csmcreative commentedI was stuck on this for a while. I'm using Tweme (Bootstrap theme) and since the error was regarding the nav I went into Appearance > Settings for my theme and disable the secondary and main menu. I believe for me it was the secondary menu I set as Navigation that broke it. Now it seems ok.
Comment #26
mayur.pimple commentedSubscribe +
Comment #27
rooby commentedChanging title back as the solution in #23 is not really a solution to the original post.
Also, we use the status field instead of adding a status to the title.
Comment #28
no_angel commentedadd issue summary tag
Comment #29
vids commentedI am not sure if my solution is right or not ..
But, I have added this line
before
And removed
these lines..
So, my final code will be"
I hope it will help some one..
Thanks!
Comment #30
scott.browne commentedhttps://www.drupal.org/node/1018614
This issue seems similar and worth checking out this post. I fixed my error with #83 in that post. I think it was brought up once in this post earlier but worth checking out as it's more active.
Hope that helps.
Comment #31
Sakhmed commented#10 Resolved my problem. Thanks!
Comment #32
hass commentedComment #33
allsite commentedI got this error when cloning a view in D7 that had a "Normal" menu entry. Deleting the normal menu entry from the source view prior to cloning resolved the issue. The new cloned view was error free.