I am running into a new bug that has appeared over the past week since I have upgraded from 8.1.10 to 8.2.1. I have a multilingual site and have created translations for most of my nodes. Prior to this bug, I was able to create menu items and add the link as either a node # (/node/1874) or by using the autocomplete to reference the node title. So long as the menu language is set correctly for each menu, the link will automatically include the path prefix and link to the node translation correctly with the appropriate path alias.
Since I have upgraded to 8.2.1, this behavior has changed. If my menu link is entered as a node #, the menu link will appear as node/id instead of the path alias. I have to enter the title name and use the autocomplete to reference the node in order for the menu link to include the path alias when rendered.
Comment | File | Size | Author |
---|---|---|---|
#10 | drupal-menu-links-lose-prefix-after-cache-clear-11812915-10-D8.patch | 512 bytes | corneboele |
Comments
Comment #2
cilefen CreditAttribution: cilefen as a volunteer commentedComment #3
goodwillhinton CreditAttribution: goodwillhinton commentedI am seeing a similar bug that I believe may be connected. I am adding relative links to translated content (ie /en-gb/contact-us) yet after a cache clear the link is rendered as node/id. I have discovered that if I enter the link as an absolute link (ie www.domain.com/en-gb/contact-us) that the path alias remains without an error.
Comment #4
corneboele CreditAttribution: corneboele commentedI can confirm that after a cache rebuild the links display as untranslated. After saving the menu link (without changing anything), the translated path is displayed again. Seems that cache rebuild is missing a step compared to menu item save?
Comment #5
corneboele CreditAttribution: corneboele at Aubergine IT commentedCould track it down to the file vendor/symfony-cmf/routing/ChainRouter.php. If I replace this file with the one from 8.1 the problem doesn't occur anymore.
or rebuild.phpComment #6
corneboele CreditAttribution: corneboele at Aubergine IT commentedComment #7
cilefen CreditAttribution: cilefen as a volunteer commentedComment #8
corneboele CreditAttribution: corneboele at Aubergine IT commentedComment #10
corneboele CreditAttribution: corneboele at Aubergine IT commentedComment #11
corneboele CreditAttribution: corneboele at Aubergine IT commentedComment #12
stella CreditAttribution: stella at Annertech for Glanbia commentedI was having a similar problem since upgrading to 8.2.1 and this patch has fixed it for me. Thanks!
Comment #13
smazI've just run into a similar issue, and can confirm the patch fixes the problem.
We are using Drupal 8.2, using drush to clear the caches. The issue does not occur when you clear the caches whilst logged in, or using /core/rebuild.php.
Our site does not have any translations or related modules enabled, but was migrated from Drupal 6 - so possibly not just translated content is affected.
The issue is, as pointed out above, there is no method for the requests that are generated when trying to match paths to routes during a menu rebuild. Rolling back to an earlier version of /vendor/symfony-cmf/routing/ChainRouter.php also fixes the issue, again as pointed out above.
So the issue lies with one of three places:
1) Symfony, has an issue where method could be blank.
2) Drupal, where there should be a default method set if none present (as per the patch, though is that in the best place? I don't know)
3) Drush, should be causing there to be a method
I'm guessing though that if the issue is by interacting with Drupal from the command line, that other tools (i.e. Drupal Console) could have the same issue & therefore it not be up to drush to fix?
Comment #14
badrange CreditAttribution: badrange commentedI wonder if this problem is also valid for 8.2.6 and/or 8.3 rc1?
Comment #15
corneboele CreditAttribution: corneboele at Aubergine IT commentedYes, the problem is still valid for 8.2.7. I don't know about 8.3.
Comment #16
jzavrl CreditAttribution: jzavrl at NDP commentedI can confirm this is not the case anymore with 8.3.0.
Comment #17
cilefen CreditAttribution: cilefen as a volunteer commentedIt would be good to find the issue that fixed it.
Comment #18
corneboele CreditAttribution: corneboele at Aubergine IT commentedDrupal 8.3 introduced a new Router, which might do things different than the Symfony one.
For example I see the following code:
IF the requests Drush made were HEAD requests, then this would resolve the issue.
But this is a wild guess.