[!!!][TASK] Remove $GLOBALS['CLIENT'] 61/41261/2
authorHelmut Hummel <helmut.hummel@typo3.org>
Wed, 15 Jul 2015 08:07:19 +0000 (10:07 +0200)
committerGeorg Ringer <georg.ringer@gmail.com>
Wed, 15 Jul 2015 08:20:36 +0000 (10:20 +0200)
The global client information is not useful any more nowadays
and can be removed. It is only used a few times in the core.
These usages are also removed now.

GeneralUtility::clientInfo() is kept for now.

Releases: master
Resolves: #68150
Change-Id: If339ed729b6c441496548cdd15a36c7943c69ae6
Reviewed-on: http://review.typo3.org/41261
Reviewed-by: Benjamin Mack <benni@typo3.org>
Reviewed-by: David Greiner <hallo@davidgreiner.de>
Reviewed-by: Andreas Fernandez <typo3@scripting-base.de>
Tested-by: Andreas Fernandez <typo3@scripting-base.de>
Reviewed-by: Georg Ringer <georg.ringer@gmail.com>
Tested-by: Georg Ringer <georg.ringer@gmail.com>
typo3/sysext/backend/Classes/Controller/File/FileController.php
typo3/sysext/backend/Classes/Http/AjaxRequestHandler.php
typo3/sysext/backend/Classes/Http/BackendModuleRequestHandler.php
typo3/sysext/backend/Classes/Http/RequestHandler.php
typo3/sysext/core/Classes/Authentication/AbstractUserAuthentication.php
typo3/sysext/core/Classes/Core/Bootstrap.php
typo3/sysext/core/Classes/Core/SystemEnvironmentBuilder.php
typo3/sysext/core/Documentation/Changelog/master/Breaking-68150-GLOBALSCLIENT.rst [new file with mode: 0644]
typo3/sysext/core/Tests/Unit/Core/SystemEnvironmentBuilderTest.php

index 1d4365a..152ffbd 100644 (file)
@@ -137,7 +137,7 @@ class FileController {
                // Checking referrer / executing:
                $refInfo = parse_url(GeneralUtility::getIndpEnv('HTTP_REFERER'));
                $httpHost = GeneralUtility::getIndpEnv('TYPO3_HOST_ONLY');
-               if ($httpHost != $refInfo['host'] && $this->vC != $this->getBackendUser()->veriCode() && !$GLOBALS['TYPO3_CONF_VARS']['SYS']['doNotCheckReferer'] && $GLOBALS['CLIENT']['BROWSER'] != 'flash') {
+               if ($httpHost !== $refInfo['host'] && $this->vC !== $this->getBackendUser()->veriCode() && !$GLOBALS['TYPO3_CONF_VARS']['SYS']['doNotCheckReferer']) {
                        $this->fileProcessor->writeLog(0, 2, 1, 'Referrer host "%s" and server host "%s" did not match!', array($refInfo['host'], $httpHost));
                } else {
                        $this->fileProcessor->start($this->file);
index 0b7a4b0..1b07698 100644 (file)
@@ -148,7 +148,6 @@ class AjaxRequestHandler implements RequestHandlerInterface {
                        ->checkLockedBackendAndRedirectOrDie($proceedIfNoUserIsLoggedIn)
                        ->checkBackendIpOrDie()
                        ->checkSslBackendAndRedirectIfNeeded()
-                       ->checkValidBrowserOrDie()
                        ->loadExtensionTables(TRUE)
                        ->initializeSpriteManager()
                        ->initializeBackendUser()
index de25671..0a19c3f 100644 (file)
@@ -105,7 +105,6 @@ class BackendModuleRequestHandler implements RequestHandlerInterface {
                $this->bootstrap->checkLockedBackendAndRedirectOrDie()
                        ->checkBackendIpOrDie()
                        ->checkSslBackendAndRedirectIfNeeded()
-                       ->checkValidBrowserOrDie()
                        ->loadExtensionTables(TRUE)
                        ->initializeSpriteManager()
                        ->initializeBackendUser()
index 2860c42..066b97b 100644 (file)
@@ -64,7 +64,6 @@ class RequestHandler implements RequestHandlerInterface {
                        ->checkLockedBackendAndRedirectOrDie()
                        ->checkBackendIpOrDie()
                        ->checkSslBackendAndRedirectIfNeeded()
-                       ->checkValidBrowserOrDie()
                        ->loadExtensionTables(TRUE)
                        ->initializeSpriteManager()
                        ->initializeBackendUser()
index 874d03e..1063406 100644 (file)
@@ -1035,22 +1035,6 @@ abstract class AbstractUserAuthentication {
        protected function fetchUserSessionFromDB() {
                $statement = NULL;
                $ipLockClause = $this->ipLockClause();
-               if ($GLOBALS['CLIENT']['BROWSER'] == 'flash') {
-                       // If on the flash client, the veri code is valid, then the user session is fetched
-                       // from the DB without the hashLock clause
-                       if (GeneralUtility::_GP('vC') == $this->veriCode()) {
-                               $statement = $this->db->prepare_SELECTquery('*', $this->session_table . ',' . $this->user_table, $this->session_table . '.ses_id = :ses_id
-                                               AND ' . $this->session_table . '.ses_name = :ses_name
-                                               AND ' . $this->session_table . '.ses_userid = ' . $this->user_table . '.' . $this->userid_column . '
-                                               ' . $ipLockClause['where'] . '
-                                               ' . $this->user_where_clause());
-                               $statement->bindValues(array(
-                                       ':ses_id' => $this->id,
-                                       ':ses_name' => $this->name
-                               ));
-                               $statement->bindValues($ipLockClause['parameters']);
-                       }
-               } else {
                        $statement = $this->db->prepare_SELECTquery('*', $this->session_table . ',' . $this->user_table, $this->session_table . '.ses_id = :ses_id
                                        AND ' . $this->session_table . '.ses_name = :ses_name
                                        AND ' . $this->session_table . '.ses_userid = ' . $this->user_table . '.' . $this->userid_column . '
@@ -1062,7 +1046,6 @@ abstract class AbstractUserAuthentication {
                                ':ses_name' => $this->name
                        ));
                        $statement->bindValues($ipLockClause['parameters']);
-               }
                return $statement;
        }
 
index ced2550..b92e9f9 100644 (file)
@@ -446,21 +446,6 @@ class Bootstrap {
        }
 
        /**
-        * Throws an exception if no browser could be identified
-        *
-        * @return Bootstrap
-        * @throws \RuntimeException
-        * @internal This is not a public API method, do not use in own extensions
-        */
-       public function checkValidBrowserOrDie() {
-               // Checks for proper browser
-               if (empty($GLOBALS['CLIENT']['BROWSER'])) {
-                       throw new \RuntimeException('Browser Error: Your browser version looks incompatible with this TYPO3 version!', 1294587023);
-               }
-               return $this;
-       }
-
-       /**
         * We need an early instance of the configuration manager.
         * Since makeInstance relies on the object configuration, we create it here with new instead.
         *
index dc686c3..d08ccc6 100644 (file)
@@ -213,8 +213,6 @@ class SystemEnvironmentBuilder {
        static protected function initializeGlobalVariables() {
                // Unset variable(s) in global scope (security issue #13959)
                unset($GLOBALS['error']);
-               // Set up base information about browser/user-agent
-               $GLOBALS['CLIENT'] = GeneralUtility::clientInfo();
                $GLOBALS['TYPO3_MISC'] = array();
                $GLOBALS['T3_VAR'] = array();
                $GLOBALS['T3_SERVICES'] = array();
diff --git a/typo3/sysext/core/Documentation/Changelog/master/Breaking-68150-GLOBALSCLIENT.rst b/typo3/sysext/core/Documentation/Changelog/master/Breaking-68150-GLOBALSCLIENT.rst
new file mode 100644 (file)
index 0000000..c80504e
--- /dev/null
@@ -0,0 +1,26 @@
+=====================================
+Breaking: #68150 - $GLOBALS['CLIENT']
+=====================================
+
+Description
+===========
+
+The initialization of the $GLOBALS['CLIENT'] variable has been dropped.
+
+
+Impact
+======
+
+Extensions that use $GLOBALS['CLIENT'] will cause a PHP notice or may not function properly any more.
+
+
+Affected Installations
+======================
+
+Installations with extensions that use $GLOBALS['CLIENT'] are affected.
+
+
+Migration
+=========
+
+Extensions can still use GeneralUtility::clientInfo() API to retrieve the same information.
\ No newline at end of file
index 7067f1f..e73cdcc 100644 (file)
@@ -130,15 +130,6 @@ class SystemEnvironmentBuilderTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
        /**
         * @test
         */
-       public function initializeGlobalVariablesSetsGlobalClientArray() {
-               unset($GLOBALS['CLIENT']);
-               $this->subject->_call('initializeGlobalVariables');
-               $this->assertArrayHasKey('CLIENT', $GLOBALS);
-       }
-
-       /**
-        * @test
-        */
        public function initializeGlobalVariablesSetsGlobalTypo3MiscArray() {
                unset($GLOBALS['TYPO3_MISC']);
                $this->subject->_call('initializeGlobalVariables');