1
0
Fork 0

Fix the ZipDownloader to catch the exceptions thrown in Symfony process.

The problem was introduced in 72d4bea8 and causes composer to not fallback
to ZipArchive when unzip can not be executed (i.e. when proc_open() is
not allowed).
pull/3002/head
Christian Schiffler 2014-05-20 10:15:44 +02:00
parent fff913d6de
commit 7cec839d30
1 changed files with 10 additions and 4 deletions

View File

@ -39,12 +39,18 @@ class ZipDownloader extends ArchiveDownloader
// try to use unzip on *nix
if (!defined('PHP_WINDOWS_VERSION_BUILD')) {
$command = 'unzip '.escapeshellarg($file).' -d '.escapeshellarg($path) . ' && chmod -R u+w ' . escapeshellarg($path);
try {
if (0 === $this->process->execute($command, $ignoredOutput)) {
return;
}
$processError = 'Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput();
}
catch(\Exception $e)
{
$processError = $e->getMessage();
}
}
if (!class_exists('ZipArchive')) {
// php.ini path is added to the error message to help users find the correct file