Skip to content

Commit

Permalink
Merge branch '3.4' into 4.2
Browse files Browse the repository at this point in the history
* 3.4:
  Add a missing quote in getValue() DocBlock
  [HttpFoundation] Fixed case-sensitive handling of cache-control header in RedirectResponse constructor.
  minor: ChoiceType callable deprecation after/before seems wrong
  • Loading branch information
nicolas-grekas committed Jun 6, 2019
2 parents 687f775 + 04c6c92 commit 05eb388
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 5 deletions.
4 changes: 1 addition & 3 deletions UPGRADE-4.0.md
Expand Up @@ -297,19 +297,17 @@ Form
`ArrayAccess` in `ResizeFormListener::preSubmit` method has been removed. `ArrayAccess` in `ResizeFormListener::preSubmit` method has been removed.


* Using callable strings as choice options in ChoiceType is not supported * Using callable strings as choice options in ChoiceType is not supported
anymore in favor of passing PropertyPath instances. anymore.


Before: Before:


```php ```php
'choice_value' => new PropertyPath('range'),
'choice_label' => 'strtoupper', 'choice_label' => 'strtoupper',
``` ```


After: After:


```php ```php
'choice_value' => 'range',
'choice_label' => function ($choice) { 'choice_label' => function ($choice) {
return strtoupper($choice); return strtoupper($choice);
}, },
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Component/HttpFoundation/RedirectResponse.php
Expand Up @@ -42,7 +42,7 @@ public function __construct(?string $url, int $status = 302, array $headers = []
throw new \InvalidArgumentException(sprintf('The HTTP status code is not a redirect ("%s" given).', $status)); throw new \InvalidArgumentException(sprintf('The HTTP status code is not a redirect ("%s" given).', $status));
} }


if (301 == $status && !\array_key_exists('cache-control', $headers)) { if (301 == $status && !\array_key_exists('cache-control', array_change_key_case($headers, \CASE_LOWER))) {
$this->headers->remove('cache-control'); $this->headers->remove('cache-control');
} }
} }
Expand Down
Expand Up @@ -91,6 +91,10 @@ public function testCacheHeaders()
$this->assertFalse($response->headers->hasCacheControlDirective('no-cache')); $this->assertFalse($response->headers->hasCacheControlDirective('no-cache'));
$this->assertTrue($response->headers->hasCacheControlDirective('max-age')); $this->assertTrue($response->headers->hasCacheControlDirective('max-age'));


$response = new RedirectResponse('foo.bar', 301, ['Cache-Control' => 'max-age=86400']);
$this->assertFalse($response->headers->hasCacheControlDirective('no-cache'));
$this->assertTrue($response->headers->hasCacheControlDirective('max-age'));

$response = new RedirectResponse('foo.bar', 302); $response = new RedirectResponse('foo.bar', 302);
$this->assertTrue($response->headers->hasCacheControlDirective('no-cache')); $this->assertTrue($response->headers->hasCacheControlDirective('no-cache'));
} }
Expand Down
Expand Up @@ -58,7 +58,7 @@ public function setValue(&$objectOrArray, $propertyPath, $value);
* *
* $propertyAccessor = PropertyAccess::createPropertyAccessor(); * $propertyAccessor = PropertyAccess::createPropertyAccessor();
* *
* echo $propertyAccessor->getValue($object, 'child.name); * echo $propertyAccessor->getValue($object, 'child.name');
* // equals echo $object->getChild()->getName(); * // equals echo $object->getChild()->getName();
* *
* This method first tries to find a public getter for each property in the * This method first tries to find a public getter for each property in the
Expand Down

0 comments on commit 05eb388

Please sign in to comment.