serbanghita / Mobile-Detect

Mobile_Detect is a lightweight PHP class for detecting mobile devices (including tablets). It uses the User-Agent string combined with specific HTTP headers to detect the mobile environment.
http://mobiledetect.net
MIT License
10.54k stars 2.67k forks source link

Pixel 2 phone device mis-detected as Galapad tablet device #761

Closed maxinovi closed 3 years ago

maxinovi commented 6 years ago

Issue description Pixel 2 phone device is detected as Galapad tablet device (such behavior observed in mobile-detect.js).

User-Agent(s) Mozilla/5.0 (Linux; Android 8.1.0; Pixel 2 Build/OPM2.171026.006.G1; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/68.0.3440.70 Mobile Safari/537.36

Suggestions The user-agent string matches 1.4.3 regex for Galapad tablet /Android.*\bG1\b(?!\))/i because of 2 characters G1.

serbanghita commented 3 years ago

@maxinovi appreciate your feedback! This helped me fix the detection bug. I updated the GalapadTablet regex to be much more simple. Fix available in https://github.com/serbanghita/Mobile-Detect/releases/tag/2.8.36