[php-src] master: Merge branch 'PHP-8.6'
| From: | Ilia Alshanetsky | Date: | Wed, 30 Sep 2026 12:10:55 +0000 |
| Subject: | [php-src] master: Merge branch 'PHP-8.6' | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-141770@lists.php.net to get a copy of this message | ||
Author: Ilia Alshanetsky (iliaal)
Date: 2026-09-30T08:06:55-04:00
Commit: https://github.com/php/php-src/commit/6507d8b33d8570d774b5ddfefb369ae6adcf9d9e
Raw diff: https://github.com/php/php-src/commit/6507d8b33d8570d774b5ddfefb369ae6adcf9d9e.diff
Merge branch 'PHP-8.6'
* PHP-8.6:
sapi/cli: Fix built-in server truncating responses after a partial write
Changed paths:
M sapi/cli/php_cli_server.c
Diff:
diff --git a/sapi/cli/php_cli_server.c b/sapi/cli/php_cli_server.c
index 6e11e6b265fe..ece42a1e93f9 100644
--- a/sapi/cli/php_cli_server.c
+++ b/sapi/cli/php_cli_server.c
@@ -1049,7 +1049,8 @@ static void php_cli_server_content_sender_ctor(php_cli_server_content_sender
*se
static int php_cli_server_content_sender_send(php_cli_server_content_sender *sender, php_socket_t
fd, size_t *nbytes_sent_total) /* {{{ */
{
php_cli_server_chunk *chunk, *next;
- size_t _nbytes_sent_total = 0;
+
+ *nbytes_sent_total = 0;
for (chunk = sender->buffer.first; chunk; chunk = next) {
#ifdef PHP_WIN32
@@ -1067,7 +1068,6 @@ static int php_cli_server_content_sender_send(php_cli_server_content_sender
*sen
nbytes_sent = send(fd, chunk->data.heap.p, chunk->data.heap.len, 0);
#endif
if (nbytes_sent < 0) {
- *nbytes_sent_total = _nbytes_sent_total;
return php_socket_errno();
#ifdef PHP_WIN32
} else if (nbytes_sent == chunk->data.heap.len) {
@@ -1083,8 +1083,10 @@ static int php_cli_server_content_sender_send(php_cli_server_content_sender
*sen
} else {
chunk->data.heap.p += nbytes_sent;
chunk->data.heap.len -= nbytes_sent;
+ *nbytes_sent_total += nbytes_sent;
+ return 0;
}
- _nbytes_sent_total += nbytes_sent;
+ *nbytes_sent_total += nbytes_sent;
break;
case PHP_CLI_SERVER_CHUNK_IMMORTAL:
@@ -1094,7 +1096,6 @@ static int php_cli_server_content_sender_send(php_cli_server_content_sender
*sen
nbytes_sent = send(fd, chunk->data.immortal.p, chunk->data.immortal.len, 0);
#endif
if (nbytes_sent < 0) {
- *nbytes_sent_total = _nbytes_sent_total;
return php_socket_errno();
#ifdef PHP_WIN32
} else if (nbytes_sent == chunk->data.immortal.len) {
@@ -1110,12 +1111,13 @@ static int php_cli_server_content_sender_send(php_cli_server_content_sender
*sen
} else {
chunk->data.immortal.p += nbytes_sent;
chunk->data.immortal.len -= nbytes_sent;
+ *nbytes_sent_total += nbytes_sent;
+ return 0;
}
- _nbytes_sent_total += nbytes_sent;
+ *nbytes_sent_total += nbytes_sent;
break;
}
}
- *nbytes_sent_total = _nbytes_sent_total;
return 0;
} /* }}} */