Skip to content

Commit 7625f9e

Browse files
author
Antanas Arvasevicius
committed
#21809 [SecurityBundle] bugfix: if security provider's name contains upper cases then container didn't compile
1 parent 28a00da commit 7625f9e

File tree

4 files changed

+63
-3
lines changed

4 files changed

+63
-3
lines changed

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -558,7 +558,7 @@ private function createUserProviders($config, ContainerBuilder $container)
558558
// Parses a <provider> tag and returns the id for the related user provider service
559559
private function createUserDaoProvider($name, $provider, ContainerBuilder $container)
560560
{
561-
$name = $this->getUserProviderId(strtolower($name));
561+
$name = $this->getUserProviderId($name);
562562

563563
// Doctrine Entity and In-memory DAO provider are managed by factories
564564
foreach ($this->userProviderFactories as $factory) {
@@ -582,7 +582,7 @@ private function createUserDaoProvider($name, $provider, ContainerBuilder $conta
582582
if (isset($provider['chain'])) {
583583
$providers = array();
584584
foreach ($provider['chain']['providers'] as $providerName) {
585-
$providers[] = new Reference($this->getUserProviderId(strtolower($providerName)));
585+
$providers[] = new Reference($this->getUserProviderId($providerName));
586586
}
587587

588588
$container
@@ -597,7 +597,7 @@ private function createUserDaoProvider($name, $provider, ContainerBuilder $conta
597597

598598
private function getUserProviderId($name)
599599
{
600-
return 'security.user.provider.concrete.'.$name;
600+
return 'security.user.provider.concrete.'.strtolower($name);
601601
}
602602

603603
private function createExceptionListener($container, $config, $id, $defaultEntryPoint, $stateless)
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <fabien@symfony.com>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
return array(
13+
new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(),
14+
new Symfony\Bundle\SecurityBundle\SecurityBundle(),
15+
new Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
16+
new Symfony\Bundle\SecurityBundle\Tests\Functional\Bundle\AclBundle\AclBundle(),
17+
);
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
imports:
2+
- { resource: ./../config/framework.yml }
3+
4+
doctrine:
5+
dbal:
6+
driver: pdo_sqlite
7+
memory: true
8+
charset: UTF8
9+
10+
security:
11+
12+
firewalls:
13+
default:
14+
anonymous: ~
15+
provider: camelCasedName
16+
17+
encoders:
18+
Symfony\Component\Security\Core\User\User: plaintext
19+
20+
providers:
21+
camelCasedName:
22+
entity:
23+
class: Symfony\Component\Security\Core\User\User
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <fabien@symfony.com>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace Symfony\Bundle\SecurityBundle\Tests\Functional;
13+
14+
class CamelCasedProvidersCausesExceptionsTest extends WebTestCase
15+
{
16+
public function testBugfixExceptionThenCamelCasedProviderIsGiven()
17+
{
18+
$client = $this->createClient(array('test_case' => 'CamelCasedProviders', 'root_config' => 'config.yml'));
19+
}
20+
}

0 commit comments

Comments
 (0)