Issue Bug Closed

#99845PHP Warning in GifBuilder.php

Ralph Brugger 02/06/23, 15:07 updated 07/09/24, 12:46

Description

We’ve git several warnings in
typo3/sysext/frontend/Classes/Imaging/GifBuilder.php

protected function calculateValue($string)

if (isset($this->objBB[$objParts[0]])) {
    if ($objParts[1] === 'w') {
        $theVal = $this->objBB[$objParts[0]][0];
    } elseif ($objParts[1] === 'h') {
        $theVal = $this->objBB[$objParts[0]][1];
    } elseif ($objParts[1] === 'lineHeight') {
        $theVal = $this->objBB[$objParts[0]][2]['lineHeight'];
    }
    $theVal = (int)$theVal;
}

could / should be:

if (isset($this->objBB[$objParts[0]])) {
    if ($objParts[1] === 'w') {
      if (isset($this->objBB[$objParts[0]][0])) {
          $theVal = $this->objBB[$objParts[0]][0];
        }
    } elseif ($objParts[1] === 'h') {
        if (isset($this->objBB[$objParts[0]][1])) {
          $theVal = $this->objBB[$objParts[0]][1];
        }
    } elseif ($objParts[1] === 'lineHeight') {
        if (isset($this->objBB[$objParts[0]][2]['lineHeight'])) {
            $theVal = $this->objBB[$objParts[0]][2]['lineHeight'];
        }
    }
    $theVal = (int)$theVal;
}

Reviews 2