Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit b0ede2c

Browse files
Merge branch '3.3' into 3.4
* 3.3: [TwigBridge] Fix namespaced classes bumped Symfony version to 3.3.2 updated VERSION for 3.3.1 updated CHANGELOG for 3.3.1 [DependencyInjection] Fix named args support in ChildDefinition [Cache] Fallback to positional when keyed results are broken [HttpFoundation][FrameworkBundle] Revert "trusted proxies" BC break [Cache] MemcachedAdapter not working with TagAwareAdapter Remove closure-proxy leftovers [DependencyInjection] Use more clear message when unused environment variables detected [Form][Profiler] Fixes form collector triggering deprecations mitigate BC break with empty trusted_proxies [Profiler] Never wrap in code excerpts [Form][FrameworkBundle] Remove non-existing arg for data_collector.form explain that a role can be an instance of Role [Cache] fix Redis scheme detection mix attr options between type-guess options and user options
2 parents 7140b52 + 7769179 commit b0ede2c

File tree

33 files changed

+270
-79
lines changed

33 files changed

+270
-79
lines changed

CHANGELOG-3.3.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,36 @@ in 3.3 minor versions.
77
To get the diff for a specific change, go to https://github.com/symfony/symfony/commit/XXX where XXX is the change hash
88
To get the diff between two versions, go to https://github.com/symfony/symfony/compare/v3.3.0...v3.3.1
99

10+
* 3.3.1 (2017-06-05)
11+
12+
* bug #23067 [HttpFoundation][FrameworkBundle] Revert "trusted proxies" BC break (nicolas-grekas)
13+
* bug #23065 [Cache] Fallback to positional when keyed results are broken (nicolas-grekas)
14+
* bug #22981 [DependencyInjection] Fix named args support in ChildDefinition (dunglas)
15+
* bug #23050 [Form][Profiler] Fixes form collector triggering deprecations (ogizanagi)
16+
* bug #22971 [Profiler] Fix code excerpt wrapping (ogizanagi)
17+
* bug #23049 [FrameworkBundle] mitigate BC break with empty trusted_proxies (xabbuh)
18+
* bug #23045 [Cache] fix Redis scheme detection (xabbuh)
19+
* bug #23013 Parse the _controller format in sub-requests (weaverryan)
20+
* bug #23015 [PhpUnitBridge] Fix detection of PHPUnit 5 (enumag)
21+
* bug #23041 [Config] Always protected ClassExistenceResource against bad parents (nicolas-grekas)
22+
* bug #22988 [PropertyInfo][DoctrineBridge] The bigint Doctrine's type must be converted to string (dunglas)
23+
* bug #23014 Fix optional cache warmers are always instantiated whereas they should be lazy-loaded (romainneutron)
24+
* feature #23022 [Di] Remove closure-proxy arguments (nicolas-grekas)
25+
* bug #23024 [EventDispatcher] Fix ContainerAwareEventDispatcher::hasListeners(null) (nicolas-grekas)
26+
* bug #23008 [EventDispatcher] Handle laziness internally instead of relying on ClosureProxyArgument (nicolas-grekas)
27+
* bug #23018 [FrameworkBundle] Fix CacheCollectorPass priority (chalasr)
28+
* bug #23009 [Routing] Allow GET requests to be redirected. Fixes #23004 (frankdejonge)
29+
* bug #22996 [Form] Fix \IntlDateFormatter timezone parameter usage to bypass PHP bug #66323 (romainneutron)
30+
* bug #22965 [Cache] Ignore missing annotations.php (ro0NL)
31+
* bug #22993 [DI] Autowiring exception thrown when inlined service is removed (weaverryan)
32+
* bug #22999 Better DI type deprecation message (weaverryan)
33+
* bug #22985 [Config] Allow empty globs (nicolas-grekas)
34+
* bug #22961 [HttpKernel] Support unknown format in LoggerDataCollector (iltar)
35+
* bug #22991 [DI] Don't throw Autowire exception for removed service with private __construct (weaverryan)
36+
* bug #22968 [Profiler] Fix text selection & click on file links on exception pages (ogizanagi)
37+
* bug #22994 Harden the debugging of Twig filters and functions (stof)
38+
* bug #22960 [Cache] Fix decoration of TagAware adapters in dev (chalasr)
39+
1040
* 3.3.0 (2017-05-29)
1141

1242
* bug #22940 [Config] Fallback to regular import when glob fails (nicolas-grekas)

src/Symfony/Bridge/Twig/NodeVisitor/TranslationDefaultDomainNodeVisitor.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,15 @@
1414
use Symfony\Bridge\Twig\Node\TransNode;
1515
use Symfony\Bridge\Twig\Node\TransDefaultDomainNode;
1616
use Twig\Environment;
17+
use Twig\Node\BlockNode;
1718
use Twig\Node\Expression\ArrayExpression;
1819
use Twig\Node\Expression\AssignNameExpression;
1920
use Twig\Node\Expression\ConstantExpression;
2021
use Twig\Node\Expression\FilterExpression;
2122
use Twig\Node\Expression\NameExpression;
2223
use Twig\Node\ModuleNode;
2324
use Twig\Node\Node;
25+
use Twig\Node\SetNode;
2426
use Twig\NodeVisitor\AbstractNodeVisitor;
2527

2628
/**
@@ -48,7 +50,7 @@ public function __construct()
4850
*/
4951
protected function doEnterNode(Node $node, Environment $env)
5052
{
51-
if ($node instanceof Node_Block || $node instanceof ModuleNode) {
53+
if ($node instanceof BlockNode || $node instanceof ModuleNode) {
5254
$this->scope = $this->scope->enter();
5355
}
5456

@@ -62,7 +64,7 @@ protected function doEnterNode(Node $node, Environment $env)
6264
$name = new AssignNameExpression($var, $node->getTemplateLine());
6365
$this->scope->set('domain', new NameExpression($var, $node->getTemplateLine()));
6466

65-
return new Node_Set(false, new Node(array($name)), new Node(array($node->getNode('expr'))), $node->getTemplateLine());
67+
return new SetNode(false, new Node(array($name)), new Node(array($node->getNode('expr'))), $node->getTemplateLine());
6668
}
6769
}
6870

@@ -104,7 +106,7 @@ protected function doLeaveNode(Node $node, Environment $env)
104106
return false;
105107
}
106108

107-
if ($node instanceof Node_Block || $node instanceof ModuleNode) {
109+
if ($node instanceof BlockNode || $node instanceof ModuleNode) {
108110
$this->scope = $this->scope->leave();
109111
}
110112

src/Symfony/Bundle/FrameworkBundle/CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ CHANGELOG
77
* Not defining the `type` option of the `framework.workflows.*` configuration entries is deprecated.
88
The default value will be `state_machine` in Symfony 4.0.
99
* Deprecated the `CompilerDebugDumpPass` class
10-
* [BC BREAK] Removed the "framework.trusted_proxies" configuration option and the corresponding "kernel.trusted_proxies" parameter
10+
* Deprecated the "framework.trusted_proxies" configuration option and the corresponding "kernel.trusted_proxies" parameter
1111
* Added a new new version strategy option called json_manifest_path
1212
that allows you to use the `JsonManifestVersionStrategy`.
1313
* Added `Symfony\Bundle\FrameworkBundle\Controller\AbstractController`. It provides

src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/Descriptor.php

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -307,11 +307,4 @@ protected function sortServiceIds(array $serviceIds)
307307

308308
return $serviceIds;
309309
}
310-
311-
protected function formatClosure(\Closure $closure)
312-
{
313-
$r = new \ReflectionFunction($closure);
314-
315-
return 'closure';
316-
}
317310
}

src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/JsonDescriptor.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,7 @@ private function getCallableData($callable, array $options = array())
373373
}
374374

375375
if ($callable instanceof \Closure) {
376-
$data['type'] = $this->formatClosure($callable);
376+
$data['type'] = 'closure';
377377

378378
return $data;
379379
}

src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/MarkdownDescriptor.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -352,8 +352,7 @@ protected function describeCallable($callable, array $options = array())
352352
}
353353

354354
if ($callable instanceof \Closure) {
355-
$formatted = $this->formatClosure($callable);
356-
$string .= "\n- Type: `$formatted`";
355+
$string .= "\n- Type: `closure`";
357356

358357
return $this->write($string."\n");
359358
}

src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/TextDescriptor.php

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -475,13 +475,7 @@ private function formatCallable($callable)
475475
}
476476

477477
if ($callable instanceof \Closure) {
478-
$formatted = $this->formatClosure($callable);
479-
480-
if ('closure' === $formatted) {
481-
return '\Closure()';
482-
}
483-
484-
return $formatted.'()';
478+
return '\Closure()';
485479
}
486480

487481
if (method_exists($callable, '__invoke')) {

src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/XmlDescriptor.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -593,7 +593,7 @@ private function getCallableDocument($callable)
593593
}
594594

595595
if ($callable instanceof \Closure) {
596-
$callableXML->setAttribute('type', $this->formatClosure($callable));
596+
$callableXML->setAttribute('type', 'closure');
597597

598598
return $dom;
599599
}

src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,38 @@ public function getConfigTreeBuilder()
6565
->info("Set true to enable support for the '_method' request parameter to determine the intended HTTP method on POST requests. Note: When using the HttpCache, you need to call the method in your front controller instead")
6666
->defaultTrue()
6767
->end()
68-
->arrayNode('trusted_proxies') // @deprecated in version 3.3, to be removed in 4.0
68+
->arrayNode('trusted_proxies')
6969
->beforeNormalization()
70-
->always()
71-
->thenInvalid('The "framework.trusted_proxies" configuration key has been removed in Symfony 3.3. Use the Request::setTrustedProxies() method in your front controller instead.')
70+
->ifTrue(function ($v) {
71+
@trigger_error('The "framework.trusted_proxies" configuration key has been deprecated in Symfony 3.3. Use the Request::setTrustedProxies() method in your front controller instead.', E_USER_DEPRECATED);
72+
73+
return !is_array($v) && null !== $v;
74+
})
75+
->then(function ($v) { return is_bool($v) ? array() : preg_split('/\s*,\s*/', $v); })
76+
->end()
77+
->prototype('scalar')
78+
->validate()
79+
->ifTrue(function ($v) {
80+
if (empty($v)) {
81+
return false;
82+
}
83+
84+
if (false !== strpos($v, '/')) {
85+
if ('0.0.0.0/0' === $v) {
86+
return false;
87+
}
88+
89+
list($v, $mask) = explode('/', $v, 2);
90+
91+
if (strcmp($mask, (int) $mask) || $mask < 1 || $mask > (false !== strpos($v, ':') ? 128 : 32)) {
92+
return true;
93+
}
94+
}
95+
96+
return !filter_var($v, FILTER_VALIDATE_IP);
97+
})
98+
->thenInvalid('Invalid proxy IP "%s"')
99+
->end()
72100
->end()
73101
->end()
74102
->scalarNode('ide')->defaultNull()->end()

src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,9 @@ public function load(array $configs, ContainerBuilder $container)
155155

156156
$container->setParameter('kernel.http_method_override', $config['http_method_override']);
157157
$container->setParameter('kernel.trusted_hosts', $config['trusted_hosts']);
158+
if ($config['trusted_proxies']) {
159+
$container->setParameter('kernel.trusted_proxies', $config['trusted_proxies']);
160+
}
158161
$container->setParameter('kernel.default_locale', $config['default_locale']);
159162

160163
if (!$container->hasParameter('debug.file_link_format')) {

src/Symfony/Bundle/FrameworkBundle/Resources/config/form_debug.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
<service id="data_collector.form" class="Symfony\Component\Form\Extension\DataCollector\FormDataCollector" public="true">
2727
<tag name="data_collector" template="@WebProfiler/Collector/form.html.twig" id="form" priority="310" />
2828
<argument type="service" id="data_collector.form.extractor" />
29-
<argument>false</argument>
3029
</service>
3130
</services>
3231
</container>

src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/ConfigurationTest.php

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,103 @@ public function testDoNoDuplicateDefaultFormResources()
4343
$this->assertEquals(array('FrameworkBundle:Form'), $config['templating']['form']['resources']);
4444
}
4545

46+
/**
47+
* @group legacy
48+
* @expectedDeprecation The "framework.trusted_proxies" configuration key has been deprecated in Symfony 3.3. Use the Request::setTrustedProxies() method in your front controller instead.
49+
*/
50+
public function testTrustedProxiesSetToNullIsDeprecated()
51+
{
52+
$processor = new Processor();
53+
$configuration = new Configuration(true);
54+
$processor->processConfiguration($configuration, array(array('trusted_proxies' => null)));
55+
}
56+
57+
/**
58+
* @group legacy
59+
* @expectedDeprecation The "framework.trusted_proxies" configuration key has been deprecated in Symfony 3.3. Use the Request::setTrustedProxies() method in your front controller instead.
60+
*/
61+
public function testTrustedProxiesSetToEmptyArrayIsDeprecated()
62+
{
63+
$processor = new Processor();
64+
$configuration = new Configuration(true);
65+
$processor->processConfiguration($configuration, array(array('trusted_proxies' => array())));
66+
}
67+
68+
/**
69+
* @group legacy
70+
* @expectedDeprecation The "framework.trusted_proxies" configuration key has been deprecated in Symfony 3.3. Use the Request::setTrustedProxies() method in your front controller instead.
71+
*/
72+
public function testTrustedProxiesSetToNonEmptyArrayIsInvalid()
73+
{
74+
$processor = new Processor();
75+
$configuration = new Configuration(true);
76+
$processor->processConfiguration($configuration, array(array('trusted_proxies' => array('127.0.0.1'))));
77+
}
78+
79+
/**
80+
* @group legacy
81+
* @dataProvider getTestValidTrustedProxiesData
82+
*/
83+
public function testValidTrustedProxies($trustedProxies, $processedProxies)
84+
{
85+
$processor = new Processor();
86+
$configuration = new Configuration(true);
87+
$config = $processor->processConfiguration($configuration, array(array(
88+
'secret' => 's3cr3t',
89+
'trusted_proxies' => $trustedProxies,
90+
)));
91+
92+
$this->assertEquals($processedProxies, $config['trusted_proxies']);
93+
}
94+
95+
public function getTestValidTrustedProxiesData()
96+
{
97+
return array(
98+
array(array('127.0.0.1'), array('127.0.0.1')),
99+
array(array('::1'), array('::1')),
100+
array(array('127.0.0.1', '::1'), array('127.0.0.1', '::1')),
101+
array(null, array()),
102+
array(false, array()),
103+
array(array(), array()),
104+
array(array('10.0.0.0/8'), array('10.0.0.0/8')),
105+
array(array('::ffff:0:0/96'), array('::ffff:0:0/96')),
106+
array(array('0.0.0.0/0'), array('0.0.0.0/0')),
107+
);
108+
}
109+
110+
/**
111+
* @group legacy
112+
* @expectedException \Symfony\Component\Config\Definition\Exception\InvalidConfigurationException
113+
*/
114+
public function testInvalidTypeTrustedProxies()
115+
{
116+
$processor = new Processor();
117+
$configuration = new Configuration(true);
118+
$processor->processConfiguration($configuration, array(
119+
array(
120+
'secret' => 's3cr3t',
121+
'trusted_proxies' => 'Not an IP address',
122+
),
123+
));
124+
}
125+
126+
/**
127+
* @group legacy
128+
* @expectedException \Symfony\Component\Config\Definition\Exception\InvalidConfigurationException
129+
*/
130+
public function testInvalidValueTrustedProxies()
131+
{
132+
$processor = new Processor();
133+
$configuration = new Configuration(true);
134+
135+
$processor->processConfiguration($configuration, array(
136+
array(
137+
'secret' => 's3cr3t',
138+
'trusted_proxies' => array('Not an IP address'),
139+
),
140+
));
141+
}
142+
46143
public function testAssetsCanBeEnabled()
47144
{
48145
$processor = new Processor();
@@ -124,6 +221,7 @@ protected static function getBundleDefaultConfig()
124221
{
125222
return array(
126223
'http_method_override' => true,
224+
'trusted_proxies' => array(),
127225
'ide' => null,
128226
'default_locale' => 'en',
129227
'csrf_protection' => array(

src/Symfony/Bundle/TwigBundle/Resources/views/exception.css.twig

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ header .container { display: flex; justify-content: space-between; }
9595
.trace-head .icon svg { height: 24px; width: 24px; }
9696

9797
.trace-message { font-size: 14px; font-weight: normal; margin: .5em 0 0; }
98-
98+
.trace-details { table-layout: fixed; }
9999
.trace-line { position: relative; padding-left: 36px; }
100100
.trace-line.sf-toggle:hover { background: #F5F5F5; }
101101
.trace-line a { color: #222; }
@@ -108,12 +108,12 @@ header .container { display: flex; justify-content: space-between; }
108108
.trace-method { color: #B0413E; color: #222; font-weight: bold; color: #B0413E; }
109109
.trace-arguments { color: #222; color: #999; font-weight: normal; color: #795da3; color: #777; padding-left: 2px; }
110110

111-
.trace-code { background: #FFF; font-size: 12px; margin: 10px 0 2px; padding: 10px; }
112-
.trace-code ol { margin: 0; }
113-
.trace-code li { color: #969896; margin: 0; padding-left: 10px; }
114-
.trace-code li + li { margin-top: 10px; }
115-
.trace-code li.selected { background: #F8EEC7; padding: 3px 0 3px 10px; }
116-
.trace-code li code { color: #222; }
111+
.trace-code { background: #FFF; font-size: 12px; margin: 10px 0 2px; padding: 10px; overflow-x: auto; }
112+
.trace-code ol { margin: 0; float: left; }
113+
.trace-code li { color: #969896; margin: 0; padding-left: 10px; float: left; width: 100%; }
114+
.trace-code li + li { margin-top: 5px; }
115+
.trace-code li.selected { background: #F8EEC7; padding: 3px 0 3px 10px; margin-top: 2px; }
116+
.trace-code li code { color: #222; white-space: nowrap; }
117117

118118
.trace-as-text .stacktrace { line-height: 1.8; margin: 0 0 15px; white-space: pre-wrap; }
119119

0 commit comments

Comments
 (0)