コード例 #1
0
function __error_handler__($errno, $errmsg, $filename, $linenum)
{
    // automatically remove broken combined php file
    global $include_combined_php;
    if ($errno & (E_ERROR | E_PARSE | E_CORE_ERROR | E_COMPILE_ERROR | E_USER_ERROR) && isset($include_combined_php)) {
        if (is_readable($include_combined_php)) {
            unlink($include_combined_php);
        }
        unset($include_combined_php);
    }
    // process @ operator
    if (error_reporting() == 0) {
        return;
    }
    $errortype = array(E_ERROR => 'Error', E_WARNING => 'Warning', E_PARSE => 'Parsing Error', E_NOTICE => 'Notice', E_CORE_ERROR => 'Core Error', E_CORE_WARNING => 'Core Warning', E_COMPILE_ERROR => 'Compile Error', E_COMPILE_WARNING => 'Compile Warning', E_USER_ERROR => 'User Error', E_USER_WARNING => 'User Warning', E_USER_NOTICE => 'User Notice', E_STRICT => 'Runtime Notice', E_RECOVERABLE_ERROR => 'Catchable Fatal Error');
    if (defined('E_DEPRECATED')) {
        $errortype[E_DEPRECATED] = 'Deprecated';
    }
    $e_type = $errortype[$errno];
    $msg = "PHP {$e_type}: {$errmsg}";
    /*
     *                            :                                                                                                                                         trace()                                                   
     *                 err(),                                     CTrace                                                                                                            debug_backtrace    
     *                                                                                                                                               .
     *                                                                                                                __error_handler__                                                       err(),       
     *                                                                                                                                                        .                                                                        
     *                                   ,                                                           trace().
     */
    CTrace::trace($msg, CTrace::ERR);
}