From 67f5e90ad627c6c473550197275f77fece6bf5e4 Mon Sep 17 00:00:00 2001 From: Susanne Moog <look@susi.dev> Date: Wed, 25 Mar 2020 11:06:55 +0100 Subject: [PATCH] [BUGFIX] Avoid error in imageLinkWrap for non-existing files MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ImageLinkWrap may not get a valid file object but will still try to access methods on it which will fail. This patch implements a null check resulting in simply not linking the image if the given file resource is invalid. Resolves: #88879 Releases: master, 9.5 Change-Id: I723596aa3b0a274a3565492b3d67a30b9d52389f Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/63914 Reviewed-by: Georg Ringer <georg.ringer@gmail.com> Reviewed-by: Guido Schmechel <guido.schmechel@brandung.de> Reviewed-by: Daniel Goerz <daniel.goerz@posteo.de> Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl> Reviewed-by: Frank Nägler <frank.naegler@typo3.org> Tested-by: TYPO3com <noreply@typo3.com> Tested-by: Andreas Fernandez <a.fernandez@scripting-base.de> Tested-by: Frank Nägler <frank.naegler@typo3.org> --- .../frontend/Classes/ContentObject/ContentObjectRenderer.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php b/typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php index d4762b98da69..e86ff141b165 100644 --- a/typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php +++ b/typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php @@ -1314,7 +1314,7 @@ class ContentObjectRenderer implements LoggerAwareInterface } // Create imageFileLink if not created with typolink - if ($content === $string) { + if ($content === $string && $file !== null) { $parameterNames = ['width', 'height', 'effects', 'bodyTag', 'title', 'wrap', 'crop']; $parameters = []; $sample = isset($conf['sample.']) ? $this->stdWrap($conf['sample'], $conf['sample.']) : $conf['sample']; -- GitLab