Skip to content

PHPLIB-367: BSONArray/Document cloning should respect uncloneable objects #560

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

Merged
merged 1 commit into from
Jul 10, 2018

Conversation

jmikola
Copy link
Member

@jmikola jmikola commented Jul 5, 2018

https://jira.mongodb.org/browse/PHPLIB-367

This should address the issue reported in #559.

@jmikola jmikola requested a review from derickr July 5, 2018 15:23
@@ -216,5 +217,9 @@ function recursive_copy($element) {
return $element;
}

if ( ! (new ReflectionClass($element))->isCloneable()) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Is cloneable is reported to not work with internal classes (in a note on http://php.net/manual/en/reflectionclass.iscloneable.php) — could that be a problem for us?

Copy link
Member Author

Choose a reason for hiding this comment

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

That note was the reason I added testCloneSupportsBSONTypes(). I didn't look into isCloneable(), but it certainly appears to do the job for our BSON classes in PHP 5.5+.

Copy link
Contributor

@derickr derickr left a comment

Choose a reason for hiding this comment

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

LGTM

@jmikola jmikola merged commit d06c288 into mongodb:master Jul 10, 2018
jmikola added a commit that referenced this pull request Jul 10, 2018
@jmikola jmikola deleted the phplib-367 branch July 10, 2018 15:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants