From 1192f3643af56ac10b727f4771fe3a74692d2d6e Mon Sep 17 00:00:00 2001 From: Alain Schlesser Date: Mon, 28 May 2018 13:08:56 +0200 Subject: [PATCH] Extract SSL certificate from Phar first before using it in Composer --- src/Package_Command.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Package_Command.php b/src/Package_Command.php index e2dee2c53..019681104 100644 --- a/src/Package_Command.php +++ b/src/Package_Command.php @@ -77,6 +77,7 @@ class Package_Command extends WP_CLI_Command { const PACKAGE_INDEX_URL = 'https://wp-cli.org/package-index/'; + const SSL_CERTIFICATE = '/rmccue/requests/library/Requests/Transport/cacert.pem'; private $pool = false; @@ -1072,7 +1073,8 @@ private function set_composer_auth_env_var() { */ private function avoid_composer_ca_bundle() { if ( Utils\inside_phar() && ! getenv( 'SSL_CERT_FILE' ) && ! getenv( 'SSL_CERT_DIR' ) && ! ini_get( 'openssl.cafile' ) && ! ini_get( 'openssl.capath' ) ) { - putenv( 'SSL_CERT_FILE=phar://wp-cli.phar/vendor/rmccue/requests/library/Requests/Transport/cacert.pem' ); + $certificate = Utils\extract_from_phar( WP_CLI_VENDOR_DIR . self::SSL_CERTIFICATE ); + putenv( "SSL_CERT_FILE={$certificate}" ); } }