Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-31482

get_device_type incorrectly detects IE7/8 as IE6 (legacy)

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • 2.1.5, 2.2.2
    • 2.1.4, 2.2.1, 2.3
    • Libraries
    • MOODLE_21_STABLE, MOODLE_22_STABLE, MOODLE_23_STABLE
    • MOODLE_21_STABLE, MOODLE_22_STABLE
    • MDL-31482-master
    • Hide

      To test, you need a VM (or real computer I guess) that is set up to run IE 7 or IE 8. You will also need another VM that is set up to run the real IE 6.

      It may also be possible to test this using the IETester software, which I think lets you configure user agents. I'm giving real-computer instructions for this test script.

      (On the IE 7/8 system)

      1) Run the registry editor (regedit) and navigate to:
      HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings\User Agent\Post Platform

      2) Right click and choose New / String value. An untitled string value REG_SZ should appear.

      3) Type 'MSIE 6.99' for the value, hit return.

      4) If you have a browser open, close it.

      (On your real machine)

      5) In your Moodle settings (Appearance / Theme / Theme selector), select a different theme for 'Legacy' device type compared to default, so you can tell when it is in use. For example, you could choose 'Serenity', which is probably ugly enough that you'll notice.

      (on the IE7 machine)

      6) Open IE 7 and visit your test server.
      + Verify that your normal theme (not Serenity) is in use.

      (on the IE6 machine)

      7) Open IE6 and visit your test server.
      + Verify that the Serenity theme is in use.

      X) also test unit tests @ /lib/simpletest/testmoodlelib.php ( only 1 expected fail. read comments from SamM below)

      Show
      To test, you need a VM (or real computer I guess) that is set up to run IE 7 or IE 8. You will also need another VM that is set up to run the real IE 6. It may also be possible to test this using the IETester software, which I think lets you configure user agents. I'm giving real-computer instructions for this test script. (On the IE 7/8 system) 1) Run the registry editor (regedit) and navigate to: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings\User Agent\Post Platform 2) Right click and choose New / String value. An untitled string value REG_SZ should appear. 3) Type 'MSIE 6.99' for the value, hit return. 4) If you have a browser open, close it. (On your real machine) 5) In your Moodle settings (Appearance / Theme / Theme selector), select a different theme for 'Legacy' device type compared to default, so you can tell when it is in use. For example, you could choose 'Serenity', which is probably ugly enough that you'll notice. (on the IE7 machine) 6) Open IE 7 and visit your test server. + Verify that your normal theme (not Serenity) is in use. (on the IE6 machine) 7) Open IE6 and visit your test server. + Verify that the Serenity theme is in use. X) also test unit tests @ /lib/simpletest/testmoodlelib.php ( only 1 expected fail. read comments from SamM below)

      The get_device_type function includes this code:

          if (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE 6.') !== false) {
              return 'legacy';
          }

      Unfortunately this logic misdetects IE7/8 as IE6 under certain circumstances. In my testing, approximately 1.5% of users with MSIE7 or MSIE8 have user-agent strings that also contain the string 'MSIE 6.'.

      Here is an example user agent:

      Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; BT Openworld BB; Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1) ; Hotbar 10.2.197.0; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; .NET CLR 2.0.50727)

      Obviously this user agent string is completely broken. Agents like this (there are many different cases with no obvious common factors, other than the symptom of a 'nested' IE6 user agent) are common.

      Microsoft have fixed this problem in IE9 which doesn't add crap all over its user agent, so it is only MSIE 7 and MSIE 8 that are affected.

      (Yes we discovered this after doing something drastic so that our pages could sort of display in IE6... and then getting a bunch of helpdesk calls from irate IE7/8 users. Ooops.)

            quen Sam Marshall
            quen Sam Marshall
            Jason Fowler Jason Fowler
            Aparup Banerjee Aparup Banerjee
            Michael de Raadt Michael de Raadt
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:

                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.