diff --git a/composer.json b/composer.json index 6a8e934..cb02bcf 100644 --- a/composer.json +++ b/composer.json @@ -14,7 +14,7 @@ "retina" ], "homepage": "https://github.com/jonesiscoding/device", - "version": "4.0.7", + "version": "4.0.8", "suggest": { "deviscoding/poly-pointer": "Psuedo-Polyfill for (pointer:coarse). Easy support of touch devices." }, diff --git a/src/Device/Hints.php b/src/Device/Hints.php index 36efc6e..38351c3 100644 --- a/src/Device/Hints.php +++ b/src/Device/Hints.php @@ -287,14 +287,19 @@ protected function isUserAgentMatch($needle, &$regexMatches = null) foreach ($needles as $needle) { - if (!is_null($regexMatches)) + if (null === $ua) + { + // Only if user agent is empty AND no needles are given. + return false; + } + elseif (!is_null($regexMatches)) { if (!preg_match($needle, $ua, $regexMatches)) { return false; } } - elseif (false === stripos($this->getUserAgent(), $needle)) + elseif (false === stripos($ua, $needle)) { return false; }