[Typo3-dev] bug in class.t3lib_matchcondition.php - browser version
Simon Child
simondt at gpuk.net
Sat Aug 30 22:24:42 CEST 2003
class.t3lib_matchcondition.php has sections for determining browser version
It doesn't work for Opera, and I think it works for MSIE only accidentally
:)
case "msie":
$tmp = strstr($useragent,"MSIE");
$browserInfo["version"] = doubleval(substr($tmp,4));
break;
case "opera":
$tmp = strstr($useragent,"Opera");
$browserInfo["version"] = doubleval(substr($tmp,5));
break;
For Opera, strstr($useragent,"Opera") gives Opera/6.05
So doubleval(substr($tmp,5)) returns 0 since the 6th character
(substr($tmp,5)) is /, and doubleval of something starting / is 0
For MSIE, strstr($useragent,"MSIE") gives MSIE 5.5
So doubleval(substr($tmp,4)) works, but not because the 5th character
(substr($tmp,4)) is the first digit, but because a leading space (5th
character) does not stop doubleval giving the value in the way that a /
does.
So these lines, especially the opera line, need updating to increment the
string position by one
case "msie":
$tmp = strstr($useragent,"MSIE");
$browserInfo["version"] = doubleval(substr($tmp,5));
break;
case "opera":
$tmp = strstr($useragent,"Opera");
$browserInfo["version"] = doubleval(substr($tmp,6));
break;
--
Simon Child
More information about the TYPO3-dev
mailing list