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
{
*/
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);
}