Skip to content

Commit 2da0828

Browse files
Merge branch '4.4' into 5.0
* 4.4: [Http Foundation] Fix clear cookie samesite [Security] Check if firewall is stateless before checking for session/previous session [Form] Support customized intl php.ini settings [Security] Remember me: allow to set the samesite cookie flag [Debug] fix for PHP 7.3.16+/7.4.4+ [Validator] Backport translations [Mailer] Use %d instead of %s for error code in error messages [HttpKernel] fix locking for PHP 7.4+ [Security] Fixed hardcoded value of SODIUM_CRYPTO_PWHASH_MEMLIMIT_INTERACTIVE Prevent warning in proc_open() [FrameworkBundle] Fix Router Cache Fix deprecation messages
2 parents 6748a30 + 0a3b771 commit 2da0828

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

ResponseHeaderBag.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -239,9 +239,9 @@ public function getCookies(string $format = self::COOKIES_FLAT)
239239
/**
240240
* Clears a cookie in the browser.
241241
*/
242-
public function clearCookie(string $name, ?string $path = '/', string $domain = null, bool $secure = false, bool $httpOnly = true)
242+
public function clearCookie(string $name, ?string $path = '/', string $domain = null, bool $secure = false, bool $httpOnly = true, string $sameSite = null)
243243
{
244-
$this->setCookie(new Cookie($name, null, 1, $path, $domain, $secure, $httpOnly, false, null));
244+
$this->setCookie(new Cookie($name, null, 1, $path, $domain, $secure, $httpOnly, false, $sameSite));
245245
}
246246

247247
/**

Tests/ResponseHeaderBagTest.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,14 @@ public function testClearCookieSecureNotHttpOnly()
128128
$this->assertSetCookieHeader('foo=deleted; expires='.gmdate('D, d-M-Y H:i:s T', time() - 31536001).'; Max-Age=0; path=/; secure', $bag);
129129
}
130130

131+
public function testClearCookieSamesite()
132+
{
133+
$bag = new ResponseHeaderBag([]);
134+
135+
$bag->clearCookie('foo', '/', null, true, false, 'none');
136+
$this->assertSetCookieHeader('foo=deleted; expires='.gmdate('D, d-M-Y H:i:s T', time() - 31536001).'; Max-Age=0; path=/; secure; samesite=none', $bag);
137+
}
138+
131139
public function testReplace()
132140
{
133141
$bag = new ResponseHeaderBag([]);

0 commit comments

Comments
 (0)