From 65cfbc4c7764140c5cc7db3f2b43fa40be53cfc6 Mon Sep 17 00:00:00 2001 From: Georg Ringer <georg.ringer@gmail.com> Date: Wed, 20 Sep 2017 21:23:35 +0200 Subject: [PATCH] [BUGFIX] Better error messages for FLUIDTEMPLATE object When using FLUIDTEMPLATE with Typoscript "template.file = filename", it will fail silently if filename does not point to a file. Also check for template source when using Typoscript "file = filename" in FLUIDTEMPLATE object. Resolves: #65340 Releases: master Change-Id: Id6aa148408cad14e49b65c0a9f4c7887cfb3fa16 Reviewed-on: https://review.typo3.org/37273 Tested-by: TYPO3com <no-reply@typo3.com> Reviewed-by: Frank Naegler <frank.naegler@typo3.org> Tested-by: Frank Naegler <frank.naegler@typo3.org> Reviewed-by: Joerg Boesche <typo3@joergboesche.de> Tested-by: Joerg Boesche <typo3@joergboesche.de> Reviewed-by: Markus Klein <markus.klein@typo3.org> Tested-by: Markus Klein <markus.klein@typo3.org> --- .../Classes/ContentObject/FluidTemplateContentObject.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/typo3/sysext/frontend/Classes/ContentObject/FluidTemplateContentObject.php b/typo3/sysext/frontend/Classes/ContentObject/FluidTemplateContentObject.php index 862ac1a99d2f..dbc3d29f6e39 100644 --- a/typo3/sysext/frontend/Classes/ContentObject/FluidTemplateContentObject.php +++ b/typo3/sysext/frontend/Classes/ContentObject/FluidTemplateContentObject.php @@ -21,6 +21,7 @@ use TYPO3\CMS\Extbase\Configuration\ConfigurationManager; use TYPO3\CMS\Extbase\Mvc\Web\RequestBuilder; use TYPO3\CMS\Extbase\Object\ObjectManager; use TYPO3\CMS\Fluid\View\StandaloneView; +use TYPO3\CMS\Frontend\ContentObject\Exception\ContentRenderingException; /** * Contains FLUIDTEMPLATE class object @@ -162,6 +163,12 @@ class FluidTemplateContentObject extends AbstractContentObject } elseif (!empty($conf['template']) && !empty($conf['template.'])) { // Fetch the Fluid template by template cObject $templateSource = $this->cObj->cObjGetSingle($conf['template'], $conf['template.']); + if ($templateSource === '') { + throw new ContentRenderingException( + 'Could not find template source for ' . $conf['template'], + 1437420865 + ); + } $this->view->setTemplateSource($templateSource); } else { // Fetch the Fluid template by file stdWrap -- GitLab