From 56f5174cfa8a4221c6a90948e539213e23e90ffc Mon Sep 17 00:00:00 2001 From: mhsdesign <85400359+mhsdesign@users.noreply.github.com> Date: Fri, 29 Sep 2023 10:14:54 +0200 Subject: [PATCH 1/2] BUGFIX: FusionExceptionView must use mocked controller context 0f24c721c8a303e39542c69b1eae0056acd16998 (#4425) introduced a regression where we accidentally used `$this->controllerContext` instead of `$controllerContext`. For $some reason we have to use the mocked controller context, as otherwise the `${request.format}` will be empty "" in fusion. And this causes trouble in the `/root` matcher. This fix uses the mocked controller context again. --- Neos.Neos/Classes/View/FusionExceptionView.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Neos.Neos/Classes/View/FusionExceptionView.php b/Neos.Neos/Classes/View/FusionExceptionView.php index 5176990ff4b..41a65df05a7 100644 --- a/Neos.Neos/Classes/View/FusionExceptionView.php +++ b/Neos.Neos/Classes/View/FusionExceptionView.php @@ -204,14 +204,14 @@ protected function getFusionRuntime( $fusionConfiguration = $this->fusionService->createFusionConfigurationFromSite($site); $fusionGlobals = FusionGlobals::fromArray([ - 'request' => $this->controllerContext->getRequest(), + 'request' => $controllerContext->getRequest(), 'renderingModeName' => RenderingMode::FRONTEND ]); $this->fusionRuntime = $this->runtimeFactory->createFromConfiguration( $fusionConfiguration, $fusionGlobals ); - $this->fusionRuntime->setControllerContext($this->controllerContext); + $this->fusionRuntime->setControllerContext($controllerContext); if (isset($this->options['enableContentCache']) && $this->options['enableContentCache'] !== null) { $this->fusionRuntime->setEnableContentCache($this->options['enableContentCache']); From a50a6721fca5b58288412f97cf7a5eb231186c85 Mon Sep 17 00:00:00 2001 From: mhsdesign <85400359+mhsdesign@users.noreply.github.com> Date: Fri, 29 Sep 2023 10:16:46 +0200 Subject: [PATCH 2/2] TASK: `FusionExceptionView` fail fast on cli --- Neos.Neos/Classes/View/FusionExceptionView.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Neos.Neos/Classes/View/FusionExceptionView.php b/Neos.Neos/Classes/View/FusionExceptionView.php index 41a65df05a7..6910e8ffe6b 100644 --- a/Neos.Neos/Classes/View/FusionExceptionView.php +++ b/Neos.Neos/Classes/View/FusionExceptionView.php @@ -102,9 +102,12 @@ class FusionExceptionView extends AbstractView public function render() { $requestHandler = $this->bootstrap->getActiveRequestHandler(); - $httpRequest = $requestHandler instanceof HttpRequestHandler - ? $requestHandler->getHttpRequest() - : ServerRequest::fromGlobals(); + + if (!$requestHandler instanceof HttpRequestHandler) { + throw new \RuntimeException('The FusionExceptionView only works in web requests.', 1695975353); + } + + $httpRequest = $requestHandler->getHttpRequest(); $siteDetectionResult = SiteDetectionResult::fromRequest($httpRequest); $contentRepository = $this->contentRepositoryRegistry->get($siteDetectionResult->contentRepositoryId);