Skip to content

PHP Warning: Undefined global variable $TSFE in RenderPreProcessorHook.php line 81 #29

@StanislavSeifert

Description

@StanislavSeifert

Got "Undefined global variable $TSFE" warning in backend:
warning_screenshot

It look like that $GLOBALS['TSFE'] will be initialized after the "renderPreProcessorProc" hook.

Enviroment:
TYPO3 Version: 11.5.17
Webserver: Apache/2.4.54 (Debian)
PHP Version: 8.1.11
wapplersystems/ws_less: "^11.0"

Following patch will solve the problem:

IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/Classes/Hooks/RenderPreProcessorHook.php b/Classes/Hooks/RenderPreProcessorHook.php
--- a/Classes/Hooks/RenderPreProcessorHook.php
+++ b/Classes/Hooks/RenderPreProcessorHook.php	(date 1665767227441)
@@ -78,7 +78,9 @@

         $sitePath = Environment::getPublicPath() . '/';

-        $setup = $GLOBALS['TSFE']->tmpl->setup;
+        $configurationManager = GeneralUtility::makeInstance(\TYPO3\CMS\Extbase\Configuration\ConfigurationManager::class);
+        $setup = $configurationManager->getConfiguration(\TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface::CONFIGURATION_TYPE_FULL_TYPOSCRIPT);
+
         if (\is_array($setup['plugin.']['tx_wsless.']['variables.'])) {

             $variables = $setup['plugin.']['tx_wsless.']['variables.'];

Please update this extension.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions