[BUGFIX] Prevent error if getimagesize() fails 49/42649/2
authorStefan Neufeind <typo3.neufeind@speedpartner.de>
Sat, 15 Aug 2015 16:48:25 +0000 (18:48 +0200)
committerMarkus Klein <markus.klein@typo3.org>
Sun, 16 Aug 2015 14:13:57 +0000 (16:13 +0200)
Upon failure getimagesize() returns FALSE instead of image-dimensions.
Handle that case cleanly.

Change-Id: I8dcd98c842aaa01f572002a6e9c86ea889de6b1b
Resolves: #59528
Releases: 6.2
Reviewed-on: http://review.typo3.org/42649
Reviewed-by: Alexander Schnitzler <typo3@alexanderschnitzler.de>
Tested-by: Alexander Schnitzler <typo3@alexanderschnitzler.de>
Reviewed-by: Markus Klein <markus.klein@typo3.org>
Tested-by: Markus Klein <markus.klein@typo3.org>
typo3/sysext/core/Classes/Resource/Service/IndexerService.php

index 11a6f0e..55ef504 100644 (file)
@@ -140,7 +140,13 @@ class IndexerService implements \TYPO3\CMS\Core\SingletonInterface {
                if ($fileInfo['type'] == $fileObject::FILETYPE_IMAGE) {
                        $rawFileLocation = $fileObject->getForLocalProcessing(FALSE);
                        $metaData = array();
-                       list($metaData['width'], $metaData['height']) = getimagesize($rawFileLocation);
+                       $imageSize = getimagesize($rawFileLocation);
+                       if ($imageSize === FALSE) {
+                               $metaData['width'] = 0;
+                               $metaData['height'] = 0;
+                       } else {
+                               list($metaData['width'], $metaData['height']) = $imageSize;
+                       }
                        $this->getMetaDataRepository()->update($fileObject->getUid(), $metaData);
                }
                // Signal slot AFTER the file was indexed