Skip to content

Commit fdb84b1

Browse files
committed
Merge branch '2.4' into 2.5
* 2.4: Remove Spaceless Blocks From Twig Templates Validate locales sets intos translator Fix UserPassword validator translation Remove Spaceless Blocks from Twig Form Templates fixed typo [HttpFoundation] Fix to prevent magic bytes injection in JSONP responses (Prevents CVE-2014-4671) added regression test fix issue #8171 on configuration tree for twig extension -- pairing up with @cordoval [HttpFoundation] Fix wrong assertion in Response test [Upgrade] Fixed markdown syntax [2.3][Form] Cleanup & fix phpdocs Added verbosity methods Conflicts: src/Symfony/Component/Form/FormError.php
2 parents ca8a951 + 355283a commit fdb84b1

File tree

8 files changed

+33
-8
lines changed

8 files changed

+33
-8
lines changed

DependencyInjection/Configuration.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ private function addTwigOptions(ArrayNodeDefinition $rootNode)
136136
->scalarNode('optimizations')->end()
137137
->arrayNode('paths')
138138
->normalizeKeys(false)
139+
->useAttributeAsKey('paths')
139140
->beforeNormalization()
140141
->always()
141142
->then(function ($paths) {
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?php
2+
3+
$container->loadFromExtension('twig', array(
4+
'paths' => array(
5+
'namespaced_path3' => 'namespace3',
6+
),
7+
));

Tests/DependencyInjection/Fixtures/php/full.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
'paths' => array(
2323
'path1',
2424
'path2',
25-
'namespaced_path1' => 'namespace',
26-
'namespaced_path2' => 'namespace',
25+
'namespaced_path1' => 'namespace1',
26+
'namespaced_path2' => 'namespace2',
2727
),
2828
));
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?xml version="1.0" ?>
2+
3+
<container xmlns="http://symfony.com/schema/dic/services"
4+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
5+
xmlns:twig="http://symfony.com/schema/dic/twig"
6+
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd
7+
http://symfony.com/schema/dic/twig http://symfony.com/schema/dic/twig/twig-1.0.xsd">
8+
9+
<twig:config auto-reload="true" autoescape="true" base-template-class="stdClass" cache="/tmp" charset="ISO-8859-1" debug="true" strict-variables="true">
10+
<twig:path namespace="namespace3">namespaced_path3</twig:path>
11+
</twig:config>
12+
</container>

Tests/DependencyInjection/Fixtures/xml/full.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
<twig:global key="pi">3.14</twig:global>
1616
<twig:path>path1</twig:path>
1717
<twig:path>path2</twig:path>
18-
<twig:path namespace="namespace">namespaced_path1</twig:path>
19-
<twig:path namespace="namespace">namespaced_path2</twig:path>
18+
<twig:path namespace="namespace1">namespaced_path1</twig:path>
19+
<twig:path namespace="namespace2">namespaced_path2</twig:path>
2020
</twig:config>
2121
</container>
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
twig:
2+
paths:
3+
namespaced_path3: namespace3

Tests/DependencyInjection/Fixtures/yml/full.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,5 @@ twig:
1717
paths:
1818
path1: ''
1919
path2: ''
20-
namespaced_path1: namespace
21-
namespaced_path2: namespace
20+
namespaced_path1: namespace1
21+
namespaced_path2: namespace2

Tests/DependencyInjection/TwigExtensionTest.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@ public function testTwigLoaderPaths($format)
145145
$container = $this->createContainer();
146146
$container->registerExtension(new TwigExtension());
147147
$this->loadFromFile($container, 'full', $format);
148+
$this->loadFromFile($container, 'extra', $format);
148149
$this->compileContainer($container);
149150

150151
$def = $container->getDefinition('twig.loader.filesystem');
@@ -160,8 +161,9 @@ public function testTwigLoaderPaths($format)
160161
$this->assertEquals(array(
161162
array('path1'),
162163
array('path2'),
163-
array('namespaced_path1', 'namespace'),
164-
array('namespaced_path2', 'namespace'),
164+
array('namespaced_path1', 'namespace1'),
165+
array('namespaced_path2', 'namespace2'),
166+
array('namespaced_path3', 'namespace3'),
165167
array(__DIR__.'/Fixtures/Resources/TwigBundle/views', 'Twig'),
166168
array(realpath(__DIR__.'/../..').'/Resources/views', 'Twig'),
167169
array(__DIR__.'/Fixtures/Resources/views'),

0 commit comments

Comments
 (0)