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 #1

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

Actions #2

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

Actions #3

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

Actions #4

Updated by Simon Schaufelberger 8 months ago

Does this bug also occur on TYPO3 11 or only since 12?

Actions #5

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

Actions #6

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

Actions #7

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

Actions #8

Updated by Oliver Bartsch 8 months ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100
Actions #9

Updated by Benni Mack 5 months ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF