cbschuld/Browser.php

Undefined Offset error in browser display

Closed this issue · 2 comments

     I have implemented browser.php on my project for tracking browsers and platform.When I check my browser  it will display all the browser name except

Google Chrome. It displays following error
Undefined offset: 1 in D:\wamp\www\tracker202\assert\Browser.php on line 647.
please help me how to resolve these error?

            Finally I have cleared the error by change the $aversion = explode(' ', $aresult[0]); on line 647.

Correct code was given below

protected function checkBrowserChrome()
{
if (stripos($this->_agent, 'Chrome') !== false) {
$aresult = explode('/', stristr($this->_agent, 'Chrome'));
$aversion = explode(' ', $aresult[0]);
$this->setVersion($aversion[0]);
$this->setBrowser(self::BROWSER_CHROME);
//Chrome on Android
if (stripos($this->_agent, 'Android') !== false) {
$this->setMobile(true);
}
return true;
}
return false;
}

Hi @srajas02 - sorry this is VERY old but this is fixed now