From cc60fda68712f75ae98213858f0af6369fe18b1b Mon Sep 17 00:00:00 2001 From: Florian Pritz Date: Fri, 3 Oct 2014 15:10:09 +0200 Subject: WIP: Trap all errors and hide output before error WIP: This buffers the whole output of the php based file downloader which could be huge. Need to either use x-sendfile everywhere or find a better solution. Signed-off-by: Florian Pritz --- index.php | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/index.php b/index.php index 00ab370c3..895c242ac 100644 --- a/index.php +++ b/index.php @@ -258,7 +258,19 @@ register_shutdown_function("check_for_fatal"); * And away we go... * */ -require_once BASEPATH.'core/CodeIgniter.php'; +try { + ob_start(); + require_once BASEPATH.'core/CodeIgniter.php'; + ob_end_flush(); +} catch (Exception $e) { + ob_end_clean(); + foreach (headers_list() as $header) { + $key = explode(":", $header)[0]; + header_remove($key); + } + _actual_exception_handler($e); + echo "Usage peak: ".format_bytes(memory_get_peak_usage()); +} /* End of file index.php */ /* Location: ./index.php */ -- cgit v1.2.3-24-g4f1b