-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Fix infinite loop when chaining peering service managers #7296
Conversation
|
|
||
/** | ||
* @covers Zend\ServiceManager\ServiceManager::loopPeeringServiceManagers | ||
* @covers Zend\ServiceManager\ServiceManager::setServiceManagerCaller |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These two statements are causing PHPUnit errors to occur; it looks like PHPUnit does not like @covers
for non-public methods: https://travis-ci.org/zendframework/zf2/jobs/53314224#L486
I'll remove the statements during merge.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Its ok to @cover non-public methods, but the given one didnt exists any more.
if ($caller !== $peeringServiceManager) { | ||
$peeringServiceManager->serviceManagerCaller = $this; | ||
if ($peeringServiceManager->has($name)) { | ||
return true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't $peeringServiceManager->serviceManagerCaller
be reset to null
before returning?
Fix infinite loop when chaining peering service managers
- Continue early in loops. - Ensure `$peeringServiceManager->serviceManagerCaller` is reset before returning from a loop. - Remove `@covers` and `@uses` annotations which were raising errors.
Merged to develop for release with 2.4. |
thank you, 👍 |
…nite-loop-sm-peering Fix infinite loop when chaining peering service managers
- Continue early in loops. - Ensure `$peeringServiceManager->serviceManagerCaller` is reset before returning from a loop. - Remove `@covers` and `@uses` annotations which were raising errors.
Hello,
we have a use case where we add a peering service manager (SM) to the SM of an ZF2 application. Also the peering SM becomes the SM of the application added as peering SM, which allows us to call services from the applications SM.
For services which can't be found this runs into a infinite loop. The applications SM calls the peering SM, which calls back the application SM and so on.
This PR tries to fix that by passing the current SM instance to the peering SM so they skip the caller SM when looping over
peeringServiceManagers
.