8000 #21809 [SecurityBundle] bugfix: if security provider's name contains … · symfony/symfony@6d23c8c · GitHub
[go: up one dir, main page]

Skip to content

Commit 6d23c8c

Browse files
Antanas Arvaseviciusfabpot
Antanas Arvasevicius
authored andcommitted
#21809 [SecurityBundle] bugfix: if security provider's name contains upper cases then container didn't compile
1 parent a6b20d1 commit 6d23c8c

File tree

4 files changed

+69
-3
lines changed

4 files changed

+69
-3
lines changed

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

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

514514
// Doctrine Entity and In-memory DAO provider are managed by factories
515515
foreach ($this->userProviderFactories as $factory) {
@@ -533,7 +533,7 @@ private function createUserDaoProvider($name, $provider, ContainerBuilder $conta
533533
if (isset($provider['chain'])) {
534534
$providers = array();
535535
foreach ($provider['chain']['providers'] as $providerName) {
536-
$providers[] = new Reference($this->getUserProviderId(strtolower($providerName)));
536+
$providers[] = new Reference($this->getUserProviderId($providerName));
537537
}
538538

539539
$container
@@ -548,7 +548,7 @@ private function createUserDaoProvider($name, $provider, ContainerBuilder $conta
548548

549549
private function getUserProviderId($name)
550550
{
551-
return 'security.user.provider.concrete.'.$name;
551+
return 'security.user.provider.concrete.'.strtolower($name);
552552
}
553553

554554
private function createExceptionListener($container, $config, $id, $defaultEntryPoint, $stateless)
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
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+
);
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
imports:
2+
- { resource: ./../config/framework.yml }
3+
4+
doctrine:
5+
dbal:
6+
driver: pdo_sqlite
7+
memory: true
8+
charset: UTF8
9+
10+
orm:
11+
entity_managers:
12+
default:
13+
14+
auto_mapping: true
15+
16+
security:
17+
providers:
18+
camelCasedName:
19+
entity:
20+
class: Symfony\Component\Security\Core\User\User
21+
22+
firewalls:
23+
default:
24+
anonymous: ~
25+
provider: camelCasedName
26+
27+
encoders:
28+
Symfony\Component\Security\Core\User\User: plaintext
29+
30+
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)
0