-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
Fix bug when using an private aliased factory service #17942
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
@@ -131,6 +131,6 @@ private function updateFactoryServiceReference($factoryService, $currentId, $new | |||
return; | |||
} | |||
|
|||
return $currentId === $factoryService ? $newId : $currentId; | |||
return $currentId === $factoryService ? $newId : $factoryService; |
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.
$currentId
is the current ID of the removed alias, while $factoryService
is the original ID of the factory service.
If the factory service equals the ID of the removed alias, it should be updated to become the actual service ID. However, if the factory service does not equal the ID of the removed alias, the original value should be used.
With the old code, it was always replacing the original code, either with the actual definition ID or the ID of the removed alias (which was causing the troubles people were reporting).
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.
good catch @wouterj 👏
👍 Oh my God, what a silly mistake. Thanks Wouter for the fix! Status: Reviewed |
Was the test failing before? If not, a test would be nice to prevent this bug from happening again |
@iltar I've added a test now (although this is a very specific test, so I'm not 100% sure if we should include it). |
@@ -45,6 +47,26 @@ public function testProcess() | |||
} | |||
|
|||
/** | |||
* @group legacy |
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.
it's not really legacy in 2.3, but this makes things easier to merge to 2.7/2.8
Thank you @wouterj. |
…terJ) This PR was squashed before being merged into the 2.3 branch (closes #17942). Discussion ---------- Fix bug when using an private aliased factory service | Q | A | ------------- | --- | Bug fix? | yes | New feature? | no BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #17910, #17915 | License | MIT | Doc PR | - /cc @xabbuh Commits ------- de406c0 Fix bug when using an private aliased factory service
/cc @xabbuh