1
0
Fork 0

Fix plugin bootstrapping to ignore SSL Exceptions, fixes #5388

pull/5383/merge
Jordi Boggiano 2016-05-31 19:19:14 +01:00
parent 3ac822d5e2
commit 43273c4366
3 changed files with 32 additions and 6 deletions

View File

@ -27,6 +27,7 @@ use Composer\IO\IOInterface;
use Composer\IO\ConsoleIO; use Composer\IO\ConsoleIO;
use Composer\Json\JsonValidationException; use Composer\Json\JsonValidationException;
use Composer\Util\ErrorHandler; use Composer\Util\ErrorHandler;
use Composer\Exception\NoSslException;
/** /**
* The console application that handles the commands * The console application that handles the commands
@ -126,6 +127,7 @@ class Application extends BaseApplication
} }
if (!$input->hasParameterOption('--no-plugins') && !$this->hasPluginCommands && 'global' !== $commandName) { if (!$input->hasParameterOption('--no-plugins') && !$this->hasPluginCommands && 'global' !== $commandName) {
try {
foreach ($this->getPluginCommands() as $command) { foreach ($this->getPluginCommands() as $command) {
if ($this->has($command->getName())) { if ($this->has($command->getName())) {
$io->writeError('<warning>Plugin command '.$command->getName().' ('.get_class($command).') would override a Composer command and has been skipped</warning>'); $io->writeError('<warning>Plugin command '.$command->getName().' ('.get_class($command).') would override a Composer command and has been skipped</warning>');
@ -133,6 +135,10 @@ class Application extends BaseApplication
$this->add($command); $this->add($command);
} }
} }
} catch (NoSslException $e) {
// suppress these as they are not relevant at this point
}
$this->hasPluginCommands = true; $this->hasPluginCommands = true;
} }

View File

@ -0,0 +1,20 @@
<?php
/*
* This file is part of Composer.
*
* (c) Nils Adermann <naderman@naderman.de>
* Jordi Boggiano <j.boggiano@seld.be>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Composer\Exception;
/**
* @author Jordi Boggiano <j.boggiano@seld.be>
*/
class NoSslException extends \RuntimeException
{
}

View File

@ -569,7 +569,7 @@ class Factory
$warned = true; $warned = true;
$disableTls = true; $disableTls = true;
} elseif (!extension_loaded('openssl')) { } elseif (!extension_loaded('openssl')) {
throw new \RuntimeException('The openssl extension is required for SSL/TLS protection but is not available. ' throw new Exception\NoSslException('The openssl extension is required for SSL/TLS protection but is not available. '
. 'If you can not enable the openssl extension, you can disable this error, at your own risk, by setting the \'disable-tls\' option to true.'); . 'If you can not enable the openssl extension, you can disable this error, at your own risk, by setting the \'disable-tls\' option to true.');
} }
$remoteFilesystemOptions = array(); $remoteFilesystemOptions = array();