This commit is contained in:
2020-09-09 20:13:21 +08:00
parent 84a1a182fb
commit b9c9bb0d05
+5 -9
View File
@@ -38,17 +38,13 @@ class OnRequest extends Callback
try { try {
register_shutdown_function(function () use ($response) { register_shutdown_function(function () use ($response) {
$error = error_get_last(); $error = error_get_last();
switch ($error['type'] ?? null) { if (!isset($error['type'])) {
case E_ERROR : return;
case E_PARSE : }
case E_CORE_ERROR : $types = [E_ERROR, E_PARSE, E_CORE_ERROR, E_COMPILE_ERROR];
case E_COMPILE_ERROR : if (in_array($error['type'], $types)) {
// log or send:
// error_log($message);
// $server->send($fd, $error['message']);
$response->status(500); $response->status(500);
$response->end($error['message']); $response->end($error['message']);
break;
} }
}); });
/** @var HRequest $sRequest */ /** @var HRequest $sRequest */