From 7e74827d630b0cbc317245bc6799b1f3bbf1c0e8 Mon Sep 17 00:00:00 2001 From: Daniel Lienert Date: Tue, 30 Oct 2018 11:44:07 +0100 Subject: [PATCH] BUGFIX: __toString must not throw an excaption When an image is not found due to security constraints, an exception is thrown which is covered by PHPs exception that __toString should never throw an exception. --- Classes/EelHelpers/AbstractImageSourceHelper.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Classes/EelHelpers/AbstractImageSourceHelper.php b/Classes/EelHelpers/AbstractImageSourceHelper.php index 1c90d92..16b760a 100644 --- a/Classes/EelHelpers/AbstractImageSourceHelper.php +++ b/Classes/EelHelpers/AbstractImageSourceHelper.php @@ -118,7 +118,6 @@ public function allowsCallOfMethod($methodName) } } - /** * If the source is cast to string the default source is returned * @@ -126,6 +125,10 @@ public function allowsCallOfMethod($methodName) */ public function __toString(): string { - return $this->src(); + try { + return $this->src(); + } catch (\Exception $e) { + return $e->getMessage(); + } } }