Closed dogawaf closed 1 year ago
Hello
On TYPO3 11+php 8, a warning is triggered, and crash the scheduler task in cli mode. This is caused by the undefined TYPO3_REQUEST in $_GLOBALS.
Fix proposal (don't know if they works in other setups)
ImageResizer.php @@ -448,7 +460,8 @@ */ protected function localize(string $input): string { - if (ApplicationType::fromRequest($GLOBALS['TYPO3_REQUEST'])->isFrontend()) { + if (($GLOBALS['TYPO3_REQUEST'] ?? null) instanceof \Psr\Http\Message\ServerRequestInterface + && ApplicationType::fromRequest($GLOBALS['TYPO3_REQUEST'])->isFrontend()) { $output = is_object($GLOBALS['TSFE']) ? $GLOBALS['TSFE']->sL($input) : $input; } else { $output = $GLOBALS['LANG']->sL($input);
Classes/Task/BatchResizeTask.php @@ -151,7 +151,9 @@ // actually resizing the image while uploading, not during a batch processing (it's simply "too late"). $backendUser = null; - if (!ApplicationType::fromRequest($GLOBALS['TYPO3_REQUEST'])->isBackend() || PHP_SAPI === 'cli') { + if (($GLOBALS['TYPO3_REQUEST'] ?? null) instanceof \Psr\Http\Message\ServerRequestInterface + && ApplicationType::fromRequest($GLOBALS['TYPO3_REQUEST'])->isBackend() + || Environment::isCli()) { $callbackNotification = [$this, 'syslog']; } else { $callbackNotification = [$this, 'notify'];
This was fixed in the mean time.
I still will use Environment::isCli() instead of PHP_SAPI as it's more clean.
Environment::isCli()
PHP_SAPI
Hello
On TYPO3 11+php 8, a warning is triggered, and crash the scheduler task in cli mode. This is caused by the undefined TYPO3_REQUEST in $_GLOBALS.
Fix proposal (don't know if they works in other setups)