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

[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

Closed
wants to merge 2 commits into from

Conversation

karser
Copy link
Contributor

@karser karser commented Nov 22, 2017

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 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 it's fixed

If I add a provider to the firewall, this error doesn't reproduce:

    secured_area:
        switch_user: true
        provider: chain_provider

@karser karser changed the title providerIds is undefined error when firewall provider is not specified [SecurityBundle] providerIds is undefined error when firewall provider is not specified Nov 22, 2017
@@ -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;
Copy link
Member

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
@karser
Copy link
Contributor Author

karser commented Nov 22, 2017

@chalasr I changed it, according to your comment. Now it works without specifying a provider in the firewall.

@chalasr
Copy link
Member

chalasr commented Nov 22, 2017

Thanks for fixing this bug and congratz for your first contribution to Symfony @karser!

chalasr added a commit that referenced this pull request Nov 22, 2017
…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
chalasr added a commit that referenced this pull request Nov 22, 2017
…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
chalasr added a commit that referenced this pull request Nov 22, 2017
…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
@xabbuh xabbuh closed this Nov 22, 2017
This was referenced Nov 24, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants
Morty Proxy This is a proxified and sanitized view of the page, visit original site.