diff --git a/src/Composer/Autoload/ClassMapGenerator.php b/src/Composer/Autoload/ClassMapGenerator.php index 649c700c8..5ff23921c 100644 --- a/src/Composer/Autoload/ClassMapGenerator.php +++ b/src/Composer/Autoload/ClassMapGenerator.php @@ -94,6 +94,10 @@ class ClassMapGenerator if ($blacklist && preg_match($blacklist, strtr(realpath($filePath), '\\', '/'))) { continue; } + // check non-realpath of file for directories symlink in project dir + if ($blacklist && preg_match($blacklist, strtr($filePath, '\\', '/'))) { + continue; + } $classes = self::findClasses($filePath); diff --git a/tests/Composer/Test/Autoload/AutoloadGeneratorTest.php b/tests/Composer/Test/Autoload/AutoloadGeneratorTest.php index 22ceec030..5456769b8 100644 --- a/tests/Composer/Test/Autoload/AutoloadGeneratorTest.php +++ b/tests/Composer/Test/Autoload/AutoloadGeneratorTest.php @@ -23,6 +23,7 @@ use Composer\Repository\InstalledRepositoryInterface; use Composer\Installer\InstallationManager; use Composer\Config; use Composer\EventDispatcher\EventDispatcher; +use Composer\Util\Platform; use PHPUnit_Framework_MockObject_MockObject as MockObject; class AutoloadGeneratorTest extends TestCase @@ -1292,6 +1293,7 @@ EOF; ), 'classmap' => array('composersrc/'), 'exclude-from-classmap' => array( + '/composersrc/foo/bar/', '/composersrc/excludedTests/', '/composersrc/ClassToExclude.php', '/composersrc/*/excluded/excsubpath', @@ -1326,6 +1328,18 @@ EOF; file_put_contents($this->workingDir.'/composersrc/long/excluded/excsubpath/foo.php', 'workingDir.'/composersrc/long/excluded/excsubpath/bar.php', 'fs->ensureDirectoryExists($this->workingDir.'/forks/bar/src/exclude'); + $this->fs->ensureDirectoryExists($this->workingDir.'/composersrc/foo'); + + file_put_contents($this->workingDir.'/forks/bar/src/exclude/FooExclClass.php', 'workingDir.'/forks/bar/'; + $link = $this->workingDir.'/composersrc/foo/bar/'; + $command = Platform::isWindows() + ? 'mklink /j "' . str_replace('/', '\\', $link) . '" "' . str_replace('/', '\\', $target) + : 'ln -s "' . $target . '" "' . $link; + exec($command); + $this->generator->dump($this->config, $this->repository, $package, $this->im, 'composer', true, '_1'); // Assert that autoload_classmap.php was correctly generated.