mirror of
https://github.com/filp/whoops.git
synced 2026-08-30 03:58:17 +00:00
Move output buffer clearing to individual handlers
This commit is contained in:
@@ -43,4 +43,4 @@ $run->pushHandler($jsonHandler);
|
||||
|
||||
// That's it! Register Whoops and throw a dummy exception:
|
||||
$run->register();
|
||||
throw new RuntimeException("Oh fudge napkins!");
|
||||
throw new RuntimeException("Oh fudge napkins!");
|
||||
|
||||
@@ -71,6 +71,9 @@ class JsonResponseHandler extends Handler
|
||||
return Handler::DONE;
|
||||
}
|
||||
|
||||
// Remove any previous output
|
||||
ob_get_level() and ob_end_clean();
|
||||
|
||||
$exception = $this->getException();
|
||||
|
||||
$response = array(
|
||||
@@ -103,4 +106,4 @@ class JsonResponseHandler extends Handler
|
||||
echo json_encode($response);
|
||||
return Handler::QUIT;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -58,6 +58,9 @@ class PrettyPageHandler extends Handler
|
||||
if(php_sapi_name() === 'cli' && !isset($_ENV['whoops-test'])) {
|
||||
return Handler::DONE;
|
||||
}
|
||||
|
||||
// Remove any previous output
|
||||
ob_get_level() and ob_end_clean();
|
||||
|
||||
// Get the 'pretty-template.php' template file
|
||||
// @todo: this can be made more dynamic &&|| cleaned-up
|
||||
|
||||
@@ -144,9 +144,6 @@ class Run
|
||||
*/
|
||||
public function handleException(Exception $exception)
|
||||
{
|
||||
// Remove any previous output
|
||||
ob_get_level() and ob_end_clean();
|
||||
|
||||
// Walk the registered handlers in the reverse order
|
||||
// they were registered, and pass off the exception
|
||||
$inspector = $this->getInspector($exception);
|
||||
|
||||
Reference in New Issue
Block a user