From f1a36cf3c8e099e65d81012d4d46684deab28346 Mon Sep 17 00:00:00 2001 From: epriestley Date: Mon, 11 Feb 2013 11:06:59 -0800 Subject: [PATCH] Make it easier to use print_r() debugging Summary: The fixed-position side nav background thing tends to make looking at print_r() output hard. Also, it breaks Ajax, etc. - Loudly call out unexpected output on normal pages, to catch extra spaces before `writeResponse($response); return; } @@ -102,8 +103,21 @@ try { $response = $application->willSendResponse($response, $controller); $response->setRequest($request); - $sink->writeResponse($response); + $unexpected_output = PhabricatorStartup::endOutputCapture(); + if ($unexpected_output) { + $unexpected_output = "Unexpected output:\n\n{$unexpected_output}"; + phlog($unexpected_output); + if ($response instanceof AphrontWebpageResponse) { + echo hsprintf( + '
%s
', + $unexpected_output); + } + } + + $sink->writeResponse($response); } catch (Exception $ex) { $write_guard->dispose(); if ($access_log) {