From 34bc4b502c82b8a2eca09038c6dfa066e3d17ed9 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Bartosz=20Dziewo=C5=84ski?= Date: Thu, 24 Mar 2016 10:06:34 +0100 Subject: [PATCH] MimeMagic: Prevent PHP warning when trying to read zero bytes Honestly, there's no reason why fread() should warn when asked to read zero bytes. It should just return zero bytes of content. Eh, PHP. Bug: T130813 Change-Id: I56c4826759390bdbf6af04da28e2d9ed07781bca --- includes/MimeMagic.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/MimeMagic.php b/includes/MimeMagic.php index aedfd8fece..a432d44c9a 100644 --- a/includes/MimeMagic.php +++ b/includes/MimeMagic.php @@ -645,7 +645,7 @@ class MimeMagic { throw new MWException( "Seeking $tailLength bytes from EOF failed in " . __METHOD__ ); } - $tail = fread( $f, $tailLength ); + $tail = $tailLength ? fread( $f, $tailLength ) : ''; fclose( $f ); wfDebug( __METHOD__ . ": analyzing head and tail of $file for magic numbers.\n" ); -- 2.20.1