Merge "Third argument to unpack() requires PHP 7.1"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Sat, 13 Apr 2019 08:24:42 +0000 (08:24 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Sat, 13 Apr 2019 08:24:42 +0000 (08:24 +0000)
includes/libs/mime/MimeAnalyzer.php

index 413fb2a..a326df2 100644 (file)
@@ -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 {