Skip to content
This repository has been archived by the owner on Jan 25, 2023. It is now read-only.

Commit

Permalink
Fixed issue with windows phone and is mobile
Browse files Browse the repository at this point in the history
  • Loading branch information
gabrielbull committed Jul 28, 2016
1 parent 32a6a09 commit 7fcda47
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 0 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# CHANGELOG

## 6.0.5 (released 2016-07-28)

- Windows Phone now marks OS as mobile

## 6.0.4 (released 2016-07-27)

- Fixed Windows Phone detection
Expand Down
1 change: 1 addition & 0 deletions src/OsDetector.php
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,7 @@ private static function checkWindows(Os $os, UserAgent $userAgent)
private static function checkWindowsPhone(Os $os, UserAgent $userAgent)
{
if (stripos($userAgent->getUserAgentString(), 'Windows Phone') !== false) {
$os->setIsMobile(true);
$os->setName($os::WINDOWS_PHONE);
// Windows version
if (preg_match('/Windows Phone ([\d\.]*)/i', $userAgent->getUserAgentString(), $matches)) {
Expand Down
2 changes: 2 additions & 0 deletions tests/BrowserDetector/Tests/OsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ public function testBlackberry()

public function testIsMobile()
{
$os = new Os('Mozilla/5.0 (Windows Phone 10.0; Android 6.0.1; Microsoft; Lumia 640 LTE) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.79 Mobile Safari/537.36 Edge/14.14393');
$this->assertTrue($os->isMobile());
$os = new Os('Mozilla/5.0 (iPod; CPU iPhone OS 6_1_3 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) CriOS/28.0.1500.16 Mobile/10B329 Safari/8536.25');
$this->assertTrue($os->isMobile());
}
Expand Down

0 comments on commit 7fcda47

Please sign in to comment.