Browse Source

Fix exclude-from-classmap handling to avoid foo matching foo* directories, fixes #8563, refs #8575

Jordi Boggiano 5 years ago
parent
commit
4d74f5ba95

+ 1 - 1
src/Composer/Autoload/AutoloadGenerator.php

@@ -901,7 +901,7 @@ INITIALIZER;
                         }
 
                         $resolvedPath = realpath($installPath . '/' . $updir);
-                        $autoloads[] = preg_quote(strtr($resolvedPath, '\\', '/')) . '/' . $path;
+                        $autoloads[] = preg_quote(strtr($resolvedPath, '\\', '/')) . '/' . $path . '($|/)';
                         continue;
                     }
 

+ 2 - 2
tests/Composer/Test/Autoload/AutoloadGeneratorTest.php

@@ -1525,8 +1525,8 @@ EOF;
                 '/composersrc/ClassToExclude.php',
                 '/composersrc/*/excluded/excsubpath',
                 '**/excsubpath',
-                'composers',    // should _not_ cause exclusion of /composersrc/**
-                '/src-ca/',     // should _not_ cause exclusion of /src-cake/**
+                'composers',    // should _not_ cause exclusion of /composersrc/**, as it is equivalent to /composers/**
+                '/src-ca/',     // should _not_ cause exclusion of /src-cake/**, as it is equivalent to /src-ca/**
             ),
         ));