diff --git a/bin/compile b/bin/compile index 59e420f3a..1e2e4be1c 100755 --- a/bin/compile +++ b/bin/compile @@ -4,16 +4,28 @@ $cwd = getcwd(); assert(is_string($cwd)); chdir(__DIR__.'/../'); -$ts = rtrim(shell_exec('git log -n1 --pretty=%ct HEAD')); +$ts = rtrim(exec('git log -n1 --pretty=%ct HEAD')); if (!is_numeric($ts)) { echo 'Could not detect date using "git log -n1 --pretty=%ct HEAD"'.PHP_EOL; exit(1); } // Install with the current version to force it having the right ClassLoader version // Install without dev packages to clean up the included classmap from phpunit classes -shell_exec('php bin/composer config autoloader-suffix ComposerPhar' . $ts); -shell_exec('php bin/composer install -q --no-dev'); -shell_exec('php bin/composer config autoloader-suffix --unset'); +exec('php bin/composer config autoloader-suffix ComposerPhar' . $ts, $output, $result); +if (0 !== $result) { + echo 'Could not set the autoloader suffix, make sure exec is allowed and php can be found in your PATH'; + exit(1); +} +exec('php bin/composer install -q --no-dev', $output, $result); +if (0 !== $result) { + echo 'Could not remove dev deps, make sure exec is allowed and php can be found in your PATH'; + exit(1); +} +exec('php bin/composer config autoloader-suffix --unset', $output, $result); +if (0 !== $result) { + echo 'Could not remove the autoloader suffix, make sure exec is allowed and php can be found in your PATH'; + exit(1); +} chdir($cwd); require __DIR__.'/../src/bootstrap.php'; diff --git a/src/Composer/Command/ConfigCommand.php b/src/Composer/Command/ConfigCommand.php index b20a4ba81..56ccb5b5e 100644 --- a/src/Composer/Command/ConfigCommand.php +++ b/src/Composer/Command/ConfigCommand.php @@ -185,7 +185,7 @@ EOT $authConfigFile = $input->getOption('global') ? ($this->config->get('home') . '/auth.json') - : dirname(realpath($configFile)) . '/auth.json'; + : dirname($configFile) . '/auth.json'; $this->authConfigFile = new JsonFile($authConfigFile, null, $io); $this->authConfigSource = new JsonConfigSource($this->authConfigFile, true); diff --git a/tests/Composer/Test/Autoload/AutoloadGeneratorTest.php b/tests/Composer/Test/Autoload/AutoloadGeneratorTest.php index 51ac10a8e..5eaa8ee80 100644 --- a/tests/Composer/Test/Autoload/AutoloadGeneratorTest.php +++ b/tests/Composer/Test/Autoload/AutoloadGeneratorTest.php @@ -1597,7 +1597,10 @@ EOF; )); $map = $this->generator->buildPackageMap($this->im, $package, array($dep)); $parsed = $this->generator->parseAutoloads($map, $package); - $this->assertSame(array(preg_quote(dirname($this->workingDir)).'/excludedroot($|/)', preg_quote($this->workingDir).'/root/excl($|/)'), $parsed['exclude-from-classmap']); + $this->assertSame(array( + preg_quote(strtr((string) realpath(dirname($this->workingDir)), '\\', '/')).'/excludedroot($|/)', + preg_quote(strtr((string) realpath($this->workingDir), '\\', '/')).'/root/excl($|/)' + ), $parsed['exclude-from-classmap']); } public function testEmptyPaths(): void