Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
StanislavSeifert opened this issue Oct 17, 2022 · 1 comment

Comments

@StanislavSeifert
Copy link

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.

@danielDigitalArt
Copy link

danielDigitalArt commented Jan 5, 2024

Actually a fix exists (5493d62) but it was only included in version 12, thus there is currently no version available working on typo3 11.

On Typo3 11.5.33 i just installed Version 11.0 nd instantly got the same Error (PHP Warning: Undefined global variable $TSFE)

Solution would be to make a Version 11.0.1 which has this fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants