Bug Tracker

Ticket #2784 (assigned bug)

Opened 7 months ago

Last modified 5 months ago

In IE7 version is reported as 6.0

Reported by: cgriffin Assigned to: flesler (accepted)
Type: bug Priority: minor
Milestone: 1.3 Component: core
Version: 1.2.3 Keywords: IE7 version
Cc: Needs: Patch

Description

IE7 is reporting the following in userAgent:

Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1) ; .NET CLR 2.0.50727; .NET CLR 1.1.4322; InfoPath?.1; .NET CLR 3.0.04506.648; .NET CLR 3.5.21022)

The current RegEx? for extracting the version is: /.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/ I believe the first .+ is greedy and therefore passing the MSIE 7.0 in favor of the later MSIE 6.0.

Adding a question mark after the .+ negates the greedyness of that expression.

/.+?(?:rv|it|ra|ie)[\/: ]([\d.]+)/

Attachments

browser_version_regex_fix.diff (1.9 kB) - added by bgreenlee 5 months ago.

Change History

Changed 7 months ago by flesler

  • owner set to flesler
  • status changed from new to assigned

Ok tested this, my user agent is nothing like that... but assuming yours has an IE6 inside, then the ? will do. These needs to be tested, to see it doesn't break for other browsers.

Changed 7 months ago by flesler

It's odd, for Firefox and Safari, the revisions are collected, and not the versions. I wonder if this is the desired information, I'll have to ask around.

You can check the results with and without your modification: original: http://flesler.webs.com/UA/ modified: http://flesler.webs.com/UA/modified.html

Changed 7 months ago by flesler

Same as #2661

Changed 7 months ago by flesler

  • milestone changed from 1.2.3 to 1.2.4

Changed 5 months ago by bgreenlee

I just ran into the same problem. The regex suggested by the OP does not pass all tests, however (it breaks a couple of the Opera tests). Attached is a diff that includes a regex that does pass.

Changed 5 months ago by bgreenlee

Changed 5 months ago by flesler

  • need changed from Review to Patch
  • milestone changed from 1.2.4 to 1.3

Ok, will do some testing, will surely be fixed for 1.3.

Note: See TracTickets for help on using tickets.