From 3635cc1a6b2bc9f6827bf21b7eaa832406b7f7a7 Mon Sep 17 00:00:00 2001 From: Andreas Braun Date: Tue, 10 Jun 2025 12:24:41 +0200 Subject: [PATCH 1/2] PHPC-2593: Update libmongoc to 1.30.5 --- .../generated/build/build-libmongoc.yml | 2 +- .../templates/build/build-libmongoc.yml | 2 +- config.m4 | 10 +++++----- config.w32 | 2 +- sbom.json | 19 ++++++++++--------- src/LIBMONGOC_VERSION_CURRENT | 2 +- src/libmongoc | 2 +- 7 files changed, 20 insertions(+), 19 deletions(-) diff --git a/.evergreen/config/generated/build/build-libmongoc.yml b/.evergreen/config/generated/build/build-libmongoc.yml index b1e845197..2f847e620 100644 --- a/.evergreen/config/generated/build/build-libmongoc.yml +++ b/.evergreen/config/generated/build/build-libmongoc.yml @@ -12,7 +12,7 @@ tasks: - func: "compile driver" vars: PHP_VERSION: "8.3" - LIBMONGOC_VERSION: "1.30.1" + LIBMONGOC_VERSION: "1.30.5" - func: "upload build" - name: "build-php-8.3-libmongoc-next-stable" diff --git a/.evergreen/config/templates/build/build-libmongoc.yml b/.evergreen/config/templates/build/build-libmongoc.yml index 3ae136345..cb555f80b 100644 --- a/.evergreen/config/templates/build/build-libmongoc.yml +++ b/.evergreen/config/templates/build/build-libmongoc.yml @@ -10,7 +10,7 @@ - func: "compile driver" vars: PHP_VERSION: "%phpVersion%" - LIBMONGOC_VERSION: "1.30.1" + LIBMONGOC_VERSION: "1.30.5" - func: "upload build" - name: "build-php-%phpVersion%-libmongoc-next-stable" diff --git a/config.m4 b/config.m4 index 550fa973e..a8626c5a1 100644 --- a/config.m4 +++ b/config.m4 @@ -277,7 +277,7 @@ if test "$PHP_MONGODB" != "no"; then PHP_MONGODB_MONGOCRYPT_VERSION_STRING="None" if test "$PHP_MONGODB_SYSTEM_LIBS" != "no"; then - PKG_CHECK_MODULES([PHP_MONGODB_BSON], [libbson-1.0 >= 1.30.3], [ + PKG_CHECK_MODULES([PHP_MONGODB_BSON], [libbson-1.0 >= 1.30.5], [ PHP_MONGODB_BSON_VERSION=`$PKG_CONFIG libbson-1.0 --modversion` PHP_MONGODB_BSON_VERSION_STRING="System ($PHP_MONGODB_BSON_VERSION)" @@ -285,10 +285,10 @@ if test "$PHP_MONGODB" != "no"; then PHP_EVAL_LIBLINE($PHP_MONGODB_BSON_LIBS, MONGODB_SHARED_LIBADD) AC_DEFINE(HAVE_SYSTEM_LIBBSON, 1, [Use system libbson]) ],[ - AC_MSG_ERROR([Could not find system library for libbson >= 1.30.3]) + AC_MSG_ERROR([Could not find system library for libbson >= 1.30.5]) ]) - PKG_CHECK_MODULES([PHP_MONGODB_MONGOC], [libmongoc-1.0 >= 1.30.3], [ + PKG_CHECK_MODULES([PHP_MONGODB_MONGOC], [libmongoc-1.0 >= 1.30.5], [ PHP_MONGODB_BSON_VERSION=`$PKG_CONFIG libbson-1.0 --modversion` PHP_MONGODB_BSON_VERSION_STRING="System ($PHP_MONGODB_BSON_VERSION)" @@ -296,7 +296,7 @@ if test "$PHP_MONGODB" != "no"; then PHP_EVAL_LIBLINE($PHP_MONGODB_MONGOC_LIBS, MONGODB_SHARED_LIBADD) AC_DEFINE(HAVE_SYSTEM_LIBMONGOC, 1, [Use system libmongoc]) ],[ - AC_MSG_ERROR(Could not find system library for libmongoc >= 1.30.3) + AC_MSG_ERROR(Could not find system library for libmongoc >= 1.30.5) ]) if test "$PHP_MONGODB_CLIENT_SIDE_ENCRYPTION" != "no"; then @@ -395,7 +395,7 @@ if test "$PHP_MONGODB" != "no"; then dnl Sources below are updated by scripts/update-submodule-sources.php 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" 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" - PHP_MONGODB_BSON_SOURCES="bcon.c bson-atomic.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-md5.c bson-memory.c bson-oid.c bson-reader.c bson-string.c bson-timegm.c bson-utf8.c bson-value.c bson-version-functions.c bson-writer.c" + PHP_MONGODB_BSON_SOURCES="bcon.c bson-atomic.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-md5.c bson-memory.c bson-oid.c bson-reader.c bson-string.c bson-timegm.c bson-utf8.c bson-value.c bson-version-functions.c bson-writer.c validate.c" PHP_MONGODB_JSONSL_SOURCES="jsonsl.c" 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-index.c mongoc-init.c mongoc-interrupt.c mongoc-libressl.c mongoc-linux-distro-scanner.c mongoc-list.c mongoc-log-and-monitor-private.c mongoc-log.c mongoc-matcher.c mongoc-matcher-op.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-libressl.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" PHP_MONGODB_UTF8PROC_SOURCES="utf8proc.c" diff --git a/config.w32 b/config.w32 index 63bd1866a..5acf23822 100644 --- a/config.w32 +++ b/config.w32 @@ -108,7 +108,7 @@ if (PHP_MONGODB != "no") { // Sources below are updated by scripts/update-submodule-sources.php 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" 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"; - var PHP_MONGODB_BSON_SOURCES="bcon.c bson-atomic.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-md5.c bson-memory.c bson-oid.c bson-reader.c bson-string.c bson-timegm.c bson-utf8.c bson-value.c bson-version-functions.c bson-writer.c"; + var PHP_MONGODB_BSON_SOURCES="bcon.c bson-atomic.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-md5.c bson-memory.c bson-oid.c bson-reader.c bson-string.c bson-timegm.c bson-utf8.c bson-value.c bson-version-functions.c bson-writer.c validate.c"; var PHP_MONGODB_JSONSL_SOURCES="jsonsl.c"; 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-index.c mongoc-init.c mongoc-interrupt.c mongoc-libressl.c mongoc-linux-distro-scanner.c mongoc-list.c mongoc-log-and-monitor-private.c mongoc-log.c mongoc-matcher.c mongoc-matcher-op.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-libressl.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"; var PHP_MONGODB_UTF8PROC_SOURCES="utf8proc.c"; diff --git a/sbom.json b/sbom.json index 841367a72..df00c4693 100644 --- a/sbom.json +++ b/sbom.json @@ -19,22 +19,22 @@ "version": "1.12.0" }, { - "bom-ref": "pkg:github/mongodb/mongo-c-driver@1.30.3", + "bom-ref": "pkg:github/mongodb/mongo-c-driver@1.30.5", "externalReferences": [ { "type": "distribution", - "url": "https://github.com/mongodb/mongo-c-driver/archive/refs/tags/1.30.3.tar.gz" + "url": "https://github.com/mongodb/mongo-c-driver/archive/refs/tags/1.30.5.tar.gz" }, { "type": "website", - "url": "https://github.com/mongodb/mongo-c-driver/tree/1.30.3" + "url": "https://github.com/mongodb/mongo-c-driver/tree/1.30.5" } ], "group": "mongodb", "name": "mongo-c-driver", - "purl": "pkg:github/mongodb/mongo-c-driver@1.30.3", + "purl": "pkg:github/mongodb/mongo-c-driver@1.30.5", "type": "library", - "version": "1.30.3" + "version": "1.30.5" } ], "dependencies": [ @@ -42,11 +42,11 @@ "ref": "pkg:github/mongodb/libmongocrypt@1.12.0" }, { - "ref": "pkg:github/mongodb/mongo-c-driver@1.30.3" + "ref": "pkg:github/mongodb/mongo-c-driver@1.30.5" } ], "metadata": { - "timestamp": "2025-04-09T07:40:24.233811+00:00", + "timestamp": "2025-06-10T10:24:13.960044+00:00", "tools": [ { "externalReferences": [ @@ -90,8 +90,9 @@ ] }, "serialNumber": "urn:uuid:acb30d08-ee47-4ff0-b301-d66ef1f54082", - "version": 11, + "version": 12, "$schema": "http://cyclonedx.org/schema/bom-1.5.schema.json", "bomFormat": "CycloneDX", - "specVersion": "1.5" + "specVersion": "1.5", + "vulnerabilities": [] } diff --git a/src/LIBMONGOC_VERSION_CURRENT b/src/LIBMONGOC_VERSION_CURRENT index b0f33908d..ff592d353 100644 --- a/src/LIBMONGOC_VERSION_CURRENT +++ b/src/LIBMONGOC_VERSION_CURRENT @@ -1 +1 @@ -1.30.3 +1.30.5 diff --git a/src/libmongoc b/src/libmongoc index 80fa63e3d..252989c31 160000 --- a/src/libmongoc +++ b/src/libmongoc @@ -1 +1 @@ -Subproject commit 80fa63e3d11454c21e93b6bf8d262725011ff575 +Subproject commit 252989c310f7a326230f66311630ba259e34e4b3 From 8882fe3e4eec5ea5fe8413d7c33f37f38e502617 Mon Sep 17 00:00:00 2001 From: Andreas Braun Date: Tue, 10 Jun 2025 13:15:27 +0200 Subject: [PATCH 2/2] Update tests for new BSON validation logic --- tests/bulk/bulkwrite-insert_error-001.phpt | 9 +-------- tests/bulk/bulkwrite-update_error-001.phpt | 9 +-------- tests/bulk/bulkwrite-update_error-002.phpt | 9 +-------- 3 files changed, 3 insertions(+), 24 deletions(-) diff --git a/tests/bulk/bulkwrite-insert_error-001.phpt b/tests/bulk/bulkwrite-insert_error-001.phpt index b2c96c414..ebe2f9042 100644 --- a/tests/bulk/bulkwrite-insert_error-001.phpt +++ b/tests/bulk/bulkwrite-insert_error-001.phpt @@ -9,10 +9,6 @@ $bulk = new MongoDB\Driver\BulkWrite; echo throws(function() use ($bulk) { $bulk->insert(['' => 1]); -}, 'MongoDB\Driver\Exception\InvalidArgumentException'), "\n\n"; - -echo throws(function() use ($bulk) { - $bulk->insert(["\xc3\x28" => 1]); }, 'MongoDB\Driver\Exception\InvalidArgumentException'), "\n"; ?> @@ -20,8 +16,5 @@ echo throws(function() use ($bulk) { --EXPECT-- OK: Got MongoDB\Driver\Exception\InvalidArgumentException -invalid document for insert: empty key - -OK: Got MongoDB\Driver\Exception\InvalidArgumentException -invalid document for insert: corrupt BSON +invalid document for insert: Element key cannot be an empty string ===DONE=== diff --git a/tests/bulk/bulkwrite-update_error-001.phpt b/tests/bulk/bulkwrite-update_error-001.phpt index 82146af1d..26fb5dc1f 100644 --- a/tests/bulk/bulkwrite-update_error-001.phpt +++ b/tests/bulk/bulkwrite-update_error-001.phpt @@ -9,10 +9,6 @@ $bulk = new MongoDB\Driver\BulkWrite; echo throws(function() use ($bulk) { $bulk->update(['x' => 1], ['' => 1]); -}, 'MongoDB\Driver\Exception\InvalidArgumentException'), "\n\n"; - -echo throws(function() use ($bulk) { - $bulk->update(['x' => 1], ["\xc3\x28" => 1]); }, 'MongoDB\Driver\Exception\InvalidArgumentException'), "\n"; ?> @@ -20,8 +16,5 @@ echo throws(function() use ($bulk) { --EXPECT-- OK: Got MongoDB\Driver\Exception\InvalidArgumentException -invalid argument for replace: empty key - -OK: Got MongoDB\Driver\Exception\InvalidArgumentException -invalid argument for replace: corrupt BSON +invalid argument for replace: Element key cannot be an empty string ===DONE=== \ No newline at end of file diff --git a/tests/bulk/bulkwrite-update_error-002.phpt b/tests/bulk/bulkwrite-update_error-002.phpt index c39ef0d06..733debe3d 100644 --- a/tests/bulk/bulkwrite-update_error-002.phpt +++ b/tests/bulk/bulkwrite-update_error-002.phpt @@ -11,10 +11,6 @@ echo throws(function() use ($bulk) { $bulk->update(['x' => 1], ['$set' => ['x' => ['' => 1]]]); }, 'MongoDB\Driver\Exception\InvalidArgumentException'), "\n\n"; -echo throws(function() use ($bulk) { - $bulk->update(['x' => 1], ['$set' => ['x' => ["\xc3\x28" => 1]]]); -}, 'MongoDB\Driver\Exception\InvalidArgumentException'), "\n\n"; - /* This newObj argument mixes an update and replacement document, but * php_phongo_bulkwrite_update_has_operators() will categorize it as an update * due to the presence of an atomic operator. As such, _mongoc_validate_update() @@ -28,10 +24,7 @@ echo throws(function() use ($bulk) { --EXPECT-- OK: Got MongoDB\Driver\Exception\InvalidArgumentException -invalid argument for update: empty key - -OK: Got MongoDB\Driver\Exception\InvalidArgumentException -invalid argument for update: corrupt BSON +invalid argument for update: Element key cannot be an empty string OK: Got MongoDB\Driver\Exception\InvalidArgumentException Invalid key 'z': update only works with $ operators and pipelines