Skip to content

Commit

Permalink
Backport Motorola Edge Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
donatj committed Jun 8, 2022
1 parent ce2b7df commit 9851da5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/UserAgentParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,13 @@ function parse_user_agent( $u_agent = null ) {
}

preg_match_all('%(?P<browser>Camino|Kindle(\ Fire)?|Firefox|Iceweasel|IceCat|Safari|MSIE|Trident|AppleWebKit|
TizenBrowser|(?:Headless)?Chrome|YaBrowser|Vivaldi|IEMobile|Opera|OPR|Silk|Midori|Edge|EdgA?|CriOS|UCBrowser|Puffin|
TizenBrowser|(?:Headless)?Chrome|YaBrowser|Vivaldi|IEMobile|Opera|OPR|Silk|Midori|(?-i:Edge)|EdgA?|CriOS|UCBrowser|Puffin|
OculusBrowser|SamsungBrowser|SailfishBrowser|XiaoMi/MiuiBrowser|
Baiduspider|Applebot|Facebot|Googlebot|YandexBot|bingbot|Lynx|Version|Wget|curl|
Valve\ Steam\ Tenfoot|
NintendoBrowser|PLAYSTATION\ (\d|Vita)+)
(?:\)?;?)
(?:(?:[:/ ])(?P<version>[0-9A-Z.]+)|/(?:[A-Z]*))%ix',
(?:(?:[:/ ])(?P<version>[\dA-Z.]+)|/(?:[A-Z]*))%ix',
$u_agent, $result);

// If nothing matched, return null (to avoid undefined index errors)
Expand Down
5 changes: 5 additions & 0 deletions tests/user_agents.dist.json
Original file line number Diff line number Diff line change
Expand Up @@ -624,6 +624,11 @@
"browser": "Chrome",
"version": "18.0.1025.308"
},
"Mozilla\/5.0 (Linux; Android 11; motorola edge 20 lite) AppleWebKit\/537.36 (KHTML, like Gecko) Chrome\/102.0.5005.78 Mobile Safari\/537.36": {
"platform": "Android",
"browser": "Chrome",
"version": "102.0.5005.78"
},
"Mozilla\/5.0 (Windows Mobile 10; Android 10.0; Microsoft; Lumia 950XL) AppleWebKit\/537.36 (KHTML, like Gecko) Chrome\/100.0.4896.127 Mobile Safari\/537.36 Edge\/40.15254.603": {
"platform": "Android",
"browser": "Edge",
Expand Down

0 comments on commit 9851da5

Please sign in to comment.