Skip to content
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

added dynamic properties to be cloned #1

Merged
merged 4 commits into from
Feb 14, 2014
Merged

Conversation

DavertMik
Copy link
Contributor

Awesome library, but it lacks some dynamic properties support.
If you feel this PR is ok, please merge and create a new version.
I'm going to use DeepCopy as a dependency to my Codeception/Specify lib.

@coveralls
Copy link

Coverage Status

Coverage decreased (-1.12%) when pulling e768ab7 on DavertMik:master into 2c8df9f on myclabs:master.

$class = new ReflectionClass($newObject);
foreach ($class->getProperties() as $property) {
foreach ($class->getProperties(ReflectionProperty::IS_PROTECTED + ReflectionProperty::IS_PRIVATE) as $property) {
Copy link
Member

Choose a reason for hiding this comment

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

Using ReflectionObject instead of ReflectionClass should be enough to solve the problem without having to use get_object_vars().

To be honest I just learned about that thanks to you: https://stackoverflow.com/questions/4914376/failed-to-get-dynamic-instance-variables-via-phps-reflection

@mnapoli
Copy link
Member

mnapoli commented Feb 11, 2014

Hi!

Thanks a lot for the bug report and the fix! I was very surprised that ReflectionClass doesn't return dynamic properties!

As you can see I have commented some bits, if you don't have time to update the pull request, I can handle it, just let me know (I'd rather let you fix it and merge to keep your contribution).

Then I'll release a new version.

Cheers

@mnapoli mnapoli added the bug label Feb 11, 2014
@DavertMik
Copy link
Contributor Author

Absolutely agree. I'll send an update

@DavertMik
Copy link
Contributor Author

Ping! @mnapoli I hope now this PR looks nicer

@mnapoli
Copy link
Member

mnapoli commented Feb 14, 2014

Nice, thanks!

mnapoli added a commit that referenced this pull request Feb 14, 2014
Fixed: dynamic properties weren't cloned
@mnapoli mnapoli merged commit 6ff74ad into myclabs:master Feb 14, 2014
@mnapoli
Copy link
Member

mnapoli commented Feb 14, 2014

I've released v1.0.1

It should propagate to packagist soon and be installable through Composer.

mnapoli pushed a commit that referenced this pull request Nov 10, 2015
Fixed wrong reference in Exception message
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants