Project

General

Profile

Actions

Bug #102241

closed

Undefined array index warning in TYPO3\CMS\Frontend\Imaging\GifBuilder

Added by Hannes Bochmann about 1 year ago. Updated 5 months ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Image Generation / GIFBUILDER
Target version:
-
Start date:
2023-10-24
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
12
PHP Version:
8.2
Tags:
Complexity:
Is Regression:
Sprint Focus:

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

Actions

Also available in: Atom PDF