Skip to content

Commit 86cab6e

Browse files
committed
Merge branch '6.2' into 6.3
* 6.2: relax assertions for ICU 72.1 [Validator] Fix regression with class metadatada on parent classes [VarExporter] Fix exporting classes with __serialize() but not __unserialize() [HttpFoundation][HttpKernel] Fix deprecations when `Content-Type` is `null`
2 parents 2b4a073 + e347239 commit 86cab6e

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

Response.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ public function prepare(Request $request): static
286286
$charset = $this->charset ?: 'UTF-8';
287287
if (!$headers->has('Content-Type')) {
288288
$headers->set('Content-Type', 'text/html; charset='.$charset);
289-
} elseif (0 === stripos($headers->get('Content-Type'), 'text/') && false === stripos($headers->get('Content-Type'), 'charset')) {
289+
} elseif (0 === stripos($headers->get('Content-Type') ?? '', 'text/') && false === stripos($headers->get('Content-Type') ?? '', 'charset')) {
290290
// add the charset
291291
$headers->set('Content-Type', $headers->get('Content-Type').'; charset='.$charset);
292292
}

Tests/ResponseTest.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -548,6 +548,16 @@ public function testContentTypeCharset()
548548
$this->assertEquals('text/css; charset=UTF-8', $response->headers->get('Content-Type'));
549549
}
550550

551+
public function testContentTypeIsNull()
552+
{
553+
$response = new Response('foo');
554+
$response->headers->set('Content-Type', null);
555+
556+
$response->prepare(new Request());
557+
558+
$this->expectNotToPerformAssertions();
559+
}
560+
551561
public function testPrepareDoesNothingIfContentTypeIsSet()
552562
{
553563
$response = new Response('foo');

0 commit comments

Comments
 (0)