From 264fa0cf61c0defbcb5de7629290867406b80fa9 Mon Sep 17 00:00:00 2001 From: Fabrice Luraine Date: Sat, 15 May 2010 16:21:48 +0200 Subject: [PATCH] Fixing error_handler_dispatch: now exit properly after errors that stop application [#39 state:resolved] --- lib/limonade.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/lib/limonade.php b/lib/limonade.php index b9ce831..46f1bdb 100644 --- a/lib/limonade.php +++ b/lib/limonade.php @@ -627,9 +627,15 @@ function error_handler_dispatcher($errno, $errstr, $errfile, $errline) else { # Other errors will stop application - $handlers = error(); + static $handlers = array(); + if(empty($handlers)) + { + error(E_LIM_PHP, 'error_default_handler'); + $handlers = error(); + } + $is_http_err = http_response_status_is_valid($errno); - foreach($handlers as $handler) + while($handler = array_shift($handlers)) { $e = is_array($handler['errno']) ? $handler['errno'] : array($handler['errno']); while($ee = array_shift($e)) @@ -641,7 +647,6 @@ function error_handler_dispatcher($errno, $errstr, $errfile, $errline) } } } - echo error_default_handler($errno, $errstr, $errfile, $errline); } }