From 6617862bc236d24c54aefa4b45519dd670741698 Mon Sep 17 00:00:00 2001 From: Andreas Schempp Date: Fri, 30 Aug 2024 10:01:34 +0200 Subject: [PATCH] Fixed generating request parameters (#258) --- src/FrontendModule/ChangeLanguageModule.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/FrontendModule/ChangeLanguageModule.php b/src/FrontendModule/ChangeLanguageModule.php index 2dc5803..5d6f937 100755 --- a/src/FrontendModule/ChangeLanguageModule.php +++ b/src/FrontendModule/ChangeLanguageModule.php @@ -204,11 +204,12 @@ protected function createUrlParameterBag(array $queryParameters = []): UrlParame $attributes = []; $query = []; - if ($request->attributes->has('parameters')) { - $fragments = explode('/', ltrim($request->attributes->get('parameters'), '/')); + if (!empty($parameters = $request->attributes->get('parameters'))) { + $fragments = explode('/', ltrim($parameters, '/')); + // The auto_item parameter must not be retained if (\count($fragments) % 2 > 0) { - array_unshift($fragments, 'auto_item'); + array_shift($fragments); } for ($i = 0, $c = \count($fragments); $i < $c; $i += 2) {