From afc9069771cf45c54d20f6e36d33ede39aa009ae Mon Sep 17 00:00:00 2001 From: Jakub Onderka Date: Thu, 5 Dec 2013 21:26:02 +0100 Subject: [PATCH] Check exception code only if class ZipArchive exists If is for example exception throwed when downloading tar archive on system without installed zip extension, PHP hangs on fatal error " Class 'ZipArchive' not found". --- src/Composer/Downloader/ArchiveDownloader.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Composer/Downloader/ArchiveDownloader.php b/src/Composer/Downloader/ArchiveDownloader.php index 3f1cc4117..bfe174fb7 100644 --- a/src/Composer/Downloader/ArchiveDownloader.php +++ b/src/Composer/Downloader/ArchiveDownloader.php @@ -69,7 +69,7 @@ abstract class ArchiveDownloader extends FileDownloader $this->filesystem->removeDirectory($temporaryDir); // retry downloading if we have an invalid zip file - if ($retries && $e instanceof \UnexpectedValueException && $e->getCode() === \ZipArchive::ER_NOZIP) { + if ($retries && $e instanceof \UnexpectedValueException && class_exists('ZipArchive') && $e->getCode() === \ZipArchive::ER_NOZIP) { $this->io->write(' Invalid zip file, retrying...'); usleep(500000); continue;