From: Ævar Arnfjörð Bjarmason Date: Thu, 6 Oct 2005 16:39:00 +0000 (+0000) Subject: * Duck warnings when fed an invalid file X-Git-Tag: 1.6.0~1528 X-Git-Url: https://git.cyclocoop.org/%27.%24link.%27?a=commitdiff_plain;h=805e8fca6b0de0ae7df63309db56a9d430cb2575;p=lhc%2Fweb%2Fwiklou.git * Duck warnings when fed an invalid file --- 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();