diff --git a/core/util.php b/core/util.php index 0f005edb..48a4f1c1 100644 --- a/core/util.php +++ b/core/util.php @@ -523,10 +523,30 @@ function _fatal_error(Exception $e): void //$h_hash = $hash ? "
Hash: $hash" : ""; //'.$h_hash.' - $q = (!isset($e->query) || is_null($e->query)) ? "" : "
Query: " . html_escape($e->query); - header("HTTP/1.0 500 Internal Error"); - echo ' + 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)) ? "" : "
Query: " . html_escape($e->query); + header("HTTP/1.0 500 Internal Error"); + echo '