-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[DependencyInjection] Fix ignore invalid_reference behavior param for the some services #57561
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
base: 5.4
Are you sure you want to change the base?
Conversation
@@ -1009,7 +1009,7 @@ private function addInlineReference(string $id, Definition $definition, string $ | ||
$name = $this->getNextVariableName(); | ||
$this->referenceVariables[$targetId] = new Variable($name); | ||
|
||
$reference = ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE >= $behavior ? new Reference($targetId, $behavior) : null; | ||
$reference = ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE !== $behavior ? new Reference($targetId, $behavior) : null; |
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.
Perhaps, there was just a typo here and the author meant $behavior >= ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE
.
The bug was hidden for a long time because it can only be reproduced for "synthetic" services like kernel
and in specific cases. But the other services replaced by null on optimization step before
So, this line: That's what you mean? I think this comparison in PhpDumper is on purpose but it's quite possible that we forgot about synthetic services. |
@vtsykun did you check my comment? WDYT? |
Yes, exactly. Ok I'll create a test case |
This bug has more than 5 years old, but it make possible to reproduce after introducing a new console command profiler.
PHP DI dumper may ignore invalid reference behavior in the some cases. See example.
As you can see
ignoreOnInvalid
option is dropped on this line