diff --git a/bin/composer b/bin/composer index a884abbb2..7a80288b6 100755 --- a/bin/composer +++ b/bin/composer @@ -5,6 +5,7 @@ if (PHP_SAPI !== 'cli') { echo 'Warning: Composer should be invoked via the CLI version of PHP, not the '.PHP_SAPI.' SAPI'.PHP_EOL; } +setlocale(LC_ALL, 'C'); require __DIR__.'/../src/bootstrap.php'; use Composer\Console\Application; diff --git a/src/Composer/Autoload/ClassMapGenerator.php b/src/Composer/Autoload/ClassMapGenerator.php index 5ff23921c..5d937433b 100644 --- a/src/Composer/Autoload/ClassMapGenerator.php +++ b/src/Composer/Autoload/ClassMapGenerator.php @@ -179,6 +179,10 @@ class ClassMapGenerator if (false !== $pos && false === strpos(substr($contents, $pos), 'hasPackage($package) && is_readable($this->getInstallPath($package)); + if (!$repo->hasPackage($package)) { + return false; + } + + $installPath = $this->getInstallPath($package); + + if (is_readable($installPath)) { + return true; + } + + return (Platform::isWindows() && $this->filesystem->isJunction($installPath)) || is_link($installPath); } /** diff --git a/src/Composer/Util/Filesystem.php b/src/Composer/Util/Filesystem.php index 9e0e37279..2daa1ceb1 100644 --- a/src/Composer/Util/Filesystem.php +++ b/src/Composer/Util/Filesystem.php @@ -103,6 +103,10 @@ class Filesystem return $this->removeJunction($directory); } + if (is_link($directory)) { + return unlink($directory); + } + if (!file_exists($directory) || !is_dir($directory)) { return true; } diff --git a/tests/Composer/Test/Autoload/AutoloadGeneratorTest.php b/tests/Composer/Test/Autoload/AutoloadGeneratorTest.php index c676263a8..75cbcd058 100644 --- a/tests/Composer/Test/Autoload/AutoloadGeneratorTest.php +++ b/tests/Composer/Test/Autoload/AutoloadGeneratorTest.php @@ -1334,10 +1334,10 @@ EOF; file_put_contents($this->workingDir.'/forks/bar/src/exclude/FooExclClass.php', 'workingDir.'/forks/bar/'; - $link = $this->workingDir.'/composersrc/foo/bar/'; + $link = $this->workingDir.'/composersrc/foo/bar'; $command = Platform::isWindows() - ? 'mklink /j "' . str_replace('/', '\\', $link) . '" "' . str_replace('/', '\\', $target) - : 'ln -s "' . $target . '" "' . $link; + ? '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'); diff --git a/tests/Composer/Test/Autoload/ClassMapGeneratorTest.php b/tests/Composer/Test/Autoload/ClassMapGeneratorTest.php index 277864a2e..05f0d0530 100644 --- a/tests/Composer/Test/Autoload/ClassMapGeneratorTest.php +++ b/tests/Composer/Test/Autoload/ClassMapGeneratorTest.php @@ -62,14 +62,6 @@ class ClassMapGeneratorTest extends TestCase 'ShortOpenTagDocblock' => realpath(__DIR__) . '/Fixtures/classmap/ShortOpenTagDocblock.php', ); - /** - * @wontfix If short_open_tag is not enabled, we end up parsing the docblock because - * php_strip_whitespace won't recognize the file. Funky edge-case (does not apply to HHVM). - */ - if (!defined('HHVM_VERSION') && !ini_get('short_open_tag')) { - $classmap['description'] = realpath(__DIR__) . '/Fixtures/classmap/ShortOpenTagDocblock.php'; - } - $data = array( array(__DIR__ . '/Fixtures/Namespaced', array( 'Namespaced\\Bar' => realpath(__DIR__) . '/Fixtures/Namespaced/Bar.inc', diff --git a/tests/Composer/Test/Autoload/Fixtures/classmap/ShortOpenTagDocblock.php b/tests/Composer/Test/Autoload/Fixtures/classmap/ShortOpenTagDocblock.php index 72464eaf7..0142ca45e 100644 --- a/tests/Composer/Test/Autoload/Fixtures/classmap/ShortOpenTagDocblock.php +++ b/tests/Composer/Test/Autoload/Fixtures/classmap/ShortOpenTagDocblock.php @@ -2,4 +2,5 @@ /** * Some class description here. */ +// other class name in comment class ShortOpenTagDocblock {}