From 5248d6c9f18fd81335937a96ed48c69a7fca1f7a Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Wed, 18 Nov 2020 21:36:33 +0100 Subject: [PATCH] Improve curl error reporting some more --- src/Composer/Util/Http/CurlDownloader.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Composer/Util/Http/CurlDownloader.php b/src/Composer/Util/Http/CurlDownloader.php index 5fe3a86fc..22386e0e1 100644 --- a/src/Composer/Util/Http/CurlDownloader.php +++ b/src/Composer/Util/Http/CurlDownloader.php @@ -299,7 +299,10 @@ class CurlDownloader try { // TODO progress if (CURLE_OK !== $errno || $error) { - throw new TransportException('curl error while downloading '.Url::sanitize($progress['url']).': '.($error ?: '#'.$errno)); + if (!$error && function_exists('curl_strerror')) { + $error = curl_strerror($errno); + } + throw new TransportException('curl error '.$errno.' while downloading '.Url::sanitize($progress['url']).': '.$error); } $statusCode = $progress['http_code'];