From 98a588eb908f6abb08949cb2cb23693d9a2b8da7 Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Sun, 3 Sep 2023 11:13:54 +0200 Subject: [PATCH] Avoid COMPOSER env being set if not necessary as it can cause issues with scripts, fixes #11613, refs #11493 --- src/Composer/Command/CreateProjectCommand.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Composer/Command/CreateProjectCommand.php b/src/Composer/Command/CreateProjectCommand.php index 920b74f88..f0bb7dbb5 100644 --- a/src/Composer/Command/CreateProjectCommand.php +++ b/src/Composer/Command/CreateProjectCommand.php @@ -472,8 +472,8 @@ EOT // 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'); + if (file_exists($directory.'/composer.json') && Platform::getEnv('COMPOSER') !== false) { + Platform::clearEnv('COMPOSER'); } Platform::putEnv('COMPOSER_ROOT_VERSION', $package->getPrettyVersion());