mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-05-22 05:15:29 +09:00
Fix deprecation error in PHP 8.x when path or domain is null in setcookie()
This commit is contained in:
parent
22abeb7a88
commit
180ed429cf
4 changed files with 6 additions and 6 deletions
|
|
@ -321,7 +321,7 @@ class Context
|
||||||
$lang_type = preg_replace('/[^a-zA-Z0-9_-]/', '', $lang_type);
|
$lang_type = preg_replace('/[^a-zA-Z0-9_-]/', '', $lang_type);
|
||||||
if ($set_lang_cookie)
|
if ($set_lang_cookie)
|
||||||
{
|
{
|
||||||
setcookie('lang_type', $lang_type, time() + 86400 * 365, \RX_BASEURL, null, !!config('session.use_ssl_cookies'));
|
setcookie('lang_type', $lang_type, time() + 86400 * 365, \RX_BASEURL, '', !!config('session.use_ssl_cookies'));
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!$lang_type || !isset($enabled_langs[$lang_type]))
|
if(!$lang_type || !isset($enabled_langs[$lang_type]))
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,7 @@ class Mobile
|
||||||
$m = Context::get('m');
|
$m = Context::get('m');
|
||||||
$cookie = isset($_COOKIE['rx_uatype']) ? $_COOKIE['rx_uatype'] : null;
|
$cookie = isset($_COOKIE['rx_uatype']) ? $_COOKIE['rx_uatype'] : null;
|
||||||
$uahash = base64_encode_urlsafe(md5($_SERVER['HTTP_USER_AGENT'] ?? '', true));
|
$uahash = base64_encode_urlsafe(md5($_SERVER['HTTP_USER_AGENT'] ?? '', true));
|
||||||
if (strncmp($cookie, $uahash . ':', strlen($uahash) + 1) !== 0)
|
if (strncmp($cookie ?? '', $uahash . ':', strlen($uahash) + 1) !== 0)
|
||||||
{
|
{
|
||||||
$cookie = null;
|
$cookie = null;
|
||||||
}
|
}
|
||||||
|
|
@ -72,7 +72,7 @@ class Mobile
|
||||||
$uatype = $uahash . ':' . (self::$_ismobile ? '1' : '0');
|
$uatype = $uahash . ':' . (self::$_ismobile ? '1' : '0');
|
||||||
if ($cookie !== $uatype)
|
if ($cookie !== $uatype)
|
||||||
{
|
{
|
||||||
setcookie('rx_uatype', $uatype, 0, \RX_BASEURL, null, !!config('session.use_ssl_cookies'));
|
setcookie('rx_uatype', $uatype, 0, \RX_BASEURL, '', !!config('session.use_ssl_cookies'));
|
||||||
$_COOKIE['rx_uatype'] = $uatype;
|
$_COOKIE['rx_uatype'] = $uatype;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1261,7 +1261,7 @@ class Session
|
||||||
* @param string $domain (optional)
|
* @param string $domain (optional)
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
protected static function _unsetCookie($name, $path = null, $domain = null)
|
protected static function _unsetCookie($name, $path = '', $domain = '')
|
||||||
{
|
{
|
||||||
$result = setcookie($name, 'deleted', time() - (86400 * 366), $path, $domain, false, false);
|
$result = setcookie($name, 'deleted', time() - (86400 * 366), $path, $domain, false, false);
|
||||||
if ($result)
|
if ($result)
|
||||||
|
|
|
||||||
|
|
@ -468,12 +468,12 @@ class UA
|
||||||
if (in_array($color_scheme, ['light', 'dark']))
|
if (in_array($color_scheme, ['light', 'dark']))
|
||||||
{
|
{
|
||||||
$_COOKIE['rx_color_scheme'] = $color_scheme;
|
$_COOKIE['rx_color_scheme'] = $color_scheme;
|
||||||
setcookie('rx_color_scheme', $color_scheme, time() + 86400 * 365, \RX_BASEURL, null, !!config('session.use_ssl_cookies'));
|
setcookie('rx_color_scheme', $color_scheme, time() + 86400 * 365, \RX_BASEURL, '', !!config('session.use_ssl_cookies'));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
unset($_COOKIE['rx_color_scheme']);
|
unset($_COOKIE['rx_color_scheme']);
|
||||||
setcookie('rx_color_scheme', 'deleted', time() - 86400, \RX_BASEURL, null);
|
setcookie('rx_color_scheme', 'deleted', time() - 86400, \RX_BASEURL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue