Project

General

Profile

Actions

Bug #99998

closed

Trying to access array offset on value of type bool in typo3/sysext/core/Classes/Imaging/GraphicalFunctions.php line 2180

Added by Thomas Hohn about 1 year ago. Updated about 1 year ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Image Generation / GIFBUILDER
Start date:
2023-02-21
Due date:
% Done:

100%

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

Description

From time to time we see the following php warning in out logs. Tried to reproduce it which is very hard - since we have a big distributed env.

 Got error 'PHP message: TYPO3 [WARNING] request="8926f60c7cbed" component="TYPO3.CMS.Core.Type.File.ImageInfo": I could not retrieve the image size for file 
 SITENAME/web/typo3temp/assets/images/40dc6871ee0cefaf7e6fa10a81996d0c.png - 
 {"file":"SITENAME\\/web\\/typo3temp\\/assets\\/images\\/40dc6871ee0cefaf7e6fa10a81996d0c.png"}
 PHP message: TYPO3 [WARNING] request="8926f60c7cbed" component="TYPO3.CMS.Core.Error.ErrorHandler": Core: Error handler (FE): PHP Warning: Trying to access array offset on value of type bool in typo3/sysext/core/Classes/Imaging/GraphicalFunctions.php line 2180 
 PHP message: TYPO3 [WARNING] request="8926f60c7cbed" component="TYPO3.CMS.Core.Error.ErrorHandler": Core: Error handler (FE): PHP Warning: Trying to access array offset on value of type bool in typo3/sysext/core/Classes/Resource/Processing/LocalCropScaleMaskHelper.php line 194 
 PHP message: TYPO3 [WARNING] request="8926f60c7cbed" component="TYPO3.CMS.Core.Error.ErrorHandler": Core: Error handler (FE): PHP Warning: Trying to access array offset on value of type bool in typo3/sysext/core/Classes/Resource/Processing/LocalCropScaleMaskHelper.php line 196 
 PHP message: TYPO3 [WARNING] request="8926f60c7cbed" component="TYPO3.CMS.Core.Error.ErrorHandler": Core: Error handler (FE): PHP Warning: Trying to access array offset on value of type bool in typo3/sysext/core/Classes/Resource/Processing/LocalCropScaleMaskHelper.php line 197 
 PHP message: TYPO3 [WARNING] request="8926f60c7cbed" component="TYPO3.CMS.Core.Error.ErrorHandler": Core: Error handler (FE): PHP Warning: Trying to access array offset on value of type bool in typo3/sysext/core/Classes/Resource/Processing/LocalCropScaleMaskHelper.php line 198

We believe that it comes from a race condition in the following function
    public function getImageDimensions($imageFile)
    {
        $returnArr = null;
        preg_match('/([^\\.]*)$/', $imageFile, $reg);
        if (file_exists($imageFile) && in_array(strtolower($reg[0]), $this->imageFileExt, true)) {
            $returnArr = $this->getCachedImageDimensions($imageFile);
            if (!$returnArr) {
                $imageInfoObject = GeneralUtility::makeInstance(ImageInfo::class, $imageFile);
                if ($imageInfoObject->getWidth()) {
                    $returnArr = [
                        $imageInfoObject->getWidth(),
                        $imageInfoObject->getHeight(),
                        strtolower($reg[0]),
                        $imageFile,
                    ];
                    $this->cacheImageDimensions($returnArr);
                }
            }
        }
        return $returnArr;
    }

Where $this->getCachedImageDimensions($imageFile) returns false and the call to $imageInfoObject->getWidth()) yields 0 which leads to that the returnArr now contains a boolean with the value false, which results in an error in the LocalCropScaleMaskHelper class


Related issues 1 (0 open1 closed)

Related to TYPO3 Core - Bug #99406: Exception in LocalImageProcessor::checkForExistingTargetFile because accessing array elements without null coalese and "array" is bool (false)Closed2022-12-21

Actions
Actions #1

Updated by Gerrit Code Review about 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/+/77913

Actions #2

Updated by Sybille Peters about 1 year ago

  • Related to Bug #99406: Exception in LocalImageProcessor::checkForExistingTargetFile because accessing array elements without null coalese and "array" is bool (false) added
Actions #3

Updated by Thomas Hohn about 1 year ago

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

Updated by Gerrit Code Review about 1 year ago

  • Status changed from Resolved to Under Review

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/+/77976

Actions #5

Updated by Thomas Hohn about 1 year ago

  • Status changed from Under Review to Resolved
Actions #6

Updated by Benni Mack about 1 year ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF