Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit c79d4ab

Browse filesBrowse files
committed
feature #48043 [SecurityBundle] Deprecate enabling bundle and not configuring it (alamirault)
This PR was squashed before being merged into the 6.3 branch. Discussion ---------- [SecurityBundle] Deprecate enabling bundle and not configuring it | Q | A | ------------- | --- | Branch? | 6.3 | Bug fix? | no | New feature? | yes <!-- please update src/**/CHANGELOG.md files --> | Deprecations? | yes <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files --> | Tickets | Fix #47593 <!-- prefix each issue number with "Fix #", no need to create an issue if none exist, explain below instead --> | License | MIT | Doc PR | symfony/symfony-docs#... <!-- required for new features --> In order to improve DX, add Trigger deprecation when `SecurityBundle` is enable without configuration. Commits ------- ff76d26 [SecurityBundle] Deprecate enabling bundle and not configuring it
2 parents fd855dd + ff76d26 commit c79d4ab
Copy full SHA for c79d4ab

File tree

5 files changed

+40
-0
lines changed
Filter options

5 files changed

+40
-0
lines changed

‎UPGRADE-6.3.md

Copy file name to clipboard
+7Lines 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

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/SecurityBundle/CHANGELOG.md
+5Lines 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

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/SecurityBundle/DependencyInjection/SecurityExtension.php
+4Lines 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

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/SecurityExtensionTest.php
+16Lines 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();
+8Lines 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 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.