diff --git a/src/Composer/Autoload/AutoloadGenerator.php b/src/Composer/Autoload/AutoloadGenerator.php index c70c20f36..0d3e15ad6 100644 --- a/src/Composer/Autoload/AutoloadGenerator.php +++ b/src/Composer/Autoload/AutoloadGenerator.php @@ -690,6 +690,10 @@ FOOTER; // first escape user input $path = preg_quote(trim(strtr($path, '\\', '/'), '/')); + // add support for wildcards * and ** + $path = str_replace('\\*\\*', '.*?', $path); + $path = str_replace('\\*', '[^/]*?', $path); + $autoloads[] = empty($installPath) ? preg_quote(strtr(getcwd(), '\\', '/')) . '/' . $path : preg_quote($installPath) . '/' . $path; continue; } diff --git a/tests/Composer/Test/Autoload/AutoloadGeneratorTest.php b/tests/Composer/Test/Autoload/AutoloadGeneratorTest.php index 0e373702b..8afe87c3b 100644 --- a/tests/Composer/Test/Autoload/AutoloadGeneratorTest.php +++ b/tests/Composer/Test/Autoload/AutoloadGeneratorTest.php @@ -1274,7 +1274,12 @@ EOF; 'Acme\Cake\\' => array('src-cake/', 'lib-cake/'), ), 'classmap' => array('composersrc/'), - 'exclude-from-classmap' => array('/composersrc/excludedTests/', '/composersrc/ClassToExclude.php'), + 'exclude-from-classmap' => array( + '/composersrc/excludedTests/', + '/composersrc/ClassToExclude.php', + '/composersrc/*/excluded/excsubpath', + '**/excsubpath', + ), )); $this->repository->expects($this->once()) @@ -1300,6 +1305,9 @@ EOF; $this->fs->ensureDirectoryExists($this->workingDir.'/composersrc/excludedTests'); file_put_contents($this->workingDir.'/composersrc/excludedTests/bar.php', 'workingDir.'/composersrc/ClassToExclude.php', 'fs->ensureDirectoryExists($this->workingDir.'/composersrc/long/excluded/excsubpath'); + file_put_contents($this->workingDir.'/composersrc/long/excluded/excsubpath/foo.php', 'workingDir.'/composersrc/long/excluded/excsubpath/bar.php', 'generator->dump($this->config, $this->repository, $package, $this->im, 'composer', true, '_1');