From 43273c43667ddde999da7d72b469cd244e302181 Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Tue, 31 May 2016 19:19:14 +0100 Subject: [PATCH 1/3] Fix plugin bootstrapping to ignore SSL Exceptions, fixes #5388 --- src/Composer/Console/Application.php | 16 +++++++++++----- src/Composer/Exception/NoSslException.php | 20 ++++++++++++++++++++ src/Composer/Factory.php | 2 +- 3 files changed, 32 insertions(+), 6 deletions(-) create mode 100644 src/Composer/Exception/NoSslException.php diff --git a/src/Composer/Console/Application.php b/src/Composer/Console/Application.php index f3743c2f6..051e087a6 100644 --- a/src/Composer/Console/Application.php +++ b/src/Composer/Console/Application.php @@ -27,6 +27,7 @@ use Composer\IO\IOInterface; use Composer\IO\ConsoleIO; use Composer\Json\JsonValidationException; use Composer\Util\ErrorHandler; +use Composer\Exception\NoSslException; /** * The console application that handles the commands @@ -126,13 +127,18 @@ class Application extends BaseApplication } if (!$input->hasParameterOption('--no-plugins') && !$this->hasPluginCommands && 'global' !== $commandName) { - foreach ($this->getPluginCommands() as $command) { - if ($this->has($command->getName())) { - $io->writeError('Plugin command '.$command->getName().' ('.get_class($command).') would override a Composer command and has been skipped'); - } else { - $this->add($command); + try { + foreach ($this->getPluginCommands() as $command) { + if ($this->has($command->getName())) { + $io->writeError('Plugin command '.$command->getName().' ('.get_class($command).') would override a Composer command and has been skipped'); + } else { + $this->add($command); + } } + } catch (NoSslException $e) { + // suppress these as they are not relevant at this point } + $this->hasPluginCommands = true; } diff --git a/src/Composer/Exception/NoSslException.php b/src/Composer/Exception/NoSslException.php new file mode 100644 index 000000000..017cac382 --- /dev/null +++ b/src/Composer/Exception/NoSslException.php @@ -0,0 +1,20 @@ + + * Jordi Boggiano + * + * 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 + */ +class NoSslException extends \RuntimeException +{ +} diff --git a/src/Composer/Factory.php b/src/Composer/Factory.php index 1e594900c..8d847840c 100644 --- a/src/Composer/Factory.php +++ b/src/Composer/Factory.php @@ -569,7 +569,7 @@ class Factory $warned = true; $disableTls = true; } 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.'); } $remoteFilesystemOptions = array(); From c289776d94382fa696de50191a08f0c2e47b9b2f Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Tue, 31 May 2016 19:37:26 +0100 Subject: [PATCH 2/3] Force-collapse multiple slashes into one, fixes #5387 --- src/Composer/Autoload/AutoloadGenerator.php | 2 +- src/Composer/Autoload/ClassMapGenerator.php | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Composer/Autoload/AutoloadGenerator.php b/src/Composer/Autoload/AutoloadGenerator.php index cf2593d86..51663e97b 100644 --- a/src/Composer/Autoload/AutoloadGenerator.php +++ b/src/Composer/Autoload/AutoloadGenerator.php @@ -810,7 +810,7 @@ INITIALIZER; if ($type === 'exclude-from-classmap') { // first escape user input - $path = preg_quote(trim(strtr($path, '\\', '/'), '/')); + $path = preg_replace('{/+}', '/', preg_quote(trim(strtr($path, '\\', '/'), '/'))); // add support for wildcards * and ** $path = str_replace('\\*\\*', '.+?', $path); diff --git a/src/Composer/Autoload/ClassMapGenerator.php b/src/Composer/Autoload/ClassMapGenerator.php index 5eed9523c..d902ae230 100644 --- a/src/Composer/Autoload/ClassMapGenerator.php +++ b/src/Composer/Autoload/ClassMapGenerator.php @@ -86,6 +86,8 @@ class ClassMapGenerator if (!$filesystem->isAbsolutePath($filePath)) { $filePath = $cwd . '/' . $filePath; $filePath = $filesystem->normalizePath($filePath); + } else { + $filePath = preg_replace('{[\\\\/]{2,}}', '/', $filePath); } if ($blacklist && preg_match($blacklist, strtr($filePath, '\\', '/'))) { From 50b101414eab2d845e3283b19879b35557bf53ae Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Tue, 31 May 2016 19:47:41 +0100 Subject: [PATCH 3/3] Update changelog --- CHANGELOG.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8fba689a8..e6d49c7b6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +### [1.1.2] - 2016-05-31 + + * Fixed degraded mode issue when accessing packagist.org + * Fixed GitHub access_token being added on subsequent requests in case of redirections + * Fixed exclude-from-classmap not working in some circumstances + * Fixed openssl warning preventing the use of config command for disabling tls + ### [1.1.1] - 2016-05-17 * Fixed regression in handling of #reference which made it update every time @@ -390,6 +397,7 @@ * Initial release +[1.1.2]: https://github.com/composer/composer/compare/1.1.1...1.1.2 [1.1.1]: https://github.com/composer/composer/compare/1.1.0...1.1.1 [1.1.0]: https://github.com/composer/composer/compare/1.0.3...1.1.0 [1.1.0-RC]: https://github.com/composer/composer/compare/1.0.3...1.1.0-RC