Tracy debugger: No output with ajax exceptions

316 Views Asked by At

Whenever I make an ajax request that throws an exception, the Tracy debugger is killing all output.

I've tested with Tracy turned off and exceptions get output. I've tested with just a page (ie: not ajax) and the exception gets output by Tracy properly.

I believe I've traced the problem to Bluescreen::render():

public function render($exception)
    {
        if (Helpers::isAjax() && session_status() === PHP_SESSION_ACTIVE) {
            echo $exception->getMessage();

            ob_start(function () {});

            $this->renderTemplate($exception, __DIR__ . '/assets/BlueScreen/content.phtml');
            $contentId = $_SERVER['HTTP_X_TRACY_AJAX'];
            $_SESSION['_tracy']['bluescreen'][$contentId] = ['content' => ob_get_clean(), 'dumps' => Dumper::fetchLiveData(), 'time' => time()];

        } else {
            $this->renderTemplate($exception, __DIR__ . '/assets/BlueScreen/page.phtml');
        }
    }

I added the echo line at the top. It gets output.

The reason I'm asking on SO and not filing a bug report, is because just this morning it was working - the exception text was output, followed by a backtrace, followed by a message saying "unable to log error...". So I'm fairly certain the problem is mine, but I can't figure out where.

I have deleted my copy of Tracy and re-pulled from GitHub, so I'm using the latest & greatest version.

0

There are 0 best solutions below