소스 검색

response code only over http in exception handler

Miraty 1 년 전
부모
커밋
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