From 36b466e0f2a7c4045e66ee27691721ea188afe76 Mon Sep 17 00:00:00 2001 From: "simon.chrzanowski" Date: Fri, 3 Dec 2021 11:20:33 +0100 Subject: [PATCH] use $sessionId instead of $sessionCookiePath on SessionUtils::popSessionCookie call --- .../HttpKernel/EventListener/AbstractSessionListener.php | 2 +- .../HttpKernel/Tests/EventListener/SessionListenerTest.php | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Symfony/Component/HttpKernel/EventListener/AbstractSessionListener.php b/src/Symfony/Component/HttpKernel/EventListener/AbstractSessionListener.php index 0867cad073dea..08b6faac0e7e9 100644 --- a/src/Symfony/Component/HttpKernel/EventListener/AbstractSessionListener.php +++ b/src/Symfony/Component/HttpKernel/EventListener/AbstractSessionListener.php @@ -146,7 +146,7 @@ public function onKernelResponse(ResponseEvent $event) $sessionCookieHttpOnly = $this->sessionOptions['cookie_httponly'] ?? true; $sessionCookieSameSite = $this->sessionOptions['cookie_samesite'] ?? Cookie::SAMESITE_LAX; - SessionUtils::popSessionCookie($sessionName, $sessionCookiePath); + SessionUtils::popSessionCookie($sessionName, $sessionId); $request = $event->getRequest(); $requestSessionCookieId = $request->cookies->get($sessionName); diff --git a/src/Symfony/Component/HttpKernel/Tests/EventListener/SessionListenerTest.php b/src/Symfony/Component/HttpKernel/Tests/EventListener/SessionListenerTest.php index d82aba64513e4..9924c27d11af9 100644 --- a/src/Symfony/Component/HttpKernel/Tests/EventListener/SessionListenerTest.php +++ b/src/Symfony/Component/HttpKernel/Tests/EventListener/SessionListenerTest.php @@ -312,6 +312,7 @@ public function testSessionUsageLogIfStatelessAndSessionUsed() public function testSessionIsSavedWhenUnexpectedSessionExceptionThrown() { $session = $this->createMock(Session::class); + $session->expects($this->exactly(1))->method('getId')->willReturn('123456'); $session->expects($this->exactly(1))->method('getName')->willReturn('PHPSESSID'); $session->method('isStarted')->willReturn(true); $session->expects($this->exactly(2))->method('getUsageIndex')->will($this->onConsecutiveCalls(0, 1));