From be58b36a351e827ae2c77250f7c598f43e33255b Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Mon, 12 Jul 2021 15:50:02 +0200 Subject: [PATCH] Also look up 7zz on linux/macOS, fixes #9951 --- src/Composer/Command/DiagnoseCommand.php | 10 ++++++++-- src/Composer/Downloader/ZipDownloader.php | 3 +++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/Composer/Command/DiagnoseCommand.php b/src/Composer/Command/DiagnoseCommand.php index f0bab63a7c35..415b6d7b23c5 100644 --- a/src/Composer/Command/DiagnoseCommand.php +++ b/src/Composer/Command/DiagnoseCommand.php @@ -177,12 +177,18 @@ protected function execute(InputInterface $input, OutputInterface $output) $finder = new ExecutableFinder; $hasSystemUnzip = (bool) $finder->find('unzip'); - $hasSystem7zip = (bool) $finder->find('7z', null, array('C:\Program Files\7-Zip')); + $bin7zip = ''; + if ($hasSystem7zip = (bool) $finder->find('7z', null, array('C:\Program Files\7-Zip'))) { + $bin7zip = '7z'; + } + if (!Platform::isWindows() && !$hasSystem7zip && $hasSystem7zip = (bool) $finder->find('7zz')) { + $bin7zip = '7zz'; + } $io->write( 'zip: ' . (extension_loaded('zip') ? 'extension present' : 'extension not loaded') . ', ' . ($hasSystemUnzip ? 'unzip present' : 'unzip not available') - . ', ' . ($hasSystem7zip ? '7-Zip present' : '7-Zip not available') + . ', ' . ($hasSystem7zip ? '7-Zip present ('.$bin7zip.')' : '7-Zip not available') ); return $this->exitCode; diff --git a/src/Composer/Downloader/ZipDownloader.php b/src/Composer/Downloader/ZipDownloader.php index fd0b93a4a155..06f33347ce96 100644 --- a/src/Composer/Downloader/ZipDownloader.php +++ b/src/Composer/Downloader/ZipDownloader.php @@ -49,6 +49,9 @@ public function download(PackageInterface $package, $path, PackageInterface $pre if (!Platform::isWindows() && ($cmd = $finder->find('7z'))) { // 7z linux/macOS support is only used if unzip is not present self::$unzipCommands[] = array('7z', ProcessExecutor::escape($cmd).' x -bb0 -y %s -o%s'); } + if (!Platform::isWindows() && ($cmd = $finder->find('7zz'))) { // 7zz linux/macOS support is only used if unzip is not present + self::$unzipCommands[] = array('7zz', ProcessExecutor::escape($cmd).' x -bb0 -y %s -o%s'); + } } if (null === self::$hasZipArchive) {