Skip to content

Commit 4186a4b

Browse files
committed
docs: document why we filter integer keys from the $headers array
Signed-off-by: Matthew Weier O'Phinney <matthew@weierophinney.net>
1 parent 608f025 commit 4186a4b

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/functions/marshal_headers_from_sapi.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,9 @@ function marshalHeadersFromSapi(array $server): array
6666
}
6767
}
6868

69-
// Filter out integer keys
69+
// Filter out integer keys.
70+
// These can occor if the translated header name is a string integer.
71+
// PHP will cast those to integers when assigned to an array.
72+
// This filters them out.
7073
return array_filter($headers, fn(string|int $key): bool => is_string($key), ARRAY_FILTER_USE_KEY);
7174
}

0 commit comments

Comments
 (0)