From adac4f3a35e2225912621093b1d07cab7c43df98 Mon Sep 17 00:00:00 2001 From: David Carlier Date: Tue, 16 Jul 2024 19:55:04 +0100 Subject: [PATCH] ext/curl: curl_error using curl_easy_strerror if CURLOPT_ERRORBUFFER did not fill the error buffer. --- ext/curl/interface.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ext/curl/interface.c b/ext/curl/interface.c index 88beb69bc6aa..994bac82f380 100644 --- a/ext/curl/interface.c +++ b/ext/curl/interface.c @@ -2626,7 +2626,11 @@ PHP_FUNCTION(curl_error) if (ch->err.no) { ch->err.str[CURL_ERROR_SIZE] = 0; - RETURN_STRING(ch->err.str); + if (strlen(ch->err.str) > 0) { + RETURN_STRING(ch->err.str); + } else { + RETURN_STRING(curl_easy_strerror(ch->err.no)); + } } else { RETURN_EMPTY_STRING(); }