[!!!][TASK] Remove deprecated frontend-related hooks and include scripts
[Packages/TYPO3.CMS.git] / typo3 / sysext / frontend / Classes / Middleware / PreprocessRequestHook.php
index 0fafd19..9f22478 100644 (file)
@@ -19,12 +19,12 @@ use Psr\Http\Message\ResponseInterface;
 use Psr\Http\Message\ServerRequestInterface;
 use Psr\Http\Server\MiddlewareInterface;
 use Psr\Http\Server\RequestHandlerInterface;
-use TYPO3\CMS\Core\Utility\GeneralUtility;
 
 /**
  * Calls a hook before processing a request for the TYPO3 Frontend.
  *
  * @internal
+ * @deprecated since TYPO3 v9, will be removed in TYPO3 v10.0.
  */
 class PreprocessRequestHook implements MiddlewareInterface
 {
@@ -38,9 +38,12 @@ class PreprocessRequestHook implements MiddlewareInterface
      */
     public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
     {
-        foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/index_ts.php']['preprocessRequest'] ?? [] as $hookFunction) {
-            $hookParameters = [];
-            GeneralUtility::callUserFunction($hookFunction, $hookParameters, $hookParameters);
+        // Legacy functionality to check if any hook modified global GET/POST
+        // This is a safety net, see RequestHandler for how this is validated.
+        // This information is just a compat layer which will be removed in TYPO3 v10.0.
+        $request = $request->withAttribute('_originalGetParameters', $_GET);
+        if ($request->getMethod() === 'POST') {
+            $request = $request->withAttribute('_originalPostParameters', $_POST);
         }
         return $handler->handle($request);
     }