From 0f94dcd848512a284ede8095732902db894712a5 Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Tue, 8 Aug 2017 18:29:20 +0200 Subject: [PATCH] Fix composer global config handling --- src/Composer/Command/ConfigCommand.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Composer/Command/ConfigCommand.php b/src/Composer/Command/ConfigCommand.php index ca8d4491e..eb7a3ff1f 100644 --- a/src/Composer/Command/ConfigCommand.php +++ b/src/Composer/Command/ConfigCommand.php @@ -149,7 +149,11 @@ EOT : ($input->getOption('file') ?: Factory::getComposerFile()); // Create global composer.json if this was invoked using `composer global config` - if ($configFile === 'composer.json' && !file_exists($configFile) && realpath(getcwd()) === realpath($this->config->get('home'))) { + if ( + ($configFile === 'composer.json' || $configFile === './composer.json') + && !file_exists($configFile) + && realpath(getcwd()) === realpath($this->config->get('home')) + ) { file_put_contents($configFile, "{\n}\n"); }