Project

General

Profile

Actions

Bug #99845

closed

PHP Warning in GifBuilder.php

Added by Ralph Brugger almost 2 years ago. Updated 5 months ago.

Status:
Closed
Priority:
Should have
Assignee:
Category:
Frontend
Target version:
-
Start date:
2023-02-06
Due date:
% Done:

100%

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

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;
}
Actions #1

Updated by Chris Müller almost 2 years ago

Can you state the warnings and give some context when they are thrown? I assume, something with "undefined array key"?

Actions #2

Updated by Ralph Brugger almost 2 years ago

Sorry, yes:

Error handler (FE): PHP Warning: Undefined array key 0
and
Error handler (FE): PHP Warning: Undefined array key 1
for $this->objBB[$objParts0]0 and $this->objBB[$objParts0]1

The context is not completely clear.
It occures when rendering of many simple CEs.

Actions #3

Updated by Thomas Hohn over 1 year ago

  • Assignee set to Thomas Hohn
Actions #4

Updated by Gerrit Code Review over 1 year 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/+/78041

Actions #5

Updated by Gerrit Code Review over 1 year 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/+/78121

Actions #6

Updated by Thomas Hohn over 1 year ago

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

Updated by Benni Mack 5 months ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF