[Typo3-dev] bug in class.t3lib_matchcondition.php - browser version

Kasper Skårhøj kasper at typo3.com
Thu Apr 1 17:54:52 CEST 2004


Thanks,

changed the function a bit in latest CVS. Please check it.

- kasper

On Sat, 2003-08-30 at 22:24, Simon Child wrote:
> 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
> 
> 
> _______________________________________________
> Typo3-dev mailing list
> Typo3-dev at lists.netfielders.de
> http://lists.netfielders.de/cgi-bin/mailman/listinfo/typo3-dev
-- 

Best regards

- kasper

---------------
"Zero MS-gravity" - finally migrated to Linux!





More information about the TYPO3-dev mailing list