|
|
@ -25,6 +25,7 @@ use Symfony\Component\Console\Formatter\OutputFormatterStyle;
|
|
|
|
use Composer\EventDispatcher\EventDispatcher;
|
|
|
|
use Composer\EventDispatcher\EventDispatcher;
|
|
|
|
use Composer\Autoload\AutoloadGenerator;
|
|
|
|
use Composer\Autoload\AutoloadGenerator;
|
|
|
|
use Composer\Semver\VersionParser;
|
|
|
|
use Composer\Semver\VersionParser;
|
|
|
|
|
|
|
|
use Composer\Downloader\TransportException;
|
|
|
|
use Seld\JsonLint\JsonParser;
|
|
|
|
use Seld\JsonLint\JsonParser;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
@ -174,7 +175,7 @@ class Factory
|
|
|
|
if (!isset($repo['type'])) {
|
|
|
|
if (!isset($repo['type'])) {
|
|
|
|
throw new \UnexpectedValueException('Repository "'.$index.'" ('.json_encode($repo).') must have a type defined');
|
|
|
|
throw new \UnexpectedValueException('Repository "'.$index.'" ('.json_encode($repo).') must have a type defined');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$name = is_int($index) && isset($repo['url']) ? preg_replace('{^https?://}i', '', $repo['url']) : $index; //CHECK: Why is scheme stripped?
|
|
|
|
$name = is_int($index) && isset($repo['url']) ? preg_replace('{^https?://}i', '', $repo['url']) : $index;
|
|
|
|
while (isset($repos[$name])) {
|
|
|
|
while (isset($repos[$name])) {
|
|
|
|
$name .= '2';
|
|
|
|
$name .= '2';
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -205,6 +206,8 @@ class Factory
|
|
|
|
$localConfig = static::getComposerFile();
|
|
|
|
$localConfig = static::getComposerFile();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$rfs = Factory::createRemoteFilesystem($io);
|
|
|
|
|
|
|
|
|
|
|
|
if (is_string($localConfig)) {
|
|
|
|
if (is_string($localConfig)) {
|
|
|
|
$composerFile = $localConfig;
|
|
|
|
$composerFile = $localConfig;
|
|
|
|
|
|
|
|
|
|
|
@ -516,12 +519,12 @@ class Factory
|
|
|
|
public static function createRemoteFilesystem(IOInterface $io, Config $config = null, $options = array())
|
|
|
|
public static function createRemoteFilesystem(IOInterface $io, Config $config = null, $options = array())
|
|
|
|
{
|
|
|
|
{
|
|
|
|
$disableTls = false;
|
|
|
|
$disableTls = false;
|
|
|
|
if ((isset($config) && $config->get('disable-tls') === true) || $io->getInputOption('disable-tls')) {
|
|
|
|
if (isset($config) && $config->get('disable-tls') === true) {
|
|
|
|
$io->write('<warning>You are running Composer with SSL/TLS protection disabled.</warning>');
|
|
|
|
$io->write('<warning>You are running Composer with SSL/TLS protection disabled.</warning>');
|
|
|
|
$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 \RuntimeException('The openssl extension is required for SSL/TLS protection but is not available. '
|
|
|
|
. '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();
|
|
|
|
if ($disableTls === false) {
|
|
|
|
if ($disableTls === false) {
|
|
|
@ -533,7 +536,7 @@ class Factory
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
$remoteFilesystem = new RemoteFilesystem($io, $config, $remoteFilesystemOptions, $disableTls);
|
|
|
|
$remoteFilesystem = new RemoteFilesystem($io, $config, $remoteFilesystemOptions, $disableTls);
|
|
|
|
} catch (TransportException $e) {
|
|
|
|
} catch (TransportException $e) {
|
|
|
|
if (preg_match('|cafile|', $e->getMessage())) {
|
|
|
|
if (preg_match('{cafile}', $e->getMessage())) {
|
|
|
|
$io->write('<error>Unable to locate a valid CA certificate file. You must set a valid \'cafile\' option.</error>');
|
|
|
|
$io->write('<error>Unable to locate a valid CA certificate file. You must set a valid \'cafile\' option.</error>');
|
|
|
|
$io->write('<error>A valid CA certificate file is required for SSL/TLS protection.</error>');
|
|
|
|
$io->write('<error>A valid CA certificate file is required for SSL/TLS protection.</error>');
|
|
|
|
if (PHP_VERSION_ID < 50600) {
|
|
|
|
if (PHP_VERSION_ID < 50600) {
|
|
|
|