We are currently experiencing some strange behavior on one of our sites regarding menu active trails in language-specific menus with untranslatable menu links.

Steps to reproduce

  • Set up a Drupal site with two languages (e.g. EN and DE), set EN as default language with URL prefix /en, DE without URL prefix
  • Enable all multilingual modules (especially language and content translation) and ensure that path module is enabled
  • Use path prefix URL language detection
  • Do not allow translations of custom menu link entities and set -Not specified - as default language for them
  • Create a language-specific menu (in our case EN as menu language)
  • Create an english taxonomy term with a path alias (let's use /term-name for now)
  • Ensure that you are visiting the english site version (with /en URL prefix) and add a menu link using /en/term-name as link value
  • Check your menu_tree table and search for the row with "route_param_key" having taxonomy_term=[TID] (of course use your term ID for [TID]) - it should exist
  • Visit the menu link's page and inspect the menu link - it should have a class added indicating that it is in the active trail
  • Switch over to german site version (without /en URL prefix
  • When you are on the menu edit page now and click edit on that menu link again, you are automatically send to the edit form without the /en URL prefix (if not, open it up without the prefix). Now just safe the form without any manual changes (NOTE: You are editing a menu link without language for an EN menu, with an english path alias as link... in the german user interface, which should be no problem at all)
  • Check your database again... the row with "route_param_key" having taxonomy_term=[TID] (of course use your term ID for [TID]) is gone, but instead of it you now have a row with "url" having base:/en/term-name... but without all the term information the previous row had.
  • Visit the menu link's page and inspect the menu link - the class indicating that it is in the active trail is gone, because the menu system cannot identify it in the active trail anymore
  • ... even worse: When using the aliased link URL, editing this in the corresponding language without breaking anything etc., the next cache clear will also kill the correct row in the menu_tree table

As this is a rather complex problem, I hope I did not forget any steps to reproduce this behavior.

If anybody needs a workaround until this issue might get fixed:

  • Instead of using the aliased term URL with language URL prefix, use /taxonomy/term/[TID] (of course use your term ID for [TID])
  • Check your menu_tree table and search for the row with "route_param_key" having taxonomy_term=[TID] (of course use your term ID for [TID]) - it should exist
  • Using this URL based on the internal path you should be safe to edit the menu link in any interface language you like

Comments

hctom created an issue. See original summary.

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.0-alpha1 will be released the week of January 17, 2018, which means new developments and disruptive changes should now be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

berdir’s picture

Status: Active » Closed (duplicate)

Same here, I'm pretty sure that #2802403: Combination of language negotiation and path aliasing can cause a corrupted route cache, 404s which was just committed fixes this. Please check again in 8.5/8.6.