Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

[HttpFoundation] Fixed messed up headers

  • Loading branch information...
commit 05436cd1d542f21da6ee67857cf88224e5f3acb1 1 parent b4f1360
Bart van den Burg authored fabpot committed
Showing with 16 additions and 0 deletions.
  1. +2 −0  ResponseHeaderBag.php
  2. +14 −0 Tests/ResponseHeaderBagTest.php
View
2  ResponseHeaderBag.php
@@ -67,6 +67,8 @@ public function __toString()
$cookies .= 'Set-Cookie: '.$cookie."\r\n";
}
+ ksort($this->headerNames);
+
return parent::__toString().$cookies;
}
View
14 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(
Please sign in to comment.
Something went wrong with that request. Please try again.