Issue Bug Closed

#100853PHP Warning in GifBuilder.php

Ralph Brugger 05/10/23, 12:01 updated 07/09/24, 12:56

Description

PHP Warning: Undefined array key 3 in /data/www/sites/baden-wuerttemberg.de/shared/typo3_src/typo3_src-11.5.27/typo3/sysext/frontend/Classes/Imaging/GifBuilder.php line 192

There are two places where $fileInfo[3] is accessed.
Should be better to set a default when $fileInfo[3] is not set.
if (! isset($fileInfo[3])){
    $fileInfo[3] = '';
}

Reviews 3

Files 1

History 811

  1. David Bruchmann commented 05/11/23, 06:01

    The patch file looks empty.

  2. Ralph Brugger commented 05/11/23, 07:00

    > The patch file looks empty.

    The file has 171 Bytes:

    191a192,194
    >                                 if (! isset($fileInfo[3])){
    >                                     $fileInfo[3] = '';
    >                                 }
  3. Benni Mack changed Sprint Focus Stabilization Sprint 06/06/23, 12:49

  4. Stefan Bürk commented 06/10/23, 19:10

    The array key access error is weired, however I guess if that is hit there is more off than that. Because if that is needed and the public url not set, there is something broken.

    Can you provide some more context to the issue ? your used TypoScript or a guide how to properly reproduce this ?

  5. Ralph Brugger commented 06/13/23, 10:05

    I’ve tried to debug it:

    $fileInfo = $this->getResource($conf['file'] ?? '', $conf['file.'] ?? []);
    if ($fileInfo) {
        $this->combinedFileNames[] = preg_replace('/\\.[[:alnum:]]+$/', '', PathUtility::basename($fileInfo[3]));

    \TYPO3\CMS\Core\Utility\DebugUtility::debug($conf);
    —————————————————————————-

       file. => array(4 items)
          import. => array(1 item)
             data => 'register:bwmediathekasset_pi1_IMAGE' (35 chars)
          treatIdAsReference => '1' (1 chars)
          width => '217c' (4 chars)
          height => '121c' (4 chars)

    The $fileInfo does not contain those array-Entries 0,1,2,3

    \TYPO3\CMS\Core\Utility\DebugUtility::debug($fileInfo);
    ———————————————————————————-

       origFile => '/fileadmin/_processed_/f/7/csm_VIDEON_Mediathek_DRUCK_SACHE__22_LVBW_1c7bac24ed.jpg' (83 chars)
       origFile_mtime => FALSE
  6. Gerrit Code Review pushed patch set 1 for main to change 79590 status New Under Review 07/03/23, 11:51

  7. Benni Mack commented 07/03/23, 11:52

    I created a patch for TYPO3 Core. It might be that the TypoScript code needs an update. Can you share yours?

    In addition, I changed the code in the caller code to solve this properly – the image should not be used then.

  8. Gerrit Code Review pushed patch set 1 for 12.4 to change 80091 07/19/23, 09:12

  9. Gerrit Code Review pushed patch set 1 for 11.5 to change 80092 07/19/23, 09:15

  10. Benni Mack commented and changed status Under Review Resolved done 0 % 100 % 07/19/23, 09:45

    Applied in changeset commit:27ecaf0a4087fba8013693e8718007ef4ecbe6b5.

  11. Benni Mack changed status Resolved Closed 07/09/24, 12:56