Project

General

Profile

Actions

Bug #22511

closed

getBrowserInfo delivers wrong info

Added by Steffen Kamper almost 14 years ago. Updated over 13 years ago.

Status:
Closed
Priority:
Should have
Category:
-
Target version:
-
Start date:
2010-04-26
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
4.4
PHP Version:
5.3
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

As the most userAgents starts with Mozilla, we always get "netscape" as result which is wrong and doesn't help.

The parsing of UA is not precise and compares the wrong way.

This patch use a regular expression and a list of the known browsers, it's easy to maintain and to add new browsers.

As the TS condition only need one browser, and some browsers return more than one result, the last result is taken as main browser info. But an additional array "all" contains all founded browsers in UA.

The result parsing isn't perfect as there are many possible UA strings, but it reflects the most common browsers.

Example on my machine:

Chrome

[useragent] => Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US) AppleWebKit/532.5 (KHTML, like Gecko) Chrome/4.1.249.1045 Safari/532.5
[browser] => safari
[version] => 532.5
[all] => Array
(
[webkit] => 532.5
[chrome] => 4.1
[safari] => 532.5
)
[system] => winNT

IE

[useragent] => Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; Trident/4.0; SLCC1; .NET CLR 2.0.50727; Media Center PC 5.0; .NET CLR 3.5.30729; InfoPath.1; .NET CLR 3.0.30729; AskTB5.4)
[browser] => msie
[version] => 7.0
[all] => Array
(
[msie] => 7.0
)
[system] => winNT

Firefox

[useragent] => Mozilla/5.0 (Windows; U; Windows NT 6.0; de; rv:1.9.2.3) Gecko/20100401 Ant.com Toolbar 2.0.1 Firefox/3.6.3
[browser] => firefox
[version] => 3.6
[all] => Array
(
[gecko] => 20100401
[firefox] => 3.6
)
[system] => winNT

Safari

[useragent] => Mozilla/5.0 (Windows; U; Windows NT 6.0; de-DE) AppleWebKit/531.22.7 (KHTML, like Gecko) Version/4.0.5 Safari/531.22.7
[browser] => safari
[version] => 531.22
[all] => Array
(
[webkit] => 531.22
[safari] => 531.22
)
[system] => winNT
(issue imported from #M14201)


Files

14201.diff (5.81 KB) 14201.diff Administrator Admin, 2010-04-26 11:00

Related issues 2 (0 open2 closed)

Related to TYPO3 Core - Feature #22383: No Browser Condition working for IE8 in Compatibility ModeClosed2010-04-06

Actions
Related to TYPO3 Core - Bug #22697: getBrowserInfo fails with IE UA StringsClosedSteffen Kamper2010-05-22

Actions
Actions #1

Updated by Steffen Kamper almost 14 years ago

committed to svn
4_3 rev 7437
trunk rev 7438

Actions

Also available in: Atom PDF