mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-04 17:21:39 +09:00
Remove condition for PHP < 7.3
This commit is contained in:
parent
d5796b6f9d
commit
b2051f9934
2 changed files with 2 additions and 29 deletions
|
|
@ -79,24 +79,7 @@ class Cookie
|
|||
$options['samesite'] = config('cookie.samesite') ?? 'Lax';
|
||||
}
|
||||
|
||||
// PHP 7.3+ supports the samesite attribute natively. PHP 7.2 requires a hack.
|
||||
if (\PHP_VERSION_ID >= 70300)
|
||||
{
|
||||
$result = setcookie($name, $value, $options);
|
||||
}
|
||||
else
|
||||
{
|
||||
$expires = $options['expires'];
|
||||
$path = $options['path'] ?? '/';
|
||||
$domain = $options['domain'] ?? null;
|
||||
$secure = $options['secure'] ?? false;
|
||||
$httponly = $options['httponly'] ?? false;
|
||||
if (!empty($options['samesite']))
|
||||
{
|
||||
$path = ($path ?: '/') . '; SameSite=' . $options['samesite'];
|
||||
}
|
||||
$result = setcookie($name, $value, $expires, $path, $domain, $secure, $httponly);
|
||||
}
|
||||
$result = setcookie($name, $value, $options);
|
||||
|
||||
// Make the cookie immediately available server-side.
|
||||
if ($result && $options['expires'] >= 0)
|
||||
|
|
|
|||
|
|
@ -79,17 +79,7 @@ class Session
|
|||
ini_set('session.use_cookies', 1);
|
||||
ini_set('session.use_only_cookies', 1);
|
||||
ini_set('session.use_strict_mode', 1);
|
||||
if ($samesite)
|
||||
{
|
||||
if (PHP_VERSION_ID >= 70300)
|
||||
{
|
||||
ini_set('session.cookie_samesite', $samesite);
|
||||
}
|
||||
else
|
||||
{
|
||||
$path = ($path ?: '/') . '; SameSite=' . $samesite;
|
||||
}
|
||||
}
|
||||
ini_set('session.cookie_samesite', $samesite ? 1 : 0);
|
||||
session_set_cookie_params($lifetime, $path, $domain, $secure, $httponly);
|
||||
session_name($session_name = Config::get('session.name') ?: session_name());
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue