Skip to content

[DI] Detect circular references with ChildDefinition parent #28480

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
Sep 18, 2018
Merged

[DI] Detect circular references with ChildDefinition parent #28480

merged 1 commit into from
Sep 18, 2018

Conversation

Seb33300
Copy link
Contributor

@Seb33300 Seb33300 commented Sep 16, 2018

Q A
Branch? 3.4 (be careful when merging)
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets #28312
License MIT
Doc PR

I will provide a test case if the fix looks good for you :)

@Seb33300
Copy link
Contributor Author

Oups, didn't see that someone already worked on it: #28452

@Seb33300
Copy link
Contributor Author

Seb33300 commented Sep 16, 2018

Just pushed a test case since it looks to be the good way to fix this issue regarding comments on the other pull request.

I pushed on master because it is a very similar issue as the previous one I fixed (#28315) which was merged on master.

@@ -396,4 +396,20 @@ protected function process(ContainerBuilder $container)
$pass = new ResolveChildDefinitionsPass();
$pass->process($container);
}

/**
* @expectedException \Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException
Copy link
Member

Choose a reason for hiding this comment

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

could be worth adding an @expectedExceptionMessage: right now, I get: Service "a": Service "a": Service "a": Service "a": Circular reference detected for service "c", path: "c -> b -> a -> c"., which might need some tweaks :)

Copy link
Member

Choose a reason for hiding this comment

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

hmm, that's resolveDefinition prefixing the exception message. And the multiple prefixing looks really weird though.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oups, didn't see that. I just pushed a fix.

Copy link
Member

Choose a reason for hiding this comment

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

still worth adding @expectedExceptionMessage :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Maybe @expectedExceptionMessageRegExp to test if exception message is not prefixed?

@nicolas-grekas
Copy link
Member

(for 3.4!)

@nicolas-grekas nicolas-grekas added this to the 3.4 milestone Sep 17, 2018
@nicolas-grekas nicolas-grekas changed the base branch from master to 3.4 September 18, 2018 09:39
@nicolas-grekas
Copy link
Member

Thank you @Seb33300.

@nicolas-grekas nicolas-grekas merged commit 2a59c8e into symfony:3.4 Sep 18, 2018
nicolas-grekas added a commit that referenced this pull request Sep 18, 2018
…t (Seb33300)

This PR was submitted for the master branch but it was squashed and merged into the 3.4 branch instead (closes #28480).

Discussion
----------

[DI] Detect circular references with ChildDefinition parent

| Q             | A
| ------------- | ---
| Branch?       | 3.4 (be careful when merging)
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #28312
| License       | MIT
| Doc PR        |

I will provide a test case if the fix looks good for you :)

Commits
-------

2a59c8e [DI] Detect circular references with ChildDefinition parent
@Seb33300 Seb33300 deleted the patch-2 branch September 18, 2018 09:45
This was referenced Sep 30, 2018
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.

4 participants