-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[DI] Fix ServiceLocatorArgument::setValues() for non-reference values #21794
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
Conversation
hmm, we should still allow only |
d23c60c
to
2535108
Compare
@stof fixed |
@@ -39,7 +39,7 @@ public function getValues() | |||
public function setValues(array $values) | |||
{ | |||
foreach ($values as $v) { | |||
if (!$v instanceof Reference) { | |||
if (!$v instanceof Reference && null !== $v) { |
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.
null
s will create services that have "has()" return true, and "get()" return null. Not sure it's useful at all. What about skipping them instead?
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.
Self answer: bad idea: maybe the consumer expects a value from get for the provided key. :)
Test case missing?
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 case added
b71b4db
to
ae18b79
Compare
ae18b79
to
256b836
Compare
Build failure unrelated. |
Thank you @chalasr. |
…ence values (chalasr) This PR was merged into the 3.3-dev branch. Discussion ---------- [DI] Fix ServiceLocatorArgument::setValues() for non-reference values | Q | A | ------------- | --- | Branch? | master | Fixed tickets | #21625 (comment) | Tests pass? | yes | License | MIT `ResolveInvalidReferencesPass` [calls `setValues()`](https://github.com/symfony/symfony/blob/master/src/Symfony/Component/DependencyInjection/Compiler/ResolveInvalidReferencesPass.php#L91) with resolved invalid reference (null), the `Reference` type check should occurs at construction only. Commits ------- 256b836 [DI] Fix ServiceLocatorArgument::setValues() for non-reference values
ResolveInvalidReferencesPass
callssetValues()
with resolved invalid reference (null), theReference
type check should occurs at construction only.