Opened 3 years ago

Closed 8 months ago

Last modified 8 months ago

#2621 closed New feature (fixed)

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

Reported by: markus Owned by:
Priority: normal Milestone: 1.6 Piwik 1.6
Component: Core Keywords:
Cc: Sensitive: no

Description

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

Change History (6)

comment:1 Changed 3 years ago by vipsoft (robocoder)

  • Keywords UserAgent removed
  • Milestone changed from Feature requests to 1.6 Piwik 1.6
  • Summary changed from UserAgentParser.php: IE8 in compatibility mode not recognised to UserAgentParser.php: use actual IE version instead IE7 when in compatibility mode

comment:2 Changed 3 years ago by vipsoft (robocoder)

  • Resolution set to fixed
  • Status changed from new to closed

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

comment:3 Changed 9 months ago by soulfroys

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?

comment:4 Changed 8 months ago by soulfroys

  • Resolution fixed deleted
  • Status changed from closed to reopened

comment:5 Changed 8 months ago by vipsoft (robocoder)

  • Resolution set to fixed
  • Status changed from reopened to closed

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).

comment:6 Changed 8 months ago by soulfroys

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

Sorry for the noise!

Note: See TracTickets for help on using tickets.