From 63ca02683d41ecaec68feabea3eea4819e4b9853 Mon Sep 17 00:00:00 2001
From: Georg Ringer <georg.ringer@gmail.com>
Date: Tue, 16 Jan 2018 11:28:05 +0100
Subject: [PATCH] [BUGFIX] Improve exception output for ImageService

Avoid spamming the log in PHP 7.2 due to get_class(null) if fetching the
image in ImageService->getImage() fails.

Resolves: #83570
Releases: master, 8.7, 7.6
Change-Id: Icc3c78f5b747842cee89d184134ff298b8e04a3a
Reviewed-on: https://review.typo3.org/55376
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Oliver Klee <typo3-coding@oliverklee.de>
Reviewed-by: Benni Mack <benni@typo3.org>
Tested-by: Benni Mack <benni@typo3.org>
---
 typo3/sysext/extbase/Classes/Service/ImageService.php | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/typo3/sysext/extbase/Classes/Service/ImageService.php b/typo3/sysext/extbase/Classes/Service/ImageService.php
index 9e5cfce19dfe..08e62ba54024 100644
--- a/typo3/sysext/extbase/Classes/Service/ImageService.php
+++ b/typo3/sysext/extbase/Classes/Service/ImageService.php
@@ -130,7 +130,8 @@ class ImageService implements \TYPO3\CMS\Core\SingletonInterface
         }
 
         if (!($image instanceof File || $image instanceof FileReference)) {
-            throw new \UnexpectedValueException('Supplied file object type ' . get_class($image) . ' for ' . $src . ' must be File or FileReference.', 1382687163);
+            $class = is_object($image) ? get_class($image) : 'null';
+            throw new \UnexpectedValueException('Supplied file object type ' . $class . ' for ' . $src . ' must be File or FileReference.', 1382687163);
         }
 
         return $image;
-- 
GitLab