From 8507c696f283ffefc2046109db9a178ab7cddc98 Mon Sep 17 00:00:00 2001 From: Thomas Hohn <thomas@hohn.dk> Date: Mon, 6 Mar 2023 18:56:13 +0100 Subject: [PATCH] [BUGFIX] Fix PHP 8 warnings in GifBuilder Added some guards, isset(), to ensure that array keys that aren't defined are accessed and throws PHP warnings. Resolves: #99845 Releases: main, 11.5 Change-Id: I009f5d23a9bf3cd112dc786256d1144983736dd3 Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/78121 Reviewed-by: Ralph Brugger <typo3bugs@public.linkpool.de> Tested-by: Christian Kuhn <lolli@schwarzbu.ch> Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch> Reviewed-by: Oliver Klee <typo3-coding@oliverklee.de> Tested-by: core-ci <typo3@b13.com> --- typo3/sysext/frontend/Classes/Imaging/GifBuilder.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/typo3/sysext/frontend/Classes/Imaging/GifBuilder.php b/typo3/sysext/frontend/Classes/Imaging/GifBuilder.php index a8302eccd74d..248433ca4a8b 100644 --- a/typo3/sysext/frontend/Classes/Imaging/GifBuilder.php +++ b/typo3/sysext/frontend/Classes/Imaging/GifBuilder.php @@ -777,12 +777,12 @@ class GifBuilder extends GraphicalFunctions } elseif ('[' . substr($theVal, 1, -1) . ']' == $theVal) { $objParts = explode('.', substr($theVal, 1, -1)); $theVal = 0; - if (isset($this->objBB[$objParts[0]])) { - if ($objParts[1] === 'w') { + if (isset($this->objBB[$objParts[0]], $objParts[1])) { + if ($objParts[1] === 'w' && isset($this->objBB[$objParts[0]][0])) { $theVal = $this->objBB[$objParts[0]][0]; - } elseif ($objParts[1] === 'h') { + } elseif ($objParts[1] === 'h' && isset($this->objBB[$objParts[0]][1])) { $theVal = $this->objBB[$objParts[0]][1]; - } elseif ($objParts[1] === 'lineHeight') { + } elseif ($objParts[1] === 'lineHeight' && isset($this->objBB[$objParts[0]][2]['lineHeight'])) { $theVal = $this->objBB[$objParts[0]][2]['lineHeight']; } $theVal = (int)$theVal; -- GitLab