Skip to content

Commit efd00b8

Browse files
committed
ext/curl: curl_error using curl_easy_strerror if CURLOPT_ERRORBUFFER
did not fill the error buffer. close GH-14984
1 parent 911dc5b commit efd00b8

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

NEWS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@ PHP NEWS
22
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
33
?? ??? ????, PHP 8.2.23
44

5+
- Curl:
6+
. Fixed case when curl_error returns an empty string.
7+
(David Carlier)
8+
59
- Soap:
610
. Fixed bug #55639 (Digest autentication dont work). (nielsdos)
711

ext/curl/interface.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2764,7 +2764,11 @@ PHP_FUNCTION(curl_error)
27642764

27652765
if (ch->err.no) {
27662766
ch->err.str[CURL_ERROR_SIZE] = 0;
2767-
RETURN_STRING(ch->err.str);
2767+
if (strlen(ch->err.str) > 0) {
2768+
RETURN_STRING(ch->err.str);
2769+
} else {
2770+
RETURN_STRING(curl_easy_strerror(ch->err.no));
2771+
}
27682772
} else {
27692773
RETURN_EMPTY_STRING();
27702774
}

0 commit comments

Comments
 (0)