Skip to content
This repository has been archived by the owner on Jan 25, 2023. It is now read-only.

Firefox on iOs is detected as Safari #88

Open
janmech opened this issue Jul 11, 2017 · 1 comment
Open

Firefox on iOs is detected as Safari #88

janmech opened this issue Jul 11, 2017 · 1 comment

Comments

@janmech
Copy link

janmech commented Jul 11, 2017

When checking for firefox the first criteria to is the absence of 'safari' in the user agent string.

but on iOS 'safari' appears (@see: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/User-Agent/Firefox)

Instead of 'Firefox/version' 'FxiOS/version' is used.

Hence firefox on iOS is identified as Safari with version:unkown.

IN:

Sinergi\BrowserDetector\BrowserDetector

public static function checkBrowserFirefox()
    {
        if (stripos(self::$userAgentString, 'safari') === false) {
            if (preg_match("/Firefox[\/ \(]([^ ;\)]+)/i", self::$userAgentString, $matches)) {
                if (isset($matches[1])) {
                    self::$browser->setVersion($matches[1]);
                }
                self::$browser->setName(Browser::FIREFOX);

                return true;
            } elseif (preg_match('/Firefox$/i', self::$userAgentString, $matches)) {
                self::$browser->setVersion('');
                self::$browser->setName(Browser::FIREFOX);

                return true;
            }
        }

        return false;
    }
@derpoho
Copy link

derpoho commented Oct 2, 2017

Looks like #86 !

Can somebody merge this PR?

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

No branches or pull requests

2 participants