From 8470de671d6ee5023ef37b796036aa9d9fb62171 Mon Sep 17 00:00:00 2001 From: eater Date: Sat, 27 Jan 2018 18:44:01 +0100 Subject: [PATCH] Fix header writing --- src/Server.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/Server.php b/src/Server.php index 376a888..04e4574 100644 --- a/src/Server.php +++ b/src/Server.php @@ -88,11 +88,12 @@ class Server header('HTTP/' . $response->getProtocolVersion() . ' ' . $response->getStatusCode() . ' ' . $response->getReasonPhrase()); - $wrote = []; - foreach ($response->getHeaders() as [$headerName, $headerValue]) { - // Only replace header if we didn't write on those yet - header($headerName . ': ' . $headerValue, !isset($wrote[$headerName])); - $wrote[$headerName] = true; + foreach ($response->getHeaders() as $headerName => $headerValues) { + $first = true; + foreach ($headerValues as $headerValue) { + header($headerName . ': ' . $headerValue, $first === true); + $first = false; + } } $stdout = fopen('php://output', 'w+');