Skip to content
This repository has been archived by the owner on Apr 23, 2024. It is now read-only.

Commit

Permalink
Fix new User-Agent passed by Chromium in Windows 10
Browse files Browse the repository at this point in the history
  • Loading branch information
zsxsoft committed Jan 4, 2017
1 parent bf1da92 commit f8bf32d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/useragent_detect_os.php
Expand Up @@ -17,8 +17,8 @@

class useragent_detect_os {
private static $_windows_version = array(
"6.4" => array("10", "6"), // Windows 10 before 10240
"10.0" => array("10", "6"),
"6.4" => array("10", "6"), // Windows 10 before 10240
"6.3" => array("8.1", "5"),
"6.2" => array("8", "5"),
"6.1" => array("7", "4"),
Expand Down Expand Up @@ -88,7 +88,7 @@ public static function analyzeWindows($useragent) {
$image_url = "wp7";
}
}
} elseif (preg_match('/Windows NT ([0-9.]+)/i', $useragent, $regmatch)) {
} elseif (preg_match('/Windows NT (\d+\.\d+)/i', $useragent, $regmatch)) {
if (isset(self::$_windows_version[$regmatch[1]])) {
self::_returnWindows($return, $regmatch[1]);
}
Expand Down
4 changes: 4 additions & 0 deletions tests/UserAgentList.php
Expand Up @@ -2402,4 +2402,8 @@
array('Mozilla/5.0 (Linux; Android 5.1.1; Mi-4c Build/LMY47V; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/43.0.2357.121 Mobile Safari/537.36'),
array('img/16/browser/chrome.png', 'img/16/device/xiaomi.png', 'Google Chrome', '43.0.2357.121', 'Google Chrome 43.0.2357.121', 'Android', '5.1.1', 'Android 5.1.1', 'Xiaomi 4c', 'device')
),
array(
array('Mozilla/5.0 (Windows NT 10.0.14986; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2950.4 Safari/537.36'),
array('img/16/browser/chrome.png', 'img/16/os/win-6.png', 'Google Chrome', '57.0.2950.4', 'Google Chrome 57.0.2950.4', 'Windows', '10', 'Windows 10 x64', '', 'os')
),
);

0 comments on commit f8bf32d

Please sign in to comment.