Project

General

Profile

Actions

Bug #104639

closed

GIFBUILDER unnecessary "Undefined array key" Warning when using TEXT properties like "outline"

Added by Thomas Oliver Moll 3 months ago. Updated about 1 month ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Frontend
Target version:
Start date:
2024-08-14
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
11
PHP Version:
8.1
Tags:
Complexity:
no-brainer
Is Regression:
Sprint Focus:

Description

Hi,
since switching to PHP8 my logs are flooded with "Undefined array key" warnings.

At one place I render text (creator name) into an image, and to have the text visible against every background color, I give it an outline:

Simplified:

20 = IMG_RESOURCE
20{
   file = GIFBUILDER
   file{
        10 = IMAGE
        10{
           ...
        }
        20 = TEXT
    20 {
      text.data = register:creator
          text.wrap = ©|
          test.required = register:creator 
          # bottom right corner
          offset = [10.w]-3,[10.h]-3
          angle = 90
          fontColor = #FFFFFF
      outline {
        thickness = 1
        if.isTrue.field=rendercreator
        color = #32475b
        color.if.isTrue.field=rendercreator
      }
    }
   }
}

Every line within the outline-block triggers the following Warning (for what ever comes first):

Exception: PHP Warning: Undefined array key "thickness" in /var/www/html/typo3_src-12.4.18/typo3/sysext/frontend/Classes/Imaging/GifBuilder.php line 455

And if I lookup the code in GifBuilder.php it's relatively clear why this warning is triggered:

451  if (is_array($conf['outline.'] ?? null)) {
452      $isStdWrapped = [];
453      foreach ($conf['outline.'] as $key => $value) {
454          $parameter = rtrim($key, '.');
455          if (!$isStdWrapped[$parameter] && isset($conf[$parameter . '.'])) {
456              $conf['outline.'][$parameter] = $this->cObj->stdWrapValue($parameter, $conf);
457              $isStdWrapped[$parameter] = 1;
458          }
459      }
460      $this->makeOutline($this->im, $conf['outline.'], $this->workArea, $conf);
461  }

in line 452 the Array is created empty and in 455 the key "thickness" (for example) is used without it being initialized.

I'm unsure what the best way would be in this case. I think it would suffice to change it to:

455          if (!($isStdWrapped[$parameter] ?? false) && isset($conf[$parameter . '.'])) {

Of course this same change has to be done for all 3 occurrences - I attached a patch file for TYPO3 v12.4.19 but the problem is present in v11 as well

On a side note: this warning at first seemed to be much more catastrophic, because in the settings the value for exceptionalErrors was switched from 4096 (default) to

[SYS][exceptionalErrors] = 12290

This is the second time, this exact change happened - seeing this happen again and "right in front of my eyes" make me think it's the Upgrade Wizard that changes ist - but not always. I'm confused. if any one knows, why this happens please give me a clue.


Files

GifBuilder.php.patch (2.17 KB) GifBuilder.php.patch Thomas Oliver Moll, 2024-08-15 16:30
Actions #1

Updated by Gerrit Code Review 3 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/+/85694

Actions #2

Updated by Gerrit Code Review 3 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/+/85694

Actions #3

Updated by Gerrit Code Review 3 months ago

Patch set 3 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/+/85694

Actions #4

Updated by Gerrit Code Review 3 months ago

Patch set 4 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/+/85694

Actions #5

Updated by Gerrit Code Review 3 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/+/85698

Actions #6

Updated by Gerrit Code Review 3 months 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/+/85699

Actions #7

Updated by Oliver Bartsch 3 months ago

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

Updated by Benni Mack about 1 month ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF