You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
bug #25045 [SecurityBundle] Don't trigger auto-picking notice if provider is set per listener (chalasr)
This PR was merged into the 3.4 branch.
Discussion
----------
[SecurityBundle] Don't trigger auto-picking notice if provider is set per listener
| Q | A
| ------------- | ---
| Branch? | 3.4
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #24980
| License | MIT
| Doc PR | n/a
Commits
-------
19e891a [SecurityBundle] Don't trigger auto-picking notice if provider is set per listener
// Provider id (take the first registered provider if none defined)
349
+
$defaultProvider = null;
349
350
if (isset($firewall['provider'])) {
350
351
if (!isset($providerIds[$normalizedName = str_replace('-', '_', $firewall['provider'])])) {
351
352
thrownewInvalidConfigurationException(sprintf('Invalid firewall "%s": user provider "%s" not found.', $id, $firewall['provider']));
352
353
}
353
354
$defaultProvider = $providerIds[$normalizedName];
354
-
} else {
355
+
} elseif (1 === count($providerIds)) {
355
356
$defaultProvider = reset($providerIds);
356
-
357
-
if (count($providerIds) > 1) {
358
-
@trigger_error(sprintf('Firewall "%s" has no "provider" set but multiple providers exist. Using the first configured provider (%s) is deprecated since 3.4 and will throw an exception in 4.0, set the "provider" key on the firewall instead.', $id, key($providerIds)), E_USER_DEPRECATED);
359
-
}
360
357
}
361
358
362
359
$config->replaceArgument(5, $defaultProvider);
@@ -500,7 +497,7 @@ private function createContextListener($container, $contextKey)
@trigger_error(sprintf('Listener "%s" on firewall "%s" has no "provider" set but multiple providers exist. Using the first configured provider (%s) is deprecated since 3.4 and will throw an exception in 4.0, set the "provider" key on the firewall instead.', $listenerName, $firewallName, $first = array_keys($providerIds)[0]), E_USER_DEPRECATED);
Copy file name to clipboardExpand all lines: src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/SecurityExtensionTest.php
+22-1
Original file line number
Diff line number
Diff line change
@@ -176,7 +176,7 @@ public function testSwitchUserNotStatelessOnStatelessFirewall()
176
176
177
177
/**
178
178
* @group legacy
179
-
* @expectedDeprecation Firewall "default" has no "provider" set but multiple providers exist. Using the first configured provider (first) is deprecated since 3.4 and will throw an exception in 4.0, set the "provider" key on the firewall instead.
179
+
* @expectedDeprecation Listener "http_basic" on firewall "default" has no "provider" set but multiple providers exist. Using the first configured provider (first) is deprecated since 3.4 and will throw an exception in 4.0, set the "provider" key on the firewall instead.
0 commit comments