X-Git-Url: http://git.typo3.org/Packages/TYPO3.CMS.git/blobdiff_plain/0235c1360569feb036358978662951b979b890cc..4ea922d09a270cf0e0e17d66d5a3ebbab8f38c74:/typo3/sysext/frontend/Classes/Middleware/PrepareTypoScriptFrontendRendering.php diff --git a/typo3/sysext/frontend/Classes/Middleware/PrepareTypoScriptFrontendRendering.php b/typo3/sysext/frontend/Classes/Middleware/PrepareTypoScriptFrontendRendering.php index d0e0ded10df..eab6c9e7f53 100644 --- a/typo3/sysext/frontend/Classes/Middleware/PrepareTypoScriptFrontendRendering.php +++ b/typo3/sysext/frontend/Classes/Middleware/PrepareTypoScriptFrontendRendering.php @@ -20,7 +20,9 @@ use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\ServerRequestInterface; use Psr\Http\Server\MiddlewareInterface; use Psr\Http\Server\RequestHandlerInterface as PsrRequestHandlerInterface; +use TYPO3\CMS\Core\Routing\PageArguments; use TYPO3\CMS\Core\TimeTracker\TimeTracker; +use TYPO3\CMS\Core\Utility\ArrayUtility; use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController; @@ -28,6 +30,8 @@ use TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController; * Initialization of TypoScriptFrontendController * * Do all necessary preparation steps for rendering + * + * @internal this middleware might get removed in TYPO3 v10.0. */ class PrepareTypoScriptFrontendRendering implements MiddlewareInterface { @@ -56,10 +60,6 @@ class PrepareTypoScriptFrontendRendering implements MiddlewareInterface */ public function process(ServerRequestInterface $request, PsrRequestHandlerInterface $handler): ResponseInterface { - // Starts the template - $this->timeTracker->push('Start Template'); - $this->controller->initTemplate(); - $this->timeTracker->pull(); // Get from cache $this->timeTracker->push('Get Page from cache'); // Locks may be acquired here @@ -68,6 +68,25 @@ class PrepareTypoScriptFrontendRendering implements MiddlewareInterface // Get config if not already gotten // After this, we should have a valid config-array ready $this->controller->getConfigArray(); + + // Merge Query Parameters with config.defaultGetVars + // This is done in getConfigArray as well, but does not override the current middleware request object + // Since we want to stay in sync with this, the option needs to be set as well. + $pageArguments = $request->getAttribute('routing'); + if (!empty($this->controller->config['config']['defaultGetVars.'] ?? null)) { + $modifiedGetVars = GeneralUtility::removeDotsFromTS($this->controller->config['config']['defaultGetVars.']); + if ($pageArguments instanceof PageArguments) { + $pageArguments = $pageArguments->withQueryArguments($modifiedGetVars); + $this->controller->setPageArguments($pageArguments); + $request = $request->withAttribute('routing', $pageArguments); + } + if (!empty($request->getQueryParams())) { + ArrayUtility::mergeRecursiveWithOverrule($modifiedGetVars, $request->getQueryParams()); + } + $request = $request->withQueryParams($modifiedGetVars); + $GLOBALS['TYPO3_REQUEST'] = $request; + } + // Setting language and locale $this->timeTracker->push('Setting language and locale'); $this->controller->settingLanguage(); @@ -84,14 +103,8 @@ class PrepareTypoScriptFrontendRendering implements MiddlewareInterface $GLOBALS['TYPO3_REQUEST'] = $request; } - $this->controller->initializeRedirectUrlHandlers(); - - // Hook for processing data submission to extensions - // This is done at this point, because we need the config values - foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/class.tslib_fe.php']['checkDataSubmission'] ?? [] as $className) { - GeneralUtility::makeInstance($className)->checkDataSubmission($this->controller); - } - + // @deprecated since TYPO3 v9.3, will be removed in TYPO3 v10.0 + $this->controller->initializeRedirectUrlHandlers(true); return $handler->handle($request); }