Project

General

Profile

Actions

Bug #19509

closed

TypoScript condition "browser": Mismatches due to wrong search order

Added by Sven Teuber about 16 years ago. Updated about 16 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
-
Target version:
-
Start date:
2008-10-27
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
4.2
PHP Version:
5.2
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

in t3lib/class.t3lib_matchcondition.php,
function browserInfo() (line 516 - 540),
the browser is detected using a string-match against the useragent:

if ($useragent) {
// browser
if (strstr($useragent,'MSIE')) {
$browserInfo['browser']='msie';
} elseif(strstr($useragent,'Konqueror')) {
$browserInfo['browser']='konqueror';
} elseif(strstr($useragent,'Opera')) {
$browserInfo['browser']='opera';
}
// ...
}

Since Opera (9.x) identifies as:

"Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; de) Opera 9.61"

the search for MSIE triggers before the search for "Opera" is performed. Thus, Opera will never be identified, but always be mistaken for an Internet Explorer.

Fix:
Turn the order around:

if ($useragent) {
// browser
if (strstr($useragent,'Opera')) {
$browserInfo['browser']='opera';
} elseif(strstr($useragent,'MSIE')) {
$browserInfo['browser']='msie';
} elseif(strstr($useragent,'Konqueror')) {
$browserInfo['browser']='konqueror';
}
// ...
}

This way, Opera will be detected correctly, without breaking MSIE detection.

The bug is present in 4.2.2, too.
(issue imported from #M9650)

Actions

Also available in: Atom PDF