[BUGFIX] Detect recursions in PageContentErrorHandler
[Packages/TYPO3.CMS.git] / typo3 / sysext / core / Classes / Error / PageErrorHandler / PageContentErrorHandler.php
index 6d2b275..ce44db5 100644 (file)
@@ -68,7 +68,13 @@ class PageContentErrorHandler implements PageErrorHandlerInterface
     {
         try {
             $resolvedUrl = $this->resolveUrl($request, $this->errorHandlerConfiguration['errorContentSource']);
-            $content = GeneralUtility::getUrl($resolvedUrl);
+            $content = null;
+            if ($resolvedUrl !== (string)$request->getUri()) {
+                $content = GeneralUtility::getUrl($resolvedUrl);
+            }
+            if (!$content) {
+                $content = 'Error handler could not fetch error page: Possible recursion detected.';
+            }
         } catch (InvalidRouteArgumentsException | SiteNotFoundException $e) {
             $content = 'Invalid error handler configuration: ' . $this->errorHandlerConfiguration['errorContentSource'];
         }