bug #29057 [HttpFoundation] replace any preexisting Content-Type headers (nicolas-grekas)

This PR was merged into the 2.8 branch.

Discussion
----------

[HttpFoundation] replace any preexisting Content-Type headers

| Q             | A
| ------------- | ---
| Branch?       | 2.8
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #21204
| License       | MIT
| Doc PR        | -

Commits
-------

de2ce58a4f [HttpFoundation] replace any preexisting Content-Type headers
This commit is contained in:
Nicolas Grekas 2018-11-08 22:38:31 +01:00
commit 46e3745a03
1 changed files with 2 additions and 1 deletions

View File

@ -344,8 +344,9 @@ class Response
// headers
foreach ($this->headers->allPreserveCase() as $name => $values) {
$replace = 0 === strcasecmp($name, 'Content-Type');
foreach ($values as $value) {
header($name.': '.$value, false, $this->statusCode);
header($name.': '.$value, $replace, $this->statusCode);
}
}