Base path in admin menu cause error to non admin users.

Created on 11 October 2023, 9 months ago
Updated 26 October 2023, 8 months ago

Problem/Motivation

The following error is thrown.

UnexpectedValueException: base:admin/content/advanced has no corresponding route. in Drupal\Core\Url->getRouteName() (line 567 of core/lib/Drupal/Core/Url.php).
admin_toolbar_links_access_filter_filter_non_accessible_links(Array) (Line: 52)
admin_toolbar_links_access_filter_preprocess_menu(Array, 'menu__toolbar', Array)
call_user_func_array('admin_toolbar_links_access_filter_preprocess_menu', Array) (Line: 285)

Steps to reproduce

Create an admin menu with custom hard coded path like: admin/content/advanced

$original_link->getUrlObject()->getRouteName() is throwing an error.

Proposed resolution

Make additional check if getRouteName() can be called.

🐛 Bug report
Status

Needs review

Version

3.4

Component

Code

Created by

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.69.0 2024