From 159bb84fa63c30cf9289d4698458e442c5d0ee1b Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Mon, 12 Oct 2020 08:16:31 +0200 Subject: [PATCH] Allow running the config command to disable tls even if openssl is not present, fixes #9198 --- src/Composer/Factory.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Composer/Factory.php b/src/Composer/Factory.php index 8a0ff1e2d..acb483294 100644 --- a/src/Composer/Factory.php +++ b/src/Composer/Factory.php @@ -586,7 +586,11 @@ class Factory { static $warned = false; $disableTls = false; - if ($config && $config->get('disable-tls') === true) { + // allow running the config command if disable-tls is in the arg list, even if openssl is missing, to allow disabling it via the config command + if (isset($_SERVER['argv']) && in_array('disable-tls', $_SERVER['argv']) && (in_array('conf', $_SERVER['argv']) || in_array('config', $_SERVER['argv']))) { + $warned = true; + $disableTls = !extension_loaded('openssl'); + } elseif ($config && $config->get('disable-tls') === true) { if (!$warned) { $io->writeError('You are running Composer with SSL/TLS protection disabled.'); }