From 4c8c75515fb2650dff62f04fb3e3c0a6e8dc1920 Mon Sep 17 00:00:00 2001 From: Tim Weisenberger Date: Tue, 29 Oct 2024 08:44:09 +0100 Subject: [PATCH] fix: Ensure existence for TYPO3_REQUEST is checked before ApplicationType is determined --- Classes/EventListener/AbstractImageOptimizer.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Classes/EventListener/AbstractImageOptimizer.php b/Classes/EventListener/AbstractImageOptimizer.php index 443af3e..7b61123 100644 --- a/Classes/EventListener/AbstractImageOptimizer.php +++ b/Classes/EventListener/AbstractImageOptimizer.php @@ -27,7 +27,10 @@ public function __construct() protected function isEnabled(ProcessedFile $processedFile): bool { - if (!ApplicationType::fromRequest($GLOBALS['TYPO3_REQUEST'])->isFrontend()) { + if ( + !array_key_exists('TYPO3_REQUEST', $GLOBALS) || + !ApplicationType::fromRequest($GLOBALS['TYPO3_REQUEST'])->isFrontend() + ) { // this is not needed for TYPO3 backend and would break deferred image processing return false; }