From ce5d4b05ded6b9896eb24464e7692cf2d6032b6a Mon Sep 17 00:00:00 2001 From: Benni Mack <benni@typo3.org> Date: Thu, 21 Sep 2023 15:41:59 +0200 Subject: [PATCH] [BUGFIX] Restore file.crop syntax in PHP 8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When using "file.crop" via TypoScript, PHP 8 requires strict types for float values. Therefore, all values, which were strings before, are now properly casted to floats, avoiding PHP errors. Example TypoScript: page.10 = IMAGE page.10 { file = 1:/myimage.jpg file.ext = png file.width = 200 file.height = 200 file.crop = 50,50,100,100 } Resolves: #101994 Releases: main, 12.4 Change-Id: I73c2dc9128fded7874b506ddb37026077f5a67a6 Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/81156 Tested-by: Oliver Klee <typo3-coding@oliverklee.de> Tested-by: Oliver Bartsch <bo@cedev.de> Reviewed-by: Stefan Bürk <stefan@buerk.tech> Tested-by: Stefan Bürk <stefan@buerk.tech> Reviewed-by: Oliver Bartsch <bo@cedev.de> Reviewed-by: Oliver Klee <typo3-coding@oliverklee.de> Tested-by: core-ci <typo3@b13.com> --- .../frontend/Classes/ContentObject/ContentObjectRenderer.php | 1 + 1 file changed, 1 insertion(+) diff --git a/typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php b/typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php index 6b80dd8704d7..0f3eb4f28e9b 100644 --- a/typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php +++ b/typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php @@ -3846,6 +3846,7 @@ class ContentObjectRenderer implements LoggerAwareInterface if ($jsonCropArea->isEmpty() && preg_match('/^[0-9]+,[0-9]+,[0-9]+,[0-9]+$/', $cropSettings)) { $cropSettings = explode(',', $cropSettings); if (count($cropSettings) === 4) { + $cropSettings = array_map(floatval(...), $cropSettings); $stringCropArea = GeneralUtility::makeInstance( Area::class, ...$cropSettings -- GitLab