diff options
Diffstat (limited to 'lib/private/AppFramework')
-rw-r--r-- | lib/private/AppFramework/App.php | 5 | ||||
-rw-r--r-- | lib/private/AppFramework/Http/Output.php | 16 |
2 files changed, 18 insertions, 3 deletions
diff --git a/lib/private/AppFramework/App.php b/lib/private/AppFramework/App.php index e02f372e41c..ea97ea4096d 100644 --- a/lib/private/AppFramework/App.php +++ b/lib/private/AppFramework/App.php @@ -151,6 +151,8 @@ class App { if ($value['expireDate'] instanceof \DateTime) { $expireDate = $value['expireDate']->getTimestamp(); } + $sameSite = $value['sameSite'] ?? 'Lax'; + $io->setCookie( $name, $value['value'], @@ -158,7 +160,8 @@ class App { $container->getServer()->getWebRoot(), null, $container->getServer()->getRequest()->getServerProtocol() === 'https', - true + true, + $sameSite ); } diff --git a/lib/private/AppFramework/Http/Output.php b/lib/private/AppFramework/Http/Output.php index fd95f370360..8777c1970a6 100644 --- a/lib/private/AppFramework/Http/Output.php +++ b/lib/private/AppFramework/Http/Output.php @@ -92,8 +92,20 @@ class Output implements IOutput { * @param bool $secure * @param bool $httpOnly */ - public function setCookie($name, $value, $expire, $path, $domain, $secure, $httpOnly) { + public function setCookie($name, $value, $expire, $path, $domain, $secure, $httpOnly, $sameSite = 'Lax') { $path = $this->webRoot ? : '/'; - setcookie($name, $value, $expire, $path, $domain, $secure, $httpOnly); + + if (PHP_VERSION_ID < 70300) { + setcookie($name, $value, $expire, $path, $domain, $secure, $httpOnly); + } else { + setcookie($name, $value, [ + 'expires' => $expire, + 'path' => $path, + 'domain' => $domain, + 'secure' => $secure, + 'httponly' => $httpOnly, + 'samesite' => $sameSite + ]); + } } } |