[php-src] Issue #7953: Calling ob_clean() after ob_start('gz_handler') does not set Content-Encoding
| From: | cmb69 | Date: | Mon, 17 Jan 2022 18:08:26 +0000 |
| Subject: | [php-src] Issue #7953: Calling ob_clean() after ob_start('gz_handler') does not set Content-Encoding | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-239074@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/7953
Comment Author: cmb69
> I'm also seeing odd behavior with a flush + clean in that the special
> "ob_gzhandler" issues a "Failed to delete buffer" notice while the wrapped
> ob_gzhandler() call does not.
The special
ob_gzhandler makes the handler immutable (i.e. uncleanable and
unremoveable) after the headers have been sent. The wrapped ob_gzhandler doesn't
do that. I'm not sure whether uncleanability is required, but at least the handler must be
unremoveable, or otherwise output after removing the handler causes issues:
````php
ob_start(fn($buffer, $phase) => ob_gzhandler($buffer, $phase));
echo "Hello";
ob_flush();
ob_end_clean();
echo "world";
````
Note to self: check ob_iconv_handler regarding these issues.