WhichBrowser / Parser-PHP

Browser sniffing gone too far — A useragent parser library for PHP
http://whichbrowser.net
MIT License
1.79k stars 242 forks source link

Incorrect detection of user agent string #652

Open etetlow opened 3 years ago

etetlow commented 3 years ago

Hey,

I've caught quite an embarrassing mistake in the incorrect detection of a user agent string. The string in question is: Mozilla/5.0 (Linux; Android 10; YAL-L21; HMSCore 5.2.0.318; GMSCore 21.09.15) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.106 HuaweiBrowser/11.0.6.305 Mobile Safari/537.36

On the website it's detected as: manufacturer: Huawei model: Browser browser: Chrome version: 83.0.4103.106 rendering engine: Blink operating system: Android version: 10

When in fact the model is an Honor 20 as the model number: YAL-L21 suggests in the user agent. The browser is the in-built Huawei Browser, version: 11.06.305 as stated in the user agent.

I can see that it's gone through the detectGenericMobileModels function and found 'HUAWEI' but if 'Browser' is found right next to it, surely this is a big hint that it's not the model number. As it stands, any Huawei device using its own built-in browser is going to have the model detected as 'Browser'. Could someone please look into rectifying this.

Thanks.