Skip to content

Commit 46e3745

Browse files
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 ------- de2ce58 [HttpFoundation] replace any preexisting Content-Type headers
2 parents def89e2 + de2ce58 commit 46e3745

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/Symfony/Component/HttpFoundation/Response.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -344,8 +344,9 @@ public function sendHeaders()
344344

345345
// headers
346346
foreach ($this->headers->allPreserveCase() as $name => $values) {
347+
$replace = 0 === strcasecmp($name, 'Content-Type');
347348
foreach ($values as $value) {
348-
header($name.': '.$value, false, $this->statusCode);
349+
header($name.': '.$value, $replace, $this->statusCode);
349350
}
350351
}
351352

0 commit comments

Comments
 (0)