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

@ -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;