Skip to content
This repository was archived by the owner on Sep 20, 2021. It is now read-only.
This repository was archived by the owner on Sep 20, 2021. It is now read-only.

Properly disable output buffering. #22

@SamMousa

Description

@SamMousa

We had some issues with a server which had output_buffering enabled via php.ini.
Debugging was made harder due to the fact that the Server creates an output buffer in its constructor, which is a side effect..

Since output_get_level will reliably tell us if output buffering is enabled, it would be nice to just throw an exception in that case:

    public function __construct($verifyHeaders = true)
    {
        if (true === $verifyHeaders && true === headers_sent($file, $line)) {
            throw new Exception(
                'Headers already sent in %s at line %d, cannot send data ' .
                'to client correctly.',
                0,
                [$file, $line]
            );
        }
        if(ob_get_level() > 0) { 
            throw new Exception("Output buffering is active");
        }

Alternatively output buffering could be disabled:

  while (@ob_end_flush());

Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

Metadata

Metadata

Assignees

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions