From b989e2b0875c2acfa18e2b58401d1efed4e41a66 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tim=20D=C3=BCsterhus?= Date: Thu, 11 Mar 2021 09:30:51 +0100 Subject: [PATCH] Explicitly return `null` on no match in SessionHandler::getSpiderID() --- .../files/lib/system/session/SessionHandler.class.php | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/wcfsetup/install/files/lib/system/session/SessionHandler.class.php b/wcfsetup/install/files/lib/system/session/SessionHandler.class.php index 49936cb275..fca008eef4 100644 --- a/wcfsetup/install/files/lib/system/session/SessionHandler.class.php +++ b/wcfsetup/install/files/lib/system/session/SessionHandler.class.php @@ -1323,20 +1323,19 @@ final class SessionHandler extends SingletonFactory /** * Returns the spider id for given user agent. - * - * @param string $userAgent - * @return mixed */ - protected function getSpiderID($userAgent) + protected function getSpiderID(string $userAgent): ?int { $spiderList = SpiderCacheBuilder::getInstance()->getData(); $userAgent = \strtolower($userAgent); foreach ($spiderList as $spider) { if (\strpos($userAgent, $spider->spiderIdentifier) !== false) { - return $spider->spiderID; + return \intval($spider->spiderID); } } + + return null; } /** -- 2.20.1