[php-src] Issue #7953: Calling ob_clean() after ob_start('gz_handler') unsets Content-Encoding
| From: | damianwadley | Date: | Mon, 17 Jan 2022 05:03:50 +0000 |
| Subject: | [php-src] Issue #7953: Calling ob_clean() after ob_start('gz_handler') unsets Content-Encoding | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-239044@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/7953
Comment Author: damianwadley
ob_gzhandler isn't some special string that output buffering recognizes - it's an actual
function - so it's not output buffering itself that is at fault. It's like you wrote your
own callback that added a response header the first time it was called - that header will still be
there after output buffering ends.
I think it would be possible for ob_gzhandler to detect the PHP_OUTPUT_HANDLER_CLEAN flag and to
unset the header and reset back to the initial state. (Equally possible in userland.) Or to remove
the header automatically if there's been no output, but that would mean no more
effectively-empty responses with just the compression container and instead actually-empty responses
with no content at all, _but_ any good client should be totally okay with that.