make sure we don't get a null uastring master
authorRobert Kaiser <kairo@kairo.at>
Sun, 3 Nov 2024 00:06:21 +0000 (01:06 +0100)
committerRobert Kaiser <kairo@kairo.at>
Sun, 3 Nov 2024 00:06:34 +0000 (01:06 +0100)
classes/useragent.php-class

index 190e539119befaa46f1f2b2c569170ba1111147a..c64117f38e8e3639fdf2912e797eefd9550f99f6 100755 (executable)
@@ -106,11 +106,12 @@ class userAgent {
     }
     else {
       // read raw UA string
     }
     else {
       // read raw UA string
-      $this->uastring = $_SERVER['HTTP_USER_AGENT'];
+      $this->uastring = ($_SERVER['HTTP_USER_AGENT'] ?? '');
     }
 
     // get UA brand and version
     }
 
     // get UA brand and version
-    $this->brand = 'Unknown'; $this->version = null;
+    $this->brand = 'Unknown';
+    $this->version = null;
     // find reasonable defaults
     if (preg_match('|([0-9a-zA-Z\.:()_ -]+)/(\d[0-9a-zA-Z\._+-]*)|', $this->uastring, $regs)) {
       $this->brand = trim($regs[1]);
     // find reasonable defaults
     if (preg_match('|([0-9a-zA-Z\.:()_ -]+)/(\d[0-9a-zA-Z\._+-]*)|', $this->uastring, $regs)) {
       $this->brand = trim($regs[1]);