From: Aryeh Gregor Date: Wed, 10 Apr 2019 11:08:40 +0000 (+0300) Subject: Third argument to unpack() requires PHP 7.1 X-Git-Tag: 1.34.0-rc.0~2016^2 X-Git-Url: http://git.cyclocoop.org/%7B%7B%20url_for%28%27admin_vote_add%27%29%20%7D%7D?a=commitdiff_plain;h=94033330b43f562af7fa80f086e9bc2f591f1af0;p=lhc%2Fweb%2Fwiklou.git Third argument to unpack() requires PHP 7.1 On PHP 7.0, it looks like this code would have raised a warning and given random results, because it would interpret the first byte of $tail as the comment length instead of the correct one. Thanks for being permissive about unrecognized function parameters, PHP! (The actual reason I found and fixed this is because the phan annotation here was giving me an error on PHP 7.3: "UnusedPluginSuppression Plugin BuiltinSuppressionPlugin suppresses issue PhanParamTooManyInternal on this line but this suppression is unused or suppressed elsewhere".) Change-Id: I910f78698d1a53e8a90ddf243a4d65be87f29ca9 --- diff --git a/includes/libs/mime/MimeAnalyzer.php b/includes/libs/mime/MimeAnalyzer.php index 413fb2a15e..a326df2bc2 100644 --- a/includes/libs/mime/MimeAnalyzer.php +++ b/includes/libs/mime/MimeAnalyzer.php @@ -806,9 +806,7 @@ EOT; if ( $eocdrPos !== false ) { $this->logger->info( __METHOD__ . ": ZIP signature present in $file\n" ); // Check if it really is a ZIP file, make sure the EOCDR is at the end (T40432) - // FIXME: unpack()'s third argument was added in PHP 7.1 - // @phan-suppress-next-line PhanParamTooManyInternal - $commentLength = unpack( "n", $tail, $eocdrPos + 20 )[0]; + $commentLength = unpack( "n", substr( $tail, $eocdrPos + 20 ) )[0]; if ( $eocdrPos + 22 + $commentLength !== strlen( $tail ) ) { $this->logger->info( __METHOD__ . ": ZIP EOCDR not at end. Not a ZIP file." ); } else {