Bug #104639
openGIFBUILDER unnecessary "Undefined array key" Warning when using TEXT properties like "outline"
0%
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
No data to display