Explicitly return `null` on no match in SessionHandler::getSpiderID()
authorTim Düsterhus <duesterhus@woltlab.com>
Thu, 11 Mar 2021 08:30:51 +0000 (09:30 +0100)
committerTim Düsterhus <duesterhus@woltlab.com>
Thu, 11 Mar 2021 08:30:51 +0000 (09:30 +0100)
wcfsetup/install/files/lib/system/session/SessionHandler.class.php

index 49936cb2752772a70e0790f10366f11aa5f91179..fca008eef4bb3694ce1deb70918a2016408e0583 100644 (file)
@@ -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;
     }
 
     /**