Explorar o código

response code only over http in exception handler

Miraty hai 1 ano
pai
achega
ccf10e3f47
Modificáronse 1 ficheiros con 2 adicións e 1 borrados
  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