From 9d003ffab814fc42a44b52c29c9352d602c19748 Mon Sep 17 00:00:00 2001 From: gormur Date: Tue, 2 Jul 2019 01:29:58 +0200 Subject: [PATCH] More robust error handling If using custom error handling, the @ error suppression may get ignored and errors in exif_read_data throw an Exception. --- Adapter/Common.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Adapter/Common.php b/Adapter/Common.php index 5e9de61..c3a0523 100644 --- a/Adapter/Common.php +++ b/Adapter/Common.php @@ -107,7 +107,11 @@ public function fixOrientation() throw new \RuntimeException('You need to EXIF PHP Extension to use this function'); } - $exif = @exif_read_data($this->source->getInfos()); + try { + $exif = @exif_read_data($this->source->getInfos()); + } catch (\Exception $e) { + $exif = false; + } if ($exif === false || !array_key_exists('Orientation', $exif)) { return $this;