Skip to content

Commit

Permalink
Merge pull request #1 from YetOpen/master
Browse files Browse the repository at this point in the history
Update Mobile_Detect.php ensure it works from console application
  • Loading branch information
xstreamka authored May 13, 2024
2 parents 5303b07 + c94f58e commit e22d66b
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/Mobile_Detect.php
Original file line number Diff line number Diff line change
Expand Up @@ -1254,6 +1254,10 @@ public function is($key, $userAgent = null, $httpHeaders = null)
*/
public function match($regex, $userAgent = null)
{
$userAgent = (false === empty($userAgent) ? $userAgent : $this->userAgent);
if (empty($userAgent)) {
return false;
}
$match = (bool) preg_match(sprintf('#%s#is', $regex), (false === empty($userAgent) ? $userAgent : $this->userAgent), $matches);
// If positive match is found, store the results for debug.
if ($match) {
Expand Down

0 comments on commit e22d66b

Please sign in to comment.