Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

isMobile returns true on desktop after Chrome's update #358

Closed
ppartida-LEGACY opened this issue Mar 4, 2015 · 11 comments
Closed

isMobile returns true on desktop after Chrome's update #358

ppartida-LEGACY opened this issue Mar 4, 2015 · 11 comments

Comments

@ppartida-LEGACY
Copy link

https://github.com/serbanghita/Mobile-Detect/blob/master/Mobile_Detect.php#L166

Hi, Chrome just updated last night and the new version is matching one of the LG's phone devices, causing the isMobile to be true on Chrome's desktop.

http://screencast.com/t/E1R8TAYoqN

@nicktacular
Copy link
Contributor

Yikes can you paste the user agent here that you are seeing?

@ppartida-LEGACY
Copy link
Author

My user agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.76 Safari/537.36

The string that is returning true:
'LG' => '\bLG\b;|(LG|LG-)?(C800|C900|E400|E610|E900|E-900|F160|F180K|F180L|F180S|730|855|L160|LS840|LS970|LU6200|MS690|MS695|MS770|MS840|MS870|MS910|P500|P700|P705|VM696|AS680|AS695|AX840|C729|E970|GS505|272|C395|E739BK|E960|L55C|L75C|LS696|LS860|P769BK|P350|P870|UN272|US730|VS840|VS950|LN272|LN510|LS670|LS855|LW690|MN270|MN510|P509|P769|P930|UN200|UN270|UN510|UN610|US670|US740|US760|UX265|UX840|VN271|VN530|VS660|VS700|VS740|VS750|VS910|VS920|VS930|VX9200|VX11000|AX840A|LW770|P506|P925|P999)',

Got those from here:

function match($regex, $userAgent=null){
    // Escape the special character which is the delimiter.
    $regex = str_replace('/', '\/', $regex);
    return (bool)preg_match('/'.$regex.'/is', (!empty($userAgent) ? $userAgent : $this->userAgent));
}

http://screencast.com/t/E1R8TAYoqN

@nicktacular
Copy link
Contributor

Ah I see, the problematic bit is the |272| bit which is a bit too permissive I think. We'll work on coming up with a better pattern for this. Thanks for pointing this out. For the time being, remove |272 from the array until we have an update.

@ppartida-LEGACY
Copy link
Author

I removed it as well as:

  • 730
  • 855

Just for LG's.

:-) np

@rangilin
Copy link

rangilin commented Mar 5, 2015

Hello,

I upgrade from 2.6.0 to 2.8.11 fix this problem, FYI.

older version use regex (LG|LG-)?, so it can match 272
new version use LG[- ]?, so only LG272, LG-272 mtach

@mauroagr
Copy link

mauroagr commented Mar 5, 2015

Hi,
I am using the prestashop, and get the same error.
I update to 2.8.11, and stay marking like a mobile, and was working fine before update.
I test in IE, and running fine..fine.
Version 41.0.2272.76
Thanks
Mauro

@serbanghita
Copy link
Owner

I can confirm that this is an issue with an older release 2.6.2, upgrade to the latest.

@mauroagr Prestashop should include Mobile_Detect class through a 3rd party module so it could be updated easely.

@serbanghita
Copy link
Owner

@porfiriopartida thank you for bringing this into attention! I will find a way with @nicktacular to better announce our releases on mobiledetect.net

@mauroagr
Copy link

@serbanghita Yes, i update eh mobile_detect, but not work.
Then i change some lines in php from prestashop and solve.
Thanks

@joshuaiz
Copy link

joshuaiz commented Apr 1, 2015

Thanks for this update. Was driving a client mad.

@serbanghita
Copy link
Owner

Sorry about this, we will try to deliver official Mobile Detect plugins that we will automatically update with each release. I have this on my list.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants