浏览代码

Force-collapse multiple slashes into one, fixes #5387

Jordi Boggiano 9 年之前
父节点
当前提交
c289776d94
共有 2 个文件被更改,包括 3 次插入1 次删除
  1. 1 1
      src/Composer/Autoload/AutoloadGenerator.php
  2. 2 0
      src/Composer/Autoload/ClassMapGenerator.php

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