Skip to content

Merge v1.x into v2.x #1775

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

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 0 additions & 2 deletions config.m4
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
Expand Down
16 changes: 1 addition & 15 deletions config.w32
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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,
Expand All @@ -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",
Expand Down
16 changes: 8 additions & 8 deletions sbom.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,34 +19,34 @@
"version": "1.12.0"
},
{
"bom-ref": "pkg:github/mongodb/[email protected].0",
"bom-ref": "pkg:github/mongodb/[email protected].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/[email protected].0",
"purl": "pkg:github/mongodb/[email protected].2",
"type": "library",
"version": "1.29.0"
"version": "1.29.2"
}
],
"dependencies": [
{
"ref": "pkg:github/mongodb/[email protected]"
},
{
"ref": "pkg:github/mongodb/[email protected].0"
"ref": "pkg:github/mongodb/[email protected].2"
}
],
"metadata": {
"timestamp": "2024-11-12T18:00:38.546484+00:00",
"timestamp": "2025-01-14T14:24:24.250261+00:00",
"tools": [
{
"externalReferences": [
Expand Down Expand Up @@ -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",
Expand Down
23 changes: 0 additions & 23 deletions scripts/autotools/libbson/CheckAtomics.m4

This file was deleted.

67 changes: 0 additions & 67 deletions scripts/autotools/libbson/FindDependencies.m4
Original file line number Diff line number Diff line change
Expand Up @@ -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 <stdlib.h>
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 <unistd.h>
#include <sys/syscall.h>
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 <unistd.h>
#include <sys/syscall.h>
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)])
Expand All @@ -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.
Expand All @@ -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.h>
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
9 changes: 0 additions & 9 deletions scripts/autotools/libmongoc/WeakSymbols.m4

This file was deleted.

2 changes: 1 addition & 1 deletion src/LIBMONGOC_VERSION_CURRENT
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.29.0
1.29.2
2 changes: 1 addition & 1 deletion src/MongoDB/Exception/WriteException.stub.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
6 changes: 3 additions & 3 deletions src/MongoDB/Exception/WriteException_arginfo.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions src/phongo_util.c
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ zval* php_phongo_prep_legacy_option(zval* options, const char* key, bool* alloca
Z_ADDREF_P(options);
*allocated = true;

php_error_docref(NULL, E_DEPRECATED, "Passing the \"%s\" option directly is deprecated and will be removed in ext-mongodb 2.0", key);

return new_options;
}

Expand Down
2 changes: 1 addition & 1 deletion tests/bulk/write-0002.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ $w = 1;
$wtimeout = 1000;
$writeConcern = new \MongoDB\Driver\WriteConcern($w, $wtimeout);
var_dump($insertBulk);
$result = $manager->executeBulkWrite(NS, $insertBulk, $writeConcern);
$result = $manager->executeBulkWrite(NS, $insertBulk, ['writeConcern' => $writeConcern]);
var_dump($insertBulk);

assert($result instanceof \MongoDB\Driver\WriteResult);
Expand Down
23 changes: 23 additions & 0 deletions tests/manager/manager-executeBulkWrite-015.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
--TEST--
MongoDB\Driver\Manager::executeBulkWrite() explicit WriteConcern argument is deprecated
--SKIPIF--
<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
<?php skip_if_not_live(); ?>
<?php skip_if_not_clean(); ?>
--FILE--
<?php

require_once __DIR__ . "/../utils/basic.inc";

$manager = create_test_manager();

$bulk = new MongoDB\Driver\BulkWrite();
$bulk->insert(['_id' => 1]);
$manager->executeBulkWrite(NS, $bulk, new MongoDB\Driver\WriteConcern(0));

?>
===DONE===
<?php exit(0); ?>
--EXPECTF--
Deprecated: MongoDB\Driver\Manager::executeBulkWrite(): Passing the "writeConcern" option directly is deprecated and will be removed in ext-mongodb 2.0%s
===DONE===
2 changes: 1 addition & 1 deletion tests/manager/manager-executeBulkWrite_error-003.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ $bulk = new MongoDB\Driver\BulkWrite();
$bulk->insert(array('_id' => 1, 'x' => 1));

try {
$manager->executeBulkWrite(NS, $bulk, new MongoDB\Driver\WriteConcern(30));
$manager->executeBulkWrite(NS, $bulk, ['writeConcern' => new MongoDB\Driver\WriteConcern(30)]);
} catch (MongoDB\Driver\Exception\BulkWriteException $e) {
printf("BulkWriteException: %s\n", $e->getMessage());

Expand Down
4 changes: 4 additions & 0 deletions tests/manager/manager-executeCommand-003.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,14 @@ echo "is_secondary: ", $cursor->getServer()->isSecondary() ? 'true' : 'false', "
<?php exit(0); ?>
--EXPECTF--
Testing primary:

Deprecated: MongoDB\Driver\Manager::executeCommand(): Passing the "readPreference" option directly is deprecated and will be removed in ext-mongodb 2.0%s
is_primary: true
is_secondary: false

Testing secondary:

Deprecated: MongoDB\Driver\Manager::executeCommand(): Passing the "readPreference" option directly is deprecated and will be removed in ext-mongodb 2.0%s
is_primary: false
is_secondary: true

Expand Down
4 changes: 4 additions & 0 deletions tests/manager/manager-executeQuery-004.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,14 @@ echo "is_secondary: ", $cursor->getServer()->isSecondary() ? 'true' : 'false', "
<?php exit(0); ?>
--EXPECTF--
Testing primary:

Deprecated: MongoDB\Driver\Manager::executeQuery(): Passing the "readPreference" option directly is deprecated and will be removed in ext-mongodb 2.0%s
is_primary: true
is_secondary: false

Testing secondary:

Deprecated: MongoDB\Driver\Manager::executeQuery(): Passing the "readPreference" option directly is deprecated and will be removed in ext-mongodb 2.0%s
is_primary: false
is_secondary: true

Expand Down
2 changes: 1 addition & 1 deletion tests/readPreference/bug0146-001.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ $rps = [

foreach($rps as $r) {
$rp = new MongoDB\Driver\ReadPreference($r);
$cursor = $manager->executeQuery(NS, new MongoDB\Driver\Query(array("my" => "query")), $rp);
$cursor = $manager->executeQuery(NS, new MongoDB\Driver\Query(['my' => 'query']), ['readPreference' => $rp]);
var_dump($cursor);
}

Expand Down
2 changes: 1 addition & 1 deletion tests/replicaset/bug0155.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ $bulk = new MongoDB\Driver\BulkWrite();
$bulk->insert(array('example' => 'document'));

try {
$manager->executeBulkWrite(NS, $bulk, $wc);
$manager->executeBulkWrite(NS, $bulk, ['writeConcern' => $wc]);
} catch(MongoDB\Driver\Exception\BulkWriteException $e) {
var_dump($e->getWriteResult()->getWriteConcernError());
}
Expand Down
2 changes: 1 addition & 1 deletion tests/replicaset/readconcern-001.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ $wc = new MongoDB\Driver\WriteConcern(MongoDB\Driver\WriteConcern::MAJORITY);
$bulk = new MongoDB\Driver\BulkWrite();
$bulk->insert(['_id' => 1, 'x' => 1]);
$bulk->insert(['_id' => 2, 'x' => 2]);
$manager->executeBulkWrite(NS, $bulk, $wc);
$manager->executeBulkWrite(NS, $bulk, ['writeConcern' => $wc]);

$rc = new MongoDB\Driver\ReadConcern(MongoDB\Driver\ReadConcern::LOCAL);
$query = new MongoDB\Driver\Query(['x' => 2], ['readConcern' => $rc]);
Expand Down
2 changes: 1 addition & 1 deletion tests/replicaset/writeconcernerror-001.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ $bulk->insert(array("my" => "value"));

$w = new MongoDB\Driver\WriteConcern(30, 100);
try {
$retval = $manager->executeBulkWrite(NS, $bulk, $w);
$retval = $manager->executeBulkWrite(NS, $bulk, ['writeConcern' => $w]);
} catch(MongoDB\Driver\Exception\BulkWriteException $e) {
$server = $e->getWriteResult()->getServer();
$server->getPort();
Expand Down
Loading
Loading