Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

[DI] Shared services should not be inlined in non-shared ones#27265

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
nicolas-grekas merged 1 commit intosymfony:3.4fromnicolas-grekas:di-no-inline
May 15, 2018

Conversation

@nicolas-grekas
Copy link
Member

@nicolas-grekasnicolas-grekas commentedMay 14, 2018
edited
Loading

QA
Branch?3.4
Bug fix?yes
New feature?no
BC breaks?no
Deprecations?no
Tests pass?yes
Fixed tickets-
LicenseMIT
Doc PR-

Already good on 2.7/2.8.

@nicolas-grekasnicolas-grekas merged commit6f8b862 intosymfony:3.4May 15, 2018
nicolas-grekas added a commit that referenced this pull requestMay 15, 2018
…nes (nicolas-grekas)This PR was merged into the 3.4 branch.Discussion----------[DI] Shared services should not be inlined in non-shared ones| Q             | A| ------------- | ---| Branch?       | 3.4| Bug fix?      | yes| New feature?  | no| BC breaks?    | no| Deprecations? | no| Tests pass?   | yes| Fixed tickets | -| License       | MIT| Doc PR        | -[Already good on 2.7/2.8.](https://github.com/symfony/symfony/blob/2.7/src/Symfony/Component/DependencyInjection/Compiler/InlineServiceDefinitionsPass.php#L152)Commits-------6f8b862 [DI] Shared services should not be inlined in non-shared ones
@nicolas-grekasnicolas-grekas deleted the di-no-inline branchMay 15, 2018 08:57
This was referencedMay 21, 2018
}

returntrue;
return$this->container->getDefinition($ids[0])->isShared();
Copy link
Member

Choose a reason for hiding this comment

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

Look like this change break the compilation withUndefined offset: 0 when the node doesn't have anyInEdges

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

hotfixed in5eb17e5
but I don't understand how this can happen logically (we're here because we did find a reference to the service, to it must have at least one in-edge.)
could you share a reproduder?

Copy link
Member

Choose a reason for hiding this comment

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

The use case is: I use a custom TestKernel which inject mocks in the container and set the service as Synthetic with a compiler pass

NB: Changing the type of the compiler pass toPassConfig::TYPE_AFTER_REMOVING (to run afterInlineServiceDefinitionsPass) fix the issue

This minimal reproduct case is:

class Kernel extends BaseKernel implements CompilerPassInterface{    // ...    public function process(ContainerBuilder $container)    {        // routing.resolver is just an example for the minimal reproduct case here        $container->getDefinition('routing.resolver')->setPublic(true)->setSynthetic(true);    }}

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

ok, so this means we are missing a check for synthetic service!
added in#27366

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@jderussejderussejderusse left review comments

@stofstofstof approved these changes

+1 more reviewer

@ogizanagiogizanagiogizanagi approved these changes

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Projects

None yet

Milestone

3.4

Development

Successfully merging this pull request may close these issues.

5 participants

@nicolas-grekas@stof@jderusse@ogizanagi@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp