[BUGFIX] Fluid: Strict type checking when adding debug namespace 32/53832/3
authorBenni Mack <benni@typo3.org>
Wed, 30 Aug 2017 06:13:13 +0000 (08:13 +0200)
committerStefan Neufeind <typo3.neufeind@speedpartner.de>
Sun, 10 Sep 2017 14:23:59 +0000 (16:23 +0200)
The check on BE_USER->uc() in frontend context is cleaned up and more
strict, checking whether the object exists currently.

Additionally, the specific request type is used here.

Resolves: #82397
Releases: master, 8.7
Change-Id: Ibe0b533c23e1ba9c35ed2b6b9b0301e1a449c2e3
Reviewed-on: https://review.typo3.org/53832
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: Stefan Neufeind <typo3.neufeind@speedpartner.de>
Tested-by: Stefan Neufeind <typo3.neufeind@speedpartner.de>
typo3/sysext/fluid/Classes/Core/ViewHelper/ViewHelperResolver.php

index 0b0fd53..8e1a421 100644 (file)
@@ -58,12 +58,11 @@ class ViewHelperResolver extends \TYPO3Fluid\Fluid\Core\ViewHelper\ViewHelperRes
     public function __construct()
     {
         $this->namespaces = $GLOBALS['TYPO3_CONF_VARS']['SYS']['fluid']['namespaces'];
-        $configuration = $this->getBackendUser()->uc['TSFE_adminConfig'];
-        if (TYPO3_MODE === 'FE'
-            && isset($configuration['preview_showFluidDebug'])
-            && $configuration['preview_showFluidDebug']
-        ) {
-            $this->namespaces['f'][] = 'TYPO3\\CMS\\Fluid\\ViewHelpers\\Debug';
+        if (TYPO3_REQUESTTYPE & TYPO3_REQUESTTYPE_FE && $this->getBackendUser() instanceof BackendUserAuthentication) {
+            $configuration = $this->getBackendUser()->uc['TSFE_adminConfig'];
+            if (isset($configuration['preview_showFluidDebug']) && $configuration['preview_showFluidDebug']) {
+                $this->namespaces['f'][] = 'TYPO3\\CMS\\Fluid\\ViewHelpers\\Debug';
+            }
         }
     }