Merge pull request #23942 from nextcloud/techdebt/cookie-lax-php7.3
Remove the cookie paths for php<7.3
This commit is contained in:
commit
cab80e685b
|
@ -96,17 +96,13 @@ class Output implements IOutput {
|
||||||
public function setCookie($name, $value, $expire, $path, $domain, $secure, $httpOnly, $sameSite = 'Lax') {
|
public function setCookie($name, $value, $expire, $path, $domain, $secure, $httpOnly, $sameSite = 'Lax') {
|
||||||
$path = $this->webRoot ? : '/';
|
$path = $this->webRoot ? : '/';
|
||||||
|
|
||||||
if (PHP_VERSION_ID < 70300) {
|
setcookie($name, $value, [
|
||||||
setcookie($name, $value, $expire, $path, $domain, $secure, $httpOnly);
|
'expires' => $expire,
|
||||||
} else {
|
'path' => $path,
|
||||||
setcookie($name, $value, [
|
'domain' => $domain,
|
||||||
'expires' => $expire,
|
'secure' => $secure,
|
||||||
'path' => $path,
|
'httponly' => $httpOnly,
|
||||||
'domain' => $domain,
|
'samesite' => $sameSite
|
||||||
'secure' => $secure,
|
]);
|
||||||
'httponly' => $httpOnly,
|
|
||||||
'samesite' => $sameSite
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -88,22 +88,18 @@ class CryptoWrapper {
|
||||||
$webRoot = '/';
|
$webRoot = '/';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (PHP_VERSION_ID < 70300) {
|
setcookie(
|
||||||
setcookie(self::COOKIE_NAME, $this->passphrase, 0, $webRoot, '', $secureCookie, true);
|
self::COOKIE_NAME,
|
||||||
} else {
|
$this->passphrase,
|
||||||
setcookie(
|
[
|
||||||
self::COOKIE_NAME,
|
'expires' => 0,
|
||||||
$this->passphrase,
|
'path' => $webRoot,
|
||||||
[
|
'domain' => '',
|
||||||
'expires' => 0,
|
'secure' => $secureCookie,
|
||||||
'path' => $webRoot,
|
'httponly' => true,
|
||||||
'domain' => '',
|
'samesite' => 'Lax',
|
||||||
'secure' => $secureCookie,
|
]
|
||||||
'httponly' => true,
|
);
|
||||||
'samesite' => 'Lax',
|
|
||||||
]
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -214,10 +214,6 @@ class Internal extends Session {
|
||||||
}
|
}
|
||||||
|
|
||||||
private function startSession(bool $silence = false) {
|
private function startSession(bool $silence = false) {
|
||||||
if (PHP_VERSION_ID < 70300) {
|
$this->invoke('session_start', [['cookie_samesite' => 'Lax']], $silence);
|
||||||
$this->invoke('session_start', [], $silence);
|
|
||||||
} else {
|
|
||||||
$this->invoke('session_start', [['cookie_samesite' => 'Lax']], $silence);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue