Skip to content

Commit

Permalink
[BUGFIX] Prevent type error on invalid crop instructions
Browse files Browse the repository at this point in the history
When the crop object is serialized in a wrong manner
or does not contain all information. In order to avoid
PHP errors, the casting is done so the page still
gets rendered.

Resolves: #93138
Releases: main, 12.4, 11.5
Change-Id: Ia71dc81363c519a663c9cc91e2f0f200e7570832
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/81064
Tested-by: core-ci <typo3@b13.com>
Reviewed-by: Oliver Bartsch <bo@cedev.de>
Tested-by: Oliver Bartsch <bo@cedev.de>
  • Loading branch information
bmack authored and o-ba committed Sep 20, 2023
1 parent 1b856fa commit 6d1a37b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion typo3/sysext/core/Classes/Imaging/ImageDimension.php
Expand Up @@ -145,7 +145,7 @@ private static function getConfigurationForImageCropScaleMask(TaskInterface $tas
// check if it is a json object
$cropData = json_decode($configuration['crop']);
if ($cropData) {
$options['crop'] = new Area($cropData->x, $cropData->y, $cropData->width, $cropData->height);
$options['crop'] = new Area((float)$cropData->x, (float)$cropData->y, (float)$cropData->width, (float)$cropData->height);
} else {
[$offsetLeft, $offsetTop, $newWidth, $newHeight] = explode(',', $configuration['crop'], 4);
$options['crop'] = new Area((float)$offsetLeft, (float)$offsetTop, (float)$newWidth, (float)$newHeight);
Expand Down

0 comments on commit 6d1a37b

Please sign in to comment.