From 07016fe3268ccefcad976b8b09007ad1429b5c24 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Mirtes?= Date: Fri, 26 Aug 2022 15:01:28 +0200 Subject: [PATCH] Config - always respect COMPOSER_DISCARD_CHANGES --- src/Composer/Config.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Composer/Config.php b/src/Composer/Config.php index eb4999fda..4af2842a3 100644 --- a/src/Composer/Config.php +++ b/src/Composer/Config.php @@ -389,7 +389,8 @@ class Config return $value; case 'discard-changes': - if ($env = $this->getComposerEnv('COMPOSER_DISCARD_CHANGES')) { + $env = $this->getComposerEnv('COMPOSER_DISCARD_CHANGES'); + if ($env !== false) { if (!in_array($env, array('stash', 'true', 'false', '1', '0'), true)) { throw new \RuntimeException( "Invalid value for COMPOSER_DISCARD_CHANGES: {$env}. Expected 1, 0, true, false or stash" @@ -551,7 +552,7 @@ class Config * that overload config values. * * @param string $var - * @return string|bool + * @return string|false */ private function getComposerEnv($var) {