8000 $container->initialized is broken for aliases · Issue #12569 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content
8000

$container->initialized is broken for aliases #12569

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
chx opened this issue Nov 25, 2014 · 0 comments
Closed

$container->initialized is broken for aliases #12569

chx opened this issue Nov 25, 2014 · 0 comments

Comments

@chx
Copy link
Contributor
chx commented Nov 25, 2014
    public function get($id, $invalidBehavior = self::EXCEPTION_ON_INVALID_REFERENCE)
            if (isset($this->aliases[$id])) {
                $id = $this->aliases[$id];
            }
            // Re-use shared service instance if it exists.
            if (isset($this->services[$id]) || array_key_exists($id, $this->services)) {
                return $this->services[$id];
            }

compare to

    public function initialized($id)
    {
        $id = strtolower($id);
        return isset($this->services[$id]) || array_key_exists($id, $this->services);
    }

but the service is not at $id but at $this->aliases[$id]

fabpot added a commit that referenced this issue Nov 25, 2014
This PR was submitted for the master branch but it was merged into the 2.3 branch instead (closes #12570).

Discussion
----------

Fix initialized() with aliased services

| Q             | A
| ------------- | ---
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #12569
| License       | MIT
| Doc PR        |

Commits
-------

a18b6d1 Fix initialized() with aliased services
@fabpot fabpot closed this as completed Nov 25, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants
0