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

UserAgentParser.php: use actual IE version instead IE7 when in compatibility mode #2621

Closed
anonymous-matomo-user opened this issue Aug 10, 2011 · 4 comments
Labels
Enhancement For new feature suggestions that enhance Matomo's capabilities or add a new report, new API etc.
Milestone

Comments

@anonymous-matomo-user
Copy link

all of our IE8 are detected as IE7 in UserAgents because they are running in compatibility mode. it would be nice to have those browsers recodgnised as "IE8 Compatibility" and not as IE7. i have patched UserAgentParser.php

        // Misbehaving IE add-ons
        $userAgent = preg_replace('/[; ]Mozilla\/[0-9.]+ \([^)]+\)/', '', $userAgent);
// IE 8 in compatibility mode on xp, vista and win7
        $userAgent = preg_replace('/MSIE 7.0; Windows NT 5.1; Trident\/4.0/', 'MSIE 8.0; Windows NT 5.1; Trident/4.0', $userAgent);
        $userAgent = preg_replace('/MSIE 7.0; Windows NT 6.0; Trident\/4.0/', 'MSIE 8.0; Windows NT 6.0; Trident/4.0', $userAgent);
        $userAgent = preg_replace('/MSIE 7.0; Windows NT 6.1; Trident\/4.0/', 'MSIE 8.0; Windows NT 6.0; Trident/4.0', $userAgent);

i also patched UserAgentParser.test.php to have ie8 on winxp

    'ie8 on vista' => 'Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; Trident/4.0)',
    'ie8 on winxp' => 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Trident/4.0; ',

so with this IE8 as returned. maybe it would be better to return it as "IE8 in Compatibility Mode".

markus

@robocoder
Copy link
Contributor

(In [5105]) fixes #2621 but UserAgentParser could use some love

@anonymous-matomo-user
Copy link
Author

Hello @markus!

Unfortunately this problem still persists in the latest version (1.12). On an intranet (my case) the Browser Version report is useless this way.

I tried using your patch, but I got no success... Please, could you post a new patch?

@robocoder
Copy link
Contributor

Please open a new ticket with the User Agent that's failing.

tests/PHPUnit/Plugins/UserSettingsTest.php contains compatibility mode User Agent strings showing the actual browser version is detected (instead of the reported compatibility mode).

@anonymous-matomo-user
Copy link
Author

I'll do it. Thank you for putting me in the right direction.

Sorry for the noise!

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement For new feature suggestions that enhance Matomo's capabilities or add a new report, new API etc.
Projects
None yet
Development

No branches or pull requests

2 participants