[BUGFIX] Catch exception in getData with invalid key for site configuration 47/58947/3
authorGeorg Ringer <georg.ringer@gmail.com>
Sun, 25 Nov 2018 18:47:20 +0000 (19:47 +0100)
committerBenni Mack <benni@typo3.org>
Thu, 29 Nov 2018 07:46:59 +0000 (08:46 +0100)
Catch the exception which is thrown if provided path does not exist in
site configuration. Especially if the site configuration is extended
and the desired configuration is not yet persisted the frontend must
be still available.

The exception is logged to be able to find the error.

Resolves: #86978
Releases: master
Change-Id: Iad70acc8a76e0f77875c2cfb6deb67e3afea584a
Reviewed-on: https://review.typo3.org/58947
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Josef Glatz <josef.glatz@typo3.org>
Tested-by: Josef Glatz <josef.glatz@typo3.org>
Reviewed-by: Benni Mack <benni@typo3.org>
Tested-by: Benni Mack <benni@typo3.org>
typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php

index 3b1342e..a863ad6 100644 (file)
@@ -53,6 +53,7 @@ use TYPO3\CMS\Core\TypoScript\Parser\TypoScriptParser;
 use TYPO3\CMS\Core\TypoScript\TypoScriptService;
 use TYPO3\CMS\Core\Utility\ArrayUtility;
 use TYPO3\CMS\Core\Utility\DebugUtility;
+use TYPO3\CMS\Core\Utility\Exception\MissingArrayPathException;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
 use TYPO3\CMS\Core\Utility\HttpUtility;
 use TYPO3\CMS\Core\Utility\MailUtility;
@@ -5097,7 +5098,11 @@ class ContentObjectRenderer implements LoggerAwareInterface
                         $request = $GLOBALS['TYPO3_REQUEST'] ?? null;
                         $site = $request ? $request->getAttribute('site') : null;
                         if ($site instanceof Site) {
-                            $retVal = ArrayUtility::getValueByPath($site->getConfiguration(), $key, '.');
+                            try {
+                                $retVal = ArrayUtility::getValueByPath($site->getConfiguration(), $key, '.');
+                            } catch (MissingArrayPathException $exception) {
+                                $this->logger->warning(sprintf('getData() with "%s" failed', $key), ['exception' => $exception]);
+                            }
                         }
                         break;
                 }