Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Fixes #5755 - Parent class fields are not cloned#5768

Closed
edhgoose wants to merge 1 commit into
doctrine:masterfrom
edhgoose:fix-5755-subclass-not-cloned
Closed

Fixes #5755 - Parent class fields are not cloned#5768
edhgoose wants to merge 1 commit into
doctrine:masterfrom
edhgoose:fix-5755-subclass-not-cloned

Conversation

@edhgoose
Copy link
Copy Markdown

This addresses #5755, which we have also just noticed as a result of upgrading from Symfony 2.3 to 2.8. The bug is that private/protected fields in a parent class are not cloned when cloning a proxy.

The relevant changes and what we're reversing are here:

https://github.com/doctrine/common/pull/168/files#diff-4415e2672350448f02229f989bcfca38R85 This is the original commit to migrate the clone functionality into Doctrine common. Note the use of foreach ($metadata->getReflectionClass()->getProperties() as $reflProperty) {.

The change this replaces is in Ocramius@8272ffd#diff-b8508327ba460ef291cee00db8cb7b23L432, which used foreach ($class->reflFields as $field => $reflProperty) {.

…>getReflectionClass()->getProperties()' to ensure all fields are copied, and adds test to confirm behaviour
@Ocramius Ocramius added this to the 2.5.5 milestone Apr 12, 2016
@Ocramius Ocramius self-assigned this Apr 12, 2016
Ocramius added a commit that referenced this pull request Sep 10, 2016
@Ocramius Ocramius closed this in cd11723 Sep 10, 2016
Ocramius added a commit that referenced this pull request Sep 10, 2016
@Ocramius
Copy link
Copy Markdown
Member

Merged, thanks!

master: cd11723
2.5: 73e4be7

@betd-claumond
Copy link
Copy Markdown

@edhgoose Thanks for this fix !
@Ocramius Is it possible to backport this fix to 2.4 please ?

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.

3 participants