Skip to content

Commit ed4ae18

Browse files
committed
Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4: curl: Don't truncate length
2 parents e8a274e + e2059a4 commit ed4ae18

2 files changed

Lines changed: 6 additions & 3 deletions

File tree

NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ PHP NEWS
1717
property backing value). (ilutov)
1818
. Fixed bug GH-21215 (Build fails with -std=). (Arnaud)
1919

20+
- Curl:
21+
. Don't truncate length. (ndossche)
22+
2023
- Date:
2124
. Fixed bug GH-20936 (DatePeriod::__set_state() cannot handle null start).
2225
(ndossche)

ext/curl/interface.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -540,7 +540,7 @@ static size_t curl_write(char *data, size_t size, size_t nmemb, void *ctx)
540540
return fwrite(data, size, nmemb, write_handler->fp);
541541
case PHP_CURL_RETURN:
542542
if (length > 0) {
543-
smart_str_appendl(&write_handler->buf, data, (int) length);
543+
smart_str_appendl(&write_handler->buf, data, length);
544544
}
545545
break;
546546
case PHP_CURL_USER: {
@@ -817,7 +817,7 @@ static size_t curl_read(char *data, size_t size, size_t nmemb, void *ctx)
817817
if (!Z_ISUNDEF(retval)) {
818818
_php_curl_verify_handlers(ch, /* reporterror */ true);
819819
if (Z_TYPE(retval) == IS_STRING) {
820-
length = MIN((size * nmemb), Z_STRLEN(retval));
820+
length = MIN(size * nmemb, Z_STRLEN(retval));
821821
memcpy(data, Z_STRVAL(retval), length);
822822
} else if (Z_TYPE(retval) == IS_LONG) {
823823
length = Z_LVAL_P(&retval);
@@ -848,7 +848,7 @@ static size_t curl_write_header(char *data, size_t size, size_t nmemb, void *ctx
848848
/* Handle special case write when we're returning the entire transfer
849849
*/
850850
if (ch->handlers.write->method == PHP_CURL_RETURN && length > 0) {
851-
smart_str_appendl(&ch->handlers.write->buf, data, (int) length);
851+
smart_str_appendl(&ch->handlers.write->buf, data, length);
852852
} else {
853853
PHPWRITE(data, length);
854854
}

0 commit comments

Comments
 (0)