Problem/Motivation
When an internal link that is not an entity is added to the menu using "internal:" as URL, it results in "UnexpectedValueException: External URLs do not have internal route parameters. in Drupal\Core\Url->getRouteParameters()"
Steps to reproduce
Enable "admin_toolbar_links_access_filter" module on Drupal 9.5.9. Add a menu link to one of the menu item using a custom module and the url being "internal:" on your custom module's liks.menu.yml
Proposed resolution
Check if the URL is routed before retrieving routed parameters.
Remaining tasks
User interface changes
API changes
Data model changes
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | admin_toolbar_links_access_filter.patch | 1.05 KB | dsrikanth |
Comments
Comment #2
dsrikanth commentedUpdating the path in the patch file.
Comment #3
dsrikanth commentedComment #5
adriancidThanks
Comment #6
nicholassI can confirm our site hit this issue and the patch solved it. Only affected non-admin users. You could test it by masquerading as them. We had a manually created link pointing to a redirect in the menu.
Comment #8
saltwaterskin commentedShouldn't this line
if ($url->isExternal() || !$original_link->getUrlObject()->isRouted()) {
be this instead?
if ($url->isExternal() || !$url->isRouted()) {
$original_link would not be set on line 83 if I am reading this correctly
Comment #9
nicholass@saltwaterskin I think you are correct, I guess the $url->isExternal() is true so it was never getting to that second option.