From 787f301143e5cb8fa7c1f6e7b5c95fc00faac0b0 Mon Sep 17 00:00:00 2001 From: Jeremy Mikola Date: Wed, 15 Jan 2025 14:01:22 -0500 Subject: [PATCH 1/4] PHPC-2499: Update to libmongoc 1.29.2 (#1766) * Install Python 3.13 for drivers-evergreen-tools GH action Related to mongodb/mongo-php-library#1564 --- .github/workflows/tests.yml | 4 ++++ sbom.json | 16 ++++++++-------- src/LIBMONGOC_VERSION_CURRENT | 2 +- src/libmongoc | 2 +- 4 files changed, 14 insertions(+), 10 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 56eb5b6ea..8fb2368e4 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -53,6 +53,10 @@ jobs: with: submodules: true + - uses: actions/setup-python@v5 + with: + python-version: '3.13' + - id: setup-mongodb uses: mongodb-labs/drivers-evergreen-tools@master with: diff --git a/sbom.json b/sbom.json index fb98f7605..7ed391e81 100644 --- a/sbom.json +++ b/sbom.json @@ -19,22 +19,22 @@ "version": "1.12.0" }, { - "bom-ref": "pkg:github/mongodb/mongo-c-driver@1.29.0", + "bom-ref": "pkg:github/mongodb/mongo-c-driver@1.29.2", "externalReferences": [ { "type": "distribution", - "url": "https://github.com/mongodb/mongo-c-driver/archive/refs/tags/1.29.0.tar.gz" + "url": "https://github.com/mongodb/mongo-c-driver/archive/refs/tags/1.29.2.tar.gz" }, { "type": "website", - "url": "https://github.com/mongodb/mongo-c-driver/tree/1.29.0" + "url": "https://github.com/mongodb/mongo-c-driver/tree/1.29.2" } ], "group": "mongodb", "name": "mongo-c-driver", - "purl": "pkg:github/mongodb/mongo-c-driver@1.29.0", + "purl": "pkg:github/mongodb/mongo-c-driver@1.29.2", "type": "library", - "version": "1.29.0" + "version": "1.29.2" } ], "dependencies": [ @@ -42,11 +42,11 @@ "ref": "pkg:github/mongodb/libmongocrypt@1.12.0" }, { - "ref": "pkg:github/mongodb/mongo-c-driver@1.29.0" + "ref": "pkg:github/mongodb/mongo-c-driver@1.29.2" } ], "metadata": { - "timestamp": "2024-11-12T18:00:38.546484+00:00", + "timestamp": "2025-01-14T14:24:24.250261+00:00", "tools": [ { "externalReferences": [ @@ -90,7 +90,7 @@ ] }, "serialNumber": "urn:uuid:acb30d08-ee47-4ff0-b301-d66ef1f54082", - "version": 7, + "version": 8, "$schema": "http://cyclonedx.org/schema/bom-1.5.schema.json", "bomFormat": "CycloneDX", "specVersion": "1.5", diff --git a/src/LIBMONGOC_VERSION_CURRENT b/src/LIBMONGOC_VERSION_CURRENT index 5e57fb895..412114252 100644 --- a/src/LIBMONGOC_VERSION_CURRENT +++ b/src/LIBMONGOC_VERSION_CURRENT @@ -1 +1 @@ -1.29.0 +1.29.2 diff --git a/src/libmongoc b/src/libmongoc index fc82e03cb..48011c65d 160000 --- a/src/libmongoc +++ b/src/libmongoc @@ -1 +1 @@ -Subproject commit fc82e03cbea13abf276b5abb3736249e97c7ee0f +Subproject commit 48011c65d759bc288a02a583c378a224c1141bbb From 2585be41bac879c2c278ba469025e2253a8cb7f9 Mon Sep 17 00:00:00 2001 From: Jeremy Mikola Date: Wed, 29 Jan 2025 11:39:15 -0500 Subject: [PATCH 2/4] PHPC-2496: WriteException stub should inherit ServerException (#1769) --- src/MongoDB/Exception/WriteException.stub.php | 2 +- src/MongoDB/Exception/WriteException_arginfo.h | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/MongoDB/Exception/WriteException.stub.php b/src/MongoDB/Exception/WriteException.stub.php index 4372e933a..9ee7bfc26 100644 --- a/src/MongoDB/Exception/WriteException.stub.php +++ b/src/MongoDB/Exception/WriteException.stub.php @@ -8,7 +8,7 @@ namespace MongoDB\Driver\Exception; /** @deprecated use MongoDB\Driver\Exception\BulkWriteException instead */ -abstract class WriteException extends RuntimeException +abstract class WriteException extends ServerException { /** @var \MongoDB\Driver\WriteResult */ protected $writeResult; diff --git a/src/MongoDB/Exception/WriteException_arginfo.h b/src/MongoDB/Exception/WriteException_arginfo.h index 9c3e9f43d..e373c6bfe 100644 --- a/src/MongoDB/Exception/WriteException_arginfo.h +++ b/src/MongoDB/Exception/WriteException_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: bf7229dbad041a8fe73af62d1961700783a933e3 */ + * Stub hash: d68a9b6bb6ba6a1222689ffe95c58ce91b3a6704 */ ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_MongoDB_Driver_Exception_WriteException_getWriteResult, 0, 0, MongoDB\\Driver\\WriteResult, 0) ZEND_END_ARG_INFO() @@ -13,12 +13,12 @@ static const zend_function_entry class_MongoDB_Driver_Exception_WriteException_m ZEND_FE_END }; -static zend_class_entry *register_class_MongoDB_Driver_Exception_WriteException(zend_class_entry *class_entry_MongoDB_Driver_Exception_RuntimeException) +static zend_class_entry *register_class_MongoDB_Driver_Exception_WriteException(zend_class_entry *class_entry_MongoDB_Driver_Exception_ServerException) { zend_class_entry ce, *class_entry; INIT_NS_CLASS_ENTRY(ce, "MongoDB\\Driver\\Exception", "WriteException", class_MongoDB_Driver_Exception_WriteException_methods); - class_entry = zend_register_internal_class_ex(&ce, class_entry_MongoDB_Driver_Exception_RuntimeException); + class_entry = zend_register_internal_class_ex(&ce, class_entry_MongoDB_Driver_Exception_ServerException); class_entry->ce_flags |= ZEND_ACC_ABSTRACT|ZEND_ACC_DEPRECATED; zval property_writeResult_default_value; From 2b2e0be061aa89950e8da617c4eb8f5bd60bb7b8 Mon Sep 17 00:00:00 2001 From: Jeremy Mikola Date: Wed, 29 Jan 2025 11:44:36 -0500 Subject: [PATCH 3/4] PHPC-2477: Remove unused libmongoc and libbson constants (#1768) * PHPC-2477: BSON_HAVE_ATOMIC constants are obsolete CDRIVER-4124 removed BSON_HAVE_ATOMIC_32_ADD_AND_FETCH and BSON_HAVE_ATOMIC_64_ADD_AND_FETCH * PHPC-2477: BSON_PTHREAD_ONCE_INIT_NEEDS_BRACES is obsolete CDRIVER-2694 removed BSON_PTHREAD_ONCE_INIT_NEEDS_BRACES * PHPC-2477: BSON_HAVE_REALLOCF is obsolete BSON_HAVE_REALLOCF was no longer used when libbson was vendored in CDRIVER-2416 * PHPC-2477: BSON_HAVE_SYSCALL_TID is obsolete CDRIVER-2771 removed outstanding references to BSON_HAVE_SYSCALL_TID * PHPC-2477: BSON_NEEDS_SET_OUTPUT_FORMAT is obsolete * PHPC-2477: BSON_HAVE_DECIMAL128 is obsolete * PHPC-2477: BSON_HAVE_ARC4RANDOM_BUF is obsolete * PHPC-2477: MONGOC_ENABLE_SASL_GSSAPI is obsolete CDRIVER-2654 removed MONGOC_ENABLE_SASL_GSSAPI. PHPC-2312 removed it from Autotools, but it was left behind in config.w32. * PHPC-2477: MONGOC_HAVE_WEAK_SYMBOLS is obsolete CDRIVER-2600 removed MONGOC_HAVE_WEAK_SYMBOLS --- config.m4 | 2 - config.w32 | 16 +---- scripts/autotools/libbson/CheckAtomics.m4 | 23 ------- scripts/autotools/libbson/FindDependencies.m4 | 67 ------------------- scripts/autotools/libmongoc/WeakSymbols.m4 | 9 --- 5 files changed, 1 insertion(+), 116 deletions(-) delete mode 100644 scripts/autotools/libbson/CheckAtomics.m4 delete mode 100644 scripts/autotools/libmongoc/WeakSymbols.m4 diff --git a/config.m4 b/config.m4 index 28998f5e8..57f2c42c5 100644 --- a/config.m4 +++ b/config.m4 @@ -338,7 +338,6 @@ if test "$PHP_MONGODB" != "no"; then m4_include(PHP_MONGODB_BASEDIR/scripts/autotools/CheckHost.m4) m4_include(PHP_MONGODB_BASEDIR/scripts/autotools/PlatformFlags.m4) - m4_include(PHP_MONGODB_BASEDIR/scripts/autotools/libbson/CheckAtomics.m4) m4_include(PHP_MONGODB_BASEDIR/scripts/autotools/libbson/CheckHeaders.m4) m4_include(PHP_MONGODB_BASEDIR/scripts/autotools/libbson/Endian.m4) m4_include(PHP_MONGODB_BASEDIR/scripts/autotools/libbson/FindDependencies.m4) @@ -352,7 +351,6 @@ if test "$PHP_MONGODB" != "no"; then m4_include(PHP_MONGODB_BASEDIR/scripts/autotools/libmongoc/Endian.m4) m4_include(PHP_MONGODB_BASEDIR/scripts/autotools/libmongoc/FindDependencies.m4) m4_include(PHP_MONGODB_BASEDIR/scripts/autotools/libmongoc/Versions.m4) - m4_include(PHP_MONGODB_BASEDIR/scripts/autotools/libmongoc/WeakSymbols.m4) dnl This include modifies the value of $PHP_MONGODB_CLIENT_SIDE_ENCRYPTION to "yes" dnl or "no" depending on whether dependencies for libmongocrypt are fulfilled diff --git a/config.w32 b/config.w32 index dbded6599..91199a87b 100644 --- a/config.w32 +++ b/config.w32 @@ -130,28 +130,16 @@ if (PHP_MONGODB != "no") { BSON_OS: 2, BSON_HAVE_STDBOOL_H: 0, BSON_HAVE_STRINGS_H: 0, - BSON_HAVE_ATOMIC_32_ADD_AND_FETCH: 0, - BSON_HAVE_ATOMIC_64_ADD_AND_FETCH: 0, - BSON_PTHREAD_ONCE_INIT_NEEDS_BRACES: 0, BSON_HAVE_CLOCK_GETTIME: 0, BSON_HAVE_STRNLEN: 0, BSON_HAVE_SNPRINTF: 0, BSON_HAVE_STRLCPY: 0, - BSON_HAVE_REALLOCF: 0, - BSON_NEEDS_SET_OUTPUT_FORMAT: 0, BSON_HAVE_TIMESPEC: 0, BSON_EXTRA_ALIGN: 0, - BSON_HAVE_SYSCALL_TID: 0, - BSON_HAVE_DECIMAL128: 0, BSON_HAVE_GMTIME_R: 0, - BSON_HAVE_RAND_R: 0, - BSON_HAVE_ARC4RANDOM_BUF: 0 + BSON_HAVE_RAND_R: 0 }; - if (CHECK_FUNC_IN_HEADER("stdio.h", "_set_output_format")) { - bson_opts.BSON_NEEDS_SET_OUTPUT_FORMAT = 1; - } - mongodb_generate_header( configure_module_dirname + "/src/libmongoc/src/libbson/src/bson/bson-config.h.in", configure_module_dirname + "/src/libmongoc/src/libbson/src/bson/bson-config.h", @@ -187,7 +175,6 @@ if (PHP_MONGODB != "no") { MONGOC_ENABLE_MONGODB_AWS_AUTH: 0, MONGOC_ENABLE_SASL: 0, MONGOC_ENABLE_SASL_CYRUS: 0, - MONGOC_ENABLE_SASL_GSSAPI: 0, MONGOC_ENABLE_SASL_SSPI: 0, MONGOC_ENABLE_SRV: 0, MONGOC_ENABLE_RDTSCP: 0, @@ -196,7 +183,6 @@ if (PHP_MONGODB != "no") { MONGOC_HAVE_SASL_CLIENT_DONE: 0, MONGOC_HAVE_SCHED_GETCPU: 0, MONGOC_HAVE_SOCKLEN: 1, - MONGOC_HAVE_WEAK_SYMBOLS: 0, MONGOC_NO_AUTOMATIC_GLOBALS: 1, MONGOC_SOCKET_ARG2: "struct sockaddr", MONGOC_SOCKET_ARG3: "socklen_t", diff --git a/scripts/autotools/libbson/CheckAtomics.m4 b/scripts/autotools/libbson/CheckAtomics.m4 deleted file mode 100644 index 3071e36df..000000000 --- a/scripts/autotools/libbson/CheckAtomics.m4 +++ /dev/null @@ -1,23 +0,0 @@ -AC_LANG_PUSH([C]) -AC_MSG_CHECKING([for __sync_add_and_fetch_4]) -AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include ]], - [[int32_t v = 1; return __sync_add_and_fetch_4 (&v, (int32_t)10);]])], - [AC_MSG_RESULT(yes) - have_sync_add_and_fetch_4=yes], - [AC_MSG_RESULT(no) - have_sync_add_and_fetch_4=no]) -AS_IF([test "$have_sync_add_and_fetch_4" = "yes"], - [AC_SUBST(BSON_HAVE_ATOMIC_32_ADD_AND_FETCH, 1)], - [AC_SUBST(BSON_HAVE_ATOMIC_32_ADD_AND_FETCH, 0)]) - -AC_MSG_CHECKING([for __sync_add_and_fetch_8]) -AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include ]], - [[int64_t v; return __sync_add_and_fetch_8 (&v, (int64_t)10);]])], - [AC_MSG_RESULT(yes) - have_sync_add_and_fetch_8=yes], - [AC_MSG_RESULT(no) - have_sync_add_and_fetch_8=no]) -AS_IF([test "$have_sync_add_and_fetch_8" = "yes"], - [AC_SUBST(BSON_HAVE_ATOMIC_64_ADD_AND_FETCH, 1)], - [AC_SUBST(BSON_HAVE_ATOMIC_64_ADD_AND_FETCH, 0)]) -AC_LANG_POP([C]) diff --git a/scripts/autotools/libbson/FindDependencies.m4 b/scripts/autotools/libbson/FindDependencies.m4 index f365f6c21..2472e0a1b 100644 --- a/scripts/autotools/libbson/FindDependencies.m4 +++ b/scripts/autotools/libbson/FindDependencies.m4 @@ -13,46 +13,6 @@ if test "$bson_cv_have_strnlen" = yes; then AC_SUBST(BSON_HAVE_STRNLEN, 1) fi -# Check for reallocf() (BSD/Darwin) -AC_SUBST(BSON_HAVE_REALLOCF, 0) -AC_CACHE_CHECK([for reallocf], - bson_cv_have_reallocf, - [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ -#include -int reallocf () { return 0; } -]])], - [bson_cv_have_reallocf=no], - [bson_cv_have_reallocf=yes])]) -if test "$bson_cv_have_reallocf" = yes; then - AC_SUBST(BSON_HAVE_REALLOCF, 1) -fi - -# Check for syscall() -AC_SUBST(BSON_HAVE_SYSCALL_TID, 0) -AC_CACHE_CHECK([for syscall], - bson_cv_have_syscall_tid, - [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ -#include -#include -int syscall () { return 0; } -]])], - [bson_cv_have_syscall_tid=no], - [bson_cv_have_syscall_tid=yes])]) -if test "$bson_cv_have_syscall_tid" = yes -a "$os_darwin" != "yes"; then - AC_CACHE_CHECK([for SYS_gettid], - bson_cv_have_sys_gettid_tid, - [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ -#include -#include -int gettid () { return SYS_gettid; } - ]])], - [bson_cv_have_sys_gettid_tid=yes], - [bson_cv_have_sys_gettid_tid=no])]) - if test "$bson_cv_have_sys_gettid_tid" = yes; then - AC_SUBST(BSON_HAVE_SYSCALL_TID, 1) - fi -fi - # Check for snprintf() AC_SUBST(BSON_HAVE_SNPRINTF, 0) AC_CHECK_FUNC(snprintf, [AC_SUBST(BSON_HAVE_SNPRINTF, 1)]) @@ -79,10 +39,6 @@ AC_CHECK_FUNC(gmtime_r, [AC_SUBST(BSON_HAVE_GMTIME_R, 1)]) AC_SUBST(BSON_HAVE_RAND_R, 0) AC_CHECK_FUNC(rand_r, [AC_SUBST(BSON_HAVE_RAND_R, 1)]) -# Check for arc4random_buf() -AC_SUBST(BSON_HAVE_ARC4RANDOM_BUF, 0) -AC_CHECK_FUNC(arc4random_buf, [AC_SUBST(BSON_HAVE_ARC4RANDOM_BUF, 1)]) - # Check for pthreads. We might need to make this better to handle mingw, # but I actually think it is okay to just check for it even though we will # use win32 primatives. @@ -96,26 +52,3 @@ AX_PTHREAD([ ],[ AC_MSG_ERROR([libbson requires pthreads on non-Windows platforms.]) ]) - - -# The following is borrowed from the guile configure script. -# -# On past versions of Solaris, believe 8 through 10 at least, you -# had to write "pthread_once_t foo = { PTHREAD_ONCE_INIT };". -# This is contrary to POSIX: -# http://www.opengroup.org/onlinepubs/000095399/functions/pthread_once.html -# Check here if this style is required. -# -# glibc (2.3.6 at least) works both with or without braces, so the -# test checks whether it works without. -# -AC_SUBST(BSON_PTHREAD_ONCE_INIT_NEEDS_BRACES, 0) -AC_CACHE_CHECK([whether PTHREAD_ONCE_INIT needs braces], - bson_cv_need_braces_on_pthread_once_init, - [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include - pthread_once_t foo = PTHREAD_ONCE_INIT;]])], - [bson_cv_need_braces_on_pthread_once_init=no], - [bson_cv_need_braces_on_pthread_once_init=yes])]) -if test "$bson_cv_need_braces_on_pthread_once_init" = yes; then - AC_SUBST(BSON_PTHREAD_ONCE_INIT_NEEDS_BRACES, 1) -fi diff --git a/scripts/autotools/libmongoc/WeakSymbols.m4 b/scripts/autotools/libmongoc/WeakSymbols.m4 deleted file mode 100644 index 1a54a4fe7..000000000 --- a/scripts/autotools/libmongoc/WeakSymbols.m4 +++ /dev/null @@ -1,9 +0,0 @@ -AC_MSG_CHECKING(if weak symbols are supported) -AC_LINK_IFELSE([AC_LANG_PROGRAM([[ -__attribute__((weak)) void __dummy(void *x) { } -void f(void *x) { __dummy(x); } -]], [[ ]] -)], -[AC_MSG_RESULT(yes) -AC_SUBST(MONGOC_HAVE_WEAK_SYMBOLS, 1)], -[AC_MSG_RESULT(no)]) From 7590fae661ad41f49326b3a43735c0f2a4c5a0e2 Mon Sep 17 00:00:00 2001 From: Jeremy Mikola Date: Wed, 29 Jan 2025 14:38:03 -0500 Subject: [PATCH 4/4] PHPC-2502: Remove XFAIL in server-executeQuery-012.phpt (#1772) The corresponding CDRIVER ticket was fixed a while back, and included in the submodule bump for PHPC 1.13. --- tests/server/server-executeQuery-012.phpt | 2 -- 1 file changed, 2 deletions(-) diff --git a/tests/server/server-executeQuery-012.phpt b/tests/server/server-executeQuery-012.phpt index f67a06336..c324f0757 100644 --- a/tests/server/server-executeQuery-012.phpt +++ b/tests/server/server-executeQuery-012.phpt @@ -1,7 +1,5 @@ --TEST-- MongoDB\Driver\Server::executeQuery() pins transaction to server ---XFAIL-- -_mongoc_cursor_fetch_stream segfault (CDRIVER-4290) --SKIPIF--