Fixed bug #14458: getBrowserInfo fails with IE UA Strings
authorSteffen Kamper <info@sk-typo3.de>
Wed, 9 Jun 2010 11:03:51 +0000 (11:03 +0000)
committerSteffen Kamper <info@sk-typo3.de>
Wed, 9 Jun 2010 11:03:51 +0000 (11:03 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@7844 709f56b5-9817-0410-a4d7-c38de5d9e867

ChangeLog
t3lib/utility/class.t3lib_utility_client.php

index cd69fdf..1a976c0 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2010-06-08  Steffen Kamper  <info@sk-typo3.de>
+
+       * Fixed bug #14458: getBrowserInfo fails with IE UA Strings
+
 2010-06-09  Christian Kuhn  <lolli@schwarzbu.ch>
 
        * Added feature #14655: Caching framework: Implement PDO backend
index ae911b9..e4b6a5e 100644 (file)
@@ -79,12 +79,15 @@ final class t3lib_utility_Client {
                                // Since some UAs have more than one phrase (e.g Firefox has a Gecko phrase,
                                // Opera 7,8 have a MSIE phrase), use the last one found (the right-most one
                                // in the UA).  That's usually the most correct.
+                               // For IE use the first match as IE sends multiple MSIE with version, from higher to lower.
                        $lastIndex = count($matches['browser']) - 1;
                        $browserInfo['browser'] = $matches['browser'][$lastIndex];
-                       $browserInfo['version'] = $matches['version'][$lastIndex];
+                       $browserInfo['version'] = $browserInfo['browser'] === 'msie' ? $matches['version'][0] : $matches['version'][$lastIndex];
                                //But return all parsed browsers / version in an extra array
                        for ($i = 0; $i <= $lastIndex; $i++) {
-                               $browserInfo['all'][$matches['browser'][$i]] = $matches['version'][$i];
+                               if (!isset($browserInfo['all'][$matches['browser'][$i]])) {
+                                       $browserInfo['all'][$matches['browser'][$i]] = $matches['version'][$i];
+                               }
                        }
                }