-
-
Notifications
You must be signed in to change notification settings - Fork 102
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
Conversation
$class = new ReflectionClass($newObject); | ||
foreach ($class->getProperties() as $property) { | ||
foreach ($class->getProperties(ReflectionProperty::IS_PROTECTED + ReflectionProperty::IS_PRIVATE) as $property) { |
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.
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
Hi! Thanks a lot for the bug report and the fix! I was very surprised that 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 |
Absolutely agree. I'll send an update |
Ping! @mnapoli I hope now this PR looks nicer |
Nice, thanks! |
Fixed: dynamic properties weren't cloned
I've released v1.0.1 It should propagate to packagist soon and be installable through Composer. |
Fixed wrong reference in Exception message
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.