[TASK] Consistently retrieve ApplicationContext from GeneralUtility 40/55940/4
authorBenjamin Franzke <bfr@qbus.de>
Sun, 25 Feb 2018 12:34:58 +0000 (13:34 +0100)
committerChristian Kuhn <lolli@schwarzbu.ch>
Wed, 28 Feb 2018 16:40:09 +0000 (17:40 +0100)
As documented in Bootstrap code, GeneralUtility should be
used instead of Bootstrap to retrieve the ApplicationContext.

Therefore ClassLoadingInformation is adapted to read the
ApplicationContext from GeneralUtility. Bootstrap now pushes the
ApplicationContext early to GeneralUtility to be available for
ClassLoadingInformation during bootstrap.

Change-Id: I119ac944dd49c7d063b0f1e05f23e48f664ce2bc
Releases: master
Resolves: #84083
Reviewed-on: https://review.typo3.org/55940
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Frank Naegler <frank.naegler@typo3.org>
Tested-by: Frank Naegler <frank.naegler@typo3.org>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
typo3/sysext/core/Classes/Core/Bootstrap.php
typo3/sysext/core/Classes/Core/ClassLoadingInformation.php
typo3/sysext/core/Documentation/Changelog/master/Important-83869-RemoveRequestTypeSpecificCodeInBootstrap.rst [deleted file]
typo3/sysext/core/Documentation/Changelog/master/Important-83869-RemovedRequestTypeSpecificCodeInBootstrap.rst [new file with mode: 0644]
typo3/sysext/install/Configuration/ExtensionScanner/Php/MethodCallMatcher.php
typo3/sysext/install/Configuration/ExtensionScanner/Php/PropertyProtectedMatcher.php

index 717574b..30ccd80 100644 (file)
@@ -107,18 +107,6 @@ class Bootstrap
     }
 
     /**
-     * Returns the application context this bootstrap was started in.
-     *
-     * @return \TYPO3\CMS\Core\Core\ApplicationContext The application context encapsulated in an object
-     * @internal This is not a public API method, do not use in own extensions.
-     * Use \TYPO3\CMS\Core\Utility\GeneralUtility::getApplicationContext() instead
-     */
-    public function getApplicationContext()
-    {
-        return $this->applicationContext;
-    }
-
-    /**
      * Prevent any unwanted output that may corrupt AJAX/compression.
      * This does not interfere with "die()" or "echo"+"exit()" messages!
      *
@@ -172,11 +160,11 @@ class Bootstrap
         if (!defined('TYPO3_REQUESTTYPE')) {
             throw new \RuntimeException('No Request Type was set, TYPO3 does not know in which context it is run.', 1450561838);
         }
+        GeneralUtility::presetApplicationContext($this->applicationContext);
         SystemEnvironmentBuilder::run($entryPointLevel);
         if (!self::$usesComposerClassLoading && ClassLoadingInformation::isClassLoadingInformationAvailable()) {
             ClassLoadingInformation::registerClassLoadingInformation();
         }
-        GeneralUtility::presetApplicationContext($this->applicationContext);
         return $this;
     }
 
index 8eaf7a4..2c9ef4a 100644 (file)
@@ -214,7 +214,7 @@ class ClassLoadingInformation
      */
     protected static function isTestingContext()
     {
-        return Bootstrap::getInstance()->getApplicationContext()->isTesting();
+        return GeneralUtility::getApplicationContext()->isTesting();
     }
 
     /**
diff --git a/typo3/sysext/core/Documentation/Changelog/master/Important-83869-RemoveRequestTypeSpecificCodeInBootstrap.rst b/typo3/sysext/core/Documentation/Changelog/master/Important-83869-RemoveRequestTypeSpecificCodeInBootstrap.rst
deleted file mode 100644 (file)
index 14508c6..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
-.. include:: ../../Includes.txt
-
-==================================================================
-Important: #83869 - Remove request type specific code in Bootstrap
-==================================================================
-
-See :issue:`83869`
-
-Description
-===========
-
-All methods and properties related to specific HTTP or CLI handling in
-:php:`\TYPO3\CMS\Core\Core\Bootstrap` have been removed.
-These methods and properties were either protected or marked ``@internal``.
-
-Methods:
-
-* :php:`redirectToInstallTool()`
-* :php:`registerRequestHandlerImplementation()`
-* :php:`resolveRequestHandler()`
-* :php:`handleRequest()`
-* :php:`sendResponse()`
-* :php:`checkLockedBackendAndRedirectOrDie()`
-* :php:`checkBackendIpOrDie()`
-* :php:`checkSslBackendAndRedirectIfNeeded()`
-* :php:`initializeOutputCompression()`
-* :php:`sendHttpHeaders()`
-* :php:`shutdown()`
-* :php:`initializeBackendTemplate()`
-* :php:`endOutputBufferingAndCleanPreviousOutput()`
-
-Properties:
-
-* :php:`protected $installToolPath;`
-* :php:`protected $availableRequestHandlers`
-* :php:`protected $response;`
-
-
-Affected Installations
-======================
-
-All installations that use custom extensions that use request method specific methods of
-:php:`\TYPO3\CMS\Core\Core\Bootstrap`.
-
-
-Migration
-=========
-
-Custom request handlers that are registered using the internal method
-:php:`registerRequestHandlerImplementation()` should
-be converted to PSR-15 middlewares. TYPO3 9.2 gained an API
-:file:`Configuration/Configuration/RequestMiddlewares.php` for registering
-PSR-15 middleware HTTP handlers. See :php:`\TYPO3\CMS\Frontend\Middleware\EidHandler`
-for an example.
-
-.. index:: Backend, CLI, Frontend, PHP-API, FullyScanned
diff --git a/typo3/sysext/core/Documentation/Changelog/master/Important-83869-RemovedRequestTypeSpecificCodeInBootstrap.rst b/typo3/sysext/core/Documentation/Changelog/master/Important-83869-RemovedRequestTypeSpecificCodeInBootstrap.rst
new file mode 100644 (file)
index 0000000..8b1fc89
--- /dev/null
@@ -0,0 +1,58 @@
+.. include:: ../../Includes.txt
+
+===================================================================
+Important: #83869 - Removed request type specific code in Bootstrap
+===================================================================
+
+See :issue:`83869`
+
+Description
+===========
+
+All methods and properties related to specific HTTP or CLI handling in
+:php:`\TYPO3\CMS\Core\Core\Bootstrap` have been removed.
+These methods and properties were either protected or marked ``@internal``.
+
+Methods:
+
+* :php:`redirectToInstallTool()`
+* :php:`registerRequestHandlerImplementation()`
+* :php:`resolveRequestHandler()`
+* :php:`handleRequest()`
+* :php:`sendResponse()`
+* :php:`checkLockedBackendAndRedirectOrDie()`
+* :php:`checkBackendIpOrDie()`
+* :php:`checkSslBackendAndRedirectIfNeeded()`
+* :php:`initializeOutputCompression()`
+* :php:`sendHttpHeaders()`
+* :php:`shutdown()`
+* :php:`initializeBackendTemplate()`
+* :php:`endOutputBufferingAndCleanPreviousOutput()`
+* :php:`getApplicationContext()`
+* :php:`getRequestId()`
+
+Properties:
+
+* :php:`protected $installToolPath;`
+* :php:`protected $availableRequestHandlers`
+* :php:`protected $response;`
+
+
+Affected Installations
+======================
+
+All installations that use custom extensions that use request method specific methods of
+:php:`\TYPO3\CMS\Core\Core\Bootstrap`.
+
+
+Migration
+=========
+
+Custom request handlers that are registered using the internal method
+:php:`registerRequestHandlerImplementation()` should
+be converted to PSR-15 middlewares. TYPO3 9.2 gained an API
+:file:`Configuration/Configuration/RequestMiddlewares.php` for registering
+PSR-15 middleware HTTP handlers. See :php:`\TYPO3\CMS\Frontend\Middleware\EidHandler`
+for an example.
+
+.. index:: Backend, CLI, Frontend, PHP-API, FullyScanned
index a6d541f..08427a5 100644 (file)
@@ -1616,91 +1616,105 @@ return [
         'numberOfMandatoryArguments' => 0,
         'maximumNumberOfArguments' => 1,
         'restFiles' => [
-            'Important-83869-RemoveRequestTypeSpecificCodeInBootstrap.rst',
+            'Important-83869-RemovedRequestTypeSpecificCodeInBootstrap.rst',
         ],
     ],
     'TYPO3\CMS\Core\Core\Bootstrap->registerRequestHandlerImplementation' => [
         'numberOfMandatoryArguments' => 1,
         'maximumNumberOfArguments' => 1,
         'restFiles' => [
-            'Important-83869-RemoveRequestTypeSpecificCodeInBootstrap.rst',
+            'Important-83869-RemovedRequestTypeSpecificCodeInBootstrap.rst',
         ],
     ],
     'TYPO3\CMS\Core\Core\Bootstrap->resolveRequestHandler' => [
         'numberOfMandatoryArguments' => 1,
         'maximumNumberOfArguments' => 1,
         'restFiles' => [
-            'Important-83869-RemoveRequestTypeSpecificCodeInBootstrap.rst',
+            'Important-83869-RemovedRequestTypeSpecificCodeInBootstrap.rst',
         ],
     ],
     'TYPO3\CMS\Core\Core\Bootstrap->handleRequest' => [
         'numberOfMandatoryArguments' => 1,
         'maximumNumberOfArguments' => 1,
         'restFiles' => [
-            'Important-83869-RemoveRequestTypeSpecificCodeInBootstrap.rst',
+            'Important-83869-RemovedRequestTypeSpecificCodeInBootstrap.rst',
         ],
     ],
     'TYPO3\CMS\Core\Core\Bootstrap->sendResponse' => [
         'numberOfMandatoryArguments' => 0,
         'maximumNumberOfArguments' => 0,
         'restFiles' => [
-            'Important-83869-RemoveRequestTypeSpecificCodeInBootstrap.rst',
+            'Important-83869-RemovedRequestTypeSpecificCodeInBootstrap.rst',
         ],
     ],
     'TYPO3\CMS\Core\Core\Bootstrap->checkLockedBackendAndRedirectOrDie' => [
         'numberOfMandatoryArguments' => 0,
         'maximumNumberOfArguments' => 1,
         'restFiles' => [
-            'Important-83869-RemoveRequestTypeSpecificCodeInBootstrap.rst',
+            'Important-83869-RemovedRequestTypeSpecificCodeInBootstrap.rst',
         ],
     ],
     'TYPO3\CMS\Core\Core\Bootstrap->checkBackendIpOrDie' => [
         'numberOfMandatoryArguments' => 0,
         'maximumNumberOfArguments' => 0,
         'restFiles' => [
-            'Important-83869-RemoveRequestTypeSpecificCodeInBootstrap.rst',
+            'Important-83869-RemovedRequestTypeSpecificCodeInBootstrap.rst',
         ],
     ],
     'TYPO3\CMS\Core\Core\Bootstrap->checkSslBackendAndRedirectIfNeeded' => [
         'numberOfMandatoryArguments' => 0,
         'maximumNumberOfArguments' => 0,
         'restFiles' => [
-            'Important-83869-RemoveRequestTypeSpecificCodeInBootstrap.rst',
+            'Important-83869-RemovedRequestTypeSpecificCodeInBootstrap.rst',
         ],
     ],
     'TYPO3\CMS\Core\Core\Bootstrap->initializeOutputCompression' => [
         'numberOfMandatoryArguments' => 0,
         'maximumNumberOfArguments' => 0,
         'restFiles' => [
-            'Important-83869-RemoveRequestTypeSpecificCodeInBootstrap.rst',
+            'Important-83869-RemovedRequestTypeSpecificCodeInBootstrap.rst',
         ],
     ],
     'TYPO3\CMS\Core\Core\Bootstrap->sendHttpHeaders' => [
         'numberOfMandatoryArguments' => 0,
         'maximumNumberOfArguments' => 0,
         'restFiles' => [
-            'Important-83869-RemoveRequestTypeSpecificCodeInBootstrap.rst',
+            'Important-83869-RemovedRequestTypeSpecificCodeInBootstrap.rst',
         ],
     ],
     'TYPO3\CMS\Core\Core\Bootstrap->shutdown' => [
         'numberOfMandatoryArguments' => 0,
         'maximumNumberOfArguments' => 0,
         'restFiles' => [
-            'Important-83869-RemoveRequestTypeSpecificCodeInBootstrap.rst',
+            'Important-83869-RemovedRequestTypeSpecificCodeInBootstrap.rst',
         ],
     ],
     'TYPO3\CMS\Core\Core\Bootstrap->initializeBackendTemplate' => [
         'numberOfMandatoryArguments' => 0,
         'maximumNumberOfArguments' => 0,
         'restFiles' => [
-            'Important-83869-RemoveRequestTypeSpecificCodeInBootstrap.rst',
+            'Important-83869-RemovedRequestTypeSpecificCodeInBootstrap.rst',
         ],
     ],
     'TYPO3\CMS\Core\Core\Bootstrap->endOutputBufferingAndCleanPreviousOutput' => [
         'numberOfMandatoryArguments' => 0,
         'maximumNumberOfArguments' => 0,
         'restFiles' => [
-            'Important-83869-RemoveRequestTypeSpecificCodeInBootstrap.rst',
+            'Important-83869-RemovedRequestTypeSpecificCodeInBootstrap.rst',
+        ],
+    ],
+    'TYPO3\CMS\Core\Core\Bootstrap->getApplicationContext' => [
+        'numberOfMandatoryArguments' => 0,
+        'maximumNumberOfArguments' => 0,
+        'restFiles' => [
+            'Important-83869-RemovedRequestTypeSpecificCodeInBootstrap.rst',
+        ],
+    ],
+    'TYPO3\CMS\Core\Core\Bootstrap->getRequestId' => [
+        'numberOfMandatoryArguments' => 0,
+        'maximumNumberOfArguments' => 0,
+        'restFiles' => [
+            'Important-83869-RemovedRequestTypeSpecificCodeInBootstrap.rst',
         ],
     ],
 ];
index 7ca5b39..2eadab2 100644 (file)
@@ -54,17 +54,17 @@ return [
     ],
     'TYPO3\CMS\Core\Core\Bootstrap->installToolPath' => [
         'restFiles' => [
-            'Important-83869-RemoveRequestTypeSpecificCodeInBootstrap.rst',
+            'Important-83869-RemovedRequestTypeSpecificCodeInBootstrap.rst',
         ],
     ],
     'TYPO3\CMS\Core\Core\Bootstrap->availableRequestHandlers' => [
         'restFiles' => [
-            'Important-83869-RemoveRequestTypeSpecificCodeInBootstrap.rst',
+            'Important-83869-RemovedRequestTypeSpecificCodeInBootstrap.rst',
         ],
     ],
     'TYPO3\CMS\Core\Core\Bootstrap->response' => [
         'restFiles' => [
-            'Important-83869-RemoveRequestTypeSpecificCodeInBootstrap.rst',
+            'Important-83869-RemovedRequestTypeSpecificCodeInBootstrap.rst',
         ],
     ],
 ];