-
-
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
Fix deep copying of ArrayObject in PHP 7.4 #145
Conversation
In PHP 7.4 the storage of an ArrayObject isn't returned as ReflectionProperty.
dd12c91
to
8dcad4e
Compare
@@ -385,6 +387,18 @@ public function test_it_uses_the_first_filter_matching_for_copying_object_proper | |||
$this->assertNull($copy->getAProp()->cloned); | |||
} | |||
|
|||
public function test_it_can_deep_copy_an_array_object() |
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.
Just to be sure: this test fails on PHP 7.4 if the new ArrayObjectFilter
is not registered?
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.
Yes, without ArrayObjectFilter
$foo
and $copy['foo']
would be same.
LGTM, just waiting on the confirmation. |
@@ -59,6 +61,7 @@ public function __construct($useCloneMethod = false) | |||
{ | |||
$this->useCloneMethod = $useCloneMethod; | |||
|
|||
$this->addTypeFilter(new ArrayObjectFilter($this), new TypeMatcher(ArrayObject::class)); |
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.
Would it make sense to register it only on PHP 7.4+?
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.
I don't see any reason for not using it in PHP <7.4, do you?
@mnapoli @theofidry Can this be merged, or is there anything left to do? |
Thank you @dontub! |
In PHP 7.4 the storage of an ArrayObject isn't returned as
ReflectionProperty.