Browse Source

Merge branch '1.6'

Jordi Boggiano 6 years ago
parent
commit
837ad7c14e
1 changed files with 9 additions and 4 deletions
  1. 9 4
      src/Composer/Downloader/ZipDownloader.php

+ 9 - 4
src/Composer/Downloader/ZipDownloader.php

@@ -56,10 +56,6 @@ class ZipDownloader extends ArchiveDownloader
             self::$hasZipArchive = class_exists('ZipArchive');
         }
 
-        if (null === self::$isWindows) {
-            self::$isWindows = Platform::isWindows();
-        }
-
         if (!self::$hasZipArchive && !self::$hasSystemUnzip) {
             // php.ini path is added to the error message to help users find the correct file
             $iniMessage = IniHelper::getMessage();
@@ -68,6 +64,15 @@ class ZipDownloader extends ArchiveDownloader
             throw new \RuntimeException($error);
         }
 
+        if (null === self::$isWindows) {
+            self::$isWindows = Platform::isWindows();
+
+            if (!self::$isWindows && !self::$hasSystemUnzip) {
+                $this->io->writeError("<warn>As there is no 'unzip' command installed zip files are being unpacked using the PHP zip extension.</warn>");
+                $this->io->writeError("<warn>This may cause invalid reports of corrupted archives. Installing 'unzip' may remediate them.</warn>");
+            }
+        }
+
         return parent::download($package, $path, $output);
     }