From c289776d94382fa696de50191a08f0c2e47b9b2f Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Tue, 31 May 2016 19:37:26 +0100 Subject: [PATCH] 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, '\\', '/'))) {