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; }