From ef3747b970fef96b19f2d4ea901f64881aadc8e0 Mon Sep 17 00:00:00 2001 From: Oliver Bartsch <bo@cedev.de> Date: Tue, 20 Aug 2024 10:35:06 +0200 Subject: [PATCH] [BUGFIX] Fix undefined array key warnings in GifBuilder Resolves: #104639 Releases: main, 12.4, 11.5 Change-Id: I74a0cd9e856283d26a382582cc5d6b8e99887cd4 Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/85694 Tested-by: Andreas Kienast <a.fernandez@scripting-base.de> Tested-by: Christian Kuhn <lolli@schwarzbu.ch> Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch> Reviewed-by: Andreas Kienast <a.fernandez@scripting-base.de> Tested-by: core-ci <typo3@b13.com> Reviewed-by: Oliver Klee <typo3-coding@oliverklee.de> --- Build/phpstan/phpstan-baseline.neon | 10 ---------- typo3/sysext/frontend/Classes/Imaging/GifBuilder.php | 6 +++--- 2 files changed, 3 insertions(+), 13 deletions(-) diff --git a/Build/phpstan/phpstan-baseline.neon b/Build/phpstan/phpstan-baseline.neon index 08823793d7ab..6a79a499b58b 100644 --- a/Build/phpstan/phpstan-baseline.neon +++ b/Build/phpstan/phpstan-baseline.neon @@ -1415,16 +1415,6 @@ parameters: count: 8 path: ../../typo3/sysext/frontend/Classes/Imaging/GifBuilder.php - - - message: "#^Negated boolean expression is always false\\.$#" - count: 3 - path: ../../typo3/sysext/frontend/Classes/Imaging/GifBuilder.php - - - - message: "#^Result of && is always false\\.$#" - count: 3 - path: ../../typo3/sysext/frontend/Classes/Imaging/GifBuilder.php - - message: "#^Cannot unset offset 'parameter\\.' on array\\{parameter\\: mixed\\}\\.$#" count: 1 diff --git a/typo3/sysext/frontend/Classes/Imaging/GifBuilder.php b/typo3/sysext/frontend/Classes/Imaging/GifBuilder.php index a8871e5d1562..16a7c262c852 100644 --- a/typo3/sysext/frontend/Classes/Imaging/GifBuilder.php +++ b/typo3/sysext/frontend/Classes/Imaging/GifBuilder.php @@ -547,7 +547,7 @@ class GifBuilder $isStdWrapped = []; foreach ($conf['shadow.'] as $key => $value) { $parameter = rtrim($key, '.'); - if (!$isStdWrapped[$parameter] && isset($conf[$parameter . '.'])) { + if (!($isStdWrapped[$parameter] ?? false) && isset($conf[$parameter . '.'])) { $conf['shadow.'][$parameter] = $this->cObj->stdWrapValue($parameter, $conf); $isStdWrapped[$parameter] = 1; } @@ -558,7 +558,7 @@ class GifBuilder $isStdWrapped = []; foreach ($conf['emboss.'] as $key => $value) { $parameter = rtrim($key, '.'); - if (!$isStdWrapped[$parameter] && isset($conf[$parameter . '.'])) { + if (!($isStdWrapped[$parameter] ?? false) && isset($conf[$parameter . '.'])) { $conf['emboss.'][$parameter] = $this->cObj->stdWrapValue($parameter, $conf); $isStdWrapped[$parameter] = 1; } @@ -569,7 +569,7 @@ class GifBuilder $isStdWrapped = []; foreach ($conf['outline.'] as $key => $value) { $parameter = rtrim($key, '.'); - if (!$isStdWrapped[$parameter] && isset($conf[$parameter . '.'])) { + if (!($isStdWrapped[$parameter] ?? false) && isset($conf[$parameter . '.'])) { $conf['outline.'][$parameter] = $this->cObj->stdWrapValue($parameter, $conf); $isStdWrapped[$parameter] = 1; } -- GitLab