Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.7k
[DI] fix using bindings with locators of service subscribers#31541
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
Uh oh!
There was an error while loading.Please reload this page.
Conversation
| thrownewInvalidArgumentException(sprintf('Invalid definition for service "%s": an array of references is expected as first argument when the "container.service_locator" tag is set, "%s" found for key "%s".',$this->currentId,\is_object($v) ?\get_class($v) :\gettype($v),$k)); | ||
| } | ||
| if (\is_int($k)) { |
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.
This fix is borrowed from 4.2.
| require_once__DIR__.'/../Fixtures/includes/classes.php'; | ||
| class ServiceLocatorTagPassTestextends TestCase |
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.
Test class borrowed from 4.2.
| $this->assertSame(TestDefinition1::class,\get_class($locator('bar'))); | ||
| } | ||
| publicfunctiontestBindingsAreCopied() |
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.
The new test case for this fix.
…rs (nicolas-grekas)This PR was merged into the 3.4 branch.Discussion----------[DI] fix using bindings with locators of service subscribers| 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 | -Spotted during the workshop in Sao Paulo, with@tsantos84,@andreia and others :)Commits-------7146b95 [DI] fix using bindings with locators of service subscribers
| $locator->setBindings($container->getDefinition($callerId)->getBindings()); | ||
| } | ||
| if (!$container->hasDefinition($id ='service_locator.'.ContainerBuilder::hash($locator))) { |
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.
are bindings taken into account by the hashing ? If no, that would cause issues.
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.
correct, hash() uses serialize() so all the state is hashed
Spotted during the workshop in Sao Paulo, with@tsantos84,@andreia and others :)