Skip to content
Browse files

[HttpFoundation] Fixed messed up headers

  • Loading branch information...
1 parent b9d3d07 commit 850bd5a06bb575a9bbdb5183be380182b8675cef Bart van den Burg committed with fabpot Feb 26, 2013
View
2 src/Symfony/Component/HttpFoundation/ResponseHeaderBag.php
@@ -67,6 +67,8 @@ public function __toString()
$cookies .= 'Set-Cookie: '.$cookie."\r\n";
}
+ ksort($this->headerNames);
+
return parent::__toString().$cookies;
}
View
14 src/Symfony/Component/HttpFoundation/Tests/ResponseHeaderBagTest.php
@@ -235,6 +235,20 @@ public function testMakeDisposition($disposition, $filename, $filenameFallback,
$this->assertEquals($expected, $headers->makeDisposition($disposition, $filename, $filenameFallback));
}
+ public function testToStringDoesntMessUpHeaders()
+ {
+ $headers = new ResponseHeaderBag();
+
+ $headers->set('Location', 'http://www.symfony.com');
+ $headers->set('Content-type', 'text/html');
+
+ (string) $headers;
+
+ $allHeaders = $headers->allPreserveCase();
+ $this->assertEquals(array('http://www.symfony.com'), $allHeaders['Location']);
+ $this->assertEquals(array('text/html'), $allHeaders['Content-type']);
+ }
+
public function provideMakeDisposition()
{
return array(

0 comments on commit 850bd5a

Please sign in to comment.
Something went wrong with that request. Please try again.