Skip to content

Commit

Permalink
Add output buffer length check before attempting to end it
Browse files Browse the repository at this point in the history
  • Loading branch information
go-redrock-nicolas committed Sep 14, 2021
1 parent a9a2267 commit b94c430
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
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

0 comments on commit b94c430

Please sign in to comment.