[BUGFIX] Ensure variable imageSizes is an array before accessing its values 98/36698/2
authorFabien Udriot <fabien.udriot@ecodev.ch>
Thu, 5 Feb 2015 14:01:04 +0000 (15:01 +0100)
committerChristian Kuhn <lolli@schwarzbu.ch>
Thu, 5 Feb 2015 22:46:32 +0000 (23:46 +0100)
It could be the PHP function "getimagesize" will fail to get the width and
the height of an image if the format is not supported by PHP. The patch
prevent accessing the value of an array which may be not an array.

Resolves: #64875
Releases: master, 6.2
Change-Id: Ibcbeb6edc7e23a2468cbcce40c2ecb0c2ba21142
Reviewed-on: http://review.typo3.org/36698
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
typo3/sysext/core/Classes/Type/File/ImageInfo.php

index 9f0f9c6..dc64f90 100644 (file)
@@ -56,6 +56,7 @@ class ImageInfo extends FileInfo {
                        // In case the image size could not be retrieved, log the incident as a warning.
                        if ($this->imageSizes === FALSE) {
                                $this->getLogger()->warning('I could not retrieve the image size for file ' . $this->getPathname());
+                               $this->imageSizes = array(0, 0);
                        }
                }
                return $this->imageSizes;
@@ -65,11 +66,9 @@ class ImageInfo extends FileInfo {
         * @return \TYPO3\CMS\Core\Log\Logger
         */
        protected function getLogger(){
-
                /** @var $loggerManager \TYPO3\CMS\Core\Log\LogManager */
                $loggerManager = GeneralUtility::makeInstance('TYPO3\CMS\Core\Log\LogManager');
 
-               /** @var $logger \TYPO3\CMS\Core\Log\Logger */
                return $loggerManager->getLogger(get_class($this));
        }