Skip to content

Backport: Replace XtOffsetOf with offsetof for PHP 8.6 compatibility #2011

Merged
GromNaN merged 1 commit intomongodb:v2.3from
GromNaN:backport-offsetof
May 4, 2026
Merged

Backport: Replace XtOffsetOf with offsetof for PHP 8.6 compatibility #2011
GromNaN merged 1 commit intomongodb:v2.3from
GromNaN:backport-offsetof

Conversation

@GromNaN
Copy link
Copy Markdown
Member

@GromNaN GromNaN commented May 4, 2026

)

PHP 8.6 removed XtOffsetOf from php_stdint.h, so use the standard offsetof macro for object fetch helpers.
Copilot AI review requested due to automatic review settings May 4, 2026 08:41
@GromNaN GromNaN requested a review from a team as a code owner May 4, 2026 08:41
@GromNaN GromNaN requested review from alcaeus and removed request for a team May 4, 2026 08:41
@GromNaN GromNaN enabled auto-merge (squash) May 4, 2026 08:42
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

Backports the upstream change from PR #2008 to maintain PHP 8.6 compatibility by replacing the removed XtOffsetOf() macro alias with the standard C offsetof() macro across the extension’s object handler setup and helper macros.

Changes:

  • Replace XtOffsetOf(type, std) with offsetof(type, std) in all affected object handler initializations.
  • Update the CLASS_FETCH_OBJ_DECL helper macro to compute the internal struct address using offsetof().

Reviewed changes

Copilot reviewed 34 out of 34 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/phongo_classes.h Update internal object fetch helper macro to use offsetof()
src/MongoDB/WriteResult.c Use offsetof() for handler offset
src/MongoDB/WriteConcern.c Use offsetof() for handler offset
src/MongoDB/TopologyDescription.c Use offsetof() for handler offset
src/MongoDB/Session.c Use offsetof() for handler offset
src/MongoDB/ServerDescription.c Use offsetof() for handler offset
src/MongoDB/ServerApi.c Use offsetof() for handler offset
src/MongoDB/Server.c Use offsetof() for handler offset
src/MongoDB/ReadPreference.c Use offsetof() for handler offset
src/MongoDB/ReadConcern.c Use offsetof() for handler offset
src/MongoDB/Query.c Use offsetof() for handler offset
src/MongoDB/Monitoring/TopologyChangedEvent.c Use offsetof() for handler offset
src/MongoDB/Monitoring/ServerChangedEvent.c Use offsetof() for handler offset
src/MongoDB/Manager.c Use offsetof() for handler offset
src/MongoDB/Cursor.c Use offsetof() for handler offset
src/MongoDB/Command.c Use offsetof() for handler offset
src/MongoDB/ClientEncryption.c Use offsetof() for handler offset
src/MongoDB/BulkWriteCommandResult.c Use offsetof() for handler offset
src/MongoDB/BulkWriteCommand.c Use offsetof() for handler offset
src/MongoDB/BulkWrite.c Use offsetof() for handler offset
src/BSON/Undefined.c Use offsetof() for handler offset
src/BSON/UTCDateTime.c Use offsetof() for handler offset
src/BSON/Timestamp.c Use offsetof() for handler offset
src/BSON/Symbol.c Use offsetof() for handler offset
src/BSON/Regex.c Use offsetof() for handler offset
src/BSON/PackedArray.c Use offsetof() for handler offset
src/BSON/ObjectId.c Use offsetof() for handler offset
src/BSON/Javascript.c Use offsetof() for handler offset
src/BSON/Iterator.c Use offsetof() for handler offset
src/BSON/Int64.c Use offsetof() for handler offset
src/BSON/Document.c Use offsetof() for handler offset
src/BSON/Decimal128.c Use offsetof() for handler offset
src/BSON/DBPointer.c Use offsetof() for handler offset
src/BSON/Binary.c Use offsetof() for handler offset

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

@GromNaN GromNaN merged commit 7138f73 into mongodb:v2.3 May 4, 2026
47 of 48 checks passed
This was referenced May 4, 2026
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.

4 participants