8000 Fix bug when using an private aliased factory service by wouterj · Pull Request #17942 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

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

Closed
wants to merge 2 commits into from

Conversation

wouterj
Copy link
Member
@wouterj wouterj commented Feb 27, 2016
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

@@ -131,6 +131,6 @@ private function updateFactoryServiceReference($factoryService, $currentId, $new
return;
}

return $currentId === $factoryService ? $newId : $currentId;
return $currentId === $factoryService ? $newId : $factoryService;
Copy link
Member Author

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).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good catch @wouterj 👏

@xabbuh
Copy link
Member
xabbuh commented Feb 27, 2016

👍

Oh my God, what a silly mistake. Thanks Wouter for the fix!

Status: Reviewed

@linaori
Copy link
Contributor
linaori commented Feb 27, 2016

Was the test failing before? If not, a test would be nice to prevent this bug from happening again

@wouterj
Copy link
Member Author
wouterj commented Feb 27, 2016

@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
Copy link
Member Author

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

@fabpot
Copy link
Member
fabpot commented Feb 28, 2016

Thank you @wouterj.

fabpot added a commit that referenced this pull request Feb 28, 2016
…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
@fabpot fabpot closed this Feb 28, 2016
@wouterj wouterj deleted the fix_bug_private_factory_alias branch February 28, 2016 15:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants
0