[!!!][TASK] Remove deprecated frontend-related hooks and include scripts
[Packages/TYPO3.CMS.git] / typo3 / sysext / frontend / Classes / Middleware / PreprocessRequestHook.php
index f84cc4d..9f22478 100644 (file)
@@ -19,7 +19,6 @@ 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.
@@ -39,12 +38,12 @@ class PreprocessRequestHook implements MiddlewareInterface
      */
     public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
     {
-        if (!empty($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/index_ts.php']['preprocessRequest'])) {
-            trigger_error('The "preprocessRequest" hook will be removed in TYPO3 v10.0 in favor of PSR-15. Use a middleware instead.', E_USER_DEPRECATED);
-            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);
     }