We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 735996d commit b03086aCopy full SHA for b03086a
src/Headers.php
@@ -69,10 +69,16 @@ public static function get($params, bool $safeOutput = false)
69
/**
70
* Set a new header
71
*/
72
- public static function set($key, string $value = "", $replace = true, $httpCode = null): void
+ public static function set($key, string $value = "", $replace = true, int $httpCode = 200): void
73
{
74
if (!is_array($key)) {
75
- header("$key: $value", $replace, $httpCode ?? self::$httpCode);
+ $code = ($httpCode || self::$httpCode);
76
+
77
+ if (!$code) {
78
+ header("$key: $value", $replace);
79
+ } else {
80
+ header("$key: $value", $replace, $code);
81
+ }
82
} else {
83
foreach ($key as $header => $headerValue) {
84
self::set($header, $headerValue, $replace, $httpCode);
0 commit comments