#102241Undefined array index warning in TYPO3\CMS\Frontend\Imaging\GifBuilder
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
Reviews 2
History 49
-
Tobias Gülzow commented 01/17/24, 14:20
-
Gerrit Code Review pushed patch set 1 for main to change 83559 status
NewUnder Review 03/21/24, 13:03 -
Gerrit Code Review pushed patch set 2 for main to change 83559 03/21/24, 13:17
-
Simon Schaufelberger commented 03/22/24, 09:53
Does this bug also occur on TYPO3 11 or only since 12?
-
Gerrit Code Review pushed patch set 1 for 12.4 to change 83570 03/22/24, 11:17
-
Gerrit Code Review pushed patch set 2 for 12.4 to change 83570 03/22/24, 11:18
-
Gerrit Code Review pushed patch set 3 for 12.4 to change 83570 03/22/24, 11:19
-
Oliver Bartsch commented and changed status
Under ReviewResolved done0 %100 % 03/22/24, 12:35Applied in changeset commit:3d18a57a9fd68d7a461bb012386a8feb4338c20d.
-
Benni Mack changed status
ResolvedClosed 07/09/24, 15:19
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