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

Skip to content

Commit 223cc6f

Browse files
committed
Merge branch '2.2'
* 2.2: fixed regression in the Finder component (it was possible to use it without using exec before, closes #6357) fixed a circular call (closes #6864) typo [Security] [Tests] added unit tests for the UserPasswordValidator class and made the validator service for the UserPassword constraint configurable. fixed wrong indentation tweaked previous commit [HttpKernel] Fix the URI signer (closes #6801) Add Arabic translations. [HttpKernel] fixed regression when rendering an inline controller and passing some objects (closes #6822) [FrameworkBundle] fixed typo renamed some classes and Twig functions to more descriptive names (refs #6871) Classcollectionloader: fix traits + enhancements Fix a deprecated method call in the tests Update `composer.json` files: - to allow versions ~2.2 (>=2.2,<3.0) of Doctrine DBAL, ORM & Common - fixed Propel1 versions difference between main and bridge files - fixed Twig versions difference between main and bridge files - to allow versions ~1.11 (>=1.11,<2.0) of Twig - fixed Locale ext-intl version to accept all, not non-existing version Correct comment in NativeSessionStorage regarding session.save_handler [Security] Add PHPDoc to AuthenticationEvents
2 parents d0aaf62 + bf8b0f7 commit 223cc6f

File tree

60 files changed

+1136
-438
lines changed

Some content is hidden

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

60 files changed

+1136
-438
lines changed

CHANGELOG-2.0.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ To get the diff between two versions, go to https://github.com/symfony/symfony/c
238238
* d67d419: [HttpFoundation] added missing trustProxy condition
239239
* efce640: [Yaml][Parser] throw an exception if not readable
240240
* aa58330: [Form] fixed flawed condition
241-
* 253eeba: [BugFix][Validator] Fix for PHP incosistent behaviour of ArrayAccess
241+
* 253eeba: [BugFix][Validator] Fix for PHP inconsistent behaviour of ArrayAccess
242242
* 0507840: Prevent parameters from overwriting the template filename.
243243
* 9bc41d0: [HttpFoundation] Fixed #3053
244244
* 9441c46: [DependencyInjection] PhpDumper, fixes #2730

composer.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717
],
1818
"require": {
1919
"php": ">=5.3.3",
20-
"doctrine/common": ">2.2,<2.4-dev",
21-
"twig/twig": ">=1.11.0,<2.0-dev",
20+
"doctrine/common": "~2.2",
21+
"twig/twig": "~1.11",
2222
"psr/log": "~1.0"
2323
},
2424
"replace": {
@@ -59,10 +59,10 @@
5959
},
6060
"require-dev": {
6161
"doctrine/data-fixtures": "1.0.*",
62-
"doctrine/dbal": ">=2.2,<2.4-dev",
63-
"doctrine/orm": ">=2.2.3,<2.4-dev",
62+
"doctrine/dbal": "~2.2",
63+
"doctrine/orm": "~2.2,>=2.2.3",
6464
"monolog/monolog": "~1.3",
65-
"propel/propel1": "dev-master"
65+
"propel/propel1": "1.6.*"
6666
},
6767
"autoload": {
6868
"psr-0": { "Symfony\\": "src/" },

src/Symfony/Bridge/Doctrine/composer.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
],
1818
"require": {
1919
"php": ">=5.3.3",
20-
"doctrine/common": ">=2.2,<2.4-dev"
20+
"doctrine/common": "~2.2"
2121
},
2222
"require-dev": {
2323
"symfony/stopwatch": "2.2.*",
@@ -27,15 +27,15 @@
2727
"symfony/security": "2.2.*",
2828
"symfony/validator": "2.2.*",
2929
"doctrine/data-fixtures": "1.0.*",
30-
"doctrine/dbal": ">=2.2,<2.4-dev",
31-
"doctrine/orm": ">=2.2.3,<2.4-dev"
30+
"doctrine/dbal": "~2.2",
31+
"doctrine/orm": "~2.2,>=2.2.3"
3232
},
3333
"suggest": {
3434
"symfony/form": "2.2.*",
3535
"symfony/validator": "2.2.*",
3636
"doctrine/data-fixtures": "1.0.*",
37-
"doctrine/dbal": ">=2.2,<2.4-dev",
38-
"doctrine/orm": ">=2.2.3,<2.4-dev"
37+
"doctrine/dbal": "~2.2",
38+
"doctrine/orm": "~2.2,>=2.2.3"
3939
},
4040
"autoload": {
4141
"psr-0": { "Symfony\\Bridge\\Doctrine\\": "" }

src/Symfony/Bridge/Twig/Extension/HttpKernelExtension.php

Lines changed: 27 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
namespace Symfony\Bridge\Twig\Extension;
1313

14-
use Symfony\Component\HttpKernel\HttpContentRenderer;
14+
use Symfony\Component\HttpKernel\Fragment\FragmentHandler;
1515
use Symfony\Component\HttpKernel\Controller\ControllerReference;
1616

1717
/**
@@ -21,50 +21,61 @@
2121
*/
2222
class HttpKernelExtension extends \Twig_Extension
2323
{
24-
private $renderer;
24+
private $handler;
2525

2626
/**
2727
* Constructor.
2828
*
29-
* @param HttpContentRenderer $renderer A HttpContentRenderer instance
29+
* @param FragmentHandler $handler A FragmentHandler instance
3030
*/
31-
public function __construct(HttpContentRenderer $renderer)
31+
public function __construct(FragmentHandler $handler)
3232
{
33-
$this->renderer = $renderer;
33+
$this->handler = $handler;
3434
}
3535

3636
public function getFunctions()
3737
{
3838
return array(
39-
'render' => new \Twig_Function_Method($this, 'render', array('is_safe' => array('html'))),
40-
'render_*' => new \Twig_Function_Method($this, 'renderStrategy', array('is_safe' => array('html'))),
39+
'render' => new \Twig_Function_Method($this, 'renderFragment', array('is_safe' => array('html'))),
40+
'render_*' => new \Twig_Function_Method($this, 'renderFragmentStrategy', array('is_safe' => array('html'))),
4141
'controller' => new \Twig_Function_Method($this, 'controller'),
4242
);
4343
}
4444

4545
/**
46-
* Renders a URI.
46+
* Renders a fragment.
4747
*
4848
* @param string $uri A URI
4949
* @param array $options An array of options
5050
*
51-
* @return string The Response content
51+
* @return string The fragment content
5252
*
53-
* @see Symfony\Component\HttpKernel\HttpContentRenderer::render()
53+
* @see Symfony\Component\HttpKernel\Fragment\FragmentHandler::render()
5454
*/
55-
public function render($uri, $options = array())
55+
public function renderFragment($uri, $options = array())
5656
{
57-
$options = $this->renderer->fixOptions($options);
57+
$options = $this->handler->fixOptions($options);
5858

59-
$strategy = isset($options['strategy']) ? $options['strategy'] : 'default';
59+
$strategy = isset($options['strategy']) ? $options['strategy'] : 'inline';
6060
unset($options['strategy']);
6161

62-
return $this->renderer->render($uri, $strategy, $options);
62+
return $this->handler->render($uri, $strategy, $options);
6363
}
6464

65-
public function renderStrategy($strategy, $uri, $options = array())
65+
/**
66+
* Renders a fragment.
67+
*
68+
* @param string $strategy A strategy name
69+
* @param string $uri A URI
70+
* @param array $options An array of options
71+
*
72+
* @return string The fragment content
73+
*
74+
* @see Symfony\Component\HttpKernel\Fragment\FragmentHandler::render()
75+
*/
76+
public function renderFragmentStrategy($strategy, $uri, $options = array())
6677
{
67-
return $this->renderer->render($uri, $strategy, $options);
78+
return $this->handler->render($uri, $strategy, $options);
6879
}
6980

7081
public function controller($controller, $attributes = array(), $query = array())

src/Symfony/Bridge/Twig/Tests/Extension/HttpKernelExtensionTest.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
use Symfony\Bridge\Twig\Tests\TestCase;
1616
use Symfony\Component\HttpFoundation\Request;
1717
use Symfony\Component\HttpFoundation\Response;
18-
use Symfony\Component\HttpKernel\HttpContentRenderer;
18+
use Symfony\Component\HttpKernel\Fragment\FragmentHandler;
1919

2020
class HttpKernelExtensionTest extends TestCase
2121
{
@@ -33,21 +33,21 @@ protected function setUp()
3333
/**
3434
* @expectedException \Twig_Error_Runtime
3535
*/
36-
public function testRenderWithError()
36+
public function testFragmentWithError()
3737
{
38-
$kernel = $this->getHttpContentRenderer($this->throwException(new \Exception('foo')));
38+
$kernel = $this->getFragmentHandler($this->throwException(new \Exception('foo')));
3939

40-
$loader = new \Twig_Loader_Array(array('index' => '{{ render("foo") }}'));
40+
$loader = new \Twig_Loader_Array(array('index' => '{{ fragment("foo") }}'));
4141
$twig = new \Twig_Environment($loader, array('debug' => true, 'cache' => false));
4242
$twig->addExtension(new HttpKernelExtension($kernel));
4343

4444
$this->renderTemplate($kernel);
4545
}
4646

47-
protected function getHttpContentRenderer($return)
47+
protected function getFragmentHandler($return)
4848
{
49-
$strategy = $this->getMock('Symfony\\Component\\HttpKernel\\RenderingStrategy\\RenderingStrategyInterface');
50-
$strategy->expects($this->once())->method('getName')->will($this->returnValue('default'));
49+
$strategy = $this->getMock('Symfony\\Component\\HttpKernel\\Fragment\\FragmentRendererInterface');
50+
$strategy->expects($this->once())->method('getName')->will($this->returnValue('inline'));
5151
$strategy->expects($this->once())->method('render')->will($return);
5252

5353
// simulate a master request
@@ -58,13 +58,13 @@ protected function getHttpContentRenderer($return)
5858
->will($this->returnValue(Request::create('/')))
5959
;
6060

61-
$renderer = new HttpContentRenderer(array($strategy));
61+
$renderer = new FragmentHandler(array($strategy));
6262
$renderer->onKernelRequest($event);
6363

6464
return $renderer;
6565
}
6666

67-
protected function renderTemplate(HttpContentRenderer $renderer, $template = '{{ render("foo") }}')
67+
protected function renderTemplate(FragmentHandler $renderer, $template = '{{ render("foo") }}')
6868
{
6969
$loader = new \Twig_Loader_Array(array('index' => $template));
7070
$twig = new \Twig_Environment($loader, array('debug' => true, 'cache' => false));

src/Symfony/Bridge/Twig/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
],
1818
"require": {
1919
"php": ">=5.3.3",
20-
"twig/twig": ">=1.9.1,<2.0-dev"
20+
"twig/twig": "~1.11"
2121
},
2222
"require-dev": {
2323
"symfony/form": "2.2.*",

src/Symfony/Bundle/FrameworkBundle/CHANGELOG.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ CHANGELOG
88
* deprecated `Symfony\Bundle\FrameworkBundle\HttpKernel::render()` and `Symfony\Bundle\FrameworkBundle\HttpKernel::forward()`
99
* deprecated the `Symfony\Bundle\FrameworkBundle\HttpKernel` class in favor of `Symfony\Component\HttpKernel\DependencyInjection\ContainerAwareHttpKernel`
1010
* added support for adding new HTTP content rendering strategies (like ESI and Hinclude)
11-
in the DIC via the `kernel.content_renderer_strategy` tag
11+
in the DIC via the `kernel.fragment_renderer` tag
1212
* [BC BREAK] restricted the `Symfony\Bundle\FrameworkBundle\HttpKernel::render()` method to only accept URIs or ControllerReference instances
1313
* `Symfony\Bundle\FrameworkBundle\HttpKernel::render()` method signature changed and the first argument
1414
must now be a URI or a ControllerReference instance (the `generateInternalUri()` method was removed)
15-
* The internal routes (`Resources/config/routing/internal.xml`) have been removed and replaced with a listener (`Symfony\Component\HttpKernel\EventListener\RouterProxyListener`)
15+
* The internal routes (`Resources/config/routing/internal.xml`) have been removed and replaced with a listener (`Symfony\Component\HttpKernel\EventListener\FragmentListener`)
1616
* The `render` method of the `actions` templating helper signature and arguments changed
1717
* replaced Symfony\Bundle\FrameworkBundle\Controller\TraceableControllerResolver by Symfony\Component\HttpKernel\Controller\TraceableControllerResolver
1818
* replaced Symfony\Component\HttpKernel\Debug\ContainerAwareTraceableEventDispatcher by Symfony\Component\HttpKernel\Debug\TraceableEventDispatcher

src/Symfony/Bundle/FrameworkBundle/Command/RouterDebugCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ protected function outputRoute(OutputInterface $output, $name)
130130

131131
$output->writeln(sprintf('<comment>Name</comment> %s', $name));
132132
$output->writeln(sprintf('<comment>Pattern</comment> %s', $route->getPath()));
133-
$output->writeln(sprintf('<comment>Host</comment> %s', $host));
133+
$output->writeln(sprintf('<comment>Host</comment> %s', $host));
134134
$output->writeln(sprintf('<comment>Class</comment> %s', get_class($route)));
135135

136136
$defaults = '';

src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/HttpRenderingStrategyPass.php renamed to src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/FragmentRendererPass.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,30 +16,30 @@
1616
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
1717

1818
/**
19-
* Adds services tagged kernel.content_renderer_strategy as HTTP content rendering strategies.
19+
* Adds services tagged kernel.fragment_renderer as HTTP content rendering strategies.
2020
*
2121
* @author Fabien Potencier <[email protected]>
2222
*/
23-
class HttpRenderingStrategyPass implements CompilerPassInterface
23+
class FragmentRendererPass implements CompilerPassInterface
2424
{
2525
public function process(ContainerBuilder $container)
2626
{
27-
if (false === $container->hasDefinition('http_content_renderer')) {
27+
if (false === $container->hasDefinition('fragment.handler')) {
2828
return;
2929
}
3030

31-
$definition = $container->getDefinition('http_content_renderer');
32-
foreach (array_keys($container->findTaggedServiceIds('kernel.content_renderer_strategy')) as $id) {
31+
$definition = $container->getDefinition('fragment.handler');
32+
foreach (array_keys($container->findTaggedServiceIds('kernel.fragment_renderer')) as $id) {
3333
// We must assume that the class value has been correctly filled, even if the service is created by a factory
3434
$class = $container->getDefinition($id)->getClass();
3535

3636
$refClass = new \ReflectionClass($class);
37-
$interface = 'Symfony\Component\HttpKernel\RenderingStrategy\RenderingStrategyInterface';
37+
$interface = 'Symfony\Component\HttpKernel\Fragment\FragmentRendererInterface';
3838
if (!$refClass->implementsInterface($interface)) {
3939
throw new \InvalidArgumentException(sprintf('Service "%s" must implement interface "%s".', $id, $interface));
4040
}
4141

42-
$definition->addMethodCall('addStrategy', array(new Reference($id)));
42+
$definition->addMethodCall('addRenderer', array(new Reference($id)));
4343
}
4444
}
4545
}

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ public function getConfigTreeBuilder()
7373

7474
$this->addFormSection($rootNode);
7575
$this->addEsiSection($rootNode);
76-
$this->addRouterProxySection($rootNode);
76+
$this->addFragmentsSection($rootNode);
7777
$this->addProfilerSection($rootNode);
7878
$this->addRouterSection($rootNode);
7979
$this->addSessionSection($rootNode);
@@ -115,15 +115,15 @@ private function addEsiSection(ArrayNodeDefinition $rootNode)
115115
;
116116
}
117117

118-
private function addRouterProxySection(ArrayNodeDefinition $rootNode)
118+
private function addFragmentsSection(ArrayNodeDefinition $rootNode)
119119
{
120120
$rootNode
121121
->children()
122-
->arrayNode('router_proxy')
123-
->info('proxy configuration for the HTTP content renderer')
122+
->arrayNode('fragments')
123+
->info('fragments configuration')
124124
->canBeEnabled()
125125
->children()
126-
->scalarNode('path')->defaultValue('/_proxy')->end()
126+
->scalarNode('path')->defaultValue('/_fragment')->end()
127127
->end()
128128
->end()
129129
->end()

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

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public function load(array $configs, ContainerBuilder $container)
4141

4242
$loader->load('web.xml');
4343
$loader->load('services.xml');
44-
$loader->load('content_generator.xml');
44+
$loader->load('fragment_renderer.xml');
4545

4646
// A translator must always be registered (as support is included by
4747
// default in the Form component). If disabled, an identity translator
@@ -92,7 +92,7 @@ public function load(array $configs, ContainerBuilder $container)
9292

9393
$this->registerValidationConfiguration($config['validation'], $container, $loader);
9494
$this->registerEsiConfiguration($config['esi'], $container, $loader);
95-
$this->registerRouterProxyConfiguration($config['router_proxy'], $container, $loader);
95+
$this->registerFragmentsConfiguration($config['fragments'], $container, $loader);
9696
$this->registerProfilerConfiguration($config['profiler'], $container, $loader);
9797
$this->registerTranslatorConfiguration($config['translator'], $container);
9898

@@ -166,9 +166,9 @@ private function registerFormConfiguration($config, ContainerBuilder $container,
166166
/**
167167
* Loads the ESI configuration.
168168
*
169-
* @param array $config A proxy configuration array
169+
* @param array $config An ESI configuration array
170170
* @param ContainerBuilder $container A ContainerBuilder instance
171-
* @param XmlFileLoader $loader An XmlFileLoader instance
171+
* @param XmlFileLoader $loader An XmlFileLoader instance
172172
*/
173173
private function registerEsiConfiguration(array $config, ContainerBuilder $container, XmlFileLoader $loader)
174174
{
@@ -180,20 +180,20 @@ private function registerEsiConfiguration(array $config, ContainerBuilder $conta
180180
}
181181

182182
/**
183-
* Loads the router proxy configuration.
183+
* Loads the fragments configuration.
184184
*
185-
* @param array $config A proxy configuration array
185+
* @param array $config A fragments configuration array
186186
* @param ContainerBuilder $container A ContainerBuilder instance
187-
* @param XmlFileLoader $loader An XmlFileLoader instance
187+
* @param XmlFileLoader $loader An XmlFileLoader instance
188188
*/
189-
private function registerRouterProxyConfiguration(array $config, ContainerBuilder $container, XmlFileLoader $loader)
189+
private function registerFragmentsConfiguration(array $config, ContainerBuilder $container, XmlFileLoader $loader)
190190
{
191191
if (!$this->isConfigEnabled($container, $config)) {
192192
return;
193193
}
194194

195-
$loader->load('proxy.xml');
196-
$container->setParameter('http_content_renderer.proxy_path', $config['path']);
195+
$loader->load('fragment_listener.xml');
196+
$container->setParameter('fragment.path', $config['path']);
197197
}
198198

199199
/**
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,19 @@
99
* file that was distributed with this source code.
1010
*/
1111

12-
namespace Symfony\Bundle\FrameworkBundle\RenderingStrategy;
12+
namespace Symfony\Bundle\FrameworkBundle\Fragment;
1313

1414
use Symfony\Component\DependencyInjection\ContainerInterface;
1515
use Symfony\Component\HttpFoundation\Request;
1616
use Symfony\Component\HttpKernel\UriSigner;
17-
use Symfony\Component\HttpKernel\RenderingStrategy\HIncludeRenderingStrategy;
17+
use Symfony\Component\HttpKernel\Fragment\HIncludeFragmentRenderer;
1818

1919
/**
2020
* Implements the Hinclude rendering strategy.
2121
*
2222
* @author Fabien Potencier <[email protected]>
2323
*/
24-
class ContainerAwareHIncludeRenderingStrategy extends HIncludeRenderingStrategy
24+
class ContainerAwareHIncludeFragmentRenderer extends HIncludeFragmentRenderer
2525
{
2626
private $container;
2727

src/Symfony/Bundle/FrameworkBundle/FrameworkBundle.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
use Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\CompilerDebugDumpPass;
2626
use Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\TranslationExtractorPass;
2727
use Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\TranslationDumperPass;
28-
use Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\HttpRenderingStrategyPass;
28+
use Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\FragmentRendererPass;
2929
use Symfony\Component\DependencyInjection\ContainerBuilder;
3030
use Symfony\Component\DependencyInjection\Compiler\PassConfig;
3131
use Symfony\Component\DependencyInjection\Scope;
@@ -66,7 +66,7 @@ public function build(ContainerBuilder $container)
6666
$container->addCompilerPass(new AddCacheClearerPass());
6767
$container->addCompilerPass(new TranslationExtractorPass());
6868
$container->addCompilerPass(new TranslationDumperPass());
69-
$container->addCompilerPass(new HttpRenderingStrategyPass(), PassConfig::TYPE_AFTER_REMOVING);
69+
$container->addCompilerPass(new FragmentRendererPass(), PassConfig::TYPE_AFTER_REMOVING);
7070

7171
if ($container->getParameter('kernel.debug')) {
7272
$container->addCompilerPass(new ContainerBuilderDebugDumpPass(), PassConfig::TYPE_AFTER_REMOVING);

0 commit comments

Comments
 (0)