Skip to content

Gzip output handler - ob_end_flush() must not call flush() #13798

Open
@mvorisek

Description

@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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions