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

[DependencyInjection] PhpDumper.php: hasReference() shouldn't search references in lazy service.#19902

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
fabpot merged 1 commit intosymfony:2.7fromantanas-arvasevicius:bugfix-phpdumper-lazy
Dec 3, 2016
Merged

[DependencyInjection] PhpDumper.php: hasReference() shouldn't search references in lazy service.#19902

fabpot merged 1 commit intosymfony:2.7fromantanas-arvasevicius:bugfix-phpdumper-lazy
Dec 3, 2016

Conversation

@antanas-arvasevicius
Copy link
Contributor

@antanas-arvaseviciusantanas-arvasevicius commentedSep 10, 2016
edited
Loading

QA
Branch?2.7
Bug fix?yes
New feature?yes
BC breaks?no
Tests pass?yes
Fixed tickets#19901
LicenseMIT
Doc PRN/A

more info:
#19901

@nicolas-grekas
Copy link
Member

Will this also solvedoctrine/DoctrineBundle#562?

Copy link
Contributor

@lemoinemlemoinem left a comment

Choose a reason for hiding this comment

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

Hello,

Thank you very much for your contribution... Could you re-insert the complete PR summary at the top of your PR. If a line seems irrelevant for your PR, just put N/A instead of removing it.

I think it would also be a nice touch to add a test for this behavior so we make sure the bug doesn't come back to haunt us later on.

@nicolas-grekas
Copy link
Member

@antanas-arvasevicius lookingat your comment here, I think we can close this PR, isn't it?

@antanas-arvasevicius
Copy link
ContributorAuthor

antanas-arvasevicius commentedOct 3, 2016
edited by nicolas-grekas
Loading

Hi, no this PR fixes the issue, I'll add some test cases to this PR and
hope this will be merged into release. But why do you think that this PR
should be closed?

@nicolas-grekas
Copy link
Member

why do you think that this PR should be closed?

Because reading your comment, you say "it's not due lazy->lazy" :)
And also because "lazy" is an optional feature that requires proxy-manager.
Or should this be done conditionally when proxy-manager is used?

@antanas-arvasevicius
Copy link
ContributorAuthor

antanas-arvasevicius commentedOct 3, 2016
edited by nicolas-grekas
Loading

Yes, that doctrine bug is not due lazy->lazy. It's due this bug which was
fixed with this PR. It's due a fact that hasReference() also scans lazy
service dependencies to find out circular dependencies, why is that so
because lazy is indirectly referenced and instantiated lazily. And that
Doctrine lazy listeners has worked only by miracle because it used
Configuration as inlined service definition and thats why hasReference
hadn't detected any circular dep.

@nicolas-grekas
Copy link
Member

So, what about:

Or should this be done conditionally when proxy-manager is used?

@antanas-arvasevicius
Copy link
ContributorAuthor

antanas-arvasevicius commentedOct 3, 2016
edited by nicolas-grekas
Loading

It would be reasonable to do it conditionally because if proxy-manager
doesn't exists then everything is instantiated eagerly and we need
detection of circular references in this case. If proxy-manager is
available then we need to "skip reference search in lazy service's
arguments". What do you think?

@nicolas-grekas
Copy link
Member

I agree :)

lemoinem and xabbuh reacted with thumbs up emoji

@fabpot
Copy link
Member

Anything to be done before merging this one?

@antanas-arvasevicius
Copy link
ContributorAuthor

On Nov 10, 2016 2:26 AM, "Fabien Potencier"notifications@github.com
wrote:

Anything to be done before merging this one?


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#19902 (comment), or
mute the thread
https://github.com/notifications/unsubscribe-auth/AEAcnFDb7RZgYeYoDImXkxBprTf1OUu2ks5q8mTOgaJpZM4J5yIT
.

@antanas-arvasevicius
Copy link
ContributorAuthor

Hi, needed to add unit test with DI setup which shows correct behavior (no
circular reference error while injecting argument in lazy service which is
dependent of that service itself) e.g. graph: new A(new B(A)). If B is
marked as lazy we should allow this configuration.

On Nov 10, 2016 7:32 AM, "Antanas Arvasevicius" <
antanas.arvasevicius@gmail.com> wrote:

On Nov 10, 2016 2:26 AM, "Fabien Potencier"notifications@github.com
wrote:

Anything to be done before merging this one?


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#19902 (comment), or
mute the thread
https://github.com/notifications/unsubscribe-auth/AEAcnFDb7RZgYeYoDImXkxBprTf1OUu2ks5q8mTOgaJpZM4J5yIT
.

@stof
Copy link
Member

if B is lazyand we can actually make it lazy (if we cannot generate the lazy proxy, it is the same than not being lazy)

@antanas-arvasevicius
Copy link
ContributorAuthor

Right, but what's the point to allow lazy:true without proxy mngr? Are
there any use cases for that?
Now, if you need a lazy for avoiding circular refs and proxy manager is not
there you'll get circular reference error and not an error which tells you
that you must enable proxy manager for this.

On Nov 10, 2016 12:11 PM, "Christophe Coevoet"notifications@github.com
wrote:

if B is lazyand we can actually make it lazy (if we cannot generate
the lazy proxy, it is the same than not being lazy)


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#19902 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AEAcnF7eP7HvJbyqeC04_6KkyTVKGC3hks5q8u3rgaJpZM4J5yIT
.

@fabpot
Copy link
Member

fabpot commentedNov 10, 2016
edited
Loading

At least for Open-Source bundles, people might tag a service as lazy as an optimization if the end user has the proxy manager and as a noop if it's not installed.

@antanas-arvasevicius
Copy link
ContributorAuthor

Added unit tests, And also had found out that CheckCircularReferencesPass detects circular references. I've applied patch for that too. Please review.

@antanas-arvasevicius
Copy link
ContributorAuthor

@fabpot could this be merged now? Or there are any problems?

@nicolas-grekas
Copy link
Member

rebase needed

@antanas-arvasevicius
Copy link
ContributorAuthor

Rebase onto what? Haven't thought that bug fix could take so long to be applied... I really do not understand how your bug fix apply policy works, but it sucks. Bye.

@HeahDude
Copy link
Contributor

A rebase on the target branch of this PR which is 2.7, since some other commits have changed some files modified in this PR, you need to resolve some conflicts so maintainers are able to merge it automatically. Thank you for contributing.

@antanas-arvasevicius
Copy link
ContributorAuthor

Thanks for explanation. Now rebased my branch. Is this fix will be available in 2.8 .. 3.1 also?

@HeahDude
Copy link
Contributor

Yes it will ;)

@HeahDude
Copy link
Contributor

👍

Status: Reviewed

@nicolas-grekas
Copy link
Member

👍 (the $isLazy temp var could be removed)

@fabpot
Copy link
Member

Thank you@antanas-arvasevicius.

@fabpotfabpot merged commit595a978 intosymfony:2.7Dec 3, 2016
fabpot added a commit that referenced this pull requestDec 3, 2016
…n't search references in lazy service. (antanas-arvasevicius)This PR was merged into the 2.7 branch.Discussion----------[DependencyInjection] PhpDumper.php: hasReference() shouldn't search references in lazy service.| Q | A || --- | --- || Branch? | 2.7 || Bug fix? | yes || New feature? | yes || BC breaks? | no || Tests pass? | yes || Fixed tickets |#19901 || License | MIT || Doc PR | N/A |more info:#19901Commits-------595a978 [DependencyInjection] PhpDumper.php: hasReference() should not search references in lazy service arguments.
@gxolin
Copy link

Thank you@antanas-arvasevicius.
@fabpot do you know in which version this fix will be available for 7.2.* ?

@wouterj
Copy link
Member

@gxolin it's always the next release. So 2.7.22

gxolin reacted with thumbs up emoji

@antanas-arvasevicius
Copy link
ContributorAuthor

no prob :)

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

Reviewers

1 more reviewer

@lemoinemlemoinemlemoinem requested changes

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

9 participants

@antanas-arvasevicius@nicolas-grekas@fabpot@stof@HeahDude@gxolin@wouterj@lemoinem@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp