Issue Bug Closed

#97720Problem with TYPOScript IMG_RESOURCE and cropping (PHP 8)

Marc Willmann 06/01/22, 10:51 updated 10/04/22, 14:04

Description

The example TS code https://docs.typo3.org/m/typo3/reference-typoscript/11.5/en-us/Functions/Imgresource.html

file {
    crop.data = file:current:crop
    cropVariant = desktop
}

breaks with TYPO3 11.5 and PHP 8.0 with the following error message.

PHP Warning: Undefined array key “crop” in /var/www/html/vendor/typo3/cms-frontend/Classes/ContentObject/ContentObjectRenderer.php line 4204

As a workaround this can be circumvented by adding an empty crop attribute:

file {
    crop =
    crop.data = file:current:crop
    cropVariant = desktop
}

The problem though is a missing validation in frontend/Classes/ContentObject/ContentObjectRenderer.php in the named line 4204. I will try to provide a fix for that.

Problem is found in TYPO3 11.5.10, but is also in TYPO3 dev-main.

Reviews 2