Skip to content

Commit a28c522

Browse files
Merge branch '3.1' into 3.2
* 3.1: (28 commits) Fix merge [Validator] add class name to the cache key [Serializer] Remove AbstractObjectNormalizer::isAttributeToNormalize Throw less misleading exception when property access not found [Twig] Fix deprecations with Twig 1.29 Fixed typo [FrameworkBundle] Removed the kernel.debug parameter from the cache pool namespace seed Fix email address fix the docblock in regard to the role argument Don't use the "app" global variable in the profiler [VarDumper] fix tests when xdebug is enabled Fix merge FIXED NON EXISTING TYPE DECLARATION [Cache] Fix dumping SplDoublyLinkedList iter mode [Console] fixed PHP7 Errors when not using Dispatcher Regression test for missing controller arguments (3.1) Regression test for missing controller arguments fix a test checking for a value [Form][DX] FileType "multiple" fixes fixed CS ...
2 parents f5058ac + 59d0444 commit a28c522

File tree

50 files changed

+507
-92
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+507
-92
lines changed

UPGRADE-3.1.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,10 @@ Serializer
111111
deprecated and will not be supported in Symfony 4.0. You should use the
112112
`CacheClassMetadataFactory` class instead.
113113

114+
* The `AbstractObjectNormalizer::isAttributeToNormalize()` method has been removed
115+
because it was initially added by mistake, has never been used and is not tested
116+
nor documented.
117+
114118
Translation
115119
-----------
116120

src/Symfony/Bridge/Twig/Tests/Translation/TwigExtractorTest.php

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,7 @@ public function getExtractData()
7272
}
7373

7474
/**
75-
* @expectedException \Twig_Error
76-
* @expectedExceptionMessageRegExp /Unclosed "block" in ".*extractor(\/|\\)syntax_error\.twig" at line 1/
75+
* @expectedException \Twig_Error
7776
* @dataProvider resourcesWithSyntaxErrorsProvider
7877
*/
7978
public function testExtractSyntaxError($resources)
@@ -82,7 +81,19 @@ public function testExtractSyntaxError($resources)
8281
$twig->addExtension(new TranslationExtension($this->getMock('Symfony\Component\Translation\TranslatorInterface')));
8382

8483
$extractor = new TwigExtractor($twig);
85-
$extractor->extract($resources, new MessageCatalogue('en'));
84+
85+
try {
86+
$extractor->extract($resources, new MessageCatalogue('en'));
87+
} catch (\Twig_Error $e) {
88+
if (method_exists($e, 'getSourceContext')) {
89+
$this->assertSame(dirname(__DIR__).strtr('/Fixtures/extractor/syntax_error.twig', '/', DIRECTORY_SEPARATOR), $e->getFile());
90+
$this->assertSame(1, $e->getLine());
91+
$this->assertSame('Unclosed "block".', $e->getMessage());
92+
} else {
93+
$this->expectExceptionMessageRegExp('/Unclosed "block" in ".*extractor(\\/|\\\\)syntax_error\\.twig" at line 1/');
94+
}
95+
throw $e;
96+
}
8697
}
8798

8899
/**

src/Symfony/Bridge/Twig/Translation/TwigExtractor.php

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,14 @@ public function extract($resource, MessageCatalogue $catalogue)
6161
try {
6262
$this->extractTemplate(file_get_contents($file->getPathname()), $catalogue);
6363
} catch (\Twig_Error $e) {
64-
if ($file instanceof SplFileInfo) {
65-
$e->setTemplateName($file->getRelativePathname());
66-
} elseif ($file instanceof \SplFileInfo) {
67-
$e->setTemplateName($file->getRealPath() ?: $file->getPathname());
64+
if ($file instanceof \SplFileInfo) {
65+
$path = $file->getRealPath() ?: $file->getPathname();
66+
$name = $file instanceof SplFileInfo ? $file->getRelativePathname() : $path;
67+
if (method_exists($e, 'setSourceContext')) {
68+
$e->setSourceContext(new \Twig_Source('', $name, $path));
69+
} else {
70+
$e->setTemplateName($name);
71+
}
6872
}
6973

7074
throw $e;

src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/CachePoolPass.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public function process(ContainerBuilder $container)
3434
} else {
3535
$seed = '_'.$container->getParameter('kernel.root_dir');
3636
}
37-
$seed .= '.'.$container->getParameter('kernel.name').'.'.$container->getParameter('kernel.environment').'.'.$container->getParameter('kernel.debug');
37+
$seed .= '.'.$container->getParameter('kernel.name').'.'.$container->getParameter('kernel.environment');
3838

3939
$aliases = $container->getAliases();
4040
$attributes = array(

src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/CachePoolPassTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public function testNamespaceArgumentIsReplaced()
4545

4646
$this->cachePoolPass->process($container);
4747

48-
$this->assertSame('C42Pcl9VBJ', $cachePool->getArgument(0));
48+
$this->assertSame('D07rhFx97S', $cachePool->getArgument(0));
4949
}
5050

5151
public function testArgsAreReplaced()
@@ -69,7 +69,7 @@ public function testArgsAreReplaced()
6969

7070
$this->assertInstanceOf(Reference::class, $cachePool->getArgument(0));
7171
$this->assertSame('foobar', (string) $cachePool->getArgument(0));
72-
$this->assertSame('KO3xHaFEZU', $cachePool->getArgument(1));
72+
$this->assertSame('itantF+pIq', $cachePool->getArgument(1));
7373
$this->assertSame(3, $cachePool->getArgument(2));
7474
}
7575

src/Symfony/Bundle/TwigBundle/DependencyInjection/Compiler/ExtensionPass.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
namespace Symfony\Bundle\TwigBundle\DependencyInjection\Compiler;
1313

1414
use Symfony\Component\Config\Resource\ClassExistenceResource;
15+
use Symfony\Component\DependencyInjection\Alias;
1516
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
1617
use Symfony\Component\DependencyInjection\ContainerBuilder;
1718
use Symfony\Component\DependencyInjection\Reference;
@@ -74,7 +75,7 @@ public function process(ContainerBuilder $container)
7475
$loader->addTag('twig.loader');
7576
$loader->setMethodCalls($container->getDefinition('twig.loader.filesystem')->getMethodCalls());
7677

77-
$container->setDefinition('twig.loader.filesystem', $loader);
78+
$container->setAlias('twig.loader.filesystem', new Alias('twig.loader.native_filesystem', false));
7879
}
7980

8081
if ($container->has('assets.packages')) {

src/Symfony/Bundle/TwigBundle/TwigEngine.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,13 @@ public function render($name, array $parameters = array())
5252
if ($name instanceof TemplateReference) {
5353
try {
5454
// try to get the real name of the template where the error occurred
55-
$e->setTemplateName(sprintf('%s', $this->locator->locate($this->parser->parse($e->getTemplateName()))));
55+
$name = $e->getTemplateName();
56+
$path = (string) $this->locator->locate($this->parser->parse($name));
57+
if (method_exists($e, 'setSourceContext')) {
58+
$e->setSourceContext(new \Twig_Source('', $name, $path));
59+
} else {
60+
$e->setTemplateName($path);
61+
}
5662
} catch (\Exception $e2) {
5763
}
5864
}

src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/exception.css.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
padding-bottom: 2px;
1010
}
1111
.sf-reset .traces li {
12-
ccolor: #222;
12+
color: #222;
1313
font-size: 14px;
1414
padding: 5px 0;
1515
list-style-type: decimal;

src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/layout.html.twig

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
{%- else -%}
4040
{{ redirect_route }}
4141
{%- endif %}
42-
(<a href="{{ path('_profiler', { token: redirect.token }) }}">{{ redirect.token }}</a>)
42+
(<a href="{{ path('_profiler', { token: redirect.token, panel: request.query.get('panel', 'request') }) }}">{{ redirect.token }}</a>)
4343
</dd>
4444
</dl>
4545
{%- endif %}
@@ -113,9 +113,11 @@
113113
<ul id="menu-profiler">
114114
{% for name, template in templates %}
115115
{% set menu -%}
116-
{% with { collector: profile.getcollector(name), profiler_markup_version: profiler_markup_version } %}
117-
{{- block('menu', template) -}}
118-
{% endwith %}
116+
{% if block('menu', template) is defined %}
117+
{% with { collector: profile.getcollector(name), profiler_markup_version: profiler_markup_version } %}
118+
{{- block('menu', template) -}}
119+
{% endwith %}
120+
{% endif %}
119121
{%- endset %}
120122
{% if menu is not empty %}
121123
<li class="{{ name }} {{ name == panel ? 'selected' : '' }}">

src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/toolbar.css.twig

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -375,11 +375,13 @@
375375
border-color: #777;
376376
border-radius: 0;
377377
margin: 6px 0 12px 0;
378-
width: 200px;
379378
}
380379
.sf-toolbar-block-dump pre.sf-dump:last-child {
381380
margin-bottom: 0;
382381
}
382+
.sf-toolbar-block-dump .sf-toolbar-info-piece {
383+
display: block;
384+
}
383385
.sf-toolbar-block-dump .sf-toolbar-info-piece .sf-toolbar-file-line {
384386
color: #AAA;
385387
margin-left: 4px;

0 commit comments

Comments
 (0)