From 44a2aa9be4d1c9b9fc45ce2882cdd058ee95137a Mon Sep 17 00:00:00 2001 From: Joseph Wynn <31634862+josephwynn-sc@users.noreply.github.com> Date: Wed, 27 Oct 2021 20:40:20 +1300 Subject: [PATCH] Log when COMPOSER_AUTH environment variable is malformed, but do not throw an error. Fixes #10208. (#10209) Co-authored-by: Joseph Wynn --- src/Composer/Factory.php | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/Composer/Factory.php b/src/Composer/Factory.php index 2cbf6e3f0..d714b3702 100644 --- a/src/Composer/Factory.php +++ b/src/Composer/Factory.php @@ -230,13 +230,15 @@ class Factory $authData = json_decode($composerAuthEnv, true); if (null === $authData) { - throw new \UnexpectedValueException('COMPOSER_AUTH environment variable is malformed, should be a valid JSON object'); + if ($io) { + $io->writeError('COMPOSER_AUTH environment variable is malformed, should be a valid JSON object'); + } + } else { + if ($io && $io->isDebug()) { + $io->writeError('Loading auth config from COMPOSER_AUTH'); + } + $config->merge(array('config' => $authData)); } - - if ($io && $io->isDebug()) { - $io->writeError('Loading auth config from COMPOSER_AUTH'); - } - $config->merge(array('config' => $authData)); } return $config;