From 2ae0800cd31e1a0506d78ff8abe747df8d38f0fd Mon Sep 17 00:00:00 2001 From: SpacePossum Date: Fri, 16 Sep 2016 14:50:34 +0200 Subject: [PATCH 1/2] Remove useless concat. --- src/Composer/Autoload/AutoloadGenerator.php | 9 ++++++++- .../Test/Autoload/Fixtures/autoload_functions.php | 2 +- .../Fixtures/autoload_functions_by_dependency.php | 2 +- .../Test/Autoload/Fixtures/autoload_target_dir.php | 2 +- 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/Composer/Autoload/AutoloadGenerator.php b/src/Composer/Autoload/AutoloadGenerator.php index 497df1e2a..2a66a4bf6 100644 --- a/src/Composer/Autoload/AutoloadGenerator.php +++ b/src/Composer/Autoload/AutoloadGenerator.php @@ -526,12 +526,19 @@ EOF; protected function getAutoloadFile($vendorPathToTargetDirCode, $suffix) { + $lastChar = $vendorPathToTargetDirCode[strlen($vendorPathToTargetDirCode)-1]; + if ("'" === $lastChar || '"' === $lastChar) { + $vendorPathToTargetDirCode = substr($vendorPathToTargetDirCode, 0, -1).'/autoload_real.php'.$lastChar; + } else { + $vendorPathToTargetDirCode .= " . '/autoload_real.php'"; + } + return << Date: Sat, 17 Sep 2016 13:27:29 +0200 Subject: [PATCH 2/2] Fix regex cleaning up repo URLs, fixes #5686 --- src/Composer/Repository/ComposerRepository.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Composer/Repository/ComposerRepository.php b/src/Composer/Repository/ComposerRepository.php index 78ef7430e..4cf661517 100644 --- a/src/Composer/Repository/ComposerRepository.php +++ b/src/Composer/Repository/ComposerRepository.php @@ -88,7 +88,7 @@ class ComposerRepository extends ArrayRepository implements ConfigurableReposito $this->config = $config; $this->options = $repoConfig['options']; $this->url = $repoConfig['url']; - $this->baseUrl = rtrim(preg_replace('{^(.*)(?:/[^/\\]+.json)?(?:[?#].*)?$}', '$1', $this->url), '/'); + $this->baseUrl = rtrim(preg_replace('{(?:/[^/\\\\]+\.json)?(?:[?#].*)?$}', '', $this->url), '/'); $this->io = $io; $this->cache = new Cache($io, $config->get('cache-repo-dir').'/'.preg_replace('{[^a-z0-9.]}i', '-', $this->url), 'a-z0-9.$'); $this->loader = new ArrayLoader();