From 805e8fca6b0de0ae7df63309db56a9d430cb2575 Mon Sep 17 00:00:00 2001 From: =?utf8?q?=C3=86var=20Arnfj=C3=B6r=C3=B0=20Bjarmason?= Date: Thu, 6 Oct 2005 16:39:00 +0000 Subject: [PATCH] * Duck warnings when fed an invalid file --- includes/Exif.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/includes/Exif.php b/includes/Exif.php index cf79423746..b2b43c1491 100644 --- a/includes/Exif.php +++ b/includes/Exif.php @@ -287,8 +287,14 @@ class Exif { $this->debugFile( $basename, __FUNCTION__, true ); wfSuppressWarnings(); - $this->mRawExifData = exif_read_data( $file ); + $data = exif_read_data( $file ); wfRestoreWarnings(); + /** + * exif_read_data() will return false on invalid input, such as + * when somebody uploads a file called something.jpeg + * containing random gibberish. + */ + $this->mRawExifData = $data ? $data : array(); $this->makeFilteredData(); $this->makeFormattedData(); -- 2.20.1