Permalink
Browse files

bug #23049 [FrameworkBundle] mitigate BC break with empty trusted_pro…

…xies (xabbuh)

This PR was merged into the 3.3 branch.

Discussion
----------

[FrameworkBundle] mitigate BC break with empty trusted_proxies

| Q             | A
| ------------- | ---
| Branch?       | 3.3
| Bug fix?      | kind of
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #22238 (comment)
| License       | MIT
| Doc PR        |

Commits
-------

ff055ef mitigate BC break with empty trusted_proxies
  • Loading branch information...
fabpot committed Jun 3, 2017
2 parents 8d58b50 + ff055ef commit 7183be3739f5c3630b2a85544a17edab0ba2e1fe
@@ -67,7 +67,11 @@ public function getConfigTreeBuilder()
->end()
->arrayNode('trusted_proxies') // @deprecated in version 3.3, to be removed in 4.0
->beforeNormalization()
->always()
->ifTrue(function ($v) { return empty($v); })
->then(function () { @trigger_error('The "framework.trusted_proxies" configuration key has been removed in Symfony 3.3. Use the Request::setTrustedProxies() method in your front controller instead.', E_USER_DEPRECATED); })
->end()
->beforeNormalization()
->ifTrue(function ($v) { return !empty($v); })
->thenInvalid('The "framework.trusted_proxies" configuration key has been removed in Symfony 3.3. Use the Request::setTrustedProxies() method in your front controller instead.')
->end()
->end()
@@ -43,6 +43,38 @@ public function testDoNoDuplicateDefaultFormResources()
$this->assertEquals(array('FrameworkBundle:Form'), $config['templating']['form']['resources']);
}
/**
* @group legacy
* @expectedDeprecation The "framework.trusted_proxies" configuration key has been removed in Symfony 3.3. Use the Request::setTrustedProxies() method in your front controller instead.
*/
public function testTrustedProxiesSetToNullIsDeprecated()
{
$processor = new Processor();
$configuration = new Configuration(true);
$processor->processConfiguration($configuration, array(array('trusted_proxies' => null)));
}
/**
* @group legacy
* @expectedDeprecation The "framework.trusted_proxies" configuration key has been removed in Symfony 3.3. Use the Request::setTrustedProxies() method in your front controller instead.
*/
public function testTrustedProxiesSetToEmptyArrayIsDeprecated()
{
$processor = new Processor();
$configuration = new Configuration(true);
$processor->processConfiguration($configuration, array(array('trusted_proxies' => array())));
}
/**
* @expectedException \InvalidArgumentException
*/
public function testTrustedProxiesSetToNonEmptyArrayIsInvalid()
{
$processor = new Processor();
$configuration = new Configuration(true);
$processor->processConfiguration($configuration, array(array('trusted_proxies' => array('127.0.0.1'))));
}
public function testAssetsCanBeEnabled()
{
$processor = new Processor();

0 comments on commit 7183be3

Please sign in to comment.