From 205f246287459f239d5317b04e01004efc1e5669 Mon Sep 17 00:00:00 2001
From: Markus Klein <markus.klein@typo3.org>
Date: Mon, 20 Apr 2020 11:12:26 +0200
Subject: [PATCH] [TASK] Ensure TSFE is really a valid object

Make sure the TSFE fetched in TemplateService really is a valid
TypoScriptFrontendController.
This way any kind of "fake Frontend" built in Backend does not
break the functionality.

Resolves: #91139
Releases: master
Change-Id: I571130de635f2be79301f747c5b3e1ad40987fec
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/64255
Tested-by: Andreas Fernandez <a.fernandez@scripting-base.de>
Tested-by: Oliver Bartsch <bo@cedev.de>
Tested-by: TYPO3com <noreply@typo3.com>
Tested-by: Benni Mack <benni@typo3.org>
Reviewed-by: Andreas Fernandez <a.fernandez@scripting-base.de>
Reviewed-by: Oliver Klee <typo3-coding@oliverklee.de>
Reviewed-by: Oliver Bartsch <bo@cedev.de>
Reviewed-by: Benni Mack <benni@typo3.org>
---
 typo3/sysext/core/Classes/TypoScript/TemplateService.php | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/typo3/sysext/core/Classes/TypoScript/TemplateService.php b/typo3/sysext/core/Classes/TypoScript/TemplateService.php
index 064b28e93e9d..64b3c587e6e9 100644
--- a/typo3/sysext/core/Classes/TypoScript/TemplateService.php
+++ b/typo3/sysext/core/Classes/TypoScript/TemplateService.php
@@ -1212,7 +1212,7 @@ class TemplateService
 
             // adding constants from site settings
             $siteConstants = '';
-            if ($this->getTypoScriptFrontendController()) {
+            if ($this->getTypoScriptFrontendController() instanceof TypoScriptFrontendController) {
                 $site = $this->getTypoScriptFrontendController()->getSite();
             } else {
                 $currentPage = end($this->absoluteRootLine);
-- 
GitLab