Skip to content

Commit b46681d

Browse files
committed
Fix curl build failure on macOS+curl 8.16
Closes GH-19820.
1 parent d30dd1b commit b46681d

File tree

2 files changed

+14
-13
lines changed

2 files changed

+14
-13
lines changed

NEWS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ PHP NEWS
1212
- Curl:
1313
. Fix cloning of CURLOPT_POSTFIELDS when using the clone operator instead
1414
of the curl_copy_handle() function to clone a CurlHandle. (timwolla)
15+
. Fix curl build failure on macOS+curl 8.16. (nielsdos)
1516

1617
- Soap:
1718
. Fixed bug GH-19784 (SoapServer memory leak). (nielsdos)

ext/curl/interface.c

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -677,11 +677,11 @@ static int curl_fnmatch(void *ctx, const char *pattern, const char *string)
677677
/* }}} */
678678

679679
/* {{{ curl_progress */
680-
static size_t curl_progress(void *clientp, double dltotal, double dlnow, double ultotal, double ulnow)
680+
static int curl_progress(void *clientp, double dltotal, double dlnow, double ultotal, double ulnow)
681681
{
682682
php_curl *ch = (php_curl *)clientp;
683683
php_curl_callback *t = ch->handlers.progress;
684-
size_t rval = 0;
684+
int rval = 0;
685685

686686
#if PHP_CURL_DEBUG
687687
fprintf(stderr, "curl_progress() called\n");
@@ -726,11 +726,11 @@ static size_t curl_progress(void *clientp, double dltotal, double dlnow, double
726726

727727
#if LIBCURL_VERSION_NUM >= 0x072000
728728
/* {{{ curl_xferinfo */
729-
static size_t curl_xferinfo(void *clientp, curl_off_t dltotal, curl_off_t dlnow, curl_off_t ultotal, curl_off_t ulnow)
729+
static int curl_xferinfo(void *clientp, curl_off_t dltotal, curl_off_t dlnow, curl_off_t ultotal, curl_off_t ulnow)
730730
{
731731
php_curl *ch = (php_curl *)clientp;
732732
php_curl_callback *t = ch->handlers.xferinfo;
733-
size_t rval = 0;
733+
int rval = 0;
734734

735735
#if PHP_CURL_DEBUG
736736
fprintf(stderr, "curl_xferinfo() called\n");
@@ -1154,8 +1154,8 @@ static void _php_curl_set_default_options(php_curl *ch)
11541154
{
11551155
char *cainfo;
11561156

1157-
curl_easy_setopt(ch->cp, CURLOPT_NOPROGRESS, 1);
1158-
curl_easy_setopt(ch->cp, CURLOPT_VERBOSE, 0);
1157+
curl_easy_setopt(ch->cp, CURLOPT_NOPROGRESS, 1L);
1158+
curl_easy_setopt(ch->cp, CURLOPT_VERBOSE, 0L);
11591159
curl_easy_setopt(ch->cp, CURLOPT_ERRORBUFFER, ch->err.str);
11601160
curl_easy_setopt(ch->cp, CURLOPT_WRITEFUNCTION, curl_write);
11611161
curl_easy_setopt(ch->cp, CURLOPT_FILE, (void *) ch);
@@ -1164,10 +1164,10 @@ static void _php_curl_set_default_options(php_curl *ch)
11641164
curl_easy_setopt(ch->cp, CURLOPT_HEADERFUNCTION, curl_write_header);
11651165
curl_easy_setopt(ch->cp, CURLOPT_WRITEHEADER, (void *) ch);
11661166
#ifndef ZTS
1167-
curl_easy_setopt(ch->cp, CURLOPT_DNS_USE_GLOBAL_CACHE, 1);
1167+
curl_easy_setopt(ch->cp, CURLOPT_DNS_USE_GLOBAL_CACHE, 1L);
11681168
#endif
1169-
curl_easy_setopt(ch->cp, CURLOPT_DNS_CACHE_TIMEOUT, 120);
1170-
curl_easy_setopt(ch->cp, CURLOPT_MAXREDIRS, 20); /* prevent infinite redirects */
1169+
curl_easy_setopt(ch->cp, CURLOPT_DNS_CACHE_TIMEOUT, 120L);
1170+
curl_easy_setopt(ch->cp, CURLOPT_MAXREDIRS, 20L); /* prevent infinite redirects */
11711171

11721172
cainfo = INI_STR("openssl.cafile");
11731173
if (!(cainfo && cainfo[0] != '\0')) {
@@ -2278,7 +2278,7 @@ static zend_result _php_curl_setopt(php_curl *ch, zend_long option, zval *zvalue
22782278
/* no need to build the mime structure for empty hashtables;
22792279
also works around https://github.com/curl/curl/issues/6455 */
22802280
curl_easy_setopt(ch->cp, CURLOPT_POSTFIELDS, "");
2281-
error = curl_easy_setopt(ch->cp, CURLOPT_POSTFIELDSIZE, 0);
2281+
error = curl_easy_setopt(ch->cp, CURLOPT_POSTFIELDSIZE, 0L);
22822282
} else {
22832283
return build_mime_structure_from_hash(ch, zvalue);
22842284
}
@@ -2371,7 +2371,7 @@ static zend_result _php_curl_setopt(php_curl *ch, zend_long option, zval *zvalue
23712371

23722372
case CURLOPT_POSTREDIR:
23732373
lval = zval_get_long(zvalue);
2374-
error = curl_easy_setopt(ch->cp, CURLOPT_POSTREDIR, lval & CURL_REDIR_POST_ALL);
2374+
error = curl_easy_setopt(ch->cp, CURLOPT_POSTREDIR, (long) (lval & CURL_REDIR_POST_ALL));
23752375
break;
23762376

23772377
/* the following options deal with files, therefore the open_basedir check
@@ -2406,11 +2406,11 @@ static zend_result _php_curl_setopt(php_curl *ch, zend_long option, zval *zvalue
24062406
if (zend_is_true(zvalue)) {
24072407
curl_easy_setopt(ch->cp, CURLOPT_DEBUGFUNCTION, curl_debug);
24082408
curl_easy_setopt(ch->cp, CURLOPT_DEBUGDATA, (void *)ch);
2409-
curl_easy_setopt(ch->cp, CURLOPT_VERBOSE, 1);
2409+
curl_easy_setopt(ch->cp, CURLOPT_VERBOSE, 1L);
24102410
} else {
24112411
curl_easy_setopt(ch->cp, CURLOPT_DEBUGFUNCTION, NULL);
24122412
curl_easy_setopt(ch->cp, CURLOPT_DEBUGDATA, NULL);
2413-
curl_easy_setopt(ch->cp, CURLOPT_VERBOSE, 0);
2413+
curl_easy_setopt(ch->cp, CURLOPT_VERBOSE, 0L);
24142414
}
24152415
break;
24162416

0 commit comments

Comments
 (0)