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 #1

Updated by Marcus Krause about 16 years ago

This only happens when Opera's Browser Identification is set to "Identify as Internet Explorer" and so it's intended by design to be recognized as IE.

A proper configured Opera identifies like
Opera/9.61 (X11; Linux i686; U; en) Presto/2.1.1
as my does.

IMHO, this issue is not a bug and could be closed.

Actions #3

Updated by Steffen Kamper about 16 years ago

it doesn't matter in which order the if is, there is only one match.

As Markus mentioned, if Opera uses MSIE as identifier, he wants to be recognized as MSIE.

Actions

Also available in: Atom PDF