1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00

Merge branch 'PHP-8.4' into PHP-8.5

* PHP-8.4:
  curl: Don't truncate length
This commit is contained in:
ndossche
2026-02-17 23:16:25 +01:00
2 changed files with 6 additions and 3 deletions

3
NEWS
View File

@@ -17,6 +17,9 @@ PHP NEWS
property backing value). (ilutov)
. Fixed bug GH-21215 (Build fails with -std=). (Arnaud)
- Curl:
. Don't truncate length. (ndossche)
- Date:
. Fixed bug GH-20936 (DatePeriod::__set_state() cannot handle null start).
(ndossche)

View File

@@ -540,7 +540,7 @@ static size_t curl_write(char *data, size_t size, size_t nmemb, void *ctx)
return fwrite(data, size, nmemb, write_handler->fp);
case PHP_CURL_RETURN:
if (length > 0) {
smart_str_appendl(&write_handler->buf, data, (int) length);
smart_str_appendl(&write_handler->buf, data, length);
}
break;
case PHP_CURL_USER: {
@@ -817,7 +817,7 @@ static size_t curl_read(char *data, size_t size, size_t nmemb, void *ctx)
if (!Z_ISUNDEF(retval)) {
_php_curl_verify_handlers(ch, /* reporterror */ true);
if (Z_TYPE(retval) == IS_STRING) {
length = MIN((size * nmemb), Z_STRLEN(retval));
length = MIN(size * nmemb, Z_STRLEN(retval));
memcpy(data, Z_STRVAL(retval), length);
} else if (Z_TYPE(retval) == IS_LONG) {
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
/* Handle special case write when we're returning the entire transfer
*/
if (ch->handlers.write->method == PHP_CURL_RETURN && length > 0) {
smart_str_appendl(&ch->handlers.write->buf, data, (int) length);
smart_str_appendl(&ch->handlers.write->buf, data, length);
} else {
PHPWRITE(data, length);
}