2 declare(strict_types = 1);
19 use Psr\Http\Message\ResponseInterface;
20 use Psr\Http\Message\ServerRequestInterface;
21 use Psr\Http\Server\MiddlewareInterface;
22 use Psr\Http\Server\RequestHandlerInterface as PsrRequestHandlerInterface;
51 $this->timeTracker =
$timeTracker ?: GeneralUtility::makeInstance(TimeTracker::class);
61 public function process(ServerRequestInterface $request, PsrRequestHandlerInterface $handler): ResponseInterface
64 $this->timeTracker->push(
'Get Page from cache');
66 $this->controller->getFromCache();
67 $this->timeTracker->pull();
70 $this->controller->getConfigArray();
75 $pageArguments = $request->getAttribute(
'routing');
76 if (!empty($this->controller->config[
'config'][
'defaultGetVars.'] ??
null)) {
77 $modifiedGetVars = GeneralUtility::removeDotsFromTS($this->controller->config[
'config'][
'defaultGetVars.']);
79 $pageArguments = $pageArguments->withQueryArguments($modifiedGetVars);
80 $this->controller->setPageArguments($pageArguments);
81 $request = $request->withAttribute(
'routing', $pageArguments);
83 if (!empty($request->getQueryParams())) {
86 $request = $request->withQueryParams($modifiedGetVars);
91 $this->timeTracker->push(
'Setting language and locale');
92 $this->controller->settingLanguage();
93 $this->controller->settingLocale();
94 $this->timeTracker->pull();
97 if ($this->controller->metaCharset !==
'utf-8' && is_array($_POST) && !empty($_POST)) {
100 $parsedBody = $request->getParsedBody();
102 $request = $request->withParsedBody($parsedBody);
107 $this->controller->initializeRedirectUrlHandlers(
true);
111 if (!empty(
$GLOBALS[
'TYPO3_CONF_VARS'][
'SC_OPTIONS'][
'tslib/class.tslib_fe.php'][
'checkDataSubmission'])) {
112 trigger_error(
'The "checkDataSubmission" hook will be removed in TYPO3 v10.0 in favor of PSR-15. Use a middleware instead.', E_USER_DEPRECATED);
113 foreach (
$GLOBALS[
'TYPO3_CONF_VARS'][
'SC_OPTIONS'][
'tslib/class.tslib_fe.php'][
'checkDataSubmission'] as $className) {
114 GeneralUtility::makeInstance($className)->checkDataSubmission($this->controller);
118 return $handler->handle($request);
129 foreach ($data as $key => $value) {
130 if (is_array($data[$key])) {
132 } elseif (is_string($data[$key])) {
133 $data[$key] = mb_convert_encoding($data[$key],
'utf-8', $fromCharset);