From 2c1b309cd3925c3bd7c400663c905655e9698767 Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Wed, 12 Oct 2022 16:56:44 +0200 Subject: [PATCH] Add hard failure if COMPOSER_AUTH is malformed json, fixes #11085 --- src/Composer/Factory.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/Composer/Factory.php b/src/Composer/Factory.php index 453f1e9e2..40a08da1c 100644 --- a/src/Composer/Factory.php +++ b/src/Composer/Factory.php @@ -219,9 +219,7 @@ class Factory if ($composerAuthEnv = Platform::getEnv('COMPOSER_AUTH')) { $authData = json_decode($composerAuthEnv); if (null === $authData) { - if ($io instanceof IOInterface) { - $io->writeError('COMPOSER_AUTH environment variable is malformed, should be a valid JSON object'); - } + throw new \UnexpectedValueException('COMPOSER_AUTH environment variable is malformed, should be a valid JSON object'); } else { if ($io instanceof IOInterface) { $io->writeError('Loading auth config from COMPOSER_AUTH', true, IOInterface::DEBUG);