Skip to content

Commit 1fc6ee1

Browse files
committed
Add support for SameSite cookie session setting
1 parent 81c3ec0 commit 1fc6ee1

File tree

2 files changed

+12
-13
lines changed

2 files changed

+12
-13
lines changed

lib/response/sfWebResponse.class.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -161,18 +161,18 @@ public function isHeaderOnly()
161161
/**
162162
* Sets a cookie.
163163
*
164-
* @param string $name HTTP header name
165-
* @param string $value Value for the cookie
166-
* @param string $expire Cookie expiration period
167-
* @param string $path Path
168-
* @param string $domain Domain name
169-
* @param bool $secure If secure
170-
* @param bool $httpOnly If uses only HTTP
171-
* @param bool $samesite If uses Same-site cookies
164+
* @param string $name HTTP header name
165+
* @param string $value Value for the cookie
166+
* @param string $expire Cookie expiration period
167+
* @param string $path Path
168+
* @param string $domain Domain name
169+
* @param bool $secure If secure
170+
* @param bool $httpOnly If uses only HTTP
171+
* @param ''|'None'|'Lax'|'Strict' $samesite If uses Same-site cookies
172172
*
173173
* @throws sfException If fails to set the cookie
174174
*/
175-
public function setCookie($name, $value, $expire = null, $path = '/', $domain = '', $secure = false, $httpOnly = false, $samesite = '')
175+
public function setCookie($name, $value, $expire = null, $path = '/', $domain = '', $secure = false, $httpOnly = false, string $samesite = '')
176176
{
177177
if (null !== $expire) {
178178
if (is_numeric($expire)) {

lib/storage/sfSessionStorage.class.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,14 +82,13 @@ public function initialize($options = null)
8282
$samesite = $this->options['session_cookie_samesite'];
8383
session_set_cookie_params([
8484
'lifetime' => $lifetime,
85-
'path' => $path,
86-
'domain' => $domain,
87-
'secure' => $secure,
85+
'path' => $path,
86+
'domain' => $domain,
87+
'secure' => $secure,
8888
'httponly' => $httpOnly,
8989
'samesite' => $samesite,
9090
]);
9191

92-
9392
if (null !== $this->options['session_cache_limiter']) {
9493
session_cache_limiter($this->options['session_cache_limiter']);
9594
}

0 commit comments

Comments
 (0)