GaretJax / phpbrowscap

Standalone replacement for php's native get_browser() function
MIT License
429 stars 69 forks source link

browscap returns 'Default Browser' #47

Open ammont opened 10 years ago

ammont commented 10 years ago

browscap_obj->getBrowser()->Browser returns 'Default Browser'

quentin389 commented 10 years ago

Hi, I can't do anything with it unless you tell me what user agent is this for.

ammont commented 10 years ago

so when it does not recognize the browser will return 'Default Browser'?

Firefox 25.0.1 on OSX

quentin389 commented 10 years ago

It's funny... cause that's not even documented in http://php.net/get_browser and yet I always assumed everybody knew that :)

Yes, 'Default Browser' means that the browser was not recognized.

Can you please paste the user agent string here?

ammont commented 10 years ago

Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:25.0) Gecko/20100101 Firefox/25.0 FirePHP/0.7.4

xzag commented 10 years ago

these were not recoginzed as well for me Mozilla/5.0 (Windows NT 6.1; WOW64; rv:25.0) Gecko/20100101 Firefox/25.0 Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like Gecko

Firefox 25 and Explorer 11 on Windows 7

ntvsx193 commented 10 years ago

I have too return 'Default Browser' Chrome 31: Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1650.63 Safari/537.36

IE 11: Mozilla\/5.0 (Windows NT 6.3; WOW64; Trident\/7.0; rv:11.0) like Gecko

Opera 18: Mozilla\/5.0 (Windows NT 6.3; WOW64) AppleWebKit\/537.36 (KHTML, like Gecko) Chrome\/31.0.1650.57 Safari\/537.36 OPR\/18.0.1284.49

wz520 commented 10 years ago

Me too.

Firefox 26: Mozilla/5.0 (Windows NT 5.1; rv:26.0) Gecko/20100101 Firefox/26.0

And the object returned by getBrowser() contains almost nothing.

But on my Chrome 31 it works OK. Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1650.63 Safari/537.36

AlexRegenbogen commented 10 years ago

Getting the same here, but after manually retrieving the actual latest browscap.ini (5021-rc1), I do get the correct results....

Looks like there is something amok with the retrieval of the 'latest' version of browscap.ini...

pjordaan commented 10 years ago

I think the main issue is that http://tempdownloads.browserscap.com/ no longer contains the latest version, but http://browscap.org/ does.

so you can easily fix it: $browscap = new Browscap($cache_dir); $browscap->remoteIniUrl = "http://browscap.org/stream?q=Full_PHP_BrowsCapINI"; $browscap->remoteVerUrl = "http://browscap.org/version";

of course this should be done in the current source code.

quentin389 commented 10 years ago

That's already in the current version...

pjordaan commented 10 years ago

I get my checkout with composer and the latest version I had did not link to the new url.

quentin389 commented 10 years ago

Aha! Updated. Try now. Packagist doesn't update automatically for this project though.