8000 bug #21810 #21809 [SecurityBundle] bugfix: if security provider's nam… · MacDada/symfony@ac01aad · GitHub
[go: up one dir, main page]

Skip to content

Commit ac01aad

Browse files
committed
bug symfony#21810 symfony#21809 [SecurityBundle] bugfix: if security provider's name contains upper cases then container didn't compile (Antanas Arvasevicius)
This PR was submitted for the master branch but it was merged into the 2.7 branch instead (closes symfony#21810). Discussion ---------- symfony#21809 [SecurityBundle] bugfix: if security provider's name contains upper cases then container didn't compile | Q | A | ------------- | --- | Branch? | master | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? no | Tests pass? | yes | Fixed tickets | symfony#21809 | License | MIT then security.yml providers was with upper case, on container compile error was thrown: ```` [04:39:32][Ant output] [exec] [exec] > Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::clearCache [04:39:32][Ant output] [exec] [exec] [04:39:32][Ant output] [exec] [exec] [04:39:32][Ant output] [exec] [exec] 8000 [Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException] [04:39:32][Ant output] [exec] [exec] The service "security.authentication.provider.simple_form.default" has a de [04:39:32][Ant output] [exec] [exec] pendency on a non-existent service "security.user.provider.concrete.carrier [04:39:32][Ant output] [exec] [exec] User". ````` Problem has occurred with this commit line: symfony@fbd9f88#diff-2be909961a57bf75fbb600c1f5fc46e3R320 Issue fixes with this PR. Commits ------- 6d23c8c symfony#21809 [SecurityBundle] bugfix: if security provider's name contains upper cases then container didn't compile
2 parents a6b20d1 + 6d23c8c commit ac01aad

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