From c6026bb3d271a6c58a07c2961a097163fec10d43 Mon Sep 17 00:00:00 2001 From: Lazizbek Ergashev Date: Mon, 24 Aug 2026 01:25:33 +0500 Subject: [PATCH] Fix php_embed_ub_write() infinite loop on failed write --- NEWS | 3 +++ sapi/embed/php_embed.c | 1 + 2 files changed, 4 insertions(+) diff --git a/NEWS b/NEWS index a22154027d39..cc69770e3971 100644 --- a/NEWS +++ b/NEWS @@ -2,6 +2,9 @@ PHP NEWS ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| ?? ??? ????, PHP 8.2.34 +- Embed: + . Fixed bug GH-23423 (php_embed_ub_write() infinite loop when a write + fails and the connection is not aborted). (Lazizbek Ergashev) 30 Jul 2026, PHP 8.2.33 diff --git a/sapi/embed/php_embed.c b/sapi/embed/php_embed.c index 4b94bd98e66d..1ef982149919 100644 --- a/sapi/embed/php_embed.c +++ b/sapi/embed/php_embed.c @@ -82,6 +82,7 @@ static size_t php_embed_ub_write(const char *str, size_t str_length) ret = php_embed_single_write(ptr, remaining); if (!ret) { php_handle_aborted_connection(); + return str_length - remaining; } ptr += ret; remaining -= ret;