diff --git a/src/Menu/MenuItemMatcher.php b/src/Menu/MenuItemMatcher.php index 3ef634abc3..1532f8a167 100644 --- a/src/Menu/MenuItemMatcher.php +++ b/src/Menu/MenuItemMatcher.php @@ -200,9 +200,9 @@ private function doMarkSelectedPrettyUrlsMenuItem(array $menuItems, Request $req // compare the ending of the URL instead of a strict equality because link URLs can be absolute URLs if (str_ends_with($menuItemUrl, $currentRequestUriWithoutQueryString) - || str_ends_with($menuItemUrl, $currentRequestUriWithoutAction) + || ('' !== $currentRequestUriWithoutAction && str_ends_with($menuItemUrl, $currentRequestUriWithoutAction)) || str_ends_with($menuItemUrlWithoutQueryString, $currentRequestUriWithoutQueryString) - || str_ends_with($menuItemUrlWithoutQueryString, $currentRequestUriWithoutAction)) { + || ('' !== $currentRequestUriWithoutAction && str_ends_with($menuItemUrlWithoutQueryString, $currentRequestUriWithoutAction))) { $menuItemDto->setSelected(true); return $menuItems;