From e7252b71843111232b4cd105aba03dd2ee31d1dd Mon Sep 17 00:00:00 2001 From: Manuel Gschwandtner Date: Thu, 14 Mar 2024 12:43:18 +0100 Subject: [PATCH 1/2] set $GLOBALS['TYPO3_REQUEST'] in FrontendUserMiddleware->weShouldHaveCookie --- Classes/Middleware/FrontendUserMiddleware.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Classes/Middleware/FrontendUserMiddleware.php b/Classes/Middleware/FrontendUserMiddleware.php index fdd46fb66d8..c0d9c626487 100644 --- a/Classes/Middleware/FrontendUserMiddleware.php +++ b/Classes/Middleware/FrontendUserMiddleware.php @@ -49,6 +49,10 @@ public function process(ServerRequestInterface $request, RequestHandlerInterface protected function weShouldHaveCookie(FrontendUserAuthentication $feUser, ServerRequestInterface $request): bool { + if ($GLOBALS['TYPO3_REQUEST'] === null) { + $GLOBALS['TYPO3_REQUEST'] = $request; + } + $setCookieHeader = $feUser->appendCookieToResponse(new HtmlResponse(''))->getHeaderLine('Set-Cookie'); if (strpos($setCookieHeader, 'Max-Age=0')) { From 54d314c379f14dae9e97d914a1d233e8c83940ed Mon Sep 17 00:00:00 2001 From: Manuel Gschwandtner Date: Thu, 14 Mar 2024 13:21:44 +0100 Subject: [PATCH 2/2] pass normalizedParams directly to $feUser->appendCookieToResponse --- Classes/Middleware/FrontendUserMiddleware.php | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/Classes/Middleware/FrontendUserMiddleware.php b/Classes/Middleware/FrontendUserMiddleware.php index c0d9c626487..0f4e7307164 100644 --- a/Classes/Middleware/FrontendUserMiddleware.php +++ b/Classes/Middleware/FrontendUserMiddleware.php @@ -49,11 +49,7 @@ public function process(ServerRequestInterface $request, RequestHandlerInterface protected function weShouldHaveCookie(FrontendUserAuthentication $feUser, ServerRequestInterface $request): bool { - if ($GLOBALS['TYPO3_REQUEST'] === null) { - $GLOBALS['TYPO3_REQUEST'] = $request; - } - - $setCookieHeader = $feUser->appendCookieToResponse(new HtmlResponse(''))->getHeaderLine('Set-Cookie'); + $setCookieHeader = $feUser->appendCookieToResponse(new HtmlResponse(''), $request->getAttribute('normalizedParams'))->getHeaderLine('Set-Cookie'); if (strpos($setCookieHeader, 'Max-Age=0')) { // the new cookie is to delete the old cookie: