[php-src] Issue #23423: php_embed_ub_write does not return on error

[email protected] (Sjord)
Newsgroups php.bugs
Message-ID <[email protected]>
Issue: https://github.com/php/php-src/issues/23423
Author: Sjord

### Description

sapi/embed/php_embed.c:

```
/* SAPIs only have unbuffered write operations. This is because PHP's output
 * buffering feature will handle any buffering of the output and invoke the
 * SAPI unbuffered write operation when it flushes the buffer.
 */
static size_t php_embed_ub_write(const char *str, size_t str_length)
{
	const char *ptr = str;
	size_t remaining = str_length;
	size_t ret;

	while (remaining > 0) {
		ret = php_embed_single_write(ptr, remaining);
		if (!ret) {
			php_handle_aborted_connection();
		}
		ptr += ret;
		remaining -= ret;
	}

	return str_length;
}
```

`php_handle_aborted_connection` does not always abort, i.e. if `ignore_user_abort=1`. So I sending fails and `ret` is 0, then `remaining` is never decremented and this loops forever.

It should probably `return str_length - remaining` after `php_handle_aborted_connection()`.

### PHP Version

```plain
master
```

### Operating System

_No response_
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.