diff --git a/examples/example-ajax-only.php b/examples/example-ajax-only.php index 939d61a..3efdb45 100644 --- a/examples/example-ajax-only.php +++ b/examples/example-ajax-only.php @@ -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!"); \ No newline at end of file +throw new RuntimeException("Oh fudge napkins!"); diff --git a/src/Whoops/Handler/JsonResponseHandler.php b/src/Whoops/Handler/JsonResponseHandler.php index 8f3dbec..2229de1 100644 --- a/src/Whoops/Handler/JsonResponseHandler.php +++ b/src/Whoops/Handler/JsonResponseHandler.php @@ -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; } -} \ No newline at end of file +} diff --git a/src/Whoops/Handler/PrettyPageHandler.php b/src/Whoops/Handler/PrettyPageHandler.php index 0d0d632..a2ed1df 100644 --- a/src/Whoops/Handler/PrettyPageHandler.php +++ b/src/Whoops/Handler/PrettyPageHandler.php @@ -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 diff --git a/src/Whoops/Run.php b/src/Whoops/Run.php index 0921d47..9bd29cc 100644 --- a/src/Whoops/Run.php +++ b/src/Whoops/Run.php @@ -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);