From 0fb9702c73cb6a84504658ab0bd20a47a86797fc Mon Sep 17 00:00:00 2001 From: Benni Mack <benni@typo3.org> Date: Fri, 8 May 2020 19:00:31 +0200 Subject: [PATCH] [BUGFIX] Do not deprecate $GLOBALS[TYPO3_REQUEST] The global object $GLOBALS[TYPO3_REQUEST] holding the current PSR-7 request object was introduced in TYPO3 v9.2. However, it was also marked as deprecated as we thought we were able to remove all usages again by the end of TYPO3 v9.5 development, which shows that we have more problems in various areas like hooks and Extbase where we heavily rely on this object. For this reason, it is kept but the original Feature RST still contains the information that it is considered bad practice. Removing the deprecation will result in better result for the ExtensionScanner. Resolves: #91347 Releases: master, 9.5 Change-Id: I97bb16cf7f4e7149c5c3a3528a015701f60c2628 Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/64439 Tested-by: TYPO3com <noreply@typo3.com> Tested-by: Benni Mack <benni@typo3.org> Reviewed-by: Benni Mack <benni@typo3.org> --- ...n-83736-DeprecatedGlobalsTYPO3_REQUEST.rst | 36 ------------------- ...PSR-7RequestsWithTYPO3ServerParameters.rst | 5 ++- .../Php/ArrayGlobalMatcher.php | 5 --- 3 files changed, 2 insertions(+), 44 deletions(-) delete mode 100644 typo3/sysext/core/Documentation/Changelog/9.2/Deprecation-83736-DeprecatedGlobalsTYPO3_REQUEST.rst diff --git a/typo3/sysext/core/Documentation/Changelog/9.2/Deprecation-83736-DeprecatedGlobalsTYPO3_REQUEST.rst b/typo3/sysext/core/Documentation/Changelog/9.2/Deprecation-83736-DeprecatedGlobalsTYPO3_REQUEST.rst deleted file mode 100644 index 41167dfe62a8..000000000000 --- a/typo3/sysext/core/Documentation/Changelog/9.2/Deprecation-83736-DeprecatedGlobalsTYPO3_REQUEST.rst +++ /dev/null @@ -1,36 +0,0 @@ -.. include:: ../../Includes.txt - -====================================================== -Deprecation: #83736 - Deprecated globals TYPO3_REQUEST -====================================================== - -See :issue:`83736` - -Description -=========== - -The :php:`ServerRequestInterface $request` is available as :php:`$GLOBALS['TYPO3_REQUEST']` -in HTTP requests. This global is available in a transition phase only and will be removed later. - -Extension authors are discouraged to use that global and the extension scanner marks any usage as deprecated. - - -Impact -====== - -Accessing :php:`$GLOBALS['TYPO3_REQUEST']` is discouraged. - - -Affected Installations -====================== - -Instances with extensions using :php:`$GLOBALS['TYPO3_REQUEST']`. - - -Migration -========= - -Controller classes for HTTP requests retrieve the request object. Access should either be done from within controllers -or by passing :php:`$request` to service classes that need to access values from :php:`$request`. - -.. index:: PHP-API, FullyScanned diff --git a/typo3/sysext/core/Documentation/Changelog/9.2/Feature-83736-ExtendedPSR-7RequestsWithTYPO3ServerParameters.rst b/typo3/sysext/core/Documentation/Changelog/9.2/Feature-83736-ExtendedPSR-7RequestsWithTYPO3ServerParameters.rst index b7f0ab38e3bb..ddec2508a6e3 100644 --- a/typo3/sysext/core/Documentation/Changelog/9.2/Feature-83736-ExtendedPSR-7RequestsWithTYPO3ServerParameters.rst +++ b/typo3/sysext/core/Documentation/Changelog/9.2/Feature-83736-ExtendedPSR-7RequestsWithTYPO3ServerParameters.rst @@ -25,9 +25,8 @@ is given to controllers, example: The request object is also available as a global variable in :php:`$GLOBALS['TYPO3_REQUEST']`. This is a workaround for the core which has to access the server parameters at places where $request is not available. So, while this object is -globally available during any HTTP request, it is considered bad practice to use it, and the extension scanner will mark -an access to this global variable as deprecated. The global object will vanish later if the core code has been -refactored enough to not rely on it anymore. +globally available during any HTTP request, it is considered bad practice to use it. The global object will vanish +later if the core code has been refactored enough to not rely on it anymore. For now, class :php:`NormalizedParams` is a one-to-one transition of :php:`GeneralUtility::getIndpEnv()`, the old arguments can be substituted with these calls: diff --git a/typo3/sysext/install/Configuration/ExtensionScanner/Php/ArrayGlobalMatcher.php b/typo3/sysext/install/Configuration/ExtensionScanner/Php/ArrayGlobalMatcher.php index 8fd703a8b531..8cac9884471a 100644 --- a/typo3/sysext/install/Configuration/ExtensionScanner/Php/ArrayGlobalMatcher.php +++ b/typo3/sysext/install/Configuration/ExtensionScanner/Php/ArrayGlobalMatcher.php @@ -16,11 +16,6 @@ return [ 'Breaking-82893-RemoveGlobalVariablePARSETIME_START.rst' ], ], - '$GLOBALS[\'TYPO3_REQUEST\']' => [ - 'restFiles' => [ - 'Deprecation-83736-DeprecatedGlobalsTYPO3_REQUEST.rst', - ], - ], '$GLOBALS[\'TYPO3_LOADED_EXT\']' => [ 'restFiles' => [ 'Deprecation-86404-GLOBALSTYPO3_LOADED_EXT.rst', -- GitLab