From 69e5dab546afeaa3c10421c725380189712e0695 Mon Sep 17 00:00:00 2001 From: kafene Date: Thu, 24 Jan 2013 21:52:35 -0500 Subject: [PATCH] Don't let header fields clobber eachother See: http://php.net/manual/en/function.header.php 2nd option, $replace, should be false if sending multiple headers with the same name. The difference can be observed by editing index.php (the example index page) so that before `echo 'hello'` is a line: `flight::response()->cache(false);` and editing Response.php so that before `exit($this->body)` is a line: `var_dump(headers_list());` Before change: `array (size=3)` `0 => string 'Expires: Mon, 26 Jul 1997 05:00:00 GMT' (length=38)` `1 => string 'Cache-Control: max-age=0' (length=24)` `2 => string 'Pragma: no-cache' (length=16)` After: `array (size=5)` `0 => string 'Expires: Mon, 26 Jul 1997 05:00:00 GMT' (length=38)` `1 => string 'Cache-Control: no-store, no-cache, must-revalidate' (length=50)` `2 => string 'Cache-Control: post-check=0, pre-check=0' (length=40)` `3 => string 'Cache-Control: max-age=0' (length=24)` `4 => string 'Pragma: no-cache' (length=16)` --- flight/net/Response.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/flight/net/Response.php b/flight/net/Response.php index 400757b..70888de 100644 --- a/flight/net/Response.php +++ b/flight/net/Response.php @@ -181,7 +181,7 @@ class Response { foreach ($this->headers as $field => $value) { if (is_array($value)) { foreach ($value as $v) { - header($field.': '.$v); + header($field.': '.$v, false); } } else {