Closed (outdated)
Project:
Drupal core
Version:
7.x-dev
Component:
menu system
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
3 Mar 2011 at 07:03 UTC
Updated:
14 Sep 2016 at 01:36 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
caligan commentedSuccessfully replicated this with the provided steps. Menu items registered in the menu_links table that are later turned into MENU_CALLBACKs (which should not be in menu_links) aren't removed from the table by _menu_navigation_links_rebuild() because their paths are still valid.
This patch sieves for MENU_CALLBACK items and removes them from menu_links along with any stale entries.
Comment #2
ins0mn1ac22 commentedpatch looks good. nitpick:
missing a space after 'router_path' in the second db_or() condition.
here are some hints to help you build a test:
Comment #3
caligan commentedPatch bundled with a test verifying that menu items changed to MENU_CALLBACK are removed from menu_links table (and so from visible menus).
Comment #4
sunComment #5
sun#1148940: Menu links not removed from menu has been marked as duplicate
Comment #6
blackice2999 commentedHi,
works fine for me. It can be good tested with Views and also fixes: #1029022: Menu item created in a view is not removed from the menu when removed from the view
Comment #7
sunThis needs some more reviews, especially from menu system maintainers.
I don't have time myself right now, but will try to come back to this issue shortly.
Comment #8
yoroy commentedRelated major bug: #550254: Menu links are sometimes not properly re-parented
Comment #9
sunWhy isn't this simply an "else" ?
-2 days to next Drupal core point release.
Comment #10
hefox commentedSame question as sun; switching to other type of menu items other than normal item, like local tasks, will make them not-menu-links, so it'd only work for a subset of links it needs to.
Why keep track of both path and item if only using path? Seems like a waist of memory to keep track of extra information.
Comment #11
drzraf commentedthe patch (#3) did not removed the menu entry created by a view (dup: #1418618: Views may leave stale menu entries)
Comment #12
hefox commentedComment #13
hefox commentedHere's a slightly different take on it
Patch:
Didn't really change the actual test other than the function call that sets the static.
Comment #14
hefox commentedRight.. the patch.
Comment #15
cweagansUpdating tags per http://drupal.org/node/1517250
Comment #16
ifernando commentedThe patch menu_callback_drop-1079628-1.patch works for me.
Comment #17
jibran#14: drupal_1079628_menu_type_change_13.patch queued for re-testing.
Comment #19
sutharsan commentedSince the original report and patches the menu system got a full overhaul, but the problem still remains. Changing issue title and description to match the current situation.
Comment #20
joegraduateAs far as I can tell, this is no longer a problem in Drupal 8.0.x. Just tested a clean install of Drupal 8.0.4 and this issue does not exist. This is still a problem in 7.x, however.
Comment #21
joegraduateThe attached patch is a backport of #14. This patch fixes the problem for me in the latest 7.x-dev version of Drupal core.
Comment #22
joegraduateComment #24
joegraduateUpdated patch with fixed tests.
Comment #25
joegraduateComment #26
joegraduatePatch in #24 still applies cleanly to the latest 7.x-dev and 7.44.
Comment #27
joegraduatePatch in #24 still applies cleanly to the latest 7.x-dev and 7.50. Please review!
Comment #28
sutharsan commentedIf I interpret the code correctly the conditions are _and_-ed. The description says _or_. If I'm right one must be corrected. (but I have to be careful with negative logic)
Comment #29
joegraduateGood catch, @Sutharsan. I've updated the confusing comment you identified to more accurately describe what is happening.
Comment #30
joegraduateComment #31
joegraduateComment #32
kopeboyGuys, how to delete an orphaned menu item before this is commited!?
I have menu items on main menu that were created with Page Manager. The pages were deleted and now I can't change paths or delete them.
I even tried recreating pages with the same path, change menu item to tab and delete pages but tat doesn't work.
Now I have 3 menu items with same name, same link
Update: ok I could delete them by changing the name (the Menu link title) and then doing Reset > they immediately disappeared.
Comment #33
thomasmurphy commentedI had a lot of problem with the menu table in D7 on a very large website with a very large menu which had stopped working because it wasn't managed properly. There were some strange examples items appearing and disappearing, so I finally just connected to the database directly and cleaned it up there. What I did discover was that there were a lot of orphaned menu records which didn't appear in the UI because their parent no longer existed, as per this issue, but if a menu item with a matching name was created they appeared in the UI again. The next time I see anything that weird again I'm going straight to the database.