From bcd8a73e8c788232359c8d79ded7a7ca10ca3c4d Mon Sep 17 00:00:00 2001 From: Christophe Coevoet Date: Tue, 22 Sep 2020 18:49:53 +0200 Subject: [PATCH 1/2] Fix support for running diagnose without openssl The diagnose command already warns when openssl is not available. But the command was failing later when displaying the Openssl version. --- src/Composer/Command/DiagnoseCommand.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Composer/Command/DiagnoseCommand.php b/src/Composer/Command/DiagnoseCommand.php index b7739ff18..94f7eaad1 100644 --- a/src/Composer/Command/DiagnoseCommand.php +++ b/src/Composer/Command/DiagnoseCommand.php @@ -172,7 +172,9 @@ EOT $io->write(sprintf('PHP binary path: %s', PHP_BINARY)); } - $io->write(sprintf('OpenSSL version: %s', OPENSSL_VERSION_TEXT)); + if (defined('OPENSSL_VERSION_TEXT') { + $io->write(sprintf('OpenSSL version: %s', OPENSSL_VERSION_TEXT)); + } return $this->exitCode; } From d6b39b4c55e206b1e500238c8bddbdc703743094 Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Thu, 24 Sep 2020 11:35:38 +0200 Subject: [PATCH 2/2] Fix syntax error & improve handling --- src/Composer/Command/DiagnoseCommand.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/Composer/Command/DiagnoseCommand.php b/src/Composer/Command/DiagnoseCommand.php index 94f7eaad1..30f82be62 100644 --- a/src/Composer/Command/DiagnoseCommand.php +++ b/src/Composer/Command/DiagnoseCommand.php @@ -172,9 +172,7 @@ EOT $io->write(sprintf('PHP binary path: %s', PHP_BINARY)); } - if (defined('OPENSSL_VERSION_TEXT') { - $io->write(sprintf('OpenSSL version: %s', OPENSSL_VERSION_TEXT)); - } + $io->write('OpenSSL version: ' . (defined('OPENSSL_VERSION_TEXT') ? ''.OPENSSL_VERSION_TEXT.'' : 'missing')); return $this->exitCode; }