Skip to content

Commit ea17bc7

Browse files
Merge branch '2.5' into 2.6
* 2.5: [Form] fixed a maxlength overring on a guessing [Debug] Show only unique class candidates [SecurityBundle] Firewall providers building - code cleaning [Filesystem] symlink use RealPath instead LinkTarget [DependencyInjection] Remove duplicate declaration in PhpDumper terminals are not interactive on Travis Revert "[DependencyInjection] backport perf optim" [WebProfilerBundle] replaced pattern to path attribute in routes definitions. fix phpdoc's alignment Fixed the AuthenticationProviderInterface alignment Fixed the proxy-manager version constraint [FrameworkBundle][Template name] avoid error message for the shortcut notation. [DependencyInjection] perf optim: call dirname() at most 5x [DependencyInjection] backport perf optim Fixed #12845 adding a listener to an event that is currently being dispatched will not result into a fatal error in TraceableEventDispatcher [EventDispatcher] [2.5] Remove possible call_user_func() [2.3] Remove possible call_user_func() Conflicts: src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services1-1.php src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services1.php src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services11.php src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services12.php src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services8.php src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9.php
2 parents 7d981e0 + 76c3508 commit ea17bc7

File tree

45 files changed

+367
-169
lines changed

Some content is hidden

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

45 files changed

+367
-169
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@
7575
"monolog/monolog": "~1.11",
7676
"propel/propel1": "~1.6",
7777
"ircmaxell/password-compat": "~1.0",
78-
"ocramius/proxy-manager": ">=0.3.1,<0.6-dev",
78+
"ocramius/proxy-manager": "~0.3.1",
7979
"egulias/email-validator": "~1.2"
8080
},
8181
"autoload": {

src/Symfony/Bridge/ProxyManager/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"require": {
1919
"php": ">=5.3.3",
2020
"symfony/dependency-injection": "~2.3",
21-
"ocramius/proxy-manager": ">=0.3.1,<0.6-dev"
21+
"ocramius/proxy-manager": "~0.3.1"
2222
},
2323
"require-dev": {
2424
"symfony/config": "~2.3"

src/Symfony/Bundle/FrameworkBundle/Templating/TemplateNameParser.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@
1111

1212
namespace Symfony\Bundle\FrameworkBundle\Templating;
1313

14-
use Symfony\Component\Templating\TemplateNameParserInterface;
1514
use Symfony\Component\Templating\TemplateReferenceInterface;
1615
use Symfony\Component\HttpKernel\KernelInterface;
16+
use Symfony\Component\Templating\TemplateNameParser as BaseTemplateNameParser;
1717

1818
/**
1919
* TemplateNameParser converts template names from the short notation
@@ -22,7 +22,7 @@
2222
*
2323
* @author Fabien Potencier <fabien@symfony.com>
2424
*/
25-
class TemplateNameParser implements TemplateNameParserInterface
25+
class TemplateNameParser extends BaseTemplateNameParser
2626
{
2727
protected $kernel;
2828
protected $cache = array();
@@ -56,7 +56,7 @@ public function parse($name)
5656
}
5757

5858
if (!preg_match('/^([^:]*):([^:]*):(.+)\.([^\.]+)\.([^\.]+)$/', $name, $matches)) {
59-
throw new \InvalidArgumentException(sprintf('Template name "%s" is not valid (format is "bundle:section:template.format.engine").', $name));
59+
return parent::parse($name);
6060
}
6161

6262
$template = new TemplateReference($matches[1], $matches[2], $matches[3], $matches[4], $matches[5]);

src/Symfony/Bundle/FrameworkBundle/Test/KernelTestCase.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ protected static function bootKernel(array $options = array())
141141
static::$kernel->boot();
142142
}
143143

144-
/**
144+
/**
145145
* Creates a Kernel.
146146
*
147147
* Available options:

src/Symfony/Bundle/FrameworkBundle/Tests/Functional/app/AppKernel.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,8 @@ public function serialize()
105105

106106
public function unserialize($str)
107107
{
108-
call_user_func_array(array($this, '__construct'), unserialize($str));
108+
$a = unserialize($str);
109+
$this->__construct($a[0], $a[1], $a[2], $a[3]);
109110
}
110111

111112
protected function getKernelParameters()

src/Symfony/Bundle/FrameworkBundle/Tests/Templating/TemplateNameParserTest.php

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
use Symfony\Bundle\FrameworkBundle\Tests\TestCase;
1515
use Symfony\Bundle\FrameworkBundle\Templating\TemplateNameParser;
1616
use Symfony\Bundle\FrameworkBundle\Templating\TemplateReference;
17+
use Symfony\Component\Templating\TemplateReference as BaseTemplateReference;
1718

1819
class TemplateNameParserTest extends TestCase
1920
{
@@ -63,25 +64,17 @@ public function getLogicalNameToTemplateProvider()
6364
array(':Post:index.html.php', new TemplateReference('', 'Post', 'index', 'html', 'php')),
6465
array('::index.html.php', new TemplateReference('', '', 'index', 'html', 'php')),
6566
array('FooBundle:Post:foo.bar.index.html.php', new TemplateReference('FooBundle', 'Post', 'foo.bar.index', 'html', 'php')),
67+
array('/path/to/section/name.php', new BaseTemplateReference('/path/to/section/name.php', 'php')),
68+
array('name.twig', new BaseTemplateReference('name.twig', 'twig')),
69+
array('name', new BaseTemplateReference('name')),
6670
);
6771
}
6872

6973
/**
70-
* @dataProvider getInvalidLogicalNameProvider
7174
* @expectedException \InvalidArgumentException
7275
*/
73-
public function testParseInvalidName($name)
76+
public function testParseValidNameWithNotFoundBundle()
7477
{
75-
$this->parser->parse($name);
76-
}
77-
78-
public function getInvalidLogicalNameProvider()
79-
{
80-
return array(
81-
array('BarBundle:Post:index.html.php'),
82-
array('FooBundle:Post:index'),
83-
array('FooBundle:Post'),
84-
array('FooBundle:Post:foo:bar'),
85-
);
78+
$this->parser->parse('BarBundle:Post:index.html.php');
8679
}
8780
}

src/Symfony/Bundle/SecurityBundle/DependencyInjection/SecurityExtension.php

Lines changed: 3 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -513,6 +513,7 @@ private function createUserDaoProvider($name, $provider, ContainerBuilder $conta
513513
{
514514
$name = $this->getUserProviderId(strtolower($name));
515515

516+
// Doctrine Entity and In-memory DAO provider are managed by factories
516517
foreach ($this->userProviderFactories as $factory) {
517518
$key = str_replace('-', '_', $factory->getKey());
518519

@@ -539,37 +540,12 @@ private function createUserDaoProvider($name, $provider, ContainerBuilder $conta
539540

540541
$container
541542
->setDefinition($name, new DefinitionDecorator('security.user.provider.chain'))
542-
->addArgument($providers)
543-
;
544-
545-
return $name;
546-
}
547-
548-
// Doctrine Entity DAO provider
549-
if (isset($provider['entity'])) {
550-
$container
551-
->setDefinition($name, new DefinitionDecorator('security.user.provider.entity'))
552-
->addArgument($provider['entity']['class'])
553-
->addArgument($provider['entity']['property'])
554-
;
543+
->addArgument($providers);
555544

556545
return $name;
557546
}
558547

559-
// In-memory DAO provider
560-
$definition = $container->setDefinition($name, new DefinitionDecorator('security.user.provider.in_memory'));
561-
foreach ($provider['users'] as $username => $user) {
562-
$userId = $name.'_'.$username;
563-
564-
$container
565-
->setDefinition($userId, new DefinitionDecorator('security.user.provider.in_memory.user'))
566-
->setArguments(array($username, (string) $user['password'], $user['roles']))
567-
;
568-
569-
$definition->addMethodCall('createUser', array(new Reference($userId)));
570-
}
571-
572-
return $name;
548+
throw new InvalidConfigurationException(sprintf('Unable to create definition for "%s" user provider', $name));
573549
}
574550

575551
private function getUserProviderId($name)
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?php
2+
3+
namespace Symfony\Bundle\SecurityBundle\Tests\DependencyInjection\Fixtures\UserProvider;
4+
5+
use Symfony\Bundle\SecurityBundle\DependencyInjection\Security\UserProvider\UserProviderFactoryInterface;
6+
use Symfony\Component\Config\Definition\Builder\NodeDefinition;
7+
use Symfony\Component\DependencyInjection\ContainerBuilder;
8+
9+
class DummyProvider implements UserProviderFactoryInterface
10+
{
11+
public function create(ContainerBuilder $container, $id, $config)
12+
{
13+
14+
}
15+
16+
public function getKey()
17+
{
18+
return 'foo';
19+
}
20+
21+
public function addConfiguration(NodeDefinition $node)
22+
{
23+
24+
}
25+
}

src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/SecurityExtensionTest.php

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
use Symfony\Bundle\SecurityBundle\DependencyInjection\SecurityExtension;
1515
use Symfony\Bundle\SecurityBundle\SecurityBundle;
16+
use Symfony\Bundle\SecurityBundle\Tests\DependencyInjection\Fixtures\UserProvider\DummyProvider;
1617
use Symfony\Component\DependencyInjection\ContainerBuilder;
1718

1819
class SecurityExtensionTest extends \PHPUnit_Framework_TestCase
@@ -66,6 +67,33 @@ public function testFirewallWithoutAuthenticationListener()
6667
$container->compile();
6768
}
6869

70+
/**
71+
* @expectedException \Symfony\Component\Config\Definition\Exception\InvalidConfigurationException
72+
* @expectedExceptionMessage Unable to create definition for "security.user.provider.concrete.my_foo" user provider
73+
*/
74+
public function testFirewallWithInvalidUserProvider()
75+
{
76+
$container = $this->getRawContainer();
77+
78+
$extension = $container->getExtension('security');
79+
$extension->addUserProviderFactory(new DummyProvider());
80+
81+
$container->loadFromExtension('security', array(
82+
'providers' => array(
83+
'my_foo' => array('foo' => []),
84+
),
85+
86+
'firewalls' => array(
87+
'some_firewall' => array(
88+
'pattern' => '/.*',
89+
'http_basic' => [],
90+
),
91+
),
92+
));
93+
94+
$container->compile();
95+
}
96+
6997
protected function getRawContainer()
7098
{
7199
$container = new ContainerBuilder();

src/Symfony/Bundle/SecurityBundle/Tests/Functional/app/AppKernel.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,8 @@ public function serialize()
105105

106106
public function unserialize($str)
107107
{
108-
call_user_func_array(array($this, '__construct'), unserialize($str));
108+
$a = unserialize($str);
109+
$this->__construct($a[0], $a[1], $a[2], $a[3]);
109110
}
110111

111112
protected function getKernelParameters()

0 commit comments

Comments
 (0)