Skip to content
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

[DI] Fix using private services in expressions #23654

Merged
merged 1 commit into from Jul 26, 2017

Conversation

nicolas-grekas
Copy link
Member

@nicolas-grekas nicolas-grekas commented Jul 24, 2017

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

Since 3.2, fetching private services via $container->get() is deprecated.
This makes it impossible to use a private service in an expression.
Until this PR :)

@@ -299,7 +299,7 @@ protected function getMethodCall1Service()

$instance->setBar($this->get('foo'));
$instance->setBar(NULL);
$instance->setBar(($this->get("foo")->foo() . (($this->hasParameter("foo")) ? ($this->getParameter("foo")) : ("default"))));
$instance->setBar(($this->get('foo')->foo() . (($this->hasParameter("foo")) ? ($this->getParameter("foo")) : ("default"))));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You changed an instance of double quotes to single quotes on this line, but left three other instances untouched. Why not change them all to single quotes?

Never mind; I didn't notice this was a "compiled" file. I guess you would need to search out where else this is generated, which is likely not worth the effort.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a minor, yet important side effect of the way this block of code is generated.
Will be even more visible in 3.3 where this will be something completely different.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't wait! :-)

@nicolas-grekas
Copy link
Member Author

nicolas-grekas commented Jul 25, 2017

In fact, the remaining issue is now fixed in this very PR, as bug fix: private services used only in expressions are now considered when building the service dependency graph.

@nicolas-grekas nicolas-grekas merged commit f3da6cf into symfony:3.2 Jul 26, 2017
nicolas-grekas added a commit that referenced this pull request Jul 26, 2017
…ekas)

This PR was merged into the 3.2 branch.

Discussion
----------

[DI] Fix using private services in expressions

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

Since 3.2, fetching private services via `$container->get()` is deprecated.
This makes it impossible to use a private service in an expression.
Until this PR :)

Commits
-------

f3da6cf [DI] Fix using private services in expressions
@nicolas-grekas nicolas-grekas deleted the di-expression branch July 26, 2017 06:22
This was referenced Aug 1, 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.

None yet

5 participants