Project

General

Profile

Actions

Bug #100853

closed

PHP Warning in GifBuilder.php

Added by Ralph Brugger over 1 year ago. Updated 5 months ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Frontend
Target version:
-
Start date:
2023-05-10
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
11
PHP Version:
8.1
Tags:
Complexity:
Is Regression:
Sprint Focus:
Stabilization Sprint

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] = '';
}

Files

GifBuilder.diff (171 Bytes) GifBuilder.diff Ralph Brugger, 2023-05-10 11:59
Actions #1

Updated by David Bruchmann over 1 year ago

The patch file looks empty.

Actions #2

Updated by Ralph Brugger over 1 year ago

The patch file looks empty.

The file has 171 Bytes:

191a192,194
>                                 if (! isset($fileInfo[3])){
>                                     $fileInfo[3] = '';
>                                 }

Actions #3

Updated by Benni Mack over 1 year ago

  • Sprint Focus set to Stabilization Sprint
Actions #4

Updated by Stefan Bürk over 1 year ago

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 ?

Actions #5

Updated by Ralph Brugger over 1 year ago

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

Actions #6

Updated by Gerrit Code Review over 1 year 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/+/79590

Actions #7

Updated by Benni Mack over 1 year ago

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.

Actions #8

Updated by Gerrit Code Review over 1 year 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/+/80091

Actions #9

Updated by Gerrit Code Review over 1 year ago

Patch set 1 for branch 11.5 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/80092

Actions #10

Updated by Benni Mack over 1 year ago

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

Updated by Benni Mack 5 months ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF