Skip to content

Commit 88fdc46

Browse files
committed
remove broken magic response code reason
1 parent e4db086 commit 88fdc46

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

resources/lib/UnitySite.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,9 @@ public static function redirect($destination)
3232
}
3333
}
3434

35-
public static function headerResponseCode(int $code)
35+
public static function headerResponseCode(int $code, string $reason)
3636
{
37-
$responseCodeMessage = @http_response_code($code) ?? "";
38-
$msg = $_SERVER["SERVER_PROTOCOL"] . " " . strval($code) . " " . $responseCodeMessage;
37+
$msg = $_SERVER["SERVER_PROTOCOL"] . " " . strval($code) . " " . $reason;
3938
header($msg, true, $code);
4039
}
4140

@@ -56,14 +55,14 @@ public static function errorLog(string $title, string $message)
5655

5756
public static function badRequest($message)
5857
{
59-
self::headerResponseCode(400);
58+
self::headerResponseCode(400, "bad request");
6059
self::errorLog("bad request", $message);
6160
self::die();
6261
}
6362

6463
public static function forbidden($message)
6564
{
66-
self::headerResponseCode(403);
65+
self::headerResponseCode(403, "forbidden");
6766
self::errorLog("forbidden", $message);
6867
self::die();
6968
}

0 commit comments

Comments
 (0)