Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitb5e6c99

Browse files
author
Ivo
committed
[HttpFoundation] Fixed case-sensitive handling of cache-control header in RedirectResponse constructor.
1 parent1583b4f commitb5e6c99

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

‎src/Symfony/Component/HttpFoundation/RedirectResponse.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public function __construct($url, $status = 302, $headers = [])
4242
thrownew \InvalidArgumentException(sprintf('The HTTP status code is not a redirect ("%s" given).',$status));
4343
}
4444

45-
if (301 ==$status && !\array_key_exists('cache-control',$headers)) {
45+
if (301 ==$status && !\array_key_exists('cache-control',array_change_key_case($headers, \CASE_LOWER))) {
4646
$this->headers->remove('cache-control');
4747
}
4848
}

‎src/Symfony/Component/HttpFoundation/Tests/RedirectResponseTest.php‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,10 @@ public function testCacheHeaders()
9191
$this->assertFalse($response->headers->hasCacheControlDirective('no-cache'));
9292
$this->assertTrue($response->headers->hasCacheControlDirective('max-age'));
9393

94+
$response =newRedirectResponse('foo.bar',301, ['Cache-Control' =>'max-age=86400']);
95+
$this->assertFalse($response->headers->hasCacheControlDirective('no-cache'));
96+
$this->assertTrue($response->headers->hasCacheControlDirective('max-age'));
97+
9498
$response =newRedirectResponse('foo.bar',302);
9599
$this->assertTrue($response->headers->hasCacheControlDirective('no-cache'));
96100
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp