Skip to content

PHPC-2435: Support libmongoc 2.0 #1829

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 6 commits into from
Jun 3, 2025
Merged

Conversation

alcaeus
Copy link
Member

@alcaeus alcaeus commented May 22, 2025

This fixes the following issues:
* PHPC-2581: Bump to libmongoc 2.0.1
* PHPC-2578: Bump to libmongocrypt 1.14.0
* PHPC-2548: Remove MONGOC_WRITE_CONCERN_W_ERRORS_IGNORED
* PHPC-2540: Use const for mongoc_host_list_t
* PHPC-2547: Remove MONGOC_NO_AUTOMATIC_GLOBALS
* PHPC-2549: Remove BSON_EXTRA_ALIGN
* PHPC-1548: Add tests for empty authSource URI option
* PHPC-2542: Add test coverage for auth mechanism errors
@alcaeus alcaeus force-pushed the feature/phpc-2435-libmongoc-2 branch from 9ef16ef to b5f3c8e Compare May 26, 2025 07:17
alcaeus added 2 commits May 26, 2025 09:42
* Add build action to build libmongoc system libraries

* Build driver with system libs

* Install libmongocrypt as system library

* Run tests with system libs

* Move system library tests to tests workflow
* PHPC-2545: Drop support for compiling with LibreSSL

* Warn when explicitly building with libressl
Copy link

@Copilot 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

This PR updates the PHP driver to support libmongoc 2.x along with corresponding version bumps for libmongocrypt and the mongo-c-driver, and removes support for LibreSSL.

  • Updated file paths for version retrieval (e.g. from LIBMONGOC_VERSION_CURRENT to src/libmongoc/VERSION_CURRENT)
  • Bumped version numbers throughout configuration files, SBOM, CI workflows, and contributor documentation
  • Removed LibreSSL support from SSL configuration in autotools

Reviewed Changes

Copilot reviewed 47 out of 47 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
scripts/update-sbom.sh Updated LIBMONGOC_VERSION file location
scripts/autotools/libmongocrypt/CheckSSL.m4 Removed LibreSSL in favor of using only OpenSSL and Darwin
scripts/autotools/libmongoc/Versions.m4 Updated version file path reference
scripts/autotools/libmongoc/CheckSSL.m4 Refined SSL configuration logic
scripts/autotools/libbson/Versions.m4 Updated file path for BSON version file
sbom.json Bumped versions for libmongocrypt and mongo-c-driver
config.w32 Updated version file path and added extra include path
config.m4 Updated PKG_CHECK_MODULES call and version checks for system libs
CONTRIBUTING.md Revised instructions for checking out and bumping libmongoc version
.github workflows & Evergreen configs Updated CI jobs and actions to use new version numbers

@alcaeus alcaeus requested a review from kevinAlbs May 27, 2025 12:11
Copy link

@kevinAlbs kevinAlbs left a comment

Choose a reason for hiding this comment

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

LGTM with minor comments.

@@ -49,6 +48,8 @@ function get_files() {
"src/contrib/*.{c,h}",

"src/libmongoc/src/common/src/*.{c,h,h.in}",
// Note: src/libmongoc/src/common/src/mlib/ does not contain source files (as of libmongoc 2.0.1)
"src/libmongoc/src/common/src/mlib/*.{c,h}",

Choose a reason for hiding this comment

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

Suggested change
"src/libmongoc/src/common/src/mlib/*.{c,h}",
"src/libmongoc/src/common/src/mlib/*.h",

Remove unnecessary *.c glob? I expect the purpose of the comment is to indicate there are no *.c source files needed.

Copy link
Member Author

Choose a reason for hiding this comment

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

Updated - these are indeed not necessary (here and below).

@@ -64,10 +65,12 @@ function get_files() {
"src/libmongocrypt-compat/mongocrypt/*.{c,h}",
"src/libmongocrypt/src/*.{c,h,h.in}",
"src/libmongocrypt/src/crypto/*.{c,h}",
// Note: src/libmongocrypt/src/mlib/ does not contain source files (as of libmongocrypt 1.3.1)
"src/libmongocrypt/src/mlib/*.{c,h}",

Choose a reason for hiding this comment

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

Suggested change
"src/libmongocrypt/src/mlib/*.{c,h}",

I expect this is redundant with the glob below for src/libmongocrypt/src/mlib/*.h. The only *.c source files are tests.

Comment on lines 15 to 17
/* Note: Values of w < 0 are invalid, but libmongoc's URI string parsing only
* logs a warning instead of raising an error (see: CDRIVER-2234), so we cannot
* test for this. */

Choose a reason for hiding this comment

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

Comment appears incorrect. libmongoc returns an error for unsupported values, e.g. w=-1:

echo throws(function() {
    create_test_manager("mongodb://localhost:27017/?w=-1", []);
}, "MongoDB\Driver\Exception\InvalidArgumentException"), "\n";

Results in output:

Failed to parse MongoDB URI: 'mongodb://localhost:27017/?w=-1'. Error while parsing the 'w' URI option: Unsupported w value [w=-1].
OK: Got MongoDB\Driver\Exception\InvalidArgumentException

Copy link
Member Author

Choose a reason for hiding this comment

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

Thank you for pointing this out - I guess that comment was never updated after CDRIVER-2234 was fixed.

- name: Add repository
shell: bash
working-directory: /tmp
# Note: no packages for Ubuntu 24.04 noble exist, so we use those for 22.04

Choose a reason for hiding this comment

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

Suggested change
# Note: no packages for Ubuntu 24.04 noble exist, so we use those for 22.04
# Note: no packages for Ubuntu 24.04 noble exist, so we use those for 22.04. Update after MONGOCRYPT-813 is released.

Aside: MONGOCRYPT-813 is planned for the next 1.14.1 patch release.

Copy link
Member Author

Choose a reason for hiding this comment

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

Thank you, I'll update this alongside 1.14.1 then :)

alcaeus added 2 commits June 2, 2025 09:32
* Support building with SSPI support under Windows

* Remove support for building with Cyrus SASL on Windows

* Apply feedback from Copilot

* Apply code review feedback

* Fix handling of missing SASL libs when relying on default value for with-mongodb-sasl
@alcaeus alcaeus marked this pull request as ready for review June 2, 2025 07:48
@alcaeus alcaeus requested a review from a team as a code owner June 2, 2025 07:48
@alcaeus alcaeus requested review from paulinevos and removed request for a team June 2, 2025 07:48
@alcaeus alcaeus enabled auto-merge (squash) June 3, 2025 11:21
@alcaeus alcaeus merged commit 4b32208 into v2.x Jun 3, 2025
108 checks passed
@alcaeus alcaeus deleted the feature/phpc-2435-libmongoc-2 branch June 3, 2025 11:22
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