Skip to content

Commit 0a3b771

Browse files
Merge branch '3.4' into 4.4
* 3.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 Prevent warning in proc_open()
2 parents 109ac25 + a8833c5 commit 0a3b771

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

ResponseHeaderBag.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -252,10 +252,13 @@ public function getCookies($format = self::COOKIES_FLAT)
252252
* @param string $domain
253253
* @param bool $secure
254254
* @param bool $httpOnly
255+
* @param string $sameSite
255256
*/
256-
public function clearCookie($name, $path = '/', $domain = null, $secure = false, $httpOnly = true)
257+
public function clearCookie($name, $path = '/', $domain = null, $secure = false, $httpOnly = true/*, $sameSite = null*/)
257258
{
258-
$this->setCookie(new Cookie($name, null, 1, $path, $domain, $secure, $httpOnly, false, null));
259+
$sameSite = \func_num_args() > 5 ? func_get_arg(5) : null;
260+
261+
$this->setCookie(new Cookie($name, null, 1, $path, $domain, $secure, $httpOnly, false, $sameSite));
259262
}
260263

261264
/**

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)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy