From 6c3ba3322421567941cd2734cd6b6599cab045f6 Mon Sep 17 00:00:00 2001 From: Sjoerd Langkemper Date: Tue, 21 Jul 2026 09:03:45 +0000 Subject: [PATCH 1/2] Set curl post size using CURLOPT_POSTFIELDSIZE_LARGE This is a 64-bit number on all platforms. This improves support of posting files larger than 2GB. - https://curl.se/libcurl/c/CURLOPT_POSTFIELDSIZE.html - https://curl.se/libcurl/c/CURLOPT_POSTFIELDSIZE_LARGE.html --- ext/curl/interface.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ext/curl/interface.c b/ext/curl/interface.c index d5d20d825652..17b381127716 100644 --- a/ext/curl/interface.c +++ b/ext/curl/interface.c @@ -2170,7 +2170,7 @@ static zend_result _php_curl_setopt(php_curl *ch, zend_long option, zval *zvalue /* no need to build the mime structure for empty hashtables; also works around https://github.com/curl/curl/issues/6455 */ curl_easy_setopt(ch->cp, CURLOPT_POSTFIELDS, ""); - error = curl_easy_setopt(ch->cp, CURLOPT_POSTFIELDSIZE, 0L); + error = curl_easy_setopt(ch->cp, CURLOPT_POSTFIELDSIZE_LARGE, 0L); } else { return build_mime_structure_from_hash(ch, zvalue); } @@ -2178,7 +2178,7 @@ static zend_result _php_curl_setopt(php_curl *ch, zend_long option, zval *zvalue zend_string *tmp_str; zend_string *str = zval_get_tmp_string(zvalue, &tmp_str); /* with curl 7.17.0 and later, we can use COPYPOSTFIELDS, but we have to provide size before */ - error = curl_easy_setopt(ch->cp, CURLOPT_POSTFIELDSIZE, ZSTR_LEN(str)); + error = curl_easy_setopt(ch->cp, CURLOPT_POSTFIELDSIZE_LARGE, ZSTR_LEN(str)); error = curl_easy_setopt(ch->cp, CURLOPT_COPYPOSTFIELDS, ZSTR_VAL(str)); zend_tmp_string_release(tmp_str); } From 65ae274000b0e4d8352aa290ce442def7682c8bf Mon Sep 17 00:00:00 2001 From: Sjoerd Langkemper Date: Tue, 21 Jul 2026 11:51:51 +0000 Subject: [PATCH 2/2] Explicitly cast to curl_off_t --- ext/curl/interface.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ext/curl/interface.c b/ext/curl/interface.c index 17b381127716..c9077970bdc0 100644 --- a/ext/curl/interface.c +++ b/ext/curl/interface.c @@ -2170,7 +2170,7 @@ static zend_result _php_curl_setopt(php_curl *ch, zend_long option, zval *zvalue /* no need to build the mime structure for empty hashtables; also works around https://github.com/curl/curl/issues/6455 */ curl_easy_setopt(ch->cp, CURLOPT_POSTFIELDS, ""); - error = curl_easy_setopt(ch->cp, CURLOPT_POSTFIELDSIZE_LARGE, 0L); + error = curl_easy_setopt(ch->cp, CURLOPT_POSTFIELDSIZE_LARGE, (curl_off_t) 0); } else { return build_mime_structure_from_hash(ch, zvalue); } @@ -2178,7 +2178,7 @@ static zend_result _php_curl_setopt(php_curl *ch, zend_long option, zval *zvalue zend_string *tmp_str; zend_string *str = zval_get_tmp_string(zvalue, &tmp_str); /* with curl 7.17.0 and later, we can use COPYPOSTFIELDS, but we have to provide size before */ - error = curl_easy_setopt(ch->cp, CURLOPT_POSTFIELDSIZE_LARGE, ZSTR_LEN(str)); + error = curl_easy_setopt(ch->cp, CURLOPT_POSTFIELDSIZE_LARGE, (curl_off_t) ZSTR_LEN(str)); error = curl_easy_setopt(ch->cp, CURLOPT_COPYPOSTFIELDS, ZSTR_VAL(str)); zend_tmp_string_release(tmp_str); }