Skip to content

Commit 11f8a1e

Browse files
bug symfony#31475 [HttpFoundation] Allow set 'None' on samesite cookie flag (markitosgv)
This PR was merged into the 3.4 branch. Discussion ---------- [HttpFoundation] Allow set 'None' on samesite cookie flag Allow set samesite cookie flag to 'None' value | Q | A | ------------- | --- | Branch? | 3.4 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | symfony#31467 | License | MIT Google introduces new Chrome policy, marking all none setted samesite flag to 'Strict' by default. If you want to allow third party cookies you must set samesite flag to None. This PR fixes symfony#31467, allow to put samesite Cookie flag to None. Commits ------- 8bac3d6 Allow set 'None' on samesite cookie flag
2 parents c717083 + 8bac3d6 commit 11f8a1e

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/Symfony/Component/HttpFoundation/Cookie.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ class Cookie
2828
private $raw;
2929
private $sameSite;
3030

31+
const SAMESITE_NONE = 'none';
3132
const SAMESITE_LAX = 'lax';
3233
const SAMESITE_STRICT = 'strict';
3334

@@ -128,7 +129,7 @@ public function __construct($name, $value = null, $expire = 0, $path = '/', $dom
128129
$sameSite = strtolower($sameSite);
129130
}
130131

131-
if (!\in_array($sameSite, [self::SAMESITE_LAX, self::SAMESITE_STRICT, null], true)) {
132+
if (!\in_array($sameSite, [self::SAMESITE_LAX, self::SAMESITE_STRICT, self::SAMESITE_NONE, null], true)) {
132133
throw new \InvalidArgumentException('The "sameSite" parameter value is not valid.');
133134
}
134135

0 commit comments

Comments
 (0)