[BUGFIX] Better error messages for FLUIDTEMPLATE object 73/37273/7
authorGeorg Ringer <georg.ringer@gmail.com>
Wed, 20 Sep 2017 19:23:35 +0000 (21:23 +0200)
committerMarkus Klein <markus.klein@typo3.org>
Sun, 15 Oct 2017 21:10:15 +0000 (23:10 +0200)
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>
typo3/sysext/frontend/Classes/ContentObject/FluidTemplateContentObject.php

index 862ac1a..dbc3d29 100644 (file)
@@ -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