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

Skip to content

Commit ff76d26

Browse files
alamiraultfabpot
authored andcommitted
[SecurityBundle] Deprecate enabling bundle and not configuring it
1 parent c1311c1 commit ff76d26

File tree

5 files changed

+40
-0
lines changed

5 files changed

+40
-0
lines changed

UPGRADE-6.3.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
UPGRADE FROM 6.2 to 6.3
2+
=======================
3+
4+
SecurityBundle
5+
--------------
6+
7+
* Deprecate enabling bundle and not configuring it

src/Symfony/Bundle/SecurityBundle/CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
CHANGELOG
22
=========
33

4+
6.3
5+
---
6+
7+
* Deprecate enabling bundle and not configuring it
8+
49
6.2
510
---
611

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
use Symfony\Bundle\SecurityBundle\DependencyInjection\Security\Factory\AuthenticatorFactoryInterface;
1616
use Symfony\Bundle\SecurityBundle\DependencyInjection\Security\Factory\FirewallListenerFactoryInterface;
1717
use Symfony\Bundle\SecurityBundle\DependencyInjection\Security\UserProvider\UserProviderFactoryInterface;
18+
use Symfony\Bundle\SecurityBundle\SecurityBundle;
1819
use Symfony\Component\Config\Definition\ConfigurationInterface;
1920
use Symfony\Component\Config\Definition\Exception\InvalidConfigurationException;
2021
use Symfony\Component\Config\FileLocator;
@@ -88,6 +89,9 @@ public function prepend(ContainerBuilder $container)
8889
public function load(array $configs, ContainerBuilder $container)
8990
{
9091
if (!array_filter($configs)) {
92+
trigger_deprecation('symfony/security-bundle', '6.3', 'Enabling bundle "%s" and not configuring it is deprecated.', SecurityBundle::class);
93+
// uncomment the following line in 7.0
94+
// throw new InvalidArgumentException(sprintf('Enabling bundle "%s" and not configuring it is not allowed.', SecurityBundle::class));
9195
return;
9296
}
9397

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

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -848,6 +848,22 @@ public function testConfigureCustomFirewallListener()
848848
$this->assertContains('custom_firewall_listener_id', $firewallListeners);
849849
}
850850

851+
/**
852+
* @group legacy
853+
*/
854+
public function testNothingDoneWithEmptyConfiguration()
855+
{
856+
$container = $this->getRawContainer();
857+
858+
$container->loadFromExtension('security');
859+
860+
$this->expectDeprecation('Since symfony/security-bundle 6.3: Enabling bundle "Symfony\Bundle\SecurityBundle\SecurityBundle" and not configuring it is deprecated.');
861+
862+
$container->compile();
863+
864+
$this->assertFalse($container->has('security.authorization_checker'));
865+
}
866+
851867
protected function getRawContainer()
852868
{
853869
$container = new ContainerBuilder();
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,10 @@
11
imports:
22
- { resource: ./../config/framework.yml }
3+
4+
security:
5+
providers:
6+
dummy:
7+
memory: ~
8+
firewalls:
9+
dummy:
10+
security: false

0 commit comments

Comments
 (0)