Skip to content

Commit b0ba1a8

Browse files
committed
Add support for SameSite cookie session setting
1 parent 39e8b8c commit b0ba1a8

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
@@ -162,18 +162,18 @@ public function isHeaderOnly()
162162
/**
163163
* Sets a cookie.
164164
*
165-
* @param string $name HTTP header name
166-
* @param string $value Value for the cookie
167-
* @param string $expire Cookie expiration period
168-
* @param string $path Path
169-
* @param string $domain Domain name
170-
* @param bool $secure If secure
171-
* @param bool $httpOnly If uses only HTTP
172-
* @param bool $samesite If uses Same-site cookies
165+
* @param string $name HTTP header name
166+
* @param string $value Value for the cookie
167+
* @param string $expire Cookie expiration period
168+
* @param string $path Path
169+
* @param string $domain Domain name
170+
* @param bool $secure If secure
171+
* @param bool $httpOnly If uses only HTTP
172+
* @param ''|'None'|'Lax'|'Strict' $samesite If uses Same-site cookies
173173
*
174174
* @throws sfException If fails to set the cookie
175175
*/
176-
public function setCookie($name, $value, $expire = null, $path = '/', $domain = '', $secure = false, $httpOnly = false, $samesite = '')
176+
public function setCookie($name, $value, $expire = null, $path = '/', $domain = '', $secure = false, $httpOnly = false, string $samesite = '')
177177
{
178178
if (null !== $expire) {
179179
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)