Skip to content

PHPC-1627 Support object cloning for ReadConcern, ReadPreference, and WriteConcern#2002

Merged
GromNaN merged 1 commit into
mongodb:v2.xfrom
GromNaN:PHPC-1627
Apr 29, 2026
Merged

PHPC-1627 Support object cloning for ReadConcern, ReadPreference, and WriteConcern#2002
GromNaN merged 1 commit into
mongodb:v2.xfrom
GromNaN:PHPC-1627

Conversation

@GromNaN
Copy link
Copy Markdown
Member

@GromNaN GromNaN commented Apr 28, 2026

Fix PHPC-1627

Copilot AI review requested due to automatic review settings April 28, 2026 15:22
@GromNaN GromNaN requested a review from a team as a code owner April 28, 2026 15:22
@GromNaN GromNaN requested review from alcaeus and removed request for a team April 28, 2026 15:22
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds safe object cloning support for MongoDB\Driver\ReadConcern, ReadPreference, and WriteConcern (PHPC-1627), along with regression tests.

Changes:

  • Implement custom clone_obj handlers to deep-copy the underlying mongoc_* structs for ReadConcern/ReadPreference/WriteConcern.
  • Add PHPT tests validating clone equality/identity and clone survivability after unsetting the original.
  • Bump the extension development version in phongo_version.h.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
tests/writeConcern/writeconcern-clone-001.phpt New regression test asserting WriteConcern is cloneable and remains usable after the original is unset.
tests/readPreference/readpreference-clone-001.phpt New regression test asserting ReadPreference cloning works with tag sets and max staleness options.
tests/readConcern/readconcern-clone-001.phpt New regression test asserting ReadConcern is cloneable and remains usable after the original is unset.
src/MongoDB/WriteConcern.c Add clone_obj handler using mongoc_write_concern_copy() to avoid pointer aliasing/double-free.
src/MongoDB/ReadPreference.c Add clone_obj handler using mongoc_read_prefs_copy() to avoid pointer aliasing/double-free.
src/MongoDB/ReadConcern.c Add clone_obj handler using mongoc_read_concern_copy() to avoid pointer aliasing/double-free.
phongo_version.h Update extension dev version from 2.3.x-dev to 2.4.x-dev.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread phongo_version.h
@GromNaN GromNaN merged commit 4f5c604 into mongodb:v2.x Apr 29, 2026
43 checks passed
@GromNaN GromNaN deleted the PHPC-1627 branch April 29, 2026 11:33
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.

3 participants