Bug #19509
closedTypoScript condition "browser": Mismatches due to wrong search order
0%
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)