Browse Source

Force-collapse multiple slashes into one, fixes #5387

Jordi Boggiano 9 years ago
parent
commit
c289776d94

+ 1 - 1
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);

+ 2 - 0
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, '\\', '/'))) {