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] Prevent a loop in aliases within thefindDefinition method#25364

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

Conversation

@sroze
Copy link
Contributor

QA
Branch?3.3
Bug fix?yes
New feature?no
BC breaks?no
Deprecations?no
Tests pass?yes
Fixed tickets#25338
LicenseMIT
Doc PRø

This prevents an infinite loop going when aliases reference themselves. This is based on 3.3 as the "normalized ID" changed to allow non-lowercase names. Fixing this in 2.7 would mean a merge conflict that IMO is not worth it.

@srozesrozeforce-pushed thebugfix-25338-prevent-definition-alias-loop branch fromc716668 to22f3523CompareDecember 6, 2017 16:40
@sroze
Copy link
ContributorAuthor

AppVeyor's failure is not related... memory oncomposer ... 💥

$id = (string)$this->aliasDefinitions[$id];

if (isset($seen[$id])) {
thrownewServiceCircularReferenceException($id,array_keys($seen));

Choose a reason for hiding this comment

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

The message should be improved see the CheckCircularReferencePass

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

What do you mean?

Copy link
Member

@nicolas-grekasnicolas-grekasDec 7, 2017
edited
Loading

Choose a reason for hiding this comment

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

Sorry was on mobile :)
This is what I mean:

if (isset($seen[$id])) {$seen =array_slice($seen,array_search($id,$seen));$seen[] =$id;thrownewServiceCircularReferenceException($id,$seen);}$seen[$id] =$id;

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

I see the idea. Tho, we can't usearray_slice with string keys in an array, we'll have to use 2 of them.

@nicolas-grekas
Copy link
Member

Thanks for the PR.

Copy link
Member

@xabbuhxabbuh left a comment

Choose a reason for hiding this comment

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

LGTM

@ro0NL
Copy link
Contributor

The same loop can happen inget() right?

@nicolas-grekas
Copy link
Member

The same loop can happen in get() right?

Yes, but is already handled there AFAIK.

@leotiger
Copy link

I've tested the fix and it throws now a circular reference exception as expected. Thx.

sroze reacted with thumbs up emoji

@fabpot
Copy link
Member

Thank you@sroze.

@fabpotfabpot merged commit22f3523 intosymfony:3.3Dec 7, 2017
fabpot added a commit that referenced this pull requestDec 7, 2017
… `findDefinition` method (sroze)This PR was merged into the 3.3 branch.Discussion----------[DependencyInjection] Prevent a loop in aliases within the `findDefinition` method| Q             | A| ------------- | ---| Branch?       | 3.3| Bug fix?      | yes| New feature?  | no| BC breaks?    | no| Deprecations? | no| Tests pass?   | yes| Fixed tickets |#25338| License       | MIT| Doc PR        | øThis prevents an infinite loop going when aliases reference themselves. This is based on 3.3 as the "normalized ID" changed to allow non-lowercase names. Fixing this in 2.7 would mean a merge conflict that IMO is not worth it.Commits-------22f3523 Prevent a loop in aliases within the `findDefinition` method
@srozesroze deleted the bugfix-25338-prevent-definition-alias-loop branchDecember 8, 2017 09:36
nicolas-grekas added a commit that referenced this pull requestDec 8, 2017
This PR was merged into the 3.3 branch.Discussion----------[DI] Fix circular-aliases message| Q             | A| ------------- | ---| Branch?       | 3.3| Bug fix?      || New feature?  | no| BC breaks?    | no| Deprecations? | no| Tests pass?   | yes| Fixed tickets | -| License       | MIT| Doc PR        | -The missing bits in#25364Commits-------f1a7b07 [DI] Fix circular-aliases message
This was referencedDec 15, 2017
@fabpotfabpot mentioned this pull requestJan 5, 2018
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@nicolas-grekasnicolas-grekasnicolas-grekas left review comments

@fabpotfabpotfabpot approved these changes

@xabbuhxabbuhxabbuh approved these changes

Assignees

No one assigned

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

7 participants

@sroze@nicolas-grekas@ro0NL@leotiger@fabpot@xabbuh@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp