Fix warning in PHP 8.0 if user-agent header is missing

This commit is contained in:
Kijin Sung 2021-01-28 23:14:48 +09:00
parent 8e56fe5912
commit e1f1de8e49
2 changed files with 2 additions and 2 deletions

View file

@ -361,7 +361,7 @@ class Context
}
// start session
$relax_key_checks = ((self::$_get_vars->act ?? null) === 'procFileUpload' && preg_match('/shockwave\s?flash/i', $_SERVER['HTTP_USER_AGENT']));
$relax_key_checks = ((self::$_get_vars->act ?? null) === 'procFileUpload' && preg_match('/shockwave\s?flash/i', $_SERVER['HTTP_USER_AGENT'] ?? ''));
Rhymix\Framework\Session::checkSSO($site_module_info);
Rhymix\Framework\Session::start(false, $relax_key_checks);

View file

@ -46,7 +46,7 @@ class Mobile
// Try to detect from URL arguments and cookies, and finally fall back to user-agent detection.
$m = Context::get('m');
$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)
{
$cookie = null;