Skip to content

Commit 78cd774

Browse files
committed
Update Detector.php
1 parent b8d6700 commit 78cd774

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Utills/Detector.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public function getBrowser(): string
6060
return 'CLI';
6161
}
6262

63-
$userAgent = $_SERVER['HTTP_USER_AGENT'];
63+
$userAgent = $_SERVER['HTTP_USER_AGENT'] ?? null;
6464

6565
foreach ($this->browserName as $key => $browser) {
6666
if (str_contains($userAgent, $key)) {
@@ -80,7 +80,7 @@ public function getDevice(): string
8080
return 'CLI';
8181
}
8282

83-
$userAgent = $_SERVER['HTTP_USER_AGENT'];
83+
$userAgent = $_SERVER['HTTP_USER_AGENT'] ?? null;
8484

8585
foreach ($this->deviceName as $pattern => $name) {
8686
if (preg_match($pattern, $userAgent)) {

0 commit comments

Comments
 (0)