[php-src] Issue #13798: Gzip output handler - `ob_end_flush()` must not call `flush()`
| From: | mvorisek | Date: | Sun, 24 Mar 2024 17:59:39 +0000 |
| Subject: | [php-src] Issue #13798: Gzip output handler - `ob_end_flush()` must not call `flush()` | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-246644@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/13798
Author: mvorisek
### Description
This issue is problematic only when
zlib.output_compression is enabled.
Currently, when zlib.output_compression is enabled like:
```
php -S 127.0.0.1:81 -d zlib.output_compression=1 -t .
```
(but also tested if enabled when used /w Apache /wo mod_deflate)
and ob_end_flush() is called, no headers cannot be send anymore even if the nothing was
output.
Currently, we had to use the following code
```
while (ob_get_level() > 0) {
if (ob_get_length() === 0) {
ob_end_clean();
} else {
ob_end_flush();
}
}
```
to workaround.
When zlib.output_compression is NOT enabled, the following code:
```
```
while (ob_get_level() > 0) {
ob_end_flush();
}
```
```
is working (allows to send additional headers).
Because of this inconsistency, I belive php gzip output handler behaviour should be fixed, when
output buffer is empty, to not flush implicitly.
### PHP Version
any
### Operating System
any