Closed
Description
The ksort in the __toString function mutates HeaderBag's headers array. ResponseHeaderBag's allPreserveCase method relies on the order of the header array since it keeps a parallel array with header names.
//in Response class
var_dump($this->headers);
var_dump($this->headers->allPreserveCase());
if toString has been calls results in something like:
//headers
object(Symfony\Component\HttpFoundation\ResponseHeaderBag)[181]
protected 'computedCacheControl' =>
array (size=1)
'no-cache' => boolean true
protected 'cookies' =>
array (size=0)
empty
protected 'headerNames' =>
array (size=3)
'cache-control' => string 'Cache-Control' (length=13)
'date' => string 'Date' (length=4)
'content-type' => string 'Content-Type' (length=12)
protected 'headers' =>
array (size=3)
'cache-control' =>
array (size=1)
0 => string 'no-cache' (length=8)
'content-type' =>
array (size=1)
0 => string 'text/html; charset=UTF-8' (length=24)
'date' =>
array (size=1)
0 => string 'Tue, 19 Feb 2013 22:36:39 GMT' (length=29)
protected 'cacheControl' =>
array (size=0)
empty
//allPreserveCase
array (size=3)
'Cache-Control' =>
array (size=1)
0 => string 'no-cache' (length=8)
'Date' =>
array (size=1)
0 => string 'text/html; charset=UTF-8' (length=24)
'Content-Type' =>
array (size=1)
0 => string 'Tue, 19 Feb 2013 22:36:39 GMT' (length=29)
Since sendHeaders uses allPreserveCase, the headers have values and names mixed up.
Metadata
Metadata
Assignees
Labels
No labels