/** * Internal error handler dispatcher * Find and call matching error handler and exit * If no match found, call default error handler * * @access private * @param int $errno * @param string $errstr * @param string $errfile * @param string $errline * @return void */ function error_handler_dispatcher($errno, $errstr, $errfile, $errline) { $back_trace = debug_backtrace(); while ($trace = array_shift($back_trace)) { if ($trace['function'] == 'halt') { $errfile = $trace['file']; $errline = $trace['line']; break; } } $handlers = error(); $is_http_err = http_response_status_is_valid($errno); foreach ($handlers as $handler) { $e = is_array($handler['errno']) ? $handler['errno'] : array($handler['errno']); while ($ee = array_shift($e)) { if ($ee == $errno || $ee == E_LIM_PHP || $ee == E_LIM_HTTP && $is_http_err) { echo call_if_exists($handler['function'], $errno, $errstr, $errfile, $errline); exit; } } } echo error_default_handler($errno, $errstr, $errfile, $errline); exit; }
/** * Internal error handler dispatcher * Find and call matching error handler and exit * If no match found, call default error handler * * @access private * @param int $errno * @param string $errstr * @param string $errfile * @param string $errline * @return void */ function error_handler_dispatcher($errno, $errstr, $errfile, $errline) { $back_trace = debug_backtrace(); while ($trace = array_shift($back_trace)) { if ($trace['function'] == 'halt') { $errfile = $trace['file']; $errline = $trace['line']; break; } } # Notices and warning won't halt execution if (error_wont_halt_app($errno)) { error_notice($errno, $errstr, $errfile, $errline); return; } else { # Other errors will stop application $handlers = error(); $is_http_err = http_response_status_is_valid($errno); foreach ($handlers as $handler) { $e = is_array($handler['errno']) ? $handler['errno'] : array($handler['errno']); while ($ee = array_shift($e)) { if ($ee == $errno || $ee == E_LIM_PHP || $ee == E_LIM_HTTP && $is_http_err) { echo call_if_exists($handler['function'], $errno, $errstr, $errfile, $errline); exit; } } } echo error_default_handler($errno, $errstr, $errfile, $errline); stop_and_exit(); } }
/** * Internal error handler dispatcher * Find and call matching error handler and exit * If no match found, call default error handler * * @access private * @param int $errno * @param string $errstr * @param string $errfile * @param string $errline * @return void */ function error_handler_dispatcher($errno, $errstr, $errfile, $errline) { $back_trace = debug_backtrace(); while (!empty($back_trace) && ($trace = array_shift($back_trace))) { if ($trace['function'] == 'halt') { $errfile = $trace['file']; $errline = $trace['line']; break; } } # Notices and warning won't halt execution if (error_wont_halt_app($errno)) { error_notice($errno, $errstr, $errfile, $errline); return; } else { # Other errors will stop application //static $handlers = array(); //if(empty($handlers)) //{ //error(E_LIM_PHP, 'error_default_handler'); //$handlers = error(); //} //$is_http_err = http_response_status_is_valid($errno); switch ($errno) { default: error_default_handler($errno, $errstr, $errfile, $errline); //exit; } //while($handler = array_shift($handlers)) //{ //$e = is_array($handler['errno']) ? $handler['errno'] : array($handler['errno']); //while($ee = array_shift($e)) //{ //if($ee == $errno || $ee == E_LIM_PHP || ($ee == E_LIM_HTTP && $is_http_err)) //{ // echo call_if_exists($handler['function'], $errno, $errstr, $errfile, $errline); // exit; //} //} //} } }