From bb809bcbff16dd79ee2887ab8d8bae4935b89db7 Mon Sep 17 00:00:00 2001 From: Helmut Hummel <helmut.hummel@typo3.org> Date: Wed, 15 Jul 2015 10:07:19 +0200 Subject: [PATCH] [!!!][TASK] Remove $GLOBALS['CLIENT'] 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> --- .../Controller/File/FileController.php | 2 +- .../Classes/Http/AjaxRequestHandler.php | 1 - .../Http/BackendModuleRequestHandler.php | 1 - .../backend/Classes/Http/RequestHandler.php | 1 - .../AbstractUserAuthentication.php | 17 ------------ typo3/sysext/core/Classes/Core/Bootstrap.php | 15 ----------- .../Classes/Core/SystemEnvironmentBuilder.php | 2 -- .../master/Breaking-68150-GLOBALSCLIENT.rst | 26 +++++++++++++++++++ .../Core/SystemEnvironmentBuilderTest.php | 9 ------- 9 files changed, 27 insertions(+), 47 deletions(-) create mode 100644 typo3/sysext/core/Documentation/Changelog/master/Breaking-68150-GLOBALSCLIENT.rst diff --git a/typo3/sysext/backend/Classes/Controller/File/FileController.php b/typo3/sysext/backend/Classes/Controller/File/FileController.php index 1d4365ab49ba..152ffbdf29ba 100644 --- a/typo3/sysext/backend/Classes/Controller/File/FileController.php +++ b/typo3/sysext/backend/Classes/Controller/File/FileController.php @@ -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); diff --git a/typo3/sysext/backend/Classes/Http/AjaxRequestHandler.php b/typo3/sysext/backend/Classes/Http/AjaxRequestHandler.php index 0b7a4b04d953..1b0769894f4b 100644 --- a/typo3/sysext/backend/Classes/Http/AjaxRequestHandler.php +++ b/typo3/sysext/backend/Classes/Http/AjaxRequestHandler.php @@ -148,7 +148,6 @@ class AjaxRequestHandler implements RequestHandlerInterface { ->checkLockedBackendAndRedirectOrDie($proceedIfNoUserIsLoggedIn) ->checkBackendIpOrDie() ->checkSslBackendAndRedirectIfNeeded() - ->checkValidBrowserOrDie() ->loadExtensionTables(TRUE) ->initializeSpriteManager() ->initializeBackendUser() diff --git a/typo3/sysext/backend/Classes/Http/BackendModuleRequestHandler.php b/typo3/sysext/backend/Classes/Http/BackendModuleRequestHandler.php index de2567134b90..0a19c3fc451c 100644 --- a/typo3/sysext/backend/Classes/Http/BackendModuleRequestHandler.php +++ b/typo3/sysext/backend/Classes/Http/BackendModuleRequestHandler.php @@ -105,7 +105,6 @@ class BackendModuleRequestHandler implements RequestHandlerInterface { $this->bootstrap->checkLockedBackendAndRedirectOrDie() ->checkBackendIpOrDie() ->checkSslBackendAndRedirectIfNeeded() - ->checkValidBrowserOrDie() ->loadExtensionTables(TRUE) ->initializeSpriteManager() ->initializeBackendUser() diff --git a/typo3/sysext/backend/Classes/Http/RequestHandler.php b/typo3/sysext/backend/Classes/Http/RequestHandler.php index 2860c426baf8..066b97b36ab4 100644 --- a/typo3/sysext/backend/Classes/Http/RequestHandler.php +++ b/typo3/sysext/backend/Classes/Http/RequestHandler.php @@ -64,7 +64,6 @@ class RequestHandler implements RequestHandlerInterface { ->checkLockedBackendAndRedirectOrDie() ->checkBackendIpOrDie() ->checkSslBackendAndRedirectIfNeeded() - ->checkValidBrowserOrDie() ->loadExtensionTables(TRUE) ->initializeSpriteManager() ->initializeBackendUser() diff --git a/typo3/sysext/core/Classes/Authentication/AbstractUserAuthentication.php b/typo3/sysext/core/Classes/Authentication/AbstractUserAuthentication.php index 874d03e778ba..1063406e6236 100644 --- a/typo3/sysext/core/Classes/Authentication/AbstractUserAuthentication.php +++ b/typo3/sysext/core/Classes/Authentication/AbstractUserAuthentication.php @@ -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; } diff --git a/typo3/sysext/core/Classes/Core/Bootstrap.php b/typo3/sysext/core/Classes/Core/Bootstrap.php index ced255033865..b92e9f9bd8ff 100644 --- a/typo3/sysext/core/Classes/Core/Bootstrap.php +++ b/typo3/sysext/core/Classes/Core/Bootstrap.php @@ -445,21 +445,6 @@ class Bootstrap { return $this; } - /** - * 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. diff --git a/typo3/sysext/core/Classes/Core/SystemEnvironmentBuilder.php b/typo3/sysext/core/Classes/Core/SystemEnvironmentBuilder.php index dc686c3e1670..d08ccc687fd6 100644 --- a/typo3/sysext/core/Classes/Core/SystemEnvironmentBuilder.php +++ b/typo3/sysext/core/Classes/Core/SystemEnvironmentBuilder.php @@ -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 index 000000000000..c80504e071fc --- /dev/null +++ b/typo3/sysext/core/Documentation/Changelog/master/Breaking-68150-GLOBALSCLIENT.rst @@ -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 diff --git a/typo3/sysext/core/Tests/Unit/Core/SystemEnvironmentBuilderTest.php b/typo3/sysext/core/Tests/Unit/Core/SystemEnvironmentBuilderTest.php index 7067f1fa6fd9..e73cdccc6dc3 100644 --- a/typo3/sysext/core/Tests/Unit/Core/SystemEnvironmentBuilderTest.php +++ b/typo3/sysext/core/Tests/Unit/Core/SystemEnvironmentBuilderTest.php @@ -127,15 +127,6 @@ class SystemEnvironmentBuilderTest extends \TYPO3\CMS\Core\Tests\UnitTestCase { $this->assertFalse(isset($GLOBALS['error'])); } - /** - * @test - */ - public function initializeGlobalVariablesSetsGlobalClientArray() { - unset($GLOBALS['CLIENT']); - $this->subject->_call('initializeGlobalVariables'); - $this->assertArrayHasKey('CLIENT', $GLOBALS); - } - /** * @test */ -- GitLab