[php-src] Issue #23424: sapi_lsapi_ub_write does not return bytes written in lsapi mode

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

### Description

sapi/litespeed/lsapi_main.c:

```
static size_t sapi_lsapi_ub_write(const char *str, size_t str_length)
{
    int ret;
    int remain;
    if ( lsapi_mode ) {
        ret  = LSAPI_Write( str, str_length );
        if ( ret < str_length ) {
            php_handle_aborted_connection();
            return str_length - ret;
        }
    } else {
        remain = str_length;
        while( remain > 0 ) {
            ret = write( 1, str, remain );
            if ( ret <= 0 ) {
                php_handle_aborted_connection();
                return str_length - remain;
            }
            str += ret;
            remain -= ret;
        }
    }
    return str_length;
}
```

It seems to me that `LSAPI_Write` returns the number of bytes written. If this is less than the length of the string, something went wrong. But it then returns `str_length - ret`, where it should return `ret`.

### 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.