Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add output buffer length check before attempting to end it #705

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Whoops/Run.php
Expand Up @@ -393,7 +393,7 @@ public function handleException($exception)
// @todo Might be able to clean this up a bit better
if ($willQuit) {
// Cleanup all other output buffers before sending our output:
while ($this->system->getOutputBufferLevel() > 0) {
while ($this->system->getOutputBufferLevel() > 0 && $this->system->getOutputBufferLength() > 0) {
$this->system->endOutputBuffering();
}

Expand Down
8 changes: 8 additions & 0 deletions src/Whoops/Util/SystemFacade.php
Expand Up @@ -77,6 +77,14 @@ public function cleanOutputBuffer()
return ob_get_clean();
}

/**
* @return int
*/
public function getOutputBufferLength()
{
return ob_get_length();
}

/**
* @return int
*/
Expand Down