Skip to content

Commit 2ee6ac5

Browse files
authored
PHPC-2591, PHPC-2594: Upgrade bundled libmongoc and libmongocrypt dependencies (#1842)
* PHPC-2594: Upgrade libmongoc to 2.0.2 * PHPC-2591: Upgrade libmongocrypt to 1.14.1 * Update SBOM * Update tests for new BSON validation logic
1 parent 4b32208 commit 2ee6ac5

File tree

13 files changed

+34
-55
lines changed

13 files changed

+34
-55
lines changed

.evergreen/config/generated/build/build-libmongoc.yml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.evergreen/config/templates/build/build-libmongoc.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
- func: "compile driver"
1111
vars:
1212
PHP_VERSION: "%phpVersion%"
13-
LIBMONGOC_VERSION: "2.0.1"
13+
LIBMONGOC_VERSION: "2.0.2"
1414
- func: "upload build"
1515

1616
- name: "build-php-%phpVersion%-libmongoc-next-stable"

.github/actions/linux/build-libmongocrypt/action.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@ runs:
1515
- name: Add repository
1616
shell: bash
1717
working-directory: /tmp
18-
# Note: no packages for Ubuntu 24.04 noble exist, so we use those for 22.04
19-
run: echo "deb https://libmongocrypt.s3.amazonaws.com/apt/ubuntu jammy/libmongocrypt/${LIBMONGOCRYPT_VERSION} universe" | sudo tee /etc/apt/sources.list.d/libmongocrypt.list
18+
run: echo "deb https://libmongocrypt.s3.amazonaws.com/apt/ubuntu noble/libmongocrypt/${LIBMONGOCRYPT_VERSION} universe" | sudo tee /etc/apt/sources.list.d/libmongocrypt.list
2019
env:
2120
LIBMONGOCRYPT_VERSION: ${{ inputs.version }}
2221

.github/workflows/tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ jobs:
135135
env:
136136
PHP_VERSION: "8.3"
137137
LIBMONGOCRYPT_VERSION: "1.14"
138-
LIBMONGOC_VERSION: "2.0.1"
138+
LIBMONGOC_VERSION: "2.0.2"
139139
SERVER_VERSION: "8.0"
140140

141141
steps:

config.m4

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -242,38 +242,38 @@ if test "$PHP_MONGODB" != "no"; then
242242
PHP_MONGODB_MONGOCRYPT_VERSION_STRING="None"
243243

244244
if test "$PHP_MONGODB_SYSTEM_LIBS" != "no"; then
245-
PKG_CHECK_MODULES([PHP_MONGODB_BSON], [bson2 >= 2.0.1], [
245+
PKG_CHECK_MODULES([PHP_MONGODB_BSON], [bson2 >= 2.0.2], [
246246
PHP_MONGODB_BSON_VERSION=`$PKG_CONFIG bson2 --modversion`
247247
PHP_MONGODB_BSON_VERSION_STRING="System ($PHP_MONGODB_BSON_VERSION)"
248248
249249
PHP_MONGODB_CFLAGS="$PHP_MONGODB_CFLAGS $PHP_MONGODB_BSON_CFLAGS"
250250
PHP_EVAL_LIBLINE($PHP_MONGODB_BSON_LIBS, MONGODB_SHARED_LIBADD)
251251
AC_DEFINE(HAVE_SYSTEM_LIBBSON, 1, [Use system libbson])
252252
],[
253-
AC_MSG_ERROR([Could not find system library for libbson >= 2.0.1])
253+
AC_MSG_ERROR([Could not find system library for libbson >= 2.0.2])
254254
])
255255

256-
PKG_CHECK_MODULES([PHP_MONGODB_MONGOC], [mongoc2 >= 2.0.1], [
256+
PKG_CHECK_MODULES([PHP_MONGODB_MONGOC], [mongoc2 >= 2.0.2], [
257257
PHP_MONGODB_MONGOC_VERSION=`$PKG_CONFIG mongoc2 --modversion`
258258
PHP_MONGODB_MONGOC_VERSION_STRING="System ($PHP_MONGODB_MONGOC_VERSION)"
259259
260260
PHP_MONGODB_CFLAGS="$PHP_MONGODB_CFLAGS $PHP_MONGODB_MONGOC_CFLAGS"
261261
PHP_EVAL_LIBLINE($PHP_MONGODB_MONGOC_LIBS, MONGODB_SHARED_LIBADD)
262262
AC_DEFINE(HAVE_SYSTEM_LIBMONGOC, 1, [Use system libmongoc])
263263
],[
264-
AC_MSG_ERROR(Could not find system library for libmongoc >= 2.0.1)
264+
AC_MSG_ERROR(Could not find system library for libmongoc >= 2.0.2)
265265
])
266266

267267
if test "$PHP_MONGODB_CLIENT_SIDE_ENCRYPTION" != "no"; then
268-
PKG_CHECK_MODULES([PHP_MONGODB_MONGOCRYPT], [libmongocrypt >= 1.14.0], [
268+
PKG_CHECK_MODULES([PHP_MONGODB_MONGOCRYPT], [libmongocrypt >= 1.14.1], [
269269
PHP_MONGODB_MONGOCRYPT_VERSION=`$PKG_CONFIG libmongocrypt --modversion`
270270
PHP_MONGODB_MONGOCRYPT_VERSION_STRING="System ($PHP_MONGODB_MONGOCRYPT_VERSION)"
271271
272272
PHP_MONGODB_CFLAGS="$PHP_MONGODB_CFLAGS $PHP_MONGODB_MONGOCRYPT_CFLAGS"
273273
PHP_EVAL_LIBLINE($PHP_MONGODB_MONGOCRYPT_LIBS, MONGODB_SHARED_LIBADD)
274274
AC_DEFINE(HAVE_SYSTEM_LIBMONGOCRYPT, 1, [Use system libmongocrypt])
275275
],[
276-
AC_MSG_ERROR(Could not find system library for libmongocrypt >= 1.14.0)
276+
AC_MSG_ERROR(Could not find system library for libmongocrypt >= 1.14.1)
277277
])
278278
fi
279279
fi
@@ -358,7 +358,7 @@ if test "$PHP_MONGODB" != "no"; then
358358
dnl Sources below are updated by scripts/update-submodule-sources.php
359359
PHP_MONGODB_COMMON_SOURCES="common-atomic.c common-b64.c common-json.c common-md5.c common-oid.c common-string.c common-thread.c"
360360
PHP_MONGODB_KMS_MESSAGE_SOURCES="hexlify.c kms_azure_request.c kms_b64.c kms_caller_identity_request.c kms_crypto_apple.c kms_crypto_libcrypto.c kms_crypto_none.c kms_crypto_windows.c kms_decrypt_request.c kms_encrypt_request.c kms_gcp_request.c kms_kmip_reader_writer.c kms_kmip_request.c kms_kmip_response.c kms_kmip_response_parser.c kms_kv_list.c kms_message.c kms_port.c kms_request.c kms_request_opt.c kms_request_str.c kms_response.c kms_response_parser.c sort.c"
361-
PHP_MONGODB_BSON_SOURCES="bcon.c bson.c bson-clock.c bson-context.c bson-decimal128.c bson-error.c bson-iso8601.c bson-iter.c bson-json.c bson-keys.c bson-memory.c bson-oid.c bson-reader.c bson-string.c bson-timegm.c bson-utf8.c bson-value.c bson-vector.c bson-version-functions.c bson-writer.c"
361+
PHP_MONGODB_BSON_SOURCES="bcon.c bson.c bson-clock.c bson-context.c bson-decimal128.c bson-error.c bson-iso8601.c bson-iter.c bson-json.c bson-keys.c bson-memory.c bson-oid.c bson-reader.c bson-string.c bson-timegm.c bson-utf8.c bson-value.c bson-vector.c bson-version-functions.c bson-writer.c validate.c"
362362
PHP_MONGODB_JSONSL_SOURCES="jsonsl.c"
363363
PHP_MONGODB_MONGOC_SOURCES="mcd-azure.c mcd-nsinfo.c mcd-rpc.c mongoc-aggregate.c mongoc-apm.c mongoc-array.c mongoc-async.c mongoc-async-cmd.c mongoc-buffer.c mongoc-bulk-operation.c mongoc-bulkwrite.c mongoc-change-stream.c mongoc-client.c mongoc-client-pool.c mongoc-client-session.c mongoc-client-side-encryption.c mongoc-cluster-aws.c mongoc-cluster.c mongoc-cluster-cyrus.c mongoc-cluster-sasl.c mongoc-cluster-sspi.c mongoc-cmd.c mongoc-collection.c mongoc-compression.c mongoc-counters.c mongoc-crypt.c mongoc-crypto.c mongoc-crypto-cng.c mongoc-crypto-common-crypto.c mongoc-crypto-openssl.c mongoc-cursor-array.c mongoc-cursor.c mongoc-cursor-change-stream.c mongoc-cursor-cmd.c mongoc-cursor-cmd-deprecated.c mongoc-cursor-find.c mongoc-cursor-find-cmd.c mongoc-cursor-find-opquery.c mongoc-cursor-legacy.c mongoc-cyrus.c mongoc-database.c mongoc-deprioritized-servers.c mongoc-error.c mongoc-find-and-modify.c mongoc-flags.c mongoc-generation-map.c mongoc-gridfs-bucket.c mongoc-gridfs-bucket-file.c mongoc-gridfs.c mongoc-gridfs-file.c mongoc-gridfs-file-list.c mongoc-gridfs-file-page.c mongoc-handshake.c mongoc-host-list.c mongoc-http.c mongoc-init.c mongoc-interrupt.c mongoc-linux-distro-scanner.c mongoc-list.c mongoc-log-and-monitor-private.c mongoc-log.c mongoc-memcmp.c mongoc-ocsp-cache.c mongoc-opcode.c mongoc-openssl.c mongoc-optional.c mongoc-opts.c mongoc-opts-helpers.c mongoc-queue.c mongoc-rand-cng.c mongoc-rand-common-crypto.c mongoc-rand-openssl.c mongoc-read-concern.c mongoc-read-prefs.c mongoc-rpc.c mongoc-sasl.c mongoc-scram.c mongoc-secure-channel.c mongoc-secure-transport.c mongoc-server-api.c mongoc-server-description.c mongoc-server-monitor.c mongoc-server-stream.c mongoc-set.c mongoc-shared.c mongoc-socket.c mongoc-ssl.c mongoc-sspi.c mongoc-stream-buffered.c mongoc-stream.c mongoc-stream-file.c mongoc-stream-gridfs.c mongoc-stream-gridfs-download.c mongoc-stream-gridfs-upload.c mongoc-stream-socket.c mongoc-stream-tls.c mongoc-stream-tls-openssl-bio.c mongoc-stream-tls-openssl.c mongoc-stream-tls-secure-channel.c mongoc-stream-tls-secure-transport.c mongoc-structured-log.c mongoc-timeout.c mongoc-topology-background-monitoring.c mongoc-topology.c mongoc-topology-description-apm.c mongoc-topology-description.c mongoc-topology-scanner.c mongoc-ts-pool.c mongoc-uri.c mongoc-util.c mongoc-version-functions.c mongoc-write-command.c mongoc-write-concern.c service-gcp.c"
364364
PHP_MONGODB_UTF8PROC_SOURCES="utf8proc.c"

config.w32

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ if (PHP_MONGODB != "no") {
109109
// Sources below are updated by scripts/update-submodule-sources.php
110110
var PHP_MONGODB_COMMON_SOURCES="common-atomic.c common-b64.c common-json.c common-md5.c common-oid.c common-string.c common-thread.c"
111111
var PHP_MONGODB_KMS_MESSAGE_SOURCES="hexlify.c kms_azure_request.c kms_b64.c kms_caller_identity_request.c kms_crypto_apple.c kms_crypto_libcrypto.c kms_crypto_none.c kms_crypto_windows.c kms_decrypt_request.c kms_encrypt_request.c kms_gcp_request.c kms_kmip_reader_writer.c kms_kmip_request.c kms_kmip_response.c kms_kmip_response_parser.c kms_kv_list.c kms_message.c kms_port.c kms_request.c kms_request_opt.c kms_request_str.c kms_response.c kms_response_parser.c sort.c";
112-
var PHP_MONGODB_BSON_SOURCES="bcon.c bson.c bson-clock.c bson-context.c bson-decimal128.c bson-error.c bson-iso8601.c bson-iter.c bson-json.c bson-keys.c bson-memory.c bson-oid.c bson-reader.c bson-string.c bson-timegm.c bson-utf8.c bson-value.c bson-vector.c bson-version-functions.c bson-writer.c";
112+
var PHP_MONGODB_BSON_SOURCES="bcon.c bson.c bson-clock.c bson-context.c bson-decimal128.c bson-error.c bson-iso8601.c bson-iter.c bson-json.c bson-keys.c bson-memory.c bson-oid.c bson-reader.c bson-string.c bson-timegm.c bson-utf8.c bson-value.c bson-vector.c bson-version-functions.c bson-writer.c validate.c";
113113
var PHP_MONGODB_JSONSL_SOURCES="jsonsl.c";
114114
var PHP_MONGODB_MONGOC_SOURCES="mcd-azure.c mcd-nsinfo.c mcd-rpc.c mongoc-aggregate.c mongoc-apm.c mongoc-array.c mongoc-async.c mongoc-async-cmd.c mongoc-buffer.c mongoc-bulk-operation.c mongoc-bulkwrite.c mongoc-change-stream.c mongoc-client.c mongoc-client-pool.c mongoc-client-session.c mongoc-client-side-encryption.c mongoc-cluster-aws.c mongoc-cluster.c mongoc-cluster-cyrus.c mongoc-cluster-sasl.c mongoc-cluster-sspi.c mongoc-cmd.c mongoc-collection.c mongoc-compression.c mongoc-counters.c mongoc-crypt.c mongoc-crypto.c mongoc-crypto-cng.c mongoc-crypto-common-crypto.c mongoc-crypto-openssl.c mongoc-cursor-array.c mongoc-cursor.c mongoc-cursor-change-stream.c mongoc-cursor-cmd.c mongoc-cursor-cmd-deprecated.c mongoc-cursor-find.c mongoc-cursor-find-cmd.c mongoc-cursor-find-opquery.c mongoc-cursor-legacy.c mongoc-cyrus.c mongoc-database.c mongoc-deprioritized-servers.c mongoc-error.c mongoc-find-and-modify.c mongoc-flags.c mongoc-generation-map.c mongoc-gridfs-bucket.c mongoc-gridfs-bucket-file.c mongoc-gridfs.c mongoc-gridfs-file.c mongoc-gridfs-file-list.c mongoc-gridfs-file-page.c mongoc-handshake.c mongoc-host-list.c mongoc-http.c mongoc-init.c mongoc-interrupt.c mongoc-linux-distro-scanner.c mongoc-list.c mongoc-log-and-monitor-private.c mongoc-log.c mongoc-memcmp.c mongoc-ocsp-cache.c mongoc-opcode.c mongoc-openssl.c mongoc-optional.c mongoc-opts.c mongoc-opts-helpers.c mongoc-queue.c mongoc-rand-cng.c mongoc-rand-common-crypto.c mongoc-rand-openssl.c mongoc-read-concern.c mongoc-read-prefs.c mongoc-rpc.c mongoc-sasl.c mongoc-scram.c mongoc-secure-channel.c mongoc-secure-transport.c mongoc-server-api.c mongoc-server-description.c mongoc-server-monitor.c mongoc-server-stream.c mongoc-set.c mongoc-shared.c mongoc-socket.c mongoc-ssl.c mongoc-sspi.c mongoc-stream-buffered.c mongoc-stream.c mongoc-stream-file.c mongoc-stream-gridfs.c mongoc-stream-gridfs-download.c mongoc-stream-gridfs-upload.c mongoc-stream-socket.c mongoc-stream-tls.c mongoc-stream-tls-openssl-bio.c mongoc-stream-tls-openssl.c mongoc-stream-tls-secure-channel.c mongoc-stream-tls-secure-transport.c mongoc-structured-log.c mongoc-timeout.c mongoc-topology-background-monitoring.c mongoc-topology.c mongoc-topology-description-apm.c mongoc-topology-description.c mongoc-topology-scanner.c mongoc-ts-pool.c mongoc-uri.c mongoc-util.c mongoc-version-functions.c mongoc-write-command.c mongoc-write-concern.c service-gcp.c";
115115
var PHP_MONGODB_UTF8PROC_SOURCES="utf8proc.c";

sbom.json

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,52 @@
11
{
22
"components": [
33
{
4-
"bom-ref": "pkg:github/mongodb/libmongocrypt@1.14.0",
4+
"bom-ref": "pkg:github/mongodb/libmongocrypt@1.14.1",
55
"externalReferences": [
66
{
77
"type": "distribution",
8-
"url": "https://github.com/mongodb/libmongocrypt/archive/refs/tags/1.14.0.tar.gz"
8+
"url": "https://github.com/mongodb/libmongocrypt/archive/refs/tags/1.14.1.tar.gz"
99
},
1010
{
1111
"type": "website",
12-
"url": "https://github.com/mongodb/libmongocrypt/tree/1.14.0"
12+
"url": "https://github.com/mongodb/libmongocrypt/tree/1.14.1"
1313
}
1414
],
1515
"group": "mongodb",
1616
"name": "libmongocrypt",
17-
"purl": "pkg:github/mongodb/libmongocrypt@1.14.0",
17+
"purl": "pkg:github/mongodb/libmongocrypt@1.14.1",
1818
"type": "library",
19-
"version": "1.14.0"
19+
"version": "1.14.1"
2020
},
2121
{
22-
"bom-ref": "pkg:github/mongodb/mongo-c-driver@2.0.1",
22+
"bom-ref": "pkg:github/mongodb/mongo-c-driver@2.0.2",
2323
"externalReferences": [
2424
{
2525
"type": "distribution",
26-
"url": "https://github.com/mongodb/mongo-c-driver/archive/refs/tags/2.0.1.tar.gz"
26+
"url": "https://github.com/mongodb/mongo-c-driver/archive/refs/tags/2.0.2.tar.gz"
2727
},
2828
{
2929
"type": "website",
30-
"url": "https://github.com/mongodb/mongo-c-driver/tree/2.0.1"
30+
"url": "https://github.com/mongodb/mongo-c-driver/tree/2.0.2"
3131
}
3232
],
3333
"group": "mongodb",
3434
"name": "mongo-c-driver",
35-
"purl": "pkg:github/mongodb/mongo-c-driver@2.0.1",
35+
"purl": "pkg:github/mongodb/mongo-c-driver@2.0.2",
3636
"type": "library",
37-
"version": "2.0.1"
37+
"version": "2.0.2"
3838
}
3939
],
4040
"dependencies": [
4141
{
42-
"ref": "pkg:github/mongodb/libmongocrypt@1.14.0"
42+
"ref": "pkg:github/mongodb/libmongocrypt@1.14.1"
4343
},
4444
{
45-
"ref": "pkg:github/mongodb/mongo-c-driver@2.0.1"
45+
"ref": "pkg:github/mongodb/mongo-c-driver@2.0.2"
4646
}
4747
],
4848
"metadata": {
49-
"timestamp": "2025-05-21T07:55:41.587707+00:00",
49+
"timestamp": "2025-06-11T06:47:48.667004+00:00",
5050
"tools": [
5151
{
5252
"externalReferences": [
@@ -90,8 +90,9 @@
9090
]
9191
},
9292
"serialNumber": "urn:uuid:acb30d08-ee47-4ff0-b301-d66ef1f54082",
93-
"version": 14,
93+
"version": 15,
9494
"$schema": "http://cyclonedx.org/schema/bom-1.5.schema.json",
9595
"bomFormat": "CycloneDX",
96-
"specVersion": "1.5"
96+
"specVersion": "1.5",
97+
"vulnerabilities": []
9798
}

src/LIBMONGOCRYPT_VERSION_CURRENT

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.14.0
1+
1.14.1

src/libmongoc

Submodule libmongoc updated 39 files

tests/bulk/bulkwrite-insert_error-001.phpt

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,12 @@ $bulk = new MongoDB\Driver\BulkWrite;
99

1010
echo throws(function() use ($bulk) {
1111
$bulk->insert(['' => 1]);
12-
}, 'MongoDB\Driver\Exception\InvalidArgumentException'), "\n\n";
13-
14-
echo throws(function() use ($bulk) {
15-
$bulk->insert(["\xc3\x28" => 1]);
1612
}, 'MongoDB\Driver\Exception\InvalidArgumentException'), "\n";
1713

1814
?>
1915
===DONE===
2016
<?php exit(0); ?>
2117
--EXPECT--
2218
OK: Got MongoDB\Driver\Exception\InvalidArgumentException
23-
invalid document for insert: empty key
24-
25-
OK: Got MongoDB\Driver\Exception\InvalidArgumentException
26-
invalid document for insert: corrupt BSON
19+
invalid document for insert: Element key cannot be an empty string
2720
===DONE===

tests/bulk/bulkwrite-update_error-001.phpt

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,12 @@ $bulk = new MongoDB\Driver\BulkWrite;
99

1010
echo throws(function() use ($bulk) {
1111
$bulk->update(['x' => 1], ['' => 1]);
12-
}, 'MongoDB\Driver\Exception\InvalidArgumentException'), "\n\n";
13-
14-
echo throws(function() use ($bulk) {
15-
$bulk->update(['x' => 1], ["\xc3\x28" => 1]);
1612
}, 'MongoDB\Driver\Exception\InvalidArgumentException'), "\n";
1713

1814
?>
1915
===DONE===
2016
<?php exit(0); ?>
2117
--EXPECT--
2218
OK: Got MongoDB\Driver\Exception\InvalidArgumentException
23-
invalid argument for replace: empty key
24-
25-
OK: Got MongoDB\Driver\Exception\InvalidArgumentException
26-
invalid argument for replace: corrupt BSON
19+
invalid argument for replace: Element key cannot be an empty string
2720
===DONE===

tests/bulk/bulkwrite-update_error-002.phpt

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,6 @@ echo throws(function() use ($bulk) {
1111
$bulk->update(['x' => 1], ['$set' => ['x' => ['' => 1]]]);
1212
}, 'MongoDB\Driver\Exception\InvalidArgumentException'), "\n\n";
1313

14-
echo throws(function() use ($bulk) {
15-
$bulk->update(['x' => 1], ['$set' => ['x' => ["\xc3\x28" => 1]]]);
16-
}, 'MongoDB\Driver\Exception\InvalidArgumentException'), "\n\n";
17-
1814
/* This newObj argument mixes an update and replacement document, but
1915
* php_phongo_bulkwrite_update_has_operators() will categorize it as an update
2016
* due to the presence of an atomic operator. As such, _mongoc_validate_update()
@@ -28,10 +24,7 @@ echo throws(function() use ($bulk) {
2824
<?php exit(0); ?>
2925
--EXPECT--
3026
OK: Got MongoDB\Driver\Exception\InvalidArgumentException
31-
invalid argument for update: empty key
32-
33-
OK: Got MongoDB\Driver\Exception\InvalidArgumentException
34-
invalid argument for update: corrupt BSON
27+
invalid argument for update: Element key cannot be an empty string
3528

3629
OK: Got MongoDB\Driver\Exception\InvalidArgumentException
3730
Invalid key 'z': update only works with $ operators and pipelines

0 commit comments

Comments
 (0)