Просмотр исходного кода

response code only over http in exception handler

Miraty 1 год назад
Родитель
Сommit
ccf10e3f47
1 измененных файлов с 2 добавлено и 1 удалено
  1. 2 1
      init.php

+ 2 - 1
init.php

@@ -9,7 +9,8 @@ set_error_handler(function ($level, $message, $file = '', $line = 0) {
 });
 set_exception_handler(function ($e) {
 	error_log((string) $e);
-	http_response_code(500);
+	if (http_response_code() !== false)
+		http_response_code(500);
 	echo '<h1>Error</h1><p>An error occured.</p>' . LF;
 });
 register_shutdown_function(function () { // Also catch fatal errors