2 declare(strict_types = 1);
18 use Psr\Http\Message\ResponseInterface;
19 use Psr\Http\Message\ServerRequestInterface;
20 use Psr\Http\Server\MiddlewareInterface;
21 use Psr\Http\Server\RequestHandlerInterface;
45 public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
47 $eID = $request->getParsedBody()[
'eID'] ?? $request->getQueryParams()[
'eID'] ??
null;
50 return $handler->handle($request);
57 $response = GeneralUtility::makeInstance(Response::class);
59 if (empty($eID) || !isset(
$GLOBALS[
'TYPO3_CONF_VARS'][
'FE'][
'eID_include'][$eID])) {
60 return $response->withStatus(404,
'eID not registered');
63 $configuration =
$GLOBALS[
'TYPO3_CONF_VARS'][
'FE'][
'eID_include'][$eID];
66 if (strpos($configuration,
'::') !==
false || is_callable($configuration)) {
68 $dispatcher = GeneralUtility::makeInstance(Dispatcher::class);
69 $request = $request->withAttribute(
'target', $configuration);
70 return $dispatcher->dispatch($request, $response) ??
new NullResponse();
73 'eID "' . $eID .
'" is registered with a script to a file. This behaviour will be removed in TYPO3 v10.0.'
74 .
' Register eID with a class::method syntax like "\MyVendor\MyExtension\Controller\MyEidController::myMethod" instead.',
77 $scriptPath = GeneralUtility::getFileAbsFileName($configuration);
78 if ($scriptPath ===
'') {
79 throw new Exception(
'Registered eID has invalid script path.', 1518042216);