From beff6b7d3caf2ad6241f9c4928db3d5a696ee151 Mon Sep 17 00:00:00 2001 From: Valentin Karnauhov Date: Thu, 5 Dec 2024 14:57:21 +0200 Subject: [PATCH] Fix menu item matcher when using pretty URLs and submenus --- src/Menu/MenuItemMatcher.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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;