From 54b7aec5d3c85ea0219534b44e6e6d5977aeba41 Mon Sep 17 00:00:00 2001 From: Jesse Donat Date: Wed, 8 Jun 2022 11:31:47 -0500 Subject: [PATCH] Make Edge case sensitive Fixes issue with Motorola Edge user agent --- src/UserAgentParser.php | 2 +- tests/user_agents.dist.json | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/UserAgentParser.php b/src/UserAgentParser.php index fc4e319..14d2175 100644 --- a/src/UserAgentParser.php +++ b/src/UserAgentParser.php @@ -92,7 +92,7 @@ function parse_user_agent( $u_agent = null ) { preg_match_all(<<<'REGEX' %(?PCamino|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| diff --git a/tests/user_agents.dist.json b/tests/user_agents.dist.json index 47ada66..b813e52 100644 --- a/tests/user_agents.dist.json +++ b/tests/user_agents.dist.json @@ -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",