-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[SecurityBundle] providerIds is undefined error when firewall provider is not specified #25100
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@@ -693,7 +693,7 @@ private function createExceptionListener($container, $config, $id, $defaultEntry | ||
|
||
private function createSwitchUserListener($container, $id, $config, $defaultProvider, $stateless) | ||
{ | ||
$userProvider = isset($config['provider']) ? $this->getUserProviderId($config['provider']) : ($defaultProvider ?: $this->getFirstProvider($id, 'switch_user', $providerIds)); | ||
$userProvider = isset($config['provider']) ? $this->getUserProviderId($config['provider']) : $defaultProvider; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line should not be changed, $providerIds
argument should be added to the method and passed when calling it from createFirewall
(where the variable is defined)
Now it works without specifying provider in the firewall
@chalasr I changed it, according to your comment. Now it works without specifying a provider in the firewall. |
Thanks for fixing this bug and congratz for your first contribution to Symfony @karser! |
…all provider is not specified (karser) This PR was squashed before being merged into the 3.4 branch (closes #25100). Discussion ---------- [SecurityBundle] providerIds is undefined error when firewall provider is not specified | Q | A | ------------- | --- | Branch? | 3.4 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | n/a | License | MIT | Doc PR | n/a If I don't specify user provider on a firewall, it throws an error: `Undefined variable: providerIds`. That's because of $providerIds in [3.4-RC1](https://github.com/symfony/symfony/blob/v3.4.0-RC1/src/Symfony/Bundle/SecurityBundle/DependencyInjection/SecurityExtension.php#L696) that is not defined. ``` private function createSwitchUserListener($container, $id, $config, $defaultProvider, $stateless) { $userProvider = isset($config['provider']) ? $this->getUserProviderId($config['provider']) : ($defaultProvider ?: $this->getFirstProvider($id, 'switch_user', $providerIds)); ``` In fact, in [master](https://github.com/symfony/symfony/blob/master/src/Symfony/Bundle/SecurityBundle/DependencyInjection/SecurityExtension.php#L599) it's fixed If I add a provider to the firewall, this error doesn't reproduce: ``` secured_area: switch_user: true provider: chain_provider ``` Commits ------- 74dad79 [SecurityBundle] providerIds is undefined error when firewall provider is not specified
…all provider is not specified (karser) This PR was squashed before being merged into the 3.4 branch (closes #25100). Discussion ---------- [SecurityBundle] providerIds is undefined error when firewall provider is not specified | Q | A | ------------- | --- | Branch? | 3.4 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | n/a | License | MIT | Doc PR | n/a If I don't specify user provider on a firewall, it throws an error: `Undefined variable: providerIds`. That's because of $providerIds in [3.4-RC1](https://github.com/symfony/symfony/blob/v3.4.0-RC1/src/Symfony/Bundle/SecurityBundle/DependencyInjection/SecurityExtension.php#L696) that is not defined. ``` private function createSwitchUserListener($container, $id, $config, $defaultProvider, $stateless) { $userProvider = isset($config['provider']) ? $this->getUserProviderId($config['provider']) : ($defaultProvider ?: $this->getFirstProvider($id, 'switch_user', $providerIds)); ``` In fact, in [master](https://github.com/symfony/symfony/blob/master/src/Symfony/Bundle/SecurityBundle/DependencyInjection/SecurityExtension.php#L599) it's fixed If I add a provider to the firewall, this error doesn't reproduce: ``` secured_area: switch_user: true provider: chain_provider ``` Commits ------- 3a27bba [SecurityBundle] providerIds is undefined error when firewall provider is not specified
…all provider is not specified (karser) This PR was squashed before being merged into the 3.4 branch (closes #25100). Discussion ---------- [SecurityBundle] providerIds is undefined error when firewall provider is not specified | Q | A | ------------- | --- | Branch? | 3.4 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | n/a | License | MIT | Doc PR | n/a If I don't specify user provider on a firewall, it throws an error: `Undefined variable: providerIds`. That's because of $providerIds in [3.4-RC1](https://github.com/symfony/symfony/blob/v3.4.0-RC1/src/Symfony/Bundle/SecurityBundle/DependencyInjection/SecurityExtension.php#L696) that is not defined. ``` private function createSwitchUserListener($container, $id, $config, $defaultProvider, $stateless) { $userProvider = isset($config['provider']) ? $this->getUserProviderId($config['provider']) : ($defaultProvider ?: $this->getFirstProvider($id, 'switch_user', $providerIds)); ``` In fact, in [master](https://github.com/symfony/symfony/blob/master/src/Symfony/Bundle/SecurityBundle/DependencyInjection/SecurityExtension.php#L599) it's fixed If I add a provider to the firewall, this error doesn't reproduce: ``` secured_area: switch_user: true provider: chain_provider ``` Commits ------- aedf897 [SecurityBundle] providerIds is undefined error when firewall provider is not specified
If I don't specify user provider on a firewall, it throws an error:
Undefined variable: providerIds
. That's because of $providerIds in 3.4-RC1 that is not defined.In fact, in master it's fixed
If I add a provider to the firewall, this error doesn't reproduce: