diff --git a/src/Composer/Command/CreateProjectCommand.php b/src/Composer/Command/CreateProjectCommand.php index 6037a9803..920b74f88 100644 --- a/src/Composer/Command/CreateProjectCommand.php +++ b/src/Composer/Command/CreateProjectCommand.php @@ -469,6 +469,13 @@ EOT $io->writeError('Created project in ' . $directory . ''); chdir($directory); + // ensure that the env var being set does not interfere with create-project + // as it is probably not meant to be used here, so we do not use it if a composer.json can be found + // in the project + if (file_exists($directory.'/composer.json')) { + Platform::putEnv('COMPOSER', $directory.'/composer.json'); + } + Platform::putEnv('COMPOSER_ROOT_VERSION', $package->getPrettyVersion()); // once the root project is fully initialized, we do not need to wipe everything on user abort anymore even if it happens during deps install