From ebd0a60411cd736eff89f649a6ca50f464ca3fb4 Mon Sep 17 00:00:00 2001 From: Andreas Schempp Date: Wed, 7 Jun 2023 12:44:50 +0200 Subject: [PATCH] Force CreateProjectCommand to use the installed composer.json (#11493) --- src/Composer/Command/CreateProjectCommand.php | 7 +++++++ 1 file changed, 7 insertions(+) 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