Skip to content

Commit 6a848e1

Browse files
misaertnicolas-grekas
authored andcommitted
[HttpFoundation] Fix clearing CHIPS cookies
1 parent d1962d0 commit 6a848e1

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

EventListener/CookieClearingLogoutListener.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public function onLogout(LogoutEvent $event): void
4040
}
4141

4242
foreach ($this->cookies as $cookieName => $cookieData) {
43-
$response->headers->clearCookie($cookieName, $cookieData['path'], $cookieData['domain'], $cookieData['secure'] ?? false, true, $cookieData['samesite'] ?? null);
43+
$response->headers->clearCookie($cookieName, $cookieData['path'], $cookieData['domain'], $cookieData['secure'] ?? false, true, $cookieData['samesite'] ?? null, $cookieData['partitioned'] ?? false);
4444
}
4545
}
4646

Tests/EventListener/CookieClearingLogoutListenerTest.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public function testLogout()
2727
$event = new LogoutEvent(new Request(), null);
2828
$event->setResponse($response);
2929

30-
$listener = new CookieClearingLogoutListener(['foo' => ['path' => '/foo', 'domain' => 'foo.foo', 'secure' => true, 'samesite' => Cookie::SAMESITE_STRICT], 'foo2' => ['path' => null, 'domain' => null]]);
30+
$listener = new CookieClearingLogoutListener(['foo' => ['path' => '/foo', 'domain' => 'foo.foo', 'secure' => true, 'samesite' => Cookie::SAMESITE_STRICT, 'partitioned' => true], 'foo2' => ['path' => null, 'domain' => null]]);
3131

3232
$cookies = $response->headers->getCookies();
3333
$this->assertCount(0, $cookies);
@@ -43,6 +43,7 @@ public function testLogout()
4343
$this->assertEquals('foo.foo', $cookie->getDomain());
4444
$this->assertEquals(Cookie::SAMESITE_STRICT, $cookie->getSameSite());
4545
$this->assertTrue($cookie->isSecure());
46+
$this->assertTrue($cookie->isPartitioned());
4647
$this->assertTrue($cookie->isCleared());
4748

4849
$cookie = $cookies['']['/']['foo2'];
@@ -51,6 +52,7 @@ public function testLogout()
5152
$this->assertNull($cookie->getDomain());
5253
$this->assertNull($cookie->getSameSite());
5354
$this->assertFalse($cookie->isSecure());
55+
$this->assertFalse($cookie->isPartitioned());
5456
$this->assertTrue($cookie->isCleared());
5557
}
5658
}

0 commit comments

Comments
 (0)