cbschuld/Browser.php

IE 11 don't detected

Closed this issue · 5 comments

Hello,

There is a problem. IE 11 isn't detected.
$browser->getBrowser() => Mozilla
$browser->getVersion() => 5.0

There is a new USER-AGENT!
My USER-AGENT with IE 11 is: Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like Gecko

Can you update?

Check it: http://msdn.microsoft.com/fr-fr/library/ie/bg182625(v=vs.85).aspx

Thanks

Hello,

To fix the problem, new checkBrowserInternetExplorer function!

protected function checkBrowserInternetExplorer()
{

    // Test for v1 - v1.5 IE
    if (stripos($this->_agent, 'microsoft internet explorer') !== false) {
        $this->setBrowser(self::BROWSER_IE);
        $this->setVersion('1.0');
        $aresult = stristr($this->_agent, '/');
        if (preg_match('/308|425|426|474|0b1/i', $aresult)) {
            $this->setVersion('1.5');
        }
        return true;
    } // Test for versions > 1.5
    else if (stripos($this->_agent, 'msie') !== false && stripos($this->_agent, 'opera') === false) {
        // See if the browser is the odd MSN Explorer
        if (stripos($this->_agent, 'msnb') !== false) {
            $aresult = explode(' ', stristr(str_replace(';', '; ', $this->_agent), 'MSN'));
            $this->setBrowser(self::BROWSER_MSN);
            $this->setVersion(str_replace(array('(', ')', ';'), '', $aresult[1]));
            return true;
        }
        $aresult = explode(' ', stristr(str_replace(';', '; ', $this->_agent), 'msie'));
        $this->setBrowser(self::BROWSER_IE);
        $this->setVersion(str_replace(array('(', ')', ';'), '', $aresult[1]));
        return true;
    } // Test for versions > IE 10
    else if(stripos($this->_agent, 'trident') !== false) {
        $this->setBrowser(self::BROWSER_IE);
        $result = explode('rv:', $this->_agent);
        $this->setVersion(preg_replace('/[^0-9.]+/', '', $result[1]));
        $this->_agent = str_replace(array("Mozilla", "Gecko"), "MSIE", $this->_agent);
    } // Test for Pocket IE
    else if (stripos($this->_agent, 'mspie') !== false || stripos($this->_agent, 'pocket') !== false) {
        $aresult = explode(' ', stristr($this->_agent, 'mspie'));
        $this->setPlatform(self::PLATFORM_WINDOWS_CE);
        $this->setBrowser(self::BROWSER_POCKET_IE);
        $this->setMobile(true);

        if (stripos($this->_agent, 'mspie') !== false) {
            $this->setVersion($aresult[1]);
        } else {
            $aversion = explode('/', $this->_agent);
            $this->setVersion($aversion[1]);
        }
        return true;
    }
    return false;
}

Source: #3 (comment)

👍 Yoann166, works perfectly.

Hi @Yoann166 can you submit a pull request? I can merge it in then; thanks!

Ok! It's done.

fixed in #17