(!) {$name}
In file {$errfile}:{$errline}
>>> {$errstr}
EOF;
echo $html;
}
function __CRIMSON_error_print(
int $errno,
string $errstr,
?string $errfile = NULL,
?int $errline = NULL,
?array $errcontext = NULL,
): void {
$name = __CRIMSON_error_pretty_print_name($errno);
echo "{$name}: {$errstr}\n\tIn file {$errfile}:{$errline}\n";
}
function CRIMSON_error_handler(
int $errno,
string $errstr,
?string $errfile = NULL,
?int $errline = NULL,
?array $errcontext = NULL,
): void {
__CRIMSON_error_pretty_print($errno, $errstr, $errfile, $errline, $errcontext);
}
set_error_handler("CRIMSON_error_handler");
function CRIMSON_ERROR(string $msg): void {
$frame = debug_backtrace()[1];
CRIMSON_error_handler(E_ERROR, $msg,
$frame['file'], $frame['line']);
}
function CRIMSON_FATAL_ERROR(string $msg): void {
$frame = debug_backtrace()[1];
CRIMSON_error_handler(CRIMSON_E_FATAL_ERROR, $msg,
$frame['file'], $frame['line']);
}
function CRIMSON_WARNING(string $msg): void {
$frame = debug_backtrace()[1];
CRIMSON_error_handler(E_WARNING, $msg,
$frame['file'], $frame['line']);
}