10000 [FrameworkBundle] mitigate BC break with empty trusted_proxies by xabbuh · Pull Request #23049 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[FrameworkBundle] mitigate BC break with empty trusted_proxies #23049

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 3, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
0