/** * Use our own error handling function. */ function userErrorHandler($errno, $errmsg, $filename, $linenum, $vars) { if (PHP_VERSION >= 5) { if ($errno >= E_STRICT) { return; } } //if ($errno == E_NOTICE) return; // timestamp for the error entry $dt = date("Y-m-d H:i:s (T)"); // define an assoc array of error string // in reality the only entries we should // consider are E_WARNING, E_NOTICE, E_USER_ERROR, // E_USER_WARNING and E_USER_NOTICE $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"); // set of errors for which a var trace will be saved $user_errors = array(E_USER_ERROR, E_USER_WARNING, E_USER_NOTICE); $err = "<ul>\n"; $err .= "\t<li>" . $dt . "</li>\n"; $err .= "\t<li>Errno: " . $errno . ', ' . $errortype[$errno] . "</li>\n"; $err .= "\t<li>" . $errmsg . "</li>\n"; $err .= "\t<li>" . $filename . ":" . $linenum . "</li>\n"; if (in_array($errno, $user_errors)) { $err .= "\t<li>" . wddx_serialize_value($vars, "Variables") . "</li>\n"; } $err .= "</ul>\n\n"; // for testing echo $err; papersdb_backtrace(); echo "include path: ", ini_get("include_path"), "\n"; exit(1); }
private static function wfDie($txt) { echo $txt, "\n"; if (PHP_SAPI != "cli") { echo "<br/>\n"; } papersdb_backtrace(); exit(1); }