Bug #102241
closedUndefined array index warning in TYPO3\CMS\Frontend\Imaging\GifBuilder
100%
Description
TypoScript setup:
file = GIFBUILDER file { XY = 700,1000 format = png 10 = IMAGE 10.file { import { data = levelmedia:-1, slide listNum = 0 } width = 700c height = 560c treatIdAsReference = 1 } 21 = IMAGE 21 { offset = 0,232 file = ....png width = 700 height = 1213 if { value.data = page:bgcolor equals = 1 } } 22 < .21 22 { file = ....png if.equals = 2 } 23 < .21 23 { file = ....png if.equals = 3 } }
In the above setup only one image will be used. Either 21, 22 or 23 because of the if. statements. The GifBuilder takes care of the if. statements and removes all objects from the internal $this->setup configuration that do not match. Later in line 245 the configuration for all keys (21, 22 and 23) is retrieved but some keys might already be unset in line 231 due to the if. statements. I'm not sure if it's better to remove keys from $sKeyArray as well when when a if. statement is not met and the setup is cleaned. Or simply add a null coalescing operator in line 245.
Error message: PHP Warning: Undefined array key 22 in /var/www/html/vendor/typo3/cms-frontend/Classes/Imaging/GifBuilder.php line 245
TYPO3 version: 12.4.7
Updated by Tobias Gülzow 10 months ago
Hi everyone.
We are having exactly the same problem.
Our current workaround:
Use the gifbuilder-ConfPreProcess hook to parse through the config and remove ts settings with a problematic if clause.
Tobi
Updated by Gerrit Code Review 8 months ago
- Status changed from New to Under Review
Patch set 1 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/83559
Updated by Gerrit Code Review 8 months ago
Patch set 2 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/83559
Updated by Simon Schaufelberger 8 months ago
Does this bug also occur on TYPO3 11 or only since 12?
Updated by Gerrit Code Review 8 months ago
Patch set 1 for branch 12.4 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/83570
Updated by Gerrit Code Review 8 months ago
Patch set 2 for branch 12.4 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/83570
Updated by Gerrit Code Review 8 months ago
Patch set 3 for branch 12.4 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/83570
Updated by Oliver Bartsch 8 months ago
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
Applied in changeset 3d18a57a9fd68d7a461bb012386a8feb4338c20d.