have fatal_error print out a bunch more info when run from CLI
This commit is contained in:
parent
d6fe059b67
commit
7f041a9f93
@ -523,8 +523,28 @@ function _fatal_error(Exception $e): void
|
|||||||
//$h_hash = $hash ? "<p><b>Hash:</b> $hash" : "";
|
//$h_hash = $hash ? "<p><b>Hash:</b> $hash" : "";
|
||||||
//'.$h_hash.'
|
//'.$h_hash.'
|
||||||
|
|
||||||
$q = (!isset($e->query) || is_null($e->query)) ? "" : "<p><b>Query:</b> " . html_escape($e->query);
|
|
||||||
|
|
||||||
|
if (PHP_SAPI === 'cli' || PHP_SAPI == 'phpdbg') {
|
||||||
|
print("Trace: ");
|
||||||
|
$t = array_reverse($e->getTrace());
|
||||||
|
foreach($t as $n => $f) {
|
||||||
|
$c = $f['class'] ?? '';
|
||||||
|
$t = $f['type'] ?? '';
|
||||||
|
$a = implode(", ", array_map("stringer", $f['args']));
|
||||||
|
print("$n: {$f['file']}({$f['line']}): {$c}{$t}{$f['function']}({$a})\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
print("Message: $message\n");
|
||||||
|
|
||||||
|
if(isset($e->query)) {
|
||||||
|
print("Query: {$e->query}\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
$phpver = phpversion();
|
||||||
|
print("Version: $version (on $phpver)\n");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$q = (!isset($e->query) || is_null($e->query)) ? "" : "<p><b>Query:</b> " . html_escape($e->query);
|
||||||
header("HTTP/1.0 500 Internal Error");
|
header("HTTP/1.0 500 Internal Error");
|
||||||
echo '
|
echo '
|
||||||
<html>
|
<html>
|
||||||
@ -539,6 +559,7 @@ function _fatal_error(Exception $e): void
|
|||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
';
|
';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user