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

Commit a0cc0f1

Browse files
committed
Fixed Windows Phone detection
1 parent 356eb62 commit a0cc0f1

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

src/OsDetector.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,9 @@ private static function checkIOS(Os $os, UserAgent $userAgent)
9999
*/
100100
private static function checkChromeOs(Os $os, UserAgent $userAgent)
101101
{
102-
if (stripos($userAgent->getUserAgentString(), 'CrOS') !== false) {
102+
if (stripos($userAgent->getUserAgentString(), ' CrOS') !== false ||
103+
stripos($userAgent->getUserAgentString(), 'CrOS ') !== false
104+
) {
103105
$os->setName($os::CHROME_OS);
104106
if (preg_match('/Chrome\/([\d\.]*)/i', $userAgent->getUserAgentString(), $matches)) {
105107
$os->setVersion($matches[1]);

tests/BrowserDetector/Tests/_files/UserAgentStrings.xml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,5 +230,16 @@
230230
Mozilla/5.0 (BB10; Touch) AppleWebKit/537.10+ (KHTML, like Gecko) Version/10.0.9.2372 Mobile Safari/537.10+
231231
</field>
232232
</string>
233+
<string>
234+
<field name="browser">Edge</field>
235+
<field name="version">14.14393</field>
236+
<field name="os">Windows Phone</field>
237+
<field name="os_version">10</field>
238+
<field name="device">Lumia 640 LTE</field>
239+
<field name="device_version">unknown</field>
240+
<field name="string">
241+
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
242+
</field>
243+
</string>
233244
</strings>
234245
</document>

0 commit comments

Comments
 (0)