Issue Bug Closed

#101185unaffected crop attribute in ImageViewhelper

Philipp Parzer 06/28/23, 07:15 updated 07/09/24, 14:15

Description

the class TYPO3\CMS\Fluid\ViewHelpers\ImageViewHelper has an attribute ‘crop’ which is defined as string|bool
but if you inspect the variable $this->arguments[‘crop’] it is parsed to an array

that affects following line:
$cropVariantCollection = CropVariantCollection::create((string)$cropString);
the argument is parsed to a string and therefore the string ‘Array’ is given and an empty CropArea is created

could be solved via check:
$cropString = is_array($this->arguments[‘crop’]) ? json_encode($this->arguments[‘crop’]) : $this->arguments[‘crop’];

tested in TYPO3 11 with PHP 7.4

Reviews 3