From efd00b8ff05cb78ecb0351b96cce7780bcb72a2a 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. close GH-14984 --- NEWS | 4 ++++ ext/curl/interface.c | 6 +++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index 01073cf61ed..e82ffc50426 100644 --- a/NEWS +++ b/NEWS @@ -2,6 +2,10 @@ PHP NEWS ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| ?? ??? ????, PHP 8.2.23 +- Curl: + . Fixed case when curl_error returns an empty string. + (David Carlier) + - Soap: . Fixed bug #55639 (Digest autentication dont work). (nielsdos) diff --git a/ext/curl/interface.c b/ext/curl/interface.c index 707f4e0a6fc..4884ddc8228 100644 --- a/ext/curl/interface.c +++ b/ext/curl/interface.c @@ -2764,7 +2764,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(); }