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

[DI] Add missing deprecation when fetching private services from ContainerBuilder #25244

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

Merged
merged 1 commit into from
Dec 1, 2017

Conversation

nicolas-grekas
Copy link
Member

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

@fabpot
Copy link
Member

fabpot commented Dec 1, 2017

Tests are red though, and this seems related.


foreach ($this->definitions + $this->aliasDefinitions as $id => $definition) {
if (!$definition->isPublic() || $definition->isPrivate()) {
$this->removedIds[$id] = true;
Copy link
Member Author

Choose a reason for hiding this comment

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

This is for ppl doing that, which is a no-op, but one we catch now:
image

@@ -733,6 +733,7 @@ public function testEnvInId()
PsrContainerInterface::class => true,
ContainerInterface::class => true,
'baz_%env(BAR)%' => true,
'bar_%env(BAR)%' => true,
Copy link
Member Author

Choose a reason for hiding this comment

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

the added entries are the same as on 4.0/master: we now list the public-by-private legacy services as removed, even if they're not really for BC in 3.4.

Copy link
Member

Choose a reason for hiding this comment

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

won't they appear as removed even if they are not in 4.0?

Copy link
Member Author

Choose a reason for hiding this comment

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

wdyt? they are in 4.0

Copy link
Member

@chalasr chalasr Dec 1, 2017

Choose a reason for hiding this comment

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

definition isn't removed if injected twice or more, is it? If it isn't, wouldn't getRemovedIds() return an id that has not been removed? (I'm wondering why we populate removedIds from another place that the one which actually removes unused definitions)

@@ -94,7 +94,7 @@ protected function instantiateController($class)
} catch (\TypeError $e) {
}

if ($this->container instanceof Container && in_array($class, $this->container->getRemovedIds(), true)) {
if ($this->container instanceof Container && isset($this->container->getRemovedIds()[strtolower($class)])) {
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 bit unrelated, but still found while playing with getRemovedIds: removed services are provided as keys

Copy link
Member

Choose a reason for hiding this comment

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

are you sure about the strtolower ? The normalized id is not the lowercase one

Copy link
Member Author

Choose a reason for hiding this comment

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

indeed, fixed

@nicolas-grekas
Copy link
Member Author

Now green

@fabpot
Copy link
Member

fabpot commented Dec 1, 2017

Thank you @nicolas-grekas.

@fabpot fabpot merged commit 93c0b38 into symfony:3.4 Dec 1, 2017
fabpot added a commit that referenced this pull request Dec 1, 2017
…s from ContainerBuilder (nicolas-grekas)

This PR was merged into the 3.4 branch.

Discussion
----------

[DI] Add missing deprecation when fetching private services from ContainerBuilder

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

Commits
-------

93c0b38 [DI] Add missing deprecation when fetching private services from ContainerBuilder
@nicolas-grekas nicolas-grekas deleted the di-deprec branch December 1, 2017 19:31
This was referenced Dec 4, 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.

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