Backport: Replace XtOffsetOf with offsetof for PHP 8.6 compatibility #2011
Merged
GromNaN merged 1 commit intomongodb:v2.3from May 4, 2026
Merged
Backport: Replace XtOffsetOf with offsetof for PHP 8.6 compatibility #2011GromNaN merged 1 commit intomongodb:v2.3from
GromNaN merged 1 commit intomongodb:v2.3from
Conversation
alcaeus
approved these changes
May 4, 2026
Contributor
There was a problem hiding this comment.
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)withoffsetof(type, std)in all affected object handler initializations. - Update the
CLASS_FETCH_OBJ_DECLhelper macro to compute the internal struct address usingoffsetof().
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Backport:
Fix PHP 8.6 build