Page MenuHomePhabricator (Chris)

No OneTemporary

Authored By
Unknown
Size
1 MB
Referenced Files
None
Subscribers
None
This file is larger than 256 KB, so syntax highlighting was skipped.
diff --git a/mongodb-1.2.3/src/libbson/VERSION_CURRENT b/mongodb-1.2.3/src/libbson/VERSION_CURRENT
deleted file mode 100644
index 1d5e9e0b..00000000
--- a/mongodb-1.2.3/src/libbson/VERSION_CURRENT
+++ /dev/null
@@ -1 +0,0 @@
-1.5.3
\ No newline at end of file
diff --git a/mongodb-1.2.3/src/libbson/VERSION_RELEASED b/mongodb-1.2.3/src/libbson/VERSION_RELEASED
deleted file mode 100644
index 1d5e9e0b..00000000
--- a/mongodb-1.2.3/src/libbson/VERSION_RELEASED
+++ /dev/null
@@ -1 +0,0 @@
-1.5.3
\ No newline at end of file
diff --git a/mongodb-1.2.3/src/libmongoc/VERSION_CURRENT b/mongodb-1.2.3/src/libmongoc/VERSION_CURRENT
deleted file mode 100644
index 1d5e9e0b..00000000
--- a/mongodb-1.2.3/src/libmongoc/VERSION_CURRENT
+++ /dev/null
@@ -1 +0,0 @@
-1.5.3
\ No newline at end of file
diff --git a/mongodb-1.2.3/src/libmongoc/VERSION_RELEASED b/mongodb-1.2.3/src/libmongoc/VERSION_RELEASED
deleted file mode 100644
index 1d5e9e0b..00000000
--- a/mongodb-1.2.3/src/libmongoc/VERSION_RELEASED
+++ /dev/null
@@ -1 +0,0 @@
-1.5.3
\ No newline at end of file
diff --git a/mongodb-1.2.3/tests/functional/phpinfo-1.phpt b/mongodb-1.2.3/tests/functional/phpinfo-1.phpt
deleted file mode 100644
index 045c5404..00000000
--- a/mongodb-1.2.3/tests/functional/phpinfo-1.phpt
+++ /dev/null
@@ -1,35 +0,0 @@
---TEST--
-phpinfo()
---SKIPIF--
-<?php if (defined("HHVM_VERSION_ID")) exit("skip HHVM does not do phpinfo() this way"); ?>
-<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
---FILE--
-<?php
-require_once __DIR__ . "/../utils/basic.inc";
-
-phpinfo();
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECTF--
-%a
-mongodb
-
-MongoDB support => enabled
-MongoDB extension version => 1.%d.%d%S
-MongoDB extension stability => %s
-libbson bundled version => 1.%d.%d%S
-libmongoc bundled version => 1.%d.%d%S
-libmongoc SSL => enabled
-libmongoc SSL library => %s
-libmongoc crypto => enabled
-libmongoc crypto library => %s
-libmongoc crypto system profile => %s
-libmongoc SASL => enabled
-
-Directive => Local Value => Master Value
-mongodb.debug => no value => no value
-
-%a
-===DONE===
diff --git a/mongodb-1.2.3/tests/functional/phpinfo-2.phpt b/mongodb-1.2.3/tests/functional/phpinfo-2.phpt
deleted file mode 100644
index 91b32365..00000000
--- a/mongodb-1.2.3/tests/functional/phpinfo-2.phpt
+++ /dev/null
@@ -1,38 +0,0 @@
---TEST--
-phpinfo()
---INI--
-mongodb.debug=stderr
---SKIPIF--
-<?php if (defined("HHVM_VERSION_ID")) exit("skip HHVM does not do phpinfo() this way"); ?>
-<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
---FILE--
-<?php
-require_once __DIR__ . "/../utils/basic.inc";
-
-ini_set("mongodb.debug", "stdout");
-phpinfo();
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECTF--
-%a
-mongodb
-
-MongoDB support => enabled
-MongoDB extension version => 1.%d.%d%S
-MongoDB extension stability => %s
-libbson bundled version => 1.%d.%d%S
-libmongoc bundled version => 1.%d.%d%S
-libmongoc SSL => enabled
-libmongoc SSL library => %s
-libmongoc crypto => enabled
-libmongoc crypto library => %s
-libmongoc crypto system profile => %s
-libmongoc SASL => enabled
-
-Directive => Local Value => Master Value
-mongodb.debug => stdout => stderr
-
-%a
-===DONE===
diff --git a/mongodb-1.2.3/tests/manager/manager-debug-001.phpt b/mongodb-1.2.3/tests/manager/manager-debug-001.phpt
deleted file mode 100644
index dc34bb64..00000000
--- a/mongodb-1.2.3/tests/manager/manager-debug-001.phpt
+++ /dev/null
@@ -1,39 +0,0 @@
---TEST--
-MongoDB\Driver\Manager: Writing debug log files
---SKIPIF--
-<?php if (defined("HHVM_VERSION_ID")) exit("skip HHVM uses HHVM's logging functionality"); ?>
-<?php require __DIR__ . "/../utils/basic-skipif.inc"; CLEANUP(STANDALONE) ?>
---FILE--
-<?php
-require_once __DIR__ . "/../utils/basic.inc";
-
-$name = tempnam(sys_get_temp_dir(), "PHONGO");
-unlink($name);
-mkdir($name);
-ini_set('mongodb.debug', $name);
-$manager = new MongoDB\Driver\Manager(STANDALONE);
-$bulk = new MongoDB\Driver\BulkWrite();
-$bulk->insert(array('_id' => 1, 'x' => 1));
-$result = $manager->executeBulkWrite(NS, $bulk);
-ini_set('mongodb.debug', 'off');
-foreach(glob($name."/*") as $file);
-$content = file($file);
-unlink($file);
-rmdir($name);
-
-echo $content[0], $content[1];
-foreach($content as $line) {
- if (strpos($line, "mongoc_bulk_operation_execute")) {
- echo $line;
- }
-}
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECTF--
-[%s] PHONGO: DEBUG > Connection string: '%s'
-[%s] PHONGO: DEBUG > Creating Manager, phongo-1.%d.%d%S[%s] - mongoc-1.%s(%s), libbson-1.%s(%s), php-%s
-[%s] mongoc: TRACE > ENTRY: mongoc_bulk_operation_execute():%d
-[%s] mongoc: TRACE > EXIT: mongoc_bulk_operation_execute():%d
-===DONE===
diff --git a/mongodb-1.2.3/tests/manager/manager-executeBulkWrite_error-005.phpt b/mongodb-1.2.3/tests/manager/manager-executeBulkWrite_error-005.phpt
deleted file mode 100644
index 81c965aa..00000000
--- a/mongodb-1.2.3/tests/manager/manager-executeBulkWrite_error-005.phpt
+++ /dev/null
@@ -1,48 +0,0 @@
---TEST--
-MongoDB\Driver\Manager::executeBulkWrite() insert write error
---SKIPIF--
-<?php require __DIR__ . "/../utils/basic-skipif.inc"; CLEANUP(STANDALONE) ?>
---FILE--
-<?php
-require_once __DIR__ . "/../utils/basic.inc";
-
-$manager = new MongoDB\Driver\Manager(STANDALONE);
-
-$bulk = new MongoDB\Driver\BulkWrite();
-$bulk->insert(['$foo' => 1]);
-
-try {
- $manager->executeBulkWrite(NS, $bulk);
-} catch (MongoDB\Driver\Exception\BulkWriteException $e) {
- printf("BulkWriteException: %s\n", $e->getMessage());
-
- echo "\n===> WriteResult\n";
- printWriteResult($e->getWriteResult());
-}
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECTF--
-BulkWriteException: Document can't have $ prefixed field names: $foo
-
-===> WriteResult
-server: %s:%d
-insertedCount: 0
-matchedCount: 0
-modifiedCount: 0
-upsertedCount: 0
-deletedCount: 0
-object(MongoDB\Driver\WriteError)#%d (%d) {
- ["message"]=>
- string(48) "Document can't have $ prefixed field names: $foo"
- ["code"]=>
- int(2)
- ["index"]=>
- int(0)
- ["info"]=>
- NULL
-}
-writeError[0].message: Document can't have $ prefixed field names: $foo
-writeError[0].code: 2
-===DONE===
diff --git a/mongodb-1.2.3/tests/manager/manager-executequery-without-assignment.phpt b/mongodb-1.2.3/tests/manager/manager-executequery-without-assignment.phpt
deleted file mode 100644
index cf1172b0..00000000
--- a/mongodb-1.2.3/tests/manager/manager-executequery-without-assignment.phpt
+++ /dev/null
@@ -1,29 +0,0 @@
---TEST--
-MongoDB\Driver\Manager: Executing Query without assignment still executes
---SKIPIF--
-<?php if (defined("HHVM_VERSION_ID")) exit("skip HHVM uses HHVM's logging functionality"); ?>
-<?php require __DIR__ . "/../utils/basic-skipif.inc"; CLEANUP(STANDALONE) ?>
---FILE--
-<?php
-require_once __DIR__ . "/../utils/basic.inc";
-
-$manager = new MongoDB\Driver\Manager(STANDALONE);
-
-$bulk = new MongoDB\Driver\BulkWrite();
-$bulk->insert(array('_id' => 1, 'x' => 1));
-$bulk->insert(array('_id' => 2, 'x' => 1));
-$manager->executeBulkWrite(NS, $bulk);
-
-ini_set("mongodb.debug", "stdout");
-$manager->executeQuery(NS, new MongoDB\Driver\Query(array("x" => 1)));
-ini_set("mongodb.debug", "off");
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECTF--
-%a
-[%s] cursor: TRACE > ENTRY: mongoc_cursor_next():%d
-%a
-[%s] cursor: TRACE > EXIT: mongoc_cursor_destroy():%d
-===DONE===
diff --git a/mongodb-1.2.3/tests/standalone/bug0487-001.phpt b/mongodb-1.2.3/tests/standalone/bug0487-001.phpt
deleted file mode 100644
index a0862658..00000000
--- a/mongodb-1.2.3/tests/standalone/bug0487-001.phpt
+++ /dev/null
@@ -1,29 +0,0 @@
---TEST--
-PHPC-487: check_closed stream handler should not report open socket as closed
---SKIPIF--
-<?php require __DIR__ . "/../utils/basic-skipif.inc"; SLOW(); ?>
---FILE--
-<?php
-require_once __DIR__ . "/../utils/basic.inc";
-
-$m = new MongoDB\Driver\Manager(STANDALONE);
-
-$bulk = new MongoDB\Driver\BulkWrite;
-$bulk->insert(['x' => 1]);
-$wr = $m->executeBulkWrite(NS, $bulk);
-var_dump($wr->getInsertedCount());
-
-sleep(1);
-
-$bulk = new MongoDB\Driver\BulkWrite;
-$bulk->insert(['x' => 1]);
-$wr = $m->executeBulkWrite(NS, $bulk);
-var_dump($wr->getInsertedCount());
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-int(1)
-int(1)
-===DONE===
diff --git a/mongodb-1.2.3/tests/standalone/bug0487-002.phpt b/mongodb-1.2.3/tests/standalone/bug0487-002.phpt
deleted file mode 100644
index 8fd3eabc..00000000
--- a/mongodb-1.2.3/tests/standalone/bug0487-002.phpt
+++ /dev/null
@@ -1,92 +0,0 @@
---TEST--
-PHPC-487: Stream handler should report closed socket as closed
---SKIPIF--
-<?php require __DIR__ . "/../utils/basic-skipif.inc"; SLOW(); ?>
---FILE--
-<?php
-require_once __DIR__ . "/../utils/basic.inc";
-
-function mo_delete($id) {
- $url = getMOUri() . $id;
-
- $opts = array("http" =>
- array(
- "method" => "DELETE",
- "timeout" => 60,
- "header" => "Accept: application/json\r\n" .
- "Content-type: application/x-www-form-urlencoded",
- "ignore_errors" => true,
- ),
- );
-
- $context = stream_context_create($opts);
- $out = file_get_contents($url, false, $context);
-}
-
-function mo_post($url, $body) {
- global $KILLLIST;
-
- $url = getMOUri() . $url;
-
- $opts = array("http" =>
- array(
- "method" => "POST",
- "timeout" => 60,
- "header" => "Accept: application/json\r\n" .
- "Content-type: application/x-www-form-urlencoded",
- "content" => json_encode($body),
- "ignore_errors" => true,
- ),
- );
-
- $context = stream_context_create($opts);
- $out = file_get_contents($url, false, $context);
- $array = json_decode($out, true);
- if ($array && !empty($array["mongodb_uri"])) {
- $KILLLIST[] = $array["id"];
- return $array["mongodb_uri"];
- }
-}
-$KILLLIST = array();
-
-$dsn = mo_post("/servers", [
- 'id' => 'serverA',
- 'name' => 'mongod',
-]);
-
-$m = new MongoDB\Driver\Manager($dsn);
-
-$bulk = new MongoDB\Driver\BulkWrite;
-$bulk->insert(['x' => 1]);
-$wr = $m->executeBulkWrite(NS, $bulk);
-var_dump($wr->getInsertedCount());
-
-mo_post("/servers/serverA", ['action' => 'stop']);
-
-echo throws(function() use ($m) {
- $bulk = new MongoDB\Driver\BulkWrite;
- $bulk->insert(['x' => 1]);
- $wr = $m->executeBulkWrite(NS, $bulk);
- var_dump($wr->getInsertedCount());
-}, 'MongoDB\Driver\Exception\RuntimeException'), "\n";
-
-mo_post("/servers/serverA", ['action' => 'restart']);
-
-$bulk = new MongoDB\Driver\BulkWrite;
-$bulk->insert(['x' => 1]);
-$wr = $m->executeBulkWrite(NS, $bulk);
-var_dump($wr->getInsertedCount());
-
-foreach($KILLLIST as $id) {
- mo_delete("/servers/$id");
-}
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECTF--
-int(1)
-OK: Got MongoDB\Driver\Exception\RuntimeException
-Failed to send "insert" command with database "phongo": socket error or timeout
-int(1)
-===DONE===
diff --git a/mongodb-1.2.3/CREDITS b/mongodb-1.2.8/CREDITS
similarity index 100%
rename from mongodb-1.2.3/CREDITS
rename to mongodb-1.2.8/CREDITS
diff --git a/mongodb-1.2.3/LICENSE b/mongodb-1.2.8/LICENSE
similarity index 100%
rename from mongodb-1.2.3/LICENSE
rename to mongodb-1.2.8/LICENSE
diff --git a/mongodb-1.2.3/Makefile.frag b/mongodb-1.2.8/Makefile.frag
similarity index 100%
rename from mongodb-1.2.3/Makefile.frag
rename to mongodb-1.2.8/Makefile.frag
diff --git a/mongodb-1.2.3/README.md b/mongodb-1.2.8/README.md
similarity index 100%
rename from mongodb-1.2.3/README.md
rename to mongodb-1.2.8/README.md
diff --git a/mongodb-1.2.3/Vagrantfile b/mongodb-1.2.8/Vagrantfile
similarity index 100%
rename from mongodb-1.2.3/Vagrantfile
rename to mongodb-1.2.8/Vagrantfile
diff --git a/mongodb-1.2.3/config.m4 b/mongodb-1.2.8/config.m4
similarity index 70%
rename from mongodb-1.2.3/config.m4
rename to mongodb-1.2.8/config.m4
index f6b2c808..9da76aa9 100644
--- a/mongodb-1.2.3/config.m4
+++ b/mongodb-1.2.8/config.m4
@@ -1,618 +1,472 @@
dnl config.m4 for extension mongodb
PHP_ARG_ENABLE(mongodb, whether to enable mongodb support,
[ --enable-mongodb Enable mongodb support])
PHP_ARG_WITH(openssl-dir, OpenSSL dir for mongodb,
[ --with-openssl-dir[=DIR] openssl install prefix], yes, no)
PHP_ARG_WITH(system-ciphers, whether to use system default cipher list instead of hardcoded value,
[ --with-system-ciphers OPENSSL: Use system default cipher list instead of hardcoded value], no, no)
dnl borrowed from libmongoc configure.ac
# AS_VAR_COPY is available in AC 2.64 and on, but we only require 2.60.
# If we're on an older version, we define it ourselves:
m4_ifndef([AS_VAR_COPY],
[m4_define([AS_VAR_COPY],
[AS_LITERAL_IF([$1[]$2], [$1=$$2], [eval $1=\$$2])])])
# Get "user-set cflags" here, before we've added the flags we use by default
AS_VAR_COPY(MONGOC_USER_SET_CFLAGS, [CFLAGS])
AC_SUBST(MONGOC_USER_SET_CFLAGS)
AS_VAR_COPY(MONGOC_USER_SET_LDFLAGS, [LDFLAGS])
AC_SUBST(MONGOC_USER_SET_LDFLAGS)
AS_VAR_COPY(MONGOC_CC, [CC])
AC_SUBST(MONGOC_CC)
dnl borrowed from PHP acinclude.m4
AC_DEFUN([PHP_BSON_BIGENDIAN],
[AC_CACHE_CHECK([whether byte ordering is bigendian], ac_cv_c_bigendian_php,
[
ac_cv_c_bigendian_php=unknown
AC_TRY_RUN(
[
int main(void)
{
short one = 1;
char *cp = (char *)&one;
if (*cp == 0) {
return(0);
} else {
return(1);
}
}
], [ac_cv_c_bigendian_php=yes], [ac_cv_c_bigendian_php=no], [ac_cv_c_bigendian_php=unknown])
])
if test $ac_cv_c_bigendian_php = yes; then
AC_SUBST(BSON_BYTE_ORDER, 4321)
else
AC_SUBST(BSON_BYTE_ORDER, 1234)
fi
])
dnl Borrowed from sapi/fpm/config.m4
AC_DEFUN([PHP_BSON_CLOCK],
[
have_clock_gettime=no
AC_MSG_CHECKING([for clock_gettime])
AC_TRY_LINK([ #include <time.h> ], [struct timespec ts; clock_gettime(CLOCK_MONOTONIC, &ts);], [
have_clock_gettime=yes
AC_MSG_RESULT([yes])
], [
AC_MSG_RESULT([no])
])
if test "$have_clock_gettime" = "no"; then
AC_MSG_CHECKING([for clock_gettime in -lrt])
SAVED_LIBS="$LIBS"
LIBS="$LIBS -lrt"
AC_TRY_LINK([ #include <time.h> ], [struct timespec ts; clock_gettime(CLOCK_MONOTONIC, &ts);], [
have_clock_gettime=yes
AC_MSG_RESULT([yes])
], [
LIBS="$SAVED_LIBS"
AC_MSG_RESULT([no])
])
fi
if test "$have_clock_gettime" = "yes"; then
AC_SUBST(BSON_HAVE_CLOCK_GETTIME, 1)
fi
])
-MONGOC_SYMBOL_SUFFIX="priv"
-
AC_MSG_CHECKING(PHP version)
PHP_FOUND_VERSION=`${PHP_CONFIG} --version`
PHP_FOUND_VERNUM=`echo "${PHP_FOUND_VERSION}" | $AWK 'BEGIN { FS = "."; } { printf "%d", ([$]1 * 100 + [$]2) * 100 + [$]3;}'`
AC_MSG_RESULT($PHP_FOUND_VERNUM)
if test "$MONGODB" != "no"; then
PHP_ARG_ENABLE(developer-flags, whether to enable developer build flags,
[ --enable-developer-flags Enable developer flags],, no)
if test "$PHP_DEVELOPER_FLAGS" = "yes"; then
dnl Warn about functions which might be candidates for format attributes
PHP_CHECK_GCC_ARG(-Wmissing-format-attribute, _MAINTAINER_CFLAGS="$_MAINTAINER_CFLAGS -Wmissing-format-attribute")
dnl Avoid duplicating values for an enum
PHP_CHECK_GCC_ARG(-Wduplicate-enum, _MAINTAINER_CFLAGS="$_MAINTAINER_CFLAGS -Wduplicate-enum")
dnl Warns on mismatches between #ifndef and #define header guards
PHP_CHECK_GCC_ARG(-Wheader-guard, _MAINTAINER_CFLAGS="$_MAINTAINER_CFLAGS -Wheader-guard")
dnl logical not of a non-boolean expression
PHP_CHECK_GCC_ARG(-Wlogical-not-parentheses, _MAINTAINER_CFLAGS="$_MAINTAINER_CFLAGS -Wlogical-not-parentheses")
dnl Warn about suspicious uses of logical operators in expressions
PHP_CHECK_GCC_ARG(-Wlogical-op, _MAINTAINER_CFLAGS="$_MAINTAINER_CFLAGS -Wlogical-op")
dnl memory error detector.
dnl FIXME: -fsanitize=address,undefined for clang. The PHP_CHECK_GCC_ARG macro isn't happy about that string :(
PHP_CHECK_GCC_ARG(-fsanitize-address, _MAINTAINER_CFLAGS="$_MAINTAINER_CFLAGS -fsanitize-address")
dnl Enable frame debugging
PHP_CHECK_GCC_ARG(-fno-omit-frame-pointer, _MAINTAINER_CFLAGS="$_MAINTAINER_CFLAGS -fno-omit-frame-pointer")
dnl Make sure we don't optimize calls
PHP_CHECK_GCC_ARG(-fno-optimize-sibling-calls, _MAINTAINER_CFLAGS="$_MAINTAINER_CFLAGS -fno-optimize-sibling-calls")
PHP_CHECK_GCC_ARG(-Wlogical-op-parentheses, _MAINTAINER_CFLAGS="$_MAINTAINER_CFLAGS -Wlogical-op-parentheses")
PHP_CHECK_GCC_ARG(-Wbool-conversion, _MAINTAINER_CFLAGS="$_MAINTAINER_CFLAGS -Wbool-conversion")
PHP_CHECK_GCC_ARG(-Wloop-analysis, _MAINTAINER_CFLAGS="$_MAINTAINER_CFLAGS -Wloop-analysis")
PHP_CHECK_GCC_ARG(-Wsizeof-array-argument, _MAINTAINER_CFLAGS="$_MAINTAINER_CFLAGS -Wsizeof-array-argument")
PHP_CHECK_GCC_ARG(-Wstring-conversion, _MAINTAINER_CFLAGS="$_MAINTAINER_CFLAGS -Wstring-conversion")
PHP_CHECK_GCC_ARG(-Wno-variadic-macros, _MAINTAINER_CFLAGS="$_MAINTAINER_CFLAGS -Wno-variadic-macros")
PHP_CHECK_GCC_ARG(-Wno-sign-compare, _MAINTAINER_CFLAGS="$_MAINTAINER_CFLAGS -Wno-sign-compare")
PHP_CHECK_GCC_ARG(-fstack-protector, _MAINTAINER_CFLAGS="$_MAINTAINER_CFLAGS -fstack-protector")
PHP_CHECK_GCC_ARG(-fno-exceptions, _MAINTAINER_CFLAGS="$_MAINTAINER_CFLAGS -fno-exceptions")
PHP_CHECK_GCC_ARG(-Wformat-security, _MAINTAINER_CFLAGS="$_MAINTAINER_CFLAGS -Wformat-security")
PHP_CHECK_GCC_ARG(-Wformat-nonliteral, _MAINTAINER_CFLAGS="$_MAINTAINER_CFLAGS -Wformat-nonliteral")
PHP_CHECK_GCC_ARG(-Winit-self, _MAINTAINER_CFLAGS="$_MAINTAINER_CFLAGS -Winit-self")
PHP_CHECK_GCC_ARG(-Wwrite-strings, _MAINTAINER_CFLAGS="$_MAINTAINER_CFLAGS -Wwrite-strings")
PHP_CHECK_GCC_ARG(-Wenum-compare, _MAINTAINER_CFLAGS="$_MAINTAINER_CFLAGS -Wenum-compare")
PHP_CHECK_GCC_ARG(-Wempty-body, _MAINTAINER_CFLAGS="$_MAINTAINER_CFLAGS -Wempty-body")
PHP_CHECK_GCC_ARG(-Wparentheses, _MAINTAINER_CFLAGS="$_MAINTAINER_CFLAGS -Wparentheses")
PHP_CHECK_GCC_ARG(-Wdeclaration-after-statement, _MAINTAINER_CFLAGS="$_MAINTAINER_CFLAGS -Wdeclaration-after-statement")
+ PHP_CHECK_GCC_ARG(-Werror, _MAINTAINER_CFLAGS="$_MAINTAINER_CFLAGS -Werror")
+ PHP_CHECK_GCC_ARG(-Wextra, _MAINTAINER_CFLAGS="$_MAINTAINER_CFLAGS -Wextra")
+ PHP_CHECK_GCC_ARG(-Wno-unused-parameter, _MAINTAINER_CFLAGS="$_MAINTAINER_CFLAGS -Wno-unused-parameter")
+ PHP_CHECK_GCC_ARG(-Wno-unused-but-set-variable, _MAINTAINER_CFLAGS="$_MAINTAINER_CFLAGS -Wno-unused-but-set-variable")
+ PHP_CHECK_GCC_ARG(-Wno-missing-field-initializers, _MAINTAINER_CFLAGS="$_MAINTAINER_CFLAGS -Wno-missing-field-initializers")
- if test "$PHP_FOUND_VERNUM" -ge "50400"; then
- PHP_CHECK_GCC_ARG(-Werror, _MAINTAINER_CFLAGS="$_MAINTAINER_CFLAGS -Werror")
- fi
-
- MAINTAINER_CFLAGS="-Wextra $_MAINTAINER_CFLAGS -Wno-unused-parameter -Wno-unused-but-set-variable -Wno-missing-field-initializers"
+ MAINTAINER_CFLAGS="$_MAINTAINER_CFLAGS"
STD_CFLAGS="-g -O0 -Wall"
fi
PHP_ARG_ENABLE(coverage, whether to enable code coverage,
[ --enable-coverage Enable developer code coverage information],, no)
if test "$PHP_COVERAGE" = "yes"; then
PHP_CHECK_GCC_ARG(-fprofile-arcs, COVERAGE_CFLAGS="$COVERAGE_CFLAGS -fprofile-arcs")
PHP_CHECK_GCC_ARG(-ftest-coverage, COVERAGE_CFLAGS="$COVERAGE_CFLAGS -ftest-coverage")
EXTRA_LDFLAGS="$COVERAGE_CFLAGS"
fi
- MONGODB_BSON="\
- src/bson.c \
- ";
+ PHP_MONGODB_CFLAGS="$STD_CFLAGS $MAINTAINER_CFLAGS $COVERAGE_CFLAGS"
- MONGODB_BSON_CLASSES="\
- src/BSON/Type.c \
- src/BSON/Unserializable.c \
- src/BSON/Serializable.c \
- src/BSON/Persistable.c \
+ PHP_MONGODB_SOURCES="\
+ php_phongo.c \
+ phongo_compat.c \
+ src/bson.c \
src/BSON/Binary.c \
src/BSON/Decimal128.c \
src/BSON/Javascript.c \
src/BSON/MaxKey.c \
src/BSON/MinKey.c \
src/BSON/ObjectID.c \
+ src/BSON/Persistable.c \
src/BSON/Regex.c \
+ src/BSON/Serializable.c \
src/BSON/Timestamp.c \
+ src/BSON/Type.c \
+ src/BSON/Unserializable.c \
src/BSON/UTCDateTime.c \
- ";
- MONGODB_ROOT="\
- php_phongo.c \
- phongo_compat.c \
- ";
- MONGODB_MONGODB_CLASSES="\
- src/MongoDB/Command.c \
- src/MongoDB/Cursor.c \
- src/MongoDB/CursorId.c \
- src/MongoDB/Manager.c \
- src/MongoDB/Query.c \
- src/MongoDB/ReadConcern.c \
- src/MongoDB/ReadPreference.c \
- src/MongoDB/Server.c \
- src/MongoDB/BulkWrite.c \
- src/MongoDB/WriteConcern.c \
- src/MongoDB/WriteConcernError.c \
- src/MongoDB/WriteError.c \
- src/MongoDB/WriteResult.c \
- ";
- MONGODB_MONGODB_EXCEPTIONS="\
- src/MongoDB/Exception/Exception.c \
- src/MongoDB/Exception/LogicException.c \
- src/MongoDB/Exception/RuntimeException.c \
- src/MongoDB/Exception/UnexpectedValueException.c \
- src/MongoDB/Exception/InvalidArgumentException.c \
- src/MongoDB/Exception/ConnectionException.c \
- src/MongoDB/Exception/AuthenticationException.c \
- src/MongoDB/Exception/SSLConnectionException.c \
- src/MongoDB/Exception/ExecutionTimeoutException.c \
- src/MongoDB/Exception/ConnectionTimeoutException.c \
- src/MongoDB/Exception/WriteException.c \
- src/MongoDB/Exception/BulkWriteException.c \
- ";
-
- YAJL_SOURCES="\
- yajl_version.c \
- yajl.c \
- yajl_encode.c \
- yajl_lex.c \
- yajl_parser.c \
- yajl_buf.c \
- yajl_tree.c \
- yajl_alloc.c \
- yajl_gen.c
- ";
-
- BSON_SOURCES="\
- bcon.c \
- bson.c \
- bson-atomic.c \
- bson-clock.c \
- bson-context.c \
- bson-decimal128.c \
- bson-error.c \
- bson-iter.c \
- bson-iso8601.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
- ";
-
- MONGOC_SOURCES="\
- mongoc-apm.c \
- mongoc-array.c \
- mongoc-async.c \
- mongoc-async-cmd.c \
- mongoc-buffer.c \
- mongoc-bulk-operation.c \
- mongoc-b64.c \
- mongoc-client.c \
- mongoc-client-pool.c \
- mongoc-cluster.c \
- mongoc-collection.c \
- mongoc-counters.c \
- mongoc-cursor.c \
- mongoc-cursor-array.c \
- mongoc-cursor-cursorid.c \
- mongoc-cursor-transform.c \
- mongoc-database.c \
- mongoc-find-and-modify.c \
- mongoc-host-list.c \
- mongoc-init.c \
- mongoc-gridfs.c \
- mongoc-gridfs-file.c \
- mongoc-gridfs-file-page.c \
- mongoc-gridfs-file-list.c \
- mongoc-handshake.c \
- mongoc-index.c \
- mongoc-linux-distro-scanner.c \
- mongoc-list.c \
- mongoc-log.c \
- mongoc-matcher-op.c \
- mongoc-matcher.c \
- mongoc-memcmp.c \
- mongoc-opcode.c \
- mongoc-queue.c \
- mongoc-read-concern.c \
- mongoc-read-prefs.c \
- mongoc-rpc.c \
- mongoc-server-description.c \
- mongoc-server-stream.c \
- mongoc-set.c \
- mongoc-socket.c \
- mongoc-stream.c \
- mongoc-stream-buffered.c \
- mongoc-stream-file.c \
- mongoc-stream-gridfs.c \
- mongoc-stream-socket.c \
- mongoc-topology.c \
- mongoc-topology-description.c \
- mongoc-topology-description-apm.c \
- mongoc-topology-scanner.c \
- mongoc-uri.c \
- mongoc-util.c \
- mongoc-version-functions.c \
- mongoc-write-command.c \
- mongoc-write-concern.c
- ";
-
- MONGOC_SOURCES_CRYPTO="\
- mongoc-crypto.c \
- mongoc-scram.c
- ";
-
- MONGOC_SOURCES_SSL="\
- mongoc-stream-tls.c \
- mongoc-ssl.c
- ";
-
- MONGOC_SOURCES_OPENSSL="\
- mongoc-crypto-openssl.c \
- mongoc-openssl.c \
- mongoc-rand-openssl.c \
- mongoc-stream-tls-openssl.c \
- mongoc-stream-tls-openssl-bio.c
- ";
-
- MONGOC_SOURCES_SECURE_TRANSPORT="\
- mongoc-crypto-common-crypto.c \
- mongoc-rand-common-crypto.c \
- mongoc-secure-transport.c \
- mongoc-stream-tls-secure-transport.c
- ";
-
- MONGOC_SOURCES_SECURE_CHANNEL="\
- mongoc-crypto-cng.c \
- mongoc-rand-cng.c \
- mongoc-secure-channel.c \
- mongoc-stream-tls-secure-channel.c
- ";
-
- MONGOC_SOURCES_SASL=mongoc-sasl.c
-
- if test "$ext_shared" = "no"; then
- PHP_ADD_SOURCES(PHP_EXT_DIR(mongodb), $MONGODB_BSON)
- PHP_ADD_SOURCES(PHP_EXT_DIR(mongodb), $MONGODB_BSON_CLASSES)
- PHP_ADD_SOURCES(PHP_EXT_DIR(mongodb), $MONGODB_MONGODB_CLASSES)
- PHP_ADD_SOURCES(PHP_EXT_DIR(mongodb), $MONGODB_MONGODB_EXCEPTIONS)
- else
- PHP_ADD_SOURCES_X(PHP_EXT_DIR(mongodb), $MONGODB_BSON, [$STD_CFLAGS $MAINTAINER_CFLAGS $COVERAGE_CFLAGS], shared_objects_mongodb, yes)
- PHP_ADD_SOURCES_X(PHP_EXT_DIR(mongodb), $MONGODB_BSON_CLASSES, [$STD_CFLAGS $MAINTAINER_CFLAGS $COVERAGE_CFLAGS], shared_objects_mongodb, yes)
- PHP_ADD_SOURCES_X(PHP_EXT_DIR(mongodb), $MONGODB_MONGODB_CLASSES, [$STD_CFLAGS $MAINTAINER_CFLAGS $COVERAGE_CFLAGS], shared_objects_mongodb, yes)
- PHP_ADD_SOURCES_X(PHP_EXT_DIR(mongodb), $MONGODB_MONGODB_EXCEPTIONS, [$STD_CFLAGS $MAINTAINER_CFLAGS $COVERAGE_CFLAGS], shared_objects_mongodb, yes)
- fi
+ src/MongoDB/BulkWrite.c \
+ src/MongoDB/Command.c \
+ src/MongoDB/Cursor.c \
+ src/MongoDB/CursorId.c \
+ src/MongoDB/Manager.c \
+ src/MongoDB/Query.c \
+ src/MongoDB/ReadConcern.c \
+ src/MongoDB/ReadPreference.c \
+ src/MongoDB/Server.c \
+ src/MongoDB/WriteConcern.c \
+ src/MongoDB/WriteConcernError.c \
+ src/MongoDB/WriteError.c \
+ src/MongoDB/WriteResult.c \
+ src/MongoDB/Exception/AuthenticationException.c \
+ src/MongoDB/Exception/BulkWriteException.c \
+ src/MongoDB/Exception/ConnectionException.c \
+ src/MongoDB/Exception/ConnectionTimeoutException.c \
+ src/MongoDB/Exception/Exception.c \
+ src/MongoDB/Exception/ExecutionTimeoutException.c \
+ src/MongoDB/Exception/InvalidArgumentException.c \
+ src/MongoDB/Exception/LogicException.c \
+ src/MongoDB/Exception/RuntimeException.c \
+ src/MongoDB/Exception/SSLConnectionException.c \
+ src/MongoDB/Exception/UnexpectedValueException.c \
+ src/MongoDB/Exception/WriteException.c \
+ "
PHP_ARG_WITH(libbson, whether to use system libbson,
[ --with-libbson Use system libbson], no, no)
PHP_ARG_WITH(libmongoc, whether to use system libmongoc,
[ --with-libmongoc Use system libmongoc], no, no)
if test "$PHP_LIBBSON" != "no"; then
if test "$PHP_LIBMONGOC" == "no"; then
AC_MSG_ERROR(Cannot use system libbson and bundled libmongoc)
fi
AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
AC_MSG_CHECKING(for libbson)
if test -x "$PKG_CONFIG" && $PKG_CONFIG --exists libbson-1.0; then
if $PKG_CONFIG libbson-1.0 --atleast-version 1.5.0; then
LIBBSON_INC=`$PKG_CONFIG libbson-1.0 --cflags`
LIBBSON_LIB=`$PKG_CONFIG libbson-1.0 --libs`
LIBBSON_VER=`$PKG_CONFIG libbson-1.0 --modversion`
AC_MSG_RESULT(version $LIBBSON_VER found)
else
AC_MSG_ERROR(system libbson must be upgraded to version >= 1.5.0)
fi
else
AC_MSG_ERROR(pkgconfig and libbson must be installed)
fi
PHP_EVAL_INCLINE($LIBBSON_INC)
PHP_EVAL_LIBLINE($LIBBSON_LIB, MONGODB_SHARED_LIBADD)
AC_DEFINE(HAVE_SYSTEM_LIBBSON, 1, [Use system libbson])
else
- LIBBSON_CFLAGS="-DBSON_COMPILATION"
+ PHP_MONGODB_BSON_CFLAGS="$STD_CFLAGS -DBSON_COMPILATION"
+
+ # Generated with: find src/libbson/src/bson -name '*.c' -print0 | cut -sz -d / -f 5- | sort -z | tr '\000' ' '
+ 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"
+
+ # Generated with: find src/libbson/src/yajl -name '*.c' -print0 | cut -sz -d / -f 5- | sort -z | tr '\000' ' '
+ PHP_MONGODB_YAJL_SOURCES="yajl_alloc.c yajl_buf.c yajl.c yajl_encode.c yajl_gen.c yajl_lex.c yajl_parser.c yajl_tree.c yajl_version.c"
- PHP_ADD_SOURCES_X(PHP_EXT_DIR(mongodb)[src/libbson/src/yajl], $YAJL_SOURCES, [$STD_CFLAGS $LIBBSON_CFLAGS], shared_objects_mongodb, yes)
- PHP_ADD_SOURCES_X(PHP_EXT_DIR(mongodb)[src/libbson/src/bson], $BSON_SOURCES, [$STD_CFLAGS $LIBBSON_CFLAGS], shared_objects_mongodb, yes)
+ PHP_ADD_SOURCES_X(PHP_EXT_DIR(mongodb)[src/libbson/src/bson], $PHP_MONGODB_BSON_SOURCES, $PHP_MONGODB_BSON_CFLAGS, shared_objects_mongodb, yes)
+ PHP_ADD_SOURCES_X(PHP_EXT_DIR(mongodb)[src/libbson/src/yajl], $PHP_MONGODB_YAJL_SOURCES, $PHP_MONGODB_BSON_CFLAGS, shared_objects_mongodb, yes)
fi
AC_MSG_CHECKING(configuring libmongoc)
AC_MSG_RESULT(...)
if test "$PHP_LIBMONGOC" != "no"; then
if test "$PHP_LIBBSON" == "no"; then
AC_MSG_ERROR(Cannot use system libmongoc and bundled libbson)
fi
AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
AC_MSG_CHECKING(for libmongoc)
if test -x "$PKG_CONFIG" && $PKG_CONFIG --exists libmongoc-1.0; then
if $PKG_CONFIG libmongoc-1.0 --atleast-version 1.5.0; then
LIBMONGOC_INC=`$PKG_CONFIG libmongoc-1.0 --cflags`
LIBMONGOC_LIB=`$PKG_CONFIG libmongoc-1.0 --libs`
LIBMONGOC_VER=`$PKG_CONFIG libmongoc-1.0 --modversion`
AC_MSG_RESULT(version $LIBMONGOC_VER found)
else
AC_MSG_ERROR(system libmongoc must be upgraded to version >= 1.5.0)
fi
else
AC_MSG_ERROR(pkgconfig and mongoc must be installed)
fi
PHP_EVAL_INCLINE($LIBMONGOC_INC)
PHP_EVAL_LIBLINE($LIBMONGOC_LIB, MONGODB_SHARED_LIBADD)
AC_DEFINE(HAVE_SYSTEM_LIBMONGOC, 1, [Use system libmongoc])
else
- LIBMONGOC_CFLAGS="-DMONGOC_COMPILATION -DMONGOC_TRACE"
+ PHP_MONGODB_MONGOC_CFLAGS="$STD_CFLAGS -DMONGOC_COMPILATION -DMONGOC_TRACE"
- PHP_ADD_SOURCES_X(PHP_EXT_DIR(mongodb)[src/libmongoc/src/mongoc], $MONGOC_SOURCES, [$STD_CFLAGS $LIBMONGOC_CFLAGS], shared_objects_mongodb, yes)
- PHP_ADD_SOURCES_X(PHP_EXT_DIR(mongodb)[src/libmongoc/src/mongoc], $MONGOC_SOURCES_CRYPTO, [$STD_CFLAGS $LIBMONGOC_CFLAGS], shared_objects_mongodb, yes)
- PHP_ADD_SOURCES_X(PHP_EXT_DIR(mongodb)[src/libmongoc/src/mongoc], $MONGOC_SOURCES_SSL, [$STD_CFLAGS $LIBMONGOC_CFLAGS], shared_objects_mongodb, yes)
- PHP_ADD_SOURCES_X(PHP_EXT_DIR(mongodb)[src/libmongoc/src/mongoc], $MONGOC_SOURCES_OPENSSL, [$STD_CFLAGS $LIBMONGOC_CFLAGS], shared_objects_mongodb, yes)
- PHP_ADD_SOURCES_X(PHP_EXT_DIR(mongodb)[src/libmongoc/src/mongoc], $MONGOC_SOURCES_SECURE_TRANSPORT, [$STD_CFLAGS $LIBMONGOC_CFLAGS], shared_objects_mongodb, yes)
- PHP_ADD_SOURCES_X(PHP_EXT_DIR(mongodb)[src/libmongoc/src/mongoc], $MONGOC_SOURCES_SECURE_CHANNEL, [$STD_CFLAGS $LIBMONGOC_CFLAGS], shared_objects_mongodb, yes)
- PHP_ADD_SOURCES_X(PHP_EXT_DIR(mongodb)[src/libmongoc/src/mongoc], $MONGOC_SOURCES_SASL, [$STD_CFLAGS $LIBMONGOC_CFLAGS], shared_objects_mongodb, yes)
+ # Generated with: find src/libmongoc/src/mongoc -name '*.c' -print0 | cut -sz -d / -f 4- | sort -z | tr '\000' ' '
+ PHP_MONGODB_MONGOC_SOURCES="mongoc-apm.c mongoc-array.c mongoc-async.c mongoc-async-cmd.c mongoc-b64.c mongoc-buffer.c mongoc-bulk-operation.c mongoc-client.c mongoc-client-pool.c mongoc-cluster.c mongoc-collection.c mongoc-counters.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-cursorid.c mongoc-cursor-transform.c mongoc-database.c mongoc-find-and-modify.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-index.c mongoc-init.c mongoc-libressl.c mongoc-linux-distro-scanner.c mongoc-list.c mongoc-log.c mongoc-matcher.c mongoc-matcher-op.c mongoc-memcmp.c mongoc-opcode.c mongoc-openssl.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-description.c mongoc-server-stream.c mongoc-set.c mongoc-socket.c mongoc-ssl.c mongoc-stream-buffered.c mongoc-stream.c mongoc-stream-file.c mongoc-stream-gridfs.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-topology.c mongoc-topology-description-apm.c mongoc-topology-description.c mongoc-topology-scanner.c mongoc-uri.c mongoc-util.c mongoc-version-functions.c mongoc-write-command.c mongoc-write-concern.c"
+ PHP_ADD_SOURCES_X(PHP_EXT_DIR(mongodb)[src/libmongoc/src/mongoc], $PHP_MONGODB_MONGOC_SOURCES, $PHP_MONGODB_MONGOC_CFLAGS, shared_objects_mongodb, yes)
PHP_SETUP_OPENSSL(MONGODB_SHARED_LIBADD)
AC_SUBST(MONGOC_ENABLE_CRYPTO, 1)
AC_SUBST(MONGOC_ENABLE_SSL, 1)
AC_SUBST(MONGOC_ENABLE_CRYPTO_LIBCRYPTO, 1)
AC_SUBST(MONGOC_ENABLE_SSL_OPENSSL, 1)
if test "$PHP_SYSTEM_CIPHERS" != "no"; then
AC_SUBST(MONGOC_ENABLE_CRYPTO_SYSTEM_PROFILE, 1)
else
AC_SUBST(MONGOC_ENABLE_CRYPTO_SYSTEM_PROFILE, 0)
fi
dnl TODO: Support building with Secure Transport on OSX
AC_SUBST(MONGOC_ENABLE_SSL_SECURE_TRANSPORT, 0)
AC_SUBST(MONGOC_ENABLE_CRYPTO_COMMON_CRYPTO, 0)
dnl Secure Channel only applies to Windows
AC_SUBST(MONGOC_ENABLE_SSL_SECURE_CHANNEL, 0)
AC_SUBST(MONGOC_ENABLE_CRYPTO_CNG, 0)
AC_SUBST(MONGOC_ENABLE_SSL_LIBRESSL, 0)
AC_SUBST(MONGOC_NO_AUTOMATIC_GLOBALS, 1)
fi
PHP_ARG_WITH(mongodb-sasl, for Cyrus SASL support,
[ --with-mongodb-sasl[=DIR] mongodb: Include Cyrus SASL support], auto, no)
if test "$PHP_MONGODB_SASL" != "no"; then
AC_MSG_CHECKING(for SASL)
for i in $PHP_MONGODB_SASL /usr /usr/local; do
if test -f $i/include/sasl/sasl.h; then
MONGODB_SASL_DIR=$i
AC_MSG_RESULT(found in $i)
break
fi
done
if test -z "$MONGODB_SASL_DIR"; then
AC_MSG_RESULT(not found)
if test "$PHP_MONGODB_SASL" != "auto"; then
AC_MSG_ERROR([sasl.h not found!])
else
AC_SUBST(MONGOC_ENABLE_SASL, 0)
AC_SUBST(MONGOC_HAVE_SASL_CLIENT_DONE, 0)
fi
else
PHP_CHECK_LIBRARY(sasl2, sasl_version,
[
PHP_ADD_INCLUDE($MONGODB_SASL_DIR)
PHP_ADD_LIBRARY_WITH_PATH(sasl2, $MONGODB_SASL_DIR/$PHP_LIBDIR, MONGODB_SHARED_LIBADD)
AC_SUBST(MONGOC_ENABLE_SASL, 1)
], [
if test "$MONGODB_SASL" != "auto"; then
AC_MSG_ERROR([MongoDB SASL check failed. Please check config.log for more information.])
fi
AC_SUBST(MONGOC_ENABLE_SASL, 0)
], [
-L$MONGODB_SASL_DIR/$PHP_LIBDIR
])
PHP_CHECK_LIBRARY(sasl2, sasl_client_done,
[
AC_SUBST(MONGOC_HAVE_SASL_CLIENT_DONE, 1)
], [
AC_SUBST(MONGOC_HAVE_SASL_CLIENT_DONE, 0)
])
fi
else
AC_SUBST(MONGOC_ENABLE_SASL, 0)
AC_SUBST(MONGOC_HAVE_SASL_CLIENT_DONE, 0)
fi
m4_include(src/libmongoc/build/autotools/WeakSymbols.m4)
m4_include(src/libmongoc/build/autotools/m4/ax_pthread.m4)
AX_PTHREAD
AC_CHECK_FUNCS([shm_open], [SHM_LIB=], [AC_CHECK_LIB([rt], [shm_open], [SHM_LIB=-lrt], [SHM_LIB=])])
MONGODB_SHARED_LIBADD="$MONGODB_SHARED_LIBADD $SHM_LIB"
EXTRA_CFLAGS="$PTHREAD_CFLAGS $SASL_CFLAGS"
PHP_SUBST(EXTRA_CFLAGS)
PHP_SUBST(EXTRA_LDFLAGS)
MONGODB_SHARED_LIBADD="$MONGODB_SHARED_LIBADD $PTHREAD_LIBS $SASL_LIBS"
PHP_SUBST(MONGODB_SHARED_LIBADD)
- PHP_NEW_EXTENSION(mongodb, $MONGODB_ROOT, $ext_shared,, [$STD_CFLAGS $MAINTAINER_CFLAGS $COVERAGE_CFLAGS])
+ PHP_NEW_EXTENSION(mongodb, $PHP_MONGODB_SOURCES, $ext_shared,, $PHP_MONGODB_CFLAGS)
PHP_ADD_EXTENSION_DEP(mongodb, date)
PHP_ADD_EXTENSION_DEP(mongodb, json)
PHP_ADD_EXTENSION_DEP(mongodb, spl)
PHP_ADD_EXTENSION_DEP(mongodb, standard)
PHP_ADD_INCLUDE([$ext_srcdir/src/BSON/])
PHP_ADD_INCLUDE([$ext_srcdir/src/MongoDB/])
PHP_ADD_INCLUDE([$ext_srcdir/src/MongoDB/Exception/])
PHP_ADD_INCLUDE([$ext_srcdir/src/contrib/])
PHP_ADD_BUILD_DIR([$ext_builddir/src/BSON/])
PHP_ADD_BUILD_DIR([$ext_builddir/src/MongoDB/])
PHP_ADD_BUILD_DIR([$ext_builddir/src/MongoDB/Exception/])
PHP_ADD_BUILD_DIR([$ext_builddir/src/contrib/])
if test "$PHP_LIBMONGOC" == "no"; then
PHP_ADD_INCLUDE([$ext_srcdir/src/libmongoc/src/mongoc/])
PHP_ADD_BUILD_DIR([$ext_builddir/src/libmongoc/src/mongoc/])
fi
if test "$PHP_LIBBSON" == "no"; then
m4_include(src/libbson/build/autotools/CheckAtomics.m4)
m4_include(src/libbson/build/autotools/FindDependencies.m4)
m4_include(src/libbson/build/autotools/m4/ac_compile_check_sizeof.m4)
m4_include(src/libbson/build/autotools/m4/ac_create_stdint_h.m4)
AC_CREATE_STDINT_H([$srcdir/src/libbson/src/bson/bson-stdint.h])
PHP_ADD_INCLUDE([$ext_srcdir/src/libbson/src/])
PHP_ADD_INCLUDE([$ext_srcdir/src/libbson/src/yajl/])
PHP_ADD_INCLUDE([$ext_srcdir/src/libbson/src/bson/])
PHP_ADD_BUILD_DIR([$ext_builddir/src/libbson/src/])
PHP_ADD_BUILD_DIR([$ext_builddir/src/libbson/src/yajl/])
PHP_ADD_BUILD_DIR([$ext_builddir/src/libbson/src/bson/])
fi
PHP_BSON_BIGENDIAN
AC_HEADER_STDBOOL
AC_SUBST(BSON_EXTRA_ALIGN, 0)
AC_SUBST(BSON_HAVE_DECIMAL128, 0)
if test "$ac_cv_header_stdbool_h" = "yes"; then
AC_SUBST(BSON_HAVE_STDBOOL_H, 1)
else
AC_SUBST(BSON_HAVE_STDBOOL_H, 0)
fi
AC_SUBST(BSON_OS, 1)
PHP_BSON_CLOCK
AC_CHECK_FUNC(strnlen,ac_cv_func_strnlen=yes,ac_cv_func_strnlen=no)
if test "$ac_cv_func_strnlen" = "yes"; then
AC_SUBST(BSON_HAVE_STRNLEN, 1)
else
AC_SUBST(BSON_HAVE_STRNLEN, 0)
fi
AC_CHECK_FUNC(snprintf,ac_cv_func_snprintf=yes,ac_cv_func_snprintf=no)
if test "$ac_cv_func_snprintf" = "yes"; then
AC_SUBST(BSON_HAVE_SNPRINTF, 1)
else
AC_SUBST(BSON_HAVE_SNPRINTF, 0)
fi
if test "$PHP_LIBMONGOC" == "no"; then
backup_srcdir=${srcdir}
srcdir=${srcdir}/src/libmongoc/
m4_include(src/libmongoc/build/autotools/Versions.m4)
srcdir=${backup_srcdir}
MONGOC_API_VERSION=1.0
AC_SUBST(MONGOC_MAJOR_VERSION)
AC_SUBST(MONGOC_MINOR_VERSION)
AC_SUBST(MONGOC_MICRO_VERSION)
AC_SUBST(MONGOC_API_VERSION)
AC_SUBST(MONGOC_VERSION)
AC_OUTPUT($srcdir/src/libmongoc/src/mongoc/mongoc-config.h)
AC_OUTPUT($srcdir/src/libmongoc/src/mongoc/mongoc-version.h)
fi
if test "$PHP_LIBBSON" == "no"; then
backup_srcdir=${srcdir}
srcdir=${srcdir}/src/libbson/
m4_include(src/libbson/build/autotools/Versions.m4)
srcdir=${backup_srcdir}
BSON_API_VERSION=1.0
AC_SUBST(BSON_MAJOR_VERSION)
AC_SUBST(BSON_MINOR_VERSION)
AC_SUBST(BSON_MICRO_VERSION)
AC_SUBST(BSON_API_VERSION)
AC_SUBST(BSON_VERSION)
AC_OUTPUT($srcdir/src/libbson/src/bson/bson-config.h)
AC_OUTPUT($srcdir/src/libbson/src/bson/bson-version.h)
fi
dnl This must come after PHP_NEW_EXTENSION, otherwise the srcdir won't be set
PHP_ADD_MAKEFILE_FRAGMENT
AC_CONFIG_COMMANDS_POST([echo "
mongodb was configured with the following options:
Build configuration:
CFLAGS : $CFLAGS
Extra CFLAGS : $STD_CFLAGS $EXTRA_CFLAGS
Developers flags (slow) : $MAINTAINER_CFLAGS
Code Coverage flags (extra slow) : $COVERAGE_CFLAGS
System mongoc : $PHP_LIBMONGOC
System libbson : $PHP_LIBBSON
LDFLAGS : $LDFLAGS
EXTRA_LDFLAGS : $EXTRA_LDFLAGS
MONGODB_SHARED_LIBADD : $MONGODB_SHARED_LIBADD
Please submit bugreports at:
https://jira.mongodb.org/browse/PHPC
"])
fi
dnl: vim: et sw=2
diff --git a/mongodb-1.2.3/config.w32 b/mongodb-1.2.8/config.w32
similarity index 59%
rename from mongodb-1.2.3/config.w32
rename to mongodb-1.2.8/config.w32
index 65c4065a..271a2a52 100644
--- a/mongodb-1.2.3/config.w32
+++ b/mongodb-1.2.8/config.w32
@@ -1,186 +1,200 @@
// vim:ft=javascript
function mongodb_generate_header(inpath, outpath, replacements)
{
STDOUT.WriteLine("Generating " + outpath);
var infile = FSO.OpenTextFile(inpath, 1);
var outdata = infile.ReadAll();
infile.Close();
for (var key in replacements) {
var replacement = replacements[key];
if (typeof replacement === 'string') {
replacement = replacement.replace(/"/g, '\\"');
}
outdata = outdata.replace(new RegExp('@' + key + '@', 'g'), replacement);
}
var outfile = FSO.CreateTextFile(outpath, true);
outfile.Write(outdata);
outfile.Close();
}
function mongodb_parse_version_file(inpath, prefix)
{
var infile = FSO.OpenTextFile(inpath, 1);
var version = infile.ReadLine();
infile.Close();
var xyz_pre = version.split("-");
var xyz = xyz_pre[0].split(".");
var pre = xyz_pre.length > 1 ? xyz_pre[1] : "";
var replacements = {};
replacements[prefix + "VERSION"] = version;
replacements[prefix + "MAJOR_VERSION"] = xyz[0];
replacements[prefix + "MINOR_VERSION"] = xyz[1];
replacements[prefix + "MICRO_VERSION"] = xyz[2];
replacements[prefix + "PRERELEASE_VERSION"] = pre;
return replacements;
}
ARG_ENABLE("mongodb", "MongoDB support", "no");
ARG_WITH("mongodb-sasl", "MongoDB: Build against Cyrus-SASL", "yes");
if (PHP_MONGODB != "no") {
/* Note: ADD_EXTENSION_DEP() cannot be used to declare that we depend on the
* date and standard extensions. Assume that they're always enabled. */
ADD_EXTENSION_DEP("mongodb", "json", false);
ADD_EXTENSION_DEP("mongodb", "spl", false);
/* MongoDB does not actually depend on PHP's OpenSSL extension, but this is in
* place to ensure that later SSL library checks succeed. This can be removed
* once we support building with Secure Channel. */
ADD_EXTENSION_DEP("mongodb", "openssl", false);
- ADD_FLAG("CFLAGS_MONGODB", " /D BSON_COMPILATION /D MONGOC_COMPILATION /D MONGOC_TRACE /I" + configure_module_dirname + " /I" + configure_module_dirname + "/src/libmongoc/src/mongoc" + " /I" + configure_module_dirname + "/src/libbson/src/bson/ /I" + configure_module_dirname + "/src/libbson/src /I" + configure_module_dirname + "/src/contrib");
- EXTENSION("mongodb", "php_phongo.c");
- ADD_SOURCES(configure_module_dirname + "/", "phongo_compat.c", "mongodb");
+ var PHP_MONGODB_CFLAGS="\
+ /D BSON_COMPILATION /D MONGOC_COMPILATION /D MONGOC_TRACE \
+ /I" + configure_module_dirname + " \
+ /I" + configure_module_dirname + "/src/BSON \
+ /I" + configure_module_dirname + "/src/MongoDB \
+ /I" + configure_module_dirname + "/src/MongoDB/Exception \
+ /I" + configure_module_dirname + "/src/contrib \
+ /I" + configure_module_dirname + "/src/libbson/src \
+ /I" + configure_module_dirname + "/src/libbson/src/bson \
+ /I" + configure_module_dirname + "/src/libbson/src/yajl \
+ /I" + configure_module_dirname + "/src/libmongoc/src/mongoc \
+ ";
+
+ // Condense whitespace in CFLAGS
+ PHP_MONGODB_CFLAGS = PHP_MONGODB_CFLAGS.replace(/\s+/g, ' ');
+
+ // Generated with: find src/libbson/src/bson -name '*.c' -print0 | cut -sz -d / -f 5- | sort -z | tr '\000' ' '
+ 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";
+
+ // Generated with: find src/libbson/src/yajl -name '*.c' -print0 | cut -sz -d / -f 5- | sort -z | tr '\000' ' '
+ var PHP_MONGODB_YAJL_SOURCES="yajl_alloc.c yajl_buf.c yajl.c yajl_encode.c yajl_gen.c yajl_lex.c yajl_parser.c yajl_tree.c yajl_version.c";
+
+ // Generated with: find src/libmongoc/src/mongoc -name '*.c' -print0 | cut -sz -d / -f 4- | sort -z | tr '\000' ' '
+ var PHP_MONGODB_MONGOC_SOURCES="mongoc-apm.c mongoc-array.c mongoc-async.c mongoc-async-cmd.c mongoc-b64.c mongoc-buffer.c mongoc-bulk-operation.c mongoc-client.c mongoc-client-pool.c mongoc-cluster.c mongoc-collection.c mongoc-counters.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-cursorid.c mongoc-cursor-transform.c mongoc-database.c mongoc-find-and-modify.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-index.c mongoc-init.c mongoc-libressl.c mongoc-linux-distro-scanner.c mongoc-list.c mongoc-log.c mongoc-matcher.c mongoc-matcher-op.c mongoc-memcmp.c mongoc-opcode.c mongoc-openssl.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-description.c mongoc-server-stream.c mongoc-set.c mongoc-socket.c mongoc-ssl.c mongoc-stream-buffered.c mongoc-stream.c mongoc-stream-file.c mongoc-stream-gridfs.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-topology.c mongoc-topology-description-apm.c mongoc-topology-description.c mongoc-topology-scanner.c mongoc-uri.c mongoc-util.c mongoc-version-functions.c mongoc-write-command.c mongoc-write-concern.c";
+
+ EXTENSION("mongodb", "php_phongo.c phongo_compat.c", null, PHP_MONGODB_CFLAGS);
ADD_SOURCES(configure_module_dirname + "/src", "bson.c", "mongodb");
- ADD_SOURCES(configure_module_dirname + "/src/BSON", "Type.c Unserializable.c Serializable.c Persistable.c Binary.c Decimal128.c Javascript.c MaxKey.c MinKey.c ObjectID.c Regex.c Timestamp.c UTCDateTime.c", "mongodb");
- ADD_SOURCES(configure_module_dirname + "/src/MongoDB", "Command.c Cursor.c CursorId.c Manager.c Query.c ReadConcern.c ReadPreference.c Server.c BulkWrite.c WriteConcern.c WriteConcernError.c WriteError.c WriteResult.c", "mongodb");
- ADD_SOURCES(configure_module_dirname + "/src/MongoDB/Exception", "Exception.c LogicException.c RuntimeException.c UnexpectedValueException.c InvalidArgumentException.c ConnectionException.c AuthenticationException.c SSLConnectionException.c ExecutionTimeoutException.c ConnectionTimeoutException.c WriteException.c BulkWriteException.c", "mongodb");
- ADD_SOURCES(configure_module_dirname + "/src/libbson/src/yajl", "yajl_version.c yajl.c yajl_encode.c yajl_lex.c yajl_parser.c yajl_buf.c yajl_tree.c yajl_alloc.c yajl_gen.c", "mongodb");
- ADD_SOURCES(configure_module_dirname + "/src/libbson/src/bson", "bcon.c bson.c bson-atomic.c bson-clock.c bson-context.c bson-decimal128.c bson-error.c bson-iter.c bson-iso8601.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", "mongodb");
- ADD_SOURCES(configure_module_dirname + "/src/libmongoc/src/mongoc", "mongoc-apm.c mongoc-array.c mongoc-async.c mongoc-async-cmd.c mongoc-buffer.c mongoc-bulk-operation.c mongoc-b64.c mongoc-client.c mongoc-client-pool.c mongoc-cluster.c mongoc-collection.c mongoc-counters.c mongoc-cursor.c mongoc-cursor-array.c mongoc-cursor-cursorid.c mongoc-cursor-transform.c mongoc-database.c mongoc-find-and-modify.c mongoc-host-list.c mongoc-init.c mongoc-gridfs.c mongoc-gridfs-file.c mongoc-gridfs-file-page.c mongoc-gridfs-file-list.c mongoc-handshake.c mongoc-index.c mongoc-linux-distro-scanner.c mongoc-list.c mongoc-log.c mongoc-matcher-op.c mongoc-matcher.c mongoc-memcmp.c mongoc-opcode.c mongoc-queue.c mongoc-read-concern.c mongoc-read-prefs.c mongoc-rpc.c mongoc-server-description.c mongoc-server-stream.c mongoc-set.c mongoc-socket.c mongoc-stream.c mongoc-stream-buffered.c mongoc-stream-file.c mongoc-stream-gridfs.c mongoc-stream-socket.c mongoc-topology.c mongoc-topology-description.c mongoc-topology-description-apm.c mongoc-topology-scanner.c mongoc-uri.c mongoc-util.c mongoc-version-functions.c mongoc-write-command.c mongoc-write-concern.c", "mongodb");
- ADD_SOURCES(configure_module_dirname + "/src/libmongoc/src/mongoc", "mongoc-crypto.c mongoc-scram.c", "mongodb");
- ADD_SOURCES(configure_module_dirname + "/src/libmongoc/src/mongoc", "mongoc-stream-tls.c mongoc-ssl.c", "mongodb");
- ADD_SOURCES(configure_module_dirname + "/src/libmongoc/src/mongoc", "mongoc-crypto-openssl.c mongoc-rand-openssl.c", "mongodb");
- ADD_SOURCES(configure_module_dirname + "/src/libmongoc/src/mongoc", "mongoc-openssl.c mongoc-stream-tls-openssl.c mongoc-stream-tls-openssl-bio.c", "mongodb");
- ADD_SOURCES(configure_module_dirname + "/src/libmongoc/src/mongoc", "mongoc-crypto-common-crypto.c mongoc-rand-common-crypto.c", "mongodb");
- ADD_SOURCES(configure_module_dirname + "/src/libmongoc/src/mongoc", "mongoc-secure-transport.c mongoc-stream-tls-secure-transport.c", "mongodb");
- ADD_SOURCES(configure_module_dirname + "/src/libmongoc/src/mongoc", "mongoc-crypto-cng.c mongoc-rand-cng.c", "mongodb");
- ADD_SOURCES(configure_module_dirname + "/src/libmongoc/src/mongoc", "mongoc-secure-channel.c mongoc-stream-tls-secure-channel.c", "mongodb");
- ADD_SOURCES(configure_module_dirname + "/src/libmongoc/src/mongoc", "mongoc-sasl.c", "mongodb");
+ ADD_SOURCES(configure_module_dirname + "/src/BSON", "Binary.c Decimal128.c Javascript.c MaxKey.c MinKey.c ObjectID.c Persistable.c Regex.c Serializable.c Timestamp.c Type.c Unserializable.c UTCDateTime.c", "mongodb");
+ ADD_SOURCES(configure_module_dirname + "/src/MongoDB", "BulkWrite.c Command.c Cursor.c CursorId.c Manager.c Query.c ReadConcern.c ReadPreference.c Server.c WriteConcern.c WriteConcernError.c WriteError.c WriteResult.c", "mongodb");
+ ADD_SOURCES(configure_module_dirname + "/src/MongoDB/Exception", "AuthenticationException.c BulkWriteException.c ConnectionException.c ConnectionTimeoutException.c Exception.c ExecutionTimeoutException.c InvalidArgumentException.c LogicException.c RuntimeException.c SSLConnectionException.c UnexpectedValueException.c WriteException.c", "mongodb");
+ ADD_SOURCES(configure_module_dirname + "/src/libbson/src/bson", PHP_MONGODB_BSON_SOURCES, "mongodb");
+ ADD_SOURCES(configure_module_dirname + "/src/libbson/src/yajl", PHP_MONGODB_YAJL_SOURCES, "mongodb");
+ ADD_SOURCES(configure_module_dirname + "/src/libmongoc/src/mongoc", PHP_MONGODB_MONGOC_SOURCES, "mongodb");
var bson_opts = {
BSON_BYTE_ORDER: 1234,
BSON_OS: 2,
BSON_HAVE_STDBOOL_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_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
};
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/libbson/src/bson/bson-config.h.in",
configure_module_dirname + "/src/libbson/src/bson/bson-config.h",
bson_opts
);
mongodb_generate_header(
configure_module_dirname + "/src/libbson/src/bson/bson-version.h.in",
configure_module_dirname + "/src/libbson/src/bson/bson-version.h",
mongodb_parse_version_file(configure_module_dirname + "/src/libbson/VERSION_CURRENT", "BSON_")
);
var mongoc_opts = {
// TODO: Support building with Secure Channel on Windows
MONGOC_ENABLE_SSL_SECURE_CHANNEL: 0,
MONGOC_ENABLE_CRYPTO_CNG: 0,
// Secure Transport does not apply to Windows
MONGOC_ENABLE_SSL_SECURE_TRANSPORT: 0,
MONGOC_ENABLE_CRYPTO_COMMON_CRYPTO: 0,
MONGOC_ENABLE_SSL_LIBRESSL: 0,
MONGOC_ENABLE_SSL_OPENSSL: 0,
MONGOC_ENABLE_CRYPTO_LIBCRYPTO: 0,
MONGOC_ENABLE_SSL: 0,
MONGOC_ENABLE_CRYPTO: 0,
MONGOC_ENABLE_CRYPTO_SYSTEM_PROFILE: 0,
MONGOC_ENABLE_SASL: 0,
MONGOC_HAVE_SASL_CLIENT_DONE: 0,
MONGOC_HAVE_WEAK_SYMBOLS: 0,
MONGOC_NO_AUTOMATIC_GLOBALS: 1,
MONGOC_CC: "",
MONGOC_USER_SET_CFLAGS: "",
MONGOC_USER_SET_LDFLAGS: ""
};
var mongoc_ssl_path_to_check = PHP_MONGODB;
if (typeof PHP_OPENSSL === 'string') {
mongoc_ssl_path_to_check += ";" + PHP_OPENSSL;
}
if (CHECK_LIB("ssleay32.lib", "mongodb", mongoc_ssl_path_to_check) &&
CHECK_LIB("libeay32.lib", "mongodb", mongoc_ssl_path_to_check) &&
CHECK_LIB("crypt32.lib", "mongodb") &&
CHECK_HEADER_ADD_INCLUDE("openssl/ssl.h", "CFLAGS_MONGODB")) {
mongoc_opts.MONGOC_ENABLE_SSL_OPENSSL = 1;
mongoc_opts.MONGOC_ENABLE_CRYPTO_LIBCRYPTO = 1;
mongoc_opts.MONGOC_ENABLE_SSL = 1;
mongoc_opts.MONGOC_ENABLE_CRYPTO = 1;
} else {
WARNING("mongodb libopenssl support not enabled, libs not found");
}
if (PHP_MONGODB_SASL != "no" &&
CHECK_LIB("libsasl.lib", "mongodb", PHP_MONGODB) &&
CHECK_HEADER_ADD_INCLUDE("sasl/sasl.h", "CFLAGS_MONGODB")) {
mongoc_opts.MONGOC_ENABLE_SASL = 1;
if (CHECK_FUNC_IN_HEADER("sasl/sasl.h", "sasl_client_done")) {
mongoc_opts.MONGOC_HAVE_SASL_CLIENT_DONE = 1;
}
} else {
WARNING("mongodb libsasl support not enabled, libs not found");
}
if (typeof COMPILER_NAME === 'string') {
mongoc_opts.MONGOC_CC = COMPILER_NAME;
} else if (typeof VC_VERSIONS[VCVERS] === 'string') {
mongoc_opts.MONGOC_CC = VC_VERSIONS[VCVERS];
}
/* MONGOC_USER_SET_CFLAGS and MONGOC_USER_SET_LDFLAGS can be left blank, as we
* do not expect CFLAGS or LDFLAGS to be customized at build time. */
mongodb_generate_header(
configure_module_dirname + "/src/libmongoc/src/mongoc/mongoc-config.h.in",
configure_module_dirname + "/src/libmongoc/src/mongoc/mongoc-config.h",
mongoc_opts
);
mongodb_generate_header(
configure_module_dirname + "/src/libmongoc/src/mongoc/mongoc-version.h.in",
configure_module_dirname + "/src/libmongoc/src/mongoc/mongoc-version.h",
mongodb_parse_version_file(configure_module_dirname + "/src/libmongoc/VERSION_CURRENT", "MONGOC_")
);
}
diff --git a/mongodb-1.2.3/phongo_compat.c b/mongodb-1.2.8/phongo_compat.c
similarity index 100%
rename from mongodb-1.2.3/phongo_compat.c
rename to mongodb-1.2.8/phongo_compat.c
diff --git a/mongodb-1.2.3/phongo_compat.h b/mongodb-1.2.8/phongo_compat.h
similarity index 99%
rename from mongodb-1.2.3/phongo_compat.h
rename to mongodb-1.2.8/phongo_compat.h
index a0635c3c..0cf54578 100644
--- a/mongodb-1.2.3/phongo_compat.h
+++ b/mongodb-1.2.8/phongo_compat.h
@@ -1,184 +1,186 @@
/*
* Copyright 2015-2017 MongoDB, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef PHONGO_COMPAT_H
#define PHONGO_COMPAT_H
#include <php.h>
#include <Zend/zend_string.h>
#if PHP_VERSION_ID >= 70000
#include <Zend/zend_portability.h>
#endif
#ifdef PHP_WIN32
# include "config.w32.h"
#else
# include <php_config.h>
#endif
#ifndef PHP_FE_END
# define PHP_FE_END { NULL, NULL, NULL }
#endif
#ifndef HASH_KEY_NON_EXISTENT
# define HASH_KEY_NON_EXISTENT HASH_KEY_NON_EXISTANT
#endif
#if PHP_VERSION_ID >= 70000
# define str_efree(s) efree((char*)s)
#else
# include <Zend/zend_string.h>
#endif
#if PHP_VERSION_ID >= 50500
#define ITERATOR_GET_CURRENT_KEY(it, z) \
(it).funcs->get_current_key(&(it), z TSRMLS_CC);
#else
#define ITERATOR_GET_CURRENT_KEY(it, z) \
{ \
char *str_key; \
uint str_key_len; \
ulong int_key; \
switch ((it).funcs->get_current_key(&(it), &str_key, &str_key_len, &int_key TSRMLS_CC)) { \
case HASH_KEY_IS_LONG: \
ZVAL_LONG(z, int_key); \
break; \
case HASH_KEY_IS_STRING: \
ZVAL_STRINGL(z, str_key, str_key_len-1, 0); \
break; \
default: \
RETURN_NULL(); \
} \
}
#endif
#if defined(__GNUC__)
# define ARG_UNUSED __attribute__ ((unused))
#else
# define ARG_UNUSED
#endif
#if PHP_VERSION_ID >= 70000
# define phongo_char zend_string
# define phongo_long zend_long
#if SIZEOF_ZEND_LONG == 8
# define PHONGO_LONG_FORMAT PRId64
#elif SIZEOF_ZEND_LONG == 4
# define PHONGO_LONG_FORMAT PRId32
#else
# error Unsupported architecture (integers are neither 32-bit nor 64-bit)
#endif
# define SIZEOF_PHONGO_LONG SIZEOF_ZEND_LONG
# define phongo_create_object_retval zend_object*
+# define phongo_get_gc_table zval **
# define PHONGO_ALLOC_OBJECT_T(_obj_t, _class_type) (_obj_t *)ecalloc(1, sizeof(_obj_t)+zend_object_properties_size(_class_type))
# define PHONGO_TSRMLS_FETCH_FROM_CTX(user_data)
# define SUPPRESS_UNUSED_WARNING(x)
# define DECLARE_RETURN_VALUE_USED int return_value_used = 1;
# define EXCEPTION_P(_ex, _zp) ZVAL_OBJ(&_zp, _ex)
# define ADD_ASSOC_STRING(_zv, _key, _value) add_assoc_string_ex(_zv, ZEND_STRL(_key), (char *)(_value));
# define ADD_ASSOC_STRINGL(_zv, _key, _value, _len) add_assoc_stringl_ex(_zv, ZEND_STRL(_key), (char *)(_value), _len);
# define ADD_ASSOC_STRING_EX(_zv, _key, _key_len, _value, _value_len) add_assoc_stringl_ex(_zv, _key, _key_len, (char *)(_value), _value_len);
# define ADD_ASSOC_LONG_EX(_zv, _key, _value) add_assoc_long_ex(_zv, ZEND_STRL(_key), _value);
# define ADD_ASSOC_ZVAL_EX(_zv, _key, _value) add_assoc_zval_ex(_zv, ZEND_STRL(_key), _value);
# define ADD_ASSOC_ZVAL(_zv, _key, _value) add_assoc_zval(_zv, _key, _value);
# define ADD_ASSOC_NULL_EX(_zv, _key) add_assoc_null_ex(_zv, ZEND_STRL(_key));
# define ADD_ASSOC_BOOL_EX(_zv, _key, _value) add_assoc_bool_ex(_zv, ZEND_STRL(_key), _value);
# define ADD_NEXT_INDEX_STRINGL(_zv, _value, _len) add_next_index_stringl(_zv, _value, _len);
# define phongo_free_object_arg zend_object
# define phongo_zpp_char_len size_t
# define ZEND_HASH_APPLY_COUNT(ht) (ht)->u.v.nApplyCount
# define PHONGO_RETVAL_STRINGL(s, slen) RETVAL_STRINGL(s, slen)
# define PHONGO_RETURN_STRINGL(s, slen) RETURN_STRINGL(s, slen)
# define PHONGO_RETVAL_STRING(s) RETVAL_STRING(s)
# define PHONGO_RETURN_STRING(s) RETURN_STRING(s)
# define PHONGO_RETVAL_SMART_STR(val) PHONGO_RETVAL_STRINGL(ZSTR_VAL((val).s), ZSTR_LEN((val).s));
#else
# define phongo_char char
# define phongo_long long
# define PHONGO_LONG_FORMAT "ld"
# define SIZEOF_PHONGO_LONG SIZEOF_LONG
# define ZSTR_VAL(str) str
# define phongo_create_object_retval zend_object_value
+# define phongo_get_gc_table zval ***
# define PHONGO_ALLOC_OBJECT_T(_obj_t, _class_type) (_obj_t *)ecalloc(1, sizeof(_obj_t))
# define PHONGO_TSRMLS_FETCH_FROM_CTX(user_data) TSRMLS_FETCH_FROM_CTX(user_data)
# define SUPPRESS_UNUSED_WARNING(x) (void)x;
# define DECLARE_RETURN_VALUE_USED
# define EXCEPTION_P(_ex, _zp) _zp = _ex
# define ADD_ASSOC_STRING(_zv, _key, _value) add_assoc_string_ex(_zv, ZEND_STRS(_key), (char *)(_value), 1);
# define ADD_ASSOC_STRINGL(_zv, _key, _value, _len) add_assoc_stringl_ex(_zv, ZEND_STRS(_key), (char *)(_value), _len, 1);
# define ADD_ASSOC_STRING_EX(_zv, _key, _key_len, _value, _value_len) add_assoc_stringl_ex(_zv, _key, _key_len+1, (char *)(_value), _value_len, 1);
# define ADD_ASSOC_LONG_EX(_zv, _key, _value) add_assoc_long_ex(_zv, ZEND_STRS(_key), _value);
# define ADD_ASSOC_ZVAL_EX(_zv, _key, _value) add_assoc_zval_ex(_zv, ZEND_STRS(_key), _value);
# define ADD_ASSOC_ZVAL(_zv, _key, _value) add_assoc_zval(_zv, _key, _value);
# define ADD_ASSOC_NULL_EX(_zv, _key) add_assoc_null_ex(_zv, ZEND_STRS(_key));
# define ADD_ASSOC_BOOL_EX(_zv, _key, _value) add_assoc_bool_ex(_zv, ZEND_STRS(_key), _value);
# define ADD_NEXT_INDEX_STRINGL(_zv, _value, _len) add_next_index_stringl(_zv, _value, _len, 1);
# define Z_PHPDATE_P(object) ((php_date_obj*)zend_object_store_get_object(object TSRMLS_CC))
# define Z_ISUNDEF(x) !x
# define phongo_free_object_arg void
# define phongo_zpp_char_len int
# define ZEND_HASH_APPLY_PROTECTION(ht) true
# define ZEND_HASH_GET_APPLY_COUNT(ht) ((ht)->nApplyCount)
# define ZEND_HASH_DEC_APPLY_COUNT(ht) ((ht)->nApplyCount -= 1)
# define ZEND_HASH_INC_APPLY_COUNT(ht) ((ht)->nApplyCount += 1)
# define PHONGO_RETVAL_STRINGL(s, slen) RETVAL_STRINGL(s, slen, 1)
# define PHONGO_RETURN_STRINGL(s, slen) RETURN_STRINGL(s, slen, 1)
# define PHONGO_RETVAL_STRING(s) RETVAL_STRING(s, 1)
# define PHONGO_RETURN_STRING(s) RETURN_STRING(s, 1)
# define PHONGO_RETVAL_SMART_STR(val) PHONGO_RETVAL_STRINGL((val).c, (val).len);
#endif
#if SIZEOF_PHONGO_LONG == 8
# define ADD_INDEX_INT64(zval, index, value) add_index_long(zval, index, value)
# define ADD_NEXT_INDEX_INT64(zval, value) add_next_index_long(zval, value)
# define ADD_ASSOC_INT64(zval, key, value) add_assoc_long(zval, key, value)
#elif SIZEOF_PHONGO_LONG == 4
# define ADD_INDEX_INT64(zval, index, value) \
if (value > INT32_MAX || value < INT32_MIN) { \
phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT TSRMLS_CC, "Integer overflow detected on your platform: %lld", value); \
} else { \
add_index_long(zval, index, value); \
}
# define ADD_NEXT_INDEX_INT64(zval, value) \
if (value > INT32_MAX || value < INT32_MIN) { \
phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT TSRMLS_CC, "Integer overflow detected on your platform: %lld", value); \
} else { \
add_next_index_long(zval, value); \
}
# define ADD_ASSOC_INT64(zval, key, value) \
if (value > INT32_MAX || value < INT32_MIN) { \
phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT TSRMLS_CC, "Integer overflow detected on your platform: %lld", value); \
} else { \
add_assoc_long(zval, key, value); \
}
#else
# error Unsupported architecture (integers are neither 32-bit nor 64-bit)
#endif
void phongo_add_exception_prop(const char *prop, int prop_len, zval *value TSRMLS_DC);
#endif /* PHONGO_COMPAT_H */
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* End:
* vim600: noet sw=4 ts=4 fdm=marker
* vim<600: noet sw=4 ts=4
*/
diff --git a/mongodb-1.2.3/php_bson.h b/mongodb-1.2.8/php_bson.h
similarity index 100%
rename from mongodb-1.2.3/php_bson.h
rename to mongodb-1.2.8/php_bson.h
diff --git a/mongodb-1.2.3/php_phongo.c b/mongodb-1.2.8/php_phongo.c
similarity index 95%
rename from mongodb-1.2.3/php_phongo.c
rename to mongodb-1.2.8/php_phongo.c
index 46714bf8..716f6f8f 100644
--- a/mongodb-1.2.3/php_phongo.c
+++ b/mongodb-1.2.8/php_phongo.c
@@ -1,2153 +1,2190 @@
/*
* Copyright 2014-2017 MongoDB, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
/* External libs */
#include "bson.h"
#include "mongoc.h"
/* PHP Core stuff */
#include <php.h>
#include <php_ini.h>
#include <ext/standard/info.h>
#include <ext/standard/file.h>
#include <Zend/zend_hash.h>
#include <Zend/zend_interfaces.h>
#include <Zend/zend_exceptions.h>
#include <ext/spl/spl_iterators.h>
#include <ext/spl/spl_exceptions.h>
#include <ext/standard/php_var.h>
#if PHP_VERSION_ID >= 70000
# include <Zend/zend_smart_str.h>
#else
# include <ext/standard/php_smart_str.h>
#endif
+/* getpid() */
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+#ifdef PHP_WIN32
+# include <process.h>
+#endif
+
/* Stream wrapper */
#include <main/php_streams.h>
#include <main/php_network.h>
/* Debug log writing */
#include <main/php_open_temporary_file.h>
/* For formating timestamp in the log */
#include <ext/date/php_date.h>
/* String manipulation */
#include <Zend/zend_string.h>
/* PHP array helpers */
#include "php_array_api.h"
/* Our Compatability header */
#include "phongo_compat.h"
/* Our stuffz */
#include "php_phongo.h"
#include "php_bson.h"
#undef MONGOC_LOG_DOMAIN
#define MONGOC_LOG_DOMAIN "PHONGO"
#define PHONGO_DEBUG_INI "mongodb.debug"
#define PHONGO_DEBUG_INI_DEFAULT ""
ZEND_DECLARE_MODULE_GLOBALS(mongodb)
#if PHP_VERSION_ID >= 70000
#if defined(ZTS) && defined(COMPILE_DL_MONGODB)
ZEND_TSRMLS_CACHE_DEFINE();
#endif
#endif
/* Declare zend_class_entry dependencies, which are initialized in MINIT */
zend_class_entry *php_phongo_date_immutable_ce;
zend_class_entry *php_phongo_json_serializable_ce;
php_phongo_server_description_type_map_t
php_phongo_server_description_type_map[PHONGO_SERVER_DESCRIPTION_TYPES] = {
{ PHONGO_SERVER_UNKNOWN, "Unknown" },
{ PHONGO_SERVER_STANDALONE, "Standalone" },
{ PHONGO_SERVER_MONGOS, "Mongos" },
{ PHONGO_SERVER_POSSIBLE_PRIMARY, "PossiblePrimary" },
{ PHONGO_SERVER_RS_PRIMARY, "RSPrimary" },
{ PHONGO_SERVER_RS_SECONDARY, "RSSecondary" },
{ PHONGO_SERVER_RS_ARBITER, "RSArbiter" },
{ PHONGO_SERVER_RS_OTHER, "RSOther" },
{ PHONGO_SERVER_RS_GHOST, "RSGhost" },
};
/* {{{ phongo_std_object_handlers */
zend_object_handlers phongo_std_object_handlers;
zend_object_handlers *phongo_get_std_object_handlers(void)
{
return &phongo_std_object_handlers;
}
/* }}} */
/* Forward declarations */
static bool phongo_split_namespace(const char *namespace, char **dbname, char **cname);
/* {{{ Error reporting and logging */
zend_class_entry* phongo_exception_from_phongo_domain(php_phongo_error_domain_t domain)
{
switch (domain) {
case PHONGO_ERROR_INVALID_ARGUMENT:
return php_phongo_invalidargumentexception_ce;
case PHONGO_ERROR_LOGIC:
return php_phongo_logicexception_ce;
case PHONGO_ERROR_RUNTIME:
return php_phongo_runtimeexception_ce;
case PHONGO_ERROR_UNEXPECTED_VALUE:
return php_phongo_unexpectedvalueexception_ce;
case PHONGO_ERROR_MONGOC_FAILED:
return php_phongo_runtimeexception_ce;
case PHONGO_ERROR_WRITE_FAILED:
return php_phongo_bulkwriteexception_ce;
case PHONGO_ERROR_CONNECTION_FAILED:
return php_phongo_connectionexception_ce;
}
MONGOC_ERROR("Resolving unknown phongo error domain: %d", domain);
return php_phongo_runtimeexception_ce;
}
zend_class_entry* phongo_exception_from_mongoc_domain(uint32_t /* mongoc_error_domain_t */ domain, uint32_t /* mongoc_error_code_t */ code)
{
switch(code) {
case 50: /* ExceededTimeLimit */
return php_phongo_executiontimeoutexception_ce;
case MONGOC_ERROR_STREAM_SOCKET:
case MONGOC_ERROR_SERVER_SELECTION_FAILURE:
return php_phongo_connectiontimeoutexception_ce;
case MONGOC_ERROR_CLIENT_AUTHENTICATE:
return php_phongo_authenticationexception_ce;
case MONGOC_ERROR_STREAM_INVALID_TYPE:
case MONGOC_ERROR_STREAM_INVALID_STATE:
case MONGOC_ERROR_STREAM_NAME_RESOLUTION:
case MONGOC_ERROR_STREAM_CONNECT:
case MONGOC_ERROR_STREAM_NOT_ESTABLISHED:
return php_phongo_connectionexception_ce;
case MONGOC_ERROR_CLIENT_NOT_READY:
case MONGOC_ERROR_CLIENT_TOO_BIG:
case MONGOC_ERROR_CLIENT_TOO_SMALL:
case MONGOC_ERROR_CLIENT_GETNONCE:
case MONGOC_ERROR_CLIENT_NO_ACCEPTABLE_PEER:
case MONGOC_ERROR_CLIENT_IN_EXHAUST:
case MONGOC_ERROR_PROTOCOL_INVALID_REPLY:
case MONGOC_ERROR_PROTOCOL_BAD_WIRE_VERSION:
case MONGOC_ERROR_CURSOR_INVALID_CURSOR:
case MONGOC_ERROR_QUERY_FAILURE:
/*case MONGOC_ERROR_PROTOCOL_ERROR:*/
case MONGOC_ERROR_BSON_INVALID:
case MONGOC_ERROR_MATCHER_INVALID:
case MONGOC_ERROR_NAMESPACE_INVALID:
case MONGOC_ERROR_COMMAND_INVALID_ARG:
case MONGOC_ERROR_COLLECTION_INSERT_FAILED:
case MONGOC_ERROR_GRIDFS_INVALID_FILENAME:
case MONGOC_ERROR_QUERY_COMMAND_NOT_FOUND:
case MONGOC_ERROR_QUERY_NOT_TAILABLE:
return php_phongo_runtimeexception_ce;
}
switch (domain) {
case MONGOC_ERROR_CLIENT:
case MONGOC_ERROR_STREAM:
case MONGOC_ERROR_PROTOCOL:
case MONGOC_ERROR_CURSOR:
case MONGOC_ERROR_QUERY:
case MONGOC_ERROR_INSERT:
case MONGOC_ERROR_SASL:
case MONGOC_ERROR_BSON:
case MONGOC_ERROR_MATCHER:
case MONGOC_ERROR_NAMESPACE:
case MONGOC_ERROR_COMMAND:
case MONGOC_ERROR_COLLECTION:
case MONGOC_ERROR_GRIDFS:
/* FIXME: We don't have the Exceptions mocked yet.. */
#if 0
return phongo_ce_mongo_connection_exception;
#endif
default:
return php_phongo_runtimeexception_ce;
}
}
void phongo_throw_exception(php_phongo_error_domain_t domain TSRMLS_DC, const char *format, ...)
{
va_list args;
char *message;
int message_len;
va_start(args, format);
message_len = vspprintf(&message, 0, format, args);
zend_throw_exception(phongo_exception_from_phongo_domain(domain), message, 0 TSRMLS_CC);
efree(message);
va_end(args);
}
void phongo_throw_exception_from_bson_error_t(bson_error_t *error TSRMLS_DC)
{
zend_throw_exception(phongo_exception_from_mongoc_domain(error->domain, error->code), error->message, error->code TSRMLS_CC);
}
static void php_phongo_log(mongoc_log_level_t log_level, const char *log_domain, const char *message, void *user_data)
{
PHONGO_TSRMLS_FETCH_FROM_CTX(user_data);
(void)user_data;
switch(log_level) {
case MONGOC_LOG_LEVEL_ERROR:
case MONGOC_LOG_LEVEL_CRITICAL:
phongo_throw_exception(PHONGO_ERROR_MONGOC_FAILED TSRMLS_CC, "%s", message);
return;
case MONGOC_LOG_LEVEL_WARNING:
case MONGOC_LOG_LEVEL_MESSAGE:
case MONGOC_LOG_LEVEL_INFO:
case MONGOC_LOG_LEVEL_DEBUG:
case MONGOC_LOG_LEVEL_TRACE:
{
time_t t;
phongo_char *dt;
time(&t);
dt = php_format_date((char *)"Y-m-d\\TH:i:sP", strlen("Y-m-d\\TH:i:sP"), t, 0 TSRMLS_CC);
fprintf(MONGODB_G(debug_fd), "[%s] %10s: %-8s> %s\n", ZSTR_VAL(dt), log_domain, mongoc_log_level_str(log_level), message);
fflush(MONGODB_G(debug_fd));
efree(dt);
} break;
}
}
/* }}} */
/* {{{ Init objects */
static void phongo_cursor_init(zval *return_value, zval *manager, mongoc_cursor_t *cursor, zval *readPreference TSRMLS_DC) /* {{{ */
{
php_phongo_cursor_t *intern;
object_init_ex(return_value, php_phongo_cursor_ce);
intern = Z_CURSOR_OBJ_P(return_value);
intern->cursor = cursor;
intern->server_id = mongoc_cursor_get_hint(cursor);
intern->client = Z_MANAGER_OBJ_P(manager)->client;
#if PHP_VERSION_ID >= 70000
ZVAL_COPY(&intern->manager, manager);
#else
Z_ADDREF_P(manager);
intern->manager = manager;
#endif
if (readPreference) {
#if PHP_VERSION_ID >= 70000
ZVAL_ZVAL(&intern->read_preference, readPreference, 1, 0);
#else
Z_ADDREF_P(readPreference);
intern->read_preference = readPreference;
#endif
}
} /* }}} */
static void phongo_cursor_init_for_command(zval *return_value, zval *manager, mongoc_cursor_t *cursor, const char *db, zval *command, zval *readPreference TSRMLS_DC) /* {{{ */
{
php_phongo_cursor_t *intern;
phongo_cursor_init(return_value, manager, cursor, readPreference TSRMLS_CC);
intern = Z_CURSOR_OBJ_P(return_value);
intern->database = estrdup(db);
#if PHP_VERSION_ID >= 70000
ZVAL_ZVAL(&intern->command, command, 1, 0);
#else
Z_ADDREF_P(command);
intern->command = command;
#endif
} /* }}} */
static void phongo_cursor_init_for_query(zval *return_value, zval *manager, mongoc_cursor_t *cursor, const char *namespace, zval *query, zval *readPreference TSRMLS_DC) /* {{{ */
{
php_phongo_cursor_t *intern;
phongo_cursor_init(return_value, manager, cursor, readPreference TSRMLS_CC);
intern = Z_CURSOR_OBJ_P(return_value);
/* namespace has already been validated by phongo_execute_query() */
phongo_split_namespace(namespace, &intern->database, &intern->collection);
#if PHP_VERSION_ID >= 70000
ZVAL_ZVAL(&intern->query, query, 1, 0);
#else
Z_ADDREF_P(query);
intern->query = query;
#endif
} /* }}} */
void phongo_server_init(zval *return_value, zval *manager, int server_id TSRMLS_DC) /* {{{ */
{
php_phongo_server_t *server;
object_init_ex(return_value, php_phongo_server_ce);
server = Z_SERVER_OBJ_P(return_value);
server->server_id = server_id;
server->client = Z_MANAGER_OBJ_P(manager)->client;
#if PHP_VERSION_ID >= 70000
ZVAL_COPY(&server->manager, manager);
#else
Z_ADDREF_P(manager);
server->manager = manager;
#endif
}
/* }}} */
void phongo_readconcern_init(zval *return_value, const mongoc_read_concern_t *read_concern TSRMLS_DC) /* {{{ */
{
php_phongo_readconcern_t *intern;
object_init_ex(return_value, php_phongo_readconcern_ce);
intern = Z_READCONCERN_OBJ_P(return_value);
intern->read_concern = mongoc_read_concern_copy(read_concern);
}
/* }}} */
void phongo_readpreference_init(zval *return_value, const mongoc_read_prefs_t *read_prefs TSRMLS_DC) /* {{{ */
{
php_phongo_readpreference_t *intern;
object_init_ex(return_value, php_phongo_readpreference_ce);
intern = Z_READPREFERENCE_OBJ_P(return_value);
intern->read_preference = mongoc_read_prefs_copy(read_prefs);
}
/* }}} */
void phongo_writeconcern_init(zval *return_value, const mongoc_write_concern_t *write_concern TSRMLS_DC) /* {{{ */
{
php_phongo_writeconcern_t *intern;
object_init_ex(return_value, php_phongo_writeconcern_ce);
intern = Z_WRITECONCERN_OBJ_P(return_value);
intern->write_concern = mongoc_write_concern_copy(write_concern);
}
/* }}} */
zend_bool phongo_writeconcernerror_init(zval *return_value, bson_t *bson TSRMLS_DC) /* {{{ */
{
bson_iter_t iter;
php_phongo_writeconcernerror_t *intern;
object_init_ex(return_value, php_phongo_writeconcernerror_ce);
intern = Z_WRITECONCERNERROR_OBJ_P(return_value);
if (bson_iter_init_find(&iter, bson, "code") && BSON_ITER_HOLDS_INT32(&iter)) {
intern->code = bson_iter_int32(&iter);
}
if (bson_iter_init_find(&iter, bson, "errmsg") && BSON_ITER_HOLDS_UTF8(&iter)) {
uint32_t errmsg_len;
const char *err_msg = bson_iter_utf8(&iter, &errmsg_len);
intern->message = estrndup(err_msg, errmsg_len);
}
if (bson_iter_init_find(&iter, bson, "errInfo") && BSON_ITER_HOLDS_DOCUMENT(&iter)) {
uint32_t len;
const uint8_t *data = NULL;
bson_iter_document(&iter, &len, &data);
if (!phongo_bson_to_zval(data, len, &intern->info)) {
zval_ptr_dtor(&intern->info);
#if PHP_VERSION_ID >= 70000
ZVAL_UNDEF(&intern->info);
#else
intern->info = NULL;
#endif
return false;
}
}
return true;
} /* }}} */
zend_bool phongo_writeerror_init(zval *return_value, bson_t *bson TSRMLS_DC) /* {{{ */
{
bson_iter_t iter;
php_phongo_writeerror_t *intern;
object_init_ex(return_value, php_phongo_writeerror_ce);
intern = Z_WRITEERROR_OBJ_P(return_value);
if (bson_iter_init_find(&iter, bson, "code") && BSON_ITER_HOLDS_INT32(&iter)) {
intern->code = bson_iter_int32(&iter);
}
if (bson_iter_init_find(&iter, bson, "errmsg") && BSON_ITER_HOLDS_UTF8(&iter)) {
uint32_t errmsg_len;
const char *err_msg = bson_iter_utf8(&iter, &errmsg_len);
intern->message = estrndup(err_msg, errmsg_len);
}
if (bson_iter_init_find(&iter, bson, "errInfo") && BSON_ITER_HOLDS_DOCUMENT(&iter)) {
uint32_t len;
const uint8_t *data = NULL;
bson_iter_document(&iter, &len, &data);
if (!phongo_bson_to_zval(data, len, &intern->info)) {
zval_ptr_dtor(&intern->info);
#if PHP_VERSION_ID >= 70000
ZVAL_UNDEF(&intern->info);
#else
intern->info = NULL;
#endif
return false;
}
}
if (bson_iter_init_find(&iter, bson, "index") && BSON_ITER_HOLDS_INT32(&iter)) {
intern->index = bson_iter_int32(&iter);
}
return true;
} /* }}} */
php_phongo_writeresult_t *phongo_writeresult_init(zval *return_value, bson_t *reply, zval *manager, int server_id TSRMLS_DC) /* {{{ */
{
php_phongo_writeresult_t *writeresult;
object_init_ex(return_value, php_phongo_writeresult_ce);
writeresult = Z_WRITERESULT_OBJ_P(return_value);
writeresult->reply = bson_copy(reply);
writeresult->server_id = server_id;
writeresult->client = Z_MANAGER_OBJ_P(manager)->client;
#if PHP_VERSION_ID >= 70000
ZVAL_COPY(&writeresult->manager, manager);
#else
Z_ADDREF_P(manager);
writeresult->manager = manager;
#endif
return writeresult;
} /* }}} */
/* }}} */
/* {{{ CRUD */
/* Splits a namespace name into the database and collection names, allocated with estrdup. */
static bool phongo_split_namespace(const char *namespace, char **dbname, char **cname) /* {{{ */
{
char *dot = strchr(namespace, '.');
if (!dot) {
return false;
}
if (cname) {
*cname = estrdup(namespace + (dot - namespace) + 1);
}
if (dbname) {
*dbname = estrndup(namespace, dot - namespace);
}
return true;
} /* }}} */
mongoc_bulk_operation_t *phongo_bulkwrite_init(zend_bool ordered) { /* {{{ */
return mongoc_bulk_operation_new(ordered);
} /* }}} */
bool phongo_execute_write(zval *manager, const char *namespace, php_phongo_bulkwrite_t *bulk_write, const mongoc_write_concern_t *write_concern, int server_id, zval *return_value, int return_value_used TSRMLS_DC) /* {{{ */
{
mongoc_client_t *client;
bson_error_t error;
int success;
bson_t reply = BSON_INITIALIZER;
mongoc_bulk_operation_t *bulk = bulk_write->bulk;
php_phongo_writeresult_t *writeresult;
client = Z_MANAGER_OBJ_P(manager)->client;
if (bulk_write->executed) {
phongo_throw_exception(PHONGO_ERROR_WRITE_FAILED TSRMLS_CC, "BulkWrite objects may only be executed once and this instance has already been executed");
return false;
}
if (!phongo_split_namespace(namespace, &bulk_write->database, &bulk_write->collection)) {
phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT TSRMLS_CC, "%s: %s", "Invalid namespace provided", namespace);
return false;
}
mongoc_bulk_operation_set_database(bulk, bulk_write->database);
mongoc_bulk_operation_set_collection(bulk, bulk_write->collection);
mongoc_bulk_operation_set_client(bulk, client);
/* If a write concern was not specified, libmongoc will use the client's
* write concern; however, we should still fetch it for the write result. */
if (write_concern) {
mongoc_bulk_operation_set_write_concern(bulk, write_concern);
} else {
write_concern = mongoc_client_get_write_concern(client);
}
if (server_id > 0) {
mongoc_bulk_operation_set_hint(bulk, server_id);
}
success = mongoc_bulk_operation_execute(bulk, &reply, &error);
bulk_write->executed = true;
/* Write succeeded and the user doesn't care for the results */
if (success && !return_value_used) {
bson_destroy(&reply);
return true;
}
/* Check for connection related exceptions */
if (EG(exception)) {
bson_destroy(&reply);
return false;
}
writeresult = phongo_writeresult_init(return_value, &reply, manager, mongoc_bulk_operation_get_hint(bulk) TSRMLS_CC);
writeresult->write_concern = mongoc_write_concern_copy(write_concern);
/* The Write failed */
if (!success) {
if (error.domain == MONGOC_ERROR_COMMAND || error.domain == MONGOC_ERROR_WRITE_CONCERN) {
phongo_throw_exception(PHONGO_ERROR_WRITE_FAILED TSRMLS_CC, "%s", error.message);
phongo_add_exception_prop(ZEND_STRL("writeResult"), return_value TSRMLS_CC);
} else {
phongo_throw_exception_from_bson_error_t(&error TSRMLS_CC);
}
}
bson_destroy(&reply);
return success;
} /* }}} */
/* Advance the cursor and return whether there is an error. On error, the cursor
* will be destroyed and an exception will be thrown. */
static bool phongo_advance_cursor_and_check_for_error(mongoc_cursor_t *cursor TSRMLS_DC)
{
const bson_t *doc;
if (!mongoc_cursor_next(cursor, &doc)) {
bson_error_t error;
/* Check for connection related exceptions */
if (EG(exception)) {
mongoc_cursor_destroy(cursor);
return false;
}
/* Could simply be no docs, which is not an error */
if (mongoc_cursor_error(cursor, &error)) {
phongo_throw_exception_from_bson_error_t(&error TSRMLS_CC);
mongoc_cursor_destroy(cursor);
return false;
}
}
return true;
}
int phongo_execute_query(zval *manager, const char *namespace, zval *zquery, zval *zreadPreference, int server_id, zval *return_value, int return_value_used TSRMLS_DC) /* {{{ */
{
mongoc_client_t *client;
const php_phongo_query_t *query;
mongoc_cursor_t *cursor;
char *dbname;
char *collname;
mongoc_collection_t *collection;
client = Z_MANAGER_OBJ_P(manager)->client;
if (!phongo_split_namespace(namespace, &dbname, &collname)) {
phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT TSRMLS_CC, "%s: %s", "Invalid namespace provided", namespace);
return false;
}
collection = mongoc_client_get_collection(client, dbname, collname);
efree(dbname);
efree(collname);
query = Z_QUERY_OBJ_P(zquery);
if (query->read_concern) {
mongoc_collection_set_read_concern(collection, query->read_concern);
}
cursor = mongoc_collection_find_with_opts(collection, query->filter, query->opts, phongo_read_preference_from_zval(zreadPreference TSRMLS_CC));
mongoc_collection_destroy(collection);
/* mongoc issues a warning we need to catch somehow */
if (!cursor) {
phongo_throw_exception(PHONGO_ERROR_MONGOC_FAILED TSRMLS_CC, "%s", "FIXME: Couldn't create cursor...");
return false;
}
if (server_id > 0 && !mongoc_cursor_set_hint(cursor, server_id)) {
phongo_throw_exception(PHONGO_ERROR_MONGOC_FAILED TSRMLS_CC, "%s", "Could not set cursor server_id");
return false;
}
if (!phongo_advance_cursor_and_check_for_error(cursor TSRMLS_CC)) {
return false;
}
if (!return_value_used) {
mongoc_cursor_destroy(cursor);
return true;
}
phongo_cursor_init_for_query(return_value, manager, cursor, namespace, zquery, zreadPreference TSRMLS_CC);
return true;
} /* }}} */
int phongo_execute_command(zval *manager, const char *db, zval *zcommand, zval *zreadPreference, int server_id, zval *return_value, int return_value_used TSRMLS_DC) /* {{{ */
{
mongoc_client_t *client;
const php_phongo_command_t *command;
mongoc_cursor_t *cursor;
bson_iter_t iter;
client = Z_MANAGER_OBJ_P(manager)->client;
command = Z_COMMAND_OBJ_P(zcommand);
cursor = mongoc_client_command(client, db, MONGOC_QUERY_NONE, 0, 1, 0, command->bson, NULL, phongo_read_preference_from_zval(zreadPreference TSRMLS_CC));
if (server_id > 0 && !mongoc_cursor_set_hint(cursor, server_id)) {
phongo_throw_exception(PHONGO_ERROR_MONGOC_FAILED TSRMLS_CC, "%s", "Could not set cursor server_id");
return false;
}
if (!phongo_advance_cursor_and_check_for_error(cursor TSRMLS_CC)) {
return false;
}
if (!return_value_used) {
mongoc_cursor_destroy(cursor);
return true;
}
if (bson_iter_init_find(&iter, mongoc_cursor_current(cursor), "cursor") && BSON_ITER_HOLDS_DOCUMENT(&iter)) {
mongoc_cursor_t *cmd_cursor;
/* According to mongoc_cursor_new_from_command_reply(), the reply bson_t
* is ultimately destroyed on both success and failure. Use bson_copy()
* to create a writable copy of the const bson_t we fetched above. */
cmd_cursor = mongoc_cursor_new_from_command_reply(client, bson_copy(mongoc_cursor_current(cursor)), mongoc_cursor_get_hint(cursor));
mongoc_cursor_destroy(cursor);
if (!phongo_advance_cursor_and_check_for_error(cmd_cursor TSRMLS_CC)) {
return false;
}
phongo_cursor_init_for_command(return_value, manager, cmd_cursor, db, zcommand, zreadPreference TSRMLS_CC);
return true;
}
phongo_cursor_init_for_command(return_value, manager, cursor, db, zcommand, zreadPreference TSRMLS_CC);
return true;
} /* }}} */
/* }}} */
/* {{{ mongoc types from from_zval */
const mongoc_write_concern_t* phongo_write_concern_from_zval(zval *zwrite_concern TSRMLS_DC) /* {{{ */
{
if (zwrite_concern) {
php_phongo_writeconcern_t *intern = Z_WRITECONCERN_OBJ_P(zwrite_concern);
if (intern) {
return intern->write_concern;
}
}
return NULL;
} /* }}} */
const mongoc_read_concern_t* phongo_read_concern_from_zval(zval *zread_concern TSRMLS_DC) /* {{{ */
{
if (zread_concern) {
php_phongo_readconcern_t *intern = Z_READCONCERN_OBJ_P(zread_concern);
if (intern) {
return intern->read_concern;
}
}
return NULL;
} /* }}} */
const mongoc_read_prefs_t* phongo_read_preference_from_zval(zval *zread_preference TSRMLS_DC) /* {{{ */
{
if (zread_preference) {
php_phongo_readpreference_t *intern = Z_READPREFERENCE_OBJ_P(zread_preference);
if (intern) {
return intern->read_preference;
}
}
return NULL;
} /* }}} */
/* }}} */
/* {{{ phongo zval from mongoc types */
void php_phongo_cursor_id_new_from_id(zval *object, int64_t cursorid TSRMLS_DC) /* {{{ */
{
php_phongo_cursorid_t *intern;
object_init_ex(object, php_phongo_cursorid_ce);
intern = Z_CURSORID_OBJ_P(object);
intern->id = cursorid;
} /* }}} */
void php_phongo_objectid_new_from_oid(zval *object, const bson_oid_t *oid TSRMLS_DC) /* {{{ */
{
php_phongo_objectid_t *intern;
object_init_ex(object, php_phongo_objectid_ce);
intern = Z_OBJECTID_OBJ_P(object);
bson_oid_to_string(oid, intern->oid);
intern->initialized = true;
} /* }}} */
php_phongo_server_description_type_t php_phongo_server_description_type(mongoc_server_description_t *sd)
{
const char* name = mongoc_server_description_type(sd);
int i;
for (i = 0; i < PHONGO_SERVER_DESCRIPTION_TYPES; i++) {
if (!strcmp(name, php_phongo_server_description_type_map[i].name)) {
return php_phongo_server_description_type_map[i].type;
}
}
return PHONGO_SERVER_UNKNOWN;
}
void php_phongo_server_to_zval(zval *retval, mongoc_server_description_t *sd) /* {{{ */
{
mongoc_host_list_t *host = mongoc_server_description_host(sd);
const bson_t *is_master = mongoc_server_description_ismaster(sd);
bson_iter_t iter;
array_init(retval);
ADD_ASSOC_STRING(retval, "host", host->host);
ADD_ASSOC_LONG_EX(retval, "port", host->port);
ADD_ASSOC_LONG_EX(retval, "type", php_phongo_server_description_type(sd));
ADD_ASSOC_BOOL_EX(retval, "is_primary", !strcmp(mongoc_server_description_type(sd), php_phongo_server_description_type_map[PHONGO_SERVER_RS_PRIMARY].name));
ADD_ASSOC_BOOL_EX(retval, "is_secondary", !strcmp(mongoc_server_description_type(sd), php_phongo_server_description_type_map[PHONGO_SERVER_RS_SECONDARY].name));
ADD_ASSOC_BOOL_EX(retval, "is_arbiter", !strcmp(mongoc_server_description_type(sd), php_phongo_server_description_type_map[PHONGO_SERVER_RS_ARBITER].name));
ADD_ASSOC_BOOL_EX(retval, "is_hidden", bson_iter_init_find_case(&iter, is_master, "hidden") && bson_iter_as_bool(&iter));
ADD_ASSOC_BOOL_EX(retval, "is_passive", bson_iter_init_find_case(&iter, is_master, "passive") && bson_iter_as_bool(&iter));
if (bson_iter_init_find(&iter, is_master, "tags") && BSON_ITER_HOLDS_DOCUMENT(&iter)) {
const uint8_t *bytes;
uint32_t len;
php_phongo_bson_state state = PHONGO_BSON_STATE_INITIALIZER;
/* Use native arrays for debugging output */
state.map.root_type = PHONGO_TYPEMAP_NATIVE_ARRAY;
state.map.document_type = PHONGO_TYPEMAP_NATIVE_ARRAY;
bson_iter_document(&iter, &len, &bytes);
phongo_bson_to_zval_ex(bytes, len, &state);
#if PHP_VERSION_ID >= 70000
ADD_ASSOC_ZVAL_EX(retval, "tags", &state.zchild);
#else
ADD_ASSOC_ZVAL_EX(retval, "tags", state.zchild);
#endif
}
{
php_phongo_bson_state state = PHONGO_BSON_STATE_INITIALIZER;
/* Use native arrays for debugging output */
state.map.root_type = PHONGO_TYPEMAP_NATIVE_ARRAY;
state.map.document_type = PHONGO_TYPEMAP_NATIVE_ARRAY;
phongo_bson_to_zval_ex(bson_get_data(is_master), is_master->len, &state);
#if PHP_VERSION_ID >= 70000
ADD_ASSOC_ZVAL_EX(retval, "last_is_master", &state.zchild);
#else
ADD_ASSOC_ZVAL_EX(retval, "last_is_master", state.zchild);
#endif
}
ADD_ASSOC_LONG_EX(retval, "round_trip_time", (phongo_long) mongoc_server_description_round_trip_time(sd));
} /* }}} */
void php_phongo_read_concern_to_zval(zval *retval, const mongoc_read_concern_t *read_concern) /* {{{ */
{
const char *level = mongoc_read_concern_get_level(read_concern);
array_init_size(retval, 1);
if (level) {
ADD_ASSOC_STRING(retval, "level", level);
}
} /* }}} */
/* Prepare tagSets for BSON encoding by converting each array in the set to an
* object. This ensures that empty arrays will serialize as empty documents.
*
* php_phongo_read_preference_tags_are_valid() handles actual validation of the
* tag set structure. */
void php_phongo_read_preference_prep_tagsets(zval *tagSets TSRMLS_DC) /* {{{ */
{
HashTable *ht_data;
if (Z_TYPE_P(tagSets) != IS_ARRAY) {
return;
}
ht_data = HASH_OF(tagSets);
#if PHP_VERSION_ID >= 70000
{
zval *tagSet;
ZEND_HASH_FOREACH_VAL(ht_data, tagSet) {
ZVAL_DEREF(tagSet);
if (Z_TYPE_P(tagSet) == IS_ARRAY) {
SEPARATE_ZVAL_NOREF(tagSet);
convert_to_object(tagSet);
}
} ZEND_HASH_FOREACH_END();
}
#else
{
HashPosition pos;
zval **tagSet;
for (zend_hash_internal_pointer_reset_ex(ht_data, &pos);
zend_hash_get_current_data_ex(ht_data, (void **) &tagSet, &pos) == SUCCESS;
zend_hash_move_forward_ex(ht_data, &pos)) {
if (Z_TYPE_PP(tagSet) == IS_ARRAY) {
SEPARATE_ZVAL_IF_NOT_REF(tagSet);
convert_to_object(*tagSet);
}
}
}
#endif
return;
} /* }}} */
/* Checks if tags is valid to set on a mongoc_read_prefs_t. It may be null or an
* array of one or more documents. */
bool php_phongo_read_preference_tags_are_valid(const bson_t *tags) /* {{{ */
{
bson_iter_t iter;
if (bson_empty0(tags)) {
return true;
}
if (!bson_iter_init(&iter, tags)) {
return false;
}
while (bson_iter_next(&iter)) {
if (!BSON_ITER_HOLDS_DOCUMENT(&iter)) {
return false;
}
}
return true;
} /* }}} */
void php_phongo_read_preference_to_zval(zval *retval, const mongoc_read_prefs_t *read_prefs) /* {{{ */
{
const bson_t *tags = mongoc_read_prefs_get_tags(read_prefs);
mongoc_read_mode_t mode = mongoc_read_prefs_get_mode(read_prefs);
array_init_size(retval, 3);
switch (mode) {
case MONGOC_READ_PRIMARY: ADD_ASSOC_STRING(retval, "mode", "primary"); break;
case MONGOC_READ_PRIMARY_PREFERRED: ADD_ASSOC_STRING(retval, "mode", "primaryPreferred"); break;
case MONGOC_READ_SECONDARY: ADD_ASSOC_STRING(retval, "mode", "secondary"); break;
case MONGOC_READ_SECONDARY_PREFERRED: ADD_ASSOC_STRING(retval, "mode", "secondaryPreferred"); break;
case MONGOC_READ_NEAREST: ADD_ASSOC_STRING(retval, "mode", "nearest"); break;
default: /* Do nothing */
break;
}
if (!bson_empty0(tags)) {
/* Use PHONGO_TYPEMAP_NATIVE_ARRAY for the root type since tags is an
* array; however, inner documents and arrays can use the default. */
php_phongo_bson_state state = PHONGO_BSON_STATE_INITIALIZER;
state.map.root_type = PHONGO_TYPEMAP_NATIVE_ARRAY;
phongo_bson_to_zval_ex(bson_get_data(tags), tags->len, &state);
#if PHP_VERSION_ID >= 70000
ADD_ASSOC_ZVAL_EX(retval, "tags", &state.zchild);
#else
ADD_ASSOC_ZVAL_EX(retval, "tags", state.zchild);
#endif
}
if (mongoc_read_prefs_get_max_staleness_seconds(read_prefs) != MONGOC_NO_MAX_STALENESS) {
ADD_ASSOC_LONG_EX(retval, "maxStalenessSeconds", mongoc_read_prefs_get_max_staleness_seconds(read_prefs));
}
} /* }}} */
void php_phongo_write_concern_to_zval(zval *retval, const mongoc_write_concern_t *write_concern) /* {{{ */
{
const char *wtag = mongoc_write_concern_get_wtag(write_concern);
const int32_t w = mongoc_write_concern_get_w(write_concern);
const int32_t wtimeout = mongoc_write_concern_get_wtimeout(write_concern);
array_init_size(retval, 4);
if (wtag) {
ADD_ASSOC_STRING(retval, "w", wtag);
} else if (mongoc_write_concern_get_wmajority(write_concern)) {
ADD_ASSOC_STRING(retval, "w", PHONGO_WRITE_CONCERN_W_MAJORITY);
} else if (w != MONGOC_WRITE_CONCERN_W_DEFAULT) {
ADD_ASSOC_LONG_EX(retval, "w", w);
}
if (mongoc_write_concern_journal_is_set(write_concern)) {
ADD_ASSOC_BOOL_EX(retval, "j", mongoc_write_concern_get_journal(write_concern));
}
if (wtimeout != 0) {
ADD_ASSOC_LONG_EX(retval, "wtimeout", wtimeout);
}
} /* }}} */
/* }}} */
static mongoc_uri_t *php_phongo_make_uri(const char *uri_string, bson_t *options) /* {{{ */
{
bson_iter_t iter;
mongoc_uri_t *uri;
uri = mongoc_uri_new(uri_string);
MONGOC_DEBUG("Connection string: '%s'", uri_string);
if (!uri) {
return NULL;
}
if (options && bson_iter_init(&iter, options)) {
while (bson_iter_next (&iter)) {
const char *key = bson_iter_key(&iter);
/* Skip read preference and write concern options, as those must be
* processed after the mongoc_client_t is constructed. */
if (!strcasecmp(key, "journal") ||
!strcasecmp(key, "readpreference") ||
!strcasecmp(key, "readpreferencetags") ||
!strcasecmp(key, "safe") ||
!strcasecmp(key, "slaveok") ||
!strcasecmp(key, "w") ||
!strcasecmp(key, "wtimeoutms") ||
!strcasecmp(key, "maxstalenessseconds") ||
!strcasecmp(key, "appname")
) {
continue;
}
if (mongoc_uri_option_is_bool(key)) {
mongoc_uri_set_option_as_bool (uri, key, bson_iter_as_bool(&iter));
}
else if (mongoc_uri_option_is_int32(key) && BSON_ITER_HOLDS_INT32(&iter)) {
mongoc_uri_set_option_as_int32 (uri, key, bson_iter_int32 (&iter));
}
else if (mongoc_uri_option_is_utf8(key) && BSON_ITER_HOLDS_UTF8(&iter)) {
mongoc_uri_set_option_as_utf8(uri, key, bson_iter_utf8 (&iter, NULL));
}
else if (BSON_ITER_HOLDS_UTF8(&iter)) {
const char *value = bson_iter_utf8 (&iter, NULL);
if (!strcasecmp(key, "username")) {
mongoc_uri_set_username(uri, value);
} else if (!strcasecmp(key, "password")) {
mongoc_uri_set_password(uri, value);
} else if (!strcasecmp(key, "database")) {
mongoc_uri_set_database(uri, value);
} else if (!strcasecmp(key, "authsource")) {
mongoc_uri_set_auth_source(uri, value);
}
}
}
}
return uri;
} /* }}} */
static bool php_phongo_apply_rc_options_to_uri(mongoc_uri_t *uri, bson_t *options TSRMLS_DC) /* {{{ */
{
bson_iter_t iter;
mongoc_read_concern_t *new_rc;
const mongoc_read_concern_t *old_rc;
if (!(old_rc = mongoc_uri_get_read_concern(uri))) {
phongo_throw_exception(PHONGO_ERROR_MONGOC_FAILED TSRMLS_CC, "mongoc_uri_t does not have a read concern");
return false;
}
/* Return early if there are no options to apply */
if (bson_empty0(options)) {
return true;
}
if (!bson_iter_init_find_case(&iter, options, "readconcernlevel")) {
return true;
}
new_rc = mongoc_read_concern_copy(old_rc);
if (bson_iter_init_find_case(&iter, options, "readconcernlevel") && BSON_ITER_HOLDS_UTF8(&iter)) {
const char *str = bson_iter_utf8(&iter, NULL);
mongoc_read_concern_set_level(new_rc, str);
}
mongoc_uri_set_read_concern(uri, new_rc);
mongoc_read_concern_destroy(new_rc);
return true;
} /* }}} */
static bool php_phongo_apply_rp_options_to_uri(mongoc_uri_t *uri, bson_t *options TSRMLS_DC) /* {{{ */
{
bson_iter_t iter;
mongoc_read_prefs_t *new_rp;
const mongoc_read_prefs_t *old_rp;
if (!(old_rp = mongoc_uri_get_read_prefs_t(uri))) {
phongo_throw_exception(PHONGO_ERROR_MONGOC_FAILED TSRMLS_CC, "mongoc_uri_t does not have a read preference");
return false;
}
/* Return early if there are no options to apply */
if (bson_empty0(options)) {
return true;
}
if (!bson_iter_init_find_case(&iter, options, "slaveok") &&
!bson_iter_init_find_case(&iter, options, "readpreference") &&
!bson_iter_init_find_case(&iter, options, "readpreferencetags") &&
!bson_iter_init_find_case(&iter, options, "maxstalenessseconds")
) {
return true;
}
new_rp = mongoc_read_prefs_copy(old_rp);
- if (bson_iter_init_find_case(&iter, options, "slaveok") && BSON_ITER_HOLDS_BOOL(&iter)) {
+ if (bson_iter_init_find_case(&iter, options, "slaveok") && BSON_ITER_HOLDS_BOOL(&iter) && bson_iter_bool(&iter)) {
mongoc_read_prefs_set_mode(new_rp, MONGOC_READ_SECONDARY_PREFERRED);
}
if (bson_iter_init_find_case(&iter, options, "readpreference") && BSON_ITER_HOLDS_UTF8(&iter)) {
const char *str = bson_iter_utf8(&iter, NULL);
if (0 == strcasecmp("primary", str)) {
mongoc_read_prefs_set_mode(new_rp, MONGOC_READ_PRIMARY);
} else if (0 == strcasecmp("primarypreferred", str)) {
mongoc_read_prefs_set_mode(new_rp, MONGOC_READ_PRIMARY_PREFERRED);
} else if (0 == strcasecmp("secondary", str)) {
mongoc_read_prefs_set_mode(new_rp, MONGOC_READ_SECONDARY);
} else if (0 == strcasecmp("secondarypreferred", str)) {
mongoc_read_prefs_set_mode(new_rp, MONGOC_READ_SECONDARY_PREFERRED);
} else if (0 == strcasecmp("nearest", str)) {
mongoc_read_prefs_set_mode(new_rp, MONGOC_READ_NEAREST);
} else {
phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT TSRMLS_CC, "Unsupported readPreference value: '%s'", str);
mongoc_read_prefs_destroy(new_rp);
return false;
}
}
if (bson_iter_init_find_case(&iter, options, "readpreferencetags") && BSON_ITER_HOLDS_ARRAY(&iter)) {
bson_t tags;
uint32_t len;
const uint8_t *data;
bson_iter_array(&iter, &len, &data);
if (!bson_init_static(&tags, data, len)) {
phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT TSRMLS_CC, "Could not initialize BSON structure for read preference tags");
mongoc_read_prefs_destroy(new_rp);
return false;
}
if (!php_phongo_read_preference_tags_are_valid(&tags)) {
phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT TSRMLS_CC, "Read preference tags must be an array of zero or more documents");
mongoc_read_prefs_destroy(new_rp);
return false;
}
mongoc_read_prefs_set_tags(new_rp, &tags);
}
if (mongoc_read_prefs_get_mode(new_rp) == MONGOC_READ_PRIMARY &&
!bson_empty(mongoc_read_prefs_get_tags(new_rp))) {
phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT TSRMLS_CC, "Primary read preference mode conflicts with tags");
mongoc_read_prefs_destroy(new_rp);
return false;
}
/* Handle maxStalenessSeconds, and make sure it is not combined with primary
* readPreference */
if (bson_iter_init_find_case(&iter, options, "maxstalenessseconds") && BSON_ITER_HOLDS_INT32(&iter)) {
int32_t max_staleness_seconds = bson_iter_int32(&iter);
if (max_staleness_seconds != MONGOC_NO_MAX_STALENESS) {
if (max_staleness_seconds < MONGOC_SMALLEST_MAX_STALENESS_SECONDS) {
phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT TSRMLS_CC, "Expected maxStalenessSeconds to be >= %d, %" PRId32 " given", MONGOC_SMALLEST_MAX_STALENESS_SECONDS, max_staleness_seconds);
mongoc_read_prefs_destroy(new_rp);
return false;
}
/* max_staleness_seconds is fetched as an INT32, so there is no need to check
* if it exists INT32_MAX as we do in the ReadPreference constructor. */
if (mongoc_read_prefs_get_mode(new_rp) == MONGOC_READ_PRIMARY) {
phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT TSRMLS_CC, "Primary read preference mode conflicts with maxStalenessSeconds");
mongoc_read_prefs_destroy(new_rp);
return false;
}
}
mongoc_read_prefs_set_max_staleness_seconds(new_rp, max_staleness_seconds);
}
/* This may be redundant in light of the last check (primary with tags), but
* we'll check anyway in case additional validation is implemented. */
if (!mongoc_read_prefs_is_valid(new_rp)) {
phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT TSRMLS_CC, "Read preference is not valid");
mongoc_read_prefs_destroy(new_rp);
return false;
}
mongoc_uri_set_read_prefs_t(uri, new_rp);
mongoc_read_prefs_destroy(new_rp);
return true;
} /* }}} */
static bool php_phongo_apply_wc_options_to_uri(mongoc_uri_t *uri, bson_t *options TSRMLS_DC) /* {{{ */
{
bson_iter_t iter;
int32_t wtimeoutms;
mongoc_write_concern_t *new_wc;
const mongoc_write_concern_t *old_wc;
if (!(old_wc = mongoc_uri_get_write_concern(uri))) {
phongo_throw_exception(PHONGO_ERROR_MONGOC_FAILED TSRMLS_CC, "mongoc_uri_t does not have a write concern");
return false;
}
/* Return early if there are no options to apply */
if (bson_empty0(options)) {
return true;
}
if (!bson_iter_init_find_case(&iter, options, "journal") &&
!bson_iter_init_find_case(&iter, options, "safe") &&
!bson_iter_init_find_case(&iter, options, "w") &&
!bson_iter_init_find_case(&iter, options, "wtimeoutms")) {
return true;
}
wtimeoutms = mongoc_write_concern_get_wtimeout(old_wc);
new_wc = mongoc_write_concern_copy(old_wc);
if (bson_iter_init_find_case(&iter, options, "safe") && BSON_ITER_HOLDS_BOOL(&iter)) {
mongoc_write_concern_set_w(new_wc, bson_iter_bool(&iter) ? 1 : MONGOC_WRITE_CONCERN_W_UNACKNOWLEDGED);
}
if (bson_iter_init_find_case(&iter, options, "wtimeoutms") && BSON_ITER_HOLDS_INT32(&iter)) {
wtimeoutms = bson_iter_int32(&iter);
}
if (bson_iter_init_find_case(&iter, options, "journal") && BSON_ITER_HOLDS_BOOL(&iter)) {
mongoc_write_concern_set_journal(new_wc, bson_iter_bool(&iter));
}
if (bson_iter_init_find_case(&iter, options, "w")) {
if (BSON_ITER_HOLDS_INT32(&iter)) {
int32_t value = bson_iter_int32(&iter);
switch (value) {
case MONGOC_WRITE_CONCERN_W_ERRORS_IGNORED:
case MONGOC_WRITE_CONCERN_W_UNACKNOWLEDGED:
mongoc_write_concern_set_w(new_wc, value);
break;
default:
if (value > 0) {
mongoc_write_concern_set_w(new_wc, value);
break;
}
phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT TSRMLS_CC, "Unsupported w value: %d", value);
mongoc_write_concern_destroy(new_wc);
return false;
}
} else if (BSON_ITER_HOLDS_UTF8(&iter)) {
const char *str = bson_iter_utf8(&iter, NULL);
if (0 == strcasecmp(PHONGO_WRITE_CONCERN_W_MAJORITY, str)) {
mongoc_write_concern_set_wmajority(new_wc, wtimeoutms);
} else {
mongoc_write_concern_set_wtag(new_wc, str);
}
}
}
/* Only set wtimeout if it's still applicable; otherwise, clear it. */
if (mongoc_write_concern_get_w(new_wc) > 1 ||
mongoc_write_concern_get_wmajority(new_wc) ||
mongoc_write_concern_get_wtag(new_wc)) {
mongoc_write_concern_set_wtimeout(new_wc, wtimeoutms);
} else {
mongoc_write_concern_set_wtimeout(new_wc, 0);
}
if (mongoc_write_concern_get_journal(new_wc)) {
int32_t w = mongoc_write_concern_get_w(new_wc);
if (w == MONGOC_WRITE_CONCERN_W_UNACKNOWLEDGED || w == MONGOC_WRITE_CONCERN_W_ERRORS_IGNORED) {
phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT TSRMLS_CC, "Journal conflicts with w value: %d", w);
mongoc_write_concern_destroy(new_wc);
return false;
}
}
/* This may be redundant in light of the last check (unacknowledged w with
journal), but we'll check anyway in case additional validation is
implemented. */
if (!mongoc_write_concern_is_valid(new_wc)) {
phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT TSRMLS_CC, "Write concern is not valid");
mongoc_write_concern_destroy(new_wc);
return false;
}
mongoc_uri_set_write_concern(uri, new_wc);
mongoc_write_concern_destroy(new_wc);
return true;
} /* }}} */
static inline char *php_phongo_fetch_ssl_opt_string(zval *zoptions, const char *key, int key_len)
{
int plen;
zend_bool pfree;
char *pval, *value;
pval = php_array_fetchl_string(zoptions, key, key_len, &plen, &pfree);
value = pfree ? pval : estrndup(pval, plen);
return value;
}
static mongoc_ssl_opt_t *php_phongo_make_ssl_opt(zval *zoptions TSRMLS_DC)
{
mongoc_ssl_opt_t *ssl_opt;
if (!zoptions) {
return NULL;
}
#if defined(MONGOC_ENABLE_SSL_SECURE_CHANNEL) || defined(MONGOC_ENABLE_SSL_SECURE_TRANSPORT)
if (php_array_existsc(zoptions, "ca_dir")) {
phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT TSRMLS_CC, "\"ca_dir\" option is not supported by Secure Channel and Secure Transport");
return NULL;
}
if (php_array_existsc(zoptions, "capath")) {
phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT TSRMLS_CC, "\"capath\" option is not supported by Secure Channel and Secure Transport");
return NULL;
}
#endif
#if defined(MONGOC_ENABLE_SSL_LIBRESSL) || defined(MONGOC_ENABLE_SSL_SECURE_TRANSPORT)
if (php_array_existsc(zoptions, "crl_file")) {
phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT TSRMLS_CC, "\"crl_file\" option is not supported by LibreSSL and Secure Transport");
return NULL;
}
#endif
ssl_opt = ecalloc(1, sizeof(mongoc_ssl_opt_t));
/* Check canonical option names first and fall back to SSL context options
* for backwards compatibility. */
if (php_array_existsc(zoptions, "allow_invalid_hostname")) {
ssl_opt->allow_invalid_hostname = php_array_fetchc_bool(zoptions, "allow_invalid_hostname");
}
if (php_array_existsc(zoptions, "weak_cert_validation")) {
ssl_opt->weak_cert_validation = php_array_fetchc_bool(zoptions, "weak_cert_validation");
} else if (php_array_existsc(zoptions, "allow_self_signed")) {
ssl_opt->weak_cert_validation = php_array_fetchc_bool(zoptions, "allow_self_signed");
}
if (php_array_existsc(zoptions, "pem_file")) {
ssl_opt->pem_file = php_phongo_fetch_ssl_opt_string(zoptions, ZEND_STRL("pem_file"));
} else if (php_array_existsc(zoptions, "local_cert")) {
ssl_opt->pem_file = php_phongo_fetch_ssl_opt_string(zoptions, ZEND_STRL("local_cert"));
}
if (php_array_existsc(zoptions, "pem_pwd")) {
ssl_opt->pem_pwd = php_phongo_fetch_ssl_opt_string(zoptions, ZEND_STRL("pem_pwd"));
} else if (php_array_existsc(zoptions, "passphrase")) {
ssl_opt->pem_pwd = php_phongo_fetch_ssl_opt_string(zoptions, ZEND_STRL("passphrase"));
}
if (php_array_existsc(zoptions, "ca_file")) {
ssl_opt->ca_file = php_phongo_fetch_ssl_opt_string(zoptions, ZEND_STRL("ca_file"));
} else if (php_array_existsc(zoptions, "cafile")) {
ssl_opt->ca_file = php_phongo_fetch_ssl_opt_string(zoptions, ZEND_STRL("cafile"));
}
if (php_array_existsc(zoptions, "ca_dir")) {
ssl_opt->ca_dir = php_phongo_fetch_ssl_opt_string(zoptions, ZEND_STRL("ca_dir"));
} else if (php_array_existsc(zoptions, "capath")) {
ssl_opt->ca_dir = php_phongo_fetch_ssl_opt_string(zoptions, ZEND_STRL("capath"));
}
if (php_array_existsc(zoptions, "crl_file")) {
ssl_opt->crl_file = php_phongo_fetch_ssl_opt_string(zoptions, ZEND_STRL("crl_file"));
}
return ssl_opt;
}
static void php_phongo_free_ssl_opt(mongoc_ssl_opt_t *ssl_opt)
{
if (ssl_opt->pem_file) {
str_efree(ssl_opt->pem_file);
}
if (ssl_opt->pem_pwd) {
str_efree(ssl_opt->pem_pwd);
}
if (ssl_opt->ca_file) {
str_efree(ssl_opt->ca_file);
}
if (ssl_opt->ca_dir) {
str_efree(ssl_opt->ca_dir);
}
if (ssl_opt->crl_file) {
str_efree(ssl_opt->crl_file);
}
efree(ssl_opt);
}
/* Creates a hash for a client by concatenating the URI string with serialized
* options arrays. On success, a persistent string is returned (i.e. pefree()
* should be used to free it) and hash_len will be set to the string's length.
* On error, an exception will have been thrown and NULL will be returned. */
static char *php_phongo_manager_make_client_hash(const char *uri_string, zval *options, zval *driverOptions, size_t *hash_len TSRMLS_DC)
{
char *hash = NULL;
smart_str var_buf = {0};
php_serialize_data_t var_hash;
#if PHP_VERSION_ID >= 70000
zval args;
- array_init_size(&args, 3);
+ array_init_size(&args, 4);
+ ADD_ASSOC_LONG_EX(&args, "pid", getpid());
ADD_ASSOC_STRING(&args, "uri", uri_string);
if (options) {
ADD_ASSOC_ZVAL_EX(&args, "options", options);
Z_ADDREF_P(options);
} else {
ADD_ASSOC_NULL_EX(&args, "options");
}
if (driverOptions) {
ADD_ASSOC_ZVAL_EX(&args, "driverOptions", driverOptions);
Z_ADDREF_P(driverOptions);
} else {
ADD_ASSOC_NULL_EX(&args, "driverOptions");
}
PHP_VAR_SERIALIZE_INIT(var_hash);
php_var_serialize(&var_buf, &args, &var_hash);
PHP_VAR_SERIALIZE_DESTROY(var_hash);
if (!EG(exception)) {
*hash_len = ZSTR_LEN(var_buf.s);
hash = pestrndup(ZSTR_VAL(var_buf.s), *hash_len, 1);
}
zval_ptr_dtor(&args);
#else
zval *args;
MAKE_STD_ZVAL(args);
- array_init_size(args, 3);
+ array_init_size(args, 4);
+ ADD_ASSOC_LONG_EX(args, "pid", getpid());
ADD_ASSOC_STRING(args, "uri", uri_string);
if (options) {
ADD_ASSOC_ZVAL_EX(args, "options", options);
Z_ADDREF_P(options);
} else {
ADD_ASSOC_NULL_EX(args, "options");
}
if (driverOptions) {
ADD_ASSOC_ZVAL_EX(args, "driverOptions", driverOptions);
Z_ADDREF_P(driverOptions);
} else {
ADD_ASSOC_NULL_EX(args, "driverOptions");
}
PHP_VAR_SERIALIZE_INIT(var_hash);
php_var_serialize(&var_buf, &args, &var_hash TSRMLS_CC);
PHP_VAR_SERIALIZE_DESTROY(var_hash);
if (!EG(exception)) {
*hash_len = var_buf.len;
hash = pestrndup(var_buf.c, *hash_len, 1);
}
zval_ptr_dtor(&args);
#endif
smart_str_free(&var_buf);
return hash;
}
static mongoc_client_t *php_phongo_make_mongo_client(const mongoc_uri_t *uri, mongoc_ssl_opt_t *ssl_opt TSRMLS_DC) /* {{{ */
{
const char *mongoc_version, *bson_version;
mongoc_client_t *client;
#ifdef HAVE_SYSTEM_LIBMONGOC
mongoc_version = mongoc_get_version();
#else
mongoc_version = "bundled";
#endif
#ifdef HAVE_SYSTEM_LIBBSON
bson_version = bson_get_version();
#else
bson_version = "bundled";
#endif
MONGOC_DEBUG("Creating Manager, phongo-%s[%s] - mongoc-%s(%s), libbson-%s(%s), php-%s",
- MONGODB_VERSION_S,
- MONGODB_STABILITY_S,
+ PHP_MONGODB_VERSION,
+ PHP_MONGODB_STABILITY,
MONGOC_VERSION_S,
mongoc_version,
BSON_VERSION_S,
bson_version,
PHP_VERSION
);
client = mongoc_client_new_from_uri(uri);
if (!client) {
return NULL;
}
if (mongoc_uri_get_ssl(uri) && ssl_opt) {
mongoc_client_set_ssl_opts(client, ssl_opt);
}
return client;
} /* }}} */
+static void php_phongo_persist_client(const char *hash, size_t hash_len, mongoc_client_t *client TSRMLS_DC)
+{
+ php_phongo_pclient_t *pclient = (php_phongo_pclient_t *) pecalloc(1, sizeof(php_phongo_pclient_t), 1);
+
+ pclient->pid = (int) getpid();
+ pclient->client = client;
+
+#if PHP_VERSION_ID >= 70000
+ zend_hash_str_update_ptr(&MONGODB_G(pclients), hash, hash_len, pclient);
+#else
+ zend_hash_update(&MONGODB_G(pclients), hash, hash_len + 1, &pclient, sizeof(php_phongo_pclient_t *), NULL);
+#endif
+}
+
+static mongoc_client_t *php_phongo_find_client(const char *hash, size_t hash_len TSRMLS_DC)
+{
+#if PHP_VERSION_ID >= 70000
+ php_phongo_pclient_t *pclient;
+
+ if ((pclient = zend_hash_str_find_ptr(&MONGODB_G(pclients), hash, hash_len)) != NULL) {
+ return pclient->client;
+ }
+#else
+ php_phongo_pclient_t **pclient;
+
+ if (zend_hash_find(&MONGODB_G(pclients), hash, hash_len + 1, (void**) &pclient) == SUCCESS) {
+ return (*pclient)->client;
+ }
+#endif
+
+ return NULL;
+}
+
void phongo_manager_init(php_phongo_manager_t *manager, const char *uri_string, zval *options, zval *driverOptions TSRMLS_DC) /* {{{ */
{
char *hash = NULL;
size_t hash_len = 0;
bson_t bson_options = BSON_INITIALIZER;
mongoc_uri_t *uri = NULL;
mongoc_ssl_opt_t *ssl_opt = NULL;
bson_iter_t iter;
-#if PHP_VERSION_ID >= 70000
- mongoc_client_t *client_ptr;
-#else
- mongoc_client_t **client_ptr;
-#endif
-
if (!(hash = php_phongo_manager_make_client_hash(uri_string, options, driverOptions, &hash_len TSRMLS_CC))) {
/* Exception should already have been thrown and there is nothing to free */
return;
}
-#if PHP_VERSION_ID >= 70000
- if ((client_ptr = zend_hash_str_find_ptr(&MONGODB_G(clients), hash, hash_len)) != NULL) {
- MONGOC_DEBUG("Found client for hash: %s\n", hash);
- manager->client = client_ptr;
- goto cleanup;
- }
-#else
- if (zend_hash_find(&MONGODB_G(clients), hash, hash_len + 1, (void**) &client_ptr) == SUCCESS) {
+ if ((manager->client = php_phongo_find_client(hash, hash_len TSRMLS_CC))) {
MONGOC_DEBUG("Found client for hash: %s\n", hash);
- manager->client = *client_ptr;
goto cleanup;
}
-#endif
if (options) {
phongo_zval_to_bson(options, PHONGO_BSON_NONE, &bson_options, NULL TSRMLS_CC);
}
/* An exception may be thrown during BSON conversion */
if (EG(exception)) {
goto cleanup;
}
if (!(uri = php_phongo_make_uri(uri_string, &bson_options))) {
phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT TSRMLS_CC, "Failed to parse MongoDB URI: '%s'", uri_string);
goto cleanup;
}
if (!php_phongo_apply_rc_options_to_uri(uri, &bson_options TSRMLS_CC) ||
!php_phongo_apply_rp_options_to_uri(uri, &bson_options TSRMLS_CC) ||
!php_phongo_apply_wc_options_to_uri(uri, &bson_options TSRMLS_CC)) {
/* Exception should already have been thrown */
goto cleanup;
}
if (bson_iter_init_find_case(&iter, &bson_options, "appname") && BSON_ITER_HOLDS_UTF8(&iter)) {
const char *str = bson_iter_utf8(&iter, NULL);
if (!mongoc_uri_set_appname(uri, str)) {
phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT TSRMLS_CC, "Invalid appname value: '%s'", str);
goto cleanup;
}
}
ssl_opt = php_phongo_make_ssl_opt(driverOptions TSRMLS_CC);
/* An exception may be thrown during SSL option creation */
if (EG(exception)) {
goto cleanup;
}
manager->client = php_phongo_make_mongo_client(uri, ssl_opt TSRMLS_CC);
if (!manager->client) {
phongo_throw_exception(PHONGO_ERROR_RUNTIME TSRMLS_CC, "Failed to create Manager from URI: '%s'", uri_string);
goto cleanup;
}
MONGOC_DEBUG("Created client hash: %s\n", hash);
-#if PHP_VERSION_ID >= 70000
- zend_hash_str_update_ptr(&MONGODB_G(clients), hash, hash_len, manager->client);
-#else
- zend_hash_update(&MONGODB_G(clients), hash, hash_len + 1, &manager->client, sizeof(mongoc_client_t *), NULL);
-#endif
+ php_phongo_persist_client(hash, hash_len, manager->client TSRMLS_CC);
cleanup:
if (hash) {
pefree(hash, 1);
}
bson_destroy(&bson_options);
if (uri) {
mongoc_uri_destroy(uri);
}
if (ssl_opt) {
php_phongo_free_ssl_opt(ssl_opt);
}
} /* }}} */
void php_phongo_new_utcdatetime_from_epoch(zval *object, int64_t msec_since_epoch TSRMLS_DC) /* {{{ */
{
php_phongo_utcdatetime_t *intern;
object_init_ex(object, php_phongo_utcdatetime_ce);
intern = Z_UTCDATETIME_OBJ_P(object);
intern->milliseconds = msec_since_epoch;
intern->initialized = true;
} /* }}} */
void php_phongo_new_timestamp_from_increment_and_timestamp(zval *object, uint32_t increment, uint32_t timestamp TSRMLS_DC) /* {{{ */
{
php_phongo_timestamp_t *intern;
object_init_ex(object, php_phongo_timestamp_ce);
intern = Z_TIMESTAMP_OBJ_P(object);
intern->increment = increment;
intern->timestamp = timestamp;
intern->initialized = true;
} /* }}} */
void php_phongo_new_javascript_from_javascript(int init, zval *object, const char *code, size_t code_len TSRMLS_DC) /* {{{ */
{
php_phongo_new_javascript_from_javascript_and_scope(init, object, code, code_len, NULL TSRMLS_CC);
} /* }}} */
void php_phongo_new_javascript_from_javascript_and_scope(int init, zval *object, const char *code, size_t code_len, const bson_t *scope TSRMLS_DC) /* {{{ */
{
php_phongo_javascript_t *intern;
if (init) {
object_init_ex(object, php_phongo_javascript_ce);
}
intern = Z_JAVASCRIPT_OBJ_P(object);
intern->code = estrndup(code, code_len);
intern->code_len = code_len;
intern->scope = scope ? bson_copy(scope) : NULL;
} /* }}} */
void php_phongo_new_binary_from_binary_and_type(zval *object, const char *data, size_t data_len, bson_subtype_t type TSRMLS_DC) /* {{{ */
{
php_phongo_binary_t *intern;
object_init_ex(object, php_phongo_binary_ce);
intern = Z_BINARY_OBJ_P(object);
intern->data = estrndup(data, data_len);
intern->data_len = data_len;
intern->type = (uint8_t) type;
} /* }}} */
void php_phongo_new_decimal128(zval *object, const bson_decimal128_t *decimal TSRMLS_DC) /* {{{ */
{
php_phongo_decimal128_t *intern;
object_init_ex(object, php_phongo_decimal128_ce);
intern = Z_DECIMAL128_OBJ_P(object);
memcpy(&intern->decimal, decimal, sizeof(bson_decimal128_t));
intern->initialized = true;
} /* }}} */
/* qsort() compare callback for alphabetizing regex flags upon initialization */
static int php_phongo_regex_compare_flags(const void *f1, const void *f2) {
if (* (const char *) f1 == * (const char *) f2) {
return 0;
}
return (* (const char *) f1 > * (const char *) f2) ? 1 : -1;
}
void php_phongo_new_regex_from_regex_and_options(zval *object, const char *pattern, const char *flags TSRMLS_DC) /* {{{ */
{
php_phongo_regex_t *intern;
object_init_ex(object, php_phongo_regex_ce);
intern = Z_REGEX_OBJ_P(object);
intern->pattern_len = strlen(pattern);
intern->pattern = estrndup(pattern, intern->pattern_len);
intern->flags_len = strlen(flags);
intern->flags = estrndup(flags, intern->flags_len);
/* Ensure flags are alphabetized upon initialization. This may be removed
* once CDRIVER-1883 is implemented. */
qsort((void *) intern->flags, intern->flags_len, 1, php_phongo_regex_compare_flags);
} /* }}} */
/* {{{ Memory allocation wrappers */
static void* php_phongo_malloc(size_t num_bytes) /* {{{ */
{
return pemalloc(num_bytes, 1);
} /* }}} */
static void* php_phongo_calloc(size_t num_members, size_t num_bytes) /* {{{ */
{
return pecalloc(num_members, num_bytes, 1);
} /* }}} */
static void* php_phongo_realloc(void *mem, size_t num_bytes) { /* {{{ */
return perealloc(mem, num_bytes, 1);
} /* }}} */
static void php_phongo_free(void *mem) /* {{{ */
{
if (mem) {
pefree(mem, 1);
}
} /* }}} */
/* }}} */
#ifdef PHP_DEBUG
/* LCOV_EXCL_START */
void _phongo_debug_bson(bson_t *bson)
{
char *str;
size_t str_len;
str = bson_as_json(bson, &str_len);
php_printf("JSON: %s\n", str);
bson_free(str);
}
/* LCOV_EXCL_STOP */
#endif
/* {{{ M[INIT|SHUTDOWN] R[INIT|SHUTDOWN] G[INIT|SHUTDOWN] MINFO INI */
ZEND_INI_MH(OnUpdateDebug)
{
void ***ctx = NULL;
char *tmp_dir = NULL;
TSRMLS_SET_CTX(ctx);
/* Close any previously open log files */
if (MONGODB_G(debug_fd)) {
if (MONGODB_G(debug_fd) != stderr && MONGODB_G(debug_fd) != stdout) {
fclose(MONGODB_G(debug_fd));
}
MONGODB_G(debug_fd) = NULL;
}
if (!new_value || (new_value && !ZSTR_VAL(new_value)[0])
|| strcasecmp("0", ZSTR_VAL(new_value)) == 0
|| strcasecmp("off", ZSTR_VAL(new_value)) == 0
|| strcasecmp("no", ZSTR_VAL(new_value)) == 0
|| strcasecmp("false", ZSTR_VAL(new_value)) == 0
) {
mongoc_log_trace_disable();
mongoc_log_set_handler(NULL, NULL);
#if PHP_VERSION_ID >= 70000
return OnUpdateString(entry, new_value, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC);
#else
return OnUpdateString(entry, new_value, new_value_length, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC);
#endif
}
if (strcasecmp(ZSTR_VAL(new_value), "stderr") == 0) {
MONGODB_G(debug_fd) = stderr;
} else if (strcasecmp(ZSTR_VAL(new_value), "stdout") == 0) {
MONGODB_G(debug_fd) = stdout;
} else if (
strcasecmp("1", ZSTR_VAL(new_value)) == 0
|| strcasecmp("on", ZSTR_VAL(new_value)) == 0
|| strcasecmp("yes", ZSTR_VAL(new_value)) == 0
|| strcasecmp("true", ZSTR_VAL(new_value)) == 0
) {
tmp_dir = NULL;
} else {
tmp_dir = ZSTR_VAL(new_value);
}
if (!MONGODB_G(debug_fd)) {
time_t t;
int fd = -1;
char *prefix;
int len;
phongo_char *filename;
time(&t);
len = spprintf(&prefix, 0, "PHONGO-%ld", t);
fd = php_open_temporary_fd(tmp_dir, prefix, &filename TSRMLS_CC);
if (fd != -1) {
const char *path = ZSTR_VAL(filename);
MONGODB_G(debug_fd) = VCWD_FOPEN(path, "a");
}
efree(filename);
efree(prefix);
close(fd);
}
mongoc_log_trace_enable();
mongoc_log_set_handler(php_phongo_log, ctx);
#if PHP_VERSION_ID >= 70000
return OnUpdateString(entry, new_value, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC);
#else
return OnUpdateString(entry, new_value, new_value_length, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC);
#endif
}
/* {{{ INI entries */
PHP_INI_BEGIN()
#if PHP_VERSION_ID >= 70000
STD_PHP_INI_ENTRY(PHONGO_DEBUG_INI, PHONGO_DEBUG_INI_DEFAULT, PHP_INI_ALL, OnUpdateDebug, debug, zend_mongodb_globals, mongodb_globals)
#else
{ 0, PHP_INI_ALL, (char *)PHONGO_DEBUG_INI, sizeof(PHONGO_DEBUG_INI), OnUpdateDebug, (void *) XtOffsetOf(zend_mongodb_globals, debug), (void *) &mglo, NULL, (char *)PHONGO_DEBUG_INI_DEFAULT, sizeof(PHONGO_DEBUG_INI_DEFAULT)-1, NULL, 0, 0, 0, NULL },
#endif
PHP_INI_END()
/* }}} */
+static inline void php_phongo_pclient_destroy(php_phongo_pclient_t *pclient)
+{
+ /* Do not destroy mongoc_client_t objects created by other processes. This
+ * ensures that we do not shutdown sockets that may still be in use by our
+ * parent process (see: CDRIVER-2049). While this is a leak, we are already
+ * in MSHUTDOWN at this point. */
+ if (pclient->pid == getpid()) {
+ mongoc_client_destroy(pclient->client);
+ }
+
+ pefree(pclient, 1);
+}
+
#if PHP_VERSION_ID >= 70000
-static void php_phongo_client_dtor(zval *zv)
+static void php_phongo_pclient_dtor(zval *zv)
{
- mongoc_client_destroy((mongoc_client_t *) Z_PTR_P(zv));
+ php_phongo_pclient_destroy((php_phongo_pclient_t *) Z_PTR_P(zv));
}
#else
-static void php_phongo_client_dtor(void *client)
+static void php_phongo_pclient_dtor(void *pp)
{
- mongoc_client_destroy(*((mongoc_client_t **) client));
+ php_phongo_pclient_destroy(*((php_phongo_pclient_t **) pp));
}
#endif
/* {{{ PHP_GINIT_FUNCTION */
PHP_GINIT_FUNCTION(mongodb)
{
bson_mem_vtable_t bsonMemVTable = {
php_phongo_malloc,
php_phongo_calloc,
php_phongo_realloc,
php_phongo_free,
};
#if PHP_VERSION_ID >= 70000
#if defined(COMPILE_DL_MONGODB) && defined(ZTS)
ZEND_TSRMLS_CACHE_UPDATE();
#endif
#endif
memset(mongodb_globals, 0, sizeof(zend_mongodb_globals));
mongodb_globals->bsonMemVTable = bsonMemVTable;
/* Initialize HashTable for persistent clients */
- zend_hash_init_ex(&mongodb_globals->clients, 0, NULL, php_phongo_client_dtor, 1, 0);
+ zend_hash_init_ex(&mongodb_globals->pclients, 0, NULL, php_phongo_pclient_dtor, 1, 0);
}
/* }}} */
static zend_class_entry *php_phongo_fetch_internal_class(const char *class_name, size_t class_name_len TSRMLS_DC)
{
#if PHP_VERSION_ID >= 70000
zend_class_entry *pce;
if ((pce = zend_hash_str_find_ptr(CG(class_table), class_name, class_name_len))) {
return pce;
}
#else
zend_class_entry **pce;
if (zend_hash_find(CG(class_table), class_name, class_name_len + 1, (void **) &pce) == SUCCESS) {
return *pce;
}
#endif
return NULL;
}
/* {{{ PHP_MINIT_FUNCTION */
PHP_MINIT_FUNCTION(mongodb)
{
char *php_version_string;
(void)type; /* We don't care if we are loaded via dl() or extension= */
REGISTER_INI_ENTRIES();
/* Initialize libmongoc */
mongoc_init();
/* Set handshake options */
php_version_string = malloc(4 + sizeof(PHP_VERSION) + 1);
snprintf(php_version_string, 4 + sizeof(PHP_VERSION) + 1, "PHP %s", PHP_VERSION);
- mongoc_handshake_data_append("ext-mongodb:PHP", MONGODB_VERSION_S, php_version_string);
+ mongoc_handshake_data_append("ext-mongodb:PHP", PHP_MONGODB_VERSION, php_version_string);
free(php_version_string);
/* Initialize libbson */
bson_mem_set_vtable(&MONGODB_G(bsonMemVTable));
/* Prep default object handlers to be used when we register the classes */
memcpy(&phongo_std_object_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers));
phongo_std_object_handlers.clone_obj = NULL;
/*
phongo_std_object_handlers.get_debug_info = NULL;
phongo_std_object_handlers.compare_objects = NULL;
phongo_std_object_handlers.cast_object = NULL;
phongo_std_object_handlers.count_elements = NULL;
phongo_std_object_handlers.get_closure = NULL;
*/
/* Initialize zend_class_entry dependencies.
*
* Although DateTimeImmutable was introduced in PHP 5.5.0,
* php_date_get_immutable_ce() is not available in PHP versions before
* 5.5.24 and 5.6.8.
*
* Although JsonSerializable was introduced in PHP 5.4.0,
* php_json_serializable_ce is not exported in PHP versions before 5.4.26
* and 5.5.10. For later PHP versions, looking up the class manually also
* helps with distros that disable LTDL_LAZY for dlopen() (e.g. Fedora).
*/
php_phongo_date_immutable_ce = php_phongo_fetch_internal_class(ZEND_STRL("datetimeimmutable") TSRMLS_CC);
php_phongo_json_serializable_ce = php_phongo_fetch_internal_class(ZEND_STRL("jsonserializable") TSRMLS_CC);
if (php_phongo_json_serializable_ce == NULL) {
zend_error(E_ERROR, "JsonSerializable class is not defined. Please ensure that the 'json' module is loaded before the 'mongodb' module.");
return FAILURE;
}
PHP_MINIT(bson)(INIT_FUNC_ARGS_PASSTHRU);
PHP_MINIT(Type)(INIT_FUNC_ARGS_PASSTHRU);
PHP_MINIT(Serializable)(INIT_FUNC_ARGS_PASSTHRU);
PHP_MINIT(Unserializable)(INIT_FUNC_ARGS_PASSTHRU);
PHP_MINIT(Persistable)(INIT_FUNC_ARGS_PASSTHRU);
PHP_MINIT(Binary)(INIT_FUNC_ARGS_PASSTHRU);
PHP_MINIT(Decimal128)(INIT_FUNC_ARGS_PASSTHRU);
PHP_MINIT(Javascript)(INIT_FUNC_ARGS_PASSTHRU);
PHP_MINIT(MaxKey)(INIT_FUNC_ARGS_PASSTHRU);
PHP_MINIT(MinKey)(INIT_FUNC_ARGS_PASSTHRU);
PHP_MINIT(ObjectID)(INIT_FUNC_ARGS_PASSTHRU);
PHP_MINIT(Regex)(INIT_FUNC_ARGS_PASSTHRU);
PHP_MINIT(Timestamp)(INIT_FUNC_ARGS_PASSTHRU);
PHP_MINIT(UTCDateTime)(INIT_FUNC_ARGS_PASSTHRU);
PHP_MINIT(Command)(INIT_FUNC_ARGS_PASSTHRU);
PHP_MINIT(Cursor)(INIT_FUNC_ARGS_PASSTHRU);
PHP_MINIT(CursorId)(INIT_FUNC_ARGS_PASSTHRU);
PHP_MINIT(Manager)(INIT_FUNC_ARGS_PASSTHRU);
PHP_MINIT(Query)(INIT_FUNC_ARGS_PASSTHRU);
PHP_MINIT(ReadConcern)(INIT_FUNC_ARGS_PASSTHRU);
PHP_MINIT(ReadPreference)(INIT_FUNC_ARGS_PASSTHRU);
PHP_MINIT(Server)(INIT_FUNC_ARGS_PASSTHRU);
PHP_MINIT(BulkWrite)(INIT_FUNC_ARGS_PASSTHRU);
PHP_MINIT(WriteConcern)(INIT_FUNC_ARGS_PASSTHRU);
PHP_MINIT(WriteConcernError)(INIT_FUNC_ARGS_PASSTHRU);
PHP_MINIT(WriteError)(INIT_FUNC_ARGS_PASSTHRU);
PHP_MINIT(WriteResult)(INIT_FUNC_ARGS_PASSTHRU);
PHP_MINIT(Exception)(INIT_FUNC_ARGS_PASSTHRU);
PHP_MINIT(LogicException)(INIT_FUNC_ARGS_PASSTHRU);
PHP_MINIT(RuntimeException)(INIT_FUNC_ARGS_PASSTHRU);
PHP_MINIT(UnexpectedValueException)(INIT_FUNC_ARGS_PASSTHRU);
PHP_MINIT(InvalidArgumentException)(INIT_FUNC_ARGS_PASSTHRU);
PHP_MINIT(ConnectionException)(INIT_FUNC_ARGS_PASSTHRU);
PHP_MINIT(AuthenticationException)(INIT_FUNC_ARGS_PASSTHRU);
PHP_MINIT(SSLConnectionException)(INIT_FUNC_ARGS_PASSTHRU);
PHP_MINIT(WriteException)(INIT_FUNC_ARGS_PASSTHRU);
PHP_MINIT(BulkWriteException)(INIT_FUNC_ARGS_PASSTHRU);
PHP_MINIT(ExecutionTimeoutException)(INIT_FUNC_ARGS_PASSTHRU);
PHP_MINIT(ConnectionTimeoutException)(INIT_FUNC_ARGS_PASSTHRU);
- REGISTER_STRING_CONSTANT("MONGODB_VERSION", (char *)MONGODB_VERSION_S, CONST_CS | CONST_PERSISTENT);
- REGISTER_STRING_CONSTANT("MONGODB_STABILITY", (char *)MONGODB_STABILITY_S, CONST_CS | CONST_PERSISTENT);
+ REGISTER_STRING_CONSTANT("MONGODB_VERSION", (char *)PHP_MONGODB_VERSION, CONST_CS | CONST_PERSISTENT);
+ REGISTER_STRING_CONSTANT("MONGODB_STABILITY", (char *)PHP_MONGODB_STABILITY, CONST_CS | CONST_PERSISTENT);
return SUCCESS;
}
/* }}} */
/* {{{ PHP_MSHUTDOWN_FUNCTION */
PHP_MSHUTDOWN_FUNCTION(mongodb)
{
(void)type; /* We don't care if we are loaded via dl() or extension= */
/* Destroy HashTable for persistent clients. The HashTable destructor will
- * destroy any mongoc_client_t objects contained within. */
- zend_hash_destroy(&MONGODB_G(clients));
+ * destroy any mongoc_client_t objects that were created by this process. */
+ zend_hash_destroy(&MONGODB_G(pclients));
bson_mem_restore_vtable();
/* Cleanup after libmongoc */
mongoc_cleanup();
UNREGISTER_INI_ENTRIES();
return SUCCESS;
}
/* }}} */
/* {{{ PHP_GSHUTDOWN_FUNCTION */
PHP_GSHUTDOWN_FUNCTION(mongodb)
{
mongodb_globals->debug = NULL;
if (mongodb_globals->debug_fd) {
fclose(mongodb_globals->debug_fd);
mongodb_globals->debug_fd = NULL;
}
}
/* }}} */
/* {{{ PHP_MINFO_FUNCTION */
PHP_MINFO_FUNCTION(mongodb)
{
php_info_print_table_start();
php_info_print_table_header(2, "MongoDB support", "enabled");
- php_info_print_table_row(2, "MongoDB extension version", MONGODB_VERSION_S);
- php_info_print_table_row(2, "MongoDB extension stability", MONGODB_STABILITY_S);
+ php_info_print_table_row(2, "MongoDB extension version", PHP_MONGODB_VERSION);
+ php_info_print_table_row(2, "MongoDB extension stability", PHP_MONGODB_STABILITY);
#ifdef HAVE_SYSTEM_LIBBSON
php_info_print_table_row(2, "libbson headers version", BSON_VERSION_S);
php_info_print_table_row(2, "libbson library version", bson_get_version());
#else
php_info_print_table_row(2, "libbson bundled version", BSON_VERSION_S);
#endif
#ifdef HAVE_SYSTEM_LIBMONGOC
php_info_print_table_row(2, "libmongoc headers version", MONGOC_VERSION_S);
php_info_print_table_row(2, "libmongoc library version", mongoc_get_version());
#else
/* Bundled libraries, buildtime = runtime */
php_info_print_table_row(2, "libmongoc bundled version", MONGOC_VERSION_S);
#endif
#ifdef MONGOC_ENABLE_SSL
php_info_print_table_row(2, "libmongoc SSL", "enabled");
# if defined(MONGOC_ENABLE_SSL_OPENSSL)
php_info_print_table_row(2, "libmongoc SSL library", "OpenSSL");
# elif defined(MONGOC_ENABLE_SSL_LIBRESSL)
php_info_print_table_row(2, "libmongoc SSL library", "LibreSSL");
# elif defined(MONGOC_ENABLE_SSL_SECURE_TRANSPORT)
php_info_print_table_row(2, "libmongoc SSL library", "Secure Transport");
# elif defined(MONGOC_ENABLE_SSL_SECURE_CHANNEL)
php_info_print_table_row(2, "libmongoc SSL library", "Secure Channel");
# else
php_info_print_table_row(2, "libmongoc SSL library", "unknown");
# endif
#else
php_info_print_table_row(2, "libmongoc SSL", "disabled");
#endif
#ifdef MONGOC_ENABLE_CRYPTO
php_info_print_table_row(2, "libmongoc crypto", "enabled");
# if defined(MONGOC_ENABLE_CRYPTO_LIBCRYPTO)
php_info_print_table_row(2, "libmongoc crypto library", "libcrypto");
# elif defined(MONGOC_ENABLE_CRYPTO_COMMON_CRYPTO)
php_info_print_table_row(2, "libmongoc crypto library", "Common Crypto");
# elif defined(MONGOC_ENABLE_CRYPTO_CNG)
php_info_print_table_row(2, "libmongoc crypto library", "CNG");
# else
php_info_print_table_row(2, "libmongoc crypto library", "unknown");
# endif
# ifdef MONGOC_ENABLE_CRYPTO_SYSTEM_PROFILE
php_info_print_table_row(2, "libmongoc crypto system profile", "enabled");
# else
php_info_print_table_row(2, "libmongoc crypto system profile", "disabled");
# endif
#else
php_info_print_table_row(2, "libmongoc crypto", "disabled");
#endif
#ifdef MONGOC_ENABLE_SASL
php_info_print_table_row(2, "libmongoc SASL", "enabled");
#else
php_info_print_table_row(2, "libmongoc SASL", "disabled");
#endif
php_info_print_table_end();
DISPLAY_INI_ENTRIES();
}
/* }}} */
/* }}} */
/* {{{ mongodb_functions[]
*/
ZEND_BEGIN_ARG_INFO_EX(ai_bson_fromPHP, 0, 0, 1)
ZEND_ARG_INFO(0, value)
ZEND_END_ARG_INFO();
ZEND_BEGIN_ARG_INFO_EX(ai_bson_toPHP, 0, 0, 1)
ZEND_ARG_INFO(0, bson)
ZEND_END_ARG_INFO();
ZEND_BEGIN_ARG_INFO_EX(ai_bson_toJSON, 0, 0, 1)
ZEND_ARG_INFO(0, bson)
ZEND_END_ARG_INFO();
ZEND_BEGIN_ARG_INFO_EX(ai_bson_fromJSON, 0, 0, 1)
ZEND_ARG_INFO(0, json)
ZEND_END_ARG_INFO();
const zend_function_entry mongodb_functions[] = {
ZEND_NS_FE("MongoDB\\BSON", fromPHP, ai_bson_fromPHP)
ZEND_NS_FE("MongoDB\\BSON", toPHP, ai_bson_toPHP)
ZEND_NS_FE("MongoDB\\BSON", toJSON, ai_bson_toJSON)
ZEND_NS_FE("MongoDB\\BSON", fromJSON, ai_bson_fromJSON)
PHP_FE_END
};
/* }}} */
static const zend_module_dep mongodb_deps[] = {
ZEND_MOD_REQUIRED("date")
ZEND_MOD_REQUIRED("json")
ZEND_MOD_REQUIRED("spl")
ZEND_MOD_REQUIRED("standard")
ZEND_MOD_END
};
/* {{{ mongodb_module_entry
*/
zend_module_entry mongodb_module_entry = {
STANDARD_MODULE_HEADER_EX,
NULL,
mongodb_deps,
"mongodb",
mongodb_functions,
PHP_MINIT(mongodb),
PHP_MSHUTDOWN(mongodb),
NULL /* PHP_RINIT(mongodb)*/,
NULL /* PHP_RSHUTDOWN(mongodb)*/,
PHP_MINFO(mongodb),
- MONGODB_VERSION,
+ PHP_MONGODB_VERSION,
PHP_MODULE_GLOBALS(mongodb),
PHP_GINIT(mongodb),
PHP_GSHUTDOWN(mongodb),
NULL,
STANDARD_MODULE_PROPERTIES_EX
};
/* }}} */
#ifdef COMPILE_DL_MONGODB
ZEND_GET_MODULE(mongodb)
#endif
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* End:
* vim600: noet sw=4 ts=4 fdm=marker
* vim<600: noet sw=4 ts=4
*/
diff --git a/mongodb-1.2.3/php_phongo.h b/mongodb-1.2.8/php_phongo.h
similarity index 94%
rename from mongodb-1.2.3/php_phongo.h
rename to mongodb-1.2.8/php_phongo.h
index 63d17672..834fbadd 100644
--- a/mongodb-1.2.3/php_phongo.h
+++ b/mongodb-1.2.8/php_phongo.h
@@ -1,188 +1,195 @@
/*
* Copyright 2014-2017 MongoDB, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef PHONGO_H
#define PHONGO_H
/* External libs */
#include "bson.h"
#include "mongoc.h"
#define phpext_mongodb_ptr &mongodb_module_entry
extern zend_module_entry mongodb_module_entry;
/* FIXME: Its annoying to bump version. Move into phongo_version.h.in */
-#define MONGODB_VERSION_S "1.2.3"
-#define MONGODB_STABILITY_S "stable"
-#define MONGODB_VERSION MONGODB_VERSION_S
+#define PHP_MONGODB_VERSION "1.2.8"
+#define PHP_MONGODB_STABILITY "stable"
#ifdef PHP_WIN32
# define PHONGO_API __declspec(dllexport)
# include "ext/standard/flock_compat.h"
#elif defined(__GNUC__) && __GNUC__ >= 4
# define PHONGO_API __attribute__ ((visibility("default")))
#else
# define PHONGO_API
#endif
+/* Structure for persisted libmongoc clients. The PID is included to ensure that
+ * processes do not destroy clients created by other processes (relevant for
+ * forking). We avoid using pid_t for Windows compatibility. */
+typedef struct {
+ mongoc_client_t *client;
+ int pid;
+} php_phongo_pclient_t;
+
ZEND_BEGIN_MODULE_GLOBALS(mongodb)
char *debug;
FILE *debug_fd;
bson_mem_vtable_t bsonMemVTable;
- HashTable clients;
+ HashTable pclients;
ZEND_END_MODULE_GLOBALS(mongodb)
#if PHP_VERSION_ID >= 70000
# define MONGODB_G(v) ZEND_MODULE_GLOBALS_ACCESSOR(mongodb, v)
# if defined(ZTS) && defined(COMPILE_DL_MONGODB)
ZEND_TSRMLS_CACHE_EXTERN()
# endif
#else
# ifdef ZTS
# define MONGODB_G(v) TSRMG(mongodb_globals_id, zend_mongodb_globals *, v)
# define mglo mongodb_globals_id
# else
# define MONGODB_G(v) (mongodb_globals.v)
# define mglo mongodb_globals
# endif
#endif
#define PHONGO_WRITE_CONCERN_W_MAJORITY "majority"
#include "php_phongo_classes.h"
/* This enum is necessary since mongoc_server_description_type_t is private and
* we need to translate strings returned by mongoc_server_description_type() to
* Server integer constants. */
typedef enum {
PHONGO_SERVER_UNKNOWN = 0,
PHONGO_SERVER_STANDALONE = 1,
PHONGO_SERVER_MONGOS = 2,
PHONGO_SERVER_POSSIBLE_PRIMARY = 3,
PHONGO_SERVER_RS_PRIMARY = 4,
PHONGO_SERVER_RS_SECONDARY = 5,
PHONGO_SERVER_RS_ARBITER = 6,
PHONGO_SERVER_RS_OTHER = 7,
PHONGO_SERVER_RS_GHOST = 8,
PHONGO_SERVER_DESCRIPTION_TYPES = 9,
} php_phongo_server_description_type_t;
typedef struct {
php_phongo_server_description_type_t type;
const char *name;
} php_phongo_server_description_type_map_t;
extern php_phongo_server_description_type_map_t php_phongo_server_description_type_map[];
typedef enum {
PHONGO_ERROR_INVALID_ARGUMENT = 1,
PHONGO_ERROR_RUNTIME = 2,
PHONGO_ERROR_UNEXPECTED_VALUE = 8,
PHONGO_ERROR_MONGOC_FAILED = 3,
PHONGO_ERROR_WRITE_FAILED = 5,
PHONGO_ERROR_CONNECTION_FAILED = 7,
PHONGO_ERROR_LOGIC = 9
} php_phongo_error_domain_t;
zend_class_entry* phongo_exception_from_mongoc_domain(uint32_t /* mongoc_error_domain_t */ domain, uint32_t /* mongoc_error_code_t */ code);
zend_class_entry* phongo_exception_from_phongo_domain(php_phongo_error_domain_t domain);
void phongo_throw_exception(php_phongo_error_domain_t domain TSRMLS_DC, const char *format, ...)
#if PHP_VERSION_ID < 70000
# ifndef PHP_WIN32
# ifdef ZTS
__attribute__ ((format(printf, 3, 4)))
# else
__attribute__ ((format(printf, 2, 3)))
# endif
# endif
#endif
;
void phongo_throw_exception_from_bson_error_t(bson_error_t *error TSRMLS_DC);
zend_object_handlers *phongo_get_std_object_handlers(void);
void phongo_server_init (zval *return_value, zval *manager, int server_id TSRMLS_DC);
void phongo_readconcern_init (zval *return_value, const mongoc_read_concern_t *read_concern TSRMLS_DC);
void phongo_readpreference_init (zval *return_value, const mongoc_read_prefs_t *read_prefs TSRMLS_DC);
void phongo_writeconcern_init (zval *return_value, const mongoc_write_concern_t *write_concern TSRMLS_DC);
mongoc_bulk_operation_t* phongo_bulkwrite_init (zend_bool ordered);
bool phongo_execute_write (zval *manager, const char *namespace, php_phongo_bulkwrite_t *bulk_write, const mongoc_write_concern_t *write_concern, int server_id, zval *return_value, int return_value_used TSRMLS_DC);
int phongo_execute_command (zval *manager, const char *db, zval *zcommand, zval *zreadPreference, int server_id, zval *return_value, int return_value_used TSRMLS_DC);
int phongo_execute_query (zval *manager, const char *namespace, zval *zquery, zval *zreadPreference, int server_id, zval *return_value, int return_value_used TSRMLS_DC);
const mongoc_read_concern_t* phongo_read_concern_from_zval (zval *zread_concern TSRMLS_DC);
const mongoc_read_prefs_t* phongo_read_preference_from_zval(zval *zread_preference TSRMLS_DC);
const mongoc_write_concern_t* phongo_write_concern_from_zval (zval *zwrite_concern TSRMLS_DC);
php_phongo_server_description_type_t php_phongo_server_description_type(mongoc_server_description_t *sd);
void php_phongo_read_preference_prep_tagsets(zval *tagSets TSRMLS_DC);
bool php_phongo_read_preference_tags_are_valid(const bson_t *tags);
void php_phongo_server_to_zval(zval *retval, mongoc_server_description_t *sd);
void php_phongo_read_concern_to_zval(zval *retval, const mongoc_read_concern_t *read_concern);
void php_phongo_read_preference_to_zval(zval *retval, const mongoc_read_prefs_t *read_prefs);
void php_phongo_write_concern_to_zval(zval *retval, const mongoc_write_concern_t *write_concern);
void php_phongo_cursor_to_zval(zval *retval, const mongoc_cursor_t *cursor);
void phongo_manager_init(php_phongo_manager_t *manager, const char *uri_string, zval *options, zval *driverOptions TSRMLS_DC);
void php_phongo_objectid_new_from_oid(zval *object, const bson_oid_t *oid TSRMLS_DC);
void php_phongo_cursor_id_new_from_id(zval *object, int64_t cursorid TSRMLS_DC);
void php_phongo_new_utcdatetime_from_epoch(zval *object, int64_t msec_since_epoch TSRMLS_DC);
void php_phongo_new_timestamp_from_increment_and_timestamp(zval *object, uint32_t increment, uint32_t timestamp TSRMLS_DC);
void php_phongo_new_javascript_from_javascript(int init, zval *object, const char *code, size_t code_len TSRMLS_DC);
void php_phongo_new_javascript_from_javascript_and_scope(int init, zval *object, const char *code, size_t code_len, const bson_t *scope TSRMLS_DC);
void php_phongo_new_binary_from_binary_and_type(zval *object, const char *data, size_t data_len, bson_subtype_t type TSRMLS_DC);
void php_phongo_new_decimal128(zval *object, const bson_decimal128_t *decimal TSRMLS_DC);
void php_phongo_new_regex_from_regex_and_options(zval *object, const char *pattern, const char *flags TSRMLS_DC);
zend_bool phongo_writeerror_init(zval *return_value, bson_t *bson TSRMLS_DC);
zend_bool phongo_writeconcernerror_init(zval *return_value, bson_t *bson TSRMLS_DC);
#if PHP_VERSION_ID >= 70000
#define PHONGO_CE_FINAL(ce) do { \
ce->ce_flags |= ZEND_ACC_FINAL; \
} while(0);
#else
#define PHONGO_CE_FINAL(ce) do { \
ce->ce_flags |= ZEND_ACC_FINAL_CLASS; \
} while(0);
#endif
#define PHONGO_CE_DISABLE_SERIALIZATION(ce) do { \
ce->serialize = zend_class_serialize_deny; \
ce->unserialize = zend_class_unserialize_deny; \
} while(0);
#ifdef PHP_DEBUG
void _phongo_debug_bson(bson_t *bson);
#else
#define _phongo_debug_bson(bson)
#endif
PHP_MINIT_FUNCTION(bson);
#endif /* PHONGO_H */
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* End:
* vim600: noet sw=4 ts=4 fdm=marker
* vim<600: noet sw=4 ts=4
*/
diff --git a/mongodb-1.2.3/php_phongo_classes.h b/mongodb-1.2.8/php_phongo_classes.h
similarity index 100%
rename from mongodb-1.2.3/php_phongo_classes.h
rename to mongodb-1.2.8/php_phongo_classes.h
diff --git a/mongodb-1.2.3/php_phongo_structs.h b/mongodb-1.2.8/php_phongo_structs.h
similarity index 100%
rename from mongodb-1.2.3/php_phongo_structs.h
rename to mongodb-1.2.8/php_phongo_structs.h
diff --git a/mongodb-1.2.3/scripts/centos/essentials.sh b/mongodb-1.2.8/scripts/centos/essentials.sh
similarity index 100%
rename from mongodb-1.2.3/scripts/centos/essentials.sh
rename to mongodb-1.2.8/scripts/centos/essentials.sh
diff --git a/mongodb-1.2.3/scripts/centos/ldap/Domain.ldif b/mongodb-1.2.8/scripts/centos/ldap/Domain.ldif
similarity index 100%
rename from mongodb-1.2.3/scripts/centos/ldap/Domain.ldif
rename to mongodb-1.2.8/scripts/centos/ldap/Domain.ldif
diff --git a/mongodb-1.2.3/scripts/centos/ldap/Users.ldif b/mongodb-1.2.8/scripts/centos/ldap/Users.ldif
similarity index 100%
rename from mongodb-1.2.3/scripts/centos/ldap/Users.ldif
rename to mongodb-1.2.8/scripts/centos/ldap/Users.ldif
diff --git a/mongodb-1.2.3/scripts/centos/ldap/basics.ldif b/mongodb-1.2.8/scripts/centos/ldap/basics.ldif
similarity index 100%
rename from mongodb-1.2.3/scripts/centos/ldap/basics.ldif
rename to mongodb-1.2.8/scripts/centos/ldap/basics.ldif
diff --git a/mongodb-1.2.3/scripts/centos/ldap/install.sh b/mongodb-1.2.8/scripts/centos/ldap/install.sh
similarity index 100%
rename from mongodb-1.2.3/scripts/centos/ldap/install.sh
rename to mongodb-1.2.8/scripts/centos/ldap/install.sh
diff --git a/mongodb-1.2.3/scripts/centos/ldap/mongod.ldif b/mongodb-1.2.8/scripts/centos/ldap/mongod.ldif
similarity index 100%
rename from mongodb-1.2.3/scripts/centos/ldap/mongod.ldif
rename to mongodb-1.2.8/scripts/centos/ldap/mongod.ldif
diff --git a/mongodb-1.2.3/scripts/centos/ldap/pw.ldif b/mongodb-1.2.8/scripts/centos/ldap/pw.ldif
similarity index 100%
rename from mongodb-1.2.3/scripts/centos/ldap/pw.ldif
rename to mongodb-1.2.8/scripts/centos/ldap/pw.ldif
diff --git a/mongodb-1.2.3/scripts/centos/ldap/saslauthd.conf b/mongodb-1.2.8/scripts/centos/ldap/saslauthd.conf
similarity index 100%
rename from mongodb-1.2.3/scripts/centos/ldap/saslauthd.conf
rename to mongodb-1.2.8/scripts/centos/ldap/saslauthd.conf
diff --git a/mongodb-1.2.3/scripts/centos/ldap/users b/mongodb-1.2.8/scripts/centos/ldap/users
similarity index 100%
rename from mongodb-1.2.3/scripts/centos/ldap/users
rename to mongodb-1.2.8/scripts/centos/ldap/users
diff --git a/mongodb-1.2.3/scripts/convert-bson-corpus-tests.php b/mongodb-1.2.8/scripts/convert-bson-corpus-tests.php
similarity index 100%
rename from mongodb-1.2.3/scripts/convert-bson-corpus-tests.php
rename to mongodb-1.2.8/scripts/convert-bson-corpus-tests.php
diff --git a/mongodb-1.2.3/scripts/convert-mo-tests.php b/mongodb-1.2.8/scripts/convert-mo-tests.php
similarity index 100%
rename from mongodb-1.2.3/scripts/convert-mo-tests.php
rename to mongodb-1.2.8/scripts/convert-mo-tests.php
diff --git a/mongodb-1.2.3/scripts/freebsd/essentials.sh b/mongodb-1.2.8/scripts/freebsd/essentials.sh
similarity index 100%
rename from mongodb-1.2.3/scripts/freebsd/essentials.sh
rename to mongodb-1.2.8/scripts/freebsd/essentials.sh
diff --git a/mongodb-1.2.3/scripts/freebsd/phongo.sh b/mongodb-1.2.8/scripts/freebsd/phongo.sh
similarity index 100%
rename from mongodb-1.2.3/scripts/freebsd/phongo.sh
rename to mongodb-1.2.8/scripts/freebsd/phongo.sh
diff --git a/mongodb-1.2.3/scripts/list-servers.php b/mongodb-1.2.8/scripts/list-servers.php
similarity index 100%
rename from mongodb-1.2.3/scripts/list-servers.php
rename to mongodb-1.2.8/scripts/list-servers.php
diff --git a/mongodb-1.2.3/scripts/presets/replicaset-30.json b/mongodb-1.2.8/scripts/presets/replicaset-30.json
similarity index 100%
rename from mongodb-1.2.3/scripts/presets/replicaset-30.json
rename to mongodb-1.2.8/scripts/presets/replicaset-30.json
diff --git a/mongodb-1.2.3/scripts/presets/replicaset.json b/mongodb-1.2.8/scripts/presets/replicaset.json
similarity index 100%
rename from mongodb-1.2.3/scripts/presets/replicaset.json
rename to mongodb-1.2.8/scripts/presets/replicaset.json
diff --git a/mongodb-1.2.3/scripts/presets/standalone-24.json b/mongodb-1.2.8/scripts/presets/standalone-24.json
similarity index 100%
rename from mongodb-1.2.3/scripts/presets/standalone-24.json
rename to mongodb-1.2.8/scripts/presets/standalone-24.json
diff --git a/mongodb-1.2.3/scripts/presets/standalone-26.json b/mongodb-1.2.8/scripts/presets/standalone-26.json
similarity index 100%
rename from mongodb-1.2.3/scripts/presets/standalone-26.json
rename to mongodb-1.2.8/scripts/presets/standalone-26.json
diff --git a/mongodb-1.2.3/scripts/presets/standalone-30.json b/mongodb-1.2.8/scripts/presets/standalone-30.json
similarity index 100%
rename from mongodb-1.2.3/scripts/presets/standalone-30.json
rename to mongodb-1.2.8/scripts/presets/standalone-30.json
diff --git a/mongodb-1.2.3/scripts/presets/standalone-auth.json b/mongodb-1.2.8/scripts/presets/standalone-auth.json
similarity index 100%
rename from mongodb-1.2.3/scripts/presets/standalone-auth.json
rename to mongodb-1.2.8/scripts/presets/standalone-auth.json
diff --git a/mongodb-1.2.3/scripts/presets/standalone-plain.json b/mongodb-1.2.8/scripts/presets/standalone-plain.json
similarity index 100%
rename from mongodb-1.2.3/scripts/presets/standalone-plain.json
rename to mongodb-1.2.8/scripts/presets/standalone-plain.json
diff --git a/mongodb-1.2.3/scripts/presets/standalone-ssl.json b/mongodb-1.2.8/scripts/presets/standalone-ssl.json
similarity index 100%
rename from mongodb-1.2.3/scripts/presets/standalone-ssl.json
rename to mongodb-1.2.8/scripts/presets/standalone-ssl.json
diff --git a/mongodb-1.2.3/scripts/presets/standalone-x509.json b/mongodb-1.2.8/scripts/presets/standalone-x509.json
similarity index 100%
rename from mongodb-1.2.3/scripts/presets/standalone-x509.json
rename to mongodb-1.2.8/scripts/presets/standalone-x509.json
diff --git a/mongodb-1.2.3/scripts/presets/standalone.json b/mongodb-1.2.8/scripts/presets/standalone.json
similarity index 100%
rename from mongodb-1.2.3/scripts/presets/standalone.json
rename to mongodb-1.2.8/scripts/presets/standalone.json
diff --git a/mongodb-1.2.3/scripts/ssl/ca.pem b/mongodb-1.2.8/scripts/ssl/ca.pem
similarity index 100%
rename from mongodb-1.2.3/scripts/ssl/ca.pem
rename to mongodb-1.2.8/scripts/ssl/ca.pem
diff --git a/mongodb-1.2.3/scripts/ssl/client.pem b/mongodb-1.2.8/scripts/ssl/client.pem
similarity index 100%
rename from mongodb-1.2.3/scripts/ssl/client.pem
rename to mongodb-1.2.8/scripts/ssl/client.pem
diff --git a/mongodb-1.2.3/scripts/ssl/crl.pem b/mongodb-1.2.8/scripts/ssl/crl.pem
similarity index 100%
rename from mongodb-1.2.3/scripts/ssl/crl.pem
rename to mongodb-1.2.8/scripts/ssl/crl.pem
diff --git a/mongodb-1.2.3/scripts/ssl/server.pem b/mongodb-1.2.8/scripts/ssl/server.pem
similarity index 100%
rename from mongodb-1.2.3/scripts/ssl/server.pem
rename to mongodb-1.2.8/scripts/ssl/server.pem
diff --git a/mongodb-1.2.3/scripts/start-servers.php b/mongodb-1.2.8/scripts/start-servers.php
similarity index 100%
rename from mongodb-1.2.3/scripts/start-servers.php
rename to mongodb-1.2.8/scripts/start-servers.php
diff --git a/mongodb-1.2.3/scripts/ubuntu/essentials.sh b/mongodb-1.2.8/scripts/ubuntu/essentials.sh
similarity index 100%
rename from mongodb-1.2.3/scripts/ubuntu/essentials.sh
rename to mongodb-1.2.8/scripts/ubuntu/essentials.sh
diff --git a/mongodb-1.2.3/scripts/ubuntu/ldap/install.sh b/mongodb-1.2.8/scripts/ubuntu/ldap/install.sh
similarity index 100%
rename from mongodb-1.2.3/scripts/ubuntu/ldap/install.sh
rename to mongodb-1.2.8/scripts/ubuntu/ldap/install.sh
diff --git a/mongodb-1.2.3/scripts/ubuntu/ldap/saslauthd.conf b/mongodb-1.2.8/scripts/ubuntu/ldap/saslauthd.conf
similarity index 100%
rename from mongodb-1.2.3/scripts/ubuntu/ldap/saslauthd.conf
rename to mongodb-1.2.8/scripts/ubuntu/ldap/saslauthd.conf
diff --git a/mongodb-1.2.3/scripts/ubuntu/mongo-orchestration.sh b/mongodb-1.2.8/scripts/ubuntu/mongo-orchestration.sh
similarity index 100%
rename from mongodb-1.2.3/scripts/ubuntu/mongo-orchestration.sh
rename to mongodb-1.2.8/scripts/ubuntu/mongo-orchestration.sh
diff --git a/mongodb-1.2.3/scripts/ubuntu/phongo.sh b/mongodb-1.2.8/scripts/ubuntu/phongo.sh
similarity index 100%
rename from mongodb-1.2.3/scripts/ubuntu/phongo.sh
rename to mongodb-1.2.8/scripts/ubuntu/phongo.sh
diff --git a/mongodb-1.2.3/scripts/vmware/kernel.sh b/mongodb-1.2.8/scripts/vmware/kernel.sh
similarity index 100%
rename from mongodb-1.2.3/scripts/vmware/kernel.sh
rename to mongodb-1.2.8/scripts/vmware/kernel.sh
diff --git a/mongodb-1.2.3/src/BSON/Binary.c b/mongodb-1.2.8/src/BSON/Binary.c
similarity index 98%
rename from mongodb-1.2.3/src/BSON/Binary.c
rename to mongodb-1.2.8/src/BSON/Binary.c
index 5e5a34e9..a8097d64 100644
--- a/mongodb-1.2.3/src/BSON/Binary.c
+++ b/mongodb-1.2.8/src/BSON/Binary.c
@@ -1,488 +1,497 @@
/*
* Copyright 2014-2017 MongoDB, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
/* External libs */
#include <bson.h>
#include <mongoc.h>
/* PHP Core stuff */
#include <php.h>
#include <php_ini.h>
#include <ext/standard/base64.h>
#include <ext/standard/info.h>
#include <Zend/zend_interfaces.h>
#include <Zend/zend_operators.h>
#include <ext/spl/spl_iterators.h>
#include <ext/standard/php_var.h>
#if PHP_VERSION_ID >= 70000
# include <zend_smart_str.h>
#else
# include <ext/standard/php_smart_str.h>
#endif
/* Our Compatability header */
#include "phongo_compat.h"
/* Our stuffz */
#include "php_phongo.h"
#include "php_bson.h"
PHONGO_API zend_class_entry *php_phongo_binary_ce;
zend_object_handlers php_phongo_handler_binary;
/* Initialize the object and return whether it was successful. An exception will
* be thrown on error. */
static bool php_phongo_binary_init(php_phongo_binary_t *intern, const char *data, phongo_zpp_char_len data_len, phongo_long type TSRMLS_DC)
{
if (type < 0 || type > UINT8_MAX) {
phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT TSRMLS_CC, "Expected type to be an unsigned 8-bit integer, %" PHONGO_LONG_FORMAT " given", type);
return false;
}
intern->data = estrndup(data, data_len);
intern->data_len = data_len;
intern->type = (uint8_t) type;
return true;
}
/* Initialize the object from a HashTable and return whether it was successful.
* An exception will be thrown on error. */
static bool php_phongo_binary_init_from_hash(php_phongo_binary_t *intern, HashTable *props TSRMLS_DC)
{
#if PHP_VERSION_ID >= 70000
zval *data, *type;
if ((data = zend_hash_str_find(props, "data", sizeof("data")-1)) && Z_TYPE_P(data) == IS_STRING &&
(type = zend_hash_str_find(props, "type", sizeof("type")-1)) && Z_TYPE_P(type) == IS_LONG) {
return php_phongo_binary_init(intern, Z_STRVAL_P(data), Z_STRLEN_P(data), Z_LVAL_P(type) TSRMLS_CC);
}
#else
zval **data, **type;
if (zend_hash_find(props, "data", sizeof("data"), (void**) &data) == SUCCESS && Z_TYPE_PP(data) == IS_STRING &&
zend_hash_find(props, "type", sizeof("type"), (void**) &type) == SUCCESS && Z_TYPE_PP(type) == IS_LONG) {
return php_phongo_binary_init(intern, Z_STRVAL_PP(data), Z_STRLEN_PP(data), Z_LVAL_PP(type) TSRMLS_CC);
}
#endif
phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT TSRMLS_CC, "%s initialization requires \"data\" string and \"type\" integer fields", ZSTR_VAL(php_phongo_binary_ce->name));
return false;
}
/* {{{ proto void Binary::__construct(string $data, int $type)
Construct a new BSON binary type */
PHP_METHOD(Binary, __construct)
{
php_phongo_binary_t *intern;
zend_error_handling error_handling;
char *data;
phongo_zpp_char_len data_len;
phongo_long type;
zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling TSRMLS_CC);
intern = Z_BINARY_OBJ_P(getThis());
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sl", &data, &data_len, &type) == FAILURE) {
zend_restore_error_handling(&error_handling TSRMLS_CC);
return;
}
zend_restore_error_handling(&error_handling TSRMLS_CC);
php_phongo_binary_init(intern, data, data_len, type TSRMLS_CC);
}
/* }}} */
/* {{{ proto void Binary::__set_state(array $properties)
*/
PHP_METHOD(Binary, __set_state)
{
php_phongo_binary_t *intern;
HashTable *props;
zval *array;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a", &array) == FAILURE) {
RETURN_FALSE;
}
object_init_ex(return_value, php_phongo_binary_ce);
intern = Z_BINARY_OBJ_P(return_value);
props = Z_ARRVAL_P(array);
php_phongo_binary_init_from_hash(intern, props TSRMLS_CC);
}
/* }}} */
/* {{{ proto string Binary::__toString()
Return the Binary's data string. */
PHP_METHOD(Binary, __toString)
{
php_phongo_binary_t *intern;
if (zend_parse_parameters_none() == FAILURE) {
return;
}
intern = Z_BINARY_OBJ_P(getThis());
PHONGO_RETURN_STRINGL(intern->data, intern->data_len);
}
/* }}} */
/* {{{ proto string Binary::getData()
*/
PHP_METHOD(Binary, getData)
{
php_phongo_binary_t *intern;
intern = Z_BINARY_OBJ_P(getThis());
if (zend_parse_parameters_none() == FAILURE) {
return;
}
PHONGO_RETURN_STRINGL(intern->data, intern->data_len);
}
/* }}} */
/* {{{ proto integer Binary::getType()
*/
PHP_METHOD(Binary, getType)
{
php_phongo_binary_t *intern;
intern = Z_BINARY_OBJ_P(getThis());
if (zend_parse_parameters_none() == FAILURE) {
return;
}
RETURN_LONG(intern->type);
}
/* }}} */
/* {{{ proto array Binary::jsonSerialize()
*/
PHP_METHOD(Binary, jsonSerialize)
{
php_phongo_binary_t *intern;
char type[3];
int type_len;
if (zend_parse_parameters_none() == FAILURE) {
return;
}
intern = Z_BINARY_OBJ_P(getThis());
array_init_size(return_value, 2);
#if PHP_VERSION_ID >= 70000
{
zend_string *data = php_base64_encode((unsigned char *)intern->data, intern->data_len);
ADD_ASSOC_STRINGL(return_value, "$binary", ZSTR_VAL(data), ZSTR_LEN(data));
zend_string_free(data);
}
#else
{
int data_len = 0;
unsigned char *data = php_base64_encode((unsigned char *)intern->data, intern->data_len, &data_len);
ADD_ASSOC_STRINGL(return_value, "$binary", (char *)data, data_len);
efree(data);
}
#endif
type_len = snprintf(type, sizeof(type), "%02x", intern->type);
ADD_ASSOC_STRINGL(return_value, "$type", type, type_len);
}
/* }}} */
/* {{{ proto string Binary::serialize()
*/
PHP_METHOD(Binary, serialize)
{
php_phongo_binary_t *intern;
#if PHP_VERSION_ID >= 70000
zval retval;
#else
zval *retval;
#endif
php_serialize_data_t var_hash;
smart_str buf = { 0 };
intern = Z_BINARY_OBJ_P(getThis());
if (zend_parse_parameters_none() == FAILURE) {
return;
}
#if PHP_VERSION_ID >= 70000
array_init_size(&retval, 2);
ADD_ASSOC_STRINGL(&retval, "data", intern->data, intern->data_len);
ADD_ASSOC_LONG_EX(&retval, "type", intern->type);
#else
ALLOC_INIT_ZVAL(retval);
array_init_size(retval, 2);
ADD_ASSOC_STRINGL(retval, "data", intern->data, intern->data_len);
ADD_ASSOC_LONG_EX(retval, "type", intern->type);
#endif
PHP_VAR_SERIALIZE_INIT(var_hash);
php_var_serialize(&buf, &retval, &var_hash TSRMLS_CC);
smart_str_0(&buf);
PHP_VAR_SERIALIZE_DESTROY(var_hash);
PHONGO_RETVAL_SMART_STR(buf);
smart_str_free(&buf);
zval_ptr_dtor(&retval);
}
/* }}} */
/* {{{ proto string Binary::unserialize(string $serialized)
*/
PHP_METHOD(Binary, unserialize)
{
php_phongo_binary_t *intern;
zend_error_handling error_handling;
char *serialized;
phongo_zpp_char_len serialized_len;
#if PHP_VERSION_ID >= 70000
zval props;
#else
zval *props;
#endif
php_unserialize_data_t var_hash;
intern = Z_BINARY_OBJ_P(getThis());
zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling TSRMLS_CC);
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &serialized, &serialized_len) == FAILURE) {
zend_restore_error_handling(&error_handling TSRMLS_CC);
return;
}
zend_restore_error_handling(&error_handling TSRMLS_CC);
#if PHP_VERSION_ID < 70000
ALLOC_INIT_ZVAL(props);
#endif
PHP_VAR_UNSERIALIZE_INIT(var_hash);
if (!php_var_unserialize(&props, (const unsigned char**) &serialized, (unsigned char *) serialized + serialized_len, &var_hash TSRMLS_CC)) {
zval_ptr_dtor(&props);
phongo_throw_exception(PHONGO_ERROR_UNEXPECTED_VALUE TSRMLS_CC, "%s unserialization failed", ZSTR_VAL(php_phongo_binary_ce->name));
PHP_VAR_UNSERIALIZE_DESTROY(var_hash);
return;
}
PHP_VAR_UNSERIALIZE_DESTROY(var_hash);
#if PHP_VERSION_ID >= 70000
php_phongo_binary_init_from_hash(intern, HASH_OF(&props) TSRMLS_CC);
#else
php_phongo_binary_init_from_hash(intern, HASH_OF(props) TSRMLS_CC);
#endif
zval_ptr_dtor(&props);
}
/* }}} */
/* {{{ BSON\Binary */
ZEND_BEGIN_ARG_INFO_EX(ai_Binary___construct, 0, 0, 2)
ZEND_ARG_INFO(0, data)
ZEND_ARG_INFO(0, type)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(ai_Binary___set_state, 0, 0, 1)
ZEND_ARG_ARRAY_INFO(0, properties, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(ai_Binary_unserialize, 0, 0, 1)
ZEND_ARG_INFO(0, serialized)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(ai_Binary_void, 0, 0, 0)
ZEND_END_ARG_INFO()
static zend_function_entry php_phongo_binary_me[] = {
PHP_ME(Binary, __construct, ai_Binary___construct, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
PHP_ME(Binary, __set_state, ai_Binary___set_state, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
PHP_ME(Binary, __toString, ai_Binary_void, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
PHP_ME(Binary, jsonSerialize, ai_Binary_void, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
PHP_ME(Binary, serialize, ai_Binary_void, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
PHP_ME(Binary, unserialize, ai_Binary_unserialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
PHP_ME(Binary, getData, ai_Binary_void, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
PHP_ME(Binary, getType, ai_Binary_void, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
PHP_FE_END
};
/* }}} */
/* {{{ php_phongo_binary_t object handlers */
static void php_phongo_binary_free_object(phongo_free_object_arg *object TSRMLS_DC) /* {{{ */
{
php_phongo_binary_t *intern = Z_OBJ_BINARY(object);
zend_object_std_dtor(&intern->std TSRMLS_CC);
if (intern->data) {
efree(intern->data);
}
#if PHP_VERSION_ID < 70000
efree(intern);
#endif
} /* }}} */
phongo_create_object_retval php_phongo_binary_create_object(zend_class_entry *class_type TSRMLS_DC) /* {{{ */
{
php_phongo_binary_t *intern = NULL;
intern = PHONGO_ALLOC_OBJECT_T(php_phongo_binary_t, class_type);
zend_object_std_init(&intern->std, class_type TSRMLS_CC);
object_properties_init(&intern->std, class_type);
#if PHP_VERSION_ID >= 70000
intern->std.handlers = &php_phongo_handler_binary;
return &intern->std;
#else
{
zend_object_value retval;
retval.handle = zend_objects_store_put(intern, (zend_objects_store_dtor_t) zend_objects_destroy_object, php_phongo_binary_free_object, NULL TSRMLS_CC);
retval.handlers = &php_phongo_handler_binary;
return retval;
}
#endif
} /* }}} */
static int php_phongo_binary_compare_objects(zval *o1, zval *o2 TSRMLS_DC) /* {{{ */
{
php_phongo_binary_t *intern1, *intern2;
intern1 = Z_BINARY_OBJ_P(o1);
intern2 = Z_BINARY_OBJ_P(o2);
/* MongoDB compares binary types first by the data length, then by the type
* byte, and finally by the binary data itself. */
if (intern1->data_len != intern2->data_len) {
return intern1->data_len < intern2->data_len ? -1 : 1;
}
if (intern1->type != intern2->type) {
return intern1->type < intern2->type ? -1 : 1;
}
return zend_binary_strcmp(intern1->data, intern1->data_len, intern2->data, intern2->data_len);
} /* }}} */
+static HashTable *php_phongo_binary_get_gc(zval *object, phongo_get_gc_table table, int *n TSRMLS_DC) /* {{{ */
+{
+ *table = NULL;
+ *n = 0;
+
+ return zend_std_get_properties(object TSRMLS_CC);
+} /* }}} */
+
HashTable *php_phongo_binary_get_properties(zval *object TSRMLS_DC) /* {{{ */
{
php_phongo_binary_t *intern;
HashTable *props;
intern = Z_BINARY_OBJ_P(object);
props = zend_std_get_properties(object TSRMLS_CC);
if (!intern->data) {
return props;
}
#if PHP_VERSION_ID >= 70000
{
zval data, type;
ZVAL_STRINGL(&data, intern->data, intern->data_len);
zend_hash_str_update(props, "data", sizeof("data")-1, &data);
ZVAL_LONG(&type, intern->type);
zend_hash_str_update(props, "type", sizeof("type")-1, &type);
}
#else
{
zval *data, *type;
MAKE_STD_ZVAL(data);
ZVAL_STRINGL(data, intern->data, intern->data_len, 1);
zend_hash_update(props, "data", sizeof("data"), &data, sizeof(data), NULL);
MAKE_STD_ZVAL(type);
ZVAL_LONG(type, intern->type);
zend_hash_update(props, "type", sizeof("type"), &type, sizeof(type), NULL);
}
#endif
return props;
} /* }}} */
/* }}} */
/* {{{ PHP_MINIT_FUNCTION */
PHP_MINIT_FUNCTION(Binary)
{
zend_class_entry ce;
(void)type;(void)module_number;
INIT_NS_CLASS_ENTRY(ce, "MongoDB\\BSON", "Binary", php_phongo_binary_me);
php_phongo_binary_ce = zend_register_internal_class(&ce TSRMLS_CC);
php_phongo_binary_ce->create_object = php_phongo_binary_create_object;
PHONGO_CE_FINAL(php_phongo_binary_ce);
zend_class_implements(php_phongo_binary_ce TSRMLS_CC, 1, php_phongo_json_serializable_ce);
zend_class_implements(php_phongo_binary_ce TSRMLS_CC, 1, php_phongo_type_ce);
zend_class_implements(php_phongo_binary_ce TSRMLS_CC, 1, zend_ce_serializable);
memcpy(&php_phongo_handler_binary, phongo_get_std_object_handlers(), sizeof(zend_object_handlers));
php_phongo_handler_binary.compare_objects = php_phongo_binary_compare_objects;
+ php_phongo_handler_binary.get_gc = php_phongo_binary_get_gc;
php_phongo_handler_binary.get_properties = php_phongo_binary_get_properties;
#if PHP_VERSION_ID >= 70000
php_phongo_handler_binary.free_obj = php_phongo_binary_free_object;
php_phongo_handler_binary.offset = XtOffsetOf(php_phongo_binary_t, std);
#endif
zend_declare_class_constant_long(php_phongo_binary_ce, ZEND_STRL("TYPE_GENERIC"), BSON_SUBTYPE_BINARY TSRMLS_CC);
zend_declare_class_constant_long(php_phongo_binary_ce, ZEND_STRL("TYPE_FUNCTION"), BSON_SUBTYPE_FUNCTION TSRMLS_CC);
zend_declare_class_constant_long(php_phongo_binary_ce, ZEND_STRL("TYPE_OLD_BINARY"), BSON_SUBTYPE_BINARY_DEPRECATED TSRMLS_CC);
zend_declare_class_constant_long(php_phongo_binary_ce, ZEND_STRL("TYPE_OLD_UUID"), BSON_SUBTYPE_UUID_DEPRECATED TSRMLS_CC);
zend_declare_class_constant_long(php_phongo_binary_ce, ZEND_STRL("TYPE_UUID"), BSON_SUBTYPE_UUID TSRMLS_CC);
zend_declare_class_constant_long(php_phongo_binary_ce, ZEND_STRL("TYPE_MD5"), BSON_SUBTYPE_MD5 TSRMLS_CC);
zend_declare_class_constant_long(php_phongo_binary_ce, ZEND_STRL("TYPE_USER_DEFINED"), BSON_SUBTYPE_USER TSRMLS_CC);
return SUCCESS;
}
/* }}} */
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* End:
* vim600: noet sw=4 ts=4 fdm=marker
* vim<600: noet sw=4 ts=4
*/
diff --git a/mongodb-1.2.3/src/BSON/Decimal128.c b/mongodb-1.2.8/src/BSON/Decimal128.c
similarity index 97%
rename from mongodb-1.2.3/src/BSON/Decimal128.c
rename to mongodb-1.2.8/src/BSON/Decimal128.c
index d419a34e..27a1eecb 100644
--- a/mongodb-1.2.3/src/BSON/Decimal128.c
+++ b/mongodb-1.2.8/src/BSON/Decimal128.c
@@ -1,392 +1,401 @@
/*
* Copyright 2015-2017 MongoDB, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
/* External libs */
#include <bson.h>
#include <mongoc.h>
/* PHP Core stuff */
#include <php.h>
#include <php_ini.h>
#include <ext/standard/info.h>
#include <Zend/zend_interfaces.h>
#include <ext/spl/spl_iterators.h>
#include <ext/standard/php_var.h>
#if PHP_VERSION_ID >= 70000
# include <zend_smart_str.h>
#else
# include <ext/standard/php_smart_str.h>
#endif
/* Our Compatability header */
#include "phongo_compat.h"
/* Our stuffz */
#include "php_phongo.h"
#include "php_bson.h"
PHONGO_API zend_class_entry *php_phongo_decimal128_ce;
zend_object_handlers php_phongo_handler_decimal128;
/* Initialize the object and return whether it was successful. An exception will
* be thrown on error. */
static bool php_phongo_decimal128_init(php_phongo_decimal128_t *intern, const char *value TSRMLS_DC)
{
if (!bson_decimal128_from_string(value, &intern->decimal)) {
phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT TSRMLS_CC, "Error parsing Decimal128 string: %s", value);
return false;
}
intern->initialized = true;
return true;
}
/* Initialize the object from a HashTable and return whether it was successful.
* An exception will be thrown on error. */
static bool php_phongo_decimal128_init_from_hash(php_phongo_decimal128_t *intern, HashTable *props TSRMLS_DC)
{
#if PHP_VERSION_ID >= 70000
zval *dec;
if ((dec = zend_hash_str_find(props, "dec", sizeof("dec")-1)) && Z_TYPE_P(dec) == IS_STRING) {
return php_phongo_decimal128_init(intern, Z_STRVAL_P(dec) TSRMLS_CC);
}
#else
zval **dec;
if (zend_hash_find(props, "dec", sizeof("dec"), (void**) &dec) == SUCCESS && Z_TYPE_PP(dec) == IS_STRING) {
return php_phongo_decimal128_init(intern, Z_STRVAL_PP(dec) TSRMLS_CC);
}
#endif
phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT TSRMLS_CC, "%s initialization requires \"dec\" string field", ZSTR_VAL(php_phongo_decimal128_ce->name));
return false;
}
/* {{{ proto void Decimal128::__construct(string $value)
Construct a new BSON Decimal128 type */
PHP_METHOD(Decimal128, __construct)
{
php_phongo_decimal128_t *intern;
zend_error_handling error_handling;
char *value;
phongo_zpp_char_len value_len;
zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling TSRMLS_CC);
intern = Z_DECIMAL128_OBJ_P(getThis());
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &value, &value_len) == FAILURE) {
zend_restore_error_handling(&error_handling TSRMLS_CC);
return;
}
zend_restore_error_handling(&error_handling TSRMLS_CC);
php_phongo_decimal128_init(intern, value TSRMLS_CC);
}
/* }}} */
/* {{{ proto void Decimal128::__set_state(array $properties)
*/
PHP_METHOD(Decimal128, __set_state)
{
php_phongo_decimal128_t *intern;
HashTable *props;
zval *array;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a", &array) == FAILURE) {
RETURN_FALSE;
}
object_init_ex(return_value, php_phongo_decimal128_ce);
intern = Z_DECIMAL128_OBJ_P(return_value);
props = Z_ARRVAL_P(array);
php_phongo_decimal128_init_from_hash(intern, props TSRMLS_CC);
}
/* }}} */
/* {{{ proto string Decimal128::__toString()
*/
PHP_METHOD(Decimal128, __toString)
{
php_phongo_decimal128_t *intern;
char outbuf[BSON_DECIMAL128_STRING];
intern = Z_DECIMAL128_OBJ_P(getThis());
if (zend_parse_parameters_none() == FAILURE) {
return;
}
bson_decimal128_to_string(&intern->decimal, outbuf);
PHONGO_RETURN_STRING(outbuf);
}
/* }}} */
/* {{{ proto array Decimal128::jsonSerialize()
*/
PHP_METHOD(Decimal128, jsonSerialize)
{
php_phongo_decimal128_t *intern;
char outbuf[BSON_DECIMAL128_STRING] = "";
if (zend_parse_parameters_none() == FAILURE) {
return;
}
intern = Z_DECIMAL128_OBJ_P(getThis());
array_init_size(return_value, 1);
bson_decimal128_to_string(&intern->decimal, outbuf);
ADD_ASSOC_STRING(return_value, "$numberDecimal", outbuf);
}
/* }}} */
/* {{{ proto string Decimal128::serialize()
*/
PHP_METHOD(Decimal128, serialize)
{
php_phongo_decimal128_t *intern;
#if PHP_VERSION_ID >= 70000
zval retval;
#else
zval *retval;
#endif
php_serialize_data_t var_hash;
smart_str buf = { 0 };
char outbuf[BSON_DECIMAL128_STRING];
intern = Z_DECIMAL128_OBJ_P(getThis());
if (zend_parse_parameters_none() == FAILURE) {
return;
}
bson_decimal128_to_string(&intern->decimal, outbuf);
#if PHP_VERSION_ID >= 70000
array_init_size(&retval, 1);
ADD_ASSOC_STRING(&retval, "dec", outbuf);
#else
ALLOC_INIT_ZVAL(retval);
array_init_size(retval, 1);
ADD_ASSOC_STRING(retval, "dec", outbuf);
#endif
PHP_VAR_SERIALIZE_INIT(var_hash);
php_var_serialize(&buf, &retval, &var_hash TSRMLS_CC);
smart_str_0(&buf);
PHP_VAR_SERIALIZE_DESTROY(var_hash);
PHONGO_RETVAL_SMART_STR(buf);
smart_str_free(&buf);
zval_ptr_dtor(&retval);
}
/* }}} */
/* {{{ proto string Decimal128::unserialize(string $serialized)
*/
PHP_METHOD(Decimal128, unserialize)
{
php_phongo_decimal128_t *intern;
zend_error_handling error_handling;
char *serialized;
phongo_zpp_char_len serialized_len;
#if PHP_VERSION_ID >= 70000
zval props;
#else
zval *props;
#endif
php_unserialize_data_t var_hash;
intern = Z_DECIMAL128_OBJ_P(getThis());
zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling TSRMLS_CC);
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &serialized, &serialized_len) == FAILURE) {
zend_restore_error_handling(&error_handling TSRMLS_CC);
return;
}
zend_restore_error_handling(&error_handling TSRMLS_CC);
#if PHP_VERSION_ID < 70000
ALLOC_INIT_ZVAL(props);
#endif
PHP_VAR_UNSERIALIZE_INIT(var_hash);
if (!php_var_unserialize(&props, (const unsigned char**) &serialized, (unsigned char *) serialized + serialized_len, &var_hash TSRMLS_CC)) {
zval_ptr_dtor(&props);
phongo_throw_exception(PHONGO_ERROR_UNEXPECTED_VALUE TSRMLS_CC, "%s unserialization failed", ZSTR_VAL(php_phongo_decimal128_ce->name));
PHP_VAR_UNSERIALIZE_DESTROY(var_hash);
return;
}
PHP_VAR_UNSERIALIZE_DESTROY(var_hash);
#if PHP_VERSION_ID >= 70000
php_phongo_decimal128_init_from_hash(intern, HASH_OF(&props) TSRMLS_CC);
#else
php_phongo_decimal128_init_from_hash(intern, HASH_OF(props) TSRMLS_CC);
#endif
zval_ptr_dtor(&props);
}
/* }}} */
/* {{{ BSON\Decimal128 */
ZEND_BEGIN_ARG_INFO_EX(ai_Decimal128___construct, 0, 0, 1)
ZEND_ARG_INFO(0, value)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(ai_Decimal128___set_state, 0, 0, 1)
ZEND_ARG_ARRAY_INFO(0, properties, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(ai_Decimal128_unserialize, 0, 0, 1)
ZEND_ARG_INFO(0, serialized)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(ai_Decimal128_void, 0, 0, 0)
ZEND_END_ARG_INFO()
static zend_function_entry php_phongo_decimal128_me[] = {
PHP_ME(Decimal128, __construct, ai_Decimal128___construct, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
PHP_ME(Decimal128, __set_state, ai_Decimal128___set_state, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
PHP_ME(Decimal128, __toString, ai_Decimal128_void, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
PHP_ME(Decimal128, jsonSerialize, ai_Decimal128_void, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
PHP_ME(Decimal128, serialize, ai_Decimal128_void, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
PHP_ME(Decimal128, unserialize, ai_Decimal128_unserialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
PHP_FE_END
};
/* }}} */
/* {{{ php_phongo_decimal128_t object handlers */
static void php_phongo_decimal128_free_object(phongo_free_object_arg *object TSRMLS_DC) /* {{{ */
{
php_phongo_decimal128_t *intern = Z_OBJ_DECIMAL128(object);
zend_object_std_dtor(&intern->std TSRMLS_CC);
#if PHP_VERSION_ID < 70000
efree(intern);
#endif
} /* }}} */
phongo_create_object_retval php_phongo_decimal128_create_object(zend_class_entry *class_type TSRMLS_DC) /* {{{ */
{
php_phongo_decimal128_t *intern = NULL;
intern = PHONGO_ALLOC_OBJECT_T(php_phongo_decimal128_t, class_type);
zend_object_std_init(&intern->std, class_type TSRMLS_CC);
object_properties_init(&intern->std, class_type);
#if PHP_VERSION_ID >= 70000
intern->std.handlers = &php_phongo_handler_decimal128;
return &intern->std;
#else
{
zend_object_value retval;
retval.handle = zend_objects_store_put(intern, (zend_objects_store_dtor_t) zend_objects_destroy_object, php_phongo_decimal128_free_object, NULL TSRMLS_CC);
retval.handlers = &php_phongo_handler_decimal128;
return retval;
}
#endif
} /* }}} */
+static HashTable *php_phongo_decimal128_get_gc(zval *object, phongo_get_gc_table table, int *n TSRMLS_DC) /* {{{ */
+{
+ *table = NULL;
+ *n = 0;
+
+ return zend_std_get_properties(object TSRMLS_CC);
+} /* }}} */
+
HashTable *php_phongo_decimal128_get_properties(zval *object TSRMLS_DC) /* {{{ */
{
php_phongo_decimal128_t *intern;
HashTable *props;
char outbuf[BSON_DECIMAL128_STRING] = "";
intern = Z_DECIMAL128_OBJ_P(object);
props = zend_std_get_properties(object TSRMLS_CC);
if (!intern->initialized) {
return props;
}
bson_decimal128_to_string(&intern->decimal, outbuf);
#if PHP_VERSION_ID >= 70000
{
zval dec;
ZVAL_STRING(&dec, outbuf);
zend_hash_str_update(props, "dec", sizeof("dec")-1, &dec);
}
#else
{
zval *dec;
MAKE_STD_ZVAL(dec);
ZVAL_STRING(dec, outbuf, 1);
zend_hash_update(props, "dec", sizeof("dec"), &dec, sizeof(dec), NULL);
}
#endif
return props;
} /* }}} */
/* }}} */
/* {{{ PHP_MINIT_FUNCTION */
PHP_MINIT_FUNCTION(Decimal128)
{
zend_class_entry ce;
(void)type;(void)module_number;
INIT_NS_CLASS_ENTRY(ce, "MongoDB\\BSON", "Decimal128", php_phongo_decimal128_me);
php_phongo_decimal128_ce = zend_register_internal_class(&ce TSRMLS_CC);
php_phongo_decimal128_ce->create_object = php_phongo_decimal128_create_object;
PHONGO_CE_FINAL(php_phongo_decimal128_ce);
zend_class_implements(php_phongo_decimal128_ce TSRMLS_CC, 1, php_phongo_json_serializable_ce);
zend_class_implements(php_phongo_decimal128_ce TSRMLS_CC, 1, php_phongo_type_ce);
zend_class_implements(php_phongo_decimal128_ce TSRMLS_CC, 1, zend_ce_serializable);
memcpy(&php_phongo_handler_decimal128, phongo_get_std_object_handlers(), sizeof(zend_object_handlers));
+ php_phongo_handler_decimal128.get_gc = php_phongo_decimal128_get_gc;
php_phongo_handler_decimal128.get_properties = php_phongo_decimal128_get_properties;
#if PHP_VERSION_ID >= 70000
php_phongo_handler_decimal128.free_obj = php_phongo_decimal128_free_object;
php_phongo_handler_decimal128.offset = XtOffsetOf(php_phongo_decimal128_t, std);
#endif
return SUCCESS;
}
/* }}} */
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* End:
* vim600: noet sw=4 ts=4 fdm=marker
* vim<600: noet sw=4 ts=4
*/
diff --git a/mongodb-1.2.3/src/BSON/Javascript.c b/mongodb-1.2.8/src/BSON/Javascript.c
similarity index 98%
rename from mongodb-1.2.3/src/BSON/Javascript.c
rename to mongodb-1.2.8/src/BSON/Javascript.c
index 07a97145..483ab59a 100644
--- a/mongodb-1.2.3/src/BSON/Javascript.c
+++ b/mongodb-1.2.8/src/BSON/Javascript.c
@@ -1,560 +1,569 @@
/*
* Copyright 2014-2017 MongoDB, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
/* External libs */
#include <bson.h>
#include <mongoc.h>
/* PHP Core stuff */
#include <php.h>
#include <php_ini.h>
#include <ext/standard/info.h>
#include <Zend/zend_interfaces.h>
#include <ext/spl/spl_iterators.h>
#include <ext/standard/php_var.h>
#if PHP_VERSION_ID >= 70000
# include <zend_smart_str.h>
#else
# include <ext/standard/php_smart_str.h>
#endif
/* Our Compatability header */
#include "phongo_compat.h"
/* Our stuffz */
#include "php_phongo.h"
#include "php_bson.h"
PHONGO_API zend_class_entry *php_phongo_javascript_ce;
zend_object_handlers php_phongo_handler_javascript;
/* Initialize the object and return whether it was successful. An exception will
* be thrown on error. */
static bool php_phongo_javascript_init(php_phongo_javascript_t *intern, const char *code, phongo_zpp_char_len code_len, zval *scope TSRMLS_DC)
{
if (scope && Z_TYPE_P(scope) != IS_OBJECT && Z_TYPE_P(scope) != IS_ARRAY && Z_TYPE_P(scope) != IS_NULL) {
phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT TSRMLS_CC, "Expected scope to be array or object, %s given", zend_get_type_by_const(Z_TYPE_P(scope)));
return false;
}
if (strlen(code) != code_len) {
phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT TSRMLS_CC, "Code cannot contain null bytes");
return false;
}
intern->code = estrndup(code, code_len);
intern->code_len = code_len;
if (scope && (Z_TYPE_P(scope) == IS_OBJECT || Z_TYPE_P(scope) == IS_ARRAY)) {
intern->scope = bson_new();
phongo_zval_to_bson(scope, PHONGO_BSON_NONE, intern->scope, NULL TSRMLS_CC);
} else {
intern->scope = NULL;
}
return true;
}
/* Initialize the object from a HashTable and return whether it was successful.
* An exception will be thrown on error. */
static bool php_phongo_javascript_init_from_hash(php_phongo_javascript_t *intern, HashTable *props TSRMLS_DC)
{
#if PHP_VERSION_ID >= 70000
zval *code, *scope;
if ((code = zend_hash_str_find(props, "code", sizeof("code")-1)) && Z_TYPE_P(code) == IS_STRING) {
scope = zend_hash_str_find(props, "scope", sizeof("scope")-1);
return php_phongo_javascript_init(intern, Z_STRVAL_P(code), Z_STRLEN_P(code), scope TSRMLS_CC);
}
#else
zval **code, **scope;
if (zend_hash_find(props, "code", sizeof("code"), (void**) &code) == SUCCESS && Z_TYPE_PP(code) == IS_STRING) {
zval *tmp = zend_hash_find(props, "scope", sizeof("scope"), (void**) &scope) == SUCCESS ? *scope : NULL;
return php_phongo_javascript_init(intern, Z_STRVAL_PP(code), Z_STRLEN_PP(code), tmp TSRMLS_CC);
}
#endif
phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT TSRMLS_CC, "%s initialization requires \"code\" string field", ZSTR_VAL(php_phongo_javascript_ce->name));
return false;
}
/* {{{ proto void Javascript::__construct(string $code[, array|object $scope])
Construct a new BSON Javascript type. The scope is a document mapping
identifiers and values, representing the scope in which the code string will
be evaluated. Note that this type cannot be represented as Extended JSON. */
PHP_METHOD(Javascript, __construct)
{
php_phongo_javascript_t *intern;
zend_error_handling error_handling;
char *code;
phongo_zpp_char_len code_len;
zval *scope = NULL;
zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling TSRMLS_CC);
intern = Z_JAVASCRIPT_OBJ_P(getThis());
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|A!", &code, &code_len, &scope) == FAILURE) {
zend_restore_error_handling(&error_handling TSRMLS_CC);
return;
}
zend_restore_error_handling(&error_handling TSRMLS_CC);
php_phongo_javascript_init(intern, code, code_len, scope TSRMLS_CC);
}
/* }}} */
/* {{{ proto void Javascript::__set_state(array $properties)
*/
PHP_METHOD(Javascript, __set_state)
{
php_phongo_javascript_t *intern;
HashTable *props;
zval *array;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a", &array) == FAILURE) {
RETURN_FALSE;
}
object_init_ex(return_value, php_phongo_javascript_ce);
intern = Z_JAVASCRIPT_OBJ_P(return_value);
props = Z_ARRVAL_P(array);
php_phongo_javascript_init_from_hash(intern, props TSRMLS_CC);
}
/* }}} */
/* {{{ proto string Javascript::__toString()
Return the Javascript's code string. */
PHP_METHOD(Javascript, __toString)
{
php_phongo_javascript_t *intern;
if (zend_parse_parameters_none() == FAILURE) {
return;
}
intern = Z_JAVASCRIPT_OBJ_P(getThis());
PHONGO_RETURN_STRINGL(intern->code, intern->code_len);
}
/* }}} */
/* {{{ proto string Javascript::getCode()
*/
PHP_METHOD(Javascript, getCode)
{
php_phongo_javascript_t *intern;
if (zend_parse_parameters_none() == FAILURE) {
return;
}
intern = Z_JAVASCRIPT_OBJ_P(getThis());
PHONGO_RETURN_STRINGL(intern->code, intern->code_len);
}
/* }}} */
/* {{{ proto object|null Javascript::getScope()
*/
PHP_METHOD(Javascript, getScope)
{
php_phongo_javascript_t *intern;
if (zend_parse_parameters_none() == FAILURE) {
return;
}
intern = Z_JAVASCRIPT_OBJ_P(getThis());
if (!intern->scope) {
RETURN_NULL();
}
if (intern->scope->len) {
php_phongo_bson_state state = PHONGO_BSON_STATE_INITIALIZER;
phongo_bson_to_zval_ex(bson_get_data(intern->scope), intern->scope->len, &state);
#if PHP_VERSION_ID >= 70000
RETURN_ZVAL(&state.zchild, 0, 1);
#else
RETURN_ZVAL(state.zchild, 0, 1);
#endif
} else {
RETURN_NULL();
}
}
/* }}} */
/* {{{ proto array Javascript::jsonSerialize()
*/
PHP_METHOD(Javascript, jsonSerialize)
{
php_phongo_javascript_t *intern;
if (zend_parse_parameters_none() == FAILURE) {
return;
}
intern = Z_JAVASCRIPT_OBJ_P(getThis());
array_init_size(return_value, 2);
ADD_ASSOC_STRINGL(return_value, "$code", intern->code, intern->code_len);
if (intern->scope && intern->scope->len) {
php_phongo_bson_state state = PHONGO_BSON_STATE_INITIALIZER;
if (phongo_bson_to_zval_ex(bson_get_data(intern->scope), intern->scope->len, &state)) {
#if PHP_VERSION_ID >= 70000
Z_ADDREF(state.zchild);
ADD_ASSOC_ZVAL_EX(return_value, "$scope", &state.zchild);
#else
Z_ADDREF_P(state.zchild);
ADD_ASSOC_ZVAL_EX(return_value, "$scope", state.zchild);
#endif
}
zval_ptr_dtor(&state.zchild);
}
}
/* }}} */
/* {{{ proto string Javascript::serialize()
*/
PHP_METHOD(Javascript, serialize)
{
php_phongo_javascript_t *intern;
#if PHP_VERSION_ID >= 70000
zval retval;
#else
zval *retval;
#endif
php_phongo_bson_state state = PHONGO_BSON_STATE_INITIALIZER;
php_serialize_data_t var_hash;
smart_str buf = { 0 };
intern = Z_JAVASCRIPT_OBJ_P(getThis());
if (zend_parse_parameters_none() == FAILURE) {
return;
}
#if PHP_VERSION_ID >= 70000
if (intern->scope && intern->scope->len) {
if (!phongo_bson_to_zval_ex(bson_get_data(intern->scope), intern->scope->len, &state)) {
return;
}
Z_ADDREF(state.zchild);
} else {
ZVAL_NULL(&state.zchild);
}
#else
if (intern->scope && intern->scope->len) {
if (!phongo_bson_to_zval_ex(bson_get_data(intern->scope), intern->scope->len, &state)) {
return;
}
Z_ADDREF_P(state.zchild);
} else {
MAKE_STD_ZVAL(state.zchild);
ZVAL_NULL(state.zchild);
Z_ADDREF_P(state.zchild);
}
#endif
#if PHP_VERSION_ID >= 70000
array_init_size(&retval, 2);
ADD_ASSOC_STRINGL(&retval, "code", intern->code, intern->code_len);
ADD_ASSOC_ZVAL(&retval, "scope", &state.zchild);
#else
ALLOC_INIT_ZVAL(retval);
array_init_size(retval, 2);
ADD_ASSOC_STRINGL(retval, "code", intern->code, intern->code_len);
ADD_ASSOC_ZVAL(retval, "scope", state.zchild);
#endif
PHP_VAR_SERIALIZE_INIT(var_hash);
php_var_serialize(&buf, &retval, &var_hash TSRMLS_CC);
smart_str_0(&buf);
PHP_VAR_SERIALIZE_DESTROY(var_hash);
PHONGO_RETVAL_SMART_STR(buf);
smart_str_free(&buf);
zval_ptr_dtor(&retval);
zval_ptr_dtor(&state.zchild);
}
/* }}} */
/* {{{ proto string Javascript::unserialize(string $serialized)
*/
PHP_METHOD(Javascript, unserialize)
{
php_phongo_javascript_t *intern;
zend_error_handling error_handling;
char *serialized;
phongo_zpp_char_len serialized_len;
#if PHP_VERSION_ID >= 70000
zval props;
#else
zval *props;
#endif
php_unserialize_data_t var_hash;
intern = Z_JAVASCRIPT_OBJ_P(getThis());
zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling TSRMLS_CC);
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &serialized, &serialized_len) == FAILURE) {
zend_restore_error_handling(&error_handling TSRMLS_CC);
return;
}
zend_restore_error_handling(&error_handling TSRMLS_CC);
#if PHP_VERSION_ID < 70000
ALLOC_INIT_ZVAL(props);
#endif
PHP_VAR_UNSERIALIZE_INIT(var_hash);
if (!php_var_unserialize(&props, (const unsigned char**) &serialized, (unsigned char *) serialized + serialized_len, &var_hash TSRMLS_CC)) {
zval_ptr_dtor(&props);
phongo_throw_exception(PHONGO_ERROR_UNEXPECTED_VALUE TSRMLS_CC, "%s unserialization failed", ZSTR_VAL(php_phongo_javascript_ce->name));
PHP_VAR_UNSERIALIZE_DESTROY(var_hash);
return;
}
PHP_VAR_UNSERIALIZE_DESTROY(var_hash);
#if PHP_VERSION_ID >= 70000
php_phongo_javascript_init_from_hash(intern, HASH_OF(&props) TSRMLS_CC);
#else
php_phongo_javascript_init_from_hash(intern, HASH_OF(props) TSRMLS_CC);
#endif
zval_ptr_dtor(&props);
}
/* }}} */
/* {{{ BSON\Javascript */
ZEND_BEGIN_ARG_INFO_EX(ai_Javascript___construct, 0, 0, 1)
ZEND_ARG_INFO(0, javascript)
ZEND_ARG_INFO(0, scope)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(ai_Javascript___set_state, 0, 0, 1)
ZEND_ARG_ARRAY_INFO(0, properties, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(ai_Javascript_unserialize, 0, 0, 1)
ZEND_ARG_INFO(0, serialized)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(ai_Javascript_void, 0, 0, 0)
ZEND_END_ARG_INFO()
static zend_function_entry php_phongo_javascript_me[] = {
PHP_ME(Javascript, __construct, ai_Javascript___construct, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
PHP_ME(Javascript, __set_state, ai_Javascript___set_state, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
PHP_ME(Javascript, __toString, ai_Javascript_void, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
PHP_ME(Javascript, jsonSerialize, ai_Javascript_void, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
PHP_ME(Javascript, serialize, ai_Javascript_void, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
PHP_ME(Javascript, unserialize, ai_Javascript_unserialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
PHP_ME(Javascript, getCode, ai_Javascript_void, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
PHP_ME(Javascript, getScope, ai_Javascript_void, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
PHP_FE_END
};
/* }}} */
/* {{{ php_phongo_javascript_t object handlers */
static void php_phongo_javascript_free_object(phongo_free_object_arg *object TSRMLS_DC) /* {{{ */
{
php_phongo_javascript_t *intern = Z_OBJ_JAVASCRIPT(object);
zend_object_std_dtor(&intern->std TSRMLS_CC);
if (intern->code) {
efree(intern->code);
}
if (intern->scope) {
bson_destroy(intern->scope);
intern->scope = NULL;
}
#if PHP_VERSION_ID < 70000
efree(intern);
#endif
} /* }}} */
phongo_create_object_retval php_phongo_javascript_create_object(zend_class_entry *class_type TSRMLS_DC) /* {{{ */
{
php_phongo_javascript_t *intern = NULL;
intern = PHONGO_ALLOC_OBJECT_T(php_phongo_javascript_t, class_type);
zend_object_std_init(&intern->std, class_type TSRMLS_CC);
object_properties_init(&intern->std, class_type);
#if PHP_VERSION_ID >= 70000
intern->std.handlers = &php_phongo_handler_javascript;
return &intern->std;
#else
{
zend_object_value retval;
retval.handle = zend_objects_store_put(intern, (zend_objects_store_dtor_t) zend_objects_destroy_object, php_phongo_javascript_free_object, NULL TSRMLS_CC);
retval.handlers = &php_phongo_handler_javascript;
return retval;
}
#endif
} /* }}} */
static int php_phongo_javascript_compare_objects(zval *o1, zval *o2 TSRMLS_DC) /* {{{ */
{
php_phongo_javascript_t *intern1, *intern2;
intern1 = Z_JAVASCRIPT_OBJ_P(o1);
intern2 = Z_JAVASCRIPT_OBJ_P(o2);
/* Do not consider the scope document for comparisons */
return strcmp(intern1->code, intern2->code);
} /* }}} */
+static HashTable *php_phongo_javascript_get_gc(zval *object, phongo_get_gc_table table, int *n TSRMLS_DC) /* {{{ */
+{
+ *table = NULL;
+ *n = 0;
+
+ return zend_std_get_properties(object TSRMLS_CC);
+} /* }}} */
+
HashTable *php_phongo_javascript_get_properties(zval *object TSRMLS_DC) /* {{{ */
{
php_phongo_javascript_t *intern;
HashTable *props;
intern = Z_JAVASCRIPT_OBJ_P(object);
props = zend_std_get_properties(object TSRMLS_CC);
if (!intern->code) {
return props;
}
#if PHP_VERSION_ID >= 70000
{
zval code;
ZVAL_STRING(&code, intern->code);
zend_hash_str_update(props, "code", sizeof("code")-1, &code);
if (intern->scope) {
php_phongo_bson_state state = PHONGO_BSON_STATE_INITIALIZER;
if (phongo_bson_to_zval_ex(bson_get_data(intern->scope), intern->scope->len, &state)) {
Z_ADDREF(state.zchild);
zend_hash_str_update(props, "scope", sizeof("scope")-1, &state.zchild);
} else {
zval scope;
ZVAL_NULL(&scope);
zend_hash_str_update(props, "scope", sizeof("scope")-1, &scope);
}
zval_ptr_dtor(&state.zchild);
} else {
zval scope;
ZVAL_NULL(&scope);
zend_hash_str_update(props, "scope", sizeof("scope")-1, &scope);
}
}
#else
{
zval *code;
MAKE_STD_ZVAL(code);
ZVAL_STRING(code, intern->code, 1);
zend_hash_update(props, "code", sizeof("code"), &code, sizeof(code), NULL);
if (intern->scope) {
php_phongo_bson_state state = PHONGO_BSON_STATE_INITIALIZER;
if (phongo_bson_to_zval_ex(bson_get_data(intern->scope), intern->scope->len, &state)) {
Z_ADDREF_P(state.zchild);
zend_hash_update(props, "scope", sizeof("scope"), &state.zchild, sizeof(state.zchild), NULL);
} else {
zval *scope;
MAKE_STD_ZVAL(scope);
ZVAL_NULL(scope);
zend_hash_update(props, "scope", sizeof("scope"), &scope, sizeof(scope), NULL);
}
zval_ptr_dtor(&state.zchild);
} else {
zval *scope;
MAKE_STD_ZVAL(scope);
ZVAL_NULL(scope);
zend_hash_update(props, "scope", sizeof("scope"), &scope, sizeof(scope), NULL);
}
}
#endif
return props;
} /* }}} */
/* }}} */
/* {{{ PHP_MINIT_FUNCTION */
PHP_MINIT_FUNCTION(Javascript)
{
zend_class_entry ce;
(void)type;(void)module_number;
INIT_NS_CLASS_ENTRY(ce, "MongoDB\\BSON", "Javascript", php_phongo_javascript_me);
php_phongo_javascript_ce = zend_register_internal_class(&ce TSRMLS_CC);
php_phongo_javascript_ce->create_object = php_phongo_javascript_create_object;
PHONGO_CE_FINAL(php_phongo_javascript_ce);
zend_class_implements(php_phongo_javascript_ce TSRMLS_CC, 1, php_phongo_json_serializable_ce);
zend_class_implements(php_phongo_javascript_ce TSRMLS_CC, 1, php_phongo_type_ce);
zend_class_implements(php_phongo_javascript_ce TSRMLS_CC, 1, zend_ce_serializable);
memcpy(&php_phongo_handler_javascript, phongo_get_std_object_handlers(), sizeof(zend_object_handlers));
php_phongo_handler_javascript.compare_objects = php_phongo_javascript_compare_objects;
+ php_phongo_handler_javascript.get_gc = php_phongo_javascript_get_gc;
php_phongo_handler_javascript.get_properties = php_phongo_javascript_get_properties;
#if PHP_VERSION_ID >= 70000
php_phongo_handler_javascript.free_obj = php_phongo_javascript_free_object;
php_phongo_handler_javascript.offset = XtOffsetOf(php_phongo_javascript_t, std);
#endif
return SUCCESS;
}
/* }}} */
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* End:
* vim600: noet sw=4 ts=4 fdm=marker
* vim<600: noet sw=4 ts=4
*/
diff --git a/mongodb-1.2.3/src/BSON/MaxKey.c b/mongodb-1.2.8/src/BSON/MaxKey.c
similarity index 100%
rename from mongodb-1.2.3/src/BSON/MaxKey.c
rename to mongodb-1.2.8/src/BSON/MaxKey.c
diff --git a/mongodb-1.2.3/src/BSON/MinKey.c b/mongodb-1.2.8/src/BSON/MinKey.c
similarity index 100%
rename from mongodb-1.2.3/src/BSON/MinKey.c
rename to mongodb-1.2.8/src/BSON/MinKey.c
diff --git a/mongodb-1.2.3/src/BSON/ObjectID.c b/mongodb-1.2.8/src/BSON/ObjectID.c
similarity index 96%
rename from mongodb-1.2.3/src/BSON/ObjectID.c
rename to mongodb-1.2.8/src/BSON/ObjectID.c
index a79af9d5..ad9f8e1d 100644
--- a/mongodb-1.2.3/src/BSON/ObjectID.c
+++ b/mongodb-1.2.8/src/BSON/ObjectID.c
@@ -1,445 +1,450 @@
/*
* Copyright 2014-2017 MongoDB, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
/* External libs */
#include <bson.h>
#include <mongoc.h>
/* PHP Core stuff */
#include <php.h>
#include <php_ini.h>
#include <ext/standard/info.h>
#include <Zend/zend_interfaces.h>
#include <ext/spl/spl_iterators.h>
#include <ext/standard/php_var.h>
#if PHP_VERSION_ID >= 70000
# include <zend_smart_str.h>
#else
# include <ext/standard/php_smart_str.h>
#endif
/* Our Compatability header */
#include "phongo_compat.h"
/* Our stuffz */
#include "php_phongo.h"
#include "php_bson.h"
PHONGO_API zend_class_entry *php_phongo_objectid_ce;
zend_object_handlers php_phongo_handler_objectid;
/* Initialize the object with a generated value and return whether it was
* successful. */
static bool php_phongo_objectid_init(php_phongo_objectid_t *intern)
{
bson_oid_t oid;
intern->initialized = true;
bson_oid_init(&oid, NULL);
bson_oid_to_string(&oid, intern->oid);
return true;
}
/* Initialize the object from a hex string and return whether it was successful.
* An exception will be thrown on error. */
-static bool php_phongo_objectid_init_from_hex_string(php_phongo_objectid_t *intern, const char *oid, phongo_zpp_char_len oid_len TSRMLS_DC)
+static bool php_phongo_objectid_init_from_hex_string(php_phongo_objectid_t *intern, const char *hex, phongo_zpp_char_len hex_len TSRMLS_DC)
{
- char *tid = zend_str_tolower_dup(oid, oid_len);
-
- if (bson_oid_is_valid(tid, oid_len)) {
+ if (bson_oid_is_valid(hex, hex_len)) {
bson_oid_t oid;
- bson_oid_init_from_string(&oid, tid);
+ bson_oid_init_from_string(&oid, hex);
bson_oid_to_string(&oid, intern->oid);
intern->initialized = true;
- efree(tid);
return true;
}
- phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT TSRMLS_CC, "Error parsing ObjectID string: %s", oid);
+ phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT TSRMLS_CC, "Error parsing ObjectID string: %s", hex);
- efree(tid);
return false;
}
/* Initialize the object from a HashTable and return whether it was successful.
* An exception will be thrown on error. */
static bool php_phongo_objectid_init_from_hash(php_phongo_objectid_t *intern, HashTable *props TSRMLS_DC)
{
#if PHP_VERSION_ID >= 70000
zval *z_oid;
z_oid = zend_hash_str_find(props, "oid", sizeof("oid")-1);
if (z_oid && Z_TYPE_P(z_oid) == IS_STRING) {
return php_phongo_objectid_init_from_hex_string(intern, Z_STRVAL_P(z_oid), Z_STRLEN_P(z_oid) TSRMLS_CC);
}
#else
zval **z_oid;
if (zend_hash_find(props, "oid", sizeof("oid"), (void**) &z_oid) == SUCCESS && Z_TYPE_PP(z_oid) == IS_STRING) {
return php_phongo_objectid_init_from_hex_string(intern, Z_STRVAL_PP(z_oid), Z_STRLEN_PP(z_oid) TSRMLS_CC);
}
#endif
phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT TSRMLS_CC, "%s initialization requires \"oid\" string field", ZSTR_VAL(php_phongo_objectid_ce->name));
return false;
}
/* {{{ proto void ObjectID::__construct([string $id])
Constructs a new BSON ObjectID type, optionally from a hex string. */
PHP_METHOD(ObjectID, __construct)
{
php_phongo_objectid_t *intern;
zend_error_handling error_handling;
char *id = NULL;
phongo_zpp_char_len id_len;
zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling TSRMLS_CC);
intern = Z_OBJECTID_OBJ_P(getThis());
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s!", &id, &id_len) == FAILURE) {
zend_restore_error_handling(&error_handling TSRMLS_CC);
return;
}
zend_restore_error_handling(&error_handling TSRMLS_CC);
if (id) {
php_phongo_objectid_init_from_hex_string(intern, id, id_len TSRMLS_CC);
} else {
php_phongo_objectid_init(intern);
}
}
/* }}} */
/* {{{ proto integer ObjectID::getTimestamp()
*/
PHP_METHOD(ObjectID, getTimestamp)
{
php_phongo_objectid_t *intern;
bson_oid_t tmp_oid;
intern = Z_OBJECTID_OBJ_P(getThis());
if (zend_parse_parameters_none() == FAILURE) {
return;
}
bson_oid_init_from_string(&tmp_oid, intern->oid);
RETVAL_LONG(bson_oid_get_time_t(&tmp_oid));
}
/* }}} */
/* {{{ proto ObjectID::__set_state(array $properties)
*/
PHP_METHOD(ObjectID, __set_state)
{
php_phongo_objectid_t *intern;
HashTable *props;
zval *array;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a", &array) == FAILURE) {
RETURN_FALSE;
}
object_init_ex(return_value, php_phongo_objectid_ce);
intern = Z_OBJECTID_OBJ_P(return_value);
props = Z_ARRVAL_P(array);
php_phongo_objectid_init_from_hash(intern, props TSRMLS_CC);
}
/* }}} */
/* {{{ proto string ObjectID::__toString()
*/
PHP_METHOD(ObjectID, __toString)
{
php_phongo_objectid_t *intern;
intern = Z_OBJECTID_OBJ_P(getThis());
if (zend_parse_parameters_none() == FAILURE) {
return;
}
PHONGO_RETURN_STRINGL(intern->oid, 24);
}
/* }}} */
/* {{{ proto array ObjectID::jsonSerialize()
*/
PHP_METHOD(ObjectID, jsonSerialize)
{
php_phongo_objectid_t *intern;
if (zend_parse_parameters_none() == FAILURE) {
return;
}
intern = Z_OBJECTID_OBJ_P(getThis());
array_init_size(return_value, 1);
ADD_ASSOC_STRINGL(return_value, "$oid", intern->oid, 24);
}
/* }}} */
/* {{{ proto string ObjectID::serialize()
*/
PHP_METHOD(ObjectID, serialize)
{
php_phongo_objectid_t *intern;
#if PHP_VERSION_ID >= 70000
zval retval;
#else
zval *retval;
#endif
php_serialize_data_t var_hash;
smart_str buf = { 0 };
intern = Z_OBJECTID_OBJ_P(getThis());
if (zend_parse_parameters_none() == FAILURE) {
return;
}
#if PHP_VERSION_ID >= 70000
array_init_size(&retval, 2);
ADD_ASSOC_STRINGL(&retval, "oid", intern->oid, 24);
#else
ALLOC_INIT_ZVAL(retval);
array_init_size(retval, 2);
ADD_ASSOC_STRINGL(retval, "oid", intern->oid, 24);
#endif
PHP_VAR_SERIALIZE_INIT(var_hash);
php_var_serialize(&buf, &retval, &var_hash TSRMLS_CC);
smart_str_0(&buf);
PHP_VAR_SERIALIZE_DESTROY(var_hash);
PHONGO_RETVAL_SMART_STR(buf);
smart_str_free(&buf);
zval_ptr_dtor(&retval);
}
/* }}} */
/* {{{ proto string ObjectID::unserialize(string $serialized)
*/
PHP_METHOD(ObjectID, unserialize)
{
php_phongo_objectid_t *intern;
zend_error_handling error_handling;
char *serialized;
phongo_zpp_char_len serialized_len;
#if PHP_VERSION_ID >= 70000
zval props;
#else
zval *props;
#endif
php_unserialize_data_t var_hash;
intern = Z_OBJECTID_OBJ_P(getThis());
zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling TSRMLS_CC);
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &serialized, &serialized_len) == FAILURE) {
zend_restore_error_handling(&error_handling TSRMLS_CC);
return;
}
zend_restore_error_handling(&error_handling TSRMLS_CC);
#if PHP_VERSION_ID < 70000
ALLOC_INIT_ZVAL(props);
#endif
PHP_VAR_UNSERIALIZE_INIT(var_hash);
if (!php_var_unserialize(&props, (const unsigned char**) &serialized, (unsigned char *) serialized + serialized_len, &var_hash TSRMLS_CC)) {
zval_ptr_dtor(&props);
phongo_throw_exception(PHONGO_ERROR_UNEXPECTED_VALUE TSRMLS_CC, "%s unserialization failed", ZSTR_VAL(php_phongo_objectid_ce->name));
PHP_VAR_UNSERIALIZE_DESTROY(var_hash);
return;
}
PHP_VAR_UNSERIALIZE_DESTROY(var_hash);
#if PHP_VERSION_ID >= 70000
php_phongo_objectid_init_from_hash(intern, HASH_OF(&props) TSRMLS_CC);
#else
php_phongo_objectid_init_from_hash(intern, HASH_OF(props) TSRMLS_CC);
#endif
zval_ptr_dtor(&props);
}
/* }}} */
/* {{{ BSON\ObjectID */
ZEND_BEGIN_ARG_INFO_EX(ai_ObjectID___construct, 0, 0, 0)
ZEND_ARG_INFO(0, id)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(ai_ObjectID___set_state, 0, 0, 1)
ZEND_ARG_ARRAY_INFO(0, properties, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(ai_ObjectID_unserialize, 0, 0, 1)
ZEND_ARG_INFO(0, serialized)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(ai_ObjectID_void, 0, 0, 0)
ZEND_END_ARG_INFO()
static zend_function_entry php_phongo_objectid_me[] = {
PHP_ME(ObjectID, __construct, ai_ObjectID___construct, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
PHP_ME(ObjectID, getTimestamp, ai_ObjectID_void, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
PHP_ME(ObjectID, __set_state, ai_ObjectID___set_state, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
PHP_ME(ObjectID, __toString, ai_ObjectID_void, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
PHP_ME(ObjectID, jsonSerialize, ai_ObjectID_void, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
PHP_ME(ObjectID, serialize, ai_ObjectID_void, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
PHP_ME(ObjectID, unserialize, ai_ObjectID_unserialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
PHP_FE_END
};
/* }}} */
/* {{{ php_phongo_objectid_t object handlers */
static void php_phongo_objectid_free_object(phongo_free_object_arg *object TSRMLS_DC) /* {{{ */
{
php_phongo_objectid_t *intern = Z_OBJ_OBJECTID(object);
zend_object_std_dtor(&intern->std TSRMLS_CC);
#if PHP_VERSION_ID < 70000
efree(intern);
#endif
} /* }}} */
phongo_create_object_retval php_phongo_objectid_create_object(zend_class_entry *class_type TSRMLS_DC) /* {{{ */
{
php_phongo_objectid_t *intern = NULL;
intern = PHONGO_ALLOC_OBJECT_T(php_phongo_objectid_t, class_type);
zend_object_std_init(&intern->std, class_type TSRMLS_CC);
object_properties_init(&intern->std, class_type);
#if PHP_VERSION_ID >= 70000
intern->std.handlers = &php_phongo_handler_objectid;
return &intern->std;
#else
{
zend_object_value retval;
retval.handle = zend_objects_store_put(intern, (zend_objects_store_dtor_t) zend_objects_destroy_object, php_phongo_objectid_free_object, NULL TSRMLS_CC);
retval.handlers = &php_phongo_handler_objectid;
return retval;
}
#endif
} /* }}} */
static int php_phongo_objectid_compare_objects(zval *o1, zval *o2 TSRMLS_DC) /* {{{ */
{
php_phongo_objectid_t *intern1;
php_phongo_objectid_t *intern2;
intern1 = Z_OBJECTID_OBJ_P(o1);
intern2 = Z_OBJECTID_OBJ_P(o2);
return strcmp(intern1->oid, intern2->oid);
} /* }}} */
+static HashTable *php_phongo_objectid_get_gc(zval *object, phongo_get_gc_table table, int *n TSRMLS_DC) /* {{{ */
+{
+ *table = NULL;
+ *n = 0;
+
+ return zend_std_get_properties(object TSRMLS_CC);
+} /* }}} */
+
HashTable *php_phongo_objectid_get_properties(zval *object TSRMLS_DC) /* {{{ */
{
php_phongo_objectid_t *intern;
HashTable *props;
intern = Z_OBJECTID_OBJ_P(object);
props = zend_std_get_properties(object TSRMLS_CC);
if (!intern->oid) {
return props;
}
#if PHP_VERSION_ID >= 70000
{
zval zv;
ZVAL_STRING(&zv, intern->oid);
zend_hash_str_update(props, "oid", sizeof("oid")-1, &zv);
}
#else
{
zval *zv;
MAKE_STD_ZVAL(zv);
ZVAL_STRING(zv, intern->oid, 1);
zend_hash_update(props, "oid", sizeof("oid"), &zv, sizeof(zv), NULL);
}
#endif
return props;
} /* }}} */
/* }}} */
/* {{{ PHP_MINIT_FUNCTION */
PHP_MINIT_FUNCTION(ObjectID)
{
zend_class_entry ce;
(void)type;(void)module_number;
INIT_NS_CLASS_ENTRY(ce, "MongoDB\\BSON", "ObjectID", php_phongo_objectid_me);
php_phongo_objectid_ce = zend_register_internal_class(&ce TSRMLS_CC);
php_phongo_objectid_ce->create_object = php_phongo_objectid_create_object;
PHONGO_CE_FINAL(php_phongo_objectid_ce);
zend_class_implements(php_phongo_objectid_ce TSRMLS_CC, 1, php_phongo_json_serializable_ce);
zend_class_implements(php_phongo_objectid_ce TSRMLS_CC, 1, php_phongo_type_ce);
zend_class_implements(php_phongo_objectid_ce TSRMLS_CC, 1, zend_ce_serializable);
memcpy(&php_phongo_handler_objectid, phongo_get_std_object_handlers(), sizeof(zend_object_handlers));
php_phongo_handler_objectid.compare_objects = php_phongo_objectid_compare_objects;
+ php_phongo_handler_objectid.get_gc = php_phongo_objectid_get_gc;
php_phongo_handler_objectid.get_properties = php_phongo_objectid_get_properties;
#if PHP_VERSION_ID >= 70000
php_phongo_handler_objectid.free_obj = php_phongo_objectid_free_object;
php_phongo_handler_objectid.offset = XtOffsetOf(php_phongo_objectid_t, std);
#endif
return SUCCESS;
}
/* }}} */
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* End:
* vim600: noet sw=4 ts=4 fdm=marker
* vim<600: noet sw=4 ts=4
*/
diff --git a/mongodb-1.2.3/src/BSON/Persistable.c b/mongodb-1.2.8/src/BSON/Persistable.c
similarity index 100%
rename from mongodb-1.2.3/src/BSON/Persistable.c
rename to mongodb-1.2.8/src/BSON/Persistable.c
diff --git a/mongodb-1.2.3/src/BSON/Regex.c b/mongodb-1.2.8/src/BSON/Regex.c
similarity index 98%
rename from mongodb-1.2.3/src/BSON/Regex.c
rename to mongodb-1.2.8/src/BSON/Regex.c
index 0a64c666..9e005e21 100644
--- a/mongodb-1.2.3/src/BSON/Regex.c
+++ b/mongodb-1.2.8/src/BSON/Regex.c
@@ -1,492 +1,501 @@
/*
* Copyright 2014-2017 MongoDB, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
/* External libs */
#include <bson.h>
#include <mongoc.h>
/* PHP Core stuff */
#include <php.h>
#include <php_ini.h>
#include <ext/standard/info.h>
#include <Zend/zend_interfaces.h>
#include <ext/spl/spl_iterators.h>
#include <ext/standard/php_var.h>
#if PHP_VERSION_ID >= 70000
# include <zend_smart_str.h>
#else
# include <ext/standard/php_smart_str.h>
#endif
/* Our Compatability header */
#include "phongo_compat.h"
/* Our stuffz */
#include "php_phongo.h"
#include "php_bson.h"
PHONGO_API zend_class_entry *php_phongo_regex_ce;
zend_object_handlers php_phongo_handler_regex;
/* qsort() compare callback for alphabetizing regex flags upon initialization */
static int php_phongo_regex_compare_flags(const void *f1, const void *f2) {
if (* (const char *) f1 == * (const char *) f2) {
return 0;
}
return (* (const char *) f1 > * (const char *) f2) ? 1 : -1;
}
/* Initialize the object and return whether it was successful. An exception will
* be thrown on error. */
static bool php_phongo_regex_init(php_phongo_regex_t *intern, const char *pattern, phongo_zpp_char_len pattern_len, const char *flags, phongo_zpp_char_len flags_len TSRMLS_DC)
{
if (strlen(pattern) != pattern_len) {
phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT TSRMLS_CC, "Pattern cannot contain null bytes");
return false;
}
intern->pattern = estrndup(pattern, pattern_len);
intern->pattern_len = pattern_len;
if (flags) {
if (strlen(flags) != flags_len) {
phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT TSRMLS_CC, "Flags cannot contain null bytes");
return false;
}
intern->flags = estrndup(flags, flags_len);
intern->flags_len = flags_len;
/* Ensure flags are alphabetized upon initialization */
qsort((void *) intern->flags, flags_len, 1, php_phongo_regex_compare_flags);
} else {
intern->flags = estrdup("");
intern->flags_len = 0;
}
return true;
}
/* Initialize the object from a HashTable and return whether it was successful.
* An exception will be thrown on error. */
static bool php_phongo_regex_init_from_hash(php_phongo_regex_t *intern, HashTable *props TSRMLS_DC)
{
#if PHP_VERSION_ID >= 70000
zval *pattern, *flags;
if ((pattern = zend_hash_str_find(props, "pattern", sizeof("pattern")-1)) && Z_TYPE_P(pattern) == IS_STRING &&
(flags = zend_hash_str_find(props, "flags", sizeof("flags")-1)) && Z_TYPE_P(flags) == IS_STRING) {
return php_phongo_regex_init(intern, Z_STRVAL_P(pattern), Z_STRLEN_P(pattern), Z_STRVAL_P(flags), Z_STRLEN_P(flags) TSRMLS_CC);
}
#else
zval **pattern, **flags;
if (zend_hash_find(props, "pattern", sizeof("pattern"), (void**) &pattern) == SUCCESS && Z_TYPE_PP(pattern) == IS_STRING &&
zend_hash_find(props, "flags", sizeof("flags"), (void**) &flags) == SUCCESS && Z_TYPE_PP(flags) == IS_STRING) {
return php_phongo_regex_init(intern, Z_STRVAL_PP(pattern), Z_STRLEN_PP(pattern), Z_STRVAL_PP(flags), Z_STRLEN_PP(flags) TSRMLS_CC);
}
#endif
phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT TSRMLS_CC, "%s initialization requires \"pattern\" and \"flags\" string fields", ZSTR_VAL(php_phongo_regex_ce->name));
return false;
}
/* {{{ proto void Regex::__construct(string $pattern [, string $flags])
Constructs a new BSON regular expression type. */
PHP_METHOD(Regex, __construct)
{
php_phongo_regex_t *intern;
zend_error_handling error_handling;
char *pattern;
phongo_zpp_char_len pattern_len;
char *flags = NULL;
phongo_zpp_char_len flags_len = 0;
zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling TSRMLS_CC);
intern = Z_REGEX_OBJ_P(getThis());
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|s", &pattern, &pattern_len, &flags, &flags_len) == FAILURE) {
zend_restore_error_handling(&error_handling TSRMLS_CC);
return;
}
zend_restore_error_handling(&error_handling TSRMLS_CC);
php_phongo_regex_init(intern, pattern, pattern_len, flags, flags_len TSRMLS_CC);
}
/* }}} */
/* {{{ proto string Regex::getPattern()
*/
PHP_METHOD(Regex, getPattern)
{
php_phongo_regex_t *intern;
intern = Z_REGEX_OBJ_P(getThis());
if (zend_parse_parameters_none() == FAILURE) {
return;
}
PHONGO_RETURN_STRINGL(intern->pattern, intern->pattern_len);
}
/* }}} */
/* {{{ proto string Regex::getFlags()
*/
PHP_METHOD(Regex, getFlags)
{
php_phongo_regex_t *intern;
intern = Z_REGEX_OBJ_P(getThis());
if (zend_parse_parameters_none() == FAILURE) {
return;
}
PHONGO_RETURN_STRINGL(intern->flags, intern->flags_len);
}
/* }}} */
/* {{{ proto void Regex::__set_state(array $properties)
*/
PHP_METHOD(Regex, __set_state)
{
php_phongo_regex_t *intern;
HashTable *props;
zval *array;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a", &array) == FAILURE) {
RETURN_FALSE;
}
object_init_ex(return_value, php_phongo_regex_ce);
intern = Z_REGEX_OBJ_P(return_value);
props = Z_ARRVAL_P(array);
php_phongo_regex_init_from_hash(intern, props TSRMLS_CC);
}
/* }}} */
/* {{{ proto string Regex::__toString()
Returns a string in the form: /pattern/flags */
PHP_METHOD(Regex, __toString)
{
php_phongo_regex_t *intern;
char *regex;
int regex_len;
intern = Z_REGEX_OBJ_P(getThis());
if (zend_parse_parameters_none() == FAILURE) {
return;
}
regex_len = spprintf(&regex, 0, "/%s/%s", intern->pattern, intern->flags);
PHONGO_RETVAL_STRINGL(regex, regex_len);
efree(regex);
}
/* }}} */
/* {{{ proto array Regex::jsonSerialize()
*/
PHP_METHOD(Regex, jsonSerialize)
{
php_phongo_regex_t *intern;
if (zend_parse_parameters_none() == FAILURE) {
return;
}
intern = Z_REGEX_OBJ_P(getThis());
array_init_size(return_value, 2);
ADD_ASSOC_STRINGL(return_value, "$regex", intern->pattern, intern->pattern_len);
ADD_ASSOC_STRINGL(return_value, "$options", intern->flags, intern->flags_len);
}
/* }}} */
/* {{{ proto string Regex::serialize()
*/
PHP_METHOD(Regex, serialize)
{
php_phongo_regex_t *intern;
#if PHP_VERSION_ID >= 70000
zval retval;
#else
zval *retval;
#endif
php_serialize_data_t var_hash;
smart_str buf = { 0 };
intern = Z_REGEX_OBJ_P(getThis());
if (zend_parse_parameters_none() == FAILURE) {
return;
}
#if PHP_VERSION_ID >= 70000
array_init_size(&retval, 2);
ADD_ASSOC_STRINGL(&retval, "pattern", intern->pattern, intern->pattern_len);
ADD_ASSOC_STRINGL(&retval, "flags", intern->flags, intern->flags_len);
#else
ALLOC_INIT_ZVAL(retval);
array_init_size(retval, 2);
ADD_ASSOC_STRINGL(retval, "pattern", intern->pattern, intern->pattern_len);
ADD_ASSOC_STRINGL(retval, "flags", intern->flags, intern->flags_len);
#endif
PHP_VAR_SERIALIZE_INIT(var_hash);
php_var_serialize(&buf, &retval, &var_hash TSRMLS_CC);
smart_str_0(&buf);
PHP_VAR_SERIALIZE_DESTROY(var_hash);
PHONGO_RETVAL_SMART_STR(buf);
smart_str_free(&buf);
zval_ptr_dtor(&retval);
}
/* }}} */
/* {{{ proto string Regex::unserialize(string $serialized)
*/
PHP_METHOD(Regex, unserialize)
{
php_phongo_regex_t *intern;
zend_error_handling error_handling;
char *serialized;
phongo_zpp_char_len serialized_len;
#if PHP_VERSION_ID >= 70000
zval props;
#else
zval *props;
#endif
php_unserialize_data_t var_hash;
intern = Z_REGEX_OBJ_P(getThis());
zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling TSRMLS_CC);
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &serialized, &serialized_len) == FAILURE) {
zend_restore_error_handling(&error_handling TSRMLS_CC);
return;
}
zend_restore_error_handling(&error_handling TSRMLS_CC);
#if PHP_VERSION_ID < 70000
ALLOC_INIT_ZVAL(props);
#endif
PHP_VAR_UNSERIALIZE_INIT(var_hash);
if (!php_var_unserialize(&props, (const unsigned char**) &serialized, (unsigned char *) serialized + serialized_len, &var_hash TSRMLS_CC)) {
zval_ptr_dtor(&props);
phongo_throw_exception(PHONGO_ERROR_UNEXPECTED_VALUE TSRMLS_CC, "%s unserialization failed", ZSTR_VAL(php_phongo_regex_ce->name));
PHP_VAR_UNSERIALIZE_DESTROY(var_hash);
return;
}
PHP_VAR_UNSERIALIZE_DESTROY(var_hash);
#if PHP_VERSION_ID >= 70000
php_phongo_regex_init_from_hash(intern, HASH_OF(&props) TSRMLS_CC);
#else
php_phongo_regex_init_from_hash(intern, HASH_OF(props) TSRMLS_CC);
#endif
zval_ptr_dtor(&props);
}
/* }}} */
/* {{{ BSON\Regex */
ZEND_BEGIN_ARG_INFO_EX(ai_Regex___construct, 0, 0, 2)
ZEND_ARG_INFO(0, pattern)
ZEND_ARG_INFO(0, flags)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(ai_Regex___set_state, 0, 0, 1)
ZEND_ARG_ARRAY_INFO(0, properties, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(ai_Regex_unserialize, 0, 0, 1)
ZEND_ARG_INFO(0, serialized)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(ai_Regex_void, 0, 0, 0)
ZEND_END_ARG_INFO()
static zend_function_entry php_phongo_regex_me[] = {
PHP_ME(Regex, __construct, ai_Regex___construct, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
PHP_ME(Regex, __set_state, ai_Regex___set_state, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
PHP_ME(Regex, __toString, ai_Regex_void, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
PHP_ME(Regex, jsonSerialize, ai_Regex_void, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
PHP_ME(Regex, serialize, ai_Regex_void, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
PHP_ME(Regex, unserialize, ai_Regex_unserialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
PHP_ME(Regex, getPattern, ai_Regex_void, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
PHP_ME(Regex, getFlags, ai_Regex_void, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
PHP_FE_END
};
/* }}} */
/* {{{ php_phongo_regex_t object handlers */
static void php_phongo_regex_free_object(phongo_free_object_arg *object TSRMLS_DC) /* {{{ */
{
php_phongo_regex_t *intern = Z_OBJ_REGEX(object);
zend_object_std_dtor(&intern->std TSRMLS_CC);
if (intern->pattern) {
efree(intern->pattern);
}
if (intern->flags) {
efree(intern->flags);
}
#if PHP_VERSION_ID < 70000
efree(intern);
#endif
} /* }}} */
phongo_create_object_retval php_phongo_regex_create_object(zend_class_entry *class_type TSRMLS_DC) /* {{{ */
{
php_phongo_regex_t *intern = NULL;
intern = PHONGO_ALLOC_OBJECT_T(php_phongo_regex_t, class_type);
zend_object_std_init(&intern->std, class_type TSRMLS_CC);
object_properties_init(&intern->std, class_type);
#if PHP_VERSION_ID >= 70000
intern->std.handlers = &php_phongo_handler_regex;
return &intern->std;
#else
{
zend_object_value retval;
retval.handle = zend_objects_store_put(intern, (zend_objects_store_dtor_t) zend_objects_destroy_object, php_phongo_regex_free_object, NULL TSRMLS_CC);
retval.handlers = &php_phongo_handler_regex;
return retval;
}
#endif
} /* }}} */
static int php_phongo_regex_compare_objects(zval *o1, zval *o2 TSRMLS_DC) /* {{{ */
{
php_phongo_regex_t *intern1, *intern2;
int retval;
intern1 = Z_REGEX_OBJ_P(o1);
intern2 = Z_REGEX_OBJ_P(o2);
/* MongoDB compares the pattern string before the flags. */
retval = strcmp(intern1->pattern, intern2->pattern);
if (retval != 0) {
return retval;
}
return strcmp(intern1->flags, intern2->flags);
} /* }}} */
+static HashTable *php_phongo_regex_get_gc(zval *object, phongo_get_gc_table table, int *n TSRMLS_DC) /* {{{ */
+{
+ *table = NULL;
+ *n = 0;
+
+ return zend_std_get_properties(object TSRMLS_CC);
+} /* }}} */
+
HashTable *php_phongo_regex_get_properties(zval *object TSRMLS_DC) /* {{{ */
{
php_phongo_regex_t *intern;
HashTable *props;
intern = Z_REGEX_OBJ_P(object);
props = zend_std_get_properties(object TSRMLS_CC);
if (!intern->pattern) {
return props;
}
#if PHP_VERSION_ID >= 70000
{
zval pattern, flags;
ZVAL_STRINGL(&pattern, intern->pattern, intern->pattern_len);
zend_hash_str_update(props, "pattern", sizeof("pattern")-1, &pattern);
ZVAL_STRINGL(&flags, intern->flags, intern->flags_len);
zend_hash_str_update(props, "flags", sizeof("flags")-1, &flags);
}
#else
{
zval *pattern, *flags;
MAKE_STD_ZVAL(pattern);
ZVAL_STRINGL(pattern, intern->pattern, intern->pattern_len, 1);
zend_hash_update(props, "pattern", sizeof("pattern"), &pattern, sizeof(pattern), NULL);
MAKE_STD_ZVAL(flags);
ZVAL_STRINGL(flags, intern->flags, intern->flags_len, 1);
zend_hash_update(props, "flags", sizeof("flags"), &flags, sizeof(flags), NULL);
}
#endif
return props;
} /* }}} */
/* }}} */
/* {{{ PHP_MINIT_FUNCTION */
PHP_MINIT_FUNCTION(Regex)
{
zend_class_entry ce;
(void)type;(void)module_number;
INIT_NS_CLASS_ENTRY(ce, "MongoDB\\BSON", "Regex", php_phongo_regex_me);
php_phongo_regex_ce = zend_register_internal_class(&ce TSRMLS_CC);
php_phongo_regex_ce->create_object = php_phongo_regex_create_object;
PHONGO_CE_FINAL(php_phongo_regex_ce);
zend_class_implements(php_phongo_regex_ce TSRMLS_CC, 1, php_phongo_type_ce);
zend_class_implements(php_phongo_regex_ce TSRMLS_CC, 1, zend_ce_serializable);
zend_class_implements(php_phongo_regex_ce TSRMLS_CC, 1, php_phongo_json_serializable_ce);
memcpy(&php_phongo_handler_regex, phongo_get_std_object_handlers(), sizeof(zend_object_handlers));
php_phongo_handler_regex.compare_objects = php_phongo_regex_compare_objects;
+ php_phongo_handler_regex.get_gc = php_phongo_regex_get_gc;
php_phongo_handler_regex.get_properties = php_phongo_regex_get_properties;
#if PHP_VERSION_ID >= 70000
php_phongo_handler_regex.free_obj = php_phongo_regex_free_object;
php_phongo_handler_regex.offset = XtOffsetOf(php_phongo_regex_t, std);
#endif
return SUCCESS;
}
/* }}} */
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* End:
* vim600: noet sw=4 ts=4 fdm=marker
* vim<600: noet sw=4 ts=4
*/
diff --git a/mongodb-1.2.3/src/BSON/Serializable.c b/mongodb-1.2.8/src/BSON/Serializable.c
similarity index 100%
rename from mongodb-1.2.3/src/BSON/Serializable.c
rename to mongodb-1.2.8/src/BSON/Serializable.c
diff --git a/mongodb-1.2.3/src/BSON/Timestamp.c b/mongodb-1.2.8/src/BSON/Timestamp.c
similarity index 98%
rename from mongodb-1.2.3/src/BSON/Timestamp.c
rename to mongodb-1.2.8/src/BSON/Timestamp.c
index 878d8e20..f3d89f27 100644
--- a/mongodb-1.2.3/src/BSON/Timestamp.c
+++ b/mongodb-1.2.8/src/BSON/Timestamp.c
@@ -1,525 +1,534 @@
/*
* Copyright 2014-2017 MongoDB, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
/* External libs */
#include <bson.h>
#include <mongoc.h>
/* PHP Core stuff */
#include <php.h>
#include <php_ini.h>
#include <ext/standard/info.h>
#include <Zend/zend_interfaces.h>
#include <ext/spl/spl_iterators.h>
#include <ext/standard/php_var.h>
#if PHP_VERSION_ID >= 70000
# include <zend_smart_str.h>
#else
# include <ext/standard/php_smart_str.h>
#endif
/* Our Compatability header */
#include "phongo_compat.h"
/* Our stuffz */
#include "php_phongo.h"
#include "php_bson.h"
PHONGO_API zend_class_entry *php_phongo_timestamp_ce;
zend_object_handlers php_phongo_handler_timestamp;
/* Initialize the object and return whether it was successful. An exception will
* be thrown on error. */
static bool php_phongo_timestamp_init(php_phongo_timestamp_t *intern, int64_t increment, int64_t timestamp TSRMLS_DC)
{
if (increment < 0 || increment > UINT32_MAX) {
phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT TSRMLS_CC, "Expected increment to be an unsigned 32-bit integer, %" PHONGO_LONG_FORMAT " given", increment);
return false;
}
if (timestamp < 0 || timestamp > UINT32_MAX) {
phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT TSRMLS_CC, "Expected timestamp to be an unsigned 32-bit integer, %" PHONGO_LONG_FORMAT " given", timestamp);
return false;
}
intern->increment = (uint32_t) increment;
intern->timestamp = (uint32_t) timestamp;
intern->initialized = true;
return true;
}
/* Initialize the object from numeric strings and return whether it was
* successful. An exception will be thrown on error. */
static bool php_phongo_timestamp_init_from_string(php_phongo_timestamp_t *intern, const char *s_increment, phongo_zpp_char_len s_increment_len, const char *s_timestamp, phongo_zpp_char_len s_timestamp_len TSRMLS_DC)
{
int64_t increment, timestamp;
char *endptr = NULL;
errno = 0;
/* errno will set errno if conversion fails; however, we do not need to
* specify the type of error.
*
* Note: bson_ascii_strtoll() does not properly detect out-of-range values
* (see: CDRIVER-1377). strtoll() would be preferable, but it is not
* available on all platforms (e.g. HP-UX), and atoll() provides no error
* reporting at all. */
increment = bson_ascii_strtoll(s_increment, &endptr, 10);
if (errno || (endptr && endptr != ((const char *)s_increment + s_increment_len))) {
phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT TSRMLS_CC, "Error parsing \"%s\" as 64-bit integer increment for %s initialization", s_increment, ZSTR_VAL(php_phongo_timestamp_ce->name));
return false;
}
timestamp = bson_ascii_strtoll(s_timestamp, &endptr, 10);
if (errno || (endptr && endptr != ((const char *)s_timestamp + s_timestamp_len))) {
phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT TSRMLS_CC, "Error parsing \"%s\" as 64-bit integer timestamp for %s initialization", s_timestamp, ZSTR_VAL(php_phongo_timestamp_ce->name));
return false;
}
return php_phongo_timestamp_init(intern, increment, timestamp TSRMLS_CC);
}
/* Initialize the object from a HashTable and return whether it was successful.
* An exception will be thrown on error. */
static bool php_phongo_timestamp_init_from_hash(php_phongo_timestamp_t *intern, HashTable *props TSRMLS_DC)
{
#if PHP_VERSION_ID >= 70000
zval *increment, *timestamp;
if ((increment = zend_hash_str_find(props, "increment", sizeof("increment")-1)) && Z_TYPE_P(increment) == IS_LONG &&
(timestamp = zend_hash_str_find(props, "timestamp", sizeof("timestamp")-1)) && Z_TYPE_P(timestamp) == IS_LONG) {
return php_phongo_timestamp_init(intern, Z_LVAL_P(increment), Z_LVAL_P(timestamp) TSRMLS_CC);
}
if ((increment = zend_hash_str_find(props, "increment", sizeof("increment")-1)) && Z_TYPE_P(increment) == IS_STRING &&
(timestamp = zend_hash_str_find(props, "timestamp", sizeof("timestamp")-1)) && Z_TYPE_P(timestamp) == IS_STRING) {
return php_phongo_timestamp_init_from_string(intern, Z_STRVAL_P(increment), Z_STRLEN_P(increment), Z_STRVAL_P(timestamp), Z_STRLEN_P(timestamp) TSRMLS_CC);
}
#else
zval **increment, **timestamp;
if (zend_hash_find(props, "increment", sizeof("increment"), (void**) &increment) == SUCCESS && Z_TYPE_PP(increment) == IS_LONG &&
zend_hash_find(props, "timestamp", sizeof("timestamp"), (void**) &timestamp) == SUCCESS && Z_TYPE_PP(timestamp) == IS_LONG) {
return php_phongo_timestamp_init(intern, Z_LVAL_PP(increment), Z_LVAL_PP(timestamp) TSRMLS_CC);
}
if (zend_hash_find(props, "increment", sizeof("increment"), (void**) &increment) == SUCCESS && Z_TYPE_PP(increment) == IS_STRING &&
zend_hash_find(props, "timestamp", sizeof("timestamp"), (void**) &timestamp) == SUCCESS && Z_TYPE_PP(timestamp) == IS_STRING) {
return php_phongo_timestamp_init_from_string(intern, Z_STRVAL_PP(increment), Z_STRLEN_PP(increment), Z_STRVAL_PP(timestamp), Z_STRLEN_PP(timestamp) TSRMLS_CC);
}
#endif
phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT TSRMLS_CC, "%s initialization requires \"increment\" and \"timestamp\" integer or numeric string fields", ZSTR_VAL(php_phongo_timestamp_ce->name));
return false;
}
/* {{{ proto void Timestamp::__construct(int|string $increment, int|string $timestamp)
Construct a new BSON timestamp type, which consists of a 4-byte increment and
4-byte timestamp. */
PHP_METHOD(Timestamp, __construct)
{
php_phongo_timestamp_t *intern;
zend_error_handling error_handling;
zval *increment = NULL, *timestamp = NULL;
zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling TSRMLS_CC);
intern = Z_TIMESTAMP_OBJ_P(getThis());
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zz", &increment, &timestamp) == FAILURE) {
zend_restore_error_handling(&error_handling TSRMLS_CC);
return;
}
zend_restore_error_handling(&error_handling TSRMLS_CC);
if (Z_TYPE_P(increment) == IS_LONG && Z_TYPE_P(timestamp) == IS_LONG) {
php_phongo_timestamp_init(intern, Z_LVAL_P(increment), Z_LVAL_P(timestamp) TSRMLS_CC);
return;
}
if (Z_TYPE_P(increment) == IS_LONG) {
convert_to_string(increment);
}
if (Z_TYPE_P(increment) != IS_STRING) {
phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT TSRMLS_CC, "Expected increment to be an unsigned 32-bit integer or string, %s given", zend_get_type_by_const(Z_TYPE_P(increment)));
return;
}
if (Z_TYPE_P(timestamp) == IS_LONG) {
convert_to_string(timestamp);
}
if (Z_TYPE_P(timestamp) != IS_STRING) {
phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT TSRMLS_CC, "Expected timestamp to be an unsigned 32-bit integer or string, %s given", zend_get_type_by_const(Z_TYPE_P(timestamp)));
return;
}
php_phongo_timestamp_init_from_string(intern, Z_STRVAL_P(increment), Z_STRLEN_P(increment), Z_STRVAL_P(timestamp), Z_STRLEN_P(timestamp) TSRMLS_CC);
}
/* }}} */
/* {{{ proto void Timestamp::__set_state(array $properties)
*/
PHP_METHOD(Timestamp, __set_state)
{
php_phongo_timestamp_t *intern;
HashTable *props;
zval *array;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a", &array) == FAILURE) {
RETURN_FALSE;
}
object_init_ex(return_value, php_phongo_timestamp_ce);
intern = Z_TIMESTAMP_OBJ_P(return_value);
props = Z_ARRVAL_P(array);
php_phongo_timestamp_init_from_hash(intern, props TSRMLS_CC);
}
/* }}} */
/* {{{ proto string Timestamp::__toString()
Returns a string in the form: [increment:timestamp] */
PHP_METHOD(Timestamp, __toString)
{
php_phongo_timestamp_t *intern;
char *retval;
int retval_len;
intern = Z_TIMESTAMP_OBJ_P(getThis());
if (zend_parse_parameters_none() == FAILURE) {
return;
}
retval_len = spprintf(&retval, 0, "[%" PRIu32 ":%" PRIu32 "]", intern->increment, intern->timestamp);
PHONGO_RETVAL_STRINGL(retval, retval_len);
efree(retval);
}
/* }}} */
/* {{{ proto array Timestamp::jsonSerialize()
*/
PHP_METHOD(Timestamp, jsonSerialize)
{
php_phongo_timestamp_t *intern;
if (zend_parse_parameters_none() == FAILURE) {
return;
}
intern = Z_TIMESTAMP_OBJ_P(getThis());
array_init_size(return_value, 1);
#if PHP_VERSION_ID >= 70000
{
zval ts;
array_init_size(&ts, 2);
ADD_ASSOC_LONG_EX(&ts, "t", intern->timestamp);
ADD_ASSOC_LONG_EX(&ts, "i", intern->increment);
ADD_ASSOC_ZVAL_EX(return_value, "$timestamp", &ts);
}
#else
{
zval *ts;
MAKE_STD_ZVAL(ts);
array_init_size(ts, 2);
ADD_ASSOC_LONG_EX(ts, "t", intern->timestamp);
ADD_ASSOC_LONG_EX(ts, "i", intern->increment);
ADD_ASSOC_ZVAL_EX(return_value, "$timestamp", ts);
}
#endif
}
/* }}} */
/* {{{ proto string Timestamp::serialize()
*/
PHP_METHOD(Timestamp, serialize)
{
php_phongo_timestamp_t *intern;
#if PHP_VERSION_ID >= 70000
zval retval;
#else
zval *retval;
#endif
php_serialize_data_t var_hash;
smart_str buf = { 0 };
char s_increment[12];
char s_timestamp[12];
int s_increment_len;
int s_timestamp_len;
intern = Z_TIMESTAMP_OBJ_P(getThis());
if (zend_parse_parameters_none() == FAILURE) {
return;
}
s_increment_len = snprintf(s_increment, sizeof(s_increment), "%" PRIu32, intern->increment);
s_timestamp_len = snprintf(s_timestamp, sizeof(s_timestamp), "%" PRIu32, intern->timestamp);
#if PHP_VERSION_ID >= 70000
array_init_size(&retval, 2);
ADD_ASSOC_STRINGL(&retval, "increment", s_increment, s_increment_len);
ADD_ASSOC_STRINGL(&retval, "timestamp", s_timestamp, s_timestamp_len);
#else
ALLOC_INIT_ZVAL(retval);
array_init_size(retval, 2);
ADD_ASSOC_STRINGL(retval, "increment", s_increment, s_increment_len);
ADD_ASSOC_STRINGL(retval, "timestamp", s_timestamp, s_timestamp_len);
#endif
PHP_VAR_SERIALIZE_INIT(var_hash);
php_var_serialize(&buf, &retval, &var_hash TSRMLS_CC);
smart_str_0(&buf);
PHP_VAR_SERIALIZE_DESTROY(var_hash);
PHONGO_RETVAL_SMART_STR(buf);
smart_str_free(&buf);
zval_ptr_dtor(&retval);
}
/* }}} */
/* {{{ proto string Timestamp::unserialize(string $serialized)
*/
PHP_METHOD(Timestamp, unserialize)
{
php_phongo_timestamp_t *intern;
zend_error_handling error_handling;
char *serialized;
phongo_zpp_char_len serialized_len;
#if PHP_VERSION_ID >= 70000
zval props;
#else
zval *props;
#endif
php_unserialize_data_t var_hash;
intern = Z_TIMESTAMP_OBJ_P(getThis());
zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling TSRMLS_CC);
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &serialized, &serialized_len) == FAILURE) {
zend_restore_error_handling(&error_handling TSRMLS_CC);
return;
}
zend_restore_error_handling(&error_handling TSRMLS_CC);
#if PHP_VERSION_ID < 70000
ALLOC_INIT_ZVAL(props);
#endif
PHP_VAR_UNSERIALIZE_INIT(var_hash);
if (!php_var_unserialize(&props, (const unsigned char**) &serialized, (unsigned char *) serialized + serialized_len, &var_hash TSRMLS_CC)) {
zval_ptr_dtor(&props);
phongo_throw_exception(PHONGO_ERROR_UNEXPECTED_VALUE TSRMLS_CC, "%s unserialization failed", ZSTR_VAL(php_phongo_timestamp_ce->name));
PHP_VAR_UNSERIALIZE_DESTROY(var_hash);
return;
}
PHP_VAR_UNSERIALIZE_DESTROY(var_hash);
#if PHP_VERSION_ID >= 70000
php_phongo_timestamp_init_from_hash(intern, HASH_OF(&props) TSRMLS_CC);
#else
php_phongo_timestamp_init_from_hash(intern, HASH_OF(props) TSRMLS_CC);
#endif
zval_ptr_dtor(&props);
}
/* }}} */
/* {{{ BSON\Timestamp */
ZEND_BEGIN_ARG_INFO_EX(ai_Timestamp___construct, 0, 0, 2)
ZEND_ARG_INFO(0, increment)
ZEND_ARG_INFO(0, timestamp)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(ai_Timestamp___set_state, 0, 0, 1)
ZEND_ARG_ARRAY_INFO(0, properties, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(ai_Timestamp_unserialize, 0, 0, 1)
ZEND_ARG_INFO(0, serialized)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(ai_Timestamp_void, 0, 0, 0)
ZEND_END_ARG_INFO()
static zend_function_entry php_phongo_timestamp_me[] = {
PHP_ME(Timestamp, __construct, ai_Timestamp___construct, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
PHP_ME(Timestamp, __set_state, ai_Timestamp___set_state, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
PHP_ME(Timestamp, __toString, ai_Timestamp_void, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
PHP_ME(Timestamp, jsonSerialize, ai_Timestamp_void, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
PHP_ME(Timestamp, serialize, ai_Timestamp_void, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
PHP_ME(Timestamp, unserialize, ai_Timestamp_unserialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
PHP_FE_END
};
/* }}} */
/* {{{ php_phongo_timestamp_t object handlers */
static void php_phongo_timestamp_free_object(phongo_free_object_arg *object TSRMLS_DC) /* {{{ */
{
php_phongo_timestamp_t *intern = Z_OBJ_TIMESTAMP(object);
zend_object_std_dtor(&intern->std TSRMLS_CC);
#if PHP_VERSION_ID < 70000
efree(intern);
#endif
} /* }}} */
phongo_create_object_retval php_phongo_timestamp_create_object(zend_class_entry *class_type TSRMLS_DC) /* {{{ */
{
php_phongo_timestamp_t *intern = NULL;
intern = PHONGO_ALLOC_OBJECT_T(php_phongo_timestamp_t, class_type);
zend_object_std_init(&intern->std, class_type TSRMLS_CC);
object_properties_init(&intern->std, class_type);
#if PHP_VERSION_ID >= 70000
intern->std.handlers = &php_phongo_handler_timestamp;
return &intern->std;
#else
{
zend_object_value retval;
retval.handle = zend_objects_store_put(intern, (zend_objects_store_dtor_t) zend_objects_destroy_object, php_phongo_timestamp_free_object, NULL TSRMLS_CC);
retval.handlers = &php_phongo_handler_timestamp;
return retval;
}
#endif
} /* }}} */
static int php_phongo_timestamp_compare_objects(zval *o1, zval *o2 TSRMLS_DC) /* {{{ */
{
php_phongo_timestamp_t *intern1, *intern2;
intern1 = Z_TIMESTAMP_OBJ_P(o1);
intern2 = Z_TIMESTAMP_OBJ_P(o2);
/* MongoDB compares the timestamp before the increment. */
if (intern1->timestamp != intern2->timestamp) {
return intern1->timestamp < intern2->timestamp ? -1 : 1;
}
if (intern1->increment != intern2->increment) {
return intern1->increment < intern2->increment ? -1 : 1;
}
return 0;
} /* }}} */
+static HashTable *php_phongo_timestamp_get_gc(zval *object, phongo_get_gc_table table, int *n TSRMLS_DC) /* {{{ */
+{
+ *table = NULL;
+ *n = 0;
+
+ return zend_std_get_properties(object TSRMLS_CC);
+} /* }}} */
+
HashTable *php_phongo_timestamp_get_properties(zval *object TSRMLS_DC) /* {{{ */
{
php_phongo_timestamp_t *intern;
HashTable *props;
char s_increment[24];
char s_timestamp[24];
int s_increment_len;
int s_timestamp_len;
intern = Z_TIMESTAMP_OBJ_P(object);
props = zend_std_get_properties(object TSRMLS_CC);
if (!intern->initialized) {
return props;
}
s_increment_len = snprintf(s_increment, sizeof(s_increment), "%" PRIu32, intern->increment);
s_timestamp_len = snprintf(s_timestamp, sizeof(s_timestamp), "%" PRIu32, intern->timestamp);
#if PHP_VERSION_ID >= 70000
{
zval increment, timestamp;
ZVAL_STRINGL(&increment, s_increment, s_increment_len);
zend_hash_str_update(props, "increment", sizeof("increment")-1, &increment);
ZVAL_STRINGL(&timestamp, s_timestamp, s_timestamp_len);
zend_hash_str_update(props, "timestamp", sizeof("timestamp")-1, &timestamp);
}
#else
{
zval *increment, *timestamp;
MAKE_STD_ZVAL(increment);
ZVAL_STRINGL(increment, s_increment, s_increment_len, 1);
zend_hash_update(props, "increment", sizeof("increment"), &increment, sizeof(increment), NULL);
MAKE_STD_ZVAL(timestamp);
ZVAL_STRINGL(timestamp, s_timestamp, s_timestamp_len, 1);
zend_hash_update(props, "timestamp", sizeof("timestamp"), &timestamp, sizeof(timestamp), NULL);
}
#endif
return props;
} /* }}} */
/* }}} */
/* {{{ PHP_MINIT_FUNCTION */
PHP_MINIT_FUNCTION(Timestamp)
{
zend_class_entry ce;
(void)type;(void)module_number;
INIT_NS_CLASS_ENTRY(ce, "MongoDB\\BSON", "Timestamp", php_phongo_timestamp_me);
php_phongo_timestamp_ce = zend_register_internal_class(&ce TSRMLS_CC);
php_phongo_timestamp_ce->create_object = php_phongo_timestamp_create_object;
PHONGO_CE_FINAL(php_phongo_timestamp_ce);
zend_class_implements(php_phongo_timestamp_ce TSRMLS_CC, 1, php_phongo_json_serializable_ce);
zend_class_implements(php_phongo_timestamp_ce TSRMLS_CC, 1, php_phongo_type_ce);
zend_class_implements(php_phongo_timestamp_ce TSRMLS_CC, 1, zend_ce_serializable);
memcpy(&php_phongo_handler_timestamp, phongo_get_std_object_handlers(), sizeof(zend_object_handlers));
php_phongo_handler_timestamp.compare_objects = php_phongo_timestamp_compare_objects;
+ php_phongo_handler_timestamp.get_gc = php_phongo_timestamp_get_gc;
php_phongo_handler_timestamp.get_properties = php_phongo_timestamp_get_properties;
#if PHP_VERSION_ID >= 70000
php_phongo_handler_timestamp.free_obj = php_phongo_timestamp_free_object;
php_phongo_handler_timestamp.offset = XtOffsetOf(php_phongo_timestamp_t, std);
#endif
return SUCCESS;
}
/* }}} */
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* End:
* vim600: noet sw=4 ts=4 fdm=marker
* vim<600: noet sw=4 ts=4
*/
diff --git a/mongodb-1.2.3/src/BSON/Type.c b/mongodb-1.2.8/src/BSON/Type.c
similarity index 100%
rename from mongodb-1.2.3/src/BSON/Type.c
rename to mongodb-1.2.8/src/BSON/Type.c
diff --git a/mongodb-1.2.3/src/BSON/UTCDateTime.c b/mongodb-1.2.8/src/BSON/UTCDateTime.c
similarity index 98%
rename from mongodb-1.2.3/src/BSON/UTCDateTime.c
rename to mongodb-1.2.8/src/BSON/UTCDateTime.c
index 1c6c6af0..7f08285f 100644
--- a/mongodb-1.2.3/src/BSON/UTCDateTime.c
+++ b/mongodb-1.2.8/src/BSON/UTCDateTime.c
@@ -1,566 +1,575 @@
/*
* Copyright 2014-2017 MongoDB, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
/* External libs */
#include <bson.h>
#include <mongoc.h>
#include <math.h>
/* PHP Core stuff */
#include <php.h>
#include <php_ini.h>
#include <ext/standard/info.h>
#include <Zend/zend_interfaces.h>
#include <ext/date/php_date.h>
#include <ext/spl/spl_iterators.h>
#include <ext/standard/php_var.h>
#if PHP_VERSION_ID >= 70000
# include <zend_smart_str.h>
#else
# include <ext/standard/php_smart_str.h>
#endif
/* Our Compatability header */
#include "phongo_compat.h"
#ifdef PHP_WIN32
#include "win32/time.h"
#endif
/* Our stuffz */
#include "php_phongo.h"
#include "php_bson.h"
PHONGO_API zend_class_entry *php_phongo_utcdatetime_ce;
zend_object_handlers php_phongo_handler_utcdatetime;
/* Initialize the object and return whether it was successful. */
static bool php_phongo_utcdatetime_init(php_phongo_utcdatetime_t *intern, int64_t milliseconds)
{
intern->milliseconds = milliseconds;
intern->initialized = true;
return true;
}
/* Initialize the object from a numeric string and return whether it was
* successful. An exception will be thrown on error. */
static bool php_phongo_utcdatetime_init_from_string(php_phongo_utcdatetime_t *intern, const char *s_milliseconds, phongo_zpp_char_len s_milliseconds_len TSRMLS_DC)
{
int64_t milliseconds;
char *endptr = NULL;
errno = 0;
milliseconds = bson_ascii_strtoll(s_milliseconds, &endptr, 10);
/* errno will set errno if conversion fails; however, we do not need to
* specify the type of error.
*
* Note: bson_ascii_strtoll() does not properly detect out-of-range values
* (see: CDRIVER-1377). strtoll() would be preferable, but it is not
* available on all platforms (e.g. HP-UX), and atoll() provides no error
* reporting at all. */
if (errno || (endptr && endptr != ((const char *)s_milliseconds + s_milliseconds_len))) {
phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT TSRMLS_CC, "Error parsing \"%s\" as 64-bit integer for %s initialization", s_milliseconds, ZSTR_VAL(php_phongo_utcdatetime_ce->name));
return false;
}
return php_phongo_utcdatetime_init(intern, milliseconds);
}
/* Initialize the object from a HashTable and return whether it was successful.
* An exception will be thrown on error. */
static bool php_phongo_utcdatetime_init_from_hash(php_phongo_utcdatetime_t *intern, HashTable *props TSRMLS_DC)
{
#if PHP_VERSION_ID >= 70000
zval *milliseconds;
if ((milliseconds = zend_hash_str_find(props, "milliseconds", sizeof("milliseconds")-1)) && Z_TYPE_P(milliseconds) == IS_LONG) {
return php_phongo_utcdatetime_init(intern, Z_LVAL_P(milliseconds));
}
if ((milliseconds = zend_hash_str_find(props, "milliseconds", sizeof("milliseconds")-1)) && Z_TYPE_P(milliseconds) == IS_STRING) {
return php_phongo_utcdatetime_init_from_string(intern, Z_STRVAL_P(milliseconds), Z_STRLEN_P(milliseconds) TSRMLS_CC);
}
#else
zval **milliseconds;
if (zend_hash_find(props, "milliseconds", sizeof("milliseconds"), (void**) &milliseconds) == SUCCESS && Z_TYPE_PP(milliseconds) == IS_LONG) {
return php_phongo_utcdatetime_init(intern, Z_LVAL_PP(milliseconds));
}
if (zend_hash_find(props, "milliseconds", sizeof("milliseconds"), (void**) &milliseconds) == SUCCESS && Z_TYPE_PP(milliseconds) == IS_STRING) {
return php_phongo_utcdatetime_init_from_string(intern, Z_STRVAL_PP(milliseconds), Z_STRLEN_PP(milliseconds) TSRMLS_CC);
}
#endif
phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT TSRMLS_CC, "%s initialization requires \"milliseconds\" integer or numeric string field", ZSTR_VAL(php_phongo_utcdatetime_ce->name));
return false;
}
/* Initialize the object from the current time and return whether it was
* successful. */
static bool php_phongo_utcdatetime_init_from_current_time(php_phongo_utcdatetime_t *intern)
{
int64_t sec, usec;
struct timeval cur_time;
gettimeofday(&cur_time, NULL);
sec = cur_time.tv_sec;
usec = cur_time.tv_usec;
intern->milliseconds = (sec * 1000) + (usec / 1000);
intern->initialized = true;
return true;
}
/* Initialize the object from a DateTime object and return whether it was
* successful. */
static bool php_phongo_utcdatetime_init_from_date(php_phongo_utcdatetime_t *intern, php_date_obj *datetime_obj)
{
int64_t sec, usec;
/* The following assignments use the same logic as date_format() in php_date.c */
sec = datetime_obj->time->sse;
usec = (int64_t) floor(datetime_obj->time->f * 1000000 + 0.5);
intern->milliseconds = (sec * 1000) + (usec / 1000);
intern->initialized = true;
return true;
}
/* {{{ proto void UTCDateTime::__construct([int|float|string|DateTimeInterface $milliseconds = null])
Construct a new BSON UTCDateTime type from either the current time,
milliseconds since the epoch, or a DateTimeInterface object. Defaults to the
current time. */
PHP_METHOD(UTCDateTime, __construct)
{
php_phongo_utcdatetime_t *intern;
zend_error_handling error_handling;
zval *milliseconds = NULL;
zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling TSRMLS_CC);
intern = Z_UTCDATETIME_OBJ_P(getThis());
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|z!", &milliseconds) == FAILURE) {
zend_restore_error_handling(&error_handling TSRMLS_CC);
return;
}
zend_restore_error_handling(&error_handling TSRMLS_CC);
if (milliseconds == NULL) {
php_phongo_utcdatetime_init_from_current_time(intern);
return;
}
if (Z_TYPE_P(milliseconds) == IS_OBJECT) {
if (instanceof_function(Z_OBJCE_P(milliseconds), php_date_get_date_ce() TSRMLS_CC) ||
(php_phongo_date_immutable_ce && instanceof_function(Z_OBJCE_P(milliseconds), php_phongo_date_immutable_ce TSRMLS_CC))) {
php_phongo_utcdatetime_init_from_date(intern, Z_PHPDATE_P(milliseconds));
} else {
phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT TSRMLS_CC, "Expected instance of DateTimeInterface, %s given", ZSTR_VAL(Z_OBJCE_P(milliseconds)->name));
}
return;
}
if (Z_TYPE_P(milliseconds) == IS_LONG) {
php_phongo_utcdatetime_init(intern, Z_LVAL_P(milliseconds));
return;
}
if (Z_TYPE_P(milliseconds) == IS_DOUBLE) {
char tmp[24];
int tmp_len;
tmp_len = snprintf(tmp, sizeof(tmp), "%.0f", Z_DVAL_P(milliseconds) > 0 ? floor(Z_DVAL_P(milliseconds)) : ceil(Z_DVAL_P(milliseconds)));
php_phongo_utcdatetime_init_from_string(intern, tmp, tmp_len TSRMLS_CC);
return;
}
if (Z_TYPE_P(milliseconds) != IS_STRING) {
phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT TSRMLS_CC, "Expected integer or string, %s given", zend_get_type_by_const(Z_TYPE_P(milliseconds)));
return;
}
php_phongo_utcdatetime_init_from_string(intern, Z_STRVAL_P(milliseconds), Z_STRLEN_P(milliseconds) TSRMLS_CC);
}
/* }}} */
/* {{{ proto void UTCDateTime::__set_state(array $properties)
*/
PHP_METHOD(UTCDateTime, __set_state)
{
php_phongo_utcdatetime_t *intern;
HashTable *props;
zval *array;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a", &array) == FAILURE) {
RETURN_FALSE;
}
object_init_ex(return_value, php_phongo_utcdatetime_ce);
intern = Z_UTCDATETIME_OBJ_P(return_value);
props = Z_ARRVAL_P(array);
php_phongo_utcdatetime_init_from_hash(intern, props TSRMLS_CC);
}
/* }}} */
/* {{{ proto string UTCDateTime::__toString()
Returns the UTCDateTime's milliseconds as a string */
PHP_METHOD(UTCDateTime, __toString)
{
php_phongo_utcdatetime_t *intern;
char *tmp;
int tmp_len;
intern = Z_UTCDATETIME_OBJ_P(getThis());
if (zend_parse_parameters_none() == FAILURE) {
return;
}
tmp_len = spprintf(&tmp, 0, "%" PRId64, intern->milliseconds);
PHONGO_RETVAL_STRINGL(tmp, tmp_len);
efree(tmp);
}
/* }}} */
/* {{{ proto DateTime UTCDateTime::toDateTime()
Returns a DateTime object representing this UTCDateTime */
PHP_METHOD(UTCDateTime, toDateTime)
{
php_phongo_utcdatetime_t *intern;
php_date_obj *datetime_obj;
char *sec;
size_t sec_len;
intern = Z_UTCDATETIME_OBJ_P(getThis());
if (zend_parse_parameters_none() == FAILURE) {
return;
}
object_init_ex(return_value, php_date_get_date_ce());
datetime_obj = Z_PHPDATE_P(return_value);
sec_len = spprintf(&sec, 0, "@%" PRId64, intern->milliseconds / 1000);
php_date_initialize(datetime_obj, sec, sec_len, NULL, NULL, 0 TSRMLS_CC);
efree(sec);
datetime_obj->time->f = (double) (intern->milliseconds % 1000) / 1000;
}
/* }}} */
/* {{{ proto array UTCDateTime::jsonSerialize()
*/
PHP_METHOD(UTCDateTime, jsonSerialize)
{
php_phongo_utcdatetime_t *intern;
char s_milliseconds[24];
int s_milliseconds_len;
if (zend_parse_parameters_none() == FAILURE) {
return;
}
intern = Z_UTCDATETIME_OBJ_P(getThis());
s_milliseconds_len = snprintf(s_milliseconds, sizeof(s_milliseconds), "%" PRId64, intern->milliseconds);
array_init_size(return_value, 1);
#if PHP_VERSION_ID >= 70000
{
zval udt;
array_init_size(&udt, 1);
ADD_ASSOC_STRINGL(&udt, "$numberLong", s_milliseconds, s_milliseconds_len);
ADD_ASSOC_ZVAL_EX(return_value, "$date", &udt);
}
#else
{
zval *udt;
MAKE_STD_ZVAL(udt);
array_init_size(udt, 1);
ADD_ASSOC_STRINGL(udt, "$numberLong", s_milliseconds, s_milliseconds_len);
ADD_ASSOC_ZVAL_EX(return_value, "$date", udt);
}
#endif
}
/* }}} */
/* {{{ proto string UTCDateTime::serialize()
*/
PHP_METHOD(UTCDateTime, serialize)
{
php_phongo_utcdatetime_t *intern;
#if PHP_VERSION_ID >= 70000
zval retval;
#else
zval *retval;
#endif
php_serialize_data_t var_hash;
smart_str buf = { 0 };
char s_milliseconds[24];
int s_milliseconds_len;
intern = Z_UTCDATETIME_OBJ_P(getThis());
if (zend_parse_parameters_none() == FAILURE) {
return;
}
s_milliseconds_len = snprintf(s_milliseconds, sizeof(s_milliseconds), "%" PRId64, intern->milliseconds);
#if PHP_VERSION_ID >= 70000
array_init_size(&retval, 2);
ADD_ASSOC_STRINGL(&retval, "milliseconds", s_milliseconds, s_milliseconds_len);
#else
ALLOC_INIT_ZVAL(retval);
array_init_size(retval, 2);
ADD_ASSOC_STRINGL(retval, "milliseconds", s_milliseconds, s_milliseconds_len);
#endif
PHP_VAR_SERIALIZE_INIT(var_hash);
php_var_serialize(&buf, &retval, &var_hash TSRMLS_CC);
smart_str_0(&buf);
PHP_VAR_SERIALIZE_DESTROY(var_hash);
PHONGO_RETVAL_SMART_STR(buf);
smart_str_free(&buf);
zval_ptr_dtor(&retval);
}
/* }}} */
/* {{{ proto string UTCDateTime::unserialize(string $serialized)
*/
PHP_METHOD(UTCDateTime, unserialize)
{
php_phongo_utcdatetime_t *intern;
zend_error_handling error_handling;
char *serialized;
phongo_zpp_char_len serialized_len;
#if PHP_VERSION_ID >= 70000
zval props;
#else
zval *props;
#endif
php_unserialize_data_t var_hash;
intern = Z_UTCDATETIME_OBJ_P(getThis());
zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling TSRMLS_CC);
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &serialized, &serialized_len) == FAILURE) {
zend_restore_error_handling(&error_handling TSRMLS_CC);
return;
}
zend_restore_error_handling(&error_handling TSRMLS_CC);
#if PHP_VERSION_ID < 70000
ALLOC_INIT_ZVAL(props);
#endif
PHP_VAR_UNSERIALIZE_INIT(var_hash);
if (!php_var_unserialize(&props, (const unsigned char**) &serialized, (unsigned char *) serialized + serialized_len, &var_hash TSRMLS_CC)) {
zval_ptr_dtor(&props);
phongo_throw_exception(PHONGO_ERROR_UNEXPECTED_VALUE TSRMLS_CC, "%s unserialization failed", ZSTR_VAL(php_phongo_utcdatetime_ce->name));
PHP_VAR_UNSERIALIZE_DESTROY(var_hash);
return;
}
PHP_VAR_UNSERIALIZE_DESTROY(var_hash);
#if PHP_VERSION_ID >= 70000
php_phongo_utcdatetime_init_from_hash(intern, HASH_OF(&props) TSRMLS_CC);
#else
php_phongo_utcdatetime_init_from_hash(intern, HASH_OF(props) TSRMLS_CC);
#endif
zval_ptr_dtor(&props);
}
/* }}} */
/* {{{ BSON\UTCDateTime */
ZEND_BEGIN_ARG_INFO_EX(ai_UTCDateTime___construct, 0, 0, 1)
ZEND_ARG_INFO(0, milliseconds)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(ai_UTCDateTime___set_state, 0, 0, 1)
ZEND_ARG_ARRAY_INFO(0, properties, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(ai_UTCDateTime_unserialize, 0, 0, 1)
ZEND_ARG_INFO(0, serialized)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(ai_UTCDateTime_void, 0, 0, 0)
ZEND_END_ARG_INFO()
static zend_function_entry php_phongo_utcdatetime_me[] = {
PHP_ME(UTCDateTime, __construct, ai_UTCDateTime___construct, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
PHP_ME(UTCDateTime, __set_state, ai_UTCDateTime___set_state, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
PHP_ME(UTCDateTime, __toString, ai_UTCDateTime_void, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
PHP_ME(UTCDateTime, jsonSerialize, ai_UTCDateTime_void, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
PHP_ME(UTCDateTime, serialize, ai_UTCDateTime_void, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
PHP_ME(UTCDateTime, unserialize, ai_UTCDateTime_unserialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
PHP_ME(UTCDateTime, toDateTime, ai_UTCDateTime_void, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
PHP_FE_END
};
/* }}} */
/* {{{ php_phongo_utcdatetime_t object handlers */
static void php_phongo_utcdatetime_free_object(phongo_free_object_arg *object TSRMLS_DC) /* {{{ */
{
php_phongo_utcdatetime_t *intern = Z_OBJ_UTCDATETIME(object);
zend_object_std_dtor(&intern->std TSRMLS_CC);
#if PHP_VERSION_ID < 70000
efree(intern);
#endif
} /* }}} */
phongo_create_object_retval php_phongo_utcdatetime_create_object(zend_class_entry *class_type TSRMLS_DC) /* {{{ */
{
php_phongo_utcdatetime_t *intern = NULL;
intern = PHONGO_ALLOC_OBJECT_T(php_phongo_utcdatetime_t, class_type);
zend_object_std_init(&intern->std, class_type TSRMLS_CC);
object_properties_init(&intern->std, class_type);
#if PHP_VERSION_ID >= 70000
intern->std.handlers = &php_phongo_handler_utcdatetime;
return &intern->std;
#else
{
zend_object_value retval;
retval.handle = zend_objects_store_put(intern, (zend_objects_store_dtor_t) zend_objects_destroy_object, php_phongo_utcdatetime_free_object, NULL TSRMLS_CC);
retval.handlers = &php_phongo_handler_utcdatetime;
return retval;
}
#endif
} /* }}} */
static int php_phongo_utcdatetime_compare_objects(zval *o1, zval *o2 TSRMLS_DC) /* {{{ */
{
php_phongo_utcdatetime_t *intern1, *intern2;
intern1 = Z_UTCDATETIME_OBJ_P(o1);
intern2 = Z_UTCDATETIME_OBJ_P(o2);
if (intern1->milliseconds != intern2->milliseconds) {
return intern1->milliseconds < intern2->milliseconds ? -1 : 1;
}
return 0;
} /* }}} */
+static HashTable *php_phongo_utcdatetime_get_gc(zval *object, phongo_get_gc_table table, int *n TSRMLS_DC) /* {{{ */
+{
+ *table = NULL;
+ *n = 0;
+
+ return zend_std_get_properties(object TSRMLS_CC);
+} /* }}} */
+
HashTable *php_phongo_utcdatetime_get_properties(zval *object TSRMLS_DC) /* {{{ */
{
php_phongo_utcdatetime_t *intern;
HashTable *props;
char s_milliseconds[24];
int s_milliseconds_len;
intern = Z_UTCDATETIME_OBJ_P(object);
props = zend_std_get_properties(object TSRMLS_CC);
if (!intern->initialized) {
return props;
}
s_milliseconds_len = snprintf(s_milliseconds, sizeof(s_milliseconds), "%" PRId64, intern->milliseconds);
#if PHP_VERSION_ID >= 70000
{
zval milliseconds;
ZVAL_STRINGL(&milliseconds, s_milliseconds, s_milliseconds_len);
zend_hash_str_update(props, "milliseconds", sizeof("milliseconds")-1, &milliseconds);
}
#else
{
zval *milliseconds;
MAKE_STD_ZVAL(milliseconds);
ZVAL_STRINGL(milliseconds, s_milliseconds, s_milliseconds_len, 1);
zend_hash_update(props, "milliseconds", sizeof("milliseconds"), &milliseconds, sizeof(milliseconds), NULL);
}
#endif
return props;
} /* }}} */
/* }}} */
/* {{{ PHP_MINIT_FUNCTION */
PHP_MINIT_FUNCTION(UTCDateTime)
{
zend_class_entry ce;
(void)type;(void)module_number;
INIT_NS_CLASS_ENTRY(ce, "MongoDB\\BSON", "UTCDateTime", php_phongo_utcdatetime_me);
php_phongo_utcdatetime_ce = zend_register_internal_class(&ce TSRMLS_CC);
php_phongo_utcdatetime_ce->create_object = php_phongo_utcdatetime_create_object;
PHONGO_CE_FINAL(php_phongo_utcdatetime_ce);
zend_class_implements(php_phongo_utcdatetime_ce TSRMLS_CC, 1, php_phongo_json_serializable_ce);
zend_class_implements(php_phongo_utcdatetime_ce TSRMLS_CC, 1, php_phongo_type_ce);
zend_class_implements(php_phongo_utcdatetime_ce TSRMLS_CC, 1, zend_ce_serializable);
memcpy(&php_phongo_handler_utcdatetime, phongo_get_std_object_handlers(), sizeof(zend_object_handlers));
php_phongo_handler_utcdatetime.compare_objects = php_phongo_utcdatetime_compare_objects;
+ php_phongo_handler_utcdatetime.get_gc = php_phongo_utcdatetime_get_gc;
php_phongo_handler_utcdatetime.get_properties = php_phongo_utcdatetime_get_properties;
#if PHP_VERSION_ID >= 70000
php_phongo_handler_utcdatetime.free_obj = php_phongo_utcdatetime_free_object;
php_phongo_handler_utcdatetime.offset = XtOffsetOf(php_phongo_utcdatetime_t, std);
#endif
return SUCCESS;
}
/* }}} */
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* End:
* vim600: noet sw=4 ts=4 fdm=marker
* vim<600: noet sw=4 ts=4
*/
diff --git a/mongodb-1.2.3/src/BSON/Unserializable.c b/mongodb-1.2.8/src/BSON/Unserializable.c
similarity index 100%
rename from mongodb-1.2.3/src/BSON/Unserializable.c
rename to mongodb-1.2.8/src/BSON/Unserializable.c
diff --git a/mongodb-1.2.3/src/MongoDB/BulkWrite.c b/mongodb-1.2.8/src/MongoDB/BulkWrite.c
similarity index 100%
rename from mongodb-1.2.3/src/MongoDB/BulkWrite.c
rename to mongodb-1.2.8/src/MongoDB/BulkWrite.c
diff --git a/mongodb-1.2.3/src/MongoDB/Command.c b/mongodb-1.2.8/src/MongoDB/Command.c
similarity index 100%
rename from mongodb-1.2.3/src/MongoDB/Command.c
rename to mongodb-1.2.8/src/MongoDB/Command.c
diff --git a/mongodb-1.2.3/src/MongoDB/Cursor.c b/mongodb-1.2.8/src/MongoDB/Cursor.c
similarity index 98%
rename from mongodb-1.2.3/src/MongoDB/Cursor.c
rename to mongodb-1.2.8/src/MongoDB/Cursor.c
index d4b07446..20a8e294 100644
--- a/mongodb-1.2.3/src/MongoDB/Cursor.c
+++ b/mongodb-1.2.8/src/MongoDB/Cursor.c
@@ -1,579 +1,581 @@
/*
* Copyright 2014-2017 MongoDB, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
/* External libs */
#include <bson.h>
#include <mongoc.h>
/* PHP Core stuff */
#include <php.h>
#include <php_ini.h>
#include <ext/standard/info.h>
#include <Zend/zend_interfaces.h>
#include <ext/spl/spl_iterators.h>
/* Our Compatability header */
#include "phongo_compat.h"
/* Our stuffz */
#include "php_phongo.h"
#include "php_bson.h"
PHONGO_API zend_class_entry *php_phongo_cursor_ce;
zend_object_handlers php_phongo_handler_cursor;
static void php_phongo_cursor_free_current(php_phongo_cursor_t *cursor) /* {{{ */
{
if (!Z_ISUNDEF(cursor->visitor_data.zchild)) {
zval_ptr_dtor(&cursor->visitor_data.zchild);
#if PHP_VERSION_ID >= 70000
ZVAL_UNDEF(&cursor->visitor_data.zchild);
#else
cursor->visitor_data.zchild = NULL;
#endif
}
} /* }}} */
/* {{{ Iterator handlers */
static void php_phongo_cursor_iterator_dtor(zend_object_iterator *iter TSRMLS_DC) /* {{{ */
{
php_phongo_cursor_iterator *cursor_it = (php_phongo_cursor_iterator *)iter;
if (!Z_ISUNDEF(cursor_it->intern.data)) {
#if PHP_VERSION_ID >= 70000
zval_ptr_dtor(&cursor_it->intern.data);
#else
zval_ptr_dtor((zval**)&cursor_it->intern.data);
cursor_it->intern.data = NULL;
#endif
}
#if PHP_VERSION_ID < 70000
efree(cursor_it);
#endif
} /* }}} */
static int php_phongo_cursor_iterator_valid(zend_object_iterator *iter TSRMLS_DC) /* {{{ */
{
php_phongo_cursor_t *cursor = ((php_phongo_cursor_iterator *)iter)->cursor;
if (!Z_ISUNDEF(cursor->visitor_data.zchild)) {
return SUCCESS;
}
return FAILURE;
} /* }}} */
#if PHP_VERSION_ID < 50500
static int php_phongo_cursor_iterator_get_current_key(zend_object_iterator *iter, char **str_key, uint *str_key_len, ulong *int_key TSRMLS_DC) /* {{{ */
{
php_phongo_cursor_t *cursor = ((php_phongo_cursor_iterator *)iter)->cursor;
*int_key = (ulong) cursor->current;
return HASH_KEY_IS_LONG;
} /* }}} */
#else
static void php_phongo_cursor_iterator_get_current_key(zend_object_iterator *iter, zval *key TSRMLS_DC) /* {{{ */
{
php_phongo_cursor_t *cursor = ((php_phongo_cursor_iterator *)iter)->cursor;
ZVAL_LONG(key, cursor->current);
} /* }}} */
#endif
#if PHP_VERSION_ID < 70000
static void php_phongo_cursor_iterator_get_current_data(zend_object_iterator *iter, zval ***data TSRMLS_DC) /* {{{ */
{
php_phongo_cursor_t *cursor = ((php_phongo_cursor_iterator *)iter)->cursor;
*data = &cursor->visitor_data.zchild;
} /* }}} */
#else
static zval* php_phongo_cursor_iterator_get_current_data(zend_object_iterator *iter) /* {{{ */
{
php_phongo_cursor_t *cursor = ((php_phongo_cursor_iterator *)iter)->cursor;
return &cursor->visitor_data.zchild;
} /* }}} */
#endif
static void php_phongo_cursor_iterator_move_forward(zend_object_iterator *iter TSRMLS_DC) /* {{{ */
{
php_phongo_cursor_iterator *cursor_it = (php_phongo_cursor_iterator *)iter;
php_phongo_cursor_t *cursor = cursor_it->cursor;
const bson_t *doc;
php_phongo_cursor_free_current(cursor);
cursor->current++;
if (mongoc_cursor_next(cursor->cursor, &doc)) {
phongo_bson_to_zval_ex(bson_get_data(doc), doc->len, &cursor->visitor_data);
} else {
bson_error_t error;
if (mongoc_cursor_error(cursor->cursor, &error)) {
/* Intentionally not destroying the cursor as it will happen
* naturally now that there are no more results */
phongo_throw_exception_from_bson_error_t(&error TSRMLS_CC);
}
}
} /* }}} */
static void php_phongo_cursor_iterator_rewind(zend_object_iterator *iter TSRMLS_DC) /* {{{ */
{
php_phongo_cursor_iterator *cursor_it = (php_phongo_cursor_iterator *)iter;
php_phongo_cursor_t *cursor = cursor_it->cursor;
const bson_t *doc;
if (cursor->current > 0) {
phongo_throw_exception(PHONGO_ERROR_LOGIC TSRMLS_CC, "Cursors cannot rewind after starting iteration");
return;
}
php_phongo_cursor_free_current(cursor);
doc = mongoc_cursor_current(cursor->cursor);
if (doc) {
phongo_bson_to_zval_ex(bson_get_data(doc), doc->len, &cursor->visitor_data);
}
} /* }}} */
/* iterator handler table */
zend_object_iterator_funcs php_phongo_cursor_iterator_funcs = {
php_phongo_cursor_iterator_dtor,
php_phongo_cursor_iterator_valid,
php_phongo_cursor_iterator_get_current_data,
php_phongo_cursor_iterator_get_current_key,
php_phongo_cursor_iterator_move_forward,
php_phongo_cursor_iterator_rewind,
NULL /* invalidate_current is not used */
};
zend_object_iterator *php_phongo_cursor_get_iterator(zend_class_entry *ce, zval *object, int by_ref TSRMLS_DC) /* {{{ */
{
php_phongo_cursor_iterator *cursor_it = NULL;
php_phongo_cursor_t *cursor = Z_CURSOR_OBJ_P(object);
if (by_ref) {
zend_error(E_ERROR, "An iterator cannot be used with foreach by reference");
}
if (cursor->got_iterator) {
phongo_throw_exception(PHONGO_ERROR_LOGIC TSRMLS_CC, "Cursors cannot yield multiple iterators");
return NULL;
}
cursor->got_iterator = 1;
cursor_it = ecalloc(1, sizeof(php_phongo_cursor_iterator));
#if PHP_VERSION_ID >= 70000
zend_iterator_init(&cursor_it->intern);
#endif
#if PHP_VERSION_ID >= 70000
ZVAL_COPY(&cursor_it->intern.data, object);
#else
Z_ADDREF_P(object);
cursor_it->intern.data = (void*)object;
#endif
cursor_it->intern.funcs = &php_phongo_cursor_iterator_funcs;
cursor_it->cursor = cursor;
/* cursor_it->current should already be allocated to zero */
php_phongo_cursor_free_current(cursor_it->cursor);
return &cursor_it->intern;
} /* }}} */
/* }}} */
/* {{{ proto void Cursor::setTypeMap(array $typemap)
Sets a type map to use for BSON unserialization */
PHP_METHOD(Cursor, setTypeMap)
{
php_phongo_cursor_t *intern;
php_phongo_bson_state state = PHONGO_BSON_STATE_INITIALIZER;
zval *typemap = NULL;
+ bool restore_current_element = false;
SUPPRESS_UNUSED_WARNING(return_value) SUPPRESS_UNUSED_WARNING(return_value_ptr) SUPPRESS_UNUSED_WARNING(return_value_used)
intern = Z_CURSOR_OBJ_P(getThis());
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a!", &typemap) == FAILURE) {
return;
}
/* Check if the existing element needs to be freed before we overwrite
* visitor_data, which contains the only reference to it. */
if (!Z_ISUNDEF(intern->visitor_data.zchild)) {
php_phongo_cursor_free_current(intern);
+ restore_current_element = true;
}
phongo_bson_typemap_to_state(typemap, &state.map TSRMLS_CC);
intern->visitor_data = state;
/* If the cursor has a current element, we just freed it and should restore
* it with a new type map applied. */
- if (mongoc_cursor_current(intern->cursor)) {
+ if (restore_current_element && mongoc_cursor_current(intern->cursor)) {
const bson_t *doc = mongoc_cursor_current(intern->cursor);
phongo_bson_to_zval_ex(bson_get_data(doc), doc->len, &intern->visitor_data);
}
}
/* }}} */
static int php_phongo_cursor_to_array_apply(zend_object_iterator *iter, void *puser TSRMLS_DC) /* {{{ */
{
#if PHP_VERSION_ID >= 70000
zval *data;
zval *return_value = (zval*)puser;
data = iter->funcs->get_current_data(iter TSRMLS_CC);
if (EG(exception)) {
return ZEND_HASH_APPLY_STOP;
}
if (Z_ISUNDEF_P(data)) {
return ZEND_HASH_APPLY_STOP;
}
Z_TRY_ADDREF_P(data);
add_next_index_zval(return_value, data);
#else
zval **data;
zval *return_value = (zval*)puser;
iter->funcs->get_current_data(iter, &data TSRMLS_CC);
if (EG(exception)) {
return ZEND_HASH_APPLY_STOP;
}
if (data == NULL || *data == NULL) {
return ZEND_HASH_APPLY_STOP;
}
Z_ADDREF_PP(data);
add_next_index_zval(return_value, *data);
#endif
return ZEND_HASH_APPLY_KEEP;
}
/* }}} */
/* {{{ proto array Cursor::toArray()
Returns an array of all result documents for this cursor */
PHP_METHOD(Cursor, toArray)
{
SUPPRESS_UNUSED_WARNING(return_value_ptr) SUPPRESS_UNUSED_WARNING(return_value_used)
if (zend_parse_parameters_none() == FAILURE) {
return;
}
array_init(return_value);
if (spl_iterator_apply(getThis(), php_phongo_cursor_to_array_apply, (void*)return_value TSRMLS_CC) != SUCCESS) {
zval_dtor(return_value);
RETURN_NULL();
}
}
/* }}} */
/* {{{ proto MongoDB\Driver\CursorId Cursor::getId()
Returns the CursorId for this cursor */
PHP_METHOD(Cursor, getId)
{
php_phongo_cursor_t *intern;
SUPPRESS_UNUSED_WARNING(return_value_ptr) SUPPRESS_UNUSED_WARNING(return_value_used)
intern = Z_CURSOR_OBJ_P(getThis());
if (zend_parse_parameters_none() == FAILURE) {
return;
}
php_phongo_cursor_id_new_from_id(return_value, mongoc_cursor_get_id(intern->cursor) TSRMLS_CC);
}
/* }}} */
/* {{{ proto MongoDB\Driver\Server Cursor::getServer()
Returns the Server object to which this cursor is attached */
PHP_METHOD(Cursor, getServer)
{
php_phongo_cursor_t *intern;
SUPPRESS_UNUSED_WARNING(return_value_ptr) SUPPRESS_UNUSED_WARNING(return_value_used)
intern = Z_CURSOR_OBJ_P(getThis());
if (zend_parse_parameters_none() == FAILURE) {
return;
}
#if PHP_VERSION_ID >= 70000
phongo_server_init(return_value, &intern->manager, intern->server_id TSRMLS_CC);
#else
phongo_server_init(return_value, intern->manager, intern->server_id TSRMLS_CC);
#endif
}
/* }}} */
/* {{{ proto boolean Cursor::isDead()
Checks if a cursor is still alive */
PHP_METHOD(Cursor, isDead)
{
php_phongo_cursor_t *intern;
SUPPRESS_UNUSED_WARNING(return_value_ptr) SUPPRESS_UNUSED_WARNING(return_value_used)
intern = Z_CURSOR_OBJ_P(getThis());
if (zend_parse_parameters_none() == FAILURE) {
return;
}
RETURN_BOOL(!mongoc_cursor_is_alive(intern->cursor));
}
/* }}} */
/* {{{ MongoDB\Driver\Cursor */
ZEND_BEGIN_ARG_INFO_EX(ai_Cursor_setTypeMap, 0, 0, 1)
ZEND_ARG_ARRAY_INFO(0, typemap, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(ai_Cursor_void, 0, 0, 0)
ZEND_END_ARG_INFO()
static zend_function_entry php_phongo_cursor_me[] = {
PHP_ME(Server, __construct, ai_Cursor_void, ZEND_ACC_FINAL|ZEND_ACC_PRIVATE)
PHP_ME(Cursor, setTypeMap, ai_Cursor_setTypeMap, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
PHP_ME(Cursor, toArray, ai_Cursor_void, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
PHP_ME(Cursor, getId, ai_Cursor_void, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
PHP_ME(Cursor, getServer, ai_Cursor_void, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
PHP_ME(Cursor, isDead, ai_Cursor_void, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
PHP_ME(Manager, __wakeup, ai_Cursor_void, ZEND_ACC_PUBLIC)
PHP_FE_END
};
/* }}} */
/* {{{ php_phongo_cursor_t object handlers */
static void php_phongo_cursor_free_object(phongo_free_object_arg *object TSRMLS_DC) /* {{{ */
{
php_phongo_cursor_t *intern = Z_OBJ_CURSOR(object);
zend_object_std_dtor(&intern->std TSRMLS_CC);
if (intern->cursor) {
mongoc_cursor_destroy(intern->cursor);
}
if (intern->database) {
efree(intern->database);
}
if (intern->collection) {
efree(intern->collection);
}
if (!Z_ISUNDEF(intern->query)) {
zval_ptr_dtor(&intern->query);
}
if (!Z_ISUNDEF(intern->command)) {
zval_ptr_dtor(&intern->command);
}
if (!Z_ISUNDEF(intern->read_preference)) {
zval_ptr_dtor(&intern->read_preference);
}
php_phongo_cursor_free_current(intern);
zval_ptr_dtor(&intern->manager);
#if PHP_VERSION_ID < 70000
efree(intern);
#endif
} /* }}} */
phongo_create_object_retval php_phongo_cursor_create_object(zend_class_entry *class_type TSRMLS_DC) /* {{{ */
{
php_phongo_cursor_t *intern = NULL;
intern = PHONGO_ALLOC_OBJECT_T(php_phongo_cursor_t, class_type);
zend_object_std_init(&intern->std, class_type TSRMLS_CC);
object_properties_init(&intern->std, class_type);
#if PHP_VERSION_ID >= 70000
intern->std.handlers = &php_phongo_handler_cursor;
return &intern->std;
#else
{
zend_object_value retval;
retval.handle = zend_objects_store_put(intern, (zend_objects_store_dtor_t) zend_objects_destroy_object, php_phongo_cursor_free_object, NULL TSRMLS_CC);
retval.handlers = &php_phongo_handler_cursor;
return retval;
}
#endif
} /* }}} */
HashTable *php_phongo_cursor_get_debug_info(zval *object, int *is_temp TSRMLS_DC) /* {{{ */
{
php_phongo_cursor_t *intern;
#if PHP_VERSION_ID >= 70000
zval retval;
#else
zval retval = zval_used_for_init;
#endif
*is_temp = 1;
intern = Z_CURSOR_OBJ_P(object);
array_init_size(&retval, 9);
if (intern->database) {
ADD_ASSOC_STRING(&retval, "database", intern->database);
} else {
ADD_ASSOC_NULL_EX(&retval, "database");
}
if (intern->collection) {
ADD_ASSOC_STRING(&retval, "collection", intern->collection);
} else {
ADD_ASSOC_NULL_EX(&retval, "collection");
}
if (!Z_ISUNDEF(intern->query)) {
#if PHP_VERSION_ID >= 70000
ADD_ASSOC_ZVAL_EX(&retval, "query", &intern->query);
Z_ADDREF(intern->query);
#else
ADD_ASSOC_ZVAL_EX(&retval, "query", intern->query);
Z_ADDREF_P(intern->query);
#endif
} else {
ADD_ASSOC_NULL_EX(&retval, "query");
}
if (!Z_ISUNDEF(intern->command)) {
#if PHP_VERSION_ID >= 70000
ADD_ASSOC_ZVAL_EX(&retval, "command", &intern->command);
Z_ADDREF(intern->command);
#else
ADD_ASSOC_ZVAL_EX(&retval, "command", intern->command);
Z_ADDREF_P(intern->command);
#endif
} else {
ADD_ASSOC_NULL_EX(&retval, "command");
}
if (!Z_ISUNDEF(intern->read_preference)) {
#if PHP_VERSION_ID >= 70000
ADD_ASSOC_ZVAL_EX(&retval, "readPreference", &intern->read_preference);
Z_ADDREF(intern->read_preference);
#else
ADD_ASSOC_ZVAL_EX(&retval, "readPreference", intern->read_preference);
Z_ADDREF_P(intern->read_preference);
#endif
} else {
ADD_ASSOC_NULL_EX(&retval, "readPreference");
}
ADD_ASSOC_BOOL_EX(&retval, "isDead", !mongoc_cursor_is_alive(intern->cursor));
ADD_ASSOC_LONG_EX(&retval, "currentIndex", intern->current);
if (!Z_ISUNDEF(intern->visitor_data.zchild)) {
#if PHP_VERSION_ID >= 70000
ADD_ASSOC_ZVAL_EX(&retval, "currentDocument", &intern->visitor_data.zchild);
/*Z_ADDREF(intern->visitor_data.zchild);*/
#else
ADD_ASSOC_ZVAL_EX(&retval, "currentDocument", intern->visitor_data.zchild);
Z_ADDREF_P(intern->visitor_data.zchild);
#endif
} else {
ADD_ASSOC_NULL_EX(&retval, "currentDocument");
}
{
#if PHP_VERSION_ID >= 70000
zval server;
phongo_server_init(&server, &intern->manager, intern->server_id TSRMLS_CC);
ADD_ASSOC_ZVAL_EX(&retval, "server", &server);
#else
zval *server = NULL;
MAKE_STD_ZVAL(server);
phongo_server_init(server, intern->manager, intern->server_id TSRMLS_CC);
ADD_ASSOC_ZVAL_EX(&retval, "server", server);
#endif
}
return Z_ARRVAL(retval);
} /* }}} */
/* }}} */
/* {{{ PHP_MINIT_FUNCTION */
PHP_MINIT_FUNCTION(Cursor)
{
zend_class_entry ce;
(void)type;(void)module_number;
INIT_NS_CLASS_ENTRY(ce, "MongoDB\\Driver", "Cursor", php_phongo_cursor_me);
php_phongo_cursor_ce = zend_register_internal_class(&ce TSRMLS_CC);
php_phongo_cursor_ce->create_object = php_phongo_cursor_create_object;
PHONGO_CE_FINAL(php_phongo_cursor_ce);
PHONGO_CE_DISABLE_SERIALIZATION(php_phongo_cursor_ce);
php_phongo_cursor_ce->get_iterator = php_phongo_cursor_get_iterator;
memcpy(&php_phongo_handler_cursor, phongo_get_std_object_handlers(), sizeof(zend_object_handlers));
php_phongo_handler_cursor.get_debug_info = php_phongo_cursor_get_debug_info;
#if PHP_VERSION_ID >= 70000
php_phongo_handler_cursor.free_obj = php_phongo_cursor_free_object;
php_phongo_handler_cursor.offset = XtOffsetOf(php_phongo_cursor_t, std);
#endif
zend_class_implements(php_phongo_cursor_ce TSRMLS_CC, 1, zend_ce_traversable);
return SUCCESS;
}
/* }}} */
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* End:
* vim600: noet sw=4 ts=4 fdm=marker
* vim<600: noet sw=4 ts=4
*/
diff --git a/mongodb-1.2.3/src/MongoDB/CursorId.c b/mongodb-1.2.8/src/MongoDB/CursorId.c
similarity index 100%
rename from mongodb-1.2.3/src/MongoDB/CursorId.c
rename to mongodb-1.2.8/src/MongoDB/CursorId.c
diff --git a/mongodb-1.2.3/src/MongoDB/Exception/AuthenticationException.c b/mongodb-1.2.8/src/MongoDB/Exception/AuthenticationException.c
similarity index 100%
rename from mongodb-1.2.3/src/MongoDB/Exception/AuthenticationException.c
rename to mongodb-1.2.8/src/MongoDB/Exception/AuthenticationException.c
diff --git a/mongodb-1.2.3/src/MongoDB/Exception/BulkWriteException.c b/mongodb-1.2.8/src/MongoDB/Exception/BulkWriteException.c
similarity index 100%
rename from mongodb-1.2.3/src/MongoDB/Exception/BulkWriteException.c
rename to mongodb-1.2.8/src/MongoDB/Exception/BulkWriteException.c
diff --git a/mongodb-1.2.3/src/MongoDB/Exception/ConnectionException.c b/mongodb-1.2.8/src/MongoDB/Exception/ConnectionException.c
similarity index 100%
rename from mongodb-1.2.3/src/MongoDB/Exception/ConnectionException.c
rename to mongodb-1.2.8/src/MongoDB/Exception/ConnectionException.c
diff --git a/mongodb-1.2.3/src/MongoDB/Exception/ConnectionTimeoutException.c b/mongodb-1.2.8/src/MongoDB/Exception/ConnectionTimeoutException.c
similarity index 100%
rename from mongodb-1.2.3/src/MongoDB/Exception/ConnectionTimeoutException.c
rename to mongodb-1.2.8/src/MongoDB/Exception/ConnectionTimeoutException.c
diff --git a/mongodb-1.2.3/src/MongoDB/Exception/Exception.c b/mongodb-1.2.8/src/MongoDB/Exception/Exception.c
similarity index 100%
rename from mongodb-1.2.3/src/MongoDB/Exception/Exception.c
rename to mongodb-1.2.8/src/MongoDB/Exception/Exception.c
diff --git a/mongodb-1.2.3/src/MongoDB/Exception/ExecutionTimeoutException.c b/mongodb-1.2.8/src/MongoDB/Exception/ExecutionTimeoutException.c
similarity index 100%
rename from mongodb-1.2.3/src/MongoDB/Exception/ExecutionTimeoutException.c
rename to mongodb-1.2.8/src/MongoDB/Exception/ExecutionTimeoutException.c
diff --git a/mongodb-1.2.3/src/MongoDB/Exception/InvalidArgumentException.c b/mongodb-1.2.8/src/MongoDB/Exception/InvalidArgumentException.c
similarity index 100%
rename from mongodb-1.2.3/src/MongoDB/Exception/InvalidArgumentException.c
rename to mongodb-1.2.8/src/MongoDB/Exception/InvalidArgumentException.c
diff --git a/mongodb-1.2.3/src/MongoDB/Exception/LogicException.c b/mongodb-1.2.8/src/MongoDB/Exception/LogicException.c
similarity index 100%
rename from mongodb-1.2.3/src/MongoDB/Exception/LogicException.c
rename to mongodb-1.2.8/src/MongoDB/Exception/LogicException.c
diff --git a/mongodb-1.2.3/src/MongoDB/Exception/RuntimeException.c b/mongodb-1.2.8/src/MongoDB/Exception/RuntimeException.c
similarity index 100%
rename from mongodb-1.2.3/src/MongoDB/Exception/RuntimeException.c
rename to mongodb-1.2.8/src/MongoDB/Exception/RuntimeException.c
diff --git a/mongodb-1.2.3/src/MongoDB/Exception/SSLConnectionException.c b/mongodb-1.2.8/src/MongoDB/Exception/SSLConnectionException.c
similarity index 100%
rename from mongodb-1.2.3/src/MongoDB/Exception/SSLConnectionException.c
rename to mongodb-1.2.8/src/MongoDB/Exception/SSLConnectionException.c
diff --git a/mongodb-1.2.3/src/MongoDB/Exception/UnexpectedValueException.c b/mongodb-1.2.8/src/MongoDB/Exception/UnexpectedValueException.c
similarity index 100%
rename from mongodb-1.2.3/src/MongoDB/Exception/UnexpectedValueException.c
rename to mongodb-1.2.8/src/MongoDB/Exception/UnexpectedValueException.c
diff --git a/mongodb-1.2.3/src/MongoDB/Exception/WriteException.c b/mongodb-1.2.8/src/MongoDB/Exception/WriteException.c
similarity index 100%
rename from mongodb-1.2.3/src/MongoDB/Exception/WriteException.c
rename to mongodb-1.2.8/src/MongoDB/Exception/WriteException.c
diff --git a/mongodb-1.2.3/src/MongoDB/Manager.c b/mongodb-1.2.8/src/MongoDB/Manager.c
similarity index 100%
rename from mongodb-1.2.3/src/MongoDB/Manager.c
rename to mongodb-1.2.8/src/MongoDB/Manager.c
diff --git a/mongodb-1.2.3/src/MongoDB/Query.c b/mongodb-1.2.8/src/MongoDB/Query.c
similarity index 100%
rename from mongodb-1.2.3/src/MongoDB/Query.c
rename to mongodb-1.2.8/src/MongoDB/Query.c
diff --git a/mongodb-1.2.3/src/MongoDB/ReadConcern.c b/mongodb-1.2.8/src/MongoDB/ReadConcern.c
similarity index 100%
rename from mongodb-1.2.3/src/MongoDB/ReadConcern.c
rename to mongodb-1.2.8/src/MongoDB/ReadConcern.c
diff --git a/mongodb-1.2.3/src/MongoDB/ReadPreference.c b/mongodb-1.2.8/src/MongoDB/ReadPreference.c
similarity index 100%
rename from mongodb-1.2.3/src/MongoDB/ReadPreference.c
rename to mongodb-1.2.8/src/MongoDB/ReadPreference.c
diff --git a/mongodb-1.2.3/src/MongoDB/Server.c b/mongodb-1.2.8/src/MongoDB/Server.c
similarity index 100%
rename from mongodb-1.2.3/src/MongoDB/Server.c
rename to mongodb-1.2.8/src/MongoDB/Server.c
diff --git a/mongodb-1.2.3/src/MongoDB/WriteConcern.c b/mongodb-1.2.8/src/MongoDB/WriteConcern.c
similarity index 100%
rename from mongodb-1.2.3/src/MongoDB/WriteConcern.c
rename to mongodb-1.2.8/src/MongoDB/WriteConcern.c
diff --git a/mongodb-1.2.3/src/MongoDB/WriteConcernError.c b/mongodb-1.2.8/src/MongoDB/WriteConcernError.c
similarity index 100%
rename from mongodb-1.2.3/src/MongoDB/WriteConcernError.c
rename to mongodb-1.2.8/src/MongoDB/WriteConcernError.c
diff --git a/mongodb-1.2.3/src/MongoDB/WriteError.c b/mongodb-1.2.8/src/MongoDB/WriteError.c
similarity index 100%
rename from mongodb-1.2.3/src/MongoDB/WriteError.c
rename to mongodb-1.2.8/src/MongoDB/WriteError.c
diff --git a/mongodb-1.2.3/src/MongoDB/WriteResult.c b/mongodb-1.2.8/src/MongoDB/WriteResult.c
similarity index 100%
rename from mongodb-1.2.3/src/MongoDB/WriteResult.c
rename to mongodb-1.2.8/src/MongoDB/WriteResult.c
diff --git a/mongodb-1.2.3/src/bson.c b/mongodb-1.2.8/src/bson.c
similarity index 99%
rename from mongodb-1.2.3/src/bson.c
rename to mongodb-1.2.8/src/bson.c
index 72796c79..f81d8d3e 100644
--- a/mongodb-1.2.3/src/bson.c
+++ b/mongodb-1.2.8/src/bson.c
@@ -1,1813 +1,1812 @@
/*
* Copyright 2014-2017 MongoDB, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
/* External libs */
#include <bson.h>
/* PHP Core stuff */
#include <php.h>
#include <ext/spl/spl_array.h>
#include <Zend/zend_hash.h>
#include <Zend/zend_interfaces.h>
/* PHP array helpers */
#include "php_array_api.h"
/* Our Compatability header */
#include "phongo_compat.h"
/* Our stuffz */
#include "php_phongo.h"
#include "php_bson.h"
#if SIZEOF_PHONGO_LONG == 8
# define BSON_APPEND_INT(b, key, keylen, val) \
if (val > INT32_MAX || val < INT32_MIN) { \
bson_append_int64(b, key, keylen, val); \
} else { \
bson_append_int32(b, key, keylen, val); \
}
#elif SIZEOF_PHONGO_LONG == 4
# define BSON_APPEND_INT(b, key, keylen, val) \
bson_append_int32(b, key, keylen, val)
#else
# error Unsupported architecture (integers are neither 32-bit nor 64-bit)
#endif
#undef MONGOC_LOG_DOMAIN
#define MONGOC_LOG_DOMAIN "PHONGO-BSON"
#define PHONGO_ODM_FIELD_NAME "__pclass"
#define PHONGO_IS_CLASS_INSTANTIATABLE(ce) \
(!(ce->ce_flags & (ZEND_ACC_INTERFACE|ZEND_ACC_IMPLICIT_ABSTRACT_CLASS|ZEND_ACC_EXPLICIT_ABSTRACT_CLASS)))
PHP_MINIT_FUNCTION(bson)
{
(void)type; /* We don't care if we are loaded via dl() or extension= */
(void)module_number; /* Really doesn't matter which module number we are */
/* Register BSONable */
return SUCCESS;
}
/* Forward declarations */
bool php_phongo_bson_visit_document(const bson_iter_t *iter ARG_UNUSED, const char *key, const bson_t *v_document, void *data);
bool php_phongo_bson_visit_array(const bson_iter_t *iter ARG_UNUSED, const char *key, const bson_t *v_document, void *data);
/* {{{ Santa's Little Helper: Object getters */
void php_phongo_objectid_get_id(zval *object, bson_oid_t *oid TSRMLS_DC)
{
php_phongo_objectid_t *intern;
intern = Z_OBJECTID_OBJ_P(object);
bson_oid_init_from_string(oid, intern->oid);
}
int64_t php_phongo_utcdatetime_get_milliseconds(zval *object TSRMLS_DC)
{
php_phongo_utcdatetime_t *intern;
intern = Z_UTCDATETIME_OBJ_P(object);
return intern->milliseconds;
}
uint32_t php_phongo_timestamp_get_increment(zval *object TSRMLS_DC)
{
php_phongo_timestamp_t *intern;
intern = Z_TIMESTAMP_OBJ_P(object);
return intern->increment;
}
uint32_t php_phongo_timestamp_get_timestamp(zval *object TSRMLS_DC)
{
php_phongo_timestamp_t *intern;
intern = Z_TIMESTAMP_OBJ_P(object);
return intern->timestamp;
}
bool php_phongo_javascript_has_scope(zval *object TSRMLS_DC)
{
php_phongo_javascript_t *intern;
intern = Z_JAVASCRIPT_OBJ_P(object);
return !!intern->scope;
}
char *php_phongo_javascript_get_code(zval *object TSRMLS_DC)
{
php_phongo_javascript_t *intern;
intern = Z_JAVASCRIPT_OBJ_P(object);
return intern->code;
}
bson_t *php_phongo_javascript_get_scope(zval *object TSRMLS_DC)
{
php_phongo_javascript_t *intern;
intern = Z_JAVASCRIPT_OBJ_P(object);
return intern->scope;
}
int php_phongo_binary_get_data(zval *object, char **data TSRMLS_DC)
{
php_phongo_binary_t *intern;
intern = Z_BINARY_OBJ_P(object);
*data = intern->data;
return intern->data_len;
}
uint8_t php_phongo_binary_get_type(zval *object TSRMLS_DC)
{
php_phongo_binary_t *intern;
intern = Z_BINARY_OBJ_P(object);
return intern->type;
}
static bson_decimal128_t *php_phongo_decimal128_get_decimal128(zval *object TSRMLS_DC)
{
php_phongo_decimal128_t *intern;
intern = Z_DECIMAL128_OBJ_P(object);
return &intern->decimal;
}
char *php_phongo_regex_get_pattern(zval *object TSRMLS_DC)
{
php_phongo_regex_t *intern;
intern = Z_REGEX_OBJ_P(object);
return intern->pattern;
}
char *php_phongo_regex_get_flags(zval *object TSRMLS_DC)
{
php_phongo_regex_t *intern;
intern = Z_REGEX_OBJ_P(object);
return intern->flags;
}
/* }}} */
#if 0
bool php_phongo_bson_visit_before(const bson_iter_t *iter ARG_UNUSED, const char *key, void *data) /* {{{ */
{
return false;
}
/* }}} */
bool php_phongo_bson_visit_after(const bson_iter_t *iter ARG_UNUSED, const char *key, void *data) /* {{{ */
{
return false;
}
/* }}} */
#endif
void php_phongo_bson_visit_corrupt(const bson_iter_t *iter ARG_UNUSED, void *data ARG_UNUSED) /* {{{ */
{
mongoc_log(MONGOC_LOG_LEVEL_TRACE, MONGOC_LOG_DOMAIN, "Corrupt BSON data detected!");
}
void php_phongo_bson_visit_unsupported_type(const bson_iter_t *iter ARG_UNUSED, const char *key, uint32_t v_type_code, void *data ARG_UNUSED) /* {{{ */
{
TSRMLS_FETCH();
phongo_throw_exception(PHONGO_ERROR_UNEXPECTED_VALUE TSRMLS_CC, "Detected unknown BSON type 0x%02hhx for fieldname \"%s\". Are you using the latest driver?", v_type_code, key);
}
bool php_phongo_bson_visit_double(const bson_iter_t *iter ARG_UNUSED, const char *key, double v_double, void *data) /* {{{ */
{
#if PHP_VERSION_ID >= 70000
zval *retval = &((php_phongo_bson_state *)data)->zchild;
#else
zval *retval = ((php_phongo_bson_state *)data)->zchild;
#endif
if (((php_phongo_bson_state *)data)->is_visiting_array) {
add_next_index_double(retval, v_double);
} else {
add_assoc_double(retval, key, v_double);
}
return false;
}
/* }}} */
bool php_phongo_bson_visit_utf8(const bson_iter_t *iter ARG_UNUSED, const char *key, size_t v_utf8_len, const char *v_utf8, void *data) /* {{{ */
{
#if PHP_VERSION_ID >= 70000
zval *retval = &((php_phongo_bson_state *)data)->zchild;
#else
zval *retval = ((php_phongo_bson_state *)data)->zchild;
#endif
if (((php_phongo_bson_state *)data)->is_visiting_array) {
ADD_NEXT_INDEX_STRINGL(retval, v_utf8, v_utf8_len);
} else {
ADD_ASSOC_STRING_EX(retval, key, strlen(key), v_utf8, v_utf8_len);
}
return false;
}
/* }}} */
bool php_phongo_bson_visit_binary(const bson_iter_t *iter ARG_UNUSED, const char *key, bson_subtype_t v_subtype, size_t v_binary_len, const uint8_t *v_binary, void *data) /* {{{ */
{
#if PHP_VERSION_ID >= 70000
zval *retval = &((php_phongo_bson_state *)data)->zchild;
#else
zval *retval = ((php_phongo_bson_state *)data)->zchild;
#endif
TSRMLS_FETCH();
if (v_subtype == 0x80 && strcmp(key, PHONGO_ODM_FIELD_NAME) == 0) {
#if PHP_VERSION_ID >= 70000
zend_string *zs_classname = zend_string_init((const char *)v_binary, v_binary_len, 0);
zend_class_entry *found_ce = zend_fetch_class(zs_classname, ZEND_FETCH_CLASS_AUTO|ZEND_FETCH_CLASS_SILENT TSRMLS_CC);
- zend_string_free(zs_classname);
+ zend_string_release(zs_classname);
#else
zend_class_entry *found_ce = zend_fetch_class((const char *)v_binary, v_binary_len, ZEND_FETCH_CLASS_AUTO|ZEND_FETCH_CLASS_SILENT TSRMLS_CC);
#endif
if (found_ce && PHONGO_IS_CLASS_INSTANTIATABLE(found_ce) && instanceof_function(found_ce, php_phongo_persistable_ce TSRMLS_CC)) {
((php_phongo_bson_state *)data)->odm = found_ce;
}
}
{
#if PHP_VERSION_ID >= 70000
zval zchild;
php_phongo_new_binary_from_binary_and_type(&zchild, (const char *)v_binary, v_binary_len, v_subtype TSRMLS_CC);
if (((php_phongo_bson_state *)data)->is_visiting_array) {
add_next_index_zval(retval, &zchild);
} else {
ADD_ASSOC_ZVAL(retval, key, &zchild);
}
Z_SET_REFCOUNT(zchild, 1);
#else
zval *zchild = NULL;
MAKE_STD_ZVAL(zchild);
php_phongo_new_binary_from_binary_and_type(zchild, (const char *)v_binary, v_binary_len, v_subtype TSRMLS_CC);
if (((php_phongo_bson_state *)data)->is_visiting_array) {
add_next_index_zval(retval, zchild);
} else {
ADD_ASSOC_ZVAL(retval, key, zchild);
}
Z_SET_REFCOUNT_P(zchild, 1);
#endif
}
return false;
}
/* }}} */
#if 0
bool php_phongo_bson_visit_undefined(const bson_iter_t *iter ARG_UNUSED, const char *key, void *data) /* {{{ */
{
printf("Not Implemented\n");
return true;
}
/* }}} */
#endif
bool php_phongo_bson_visit_oid(const bson_iter_t *iter ARG_UNUSED, const char *key, const bson_oid_t *v_oid, void *data) /* {{{ */
{
#if PHP_VERSION_ID >= 70000
zval *retval = &((php_phongo_bson_state *)data)->zchild;
#else
zval *retval = ((php_phongo_bson_state *)data)->zchild;
#endif
#if PHP_VERSION_ID >= 70000
zval zchild;
php_phongo_objectid_new_from_oid(&zchild, v_oid TSRMLS_CC);
if (((php_phongo_bson_state *)data)->is_visiting_array) {
add_next_index_zval(retval, &zchild);
} else {
ADD_ASSOC_ZVAL(retval, key, &zchild);
}
#else
zval *zchild = NULL;
TSRMLS_FETCH();
MAKE_STD_ZVAL(zchild);
php_phongo_objectid_new_from_oid(zchild, v_oid TSRMLS_CC);
if (((php_phongo_bson_state *)data)->is_visiting_array) {
add_next_index_zval(retval, zchild);
} else {
ADD_ASSOC_ZVAL(retval, key, zchild);
}
Z_SET_REFCOUNT_P(zchild, 1);
#endif
return false;
}
/* }}} */
bool php_phongo_bson_visit_bool(const bson_iter_t *iter ARG_UNUSED, const char *key, bool v_bool, void *data) /* {{{ */
{
#if PHP_VERSION_ID >= 70000
zval *retval = &((php_phongo_bson_state *)data)->zchild;
#else
zval *retval = ((php_phongo_bson_state *)data)->zchild;
#endif
if (((php_phongo_bson_state *)data)->is_visiting_array) {
add_next_index_bool(retval, v_bool);
} else {
add_assoc_bool(retval, key, v_bool);
}
return false;
}
/* }}} */
bool php_phongo_bson_visit_date_time(const bson_iter_t *iter ARG_UNUSED, const char *key, int64_t msec_since_epoch, void *data) /* {{{ */
{
#if PHP_VERSION_ID >= 70000
zval *retval = &((php_phongo_bson_state *)data)->zchild;
#else
zval *retval = ((php_phongo_bson_state *)data)->zchild;
#endif
#if PHP_VERSION_ID >= 70000
zval zchild;
php_phongo_new_utcdatetime_from_epoch(&zchild, msec_since_epoch TSRMLS_CC);
if (((php_phongo_bson_state *)data)->is_visiting_array) {
add_next_index_zval(retval, &zchild);
} else {
ADD_ASSOC_ZVAL(retval, key, &zchild);
}
#else
zval *zchild = NULL;
TSRMLS_FETCH();
MAKE_STD_ZVAL(zchild);
php_phongo_new_utcdatetime_from_epoch(zchild, msec_since_epoch TSRMLS_CC);
if (((php_phongo_bson_state *)data)->is_visiting_array) {
add_next_index_zval(retval, zchild);
} else {
ADD_ASSOC_ZVAL(retval, key, zchild);
}
Z_SET_REFCOUNT_P(zchild, 1);
#endif
return false;
}
/* }}} */
bool php_phongo_bson_visit_decimal128(const bson_iter_t *iter ARG_UNUSED, const char *key, const bson_decimal128_t *decimal, void *data) /* {{{ */
{
#if PHP_VERSION_ID >= 70000
zval *retval = &((php_phongo_bson_state *)data)->zchild;
zval zchild;
php_phongo_new_decimal128(&zchild, decimal TSRMLS_CC);
if (((php_phongo_bson_state *)data)->is_visiting_array) {
add_next_index_zval(retval, &zchild);
} else {
ADD_ASSOC_ZVAL(retval, key, &zchild);
}
#else
zval *retval = ((php_phongo_bson_state *)data)->zchild;
zval *zchild = NULL;
TSRMLS_FETCH();
MAKE_STD_ZVAL(zchild);
php_phongo_new_decimal128(zchild, decimal TSRMLS_CC);
if (((php_phongo_bson_state *)data)->is_visiting_array) {
add_next_index_zval(retval, zchild);
} else {
ADD_ASSOC_ZVAL(retval, key, zchild);
}
Z_SET_REFCOUNT_P(zchild, 1);
#endif
return false;
}
/* }}} */
bool php_phongo_bson_visit_null(const bson_iter_t *iter ARG_UNUSED, const char *key, void *data) /* {{{ */
{
#if PHP_VERSION_ID >= 70000
zval *retval = &((php_phongo_bson_state *)data)->zchild;
#else
zval *retval = ((php_phongo_bson_state *)data)->zchild;
#endif
if (((php_phongo_bson_state *)data)->is_visiting_array) {
add_next_index_null(retval);
} else {
add_assoc_null(retval, key);
}
return false;
}
/* }}} */
bool php_phongo_bson_visit_regex(const bson_iter_t *iter ARG_UNUSED, const char *key, const char *v_regex, const char *v_options, void *data) /* {{{ */
{
#if PHP_VERSION_ID >= 70000
zval *retval = &((php_phongo_bson_state *)data)->zchild;
#else
zval *retval = ((php_phongo_bson_state *)data)->zchild;
#endif
#if PHP_VERSION_ID >= 70000
zval zchild;
php_phongo_new_regex_from_regex_and_options(&zchild, v_regex, v_options TSRMLS_CC);
if (((php_phongo_bson_state *)data)->is_visiting_array) {
add_next_index_zval(retval, &zchild);
} else {
ADD_ASSOC_ZVAL(retval, key, &zchild);
}
#else
zval *zchild = NULL;
TSRMLS_FETCH();
MAKE_STD_ZVAL(zchild);
php_phongo_new_regex_from_regex_and_options(zchild, v_regex, v_options TSRMLS_CC);
if (((php_phongo_bson_state *)data)->is_visiting_array) {
add_next_index_zval(retval, zchild);
} else {
ADD_ASSOC_ZVAL(retval, key, zchild);
}
Z_SET_REFCOUNT_P(zchild, 1);
#endif
return false;
}
/* }}} */
#if 0
bool php_phongo_bson_visit_dbpointer(const bson_iter_t *iter ARG_UNUSED, const char *key, size_t v_collection_len, const char *v_collection, const bson_oid_t *v_oid, void *data) /* {{{ */
{
printf("Not Implemented\n");
return true;
}
/* }}} */
#endif
bool php_phongo_bson_visit_code(const bson_iter_t *iter ARG_UNUSED, const char *key, size_t v_code_len, const char *v_code, void *data) /* {{{ */
{
#if PHP_VERSION_ID >= 70000
zval *retval = &((php_phongo_bson_state *)data)->zchild;
#else
zval *retval = ((php_phongo_bson_state *)data)->zchild;
#endif
#if PHP_VERSION_ID >= 70000
zval zchild;
php_phongo_new_javascript_from_javascript(1, &zchild, v_code, v_code_len TSRMLS_CC);
if (((php_phongo_bson_state *)data)->is_visiting_array) {
add_next_index_zval(retval, &zchild);
} else {
ADD_ASSOC_ZVAL(retval, key, &zchild);
}
#else
zval *zchild = NULL;
TSRMLS_FETCH();
MAKE_STD_ZVAL(zchild);
php_phongo_new_javascript_from_javascript(1, zchild, v_code, v_code_len TSRMLS_CC);
if (((php_phongo_bson_state *)data)->is_visiting_array) {
add_next_index_zval(retval, zchild);
} else {
ADD_ASSOC_ZVAL(retval, key, zchild);
}
Z_SET_REFCOUNT_P(zchild, 1);
#endif
return false;
}
/* }}} */
#if 0
bool php_phongo_bson_visit_symbol(const bson_iter_t *iter ARG_UNUSED, const char *key, size_t v_symbol_len, const char *v_symbol, void *data) /* {{{ */
{
printf("Not Implemented\n");
return true;
}
/* }}} */
#endif
bool php_phongo_bson_visit_codewscope(const bson_iter_t *iter ARG_UNUSED, const char *key, size_t v_code_len, const char *v_code, const bson_t *v_scope, void *data) /* {{{ */
{
#if PHP_VERSION_ID >= 70000
zval *retval = &((php_phongo_bson_state *)data)->zchild;
#else
zval *retval = ((php_phongo_bson_state *)data)->zchild;
#endif
#if PHP_VERSION_ID >= 70000
zval zchild;
php_phongo_new_javascript_from_javascript_and_scope(1, &zchild, v_code, v_code_len, v_scope TSRMLS_CC);
if (((php_phongo_bson_state *)data)->is_visiting_array) {
add_next_index_zval(retval, &zchild);
} else {
ADD_ASSOC_ZVAL(retval, key, &zchild);
}
#else
zval *zchild = NULL;
TSRMLS_FETCH();
MAKE_STD_ZVAL(zchild);
php_phongo_new_javascript_from_javascript_and_scope(1, zchild, v_code, v_code_len, v_scope TSRMLS_CC);
if (((php_phongo_bson_state *)data)->is_visiting_array) {
add_next_index_zval(retval, zchild);
} else {
ADD_ASSOC_ZVAL(retval, key, zchild);
}
Z_SET_REFCOUNT_P(zchild, 1);
#endif
return false;
}
/* }}} */
bool php_phongo_bson_visit_int32(const bson_iter_t *iter ARG_UNUSED, const char *key, int32_t v_int32, void *data) /* {{{ */
{
#if PHP_VERSION_ID >= 70000
zval *retval = &((php_phongo_bson_state *)data)->zchild;
#else
zval *retval = ((php_phongo_bson_state *)data)->zchild;
#endif
if (((php_phongo_bson_state *)data)->is_visiting_array) {
add_next_index_long(retval, v_int32);
} else {
add_assoc_long(retval, key, v_int32);
}
return false;
}
/* }}} */
bool php_phongo_bson_visit_timestamp(const bson_iter_t *iter ARG_UNUSED, const char *key, uint32_t v_timestamp, uint32_t v_increment, void *data) /* {{{ */
{
#if PHP_VERSION_ID >= 70000
zval *retval = &((php_phongo_bson_state *)data)->zchild;
#else
zval *retval = ((php_phongo_bson_state *)data)->zchild;
#endif
#if PHP_VERSION_ID >= 70000
zval zchild;
php_phongo_new_timestamp_from_increment_and_timestamp(&zchild, v_increment, v_timestamp TSRMLS_CC);
if (((php_phongo_bson_state *)data)->is_visiting_array) {
add_next_index_zval(retval, &zchild);
} else {
ADD_ASSOC_ZVAL(retval, key, &zchild);
}
#else
zval *zchild = NULL;
TSRMLS_FETCH();
MAKE_STD_ZVAL(zchild);
php_phongo_new_timestamp_from_increment_and_timestamp(zchild, v_increment, v_timestamp TSRMLS_CC);
if (((php_phongo_bson_state *)data)->is_visiting_array) {
add_next_index_zval(retval, zchild);
} else {
ADD_ASSOC_ZVAL(retval, key, zchild);
}
Z_SET_REFCOUNT_P(zchild, 1);
#endif
return false;
}
/* }}} */
bool php_phongo_bson_visit_int64(const bson_iter_t *iter ARG_UNUSED, const char *key, int64_t v_int64, void *data) /* {{{ */
{
#if PHP_VERSION_ID >= 70000
zval *retval = &((php_phongo_bson_state *)data)->zchild;
#else
zval *retval = ((php_phongo_bson_state *)data)->zchild;
#endif
#if SIZEOF_PHONGO_LONG == 4
TSRMLS_FETCH();
#endif
if (((php_phongo_bson_state *)data)->is_visiting_array) {
ADD_NEXT_INDEX_INT64(retval, v_int64);
} else {
ADD_ASSOC_INT64(retval, key, v_int64);
}
return false;
}
/* }}} */
bool php_phongo_bson_visit_maxkey(const bson_iter_t *iter ARG_UNUSED, const char *key, void *data) /* {{{ */
{
#if PHP_VERSION_ID >= 70000
zval *retval = &((php_phongo_bson_state *)data)->zchild;
#else
zval *retval = ((php_phongo_bson_state *)data)->zchild;
#endif
#if PHP_VERSION_ID >= 70000
zval zchild;
object_init_ex(&zchild, php_phongo_maxkey_ce);
if (((php_phongo_bson_state *)data)->is_visiting_array) {
add_next_index_zval(retval, &zchild);
} else {
ADD_ASSOC_ZVAL(retval, key, &zchild);
}
#else
zval *zchild = NULL;
TSRMLS_FETCH();
MAKE_STD_ZVAL(zchild);
object_init_ex(zchild, php_phongo_maxkey_ce);
if (((php_phongo_bson_state *)data)->is_visiting_array) {
add_next_index_zval(retval, zchild);
} else {
ADD_ASSOC_ZVAL(retval, key, zchild);
}
Z_SET_REFCOUNT_P(zchild, 1);
#endif
return false;
}
/* }}} */
bool php_phongo_bson_visit_minkey(const bson_iter_t *iter ARG_UNUSED, const char *key, void *data) /* {{{ */
{
#if PHP_VERSION_ID >= 70000
zval *retval = &((php_phongo_bson_state *)data)->zchild;
#else
zval *retval = ((php_phongo_bson_state *)data)->zchild;
#endif
#if PHP_VERSION_ID >= 70000
zval zchild;
object_init_ex(&zchild, php_phongo_minkey_ce);
if (((php_phongo_bson_state *)data)->is_visiting_array) {
add_next_index_zval(retval, &zchild);
} else {
ADD_ASSOC_ZVAL(retval, key, &zchild);
}
#else
zval *zchild = NULL;
TSRMLS_FETCH();
MAKE_STD_ZVAL(zchild);
object_init_ex(zchild, php_phongo_minkey_ce);
Z_SET_REFCOUNT_P(zchild, 1);
if (((php_phongo_bson_state *)data)->is_visiting_array) {
add_next_index_zval(retval, zchild);
} else {
ADD_ASSOC_ZVAL(retval, key, zchild);
}
#endif
return false;
}
/* }}} */
static const bson_visitor_t php_bson_visitors = {
NULL /* php_phongo_bson_visit_before*/,
NULL /*php_phongo_bson_visit_after*/,
php_phongo_bson_visit_corrupt,
php_phongo_bson_visit_double,
php_phongo_bson_visit_utf8,
php_phongo_bson_visit_document,
php_phongo_bson_visit_array,
php_phongo_bson_visit_binary,
NULL /*php_phongo_bson_visit_undefined*/,
php_phongo_bson_visit_oid,
php_phongo_bson_visit_bool,
php_phongo_bson_visit_date_time,
php_phongo_bson_visit_null,
php_phongo_bson_visit_regex,
NULL /*php_phongo_bson_visit_dbpointer*/,
php_phongo_bson_visit_code,
NULL /*php_phongo_bson_visit_symbol*/,
php_phongo_bson_visit_codewscope,
php_phongo_bson_visit_int32,
php_phongo_bson_visit_timestamp,
php_phongo_bson_visit_int64,
php_phongo_bson_visit_maxkey,
php_phongo_bson_visit_minkey,
php_phongo_bson_visit_unsupported_type,
php_phongo_bson_visit_decimal128,
{ NULL }
};
bool php_phongo_bson_visit_document(const bson_iter_t *iter ARG_UNUSED, const char *key, const bson_t *v_document, void *data)
{
#if PHP_VERSION_ID >= 70000
zval *retval = &((php_phongo_bson_state *)data)->zchild;
#else
zval *retval = ((php_phongo_bson_state *)data)->zchild;
#endif
bson_iter_t child;
TSRMLS_FETCH();
if (bson_iter_init(&child, v_document)) {
php_phongo_bson_state state = PHONGO_BSON_STATE_INITIALIZER;
state.map = ((php_phongo_bson_state *)data)->map;
#if PHP_VERSION_ID >= 70000
array_init(&state.zchild);
#else
MAKE_STD_ZVAL(state.zchild);
array_init(state.zchild);
#endif
if (!bson_iter_visit_all(&child, &php_bson_visitors, &state) && !child.err_off) {
/* If php_phongo_bson_visit_binary() finds an ODM class, it should
* supersede a default type map and named document class. */
if (state.odm && state.map.document_type == PHONGO_TYPEMAP_NONE) {
state.map.document_type = PHONGO_TYPEMAP_CLASS;
}
switch(state.map.document_type) {
case PHONGO_TYPEMAP_NATIVE_ARRAY:
#if PHP_VERSION_ID >= 70000
if (((php_phongo_bson_state *)data)->is_visiting_array) {
add_next_index_zval(retval, &state.zchild);
} else {
ADD_ASSOC_ZVAL(retval, key, &state.zchild);
}
Z_SET_REFCOUNT(state.zchild, 1);
#else
if (((php_phongo_bson_state *)data)->is_visiting_array) {
add_next_index_zval(retval, state.zchild);
} else {
ADD_ASSOC_ZVAL(retval, key, state.zchild);
}
Z_SET_REFCOUNT_P(state.zchild, 1);
#endif
break;
case PHONGO_TYPEMAP_CLASS: {
#if PHP_VERSION_ID >= 70000
zval obj;
object_init_ex(&obj, state.odm ? state.odm : state.map.document);
zend_call_method_with_1_params(&obj, NULL, NULL, BSON_UNSERIALIZE_FUNC_NAME, NULL, &state.zchild);
if (((php_phongo_bson_state *)data)->is_visiting_array) {
add_next_index_zval(retval, &obj);
} else {
ADD_ASSOC_ZVAL(retval, key, &obj);
}
zval_ptr_dtor(&state.zchild);
#else
zval *obj = NULL;
MAKE_STD_ZVAL(obj);
object_init_ex(obj, state.odm ? state.odm : state.map.document);
zend_call_method_with_1_params(&obj, NULL, NULL, BSON_UNSERIALIZE_FUNC_NAME, NULL, state.zchild);
if (((php_phongo_bson_state *)data)->is_visiting_array) {
add_next_index_zval(retval, obj);
} else {
ADD_ASSOC_ZVAL(retval, key, obj);
}
zval_ptr_dtor(&state.zchild);
#endif
break;
}
case PHONGO_TYPEMAP_NATIVE_OBJECT:
default:
#if PHP_VERSION_ID >= 70000
object_and_properties_init(&state.zchild, zend_standard_class_def, Z_ARRVAL(state.zchild));
if (((php_phongo_bson_state *)data)->is_visiting_array) {
add_next_index_zval(retval, &state.zchild);
} else {
ADD_ASSOC_ZVAL(retval, key, &state.zchild);
}
Z_SET_REFCOUNT(state.zchild, 1);
#else
object_and_properties_init(state.zchild, zend_standard_class_def, Z_ARRVAL_P(state.zchild));
if (((php_phongo_bson_state *)data)->is_visiting_array) {
add_next_index_zval(retval, state.zchild);
} else {
ADD_ASSOC_ZVAL(retval, key, state.zchild);
}
Z_SET_REFCOUNT_P(state.zchild, 1);
#endif
}
} else {
/* Iteration stopped prematurely due to corruption or a failed
* visitor. Free state.zchild, which we just initialized, and return
* true to stop iteration for our parent context. */
zval_ptr_dtor(&state.zchild);
return true;
}
}
return false;
}
bool php_phongo_bson_visit_array(const bson_iter_t *iter ARG_UNUSED, const char *key, const bson_t *v_array, void *data)
{
#if PHP_VERSION_ID >= 70000
zval *retval = &((php_phongo_bson_state *)data)->zchild;
#else
zval *retval = ((php_phongo_bson_state *)data)->zchild;
#endif
bson_iter_t child;
TSRMLS_FETCH();
if (bson_iter_init(&child, v_array)) {
php_phongo_bson_state state = PHONGO_BSON_STATE_INITIALIZER;
state.map = ((php_phongo_bson_state *)data)->map;
/* Note that we are visiting an array, so element visitors know to use
* add_next_index() (i.e. disregard BSON keys) instead of add_assoc()
* when building the PHP array.
*/
state.is_visiting_array = true;
#if PHP_VERSION_ID >= 70000
array_init(&state.zchild);
#else
MAKE_STD_ZVAL(state.zchild);
array_init(state.zchild);
#endif
if (!bson_iter_visit_all(&child, &php_bson_visitors, &state) && !child.err_off) {
switch(state.map.array_type) {
case PHONGO_TYPEMAP_CLASS: {
#if PHP_VERSION_ID >= 70000
zval obj;
object_init_ex(&obj, state.map.array);
zend_call_method_with_1_params(&obj, NULL, NULL, BSON_UNSERIALIZE_FUNC_NAME, NULL, &state.zchild);
if (((php_phongo_bson_state *)data)->is_visiting_array) {
add_next_index_zval(retval, &obj);
} else {
ADD_ASSOC_ZVAL(retval, key, &obj);
}
zval_ptr_dtor(&state.zchild);
#else
zval *obj = NULL;
MAKE_STD_ZVAL(obj);
object_init_ex(obj, state.map.array);
zend_call_method_with_1_params(&obj, NULL, NULL, BSON_UNSERIALIZE_FUNC_NAME, NULL, state.zchild);
if (((php_phongo_bson_state *)data)->is_visiting_array) {
add_next_index_zval(retval, obj);
} else {
ADD_ASSOC_ZVAL(retval, key, obj);
}
zval_ptr_dtor(&state.zchild);
#endif
break;
}
case PHONGO_TYPEMAP_NATIVE_OBJECT:
#if PHP_VERSION_ID >= 70000
object_and_properties_init(&state.zchild, zend_standard_class_def, Z_ARRVAL(state.zchild));
if (((php_phongo_bson_state *)data)->is_visiting_array) {
add_next_index_zval(retval, &state.zchild);
} else {
ADD_ASSOC_ZVAL(retval, key, &state.zchild);
}
Z_SET_REFCOUNT(state.zchild, 1);
#else
object_and_properties_init(state.zchild, zend_standard_class_def, Z_ARRVAL_P(state.zchild));
if (((php_phongo_bson_state *)data)->is_visiting_array) {
add_next_index_zval(retval, state.zchild);
} else {
ADD_ASSOC_ZVAL(retval, key, state.zchild);
}
Z_SET_REFCOUNT_P(state.zchild, 1);
#endif
break;
case PHONGO_TYPEMAP_NATIVE_ARRAY:
default:
#if PHP_VERSION_ID >= 70000
if (((php_phongo_bson_state *)data)->is_visiting_array) {
add_next_index_zval(retval, &state.zchild);
} else {
ADD_ASSOC_ZVAL(retval, key, &state.zchild);
}
Z_SET_REFCOUNT(state.zchild, 1);
#else
if (((php_phongo_bson_state *)data)->is_visiting_array) {
add_next_index_zval(retval, state.zchild);
} else {
ADD_ASSOC_ZVAL(retval, key, state.zchild);
}
Z_SET_REFCOUNT_P(state.zchild, 1);
#endif
break;
}
} else {
/* Iteration stopped prematurely due to corruption or a failed
* visitor. Free state.zchild, which we just initialized, and return
* true to stop iteration for our parent context. */
zval_ptr_dtor(&state.zchild);
return true;
}
}
return false;
}
int php_phongo_is_array_or_document(zval *val TSRMLS_DC) /* {{{ */
{
HashTable *ht_data = HASH_OF(val);
int count;
if (Z_TYPE_P(val) != IS_ARRAY) {
return IS_OBJECT;
}
count = ht_data ? zend_hash_num_elements(ht_data) : 0;
if (count > 0) {
#if PHP_VERSION_ID >= 70000
zend_string *key;
zend_ulong index, idx;
idx = 0;
ZEND_HASH_FOREACH_KEY(ht_data, index, key) {
if (key) {
return IS_OBJECT;
} else {
if (index != idx) {
return IS_OBJECT;
}
}
idx++;
} ZEND_HASH_FOREACH_END();
#else
char *key;
unsigned int key_len;
unsigned long index = 0;
unsigned long idx = 0;
int hash_type = 0;
HashPosition pos;
zend_hash_internal_pointer_reset_ex(ht_data, &pos);
for (;; zend_hash_move_forward_ex(ht_data, &pos)) {
hash_type = zend_hash_get_current_key_ex(ht_data, &key, &key_len, &index, 0, &pos);
if (hash_type == HASH_KEY_NON_EXISTENT) {
break;
}
if (hash_type == HASH_KEY_IS_STRING) {
return IS_OBJECT;
} else {
if (index != idx) {
return IS_OBJECT;
}
}
idx++;
}
#endif
} else {
return Z_TYPE_P(val);
}
return IS_ARRAY;
}
/* }}} */
void object_to_bson(zval *object, php_phongo_bson_flags_t flags, const char *key, long key_len, bson_t *bson TSRMLS_DC)
{
bson_t child;
if (Z_TYPE_P(object) == IS_OBJECT && instanceof_function(Z_OBJCE_P(object), php_phongo_type_ce TSRMLS_CC)) {
if (instanceof_function(Z_OBJCE_P(object), php_phongo_serializable_ce TSRMLS_CC)) {
#if PHP_VERSION_ID >= 70000
zval obj_data;
#else
zval *obj_data = NULL;
#endif
bson_t child;
HashTable *tmp_ht;
#if PHP_VERSION_ID >= 70000
zend_call_method_with_0_params(object, NULL, NULL, BSON_SERIALIZE_FUNC_NAME, &obj_data);
#else
zend_call_method_with_0_params(&object, NULL, NULL, BSON_SERIALIZE_FUNC_NAME, &obj_data);
#endif
if (Z_ISUNDEF(obj_data)) {
/* zend_call_method() failed */
return;
}
#if PHP_VERSION_ID >= 70000
if (Z_TYPE(obj_data) != IS_ARRAY && !(Z_TYPE(obj_data) == IS_OBJECT && instanceof_function(Z_OBJCE(obj_data), zend_standard_class_def TSRMLS_CC))) {
phongo_throw_exception(PHONGO_ERROR_UNEXPECTED_VALUE TSRMLS_CC,
"Expected %s::%s() to return an array or stdClass, %s given",
Z_OBJCE_P(object)->name->val,
BSON_SERIALIZE_FUNC_NAME,
(Z_TYPE(obj_data) == IS_OBJECT
? Z_OBJCE(obj_data)->name->val
: zend_get_type_by_const(Z_TYPE(obj_data))
)
);
zval_ptr_dtor(&obj_data);
#else
if (Z_TYPE_P(obj_data) != IS_ARRAY && !(Z_TYPE_P(obj_data) == IS_OBJECT && instanceof_function(Z_OBJCE_P(obj_data), zend_standard_class_def TSRMLS_CC))) {
phongo_throw_exception(PHONGO_ERROR_UNEXPECTED_VALUE TSRMLS_CC,
"Expected %s::%s() to return an array or stdClass, %s given",
Z_OBJCE_P(object)->name,
BSON_SERIALIZE_FUNC_NAME,
(Z_TYPE_P(obj_data) == IS_OBJECT
? Z_OBJCE_P(obj_data)->name
: zend_get_type_by_const(Z_TYPE_P(obj_data))
)
);
zval_ptr_dtor(&obj_data);
#endif
return;
}
#if PHP_VERSION_ID >= 70000
tmp_ht = HASH_OF(&obj_data);
#else
tmp_ht = HASH_OF(obj_data);
#endif
if (tmp_ht && ZEND_HASH_APPLY_PROTECTION(tmp_ht)) {
ZEND_HASH_INC_APPLY_COUNT(tmp_ht);
}
/* Persistable objects must always be serialized as BSON documents;
* otherwise, infer based on bsonSerialize()'s return value. */
#if PHP_VERSION_ID >= 70000
if (instanceof_function(Z_OBJCE_P(object), php_phongo_persistable_ce TSRMLS_CC) || php_phongo_is_array_or_document(&obj_data TSRMLS_CC) == IS_OBJECT) {
#else
if (instanceof_function(Z_OBJCE_P(object), php_phongo_persistable_ce TSRMLS_CC) || php_phongo_is_array_or_document(obj_data TSRMLS_CC) == IS_OBJECT) {
#endif
bson_append_document_begin(bson, key, key_len, &child);
if (instanceof_function(Z_OBJCE_P(object), php_phongo_persistable_ce TSRMLS_CC)) {
#if PHP_VERSION_ID >= 70000
bson_append_binary(&child, PHONGO_ODM_FIELD_NAME, -1, 0x80, (const uint8_t *)Z_OBJCE_P(object)->name->val, Z_OBJCE_P(object)->name->len);
#else
bson_append_binary(&child, PHONGO_ODM_FIELD_NAME, -1, 0x80, (const uint8_t *)Z_OBJCE_P(object)->name, strlen(Z_OBJCE_P(object)->name));
#endif
}
#if PHP_VERSION_ID >= 70000
phongo_zval_to_bson(&obj_data, flags, &child, NULL TSRMLS_CC);
#else
phongo_zval_to_bson(obj_data, flags, &child, NULL TSRMLS_CC);
#endif
bson_append_document_end(bson, &child);
} else {
bson_append_array_begin(bson, key, key_len, &child);
#if PHP_VERSION_ID >= 70000
phongo_zval_to_bson(&obj_data, flags, &child, NULL TSRMLS_CC);
#else
phongo_zval_to_bson(obj_data, flags, &child, NULL TSRMLS_CC);
#endif
bson_append_array_end(bson, &child);
}
if (tmp_ht && ZEND_HASH_APPLY_PROTECTION(tmp_ht)) {
ZEND_HASH_DEC_APPLY_COUNT(tmp_ht);
}
zval_ptr_dtor(&obj_data);
return;
}
if (instanceof_function(Z_OBJCE_P(object), php_phongo_objectid_ce TSRMLS_CC)) {
bson_oid_t oid;
mongoc_log(MONGOC_LOG_LEVEL_TRACE, MONGOC_LOG_DOMAIN, "encoding ObjectId");
php_phongo_objectid_get_id(object, &oid TSRMLS_CC);
bson_append_oid(bson, key, key_len, &oid);
return;
}
if (instanceof_function(Z_OBJCE_P(object), php_phongo_utcdatetime_ce TSRMLS_CC)) {
mongoc_log(MONGOC_LOG_LEVEL_TRACE, MONGOC_LOG_DOMAIN, "encoding UTCDateTime");
bson_append_date_time(bson, key, key_len, php_phongo_utcdatetime_get_milliseconds(object TSRMLS_CC));
return;
}
if (instanceof_function(Z_OBJCE_P(object), php_phongo_binary_ce TSRMLS_CC)) {
const unsigned char *data;
size_t data_len;
data_len = php_phongo_binary_get_data(object, (char **)&data TSRMLS_CC);
mongoc_log(MONGOC_LOG_LEVEL_TRACE, MONGOC_LOG_DOMAIN, "encoding Binary");
bson_append_binary(bson, key, key_len, php_phongo_binary_get_type(object TSRMLS_CC), data, data_len);
return;
}
if (instanceof_function(Z_OBJCE_P(object), php_phongo_decimal128_ce TSRMLS_CC)) {
mongoc_log(MONGOC_LOG_LEVEL_TRACE, MONGOC_LOG_DOMAIN, "encoding Decimal128");
bson_append_decimal128(bson, key, key_len, php_phongo_decimal128_get_decimal128(object TSRMLS_CC));
return;
}
if (instanceof_function(Z_OBJCE_P(object), php_phongo_regex_ce TSRMLS_CC)) {
mongoc_log(MONGOC_LOG_LEVEL_TRACE, MONGOC_LOG_DOMAIN, "encoding Regex");
bson_append_regex(bson, key, key_len, php_phongo_regex_get_pattern(object TSRMLS_CC), php_phongo_regex_get_flags(object TSRMLS_CC));
return;
}
if (instanceof_function(Z_OBJCE_P(object), php_phongo_javascript_ce TSRMLS_CC)) {
if (php_phongo_javascript_has_scope(object TSRMLS_CC)) {
mongoc_log(MONGOC_LOG_LEVEL_TRACE, MONGOC_LOG_DOMAIN, "encoding Javascript with scope");
bson_append_code_with_scope(bson, key, key_len, php_phongo_javascript_get_code(object TSRMLS_CC), php_phongo_javascript_get_scope(object TSRMLS_CC));
} else {
mongoc_log(MONGOC_LOG_LEVEL_TRACE, MONGOC_LOG_DOMAIN, "encoding Javascript without scope");
bson_append_code(bson, key, key_len, php_phongo_javascript_get_code(object TSRMLS_CC));
}
return;
}
if (instanceof_function(Z_OBJCE_P(object), php_phongo_timestamp_ce TSRMLS_CC)) {
mongoc_log(MONGOC_LOG_LEVEL_TRACE, MONGOC_LOG_DOMAIN, "encoding Timestamp");
/*
* WHOOPS! libbson swaps the increment/timestamp compared to BSON
*
* "Timestamp - Special internal type used by MongoDB replication and sharding.
* First 4 bytes are an increment, second 4 are a timestamp."
*/
bson_append_timestamp(bson, key, key_len, php_phongo_timestamp_get_timestamp(object TSRMLS_CC), php_phongo_timestamp_get_increment(object TSRMLS_CC));
return;
}
if (instanceof_function(Z_OBJCE_P(object), php_phongo_maxkey_ce TSRMLS_CC)) {
mongoc_log(MONGOC_LOG_LEVEL_TRACE, MONGOC_LOG_DOMAIN, "encoding MaxKey");
bson_append_maxkey(bson, key, key_len);
return;
}
if (instanceof_function(Z_OBJCE_P(object), php_phongo_minkey_ce TSRMLS_CC)) {
mongoc_log(MONGOC_LOG_LEVEL_TRACE, MONGOC_LOG_DOMAIN, "encoding MinKey");
bson_append_minkey(bson, key, key_len);
return;
}
phongo_throw_exception(PHONGO_ERROR_UNEXPECTED_VALUE TSRMLS_CC, "Unexpected %s instance: %s", ZSTR_VAL(php_phongo_type_ce->name), ZSTR_VAL(Z_OBJCE_P(object)->name));
return;
} else {
HashTable *tmp_ht = HASH_OF(object);
if (tmp_ht && ZEND_HASH_APPLY_PROTECTION(tmp_ht)) {
ZEND_HASH_INC_APPLY_COUNT(tmp_ht);
}
mongoc_log(MONGOC_LOG_LEVEL_TRACE, MONGOC_LOG_DOMAIN, "encoding document");
bson_append_document_begin(bson, key, key_len, &child);
phongo_zval_to_bson(object, flags, &child, NULL TSRMLS_CC);
bson_append_document_end(bson, &child);
if (tmp_ht && ZEND_HASH_APPLY_PROTECTION(tmp_ht)) {
ZEND_HASH_DEC_APPLY_COUNT(tmp_ht);
}
}
}
static void phongo_bson_append(bson_t *bson, php_phongo_bson_flags_t flags, const char *key, long key_len, zval *entry TSRMLS_DC)
{
#if PHP_VERSION_ID >= 70000
try_again:
#endif
switch (Z_TYPE_P(entry))
{
case IS_NULL:
bson_append_null(bson, key, key_len);
break;
#if PHP_VERSION_ID >= 70000
case IS_TRUE:
bson_append_bool(bson, key, key_len, true);
break;
case IS_FALSE:
bson_append_bool(bson, key, key_len, false);
break;
#else
case IS_BOOL:
bson_append_bool(bson, key, key_len, Z_BVAL_P(entry));
break;
#endif
case IS_LONG:
BSON_APPEND_INT(bson, key, key_len, Z_LVAL_P(entry));
break;
case IS_DOUBLE:
bson_append_double(bson, key, key_len, Z_DVAL_P(entry));
break;
case IS_STRING:
if (bson_utf8_validate(Z_STRVAL_P(entry), Z_STRLEN_P(entry), true)) {
bson_append_utf8(bson, key, key_len, Z_STRVAL_P(entry), Z_STRLEN_P(entry));
} else {
phongo_throw_exception(PHONGO_ERROR_UNEXPECTED_VALUE TSRMLS_CC, "Got invalid UTF-8 value serializing '%s'", Z_STRVAL_P(entry));
}
break;
case IS_ARRAY:
if (php_phongo_is_array_or_document(entry TSRMLS_CC) == IS_ARRAY) {
bson_t child;
HashTable *tmp_ht = HASH_OF(entry);
if (tmp_ht && ZEND_HASH_APPLY_PROTECTION(tmp_ht)) {
ZEND_HASH_INC_APPLY_COUNT(tmp_ht);
}
bson_append_array_begin(bson, key, key_len, &child);
phongo_zval_to_bson(entry, flags, &child, NULL TSRMLS_CC);
bson_append_array_end(bson, &child);
if (tmp_ht && ZEND_HASH_APPLY_PROTECTION(tmp_ht)) {
ZEND_HASH_DEC_APPLY_COUNT(tmp_ht);
}
break;
}
/* break intentionally omitted */
case IS_OBJECT:
object_to_bson(entry, flags, key, key_len, bson TSRMLS_CC);
break;
#if PHP_VERSION_ID >= 70000
case IS_INDIRECT:
phongo_bson_append(bson, flags, key, key_len, Z_INDIRECT_P(entry) TSRMLS_DC);
break;
case IS_REFERENCE:
ZVAL_DEREF(entry);
goto try_again;
#endif
default:
phongo_throw_exception(PHONGO_ERROR_UNEXPECTED_VALUE TSRMLS_CC, "Got unsupported type %d '%s'", Z_TYPE_P(entry), zend_get_type_by_const(Z_TYPE_P(entry)));
}
}
void phongo_zval_to_bson(zval *data, php_phongo_bson_flags_t flags, bson_t *bson, bson_t **bson_out TSRMLS_DC) /* {{{ */
{
HashTable *ht_data = NULL;
#if PHP_VERSION_ID >= 70000
zval obj_data;
#else
HashPosition pos;
zval *obj_data = NULL;
#endif
/* If we will be encoding a class that may contain protected and private
* properties, we'll need to filter them out later. */
bool ht_data_from_properties = false;
switch(Z_TYPE_P(data)) {
case IS_OBJECT:
if (instanceof_function(Z_OBJCE_P(data), php_phongo_serializable_ce TSRMLS_CC)) {
#if PHP_VERSION_ID >= 70000
zend_call_method_with_0_params(data, NULL, NULL, BSON_SERIALIZE_FUNC_NAME, &obj_data);
#else
zend_call_method_with_0_params(&data, NULL, NULL, BSON_SERIALIZE_FUNC_NAME, &obj_data);
#endif
if (Z_ISUNDEF(obj_data)) {
/* zend_call_method() failed */
break;
}
#if PHP_VERSION_ID >= 70000
if (Z_TYPE(obj_data) != IS_ARRAY && !(Z_TYPE(obj_data) == IS_OBJECT && instanceof_function(Z_OBJCE(obj_data), zend_standard_class_def TSRMLS_CC))) {
#else
if (Z_TYPE_P(obj_data) != IS_ARRAY && !(Z_TYPE_P(obj_data) == IS_OBJECT && instanceof_function(Z_OBJCE_P(obj_data), zend_standard_class_def TSRMLS_CC))) {
#endif
phongo_throw_exception(PHONGO_ERROR_UNEXPECTED_VALUE TSRMLS_CC,
"Expected %s::%s() to return an array or stdClass, %s given",
#if PHP_VERSION_ID >= 70000
Z_OBJCE_P(data)->name->val,
#else
Z_OBJCE_P(data)->name,
#endif
BSON_SERIALIZE_FUNC_NAME,
#if PHP_VERSION_ID >= 70000
(Z_TYPE(obj_data) == IS_OBJECT
? Z_OBJCE(obj_data)->name->val
: zend_get_type_by_const(Z_TYPE(obj_data))
#else
(Z_TYPE_P(obj_data) == IS_OBJECT
? Z_OBJCE_P(obj_data)->name
: zend_get_type_by_const(Z_TYPE_P(obj_data))
#endif
)
);
break;
}
#if PHP_VERSION_ID >= 70000
ht_data = HASH_OF(&obj_data);
#else
ht_data = HASH_OF(obj_data);
#endif
if (instanceof_function(Z_OBJCE_P(data), php_phongo_persistable_ce TSRMLS_CC)) {
#if PHP_VERSION_ID >= 70000
bson_append_binary(bson, PHONGO_ODM_FIELD_NAME, -1, 0x80, (const uint8_t *)Z_OBJCE_P(data)->name->val, Z_OBJCE_P(data)->name->len);
zend_hash_str_del(ht_data, PHONGO_ODM_FIELD_NAME, sizeof(PHONGO_ODM_FIELD_NAME)-1);
#else
bson_append_binary(bson, PHONGO_ODM_FIELD_NAME, -1, 0x80, (const uint8_t *)Z_OBJCE_P(data)->name, strlen(Z_OBJCE_P(data)->name));
zend_hash_del(ht_data, PHONGO_ODM_FIELD_NAME, sizeof(PHONGO_ODM_FIELD_NAME));
#endif
}
break;
}
if (instanceof_function(Z_OBJCE_P(data), php_phongo_type_ce TSRMLS_CC)) {
phongo_throw_exception(PHONGO_ERROR_UNEXPECTED_VALUE TSRMLS_CC, "%s instance %s cannot be serialized as a root element", ZSTR_VAL(php_phongo_type_ce->name), ZSTR_VAL(Z_OBJCE_P(data)->name));
break;
}
ht_data = Z_OBJ_HT_P(data)->get_properties(data TSRMLS_CC);
ht_data_from_properties = true;
break;
case IS_ARRAY:
ht_data = HASH_OF(data);
break;
default:
return;
}
if (!ht_data || ZEND_HASH_GET_APPLY_COUNT(ht_data) > 1) {
#if PHP_VERSION_ID >= 70000
if (Z_TYPE_P(data) == IS_OBJECT && instanceof_function(Z_OBJCE_P(data), php_phongo_serializable_ce TSRMLS_CC)) {
#endif
if (!Z_ISUNDEF(obj_data)) {
zval_ptr_dtor(&obj_data);
}
#if PHP_VERSION_ID >= 70000
}
#endif
return;
}
#if PHP_VERSION_ID >= 70000
{
zend_string *string_key = NULL;
zend_ulong num_key = 0;
zval *value;
ZEND_HASH_FOREACH_KEY_VAL(ht_data, num_key, string_key, value) {
if (string_key) {
if (ht_data_from_properties) {
/* Skip protected and private properties */
if (ZSTR_VAL(string_key)[0] == '\0' && ZSTR_LEN(string_key) > 0) {
- zend_string_release(string_key);
continue;
}
}
if (strlen(ZSTR_VAL(string_key)) != ZSTR_LEN(string_key)) {
phongo_throw_exception(PHONGO_ERROR_UNEXPECTED_VALUE TSRMLS_CC, "BSON keys cannot contain null bytes. Unexpected null byte after \"%s\".", ZSTR_VAL(string_key));
return;
}
if (flags & PHONGO_BSON_ADD_ID) {
if (!strcmp(ZSTR_VAL(string_key), "_id")) {
flags &= ~PHONGO_BSON_ADD_ID;
}
}
}
/* Ensure we're working with a string key */
if (!string_key) {
string_key = zend_long_to_str(num_key);
} else {
zend_string_addref(string_key);
}
phongo_bson_append(bson, flags & ~PHONGO_BSON_ADD_ID, ZSTR_VAL(string_key), strlen(ZSTR_VAL(string_key)), value TSRMLS_CC);
zend_string_release(string_key);
} ZEND_HASH_FOREACH_END();
}
#else
zend_hash_internal_pointer_reset_ex(ht_data, &pos);
for (;; zend_hash_move_forward_ex(ht_data, &pos)) {
char *string_key = NULL;
uint string_key_len = 0;
ulong num_key = 0;
zval **value;
int hash_type;
hash_type = zend_hash_get_current_key_ex(ht_data, &string_key, &string_key_len, &num_key, 0, &pos);
if (hash_type == HASH_KEY_NON_EXISTENT) {
break;
}
if (zend_hash_get_current_data_ex(ht_data, (void **) &value, &pos) == FAILURE) {
break;
}
if (hash_type == HASH_KEY_IS_STRING) {
if (ht_data_from_properties) {
/* Skip protected and private properties */
if (string_key[0] == '\0' && string_key_len > 1) {
continue;
}
}
if (strlen(string_key) != string_key_len - 1) {
phongo_throw_exception(PHONGO_ERROR_UNEXPECTED_VALUE TSRMLS_CC, "BSON keys cannot contain null bytes. Unexpected null byte after \"%s\".", ZSTR_VAL(string_key));
return;
}
if (flags & PHONGO_BSON_ADD_ID) {
if (!strcmp(string_key, "_id")) {
flags &= ~PHONGO_BSON_ADD_ID;
}
}
}
/* Ensure we're working with a string key */
if (hash_type == HASH_KEY_IS_LONG) {
spprintf(&string_key, 0, "%ld", num_key);
}
phongo_bson_append(bson, flags & ~PHONGO_BSON_ADD_ID, string_key, strlen(string_key), *value TSRMLS_CC);
if (hash_type == HASH_KEY_IS_LONG) {
efree(string_key);
}
}
#endif
if (flags & PHONGO_BSON_ADD_ID) {
bson_oid_t oid;
bson_oid_init(&oid, NULL);
bson_append_oid(bson, "_id", strlen("_id"), &oid);
mongoc_log(MONGOC_LOG_LEVEL_TRACE, MONGOC_LOG_DOMAIN, "Added new _id");
if (flags & PHONGO_BSON_RETURN_ID) {
if (bson_out) {
*bson_out = bson_new();
bson_append_oid(*bson_out, "_id", strlen("_id"), &oid);
}
}
}
#if PHP_VERSION_ID >= 70000
if (Z_TYPE_P(data) == IS_OBJECT && instanceof_function(Z_OBJCE_P(data), php_phongo_serializable_ce TSRMLS_CC)) {
#endif
if (!Z_ISUNDEF(obj_data)) {
zval_ptr_dtor(&obj_data);
}
#if PHP_VERSION_ID >= 70000
}
#endif
}
/* }}} */
#if PHP_VERSION_ID >= 70000
int phongo_bson_to_zval(const unsigned char *data, int data_len, zval *zv)
#else
int phongo_bson_to_zval(const unsigned char *data, int data_len, zval **zv)
#endif
{
int retval = 0;
php_phongo_bson_state state = PHONGO_BSON_STATE_INITIALIZER;
retval = phongo_bson_to_zval_ex(data, data_len, &state);
#if PHP_VERSION_ID >= 70000
ZVAL_ZVAL(zv, &state.zchild, 1, 1);
#else
*zv = state.zchild;
#endif
return retval;
}
int phongo_bson_to_zval_ex(const unsigned char *data, int data_len, php_phongo_bson_state *state)
{
bson_reader_t *reader;
bson_iter_t iter;
const bson_t *b;
bool eof = false;
TSRMLS_FETCH();
#if PHP_VERSION_ID < 70000
MAKE_STD_ZVAL(state->zchild);
/* Ensure that state->zchild has a type, since the calling code may want to
* zval_ptr_dtor() it if we throw an exception. */
ZVAL_NULL(state->zchild);
#endif
reader = bson_reader_new_from_data(data, data_len);
if (!(b = bson_reader_read(reader, NULL))) {
phongo_throw_exception(PHONGO_ERROR_UNEXPECTED_VALUE TSRMLS_CC, "Could not read document from BSON reader");
bson_reader_destroy(reader);
return 0;
}
if (!bson_iter_init(&iter, b)) {
phongo_throw_exception(PHONGO_ERROR_UNEXPECTED_VALUE TSRMLS_CC, "Could not initialize BSON iterator");
bson_reader_destroy(reader);
return 0;
}
/* We initialize an array because it will either be returned as-is (native
* array in type map), passed to bsonUnserialize() (ODM class), or used to
* initialize a stdClass object (native object in type map). */
#if PHP_VERSION_ID >= 70000
array_init(&state->zchild);
#else
array_init(state->zchild);
#endif
if (bson_iter_visit_all(&iter, &php_bson_visitors, state) || iter.err_off) {
/* Iteration stopped prematurely due to corruption or a failed visitor.
* While we free the reader, state->zchild should be left as-is, since
* the calling code may want to zval_ptr_dtor() it. If an exception has
* been thrown already (due to an unsupported BSON type for example,
* don't overwrite with a generic exception message. */
if (!EG(exception)) {
phongo_throw_exception(PHONGO_ERROR_UNEXPECTED_VALUE TSRMLS_CC, "Detected corrupt BSON data");
}
bson_reader_destroy(reader);
return 0;
}
/* If php_phongo_bson_visit_binary() finds an ODM class, it should supersede
* a default type map and named root class. */
if (state->odm && state->map.root_type == PHONGO_TYPEMAP_NONE) {
state->map.root_type = PHONGO_TYPEMAP_CLASS;
}
switch (state->map.root_type) {
case PHONGO_TYPEMAP_NATIVE_ARRAY:
/* Nothing to do here */
break;
case PHONGO_TYPEMAP_CLASS: {
#if PHP_VERSION_ID >= 70000
zval obj;
object_init_ex(&obj, state->odm ? state->odm : state->map.root);
zend_call_method_with_1_params(&obj, NULL, NULL, BSON_UNSERIALIZE_FUNC_NAME, NULL, &state->zchild);
zval_ptr_dtor(&state->zchild);
ZVAL_COPY_VALUE(&state->zchild, &obj);
#else
zval *obj = NULL;
MAKE_STD_ZVAL(obj);
object_init_ex(obj, state->odm ? state->odm : state->map.root);
zend_call_method_with_1_params(&obj, NULL, NULL, BSON_UNSERIALIZE_FUNC_NAME, NULL, state->zchild);
zval_ptr_dtor(&state->zchild);
state->zchild = obj;
#endif
break;
}
case PHONGO_TYPEMAP_NATIVE_OBJECT:
default:
#if PHP_VERSION_ID >= 70000
object_and_properties_init(&state->zchild, zend_standard_class_def, Z_ARRVAL(state->zchild));
#else
object_and_properties_init(state->zchild, zend_standard_class_def, Z_ARRVAL_P(state->zchild));
#endif
}
if (bson_reader_read(reader, &eof) || !eof) {
phongo_throw_exception(PHONGO_ERROR_UNEXPECTED_VALUE TSRMLS_CC, "Reading document did not exhaust input buffer");
bson_reader_destroy(reader);
return 0;
}
bson_reader_destroy(reader);
return 1;
}
/* {{{ proto string BSON\fromPHP(array|object $value)
Returns the BSON representation of a PHP value */
PHP_FUNCTION(fromPHP)
{
zval *data;
bson_t *bson;
SUPPRESS_UNUSED_WARNING(return_value_ptr) SUPPRESS_UNUSED_WARNING(this_ptr) SUPPRESS_UNUSED_WARNING(return_value_used) /* We don't use these */
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "A", &data) == FAILURE) {
return;
}
bson = bson_new();
phongo_zval_to_bson(data, PHONGO_BSON_NONE, bson, NULL TSRMLS_CC);
PHONGO_RETVAL_STRINGL((const char *) bson_get_data(bson), bson->len);
bson_destroy(bson);
}
/* }}} */
static void apply_classname_to_state(const char *classname, int classname_len, php_phongo_bson_typemap_types *type, zend_class_entry **type_ce TSRMLS_DC)
{
if (!strcasecmp(classname, "array")) {
*type = PHONGO_TYPEMAP_NATIVE_ARRAY;
*type_ce = NULL;
} else if (!strcasecmp(classname, "stdclass") || !strcasecmp(classname, "object")) {
*type = PHONGO_TYPEMAP_NATIVE_OBJECT;
*type_ce = NULL;
} else {
#if PHP_VERSION_ID >= 70000
zend_string* zs_classname = zend_string_init(classname, classname_len, 0);
zend_class_entry *found_ce = zend_fetch_class(zs_classname, ZEND_FETCH_CLASS_AUTO|ZEND_FETCH_CLASS_SILENT TSRMLS_CC);
- zend_string_free(zs_classname);
+ zend_string_release(zs_classname);
#else
zend_class_entry *found_ce = zend_fetch_class(classname, classname_len, ZEND_FETCH_CLASS_AUTO|ZEND_FETCH_CLASS_SILENT TSRMLS_CC);
#endif
if (!found_ce) {
phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT TSRMLS_CC, "Class %s does not exist", classname);
} else if (!PHONGO_IS_CLASS_INSTANTIATABLE(found_ce)) {
phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT TSRMLS_CC, "Class %s is not instantiatable", classname);
} else if (!instanceof_function(found_ce, php_phongo_unserializable_ce TSRMLS_CC)) {
phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT TSRMLS_CC, "Class %s does not implement %s", classname, ZSTR_VAL(php_phongo_unserializable_ce->name));
} else {
*type = PHONGO_TYPEMAP_CLASS;
*type_ce = found_ce;
}
}
}
void phongo_bson_typemap_to_state(zval *typemap, php_phongo_bson_typemap *map TSRMLS_DC)
{
if (typemap) {
char *classname;
int classname_len;
zend_bool classname_free = 0;
classname = php_array_fetchc_string(typemap, "array", &classname_len, &classname_free);
if (classname_len) {
apply_classname_to_state(classname, classname_len, &map->array_type, &map->array TSRMLS_CC);
}
if (classname_free) {
str_efree(classname);
}
classname = php_array_fetchc_string(typemap, "document", &classname_len, &classname_free);
if (classname_len) {
apply_classname_to_state(classname, classname_len, &map->document_type, &map->document TSRMLS_CC);
}
if (classname_free) {
str_efree(classname);
}
classname = php_array_fetchc_string(typemap, "root", &classname_len, &classname_free);
if (classname_len) {
apply_classname_to_state(classname, classname_len, &map->root_type, &map->root TSRMLS_CC);
}
if (classname_free) {
str_efree(classname);
}
}
}
/* {{{ proto array|object BSON\toPHP(string $bson [, array $typemap = array()])
Returns the PHP representation of a BSON value, optionally converting it into a custom class */
PHP_FUNCTION(toPHP)
{
char *data;
phongo_zpp_char_len data_len;
zval *typemap = NULL;
php_phongo_bson_state state = PHONGO_BSON_STATE_INITIALIZER;
SUPPRESS_UNUSED_WARNING(return_value_ptr) SUPPRESS_UNUSED_WARNING(this_ptr) SUPPRESS_UNUSED_WARNING(return_value_used) /* We don't use these */
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|a!", &data, &data_len, &typemap) == FAILURE) {
return;
}
phongo_bson_typemap_to_state(typemap, &state.map TSRMLS_CC);
if (!phongo_bson_to_zval_ex((const unsigned char *)data, data_len, &state)) {
zval_ptr_dtor(&state.zchild);
RETURN_NULL();
}
#if PHP_VERSION_ID >= 70000
RETURN_ZVAL(&state.zchild, 0, 1);
#else
RETURN_ZVAL(state.zchild, 0, 1);
#endif
}
/* }}} */
/* {{{ proto string BSON\toJSON(string $bson)
Returns the JSON representation of a BSON value */
PHP_FUNCTION(toJSON)
{
char *data;
phongo_zpp_char_len data_len;
const bson_t *b;
bool eof = false;
bson_reader_t *reader;
SUPPRESS_UNUSED_WARNING(return_value_ptr) SUPPRESS_UNUSED_WARNING(this_ptr) SUPPRESS_UNUSED_WARNING(return_value_used) /* We don't use these */
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &data, &data_len) == FAILURE) {
return;
}
reader = bson_reader_new_from_data((const unsigned char *)data, data_len);
b = bson_reader_read(reader, NULL);
if (b) {
char *str;
size_t str_len;
str = bson_as_json(b, &str_len);
if (!str) {
phongo_throw_exception(PHONGO_ERROR_UNEXPECTED_VALUE TSRMLS_CC, "Could not convert BSON document to a JSON string");
bson_reader_destroy(reader);
return;
}
PHONGO_RETVAL_STRINGL(str, str_len);
bson_free(str);
} else {
phongo_throw_exception(PHONGO_ERROR_UNEXPECTED_VALUE TSRMLS_CC, "Could not read document from BSON reader");
bson_reader_destroy(reader);
return;
}
if (bson_reader_read(reader, &eof) || !eof) {
phongo_throw_exception(PHONGO_ERROR_UNEXPECTED_VALUE TSRMLS_CC, "Reading document did not exhaust input buffer");
}
bson_reader_destroy(reader);
}
/* }}} */
/* {{{ proto string BSON\fromJSON(string $json)
Returns the BSON representation of a JSON value */
PHP_FUNCTION(fromJSON)
{
char *data;
phongo_zpp_char_len data_len;
bson_t b = BSON_INITIALIZER;
bson_error_t error;
SUPPRESS_UNUSED_WARNING(return_value_ptr) SUPPRESS_UNUSED_WARNING(this_ptr) SUPPRESS_UNUSED_WARNING(return_value_used) /* We don't use these */
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &data, &data_len) == FAILURE) {
return;
}
if (bson_init_from_json(&b, (const char *)data, data_len, &error)) {
PHONGO_RETVAL_STRINGL((const char *) bson_get_data(&b), b.len);
bson_destroy(&b);
} else {
phongo_throw_exception(PHONGO_ERROR_UNEXPECTED_VALUE TSRMLS_CC, "%s", error.domain == BSON_ERROR_JSON ? error.message : "Error parsing JSON");
}
}
/* }}} */
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* End:
* vim600: noet sw=4 ts=4 fdm=marker
* vim<600: noet sw=4 ts=4
*/
diff --git a/mongodb-1.2.3/src/contrib/php_array_api.h b/mongodb-1.2.8/src/contrib/php_array_api.h
similarity index 100%
rename from mongodb-1.2.3/src/contrib/php_array_api.h
rename to mongodb-1.2.8/src/contrib/php_array_api.h
diff --git a/mongodb-1.2.8/src/libbson/VERSION_CURRENT b/mongodb-1.2.8/src/libbson/VERSION_CURRENT
new file mode 100644
index 00000000..5ebba4f0
--- /dev/null
+++ b/mongodb-1.2.8/src/libbson/VERSION_CURRENT
@@ -0,0 +1 @@
+1.5.5
\ No newline at end of file
diff --git a/mongodb-1.2.8/src/libbson/VERSION_RELEASED b/mongodb-1.2.8/src/libbson/VERSION_RELEASED
new file mode 100644
index 00000000..5ebba4f0
--- /dev/null
+++ b/mongodb-1.2.8/src/libbson/VERSION_RELEASED
@@ -0,0 +1 @@
+1.5.5
\ No newline at end of file
diff --git a/mongodb-1.2.3/src/libbson/build/autotools/CheckAtomics.m4 b/mongodb-1.2.8/src/libbson/build/autotools/CheckAtomics.m4
similarity index 100%
rename from mongodb-1.2.3/src/libbson/build/autotools/CheckAtomics.m4
rename to mongodb-1.2.8/src/libbson/build/autotools/CheckAtomics.m4
diff --git a/mongodb-1.2.3/src/libbson/build/autotools/CheckCompiler.m4 b/mongodb-1.2.8/src/libbson/build/autotools/CheckCompiler.m4
similarity index 100%
rename from mongodb-1.2.3/src/libbson/build/autotools/CheckCompiler.m4
rename to mongodb-1.2.8/src/libbson/build/autotools/CheckCompiler.m4
diff --git a/mongodb-1.2.3/src/libbson/build/autotools/CheckHeaders.m4 b/mongodb-1.2.8/src/libbson/build/autotools/CheckHeaders.m4
similarity index 100%
rename from mongodb-1.2.3/src/libbson/build/autotools/CheckHeaders.m4
rename to mongodb-1.2.8/src/libbson/build/autotools/CheckHeaders.m4
diff --git a/mongodb-1.2.3/src/libbson/build/autotools/CheckHost.m4 b/mongodb-1.2.8/src/libbson/build/autotools/CheckHost.m4
similarity index 100%
rename from mongodb-1.2.3/src/libbson/build/autotools/CheckHost.m4
rename to mongodb-1.2.8/src/libbson/build/autotools/CheckHost.m4
diff --git a/mongodb-1.2.3/src/libbson/build/autotools/CheckProgs.m4 b/mongodb-1.2.8/src/libbson/build/autotools/CheckProgs.m4
similarity index 100%
rename from mongodb-1.2.3/src/libbson/build/autotools/CheckProgs.m4
rename to mongodb-1.2.8/src/libbson/build/autotools/CheckProgs.m4
diff --git a/mongodb-1.2.3/src/libbson/build/autotools/CheckTarget.m4 b/mongodb-1.2.8/src/libbson/build/autotools/CheckTarget.m4
similarity index 100%
rename from mongodb-1.2.3/src/libbson/build/autotools/CheckTarget.m4
rename to mongodb-1.2.8/src/libbson/build/autotools/CheckTarget.m4
diff --git a/mongodb-1.2.3/src/libbson/build/autotools/Coverage.m4 b/mongodb-1.2.8/src/libbson/build/autotools/Coverage.m4
similarity index 100%
rename from mongodb-1.2.3/src/libbson/build/autotools/Coverage.m4
rename to mongodb-1.2.8/src/libbson/build/autotools/Coverage.m4
diff --git a/mongodb-1.2.3/src/libbson/build/autotools/Endian.m4 b/mongodb-1.2.8/src/libbson/build/autotools/Endian.m4
similarity index 100%
rename from mongodb-1.2.3/src/libbson/build/autotools/Endian.m4
rename to mongodb-1.2.8/src/libbson/build/autotools/Endian.m4
diff --git a/mongodb-1.2.3/src/libbson/build/autotools/FindDependencies.m4 b/mongodb-1.2.8/src/libbson/build/autotools/FindDependencies.m4
similarity index 100%
rename from mongodb-1.2.3/src/libbson/build/autotools/FindDependencies.m4
rename to mongodb-1.2.8/src/libbson/build/autotools/FindDependencies.m4
diff --git a/mongodb-1.2.3/src/libbson/build/autotools/MaintainerFlags.m4 b/mongodb-1.2.8/src/libbson/build/autotools/MaintainerFlags.m4
similarity index 100%
rename from mongodb-1.2.3/src/libbson/build/autotools/MaintainerFlags.m4
rename to mongodb-1.2.8/src/libbson/build/autotools/MaintainerFlags.m4
diff --git a/mongodb-1.2.3/src/libbson/build/autotools/Optimizations.m4 b/mongodb-1.2.8/src/libbson/build/autotools/Optimizations.m4
similarity index 100%
rename from mongodb-1.2.3/src/libbson/build/autotools/Optimizations.m4
rename to mongodb-1.2.8/src/libbson/build/autotools/Optimizations.m4
diff --git a/mongodb-1.2.3/src/libbson/build/autotools/PrintBuildConfiguration.m4 b/mongodb-1.2.8/src/libbson/build/autotools/PrintBuildConfiguration.m4
similarity index 100%
rename from mongodb-1.2.3/src/libbson/build/autotools/PrintBuildConfiguration.m4
rename to mongodb-1.2.8/src/libbson/build/autotools/PrintBuildConfiguration.m4
diff --git a/mongodb-1.2.3/src/libbson/build/autotools/ReadCommandLineArguments.m4 b/mongodb-1.2.8/src/libbson/build/autotools/ReadCommandLineArguments.m4
similarity index 100%
rename from mongodb-1.2.3/src/libbson/build/autotools/ReadCommandLineArguments.m4
rename to mongodb-1.2.8/src/libbson/build/autotools/ReadCommandLineArguments.m4
diff --git a/mongodb-1.2.3/src/libbson/build/autotools/SetupAutomake.m4 b/mongodb-1.2.8/src/libbson/build/autotools/SetupAutomake.m4
similarity index 100%
rename from mongodb-1.2.3/src/libbson/build/autotools/SetupAutomake.m4
rename to mongodb-1.2.8/src/libbson/build/autotools/SetupAutomake.m4
diff --git a/mongodb-1.2.3/src/libbson/build/autotools/SetupLibtool.m4 b/mongodb-1.2.8/src/libbson/build/autotools/SetupLibtool.m4
similarity index 100%
rename from mongodb-1.2.3/src/libbson/build/autotools/SetupLibtool.m4
rename to mongodb-1.2.8/src/libbson/build/autotools/SetupLibtool.m4
diff --git a/mongodb-1.2.3/src/libbson/build/autotools/Versions.m4 b/mongodb-1.2.8/src/libbson/build/autotools/Versions.m4
similarity index 100%
rename from mongodb-1.2.3/src/libbson/build/autotools/Versions.m4
rename to mongodb-1.2.8/src/libbson/build/autotools/Versions.m4
diff --git a/mongodb-1.2.3/src/libbson/build/autotools/m4/ac_check_typedef.m4 b/mongodb-1.2.8/src/libbson/build/autotools/m4/ac_check_typedef.m4
similarity index 100%
rename from mongodb-1.2.3/src/libbson/build/autotools/m4/ac_check_typedef.m4
rename to mongodb-1.2.8/src/libbson/build/autotools/m4/ac_check_typedef.m4
diff --git a/mongodb-1.2.3/src/libbson/build/autotools/m4/ac_compile_check_sizeof.m4 b/mongodb-1.2.8/src/libbson/build/autotools/m4/ac_compile_check_sizeof.m4
similarity index 100%
rename from mongodb-1.2.3/src/libbson/build/autotools/m4/ac_compile_check_sizeof.m4
rename to mongodb-1.2.8/src/libbson/build/autotools/m4/ac_compile_check_sizeof.m4
diff --git a/mongodb-1.2.3/src/libbson/build/autotools/m4/ac_create_stdint_h.m4 b/mongodb-1.2.8/src/libbson/build/autotools/m4/ac_create_stdint_h.m4
similarity index 100%
rename from mongodb-1.2.3/src/libbson/build/autotools/m4/ac_create_stdint_h.m4
rename to mongodb-1.2.8/src/libbson/build/autotools/m4/ac_create_stdint_h.m4
diff --git a/mongodb-1.2.3/src/libbson/build/autotools/m4/as-compiler-flag.m4 b/mongodb-1.2.8/src/libbson/build/autotools/m4/as-compiler-flag.m4
similarity index 100%
rename from mongodb-1.2.3/src/libbson/build/autotools/m4/as-compiler-flag.m4
rename to mongodb-1.2.8/src/libbson/build/autotools/m4/as-compiler-flag.m4
diff --git a/mongodb-1.2.3/src/libbson/build/autotools/m4/ax_check_compile_flag.m4 b/mongodb-1.2.8/src/libbson/build/autotools/m4/ax_check_compile_flag.m4
similarity index 100%
rename from mongodb-1.2.3/src/libbson/build/autotools/m4/ax_check_compile_flag.m4
rename to mongodb-1.2.8/src/libbson/build/autotools/m4/ax_check_compile_flag.m4
diff --git a/mongodb-1.2.3/src/libbson/build/autotools/m4/ax_check_link_flag.m4 b/mongodb-1.2.8/src/libbson/build/autotools/m4/ax_check_link_flag.m4
similarity index 100%
rename from mongodb-1.2.3/src/libbson/build/autotools/m4/ax_check_link_flag.m4
rename to mongodb-1.2.8/src/libbson/build/autotools/m4/ax_check_link_flag.m4
diff --git a/mongodb-1.2.3/src/libbson/build/autotools/m4/ax_pthread.m4 b/mongodb-1.2.8/src/libbson/build/autotools/m4/ax_pthread.m4
similarity index 100%
rename from mongodb-1.2.3/src/libbson/build/autotools/m4/ax_pthread.m4
rename to mongodb-1.2.8/src/libbson/build/autotools/m4/ax_pthread.m4
diff --git a/mongodb-1.2.3/src/libbson/build/autotools/m4/pkg.m4 b/mongodb-1.2.8/src/libbson/build/autotools/m4/pkg.m4
similarity index 100%
rename from mongodb-1.2.3/src/libbson/build/autotools/m4/pkg.m4
rename to mongodb-1.2.8/src/libbson/build/autotools/m4/pkg.m4
diff --git a/mongodb-1.2.3/src/libbson/build/autotools/m4/silent.m4 b/mongodb-1.2.8/src/libbson/build/autotools/m4/silent.m4
similarity index 100%
rename from mongodb-1.2.3/src/libbson/build/autotools/m4/silent.m4
rename to mongodb-1.2.8/src/libbson/build/autotools/m4/silent.m4
diff --git a/mongodb-1.2.3/src/libbson/src/bson/b64_ntop.h b/mongodb-1.2.8/src/libbson/src/bson/b64_ntop.h
similarity index 100%
rename from mongodb-1.2.3/src/libbson/src/bson/b64_ntop.h
rename to mongodb-1.2.8/src/libbson/src/bson/b64_ntop.h
diff --git a/mongodb-1.2.3/src/libbson/src/bson/b64_pton.h b/mongodb-1.2.8/src/libbson/src/bson/b64_pton.h
similarity index 100%
rename from mongodb-1.2.3/src/libbson/src/bson/b64_pton.h
rename to mongodb-1.2.8/src/libbson/src/bson/b64_pton.h
diff --git a/mongodb-1.2.3/src/libbson/src/bson/bcon.c b/mongodb-1.2.8/src/libbson/src/bson/bcon.c
similarity index 100%
rename from mongodb-1.2.3/src/libbson/src/bson/bcon.c
rename to mongodb-1.2.8/src/libbson/src/bson/bcon.c
diff --git a/mongodb-1.2.3/src/libbson/src/bson/bcon.h b/mongodb-1.2.8/src/libbson/src/bson/bcon.h
similarity index 100%
rename from mongodb-1.2.3/src/libbson/src/bson/bcon.h
rename to mongodb-1.2.8/src/libbson/src/bson/bcon.h
diff --git a/mongodb-1.2.3/src/libbson/src/bson/bson-atomic.c b/mongodb-1.2.8/src/libbson/src/bson/bson-atomic.c
similarity index 100%
rename from mongodb-1.2.3/src/libbson/src/bson/bson-atomic.c
rename to mongodb-1.2.8/src/libbson/src/bson/bson-atomic.c
diff --git a/mongodb-1.2.3/src/libbson/src/bson/bson-atomic.h b/mongodb-1.2.8/src/libbson/src/bson/bson-atomic.h
similarity index 100%
rename from mongodb-1.2.3/src/libbson/src/bson/bson-atomic.h
rename to mongodb-1.2.8/src/libbson/src/bson/bson-atomic.h
diff --git a/mongodb-1.2.3/src/libbson/src/bson/bson-clock.c b/mongodb-1.2.8/src/libbson/src/bson/bson-clock.c
similarity index 100%
rename from mongodb-1.2.3/src/libbson/src/bson/bson-clock.c
rename to mongodb-1.2.8/src/libbson/src/bson/bson-clock.c
diff --git a/mongodb-1.2.3/src/libbson/src/bson/bson-clock.h b/mongodb-1.2.8/src/libbson/src/bson/bson-clock.h
similarity index 100%
rename from mongodb-1.2.3/src/libbson/src/bson/bson-clock.h
rename to mongodb-1.2.8/src/libbson/src/bson/bson-clock.h
diff --git a/mongodb-1.2.3/src/libbson/src/bson/bson-compat.h b/mongodb-1.2.8/src/libbson/src/bson/bson-compat.h
similarity index 100%
rename from mongodb-1.2.3/src/libbson/src/bson/bson-compat.h
rename to mongodb-1.2.8/src/libbson/src/bson/bson-compat.h
diff --git a/mongodb-1.2.3/src/libbson/src/bson/bson-config.h b/mongodb-1.2.8/src/libbson/src/bson/bson-config.h
similarity index 100%
rename from mongodb-1.2.3/src/libbson/src/bson/bson-config.h
rename to mongodb-1.2.8/src/libbson/src/bson/bson-config.h
diff --git a/mongodb-1.2.3/src/libbson/src/bson/bson-config.h.in b/mongodb-1.2.8/src/libbson/src/bson/bson-config.h.in
similarity index 100%
rename from mongodb-1.2.3/src/libbson/src/bson/bson-config.h.in
rename to mongodb-1.2.8/src/libbson/src/bson/bson-config.h.in
diff --git a/mongodb-1.2.3/src/libbson/src/bson/bson-context-private.h b/mongodb-1.2.8/src/libbson/src/bson/bson-context-private.h
similarity index 100%
rename from mongodb-1.2.3/src/libbson/src/bson/bson-context-private.h
rename to mongodb-1.2.8/src/libbson/src/bson/bson-context-private.h
diff --git a/mongodb-1.2.3/src/libbson/src/bson/bson-context.c b/mongodb-1.2.8/src/libbson/src/bson/bson-context.c
similarity index 100%
rename from mongodb-1.2.3/src/libbson/src/bson/bson-context.c
rename to mongodb-1.2.8/src/libbson/src/bson/bson-context.c
diff --git a/mongodb-1.2.3/src/libbson/src/bson/bson-context.h b/mongodb-1.2.8/src/libbson/src/bson/bson-context.h
similarity index 100%
rename from mongodb-1.2.3/src/libbson/src/bson/bson-context.h
rename to mongodb-1.2.8/src/libbson/src/bson/bson-context.h
diff --git a/mongodb-1.2.3/src/libbson/src/bson/bson-decimal128.c b/mongodb-1.2.8/src/libbson/src/bson/bson-decimal128.c
similarity index 100%
rename from mongodb-1.2.3/src/libbson/src/bson/bson-decimal128.c
rename to mongodb-1.2.8/src/libbson/src/bson/bson-decimal128.c
diff --git a/mongodb-1.2.3/src/libbson/src/bson/bson-decimal128.h b/mongodb-1.2.8/src/libbson/src/bson/bson-decimal128.h
similarity index 100%
rename from mongodb-1.2.3/src/libbson/src/bson/bson-decimal128.h
rename to mongodb-1.2.8/src/libbson/src/bson/bson-decimal128.h
diff --git a/mongodb-1.2.3/src/libbson/src/bson/bson-endian.h b/mongodb-1.2.8/src/libbson/src/bson/bson-endian.h
similarity index 100%
rename from mongodb-1.2.3/src/libbson/src/bson/bson-endian.h
rename to mongodb-1.2.8/src/libbson/src/bson/bson-endian.h
diff --git a/mongodb-1.2.3/src/libbson/src/bson/bson-error.c b/mongodb-1.2.8/src/libbson/src/bson/bson-error.c
similarity index 100%
rename from mongodb-1.2.3/src/libbson/src/bson/bson-error.c
rename to mongodb-1.2.8/src/libbson/src/bson/bson-error.c
diff --git a/mongodb-1.2.3/src/libbson/src/bson/bson-error.h b/mongodb-1.2.8/src/libbson/src/bson/bson-error.h
similarity index 100%
rename from mongodb-1.2.3/src/libbson/src/bson/bson-error.h
rename to mongodb-1.2.8/src/libbson/src/bson/bson-error.h
diff --git a/mongodb-1.2.3/src/libbson/src/bson/bson-iso8601-private.h b/mongodb-1.2.8/src/libbson/src/bson/bson-iso8601-private.h
similarity index 100%
rename from mongodb-1.2.3/src/libbson/src/bson/bson-iso8601-private.h
rename to mongodb-1.2.8/src/libbson/src/bson/bson-iso8601-private.h
diff --git a/mongodb-1.2.3/src/libbson/src/bson/bson-iso8601.c b/mongodb-1.2.8/src/libbson/src/bson/bson-iso8601.c
similarity index 100%
rename from mongodb-1.2.3/src/libbson/src/bson/bson-iso8601.c
rename to mongodb-1.2.8/src/libbson/src/bson/bson-iso8601.c
diff --git a/mongodb-1.2.3/src/libbson/src/bson/bson-iter.c b/mongodb-1.2.8/src/libbson/src/bson/bson-iter.c
similarity index 100%
rename from mongodb-1.2.3/src/libbson/src/bson/bson-iter.c
rename to mongodb-1.2.8/src/libbson/src/bson/bson-iter.c
diff --git a/mongodb-1.2.3/src/libbson/src/bson/bson-iter.h b/mongodb-1.2.8/src/libbson/src/bson/bson-iter.h
similarity index 100%
rename from mongodb-1.2.3/src/libbson/src/bson/bson-iter.h
rename to mongodb-1.2.8/src/libbson/src/bson/bson-iter.h
diff --git a/mongodb-1.2.3/src/libbson/src/bson/bson-json.c b/mongodb-1.2.8/src/libbson/src/bson/bson-json.c
similarity index 100%
rename from mongodb-1.2.3/src/libbson/src/bson/bson-json.c
rename to mongodb-1.2.8/src/libbson/src/bson/bson-json.c
diff --git a/mongodb-1.2.3/src/libbson/src/bson/bson-json.h b/mongodb-1.2.8/src/libbson/src/bson/bson-json.h
similarity index 100%
rename from mongodb-1.2.3/src/libbson/src/bson/bson-json.h
rename to mongodb-1.2.8/src/libbson/src/bson/bson-json.h
diff --git a/mongodb-1.2.3/src/libbson/src/bson/bson-keys.c b/mongodb-1.2.8/src/libbson/src/bson/bson-keys.c
similarity index 100%
rename from mongodb-1.2.3/src/libbson/src/bson/bson-keys.c
rename to mongodb-1.2.8/src/libbson/src/bson/bson-keys.c
diff --git a/mongodb-1.2.3/src/libbson/src/bson/bson-keys.h b/mongodb-1.2.8/src/libbson/src/bson/bson-keys.h
similarity index 100%
rename from mongodb-1.2.3/src/libbson/src/bson/bson-keys.h
rename to mongodb-1.2.8/src/libbson/src/bson/bson-keys.h
diff --git a/mongodb-1.2.3/src/libbson/src/bson/bson-macros.h b/mongodb-1.2.8/src/libbson/src/bson/bson-macros.h
similarity index 100%
rename from mongodb-1.2.3/src/libbson/src/bson/bson-macros.h
rename to mongodb-1.2.8/src/libbson/src/bson/bson-macros.h
diff --git a/mongodb-1.2.3/src/libbson/src/bson/bson-md5.c b/mongodb-1.2.8/src/libbson/src/bson/bson-md5.c
similarity index 100%
rename from mongodb-1.2.3/src/libbson/src/bson/bson-md5.c
rename to mongodb-1.2.8/src/libbson/src/bson/bson-md5.c
diff --git a/mongodb-1.2.3/src/libbson/src/bson/bson-md5.h b/mongodb-1.2.8/src/libbson/src/bson/bson-md5.h
similarity index 100%
rename from mongodb-1.2.3/src/libbson/src/bson/bson-md5.h
rename to mongodb-1.2.8/src/libbson/src/bson/bson-md5.h
diff --git a/mongodb-1.2.3/src/libbson/src/bson/bson-memory.c b/mongodb-1.2.8/src/libbson/src/bson/bson-memory.c
similarity index 100%
rename from mongodb-1.2.3/src/libbson/src/bson/bson-memory.c
rename to mongodb-1.2.8/src/libbson/src/bson/bson-memory.c
diff --git a/mongodb-1.2.3/src/libbson/src/bson/bson-memory.h b/mongodb-1.2.8/src/libbson/src/bson/bson-memory.h
similarity index 100%
rename from mongodb-1.2.3/src/libbson/src/bson/bson-memory.h
rename to mongodb-1.2.8/src/libbson/src/bson/bson-memory.h
diff --git a/mongodb-1.2.3/src/libbson/src/bson/bson-oid.c b/mongodb-1.2.8/src/libbson/src/bson/bson-oid.c
similarity index 100%
rename from mongodb-1.2.3/src/libbson/src/bson/bson-oid.c
rename to mongodb-1.2.8/src/libbson/src/bson/bson-oid.c
diff --git a/mongodb-1.2.3/src/libbson/src/bson/bson-oid.h b/mongodb-1.2.8/src/libbson/src/bson/bson-oid.h
similarity index 100%
rename from mongodb-1.2.3/src/libbson/src/bson/bson-oid.h
rename to mongodb-1.2.8/src/libbson/src/bson/bson-oid.h
diff --git a/mongodb-1.2.3/src/libbson/src/bson/bson-private.h b/mongodb-1.2.8/src/libbson/src/bson/bson-private.h
similarity index 100%
rename from mongodb-1.2.3/src/libbson/src/bson/bson-private.h
rename to mongodb-1.2.8/src/libbson/src/bson/bson-private.h
diff --git a/mongodb-1.2.3/src/libbson/src/bson/bson-reader.c b/mongodb-1.2.8/src/libbson/src/bson/bson-reader.c
similarity index 100%
rename from mongodb-1.2.3/src/libbson/src/bson/bson-reader.c
rename to mongodb-1.2.8/src/libbson/src/bson/bson-reader.c
diff --git a/mongodb-1.2.3/src/libbson/src/bson/bson-reader.h b/mongodb-1.2.8/src/libbson/src/bson/bson-reader.h
similarity index 100%
rename from mongodb-1.2.3/src/libbson/src/bson/bson-reader.h
rename to mongodb-1.2.8/src/libbson/src/bson/bson-reader.h
diff --git a/mongodb-1.2.3/src/libbson/src/bson/bson-stdint-win32.h b/mongodb-1.2.8/src/libbson/src/bson/bson-stdint-win32.h
similarity index 100%
rename from mongodb-1.2.3/src/libbson/src/bson/bson-stdint-win32.h
rename to mongodb-1.2.8/src/libbson/src/bson/bson-stdint-win32.h
diff --git a/mongodb-1.2.3/src/libbson/src/bson/bson-stdint.h b/mongodb-1.2.8/src/libbson/src/bson/bson-stdint.h
similarity index 100%
rename from mongodb-1.2.3/src/libbson/src/bson/bson-stdint.h
rename to mongodb-1.2.8/src/libbson/src/bson/bson-stdint.h
diff --git a/mongodb-1.2.3/src/libbson/src/bson/bson-string.c b/mongodb-1.2.8/src/libbson/src/bson/bson-string.c
similarity index 100%
rename from mongodb-1.2.3/src/libbson/src/bson/bson-string.c
rename to mongodb-1.2.8/src/libbson/src/bson/bson-string.c
diff --git a/mongodb-1.2.3/src/libbson/src/bson/bson-string.h b/mongodb-1.2.8/src/libbson/src/bson/bson-string.h
similarity index 100%
rename from mongodb-1.2.3/src/libbson/src/bson/bson-string.h
rename to mongodb-1.2.8/src/libbson/src/bson/bson-string.h
diff --git a/mongodb-1.2.3/src/libbson/src/bson/bson-thread-private.h b/mongodb-1.2.8/src/libbson/src/bson/bson-thread-private.h
similarity index 100%
rename from mongodb-1.2.3/src/libbson/src/bson/bson-thread-private.h
rename to mongodb-1.2.8/src/libbson/src/bson/bson-thread-private.h
diff --git a/mongodb-1.2.3/src/libbson/src/bson/bson-timegm-private.h b/mongodb-1.2.8/src/libbson/src/bson/bson-timegm-private.h
similarity index 100%
rename from mongodb-1.2.3/src/libbson/src/bson/bson-timegm-private.h
rename to mongodb-1.2.8/src/libbson/src/bson/bson-timegm-private.h
diff --git a/mongodb-1.2.3/src/libbson/src/bson/bson-timegm.c b/mongodb-1.2.8/src/libbson/src/bson/bson-timegm.c
similarity index 100%
rename from mongodb-1.2.3/src/libbson/src/bson/bson-timegm.c
rename to mongodb-1.2.8/src/libbson/src/bson/bson-timegm.c
diff --git a/mongodb-1.2.3/src/libbson/src/bson/bson-types.h b/mongodb-1.2.8/src/libbson/src/bson/bson-types.h
similarity index 100%
rename from mongodb-1.2.3/src/libbson/src/bson/bson-types.h
rename to mongodb-1.2.8/src/libbson/src/bson/bson-types.h
diff --git a/mongodb-1.2.3/src/libbson/src/bson/bson-utf8.c b/mongodb-1.2.8/src/libbson/src/bson/bson-utf8.c
similarity index 100%
rename from mongodb-1.2.3/src/libbson/src/bson/bson-utf8.c
rename to mongodb-1.2.8/src/libbson/src/bson/bson-utf8.c
diff --git a/mongodb-1.2.3/src/libbson/src/bson/bson-utf8.h b/mongodb-1.2.8/src/libbson/src/bson/bson-utf8.h
similarity index 100%
rename from mongodb-1.2.3/src/libbson/src/bson/bson-utf8.h
rename to mongodb-1.2.8/src/libbson/src/bson/bson-utf8.h
diff --git a/mongodb-1.2.3/src/libbson/src/bson/bson-value.c b/mongodb-1.2.8/src/libbson/src/bson/bson-value.c
similarity index 100%
rename from mongodb-1.2.3/src/libbson/src/bson/bson-value.c
rename to mongodb-1.2.8/src/libbson/src/bson/bson-value.c
diff --git a/mongodb-1.2.3/src/libbson/src/bson/bson-value.h b/mongodb-1.2.8/src/libbson/src/bson/bson-value.h
similarity index 100%
rename from mongodb-1.2.3/src/libbson/src/bson/bson-value.h
rename to mongodb-1.2.8/src/libbson/src/bson/bson-value.h
diff --git a/mongodb-1.2.3/src/libbson/src/bson/bson-version-functions.c b/mongodb-1.2.8/src/libbson/src/bson/bson-version-functions.c
similarity index 100%
rename from mongodb-1.2.3/src/libbson/src/bson/bson-version-functions.c
rename to mongodb-1.2.8/src/libbson/src/bson/bson-version-functions.c
diff --git a/mongodb-1.2.3/src/libbson/src/bson/bson-version-functions.h b/mongodb-1.2.8/src/libbson/src/bson/bson-version-functions.h
similarity index 100%
rename from mongodb-1.2.3/src/libbson/src/bson/bson-version-functions.h
rename to mongodb-1.2.8/src/libbson/src/bson/bson-version-functions.h
diff --git a/mongodb-1.2.3/src/libbson/src/bson/bson-version.h b/mongodb-1.2.8/src/libbson/src/bson/bson-version.h
similarity index 96%
rename from mongodb-1.2.3/src/libbson/src/bson/bson-version.h
rename to mongodb-1.2.8/src/libbson/src/bson/bson-version.h
index c1d8e657..118861cd 100644
--- a/mongodb-1.2.3/src/libbson/src/bson/bson-version.h
+++ b/mongodb-1.2.8/src/libbson/src/bson/bson-version.h
@@ -1,101 +1,101 @@
/*
* Copyright 2013 MongoDB, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#if !defined (BSON_INSIDE) && !defined (BSON_COMPILATION)
#error "Only <bson.h> can be included directly."
#endif
#ifndef BSON_VERSION_H
#define BSON_VERSION_H
/**
* BSON_MAJOR_VERSION:
*
* BSON major version component (e.g. 1 if %BSON_VERSION is 1.2.3)
*/
#define BSON_MAJOR_VERSION (1)
/**
* BSON_MINOR_VERSION:
*
* BSON minor version component (e.g. 2 if %BSON_VERSION is 1.2.3)
*/
#define BSON_MINOR_VERSION (5)
/**
* BSON_MICRO_VERSION:
*
* BSON micro version component (e.g. 3 if %BSON_VERSION is 1.2.3)
*/
-#define BSON_MICRO_VERSION (3)
+#define BSON_MICRO_VERSION (5)
/**
* BSON_PRERELEASE_VERSION:
*
* BSON prerelease version component (e.g. rc0 if %BSON_VERSION is 1.2.3-rc0)
*/
#define BSON_PRERELEASE_VERSION ()
/**
* BSON_VERSION:
*
* BSON version.
*/
-#define BSON_VERSION (1.5.3)
+#define BSON_VERSION (1.5.5)
/**
* BSON_VERSION_S:
*
* BSON version, encoded as a string, useful for printing and
* concatenation.
*/
-#define BSON_VERSION_S "1.5.3"
+#define BSON_VERSION_S "1.5.5"
/**
* BSON_VERSION_HEX:
*
* BSON version, encoded as an hexadecimal number, useful for
* integer comparisons.
*/
#define BSON_VERSION_HEX (BSON_MAJOR_VERSION << 24 | \
BSON_MINOR_VERSION << 16 | \
BSON_MICRO_VERSION << 8)
/**
* BSON_CHECK_VERSION:
* @major: required major version
* @minor: required minor version
* @micro: required micro version
*
* Compile-time version checking. Evaluates to %TRUE if the version
* of BSON is greater than the required one.
*/
#define BSON_CHECK_VERSION(major,minor,micro) \
(BSON_MAJOR_VERSION > (major) || \
(BSON_MAJOR_VERSION == (major) && BSON_MINOR_VERSION > (minor)) || \
(BSON_MAJOR_VERSION == (major) && BSON_MINOR_VERSION == (minor) && \
BSON_MICRO_VERSION >= (micro)))
#endif /* BSON_VERSION_H */
diff --git a/mongodb-1.2.3/src/libbson/src/bson/bson-version.h.in b/mongodb-1.2.8/src/libbson/src/bson/bson-version.h.in
similarity index 100%
rename from mongodb-1.2.3/src/libbson/src/bson/bson-version.h.in
rename to mongodb-1.2.8/src/libbson/src/bson/bson-version.h.in
diff --git a/mongodb-1.2.3/src/libbson/src/bson/bson-writer.c b/mongodb-1.2.8/src/libbson/src/bson/bson-writer.c
similarity index 100%
rename from mongodb-1.2.3/src/libbson/src/bson/bson-writer.c
rename to mongodb-1.2.8/src/libbson/src/bson/bson-writer.c
diff --git a/mongodb-1.2.3/src/libbson/src/bson/bson-writer.h b/mongodb-1.2.8/src/libbson/src/bson/bson-writer.h
similarity index 100%
rename from mongodb-1.2.3/src/libbson/src/bson/bson-writer.h
rename to mongodb-1.2.8/src/libbson/src/bson/bson-writer.h
diff --git a/mongodb-1.2.3/src/libbson/src/bson/bson.c b/mongodb-1.2.8/src/libbson/src/bson/bson.c
similarity index 100%
rename from mongodb-1.2.3/src/libbson/src/bson/bson.c
rename to mongodb-1.2.8/src/libbson/src/bson/bson.c
diff --git a/mongodb-1.2.3/src/libbson/src/bson/bson.h b/mongodb-1.2.8/src/libbson/src/bson/bson.h
similarity index 100%
rename from mongodb-1.2.3/src/libbson/src/bson/bson.h
rename to mongodb-1.2.8/src/libbson/src/bson/bson.h
diff --git a/mongodb-1.2.3/src/libbson/src/yajl/yajl.c b/mongodb-1.2.8/src/libbson/src/yajl/yajl.c
similarity index 100%
rename from mongodb-1.2.3/src/libbson/src/yajl/yajl.c
rename to mongodb-1.2.8/src/libbson/src/yajl/yajl.c
diff --git a/mongodb-1.2.3/src/libbson/src/yajl/yajl_alloc.c b/mongodb-1.2.8/src/libbson/src/yajl/yajl_alloc.c
similarity index 100%
rename from mongodb-1.2.3/src/libbson/src/yajl/yajl_alloc.c
rename to mongodb-1.2.8/src/libbson/src/yajl/yajl_alloc.c
diff --git a/mongodb-1.2.3/src/libbson/src/yajl/yajl_alloc.h b/mongodb-1.2.8/src/libbson/src/yajl/yajl_alloc.h
similarity index 100%
rename from mongodb-1.2.3/src/libbson/src/yajl/yajl_alloc.h
rename to mongodb-1.2.8/src/libbson/src/yajl/yajl_alloc.h
diff --git a/mongodb-1.2.3/src/libbson/src/yajl/yajl_buf.c b/mongodb-1.2.8/src/libbson/src/yajl/yajl_buf.c
similarity index 100%
rename from mongodb-1.2.3/src/libbson/src/yajl/yajl_buf.c
rename to mongodb-1.2.8/src/libbson/src/yajl/yajl_buf.c
diff --git a/mongodb-1.2.3/src/libbson/src/yajl/yajl_buf.h b/mongodb-1.2.8/src/libbson/src/yajl/yajl_buf.h
similarity index 100%
rename from mongodb-1.2.3/src/libbson/src/yajl/yajl_buf.h
rename to mongodb-1.2.8/src/libbson/src/yajl/yajl_buf.h
diff --git a/mongodb-1.2.3/src/libbson/src/yajl/yajl_bytestack.h b/mongodb-1.2.8/src/libbson/src/yajl/yajl_bytestack.h
similarity index 100%
rename from mongodb-1.2.3/src/libbson/src/yajl/yajl_bytestack.h
rename to mongodb-1.2.8/src/libbson/src/yajl/yajl_bytestack.h
diff --git a/mongodb-1.2.3/src/libbson/src/yajl/yajl_common.h b/mongodb-1.2.8/src/libbson/src/yajl/yajl_common.h
similarity index 100%
rename from mongodb-1.2.3/src/libbson/src/yajl/yajl_common.h
rename to mongodb-1.2.8/src/libbson/src/yajl/yajl_common.h
diff --git a/mongodb-1.2.3/src/libbson/src/yajl/yajl_encode.c b/mongodb-1.2.8/src/libbson/src/yajl/yajl_encode.c
similarity index 100%
rename from mongodb-1.2.3/src/libbson/src/yajl/yajl_encode.c
rename to mongodb-1.2.8/src/libbson/src/yajl/yajl_encode.c
diff --git a/mongodb-1.2.3/src/libbson/src/yajl/yajl_encode.h b/mongodb-1.2.8/src/libbson/src/yajl/yajl_encode.h
similarity index 100%
rename from mongodb-1.2.3/src/libbson/src/yajl/yajl_encode.h
rename to mongodb-1.2.8/src/libbson/src/yajl/yajl_encode.h
diff --git a/mongodb-1.2.3/src/libbson/src/yajl/yajl_gen.c b/mongodb-1.2.8/src/libbson/src/yajl/yajl_gen.c
similarity index 100%
rename from mongodb-1.2.3/src/libbson/src/yajl/yajl_gen.c
rename to mongodb-1.2.8/src/libbson/src/yajl/yajl_gen.c
diff --git a/mongodb-1.2.3/src/libbson/src/yajl/yajl_gen.h b/mongodb-1.2.8/src/libbson/src/yajl/yajl_gen.h
similarity index 100%
rename from mongodb-1.2.3/src/libbson/src/yajl/yajl_gen.h
rename to mongodb-1.2.8/src/libbson/src/yajl/yajl_gen.h
diff --git a/mongodb-1.2.3/src/libbson/src/yajl/yajl_lex.c b/mongodb-1.2.8/src/libbson/src/yajl/yajl_lex.c
similarity index 100%
rename from mongodb-1.2.3/src/libbson/src/yajl/yajl_lex.c
rename to mongodb-1.2.8/src/libbson/src/yajl/yajl_lex.c
diff --git a/mongodb-1.2.3/src/libbson/src/yajl/yajl_lex.h b/mongodb-1.2.8/src/libbson/src/yajl/yajl_lex.h
similarity index 100%
rename from mongodb-1.2.3/src/libbson/src/yajl/yajl_lex.h
rename to mongodb-1.2.8/src/libbson/src/yajl/yajl_lex.h
diff --git a/mongodb-1.2.3/src/libbson/src/yajl/yajl_parse.h b/mongodb-1.2.8/src/libbson/src/yajl/yajl_parse.h
similarity index 100%
rename from mongodb-1.2.3/src/libbson/src/yajl/yajl_parse.h
rename to mongodb-1.2.8/src/libbson/src/yajl/yajl_parse.h
diff --git a/mongodb-1.2.3/src/libbson/src/yajl/yajl_parser.c b/mongodb-1.2.8/src/libbson/src/yajl/yajl_parser.c
similarity index 100%
rename from mongodb-1.2.3/src/libbson/src/yajl/yajl_parser.c
rename to mongodb-1.2.8/src/libbson/src/yajl/yajl_parser.c
diff --git a/mongodb-1.2.3/src/libbson/src/yajl/yajl_parser.h b/mongodb-1.2.8/src/libbson/src/yajl/yajl_parser.h
similarity index 100%
rename from mongodb-1.2.3/src/libbson/src/yajl/yajl_parser.h
rename to mongodb-1.2.8/src/libbson/src/yajl/yajl_parser.h
diff --git a/mongodb-1.2.3/src/libbson/src/yajl/yajl_tree.c b/mongodb-1.2.8/src/libbson/src/yajl/yajl_tree.c
similarity index 100%
rename from mongodb-1.2.3/src/libbson/src/yajl/yajl_tree.c
rename to mongodb-1.2.8/src/libbson/src/yajl/yajl_tree.c
diff --git a/mongodb-1.2.3/src/libbson/src/yajl/yajl_tree.h b/mongodb-1.2.8/src/libbson/src/yajl/yajl_tree.h
similarity index 100%
rename from mongodb-1.2.3/src/libbson/src/yajl/yajl_tree.h
rename to mongodb-1.2.8/src/libbson/src/yajl/yajl_tree.h
diff --git a/mongodb-1.2.3/src/libbson/src/yajl/yajl_version.c b/mongodb-1.2.8/src/libbson/src/yajl/yajl_version.c
similarity index 100%
rename from mongodb-1.2.3/src/libbson/src/yajl/yajl_version.c
rename to mongodb-1.2.8/src/libbson/src/yajl/yajl_version.c
diff --git a/mongodb-1.2.3/src/libbson/src/yajl/yajl_version.h b/mongodb-1.2.8/src/libbson/src/yajl/yajl_version.h
similarity index 100%
rename from mongodb-1.2.3/src/libbson/src/yajl/yajl_version.h
rename to mongodb-1.2.8/src/libbson/src/yajl/yajl_version.h
diff --git a/mongodb-1.2.8/src/libmongoc/VERSION_CURRENT b/mongodb-1.2.8/src/libmongoc/VERSION_CURRENT
new file mode 100644
index 00000000..5ebba4f0
--- /dev/null
+++ b/mongodb-1.2.8/src/libmongoc/VERSION_CURRENT
@@ -0,0 +1 @@
+1.5.5
\ No newline at end of file
diff --git a/mongodb-1.2.8/src/libmongoc/VERSION_RELEASED b/mongodb-1.2.8/src/libmongoc/VERSION_RELEASED
new file mode 100644
index 00000000..5ebba4f0
--- /dev/null
+++ b/mongodb-1.2.8/src/libmongoc/VERSION_RELEASED
@@ -0,0 +1 @@
+1.5.5
\ No newline at end of file
diff --git a/mongodb-1.2.3/src/libmongoc/build/autotools/AutomaticInitAndCleanup.m4 b/mongodb-1.2.8/src/libmongoc/build/autotools/AutomaticInitAndCleanup.m4
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/build/autotools/AutomaticInitAndCleanup.m4
rename to mongodb-1.2.8/src/libmongoc/build/autotools/AutomaticInitAndCleanup.m4
diff --git a/mongodb-1.2.3/src/libmongoc/build/autotools/CheckCompiler.m4 b/mongodb-1.2.8/src/libmongoc/build/autotools/CheckCompiler.m4
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/build/autotools/CheckCompiler.m4
rename to mongodb-1.2.8/src/libmongoc/build/autotools/CheckCompiler.m4
diff --git a/mongodb-1.2.3/src/libmongoc/build/autotools/CheckHost.m4 b/mongodb-1.2.8/src/libmongoc/build/autotools/CheckHost.m4
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/build/autotools/CheckHost.m4
rename to mongodb-1.2.8/src/libmongoc/build/autotools/CheckHost.m4
diff --git a/mongodb-1.2.3/src/libmongoc/build/autotools/CheckProgs.m4 b/mongodb-1.2.8/src/libmongoc/build/autotools/CheckProgs.m4
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/build/autotools/CheckProgs.m4
rename to mongodb-1.2.8/src/libmongoc/build/autotools/CheckProgs.m4
diff --git a/mongodb-1.2.3/src/libmongoc/build/autotools/CheckSSL.m4 b/mongodb-1.2.8/src/libmongoc/build/autotools/CheckSSL.m4
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/build/autotools/CheckSSL.m4
rename to mongodb-1.2.8/src/libmongoc/build/autotools/CheckSSL.m4
diff --git a/mongodb-1.2.3/src/libmongoc/build/autotools/CheckSasl.m4 b/mongodb-1.2.8/src/libmongoc/build/autotools/CheckSasl.m4
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/build/autotools/CheckSasl.m4
rename to mongodb-1.2.8/src/libmongoc/build/autotools/CheckSasl.m4
diff --git a/mongodb-1.2.3/src/libmongoc/build/autotools/CheckTarget.m4 b/mongodb-1.2.8/src/libmongoc/build/autotools/CheckTarget.m4
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/build/autotools/CheckTarget.m4
rename to mongodb-1.2.8/src/libmongoc/build/autotools/CheckTarget.m4
diff --git a/mongodb-1.2.3/src/libmongoc/build/autotools/Coverage.m4 b/mongodb-1.2.8/src/libmongoc/build/autotools/Coverage.m4
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/build/autotools/Coverage.m4
rename to mongodb-1.2.8/src/libmongoc/build/autotools/Coverage.m4
diff --git a/mongodb-1.2.3/src/libmongoc/build/autotools/FindDependencies.m4 b/mongodb-1.2.8/src/libmongoc/build/autotools/FindDependencies.m4
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/build/autotools/FindDependencies.m4
rename to mongodb-1.2.8/src/libmongoc/build/autotools/FindDependencies.m4
diff --git a/mongodb-1.2.3/src/libmongoc/build/autotools/Libbson.m4 b/mongodb-1.2.8/src/libmongoc/build/autotools/Libbson.m4
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/build/autotools/Libbson.m4
rename to mongodb-1.2.8/src/libmongoc/build/autotools/Libbson.m4
diff --git a/mongodb-1.2.3/src/libmongoc/build/autotools/MaintainerFlags.m4 b/mongodb-1.2.8/src/libmongoc/build/autotools/MaintainerFlags.m4
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/build/autotools/MaintainerFlags.m4
rename to mongodb-1.2.8/src/libmongoc/build/autotools/MaintainerFlags.m4
diff --git a/mongodb-1.2.3/src/libmongoc/build/autotools/Optimizations.m4 b/mongodb-1.2.8/src/libmongoc/build/autotools/Optimizations.m4
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/build/autotools/Optimizations.m4
rename to mongodb-1.2.8/src/libmongoc/build/autotools/Optimizations.m4
diff --git a/mongodb-1.2.3/src/libmongoc/build/autotools/PlatformFlags.m4 b/mongodb-1.2.8/src/libmongoc/build/autotools/PlatformFlags.m4
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/build/autotools/PlatformFlags.m4
rename to mongodb-1.2.8/src/libmongoc/build/autotools/PlatformFlags.m4
diff --git a/mongodb-1.2.3/src/libmongoc/build/autotools/PrintBuildConfiguration.m4 b/mongodb-1.2.8/src/libmongoc/build/autotools/PrintBuildConfiguration.m4
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/build/autotools/PrintBuildConfiguration.m4
rename to mongodb-1.2.8/src/libmongoc/build/autotools/PrintBuildConfiguration.m4
diff --git a/mongodb-1.2.3/src/libmongoc/build/autotools/ReadCommandLineArguments.m4 b/mongodb-1.2.8/src/libmongoc/build/autotools/ReadCommandLineArguments.m4
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/build/autotools/ReadCommandLineArguments.m4
rename to mongodb-1.2.8/src/libmongoc/build/autotools/ReadCommandLineArguments.m4
diff --git a/mongodb-1.2.3/src/libmongoc/build/autotools/SetupAutomake.m4 b/mongodb-1.2.8/src/libmongoc/build/autotools/SetupAutomake.m4
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/build/autotools/SetupAutomake.m4
rename to mongodb-1.2.8/src/libmongoc/build/autotools/SetupAutomake.m4
diff --git a/mongodb-1.2.3/src/libmongoc/build/autotools/SetupLibtool.m4 b/mongodb-1.2.8/src/libmongoc/build/autotools/SetupLibtool.m4
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/build/autotools/SetupLibtool.m4
rename to mongodb-1.2.8/src/libmongoc/build/autotools/SetupLibtool.m4
diff --git a/mongodb-1.2.3/src/libmongoc/build/autotools/Versions.m4 b/mongodb-1.2.8/src/libmongoc/build/autotools/Versions.m4
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/build/autotools/Versions.m4
rename to mongodb-1.2.8/src/libmongoc/build/autotools/Versions.m4
diff --git a/mongodb-1.2.3/src/libmongoc/build/autotools/WeakSymbols.m4 b/mongodb-1.2.8/src/libmongoc/build/autotools/WeakSymbols.m4
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/build/autotools/WeakSymbols.m4
rename to mongodb-1.2.8/src/libmongoc/build/autotools/WeakSymbols.m4
diff --git a/mongodb-1.2.3/src/libmongoc/build/autotools/m4/ac_check_typedef.m4 b/mongodb-1.2.8/src/libmongoc/build/autotools/m4/ac_check_typedef.m4
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/build/autotools/m4/ac_check_typedef.m4
rename to mongodb-1.2.8/src/libmongoc/build/autotools/m4/ac_check_typedef.m4
diff --git a/mongodb-1.2.3/src/libmongoc/build/autotools/m4/ac_compile_check_sizeof.m4 b/mongodb-1.2.8/src/libmongoc/build/autotools/m4/ac_compile_check_sizeof.m4
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/build/autotools/m4/ac_compile_check_sizeof.m4
rename to mongodb-1.2.8/src/libmongoc/build/autotools/m4/ac_compile_check_sizeof.m4
diff --git a/mongodb-1.2.3/src/libmongoc/build/autotools/m4/ac_create_stdint_h.m4 b/mongodb-1.2.8/src/libmongoc/build/autotools/m4/ac_create_stdint_h.m4
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/build/autotools/m4/ac_create_stdint_h.m4
rename to mongodb-1.2.8/src/libmongoc/build/autotools/m4/ac_create_stdint_h.m4
diff --git a/mongodb-1.2.3/src/libmongoc/build/autotools/m4/as-compiler-flag.m4 b/mongodb-1.2.8/src/libmongoc/build/autotools/m4/as-compiler-flag.m4
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/build/autotools/m4/as-compiler-flag.m4
rename to mongodb-1.2.8/src/libmongoc/build/autotools/m4/as-compiler-flag.m4
diff --git a/mongodb-1.2.3/src/libmongoc/build/autotools/m4/ax_check_compile_flag.m4 b/mongodb-1.2.8/src/libmongoc/build/autotools/m4/ax_check_compile_flag.m4
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/build/autotools/m4/ax_check_compile_flag.m4
rename to mongodb-1.2.8/src/libmongoc/build/autotools/m4/ax_check_compile_flag.m4
diff --git a/mongodb-1.2.3/src/libmongoc/build/autotools/m4/ax_check_link_flag.m4 b/mongodb-1.2.8/src/libmongoc/build/autotools/m4/ax_check_link_flag.m4
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/build/autotools/m4/ax_check_link_flag.m4
rename to mongodb-1.2.8/src/libmongoc/build/autotools/m4/ax_check_link_flag.m4
diff --git a/mongodb-1.2.3/src/libmongoc/build/autotools/m4/ax_pthread.m4 b/mongodb-1.2.8/src/libmongoc/build/autotools/m4/ax_pthread.m4
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/build/autotools/m4/ax_pthread.m4
rename to mongodb-1.2.8/src/libmongoc/build/autotools/m4/ax_pthread.m4
diff --git a/mongodb-1.2.3/src/libmongoc/build/autotools/m4/pkg.m4 b/mongodb-1.2.8/src/libmongoc/build/autotools/m4/pkg.m4
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/build/autotools/m4/pkg.m4
rename to mongodb-1.2.8/src/libmongoc/build/autotools/m4/pkg.m4
diff --git a/mongodb-1.2.3/src/libmongoc/build/autotools/m4/silent.m4 b/mongodb-1.2.8/src/libmongoc/build/autotools/m4/silent.m4
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/build/autotools/m4/silent.m4
rename to mongodb-1.2.8/src/libmongoc/build/autotools/m4/silent.m4
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-apm-private.h b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-apm-private.h
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-apm-private.h
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-apm-private.h
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-apm.c b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-apm.c
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-apm.c
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-apm.c
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-apm.h b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-apm.h
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-apm.h
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-apm.h
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-array-private.h b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-array-private.h
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-array-private.h
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-array-private.h
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-array.c b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-array.c
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-array.c
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-array.c
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-async-cmd-private.h b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-async-cmd-private.h
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-async-cmd-private.h
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-async-cmd-private.h
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-async-cmd.c b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-async-cmd.c
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-async-cmd.c
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-async-cmd.c
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-async-private.h b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-async-private.h
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-async-private.h
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-async-private.h
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-async.c b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-async.c
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-async.c
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-async.c
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-b64-private.h b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-b64-private.h
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-b64-private.h
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-b64-private.h
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-b64.c b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-b64.c
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-b64.c
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-b64.c
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-buffer-private.h b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-buffer-private.h
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-buffer-private.h
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-buffer-private.h
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-buffer.c b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-buffer.c
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-buffer.c
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-buffer.c
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-bulk-operation-private.h b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-bulk-operation-private.h
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-bulk-operation-private.h
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-bulk-operation-private.h
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-bulk-operation.c b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-bulk-operation.c
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-bulk-operation.c
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-bulk-operation.c
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-bulk-operation.h b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-bulk-operation.h
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-bulk-operation.h
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-bulk-operation.h
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-client-pool-private.h b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-client-pool-private.h
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-client-pool-private.h
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-client-pool-private.h
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-client-pool.c b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-client-pool.c
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-client-pool.c
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-client-pool.c
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-client-pool.h b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-client-pool.h
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-client-pool.h
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-client-pool.h
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-client-private.h b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-client-private.h
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-client-private.h
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-client-private.h
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-client.c b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-client.c
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-client.c
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-client.c
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-client.h b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-client.h
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-client.h
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-client.h
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-cluster-private.h b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-cluster-private.h
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-cluster-private.h
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-cluster-private.h
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-cluster.c b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-cluster.c
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-cluster.c
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-cluster.c
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-collection-private.h b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-collection-private.h
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-collection-private.h
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-collection-private.h
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-collection.c b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-collection.c
similarity index 99%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-collection.c
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-collection.c
index d9c7e36e..3733e802 100644
--- a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-collection.c
+++ b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-collection.c
@@ -1,2629 +1,2638 @@
/*
* Copyright 2013 MongoDB, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <bcon.h>
#include <stdio.h>
#include "mongoc-bulk-operation.h"
#include "mongoc-bulk-operation-private.h"
#include "mongoc-client-private.h"
#include "mongoc-find-and-modify-private.h"
#include "mongoc-find-and-modify.h"
#include "mongoc-collection.h"
#include "mongoc-collection-private.h"
#include "mongoc-cursor-private.h"
#include "mongoc-cursor-cursorid-private.h"
#include "mongoc-cursor-array-private.h"
#include "mongoc-error.h"
#include "mongoc-index.h"
#include "mongoc-log.h"
#include "mongoc-trace-private.h"
#include "mongoc-read-concern-private.h"
#include "mongoc-write-concern-private.h"
#include "mongoc-util-private.h"
#undef MONGOC_LOG_DOMAIN
#define MONGOC_LOG_DOMAIN "collection"
#define _BSON_APPEND_WRITE_CONCERN(_bson, _write_concern) \
do { \
const bson_t *write_concern_bson; \
mongoc_write_concern_t *write_concern_copy = NULL; \
if (_write_concern->frozen) { \
write_concern_bson = _mongoc_write_concern_get_bson (_write_concern); \
} else { \
/* _mongoc_write_concern_get_bson will freeze the write_concern */ \
write_concern_copy = mongoc_write_concern_copy (_write_concern); \
write_concern_bson = _mongoc_write_concern_get_bson (write_concern_copy); \
} \
BSON_APPEND_DOCUMENT (_bson, "writeConcern", write_concern_bson); \
if (write_concern_copy) { \
mongoc_write_concern_destroy (write_concern_copy); \
} \
} while(0); \
static mongoc_cursor_t *
_mongoc_collection_cursor_new (mongoc_collection_t *collection,
mongoc_query_flags_t flags)
{
return _mongoc_cursor_new (collection->client,
collection->ns,
flags,
0, /* skip */
0, /* limit */
0, /* batch_size */
false, /* is_command */
NULL, /* query */
NULL, /* fields */
NULL, /* read prefs */
NULL); /* read concern */
}
static void
_mongoc_collection_write_command_execute (mongoc_write_command_t *command,
const mongoc_collection_t *collection,
const mongoc_write_concern_t *write_concern,
mongoc_write_result_t *result)
{
mongoc_server_stream_t *server_stream;
ENTRY;
server_stream = mongoc_cluster_stream_for_writes (&collection->client->cluster,
&result->error);
if (!server_stream) {
/* result->error has been filled out */
EXIT;
}
_mongoc_write_command_execute (command, collection->client, server_stream,
collection->db, collection->collection,
write_concern, 0 /* offset */, result);
mongoc_server_stream_cleanup (server_stream);
EXIT;
}
/*
*--------------------------------------------------------------------------
*
* _mongoc_collection_new --
*
* INTERNAL API
*
* Create a new mongoc_collection_t structure for the given client.
*
* @client must remain valid during the lifetime of this structure.
* @db is the db name of the collection.
* @collection is the name of the collection.
* @read_prefs is the default read preferences to apply or NULL.
* @read_concern is the default read concern to apply or NULL.
* @write_concern is the default write concern to apply or NULL.
*
* Returns:
* A newly allocated mongoc_collection_t that should be freed with
* mongoc_collection_destroy().
*
* Side effects:
* None.
*
*--------------------------------------------------------------------------
*/
mongoc_collection_t *
_mongoc_collection_new (mongoc_client_t *client,
const char *db,
const char *collection,
const mongoc_read_prefs_t *read_prefs,
const mongoc_read_concern_t *read_concern,
const mongoc_write_concern_t *write_concern)
{
mongoc_collection_t *col;
ENTRY;
BSON_ASSERT (client);
BSON_ASSERT (db);
BSON_ASSERT (collection);
col = (mongoc_collection_t *)bson_malloc0(sizeof *col);
col->client = client;
col->write_concern = write_concern ?
mongoc_write_concern_copy(write_concern) :
mongoc_write_concern_new();
col->read_concern = read_concern ?
mongoc_read_concern_copy(read_concern) :
mongoc_read_concern_new();
col->read_prefs = read_prefs ?
mongoc_read_prefs_copy(read_prefs) :
mongoc_read_prefs_new(MONGOC_READ_PRIMARY);
bson_snprintf (col->ns, sizeof col->ns, "%s.%s", db, collection);
bson_snprintf (col->db, sizeof col->db, "%s", db);
bson_snprintf (col->collection, sizeof col->collection, "%s", collection);
col->collectionlen = (uint32_t)strlen(col->collection);
col->nslen = (uint32_t)strlen(col->ns);
_mongoc_buffer_init(&col->buffer, NULL, 0, NULL, NULL);
col->gle = NULL;
RETURN(col);
}
/*
*--------------------------------------------------------------------------
*
* mongoc_collection_destroy --
*
* Release resources associated with @collection and frees the
* structure.
*
* Returns:
* None.
*
* Side effects:
* Everything.
*
*--------------------------------------------------------------------------
*/
void
mongoc_collection_destroy (mongoc_collection_t *collection) /* IN */
{
ENTRY;
BSON_ASSERT (collection);
bson_clear (&collection->gle);
_mongoc_buffer_destroy(&collection->buffer);
if (collection->read_prefs) {
mongoc_read_prefs_destroy(collection->read_prefs);
collection->read_prefs = NULL;
}
if (collection->read_concern) {
mongoc_read_concern_destroy(collection->read_concern);
collection->read_concern = NULL;
}
if (collection->write_concern) {
mongoc_write_concern_destroy(collection->write_concern);
collection->write_concern = NULL;
}
bson_free(collection);
EXIT;
}
/*
*--------------------------------------------------------------------------
*
* mongoc_collection_copy --
*
* Returns a copy of @collection that needs to be freed by calling
* mongoc_collection_destroy.
*
* Returns:
* A copy of this collection.
*
* Side effects:
* None.
*
*--------------------------------------------------------------------------
*/
mongoc_collection_t *
mongoc_collection_copy (mongoc_collection_t *collection) /* IN */
{
ENTRY;
BSON_ASSERT (collection);
RETURN(_mongoc_collection_new(collection->client, collection->db,
collection->collection, collection->read_prefs,
collection->read_concern,
collection->write_concern));
}
/*
*--------------------------------------------------------------------------
*
* mongoc_collection_aggregate --
*
* Send an "aggregate" command to the MongoDB server.
*
* This varies it's behavior based on the wire version. If we're on
* wire_version > 0, we use the new aggregate command, which returns a
* database cursor. On wire_version == 0, we create synthetic cursor on
* top of the array returned in result.
*
* This function will always return a new mongoc_cursor_t that should
* be freed with mongoc_cursor_destroy().
*
* The cursor may fail once iterated upon, so check
* mongoc_cursor_error() if mongoc_cursor_next() returns false.
*
* See http://docs.mongodb.org/manual/aggregation/ for more
* information on how to build aggregation pipelines.
*
* Requires:
* MongoDB >= 2.1.0
*
* Parameters:
* @flags: bitwise or of mongoc_query_flags_t or 0.
* @pipeline: A bson_t containing the pipeline request. @pipeline
* will be sent as an array type in the request.
* @options: A bson_t containing aggregation options, such as
* bypassDocumentValidation (used with $out pipeline),
* maxTimeMS (declaring maximum server execution time) and
* explain (return information on the processing of the pipeline).
* @read_prefs: Optional read preferences for the command.
*
* Returns:
* A newly allocated mongoc_cursor_t that should be freed with
* mongoc_cursor_destroy().
*
* Side effects:
* None.
*
*--------------------------------------------------------------------------
*/
mongoc_cursor_t *
mongoc_collection_aggregate (mongoc_collection_t *collection, /* IN */
mongoc_query_flags_t flags, /* IN */
const bson_t *pipeline, /* IN */
const bson_t *opts, /* IN */
const mongoc_read_prefs_t *read_prefs) /* IN */
{
mongoc_server_stream_t *server_stream = NULL;
bool has_batch_size = false;
bool has_out_key = false;
bson_iter_t kiter;
bson_iter_t ar;
mongoc_cursor_t *cursor;
uint32_t server_id;
int32_t batch_size = 0;
bson_iter_t iter;
bson_t command;
bson_t child;
bool use_cursor;
ENTRY;
BSON_ASSERT (collection);
BSON_ASSERT (pipeline);
bson_init (&command);
if (!read_prefs) {
read_prefs = collection->read_prefs;
}
cursor = _mongoc_collection_cursor_new (collection, flags);
if (!_mongoc_read_prefs_validate (read_prefs, &cursor->error)) {
GOTO (done);
}
if (!_mongoc_get_server_id_from_opts (opts, MONGOC_ERROR_COMMAND,
MONGOC_ERROR_COMMAND_INVALID_ARG,
&server_id, &cursor->error)) {
GOTO (done);
}
if (server_id) {
/* will set slaveok bit if server is not mongos */
mongoc_cursor_set_hint (cursor, server_id);
} else {
server_id = mongoc_topology_select_server_id (
collection->client->topology,
MONGOC_SS_READ,
read_prefs,
&cursor->error);
if (!server_id) {
GOTO (done);
}
/* don't use mongoc_cursor_set_hint, don't want special slaveok logic */
cursor->server_id = server_id;
}
/* server id isn't enough. ensure we're connected & know its wire version */
server_stream = mongoc_cluster_stream_for_server (
&collection->client->cluster, cursor->server_id,
true /* reconnect ok */, &cursor->error);
if (!server_stream) {
GOTO (done);
}
use_cursor = server_stream->sd->max_wire_version >= WIRE_VERSION_AGG_CURSOR;
BSON_APPEND_UTF8 (&command, "aggregate", collection->collection);
/*
* The following will allow @pipeline to be either an array of
* items for the pipeline, or {"pipeline": [...]}.
*/
if (bson_iter_init_find (&iter, pipeline, "pipeline") &&
BSON_ITER_HOLDS_ARRAY (&iter)) {
if (!bson_append_iter (&command, "pipeline", 8, &iter)) {
bson_set_error (&cursor->error,
MONGOC_ERROR_COMMAND,
MONGOC_ERROR_COMMAND_INVALID_ARG,
"Failed to append \"pipeline\" to create command.");
GOTO (done);
}
} else {
BSON_APPEND_ARRAY (&command, "pipeline", pipeline);
}
if (bson_iter_init_find (&iter, pipeline, "pipeline") &&
BSON_ITER_HOLDS_ARRAY (&iter) && bson_iter_recurse (&iter, &ar)) {
while (bson_iter_next (&ar)) {
if (BSON_ITER_HOLDS_DOCUMENT (&ar) && bson_iter_recurse (&ar, &kiter)) {
has_out_key |= bson_iter_find (&kiter, "$out");
}
}
}
/* for newer version, we include a cursor subdocument */
if (use_cursor) {
bson_append_document_begin (&command, "cursor", 6, &child);
if (opts
&& bson_iter_init_find (&iter, opts, "batchSize")
&& (BSON_ITER_HOLDS_INT32 (&iter) ||
BSON_ITER_HOLDS_INT64 (&iter) ||
BSON_ITER_HOLDS_DOUBLE (&iter))) {
batch_size = (int32_t)bson_iter_as_int64 (&iter);
BSON_APPEND_INT32 (&child, "batchSize", batch_size);
has_batch_size = true;
}
bson_append_document_end (&command, &child);
}
if (opts) {
bool ok = false;
bson_t opts_dupe = BSON_INITIALIZER;
if (has_batch_size || server_stream->sd->max_wire_version == 0) {
bson_copy_to_excluding_noinit (opts, &opts_dupe, "batchSize", NULL);
bson_iter_init (&iter, &opts_dupe);
} else {
bson_iter_init (&iter, opts);
}
/* omits "serverId" */
ok = _mongoc_client_command_append_iterator_opts_to_command (&iter,
server_stream->sd->max_wire_version,
&command,
&cursor->error);
bson_destroy (&opts_dupe);
if (!ok) {
GOTO (done);
}
}
/* Only inherit WriteConcern when for aggregate with $out */
if (!bson_has_field (&command, "writeConcern") && has_out_key) {
mongoc_write_concern_destroy (cursor->write_concern);
cursor->write_concern = mongoc_write_concern_copy (mongoc_collection_get_write_concern (collection));
}
if (!bson_has_field (&command, "readConcern")) {
mongoc_read_concern_destroy (cursor->read_concern);
- cursor->read_concern = mongoc_read_concern_copy (mongoc_collection_get_read_concern (collection));
+ cursor->read_concern = mongoc_read_concern_copy (
+ mongoc_collection_get_read_concern (collection));
+
+ if (cursor->read_concern->level != NULL) {
+ const bson_t *read_concern_bson;
+
+ read_concern_bson =
+ _mongoc_read_concern_get_bson (cursor->read_concern);
+ BSON_APPEND_DOCUMENT (&command, "readConcern", read_concern_bson);
+ }
}
if (use_cursor) {
_mongoc_cursor_cursorid_init (cursor, &command);
} else {
/* for older versions we get an array that we can create a synthetic
* cursor on top of */
_mongoc_cursor_array_init (cursor, &command, "result");
}
done:
mongoc_server_stream_cleanup (server_stream); /* null ok */
bson_destroy(&command);
/* we always return the cursor, even if it fails; users can detect the
* failure on performing a cursor operation. see CDRIVER-880. */
RETURN (cursor);
}
/*
*--------------------------------------------------------------------------
*
* mongoc_collection_find --
*
* DEPRECATED: use mongoc_collection_find_with_opts.
*
* Performs a query against the configured MongoDB server. If @read_prefs
* is provided, it will be used to locate a MongoDB node in the cluster
* to deliver the query to.
*
* @flags may be bitwise-or'd flags or MONGOC_QUERY_NONE.
*
* @skip may contain the number of documents to skip before returning the
* matching document.
*
* @limit may contain the maximum number of documents that may be
* returned.
*
* This function will always return a cursor, with the exception of
* invalid API use.
*
* Parameters:
* @collection: A mongoc_collection_t.
* @flags: A bitwise or of mongoc_query_flags_t.
* @skip: The number of documents to skip.
* @limit: The maximum number of items.
* @batch_size: The batch size
* @query: The query to locate matching documents.
* @fields: The fields to return, or NULL for all fields.
* @read_prefs: Read preferences to choose cluster node.
*
* Returns:
* A newly allocated mongoc_cursor_t that should be freed with
* mongoc_cursor_destroy().
*
* The client used by mongoc_collection_t must be valid for the
* lifetime of the resulting mongoc_cursor_t.
*
* Side effects:
* None.
*
*--------------------------------------------------------------------------
*/
mongoc_cursor_t *
mongoc_collection_find (mongoc_collection_t *collection, /* IN */
mongoc_query_flags_t flags, /* IN */
uint32_t skip, /* IN */
uint32_t limit, /* IN */
uint32_t batch_size, /* IN */
const bson_t *query, /* IN */
const bson_t *fields, /* IN */
const mongoc_read_prefs_t *read_prefs) /* IN */
{
BSON_ASSERT (collection);
BSON_ASSERT (query);
bson_clear (&collection->gle);
if (!read_prefs) {
read_prefs = collection->read_prefs;
}
return _mongoc_cursor_new (collection->client, collection->ns, flags, skip,
limit, batch_size, false, query, fields,
COALESCE (read_prefs, collection->read_prefs),
collection->read_concern);
}
/*
*--------------------------------------------------------------------------
*
* mongoc_collection_find_with_opts --
*
* Create a cursor with a query filter. All other options are
* specified in a free-form BSON document.
*
* Parameters:
* @collection: A mongoc_collection_t.
* @filter: The query to locate matching documents.
* @opts: Other options.
* @read_prefs: Optional read preferences to choose cluster node.
*
* Returns:
* A newly allocated mongoc_cursor_t that should be freed with
* mongoc_cursor_destroy().
*
* The client used by mongoc_collection_t must be valid for the
* lifetime of the resulting mongoc_cursor_t.
*
* Side effects:
* None.
*
*--------------------------------------------------------------------------
*/
mongoc_cursor_t *
mongoc_collection_find_with_opts (mongoc_collection_t *collection,
const bson_t *filter,
const bson_t *opts,
const mongoc_read_prefs_t *read_prefs)
{
BSON_ASSERT (collection);
BSON_ASSERT (filter);
bson_clear (&collection->gle);
if (!read_prefs) {
read_prefs = collection->read_prefs;
}
return _mongoc_cursor_new_with_opts (
collection->client, collection->ns, false /* is_command */, filter, opts,
COALESCE (read_prefs, collection->read_prefs), collection->read_concern);
}
/*
*--------------------------------------------------------------------------
*
* mongoc_collection_command --
*
* Executes a command on a cluster node matching @read_prefs. If
* @read_prefs is not provided, it will be run on the primary node.
*
* This function will always return a mongoc_cursor_t.
*
* Parameters:
* @collection: A mongoc_collection_t.
* @flags: Bitwise-or'd flags for command.
* @skip: Number of documents to skip, typically 0.
* @limit : Number of documents to return
* @batch_size : Batch size
* @query: The command to execute.
* @fields: The fields to return, or NULL.
* @read_prefs: Command read preferences or NULL.
*
* Returns:
* None.
*
* Side effects:
* None.
*
*--------------------------------------------------------------------------
*/
mongoc_cursor_t *
mongoc_collection_command (mongoc_collection_t *collection,
mongoc_query_flags_t flags,
uint32_t skip,
uint32_t limit,
uint32_t batch_size,
const bson_t *query,
const bson_t *fields,
const mongoc_read_prefs_t *read_prefs)
{
char ns[MONGOC_NAMESPACE_MAX];
BSON_ASSERT (collection);
BSON_ASSERT (query);
if (!read_prefs) {
read_prefs = collection->read_prefs;
}
bson_clear (&collection->gle);
if (NULL == strstr (collection->collection, "$cmd")) {
bson_snprintf (ns, sizeof ns, "%s", collection->db);
} else {
bson_snprintf (ns, sizeof ns, "%s.%s",
collection->db, collection->collection);
}
return mongoc_client_command (collection->client, ns, flags,
skip, limit, batch_size, query, fields, read_prefs);
}
bool
mongoc_collection_read_command_with_opts (mongoc_collection_t *collection,
const bson_t *command,
const mongoc_read_prefs_t *read_prefs,
const bson_t *opts,
bson_t *reply,
bson_error_t *error)
{
BSON_ASSERT (collection);
return _mongoc_client_command_with_opts (
collection->client,
collection->db,
command,
MONGOC_CMD_READ,
opts,
MONGOC_QUERY_NONE,
COALESCE (read_prefs, collection->read_prefs),
collection->read_concern,
collection->write_concern,
reply,
error);
}
bool
mongoc_collection_write_command_with_opts (
mongoc_collection_t *collection,
const bson_t *command,
const bson_t *opts,
bson_t *reply,
bson_error_t *error)
{
BSON_ASSERT (collection);
return _mongoc_client_command_with_opts (
collection->client,
collection->db,
command,
MONGOC_CMD_WRITE,
opts,
MONGOC_QUERY_NONE,
collection->read_prefs,
collection->read_concern,
collection->write_concern,
reply,
error);
}
bool
mongoc_collection_read_write_command_with_opts (mongoc_collection_t *collection,
const bson_t *command,
const mongoc_read_prefs_t *read_prefs,
const bson_t *opts,
bson_t *reply,
bson_error_t *error)
{
BSON_ASSERT (collection);
return _mongoc_client_command_with_opts (
collection->client,
collection->db,
command,
MONGOC_CMD_RW,
opts,
MONGOC_QUERY_NONE,
COALESCE (read_prefs, collection->read_prefs),
collection->read_concern,
collection->write_concern,
reply,
error);
}
bool
mongoc_collection_command_simple (mongoc_collection_t *collection,
const bson_t *command,
const mongoc_read_prefs_t *read_prefs,
bson_t *reply,
bson_error_t *error)
{
BSON_ASSERT (collection);
BSON_ASSERT (command);
bson_clear (&collection->gle);
return mongoc_client_command_simple (collection->client, collection->db,
command, read_prefs, reply, error);
}
/*
*--------------------------------------------------------------------------
*
* mongoc_collection_count --
*
* Count the number of documents matching @query.
*
* Parameters:
* @flags: A mongoc_query_flags_t describing the query flags or 0.
* @query: The query to perform or NULL for {}.
* @skip: The $skip to perform within the query or 0.
* @limit: The $limit to perform within the query or 0.
* @read_prefs: desired read preferences or NULL.
* @error: A location for an error or NULL.
*
* Returns:
* -1 on failure; otherwise the number of matching documents.
*
* Side effects:
* @error is set upon failure if non-NULL.
*
*--------------------------------------------------------------------------
*/
int64_t
mongoc_collection_count (mongoc_collection_t *collection, /* IN */
mongoc_query_flags_t flags, /* IN */
const bson_t *query, /* IN */
int64_t skip, /* IN */
int64_t limit, /* IN */
const mongoc_read_prefs_t *read_prefs, /* IN */
bson_error_t *error) /* OUT */
{
int64_t ret;
bson_t opts = BSON_INITIALIZER;
/* Complex types must be parts of `opts`, otherwise we can't
* follow various specs that require validation etc */
if (collection->read_concern->level != NULL) {
const bson_t *read_concern_bson;
read_concern_bson = _mongoc_read_concern_get_bson (collection->read_concern);
BSON_APPEND_DOCUMENT (&opts, "readConcern", read_concern_bson);
}
/* Server Selection Spec: "may-use-secondary" commands SHOULD take a read
* preference argument and otherwise MUST use the default read preference
* from client, database or collection configuration. */
ret = mongoc_collection_count_with_opts (
collection,
flags,
query,
skip,
limit,
&opts,
read_prefs,
error);
bson_destroy (&opts);
return ret;
}
int64_t
mongoc_collection_count_with_opts (mongoc_collection_t *collection, /* IN */
mongoc_query_flags_t flags, /* IN */
const bson_t *query, /* IN */
int64_t skip, /* IN */
int64_t limit, /* IN */
const bson_t *opts, /* IN */
const mongoc_read_prefs_t *read_prefs, /* IN */
bson_error_t *error) /* OUT */
{
bson_iter_t iter;
int64_t ret = -1;
bool success;
bson_t reply;
bson_t cmd = BSON_INITIALIZER;
bson_t q;
ENTRY;
BSON_ASSERT (collection);
bson_append_utf8(&cmd, "count", 5, collection->collection,
collection->collectionlen);
if (query) {
bson_append_document(&cmd, "query", 5, query);
} else {
bson_init(&q);
bson_append_document(&cmd, "query", 5, &q);
bson_destroy(&q);
}
if (limit) {
bson_append_int64(&cmd, "limit", 5, limit);
}
if (skip) {
bson_append_int64(&cmd, "skip", 4, skip);
}
success = _mongoc_client_command_with_opts (
collection->client,
collection->db,
&cmd,
MONGOC_CMD_READ,
opts,
flags,
COALESCE (read_prefs, collection->read_prefs),
collection->read_concern,
collection->write_concern,
&reply,
error);
if (success) {
if (bson_iter_init_find (&iter, &reply, "n")) {
ret = bson_iter_as_int64 (&iter);
}
}
bson_destroy (&reply);
bson_destroy (&cmd);
RETURN (ret);
}
/*
*--------------------------------------------------------------------------
*
* mongoc_collection_drop --
*
* Request the MongoDB server drop the collection.
*
* Returns:
* true if successful; otherwise false and @error is set.
*
* Side effects:
* @error is set upon failure.
*
*--------------------------------------------------------------------------
*/
bool
mongoc_collection_drop (mongoc_collection_t *collection, /* IN */
bson_error_t *error) /* OUT */
{
return mongoc_collection_drop_with_opts (collection,
NULL,
error);
}
bool
mongoc_collection_drop_with_opts (mongoc_collection_t *collection,
const bson_t *opts,
bson_error_t *error)
{
bool ret;
bson_t cmd;
BSON_ASSERT (collection);
bson_init (&cmd);
bson_append_utf8 (&cmd, "drop", 4, collection->collection,
collection->collectionlen);
ret = _mongoc_client_command_with_opts (collection->client,
collection->db,
&cmd,
MONGOC_CMD_WRITE,
opts,
MONGOC_QUERY_NONE,
collection->read_prefs,
collection->read_concern,
collection->write_concern,
NULL, /* reply */
error);
bson_destroy (&cmd);
return ret;
}
/*
*--------------------------------------------------------------------------
*
* mongoc_collection_drop_index --
*
* Request the MongoDB server drop the named index.
*
* Returns:
* true if successful; otherwise false and @error is set.
*
* Side effects:
* @error is setup upon failure if non-NULL.
*
*--------------------------------------------------------------------------
*/
bool
mongoc_collection_drop_index (mongoc_collection_t *collection, /* IN */
const char *index_name, /* IN */
bson_error_t *error) /* OUT */
{
return mongoc_collection_drop_index_with_opts (
collection, index_name, NULL, error);
}
bool
mongoc_collection_drop_index_with_opts (mongoc_collection_t *collection,
const char *index_name,
const bson_t *opts,
bson_error_t *error)
{
bool ret;
bson_t cmd;
BSON_ASSERT (collection);
BSON_ASSERT (index_name);
bson_init(&cmd);
bson_append_utf8(&cmd, "dropIndexes", -1, collection->collection,
collection->collectionlen);
bson_append_utf8(&cmd, "index", -1, index_name, -1);
ret = _mongoc_client_command_with_opts (collection->client,
collection->db,
&cmd,
MONGOC_CMD_WRITE,
opts,
MONGOC_QUERY_NONE,
collection->read_prefs,
collection->read_concern,
collection->write_concern,
NULL, /* reply */
error);
bson_destroy(&cmd);
return ret;
}
char *
mongoc_collection_keys_to_index_string (const bson_t *keys)
{
bson_string_t *s;
bson_iter_t iter;
int i = 0;
BSON_ASSERT (keys);
if (!bson_iter_init (&iter, keys)) {
return NULL;
}
s = bson_string_new (NULL);
while (bson_iter_next (&iter)) {
/* Index type can be specified as a string ("2d") or as an integer representing direction */
if (bson_iter_type(&iter) == BSON_TYPE_UTF8)
{
bson_string_append_printf (s,
(i++ ? "_%s_%s" : "%s_%s"),
bson_iter_key (&iter),
bson_iter_utf8 (&iter, NULL));
}
else
{
bson_string_append_printf (s,
(i++ ? "_%s_%d" : "%s_%d"),
bson_iter_key (&iter),
bson_iter_int32 (&iter));
}
}
return bson_string_free (s, false);
}
/*
*--------------------------------------------------------------------------
*
* _mongoc_collection_create_index_legacy --
*
* Request the MongoDB server create the named index.
*
* Returns:
* true if successful; otherwise false and @error is set.
*
* Side effects:
* @error is setup upon failure if non-NULL.
*
*--------------------------------------------------------------------------
*/
static bool
_mongoc_collection_create_index_legacy (mongoc_collection_t *collection,
const bson_t *keys,
const mongoc_index_opt_t *opt,
bson_error_t *error)
{
const mongoc_index_opt_t *def_opt;
mongoc_collection_t *col;
bool ret;
bson_t insert;
char *name;
BSON_ASSERT (collection);
/*
* TODO: this is supposed to be cached and cheap... make it that way
*/
def_opt = mongoc_index_opt_get_default ();
opt = opt ? opt : def_opt;
if (!opt->is_initialized) {
MONGOC_WARNING("Options have not yet been initialized");
return false;
}
bson_init (&insert);
bson_append_document (&insert, "key", -1, keys);
bson_append_utf8 (&insert, "ns", -1, collection->ns, -1);
if (opt->background != def_opt->background) {
bson_append_bool (&insert, "background", -1, opt->background);
}
if (opt->unique != def_opt->unique) {
bson_append_bool (&insert, "unique", -1, opt->unique);
}
if (opt->name != def_opt->name) {
bson_append_utf8 (&insert, "name", -1, opt->name, -1);
} else {
name = mongoc_collection_keys_to_index_string(keys);
if (!name) {
bson_set_error (error,
MONGOC_ERROR_BSON,
MONGOC_ERROR_BSON_INVALID,
"Cannot generate index name from invalid `keys` argument"
);
bson_destroy (&insert);
return false;
}
bson_append_utf8 (&insert, "name", -1, name, -1);
bson_free (name);
}
if (opt->drop_dups != def_opt->drop_dups) {
bson_append_bool (&insert, "dropDups", -1, opt->drop_dups);
}
if (opt->sparse != def_opt->sparse) {
bson_append_bool (&insert, "sparse", -1, opt->sparse);
}
if (opt->expire_after_seconds != def_opt->expire_after_seconds) {
bson_append_int32 (&insert,
"expireAfterSeconds", -1,
opt->expire_after_seconds);
}
if (opt->v != def_opt->v) {
bson_append_int32 (&insert, "v", -1, opt->v);
}
if (opt->weights != def_opt->weights) {
bson_append_document (&insert, "weights", -1, opt->weights);
}
if (opt->default_language != def_opt->default_language) {
bson_append_utf8 (&insert,
"default_language", -1,
opt->default_language, -1);
}
if (opt->language_override != def_opt->language_override) {
bson_append_utf8 (&insert,
"language_override", -1,
opt->language_override, -1);
}
col = mongoc_client_get_collection (collection->client, collection->db,
"system.indexes");
ret = mongoc_collection_insert (col,
(mongoc_insert_flags_t)MONGOC_INSERT_NO_VALIDATE,
&insert, NULL, error);
mongoc_collection_destroy(col);
bson_destroy (&insert);
return ret;
}
bool
mongoc_collection_create_index (mongoc_collection_t *collection,
const bson_t *keys,
const mongoc_index_opt_t *opt,
bson_error_t *error)
{
bson_t reply;
bool ret;
ret = mongoc_collection_create_index_with_opts (
collection, keys, opt, NULL, &reply, error);
bson_destroy (&reply);
return ret;
}
bool
mongoc_collection_create_index_with_opts (
mongoc_collection_t *collection,
const bson_t *keys,
const mongoc_index_opt_t *opt,
const bson_t *opts,
bson_t *reply,
bson_error_t *error)
{
const mongoc_index_opt_t *def_opt;
const mongoc_index_opt_geo_t *def_geo;
bson_error_t local_error;
const char *name;
bson_t cmd = BSON_INITIALIZER;
bson_t ar;
bson_t doc;
bson_t storage_doc;
bson_t wt_doc;
const mongoc_index_opt_geo_t *geo_opt;
const mongoc_index_opt_storage_t *storage_opt;
const mongoc_index_opt_wt_t *wt_opt;
char *alloc_name = NULL;
bool ret = false;
bool reply_initialized = false;
bool has_collation = false;
mongoc_server_stream_t *server_stream = NULL;
bson_iter_t iter;
ENTRY;
BSON_ASSERT (collection);
BSON_ASSERT (keys);
def_opt = mongoc_index_opt_get_default ();
opt = opt ? opt : def_opt;
/*
* Generate the key name if it was not provided.
*/
name = (opt->name != def_opt->name) ? opt->name : NULL;
if (!name) {
alloc_name = mongoc_collection_keys_to_index_string (keys);
if (alloc_name) {
name = alloc_name;
} else {
bson_set_error (error,
MONGOC_ERROR_BSON,
MONGOC_ERROR_BSON_INVALID,
"Cannot generate index name from invalid `keys` argument"
);
GOTO (done);
}
}
/*
* Build our createIndexes command to send to the server.
*/
BSON_APPEND_UTF8 (&cmd, "createIndexes", collection->collection);
bson_append_array_begin (&cmd, "indexes", 7, &ar);
bson_append_document_begin (&ar, "0", 1, &doc);
BSON_APPEND_DOCUMENT (&doc, "key", keys);
BSON_APPEND_UTF8 (&doc, "name", name);
if (opt->background) {
BSON_APPEND_BOOL (&doc, "background", true);
}
if (opt->unique) {
BSON_APPEND_BOOL (&doc, "unique", true);
}
if (opt->drop_dups) {
BSON_APPEND_BOOL (&doc, "dropDups", true);
}
if (opt->sparse) {
BSON_APPEND_BOOL (&doc, "sparse", true);
}
if (opt->expire_after_seconds != def_opt->expire_after_seconds) {
BSON_APPEND_INT32 (&doc, "expireAfterSeconds", opt->expire_after_seconds);
}
if (opt->v != def_opt->v) {
BSON_APPEND_INT32 (&doc, "v", opt->v);
}
if (opt->weights && (opt->weights != def_opt->weights)) {
BSON_APPEND_DOCUMENT (&doc, "weights", opt->weights);
}
if (opt->default_language != def_opt->default_language) {
BSON_APPEND_UTF8 (&doc, "default_language", opt->default_language);
}
if (opt->language_override != def_opt->language_override) {
BSON_APPEND_UTF8 (&doc, "language_override", opt->language_override);
}
if (opt->partial_filter_expression) {
BSON_APPEND_DOCUMENT (&doc, "partialFilterExpression", opt->partial_filter_expression);
}
if (opt->collation) {
BSON_APPEND_DOCUMENT (&doc, "collation", opt->collation);
has_collation = true;
}
if (opt->geo_options) {
geo_opt = opt->geo_options;
def_geo = mongoc_index_opt_geo_get_default ();
if (geo_opt->twod_sphere_version != def_geo->twod_sphere_version) {
BSON_APPEND_INT32 (&doc, "2dsphereIndexVersion", geo_opt->twod_sphere_version);
}
if (geo_opt->twod_bits_precision != def_geo->twod_bits_precision) {
BSON_APPEND_INT32 (&doc, "bits", geo_opt->twod_bits_precision);
}
if (geo_opt->twod_location_min != def_geo->twod_location_min) {
BSON_APPEND_DOUBLE (&doc, "min", geo_opt->twod_location_min);
}
if (geo_opt->twod_location_max != def_geo->twod_location_max) {
BSON_APPEND_DOUBLE (&doc, "max", geo_opt->twod_location_max);
}
if (geo_opt->haystack_bucket_size != def_geo->haystack_bucket_size) {
BSON_APPEND_DOUBLE (&doc, "bucketSize", geo_opt->haystack_bucket_size);
}
}
if (opt->storage_options) {
storage_opt = opt->storage_options;
switch (storage_opt->type) {
case MONGOC_INDEX_STORAGE_OPT_WIREDTIGER:
wt_opt = (mongoc_index_opt_wt_t *)storage_opt;
BSON_APPEND_DOCUMENT_BEGIN (&doc, "storageEngine", &storage_doc);
BSON_APPEND_DOCUMENT_BEGIN (&storage_doc, "wiredTiger", &wt_doc);
BSON_APPEND_UTF8 (&wt_doc, "configString", wt_opt->config_str);
bson_append_document_end (&storage_doc, &wt_doc);
bson_append_document_end (&doc, &storage_doc);
break;
default:
break;
}
}
bson_append_document_end (&ar, &doc);
bson_append_array_end (&cmd, &ar);
server_stream = mongoc_cluster_stream_for_reads (&collection->client->cluster, NULL, error);
if (opts && bson_iter_init (&iter, opts)) {
while (bson_iter_next (&iter)) {
if (BSON_ITER_IS_KEY (&iter, "writeConcern")) {
if (!_mongoc_write_concern_iter_is_valid (&iter)) {
bson_set_error (error,
MONGOC_ERROR_COMMAND,
MONGOC_ERROR_COMMAND_INVALID_ARG,
"Invalid writeConcern");
GOTO (done);
}
if (server_stream->sd->max_wire_version < WIRE_VERSION_CMD_WRITE_CONCERN) {
continue;
}
}
bson_append_iter (&cmd, bson_iter_key (&iter), -1, &iter);
}
}
if (has_collation && server_stream->sd->max_wire_version < WIRE_VERSION_COLLATION) {
bson_set_error (error,
MONGOC_ERROR_COMMAND,
MONGOC_ERROR_PROTOCOL_BAD_WIRE_VERSION,
"The selected server does not support collation");
GOTO (done);
}
ret = mongoc_cluster_run_command_monitored (
&collection->client->cluster, server_stream, MONGOC_QUERY_NONE, collection->db,
&cmd, reply, &local_error);
reply_initialized = true;
if (ret) {
if (reply) {
ret = !_mongoc_parse_wc_err (reply, error);
}
} else {
/*
* If we failed due to the command not being found, then use the legacy
* version which performs an insert into the system.indexes collection.
*/
if (local_error.code == MONGOC_ERROR_QUERY_COMMAND_NOT_FOUND) {
if (has_collation) {
bson_set_error (error,
MONGOC_ERROR_COMMAND,
MONGOC_ERROR_PROTOCOL_BAD_WIRE_VERSION,
"The selected server does not support collation");
}
ret = _mongoc_collection_create_index_legacy (collection, keys, opt,
error);
/* Clear the error reply from the first request */
if (reply) {
bson_reinit (reply);
}
} else if (error) {
memcpy (error, &local_error, sizeof *error);
}
}
done:
bson_destroy (&cmd);
bson_free (alloc_name);
mongoc_server_stream_cleanup (server_stream);
if (!reply_initialized && reply) {
bson_init (reply);
}
RETURN (ret);
}
bool
mongoc_collection_ensure_index (mongoc_collection_t *collection,
const bson_t *keys,
const mongoc_index_opt_t *opt,
bson_error_t *error)
{
return mongoc_collection_create_index (collection, keys, opt, error);
}
mongoc_cursor_t *
_mongoc_collection_find_indexes_legacy (mongoc_collection_t *collection,
bson_error_t *error)
{
mongoc_database_t *db;
mongoc_collection_t *idx_collection;
mongoc_read_prefs_t *read_prefs;
bson_t query = BSON_INITIALIZER;
mongoc_cursor_t *cursor;
BSON_ASSERT (collection);
BSON_APPEND_UTF8 (&query, "ns", collection->ns);
db = mongoc_client_get_database (collection->client, collection->db);
BSON_ASSERT (db);
idx_collection = mongoc_database_get_collection (db, "system.indexes");
BSON_ASSERT (idx_collection);
/* Index Enumeration Spec: "run listIndexes on the primary node". */
read_prefs = mongoc_read_prefs_new (MONGOC_READ_PRIMARY);
cursor = mongoc_collection_find_with_opts (idx_collection, &query, NULL,
read_prefs);
mongoc_read_prefs_destroy (read_prefs);
mongoc_collection_destroy (idx_collection);
mongoc_database_destroy (db);
return cursor;
}
mongoc_cursor_t *
mongoc_collection_find_indexes (mongoc_collection_t *collection,
bson_error_t *error)
{
mongoc_cursor_t *cursor;
bson_t cmd = BSON_INITIALIZER;
bson_t child;
BSON_ASSERT (collection);
bson_append_utf8 (&cmd, "listIndexes", -1, collection->collection,
collection->collectionlen);
BSON_APPEND_DOCUMENT_BEGIN (&cmd, "cursor", &child);
bson_append_document_end (&cmd, &child);
/* Set slaveOk but no read preference: Index Enumeration Spec says
* "listIndexes can be run on a secondary" when directly connected but
* "run listIndexes on the primary node in replicaSet mode". */
cursor = _mongoc_collection_cursor_new (collection, MONGOC_QUERY_SLAVE_OK);
_mongoc_cursor_cursorid_init (cursor, &cmd);
if (_mongoc_cursor_cursorid_prime (cursor)) {
/* intentionally empty */
} else {
if (mongoc_cursor_error (cursor, error)) {
mongoc_cursor_destroy (cursor);
if (error->code == MONGOC_ERROR_COLLECTION_DOES_NOT_EXIST) {
bson_t empty_arr = BSON_INITIALIZER;
/* collection does not exist. in accordance with the spec we return
* an empty array. Also we need to clear out the error. */
error->code = 0;
error->domain = 0;
cursor = _mongoc_collection_cursor_new (collection,
MONGOC_QUERY_SLAVE_OK);
_mongoc_cursor_array_init (cursor, NULL, NULL);
_mongoc_cursor_array_set_bson (cursor, &empty_arr);
} else if (error->code == MONGOC_ERROR_QUERY_COMMAND_NOT_FOUND) {
/* talking to an old server. */
/* clear out error. */
error->code = 0;
error->domain = 0;
cursor = _mongoc_collection_find_indexes_legacy (collection, error);
} else {
/* other error, to be handled by caller */
cursor = NULL;
}
}
}
bson_destroy (&cmd);
return cursor;
}
/*
*--------------------------------------------------------------------------
*
* mongoc_collection_insert_bulk --
*
* Bulk insert documents into a MongoDB collection.
*
* Parameters:
* @collection: A mongoc_collection_t.
* @flags: flags for the insert or 0.
* @documents: The documents to insert.
* @n_documents: The number of documents to insert.
* @write_concern: A write concern or NULL.
* @error: a location for an error or NULL.
*
* Returns:
* true if successful; otherwise false and @error is set.
*
* If the write concern does not dictate checking the result of the
* insert, then true may be returned even though the document was
* not actually inserted on the MongoDB server or cluster.
*
* Side effects:
* @collection->gle is setup, depending on write_concern->w value.
* @error may be set upon failure if non-NULL.
*
*--------------------------------------------------------------------------
*/
bool
mongoc_collection_insert_bulk (mongoc_collection_t *collection,
mongoc_insert_flags_t flags,
const bson_t **documents,
uint32_t n_documents,
const mongoc_write_concern_t *write_concern,
bson_error_t *error)
{
mongoc_write_command_t command;
mongoc_write_result_t result;
mongoc_bulk_write_flags_t write_flags = MONGOC_BULK_WRITE_FLAGS_INIT;
uint32_t i;
bool ret;
BSON_ASSERT (collection);
BSON_ASSERT (documents);
if (!write_concern) {
write_concern = collection->write_concern;
}
if (!(flags & MONGOC_INSERT_NO_VALIDATE)) {
int vflags = (BSON_VALIDATE_UTF8 | BSON_VALIDATE_UTF8_ALLOW_NULL
| BSON_VALIDATE_DOLLAR_KEYS | BSON_VALIDATE_DOT_KEYS);
for (i = 0; i < n_documents; i++) {
if (!bson_validate (documents[i], (bson_validate_flags_t)vflags, NULL)) {
bson_set_error (error,
MONGOC_ERROR_BSON,
MONGOC_ERROR_BSON_INVALID,
"A document was corrupt or contained "
"invalid characters . or $");
RETURN (false);
}
}
}
bson_clear (&collection->gle);
_mongoc_write_result_init (&result);
write_flags.ordered = !(flags & MONGOC_INSERT_CONTINUE_ON_ERROR);
_mongoc_write_command_init_insert (&command, NULL, write_flags,
++collection->client->cluster.operation_id,
true);
for (i = 0; i < n_documents; i++) {
_mongoc_write_command_insert_append (&command, documents[i]);
}
_mongoc_collection_write_command_execute (&command, collection,
write_concern, &result);
collection->gle = bson_new ();
ret = _mongoc_write_result_complete (&result,
collection->client->error_api_version,
write_concern,
/* no error domain override */
(mongoc_error_domain_t) 0,
collection->gle,
error);
_mongoc_write_result_destroy (&result);
_mongoc_write_command_destroy (&command);
return ret;
}
/*
*--------------------------------------------------------------------------
*
* mongoc_collection_insert --
*
* Insert a document into a MongoDB collection.
*
* Parameters:
* @collection: A mongoc_collection_t.
* @flags: flags for the insert or 0.
* @document: The document to insert.
* @write_concern: A write concern or NULL.
* @error: a location for an error or NULL.
*
* Returns:
* true if successful; otherwise false and @error is set.
*
* If the write concern does not dictate checking the result of the
* insert, then true may be returned even though the document was
* not actually inserted on the MongoDB server or cluster.
*
* Side effects:
* @collection->gle is setup, depending on write_concern->w value.
* @error may be set upon failure if non-NULL.
*
*--------------------------------------------------------------------------
*/
bool
mongoc_collection_insert (mongoc_collection_t *collection,
mongoc_insert_flags_t flags,
const bson_t *document,
const mongoc_write_concern_t *write_concern,
bson_error_t *error)
{
mongoc_bulk_write_flags_t write_flags = MONGOC_BULK_WRITE_FLAGS_INIT;
mongoc_write_command_t command;
mongoc_write_result_t result;
bool ret;
ENTRY;
BSON_ASSERT (collection);
BSON_ASSERT (document);
bson_clear (&collection->gle);
if (!write_concern) {
write_concern = collection->write_concern;
}
if (!(flags & MONGOC_INSERT_NO_VALIDATE)) {
int vflags = (BSON_VALIDATE_UTF8 | BSON_VALIDATE_UTF8_ALLOW_NULL
| BSON_VALIDATE_DOLLAR_KEYS | BSON_VALIDATE_DOT_KEYS);
if (!bson_validate (document, (bson_validate_flags_t)vflags, NULL)) {
bson_set_error (error,
MONGOC_ERROR_BSON,
MONGOC_ERROR_BSON_INVALID,
"A document was corrupt or contained "
"invalid characters . or $");
RETURN (false);
}
}
_mongoc_write_result_init (&result);
_mongoc_write_command_init_insert (&command, document, write_flags,
++collection->client->cluster.operation_id,
false);
_mongoc_collection_write_command_execute (&command, collection,
write_concern, &result);
collection->gle = bson_new ();
ret = _mongoc_write_result_complete (&result,
collection->client->error_api_version,
write_concern,
/* no error domain override */
(mongoc_error_domain_t) 0,
collection->gle,
error);
_mongoc_write_result_destroy (&result);
_mongoc_write_command_destroy (&command);
RETURN (ret);
}
/*
*--------------------------------------------------------------------------
*
* mongoc_collection_update --
*
* Updates one or more documents matching @selector with @update.
*
* Parameters:
* @collection: A mongoc_collection_t.
* @flags: The flags for the update.
* @selector: A bson_t containing your selector.
* @update: A bson_t containing your update document.
* @write_concern: The write concern or NULL.
* @error: A location for an error or NULL.
*
* Returns:
* true if successful; otherwise false and @error is set.
*
* Side effects:
* @collection->gle is setup, depending on write_concern->w value.
* @error is setup upon failure.
*
*--------------------------------------------------------------------------
*/
bool
mongoc_collection_update (mongoc_collection_t *collection,
mongoc_update_flags_t uflags,
const bson_t *selector,
const bson_t *update,
const mongoc_write_concern_t *write_concern,
bson_error_t *error)
{
mongoc_bulk_write_flags_t write_flags = MONGOC_BULK_WRITE_FLAGS_INIT;
mongoc_write_command_t command;
mongoc_write_result_t result;
bson_iter_t iter;
size_t err_offset;
bool ret;
int vflags = (BSON_VALIDATE_UTF8 | BSON_VALIDATE_UTF8_ALLOW_NULL
| BSON_VALIDATE_DOLLAR_KEYS | BSON_VALIDATE_DOT_KEYS);
int flags = uflags;
bson_t opts;
ENTRY;
BSON_ASSERT (collection);
BSON_ASSERT (selector);
BSON_ASSERT (update);
bson_clear (&collection->gle);
if (!write_concern) {
write_concern = collection->write_concern;
}
if (!((uint32_t)flags & MONGOC_UPDATE_NO_VALIDATE) &&
bson_iter_init (&iter, update) &&
bson_iter_next (&iter) &&
(bson_iter_key (&iter) [0] != '$') &&
!bson_validate (update, (bson_validate_flags_t)vflags, &err_offset)) {
bson_set_error (error,
MONGOC_ERROR_BSON,
MONGOC_ERROR_BSON_INVALID,
"update document is corrupt or contains "
"invalid keys including $ or .");
return false;
} else {
flags = (uint32_t)flags & ~MONGOC_UPDATE_NO_VALIDATE;
}
bson_init (&opts);
BSON_APPEND_BOOL (&opts, "upsert", !!(flags & MONGOC_UPDATE_UPSERT));
BSON_APPEND_BOOL (&opts, "multi", !!(flags & MONGOC_UPDATE_MULTI_UPDATE));
_mongoc_write_result_init (&result);
_mongoc_write_command_init_update (&command,
selector,
update,
&opts,
write_flags,
++collection->client->cluster.operation_id);
bson_destroy (&opts);
_mongoc_collection_write_command_execute (&command, collection,
write_concern, &result);
collection->gle = bson_new ();
ret = _mongoc_write_result_complete (&result,
collection->client->error_api_version,
write_concern,
/* no error domain override */
(mongoc_error_domain_t) 0,
collection->gle,
error);
_mongoc_write_result_destroy (&result);
_mongoc_write_command_destroy (&command);
RETURN (ret);
}
/*
*--------------------------------------------------------------------------
*
* mongoc_collection_save --
*
* Save @document to @collection.
*
* If the document has an _id field, it will be updated. Otherwise,
* the document will be inserted into the collection.
*
* Returns:
* true if successful; otherwise false and @error is set.
*
* Side effects:
* @error is set upon failure if non-NULL.
*
*--------------------------------------------------------------------------
*/
bool
mongoc_collection_save (mongoc_collection_t *collection,
const bson_t *document,
const mongoc_write_concern_t *write_concern,
bson_error_t *error)
{
bson_iter_t iter;
bool ret;
bson_t selector;
BSON_ASSERT (collection);
BSON_ASSERT (document);
if (!bson_iter_init_find(&iter, document, "_id")) {
return mongoc_collection_insert(collection,
MONGOC_INSERT_NONE,
document,
write_concern,
error);
}
bson_init(&selector);
if (!bson_append_iter(&selector, NULL, 0, &iter)) {
bson_set_error (error,
MONGOC_ERROR_COMMAND,
MONGOC_ERROR_COMMAND_INVALID_ARG,
"Failed to append bson to create update.");
bson_destroy (&selector);
return false;
}
ret = mongoc_collection_update(collection,
MONGOC_UPDATE_UPSERT,
&selector,
document,
write_concern,
error);
bson_destroy(&selector);
return ret;
}
/*
*--------------------------------------------------------------------------
*
* mongoc_collection_remove --
*
* Delete one or more items from a collection. If you want to
* limit to a single delete, provided MONGOC_REMOVE_SINGLE_REMOVE
* for @flags.
*
* Parameters:
* @collection: A mongoc_collection_t.
* @flags: the delete flags or 0.
* @selector: A selector of documents to delete.
* @write_concern: A write concern or NULL. If NULL, the default
* write concern for the collection will be used.
* @error: A location for an error or NULL.
*
* Returns:
* true if successful; otherwise false and error is set.
*
* If the write concern does not dictate checking the result, this
* function may return true even if it failed.
*
* Side effects:
* @collection->gle is setup, depending on write_concern->w value.
* @error is setup upon failure.
*
*--------------------------------------------------------------------------
*/
bool
mongoc_collection_remove (mongoc_collection_t *collection,
mongoc_remove_flags_t flags,
const bson_t *selector,
const mongoc_write_concern_t *write_concern,
bson_error_t *error)
{
mongoc_bulk_write_flags_t write_flags = MONGOC_BULK_WRITE_FLAGS_INIT;
mongoc_write_command_t command;
mongoc_write_result_t result;
bson_t opts;
bool ret;
ENTRY;
BSON_ASSERT (collection);
BSON_ASSERT (selector);
bson_clear (&collection->gle);
if (!write_concern) {
write_concern = collection->write_concern;
}
bson_init (&opts);
BSON_APPEND_INT32 (&opts, "limit", flags & MONGOC_REMOVE_SINGLE_REMOVE ? 1 : 0);
_mongoc_write_result_init (&result);
_mongoc_write_command_init_delete (&command, selector, &opts, write_flags,
++collection->client->cluster.operation_id);
bson_destroy (&opts);
_mongoc_collection_write_command_execute (&command, collection,
write_concern, &result);
collection->gle = bson_new ();
ret = _mongoc_write_result_complete (&result,
collection->client->error_api_version,
write_concern,
0 /* no error domain override */,
collection->gle,
error);
_mongoc_write_result_destroy (&result);
_mongoc_write_command_destroy (&command);
RETURN (ret);
}
bool
mongoc_collection_delete (mongoc_collection_t *collection,
mongoc_delete_flags_t flags,
const bson_t *selector,
const mongoc_write_concern_t *write_concern,
bson_error_t *error)
{
return mongoc_collection_remove (collection, (mongoc_remove_flags_t)flags,
selector, write_concern, error);
}
/*
*--------------------------------------------------------------------------
*
* mongoc_collection_get_read_prefs --
*
* Fetch the default read preferences for the collection.
*
* Returns:
* A mongoc_read_prefs_t that should not be modified or freed.
*
* Side effects:
* None.
*
*--------------------------------------------------------------------------
*/
const mongoc_read_prefs_t *
mongoc_collection_get_read_prefs (const mongoc_collection_t *collection)
{
BSON_ASSERT (collection);
return collection->read_prefs;
}
/*
*--------------------------------------------------------------------------
*
* mongoc_collection_set_read_prefs --
*
* Sets the default read preferences for the collection instance.
*
* Returns:
* None.
*
* Side effects:
* None.
*
*--------------------------------------------------------------------------
*/
void
mongoc_collection_set_read_prefs (mongoc_collection_t *collection,
const mongoc_read_prefs_t *read_prefs)
{
BSON_ASSERT (collection);
if (collection->read_prefs) {
mongoc_read_prefs_destroy(collection->read_prefs);
collection->read_prefs = NULL;
}
if (read_prefs) {
collection->read_prefs = mongoc_read_prefs_copy(read_prefs);
}
}
/*
*--------------------------------------------------------------------------
*
* mongoc_collection_get_read_concern --
*
* Fetches the default read concern for the collection instance.
*
* Returns:
* A mongoc_read_concern_t that should not be modified or freed.
*
* Side effects:
* None.
*
*--------------------------------------------------------------------------
*/
const mongoc_read_concern_t *
mongoc_collection_get_read_concern (const mongoc_collection_t *collection)
{
BSON_ASSERT (collection);
return collection->read_concern;
}
/*
*--------------------------------------------------------------------------
*
* mongoc_collection_set_read_concern --
*
* Sets the default read concern for the collection instance.
*
* Returns:
* None.
*
* Side effects:
* None.
*
*--------------------------------------------------------------------------
*/
void
mongoc_collection_set_read_concern (mongoc_collection_t *collection,
const mongoc_read_concern_t *read_concern)
{
BSON_ASSERT (collection);
if (collection->read_concern) {
mongoc_read_concern_destroy (collection->read_concern);
collection->read_concern = NULL;
}
if (read_concern) {
collection->read_concern = mongoc_read_concern_copy (read_concern);
}
}
/*
*--------------------------------------------------------------------------
*
* mongoc_collection_get_write_concern --
*
* Fetches the default write concern for the collection instance.
*
* Returns:
* A mongoc_write_concern_t that should not be modified or freed.
*
* Side effects:
* None.
*
*--------------------------------------------------------------------------
*/
const mongoc_write_concern_t *
mongoc_collection_get_write_concern (const mongoc_collection_t *collection)
{
BSON_ASSERT (collection);
return collection->write_concern;
}
/*
*--------------------------------------------------------------------------
*
* mongoc_collection_set_write_concern --
*
* Sets the default write concern for the collection instance.
*
* Returns:
* None.
*
* Side effects:
* None.
*
*--------------------------------------------------------------------------
*/
void
mongoc_collection_set_write_concern (mongoc_collection_t *collection,
const mongoc_write_concern_t *write_concern)
{
BSON_ASSERT (collection);
if (collection->write_concern) {
mongoc_write_concern_destroy(collection->write_concern);
collection->write_concern = NULL;
}
if (write_concern) {
collection->write_concern = mongoc_write_concern_copy(write_concern);
}
}
/*
*--------------------------------------------------------------------------
*
* mongoc_collection_get_name --
*
* Returns the name of the collection, excluding the database name.
*
* Returns:
* A string which should not be modified or freed.
*
* Side effects:
* None.
*
*--------------------------------------------------------------------------
*/
const char *
mongoc_collection_get_name (mongoc_collection_t *collection)
{
BSON_ASSERT (collection);
return collection->collection;
}
/*
*--------------------------------------------------------------------------
*
* mongoc_collection_get_last_error --
*
* Returns a bulk result.
*
* Returns:
* NULL or a bson_t that should not be modified or freed. This value
* is not guaranteed to be persistent between calls into the
* mongoc_collection_t instance, and therefore must be copied if
* you would like to keep it around.
*
* Side effects:
* None.
*
*--------------------------------------------------------------------------
*/
const bson_t *
mongoc_collection_get_last_error (const mongoc_collection_t *collection) /* IN */
{
BSON_ASSERT (collection);
return collection->gle;
}
/*
*--------------------------------------------------------------------------
*
* mongoc_collection_validate --
*
* Helper to call the validate command on the MongoDB server to
* validate the collection.
*
* Options may be additional options, or NULL.
* Currently supported options are:
*
* "full": Boolean
*
* If full is true, then perform a more resource intensive
* validation.
*
* The result is stored in reply.
*
* Returns:
* true if successful; otherwise false and @error is set.
*
* Side effects:
* @reply is set if successful.
* @error may be set.
*
*--------------------------------------------------------------------------
*/
bool
mongoc_collection_validate (mongoc_collection_t *collection, /* IN */
const bson_t *options, /* IN */
bson_t *reply, /* OUT */
bson_error_t *error) /* IN */
{
bson_iter_t iter;
bson_t cmd = BSON_INITIALIZER;
bool ret = false;
bool reply_initialized = false;
BSON_ASSERT (collection);
if (options &&
bson_iter_init_find (&iter, options, "full") &&
!BSON_ITER_HOLDS_BOOL (&iter)) {
bson_set_error (error,
MONGOC_ERROR_BSON,
MONGOC_ERROR_BSON_INVALID,
"'full' must be a boolean value.");
goto cleanup;
}
bson_append_utf8 (&cmd, "validate", 8,
collection->collection,
collection->collectionlen);
if (options) {
bson_concat (&cmd, options);
}
ret = mongoc_collection_command_simple (collection, &cmd, NULL, reply, error);
reply_initialized = true;
cleanup:
bson_destroy (&cmd);
if (reply && !reply_initialized) {
bson_init (reply);
}
return ret;
}
/*
*--------------------------------------------------------------------------
*
* mongoc_collection_rename --
*
* Rename the collection to @new_name.
*
* If @new_db is NULL, the same db will be used.
*
* If @drop_target_before_rename is true, then a collection named
* @new_name will be dropped before renaming @collection to
* @new_name.
*
* Returns:
* true on success; false on failure and @error is set.
*
* Side effects:
* @error is set on failure.
*
*--------------------------------------------------------------------------
*/
bool
mongoc_collection_rename (mongoc_collection_t *collection,
const char *new_db,
const char *new_name,
bool drop_target_before_rename,
bson_error_t *error)
{
return mongoc_collection_rename_with_opts (collection,
new_db,
new_name,
drop_target_before_rename,
NULL,
error);
}
bool
mongoc_collection_rename_with_opts (
mongoc_collection_t *collection,
const char *new_db,
const char *new_name,
bool drop_target_before_rename,
const bson_t *opts,
bson_error_t *error)
{
bson_t cmd = BSON_INITIALIZER;
char newns [MONGOC_NAMESPACE_MAX + 1];
bool ret;
BSON_ASSERT (collection);
BSON_ASSERT (new_name);
if (strchr (new_name, '$')) {
bson_set_error (error,
MONGOC_ERROR_NAMESPACE,
MONGOC_ERROR_NAMESPACE_INVALID,
"\"%s\" is an invalid collection name.",
new_name);
return false;
}
bson_snprintf (newns, sizeof newns, "%s.%s",
new_db ? new_db : collection->db,
new_name);
BSON_APPEND_UTF8 (&cmd, "renameCollection", collection->ns);
BSON_APPEND_UTF8 (&cmd, "to", newns);
if (drop_target_before_rename) {
BSON_APPEND_BOOL (&cmd, "dropTarget", true);
}
ret = _mongoc_client_command_with_opts (collection->client,
"admin",
&cmd,
MONGOC_CMD_WRITE,
opts,
MONGOC_QUERY_NONE,
collection->read_prefs,
collection->read_concern,
collection->write_concern,
NULL, /* reply */
error);
if (ret) {
if (new_db) {
bson_snprintf (collection->db, sizeof collection->db, "%s", new_db);
}
bson_snprintf (collection->collection, sizeof collection->collection,
"%s", new_name);
collection->collectionlen = (int) strlen (collection->collection);
bson_snprintf (collection->ns, sizeof collection->ns,
"%s.%s", collection->db, new_name);
collection->nslen = (int) strlen (collection->ns);
}
bson_destroy (&cmd);
return ret;
}
/*
*--------------------------------------------------------------------------
*
* mongoc_collection_stats --
*
* Fetches statistics about the collection.
*
* The result is stored in @stats, which should NOT be an initialized
* bson_t or a leak will occur.
*
* @stats, @options, and @error are optional.
*
* Returns:
* true on success and @stats is set.
* false on failure and @error is set.
*
* Side effects:
* @stats and @error.
*
*--------------------------------------------------------------------------
*/
bool
mongoc_collection_stats (mongoc_collection_t *collection,
const bson_t *options,
bson_t *stats,
bson_error_t *error)
{
bson_iter_t iter;
bson_t cmd = BSON_INITIALIZER;
bool ret;
BSON_ASSERT (collection);
if (options &&
bson_iter_init_find (&iter, options, "scale") &&
!BSON_ITER_HOLDS_INT32 (&iter)) {
bson_set_error (error,
MONGOC_ERROR_BSON,
MONGOC_ERROR_BSON_INVALID,
"'scale' must be an int32 value.");
return false;
}
BSON_APPEND_UTF8 (&cmd, "collStats", collection->collection);
if (options) {
bson_concat (&cmd, options);
}
/* Server Selection Spec: "may-use-secondary" commands SHOULD take a read
* preference argument and otherwise MUST use the default read preference
* from client, database or collection configuration. */
ret = mongoc_collection_command_simple (collection, &cmd,
collection->read_prefs,
stats, error);
bson_destroy (&cmd);
return ret;
}
mongoc_bulk_operation_t *
mongoc_collection_create_bulk_operation (
mongoc_collection_t *collection,
bool ordered,
const mongoc_write_concern_t *write_concern)
{
mongoc_bulk_write_flags_t write_flags = MONGOC_BULK_WRITE_FLAGS_INIT;
BSON_ASSERT (collection);
if (!write_concern) {
write_concern = collection->write_concern;
}
write_flags.ordered = ordered;
return _mongoc_bulk_operation_new (collection->client,
collection->db,
collection->collection,
write_flags,
write_concern);
}
/*
*--------------------------------------------------------------------------
*
* mongoc_collection_find_and_modify_with_opts --
*
* Find a document in @collection matching @query, applying @opts.
*
* If @reply is not NULL, then the result document will be placed
* in reply and should be released with bson_destroy().
*
* See http://docs.mongodb.org/manual/reference/command/findAndModify/
* for more information.
*
* Returns:
* true on success; false on failure.
*
* Side effects:
* reply is initialized.
* error is set if false is returned.
*
*--------------------------------------------------------------------------
*/
bool
mongoc_collection_find_and_modify_with_opts (mongoc_collection_t *collection,
const bson_t *query,
const mongoc_find_and_modify_opts_t *opts,
bson_t *reply,
bson_error_t *error)
{
mongoc_cluster_t *cluster;
mongoc_server_stream_t *server_stream;
bson_iter_t iter;
bson_iter_t inner;
const char *name;
bson_t reply_local;
bson_t *reply_ptr;
bool ret;
bson_t command = BSON_INITIALIZER;
ENTRY;
BSON_ASSERT (collection);
BSON_ASSERT (query);
reply_ptr = reply ? reply : &reply_local;
bson_init (reply_ptr);
cluster = &collection->client->cluster;
server_stream = mongoc_cluster_stream_for_writes (cluster, error);
if (!server_stream) {
bson_destroy (&command);
RETURN (false);
}
name = mongoc_collection_get_name (collection);
BSON_APPEND_UTF8 (&command, "findAndModify", name);
BSON_APPEND_DOCUMENT (&command, "query", query);
if (opts->sort) {
BSON_APPEND_DOCUMENT (&command, "sort", opts->sort);
}
if (opts->update) {
BSON_APPEND_DOCUMENT (&command, "update", opts->update);
}
if (opts->fields) {
BSON_APPEND_DOCUMENT (&command, "fields", opts->fields);
}
if (opts->flags & MONGOC_FIND_AND_MODIFY_REMOVE) {
BSON_APPEND_BOOL (&command, "remove", true);
}
if (opts->flags & MONGOC_FIND_AND_MODIFY_UPSERT) {
BSON_APPEND_BOOL (&command, "upsert", true);
}
if (opts->flags & MONGOC_FIND_AND_MODIFY_RETURN_NEW) {
BSON_APPEND_BOOL (&command, "new", true);
}
if (opts->bypass_document_validation != MONGOC_BYPASS_DOCUMENT_VALIDATION_DEFAULT) {
BSON_APPEND_BOOL (&command, "bypassDocumentValidation",
!!opts->bypass_document_validation);
}
if (opts->max_time_ms > 0) {
BSON_APPEND_INT32 (&command, "maxTimeMS", opts->max_time_ms);
}
if (server_stream->sd->max_wire_version >= WIRE_VERSION_FAM_WRITE_CONCERN) {
if (!mongoc_write_concern_is_valid (collection->write_concern)) {
bson_set_error (error,
MONGOC_ERROR_COMMAND,
MONGOC_ERROR_COMMAND_INVALID_ARG,
"The write concern is invalid.");
bson_destroy (&command);
mongoc_server_stream_cleanup (server_stream);
RETURN (false);
}
if (mongoc_write_concern_is_acknowledged (collection->write_concern)) {
_BSON_APPEND_WRITE_CONCERN (&command, collection->write_concern);
}
}
if (bson_iter_init (&iter, &opts->extra)) {
bool ok = _mongoc_client_command_append_iterator_opts_to_command (
&iter, server_stream->sd->max_wire_version, &command, error
);
if (!ok) {
bson_destroy (&command);
mongoc_server_stream_cleanup (server_stream);
RETURN (false);
}
}
ret = mongoc_cluster_run_command_monitored (cluster, server_stream,
MONGOC_QUERY_NONE,
collection->db, &command,
reply_ptr, error);
if (bson_iter_init_find (&iter, reply_ptr, "writeConcernError") &&
BSON_ITER_HOLDS_DOCUMENT (&iter)) {
const char *errmsg = NULL;
int32_t code = 0;
bson_iter_recurse(&iter, &inner);
while (bson_iter_next (&inner)) {
if (BSON_ITER_IS_KEY (&inner, "code")) {
code = bson_iter_int32 (&inner);
} else if (BSON_ITER_IS_KEY (&inner, "errmsg")) {
errmsg = bson_iter_utf8 (&inner, NULL);
}
}
bson_set_error (error, MONGOC_ERROR_WRITE_CONCERN, code, "Write Concern error: %s", errmsg);
ret = false;
}
if (reply_ptr == &reply_local) {
bson_destroy (reply_ptr);
}
bson_destroy (&command);
mongoc_server_stream_cleanup (server_stream);
RETURN (ret);
}
/*
*--------------------------------------------------------------------------
*
* mongoc_collection_find_and_modify --
*
* Find a document in @collection matching @query and update it with
* the update document @update.
*
* If @reply is not NULL, then the result document will be placed
* in reply and should be released with bson_destroy().
*
* If @remove is true, then the matching documents will be removed.
*
* If @fields is not NULL, it will be used to select the desired
* resulting fields.
*
* If @_new is true, then the new version of the document is returned
* instead of the old document.
*
* See http://docs.mongodb.org/manual/reference/command/findAndModify/
* for more information.
*
* Returns:
* true on success; false on failure.
*
* Side effects:
* reply is initialized.
* error is set if false is returned.
*
*--------------------------------------------------------------------------
*/
bool
mongoc_collection_find_and_modify (mongoc_collection_t *collection,
const bson_t *query,
const bson_t *sort,
const bson_t *update,
const bson_t *fields,
bool _remove,
bool upsert,
bool _new,
bson_t *reply,
bson_error_t *error)
{
mongoc_find_and_modify_opts_t *opts;
int flags = 0;
bool ret;
ENTRY;
BSON_ASSERT (collection);
BSON_ASSERT (query);
BSON_ASSERT (update || _remove);
if (_remove) {
flags |= MONGOC_FIND_AND_MODIFY_REMOVE;
}
if (upsert) {
flags |= MONGOC_FIND_AND_MODIFY_UPSERT;
}
if (_new) {
flags |= MONGOC_FIND_AND_MODIFY_RETURN_NEW;
}
opts = mongoc_find_and_modify_opts_new ();
mongoc_find_and_modify_opts_set_sort (opts, sort);
mongoc_find_and_modify_opts_set_update (opts, update);
mongoc_find_and_modify_opts_set_fields (opts, fields);
mongoc_find_and_modify_opts_set_flags (opts, flags);
ret = mongoc_collection_find_and_modify_with_opts (collection, query, opts, reply, error);
mongoc_find_and_modify_opts_destroy (opts);
return ret;
}
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-collection.h b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-collection.h
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-collection.h
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-collection.h
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-config.h b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-config.h
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-config.h
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-config.h
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-config.h.in b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-config.h.in
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-config.h.in
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-config.h.in
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-counters-private.h b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-counters-private.h
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-counters-private.h
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-counters-private.h
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-counters.c b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-counters.c
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-counters.c
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-counters.c
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-counters.defs b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-counters.defs
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-counters.defs
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-counters.defs
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-crypto-cng-private.h b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-crypto-cng-private.h
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-crypto-cng-private.h
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-crypto-cng-private.h
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-crypto-cng.c b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-crypto-cng.c
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-crypto-cng.c
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-crypto-cng.c
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-crypto-cng.h b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-crypto-cng.h
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-crypto-cng.h
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-crypto-cng.h
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-crypto-common-crypto-private.h b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-crypto-common-crypto-private.h
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-crypto-common-crypto-private.h
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-crypto-common-crypto-private.h
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-crypto-common-crypto.c b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-crypto-common-crypto.c
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-crypto-common-crypto.c
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-crypto-common-crypto.c
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-crypto-openssl-private.h b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-crypto-openssl-private.h
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-crypto-openssl-private.h
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-crypto-openssl-private.h
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-crypto-openssl.c b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-crypto-openssl.c
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-crypto-openssl.c
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-crypto-openssl.c
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-crypto-private.h b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-crypto-private.h
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-crypto-private.h
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-crypto-private.h
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-crypto.c b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-crypto.c
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-crypto.c
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-crypto.c
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-cursor-array-private.h b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-cursor-array-private.h
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-cursor-array-private.h
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-cursor-array-private.h
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-cursor-array.c b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-cursor-array.c
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-cursor-array.c
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-cursor-array.c
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-cursor-cursorid-private.h b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-cursor-cursorid-private.h
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-cursor-cursorid-private.h
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-cursor-cursorid-private.h
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-cursor-cursorid.c b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-cursor-cursorid.c
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-cursor-cursorid.c
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-cursor-cursorid.c
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-cursor-private.h b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-cursor-private.h
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-cursor-private.h
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-cursor-private.h
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-cursor-transform-private.h b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-cursor-transform-private.h
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-cursor-transform-private.h
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-cursor-transform-private.h
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-cursor-transform.c b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-cursor-transform.c
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-cursor-transform.c
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-cursor-transform.c
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-cursor.c b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-cursor.c
similarity index 99%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-cursor.c
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-cursor.c
index 700b60a0..c828b40d 100644
--- a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-cursor.c
+++ b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-cursor.c
@@ -1,2115 +1,2108 @@
/*
* Copyright 2013 MongoDB, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "mongoc-cursor.h"
#include "mongoc-cursor-private.h"
#include "mongoc-client-private.h"
#include "mongoc-counters-private.h"
#include "mongoc-error.h"
#include "mongoc-log.h"
#include "mongoc-trace-private.h"
#include "mongoc-cursor-cursorid-private.h"
#include "mongoc-read-concern-private.h"
#include "mongoc-util-private.h"
#include "mongoc-write-concern-private.h"
#undef MONGOC_LOG_DOMAIN
#define MONGOC_LOG_DOMAIN "cursor"
#define CURSOR_FAILED(cursor_) ((cursor_)->error.domain != 0)
static bool
_translate_query_opt (const char *query_field,
const char **cmd_field,
int *len);
static const bson_t *
_mongoc_cursor_op_query (mongoc_cursor_t *cursor,
mongoc_server_stream_t *server_stream);
static bool
_mongoc_cursor_prepare_find_command (mongoc_cursor_t *cursor,
bson_t *command,
mongoc_server_stream_t *server_stream);
static const bson_t *
_mongoc_cursor_find_command (mongoc_cursor_t *cursor,
mongoc_server_stream_t *server_stream);
static bool
_mongoc_cursor_set_opt_int64 (mongoc_cursor_t *cursor,
const char *option,
int64_t value)
{
bson_iter_t iter;
if (bson_iter_init_find (&iter, &cursor->opts, option)) {
if (!BSON_ITER_HOLDS_INT64 (&iter)) {
return false;
}
bson_iter_overwrite_int64 (&iter, value);
return true;
}
return BSON_APPEND_INT64 (&cursor->opts, option, value);
}
static int64_t
_mongoc_cursor_get_opt_int64 (const mongoc_cursor_t *cursor,
const char *option,
int64_t default_value)
{
bson_iter_t iter;
if (bson_iter_init_find (&iter, &cursor->opts, option)) {
return bson_iter_as_int64 (&iter);
}
return default_value;
}
static bool
_mongoc_cursor_set_opt_bool (mongoc_cursor_t *cursor,
const char *option,
bool value)
{
bson_iter_t iter;
if (bson_iter_init_find (&iter, &cursor->opts, option)) {
if (!BSON_ITER_HOLDS_BOOL (&iter)) {
return false;
}
bson_iter_overwrite_bool (&iter, value);
return true;
}
return BSON_APPEND_BOOL (&cursor->opts, option, value);
}
bool
_mongoc_cursor_get_opt_bool (const mongoc_cursor_t *cursor,
const char *option)
{
bson_iter_t iter;
if (bson_iter_init_find (&iter, &cursor->opts, option)) {
return bson_iter_as_bool (&iter);
}
return false;
}
int32_t
_mongoc_n_return (mongoc_cursor_t * cursor)
{
int64_t limit;
int64_t batch_size;
int64_t n_return;
if (cursor->is_command) {
/* commands always have n_return of 1 */
return 1;
}
limit = mongoc_cursor_get_limit (cursor);
batch_size = mongoc_cursor_get_batch_size (cursor);
if (limit < 0) {
n_return = limit;
} else if (limit) {
int64_t remaining = limit - cursor->count;
BSON_ASSERT (remaining > 0);
if (batch_size) {
n_return = BSON_MIN (batch_size, remaining);
} else {
/* batch_size 0 means accept the default */
n_return = remaining;
}
} else {
n_return = batch_size;
}
if (n_return < INT32_MIN) {
return INT32_MIN;
} else if (n_return > INT32_MAX) {
return INT32_MAX;
} else {
return (int32_t) n_return;
}
}
void
_mongoc_set_cursor_ns (mongoc_cursor_t *cursor,
const char *ns,
uint32_t nslen)
{
const char *dot;
bson_strncpy (cursor->ns, ns, sizeof cursor->ns);
cursor->nslen = BSON_MIN (nslen, sizeof cursor->ns);
dot = strstr (cursor->ns, ".");
if (dot) {
cursor->dblen = (uint32_t) (dot - cursor->ns);
} else {
/* a database name with no collection name */
cursor->dblen = cursor->nslen;
}
}
/* true if there are $-keys. precondition: bson must be valid. */
static bool
_has_dollar_fields (const bson_t *bson)
{
bson_iter_t iter;
const char *key;
BSON_ASSERT (bson_iter_init (&iter, bson));
while (bson_iter_next (&iter)) {
key = bson_iter_key (&iter);
if (key[0] == '$') {
return true;
}
}
return false;
}
#define MARK_FAILED(c) \
do { \
(c)->done = true; \
(c)->end_of_event = true; \
(c)->sent = true; \
} while (0)
mongoc_cursor_t *
_mongoc_cursor_new_with_opts (mongoc_client_t *client,
const char *db_and_collection,
bool is_command,
const bson_t *filter,
const bson_t *opts,
const mongoc_read_prefs_t *read_prefs,
const mongoc_read_concern_t *read_concern)
{
mongoc_cursor_t *cursor;
mongoc_topology_description_type_t td_type;
uint32_t server_id;
ENTRY;
BSON_ASSERT (client);
cursor = (mongoc_cursor_t *) bson_malloc0 (sizeof *cursor);
cursor->client = client;
cursor->is_command = is_command ? 1 : 0;
+ bson_init (&cursor->filter);
+ bson_init (&cursor->opts);
+
if (filter) {
if (!bson_validate (filter, BSON_VALIDATE_EMPTY_KEYS, NULL)) {
MARK_FAILED (cursor);
bson_set_error (&cursor->error, MONGOC_ERROR_CURSOR,
MONGOC_ERROR_CURSOR_INVALID_CURSOR,
"Empty keys are not allowed in 'filter'.");
GOTO (finish);
}
+ bson_destroy (&cursor->filter);
bson_copy_to (filter, &cursor->filter);
- } else {
- bson_init (&cursor->filter);
}
if (opts) {
if (!bson_validate (opts, BSON_VALIDATE_EMPTY_KEYS, NULL)) {
MARK_FAILED (cursor);
bson_set_error (&cursor->error, MONGOC_ERROR_CURSOR,
MONGOC_ERROR_CURSOR_INVALID_CURSOR,
"Cannot use empty keys in 'opts'.");
GOTO (finish);
}
if (_has_dollar_fields (opts)) {
MARK_FAILED (cursor);
bson_set_error (&cursor->error, MONGOC_ERROR_CURSOR,
MONGOC_ERROR_CURSOR_INVALID_CURSOR,
"Cannot use $-modifiers in 'opts'.");
GOTO (finish);
}
- bson_init (&cursor->opts);
bson_copy_to_excluding_noinit (opts, &cursor->opts, "serverId", NULL);
/* true if there's a valid serverId or no serverId, false on err */
if (!_mongoc_get_server_id_from_opts (opts, MONGOC_ERROR_CURSOR,
MONGOC_ERROR_CURSOR_INVALID_CURSOR,
&server_id, &cursor->error)) {
MARK_FAILED (cursor);
GOTO (finish);
}
if (server_id) {
mongoc_cursor_set_hint (cursor, server_id);
}
- } else {
- bson_init (&cursor->opts);
}
cursor->read_prefs = read_prefs ?
mongoc_read_prefs_copy (read_prefs) :
mongoc_read_prefs_new (MONGOC_READ_PRIMARY);
cursor->read_concern = read_concern ?
mongoc_read_concern_copy (read_concern) :
mongoc_read_concern_new ();
if (db_and_collection) {
_mongoc_set_cursor_ns (cursor, db_and_collection,
(uint32_t) strlen (db_and_collection));
}
if (_mongoc_cursor_get_opt_bool (cursor, MONGOC_CURSOR_EXHAUST)) {
if (_mongoc_cursor_get_opt_int64 (cursor, MONGOC_CURSOR_LIMIT, 0)) {
bson_set_error (&cursor->error,
MONGOC_ERROR_CURSOR,
MONGOC_ERROR_CURSOR_INVALID_CURSOR,
"Cannot specify both 'exhaust' and 'limit'.");
MARK_FAILED (cursor);
GOTO (finish);
}
td_type = _mongoc_topology_get_type (client->topology);
if (td_type == MONGOC_TOPOLOGY_SHARDED) {
bson_set_error (&cursor->error,
MONGOC_ERROR_CURSOR,
MONGOC_ERROR_CURSOR_INVALID_CURSOR,
"Cannot use exhaust cursor with sharded cluster.");
MARK_FAILED (cursor);
GOTO (finish);
}
}
_mongoc_buffer_init (&cursor->buffer, NULL, 0, NULL, NULL);
_mongoc_read_prefs_validate (read_prefs, &cursor->error);
finish:
mongoc_counter_cursors_active_inc ();
RETURN (cursor);
}
mongoc_cursor_t *
_mongoc_cursor_new (mongoc_client_t *client,
const char *db_and_collection,
mongoc_query_flags_t qflags,
uint32_t skip,
int32_t limit,
uint32_t batch_size,
bool is_command,
const bson_t *query,
const bson_t *fields,
const mongoc_read_prefs_t *read_prefs,
const mongoc_read_concern_t *read_concern)
{
bson_t filter;
bool has_filter = false;
bson_t opts = BSON_INITIALIZER;
bool slave_ok = false;
const char *key;
bson_iter_t iter;
const char *opt_key;
int len;
uint32_t data_len;
const uint8_t *data;
mongoc_cursor_t *cursor;
bson_error_t error = { 0 };
ENTRY;
BSON_ASSERT (client);
if (query) {
if (bson_has_field (query, "$query")) {
/* like "{$query: {a: 1}, $orderby: {b: 1}, $otherModifier: true}" */
bson_iter_init (&iter, query);
while (bson_iter_next (&iter)) {
key = bson_iter_key (&iter);
if (key[0] != '$') {
bson_set_error (&error, MONGOC_ERROR_CURSOR,
MONGOC_ERROR_CURSOR_INVALID_CURSOR,
"Cannot mix $query with non-dollar field '%s'",
key);
GOTO (done);
}
if (!strcmp (key, "$query")) {
/* set "filter" to the incoming document's "$query" */
bson_iter_document (&iter, &data_len, &data);
bson_init_static (&filter, data, (size_t) data_len);
has_filter = true;
} else if (_translate_query_opt (key, &opt_key, &len)) {
/* "$orderby" becomes "sort", etc., "$unknown" -> "unknown" */
bson_append_iter (&opts, opt_key, len, &iter);
} else {
/* strip leading "$" */
bson_append_iter (&opts, key + 1, -1, &iter);
}
}
}
}
if (!bson_empty0 (fields)) {
bson_append_document (&opts, MONGOC_CURSOR_PROJECTION, MONGOC_CURSOR_PROJECTION_LEN, fields);
}
if (skip) {
bson_append_int64 (&opts, MONGOC_CURSOR_SKIP, MONGOC_CURSOR_SKIP_LEN, skip);
}
if (limit) {
bson_append_int64 (&opts, MONGOC_CURSOR_LIMIT, MONGOC_CURSOR_LIMIT_LEN, llabs (limit));
if (limit < 0) {
bson_append_bool (&opts, MONGOC_CURSOR_SINGLE_BATCH, MONGOC_CURSOR_SINGLE_BATCH_LEN, true);
}
}
if (batch_size) {
bson_append_int64 (&opts, MONGOC_CURSOR_BATCH_SIZE, MONGOC_CURSOR_BATCH_SIZE_LEN, batch_size);
}
if (qflags & MONGOC_QUERY_SLAVE_OK) {
slave_ok = true;
}
if (qflags & MONGOC_QUERY_TAILABLE_CURSOR) {
bson_append_bool (&opts, MONGOC_CURSOR_TAILABLE, MONGOC_CURSOR_TAILABLE_LEN, true);
}
if (qflags & MONGOC_QUERY_OPLOG_REPLAY) {
bson_append_bool (&opts, MONGOC_CURSOR_OPLOG_REPLAY, MONGOC_CURSOR_OPLOG_REPLAY_LEN, true);
}
if (qflags & MONGOC_QUERY_NO_CURSOR_TIMEOUT) {
bson_append_bool (&opts, MONGOC_CURSOR_NO_CURSOR_TIMEOUT, MONGOC_CURSOR_NO_CURSOR_TIMEOUT_LEN, true);
}
if (qflags & MONGOC_QUERY_AWAIT_DATA) {
bson_append_bool (&opts, MONGOC_CURSOR_AWAIT_DATA, MONGOC_CURSOR_AWAIT_DATA_LEN, true);
}
if (qflags & MONGOC_QUERY_EXHAUST) {
bson_append_bool (&opts, MONGOC_CURSOR_EXHAUST, MONGOC_CURSOR_EXHAUST_LEN, true);
}
if (qflags & MONGOC_QUERY_PARTIAL) {
bson_append_bool (&opts, MONGOC_CURSOR_ALLOW_PARTIAL_RESULTS, MONGOC_CURSOR_ALLOW_PARTIAL_RESULTS_LEN,
true);
}
done:
if (error.domain != 0) {
cursor = _mongoc_cursor_new_with_opts (client, db_and_collection,
is_command, NULL, NULL, NULL,
NULL);
MARK_FAILED (cursor);
memcpy (&cursor->error, &error, sizeof (bson_error_t));
} else {
cursor = _mongoc_cursor_new_with_opts (client, db_and_collection,
is_command,
has_filter ? &filter : query,
&opts, read_prefs, read_concern);
if (slave_ok) {
cursor->slave_ok = true;
}
}
if (has_filter) {
bson_destroy (&filter);
}
bson_destroy (&opts);
RETURN (cursor);
}
void
mongoc_cursor_destroy (mongoc_cursor_t *cursor)
{
ENTRY;
BSON_ASSERT(cursor);
if (cursor->iface.destroy) {
cursor->iface.destroy(cursor);
} else {
_mongoc_cursor_destroy(cursor);
}
EXIT;
}
void
_mongoc_cursor_destroy (mongoc_cursor_t *cursor)
{
char db[MONGOC_NAMESPACE_MAX];
ENTRY;
BSON_ASSERT (cursor);
if (cursor->in_exhaust) {
cursor->client->in_exhaust = false;
if (!cursor->done) {
/* The only way to stop an exhaust cursor is to kill the connection */
mongoc_cluster_disconnect_node (&cursor->client->cluster,
cursor->server_id);
}
} else if (cursor->rpc.reply.cursor_id) {
bson_strncpy (db, cursor->ns, cursor->dblen + 1);
_mongoc_client_kill_cursor(cursor->client,
cursor->server_id,
cursor->rpc.reply.cursor_id,
cursor->operation_id,
db,
cursor->ns + cursor->dblen + 1);
}
if (cursor->reader) {
bson_reader_destroy(cursor->reader);
cursor->reader = NULL;
}
_mongoc_buffer_destroy(&cursor->buffer);
mongoc_read_prefs_destroy(cursor->read_prefs);
mongoc_read_concern_destroy(cursor->read_concern);
mongoc_write_concern_destroy (cursor->write_concern);
bson_destroy (&cursor->filter);
bson_destroy (&cursor->opts);
bson_free(cursor);
mongoc_counter_cursors_active_dec();
mongoc_counter_cursors_disposed_inc();
EXIT;
}
mongoc_server_stream_t *
_mongoc_cursor_fetch_stream (mongoc_cursor_t *cursor)
{
mongoc_server_stream_t *server_stream;
ENTRY;
if (cursor->server_id) {
server_stream = mongoc_cluster_stream_for_server (&cursor->client->cluster,
cursor->server_id,
true /* reconnect_ok */,
&cursor->error);
} else {
server_stream = mongoc_cluster_stream_for_reads (&cursor->client->cluster,
cursor->read_prefs,
&cursor->error);
if (server_stream) {
cursor->server_id = server_stream->sd->id;
}
}
RETURN (server_stream);
}
bool
_use_find_command (const mongoc_cursor_t *cursor,
const mongoc_server_stream_t *server_stream)
{
/* Find, getMore And killCursors Commands Spec: "the find command cannot be
* used to execute other commands" and "the find command does not support the
* exhaust flag."
*/
return server_stream->sd->max_wire_version >= WIRE_VERSION_FIND_CMD &&
!cursor->is_command && !_mongoc_cursor_get_opt_bool (cursor, MONGOC_CURSOR_EXHAUST);
}
static const bson_t *
_mongoc_cursor_initial_query (mongoc_cursor_t *cursor)
{
mongoc_server_stream_t *server_stream;
const bson_t *b = NULL;
ENTRY;
BSON_ASSERT (cursor);
server_stream = _mongoc_cursor_fetch_stream (cursor);
if (!server_stream) {
GOTO (done);
}
if (_use_find_command (cursor, server_stream)) {
b = _mongoc_cursor_find_command (cursor, server_stream);
} else {
/* When the user explicitly provides a readConcern -- but the server
* doesn't support readConcern, we must error:
* https://github.com/mongodb/specifications/blob/master/source/read-write-concern/read-write-concern.rst#errors-1
*/
if (cursor->read_concern->level != NULL
&& server_stream->sd->max_wire_version < WIRE_VERSION_READ_CONCERN) {
bson_set_error (&cursor->error,
MONGOC_ERROR_COMMAND,
MONGOC_ERROR_PROTOCOL_BAD_WIRE_VERSION,
"The selected server does not support readConcern");
} else {
b = _mongoc_cursor_op_query (cursor, server_stream);
}
}
done:
/* no-op if server_stream is NULL */
mongoc_server_stream_cleanup (server_stream);
if (!b) {
cursor->done = true;
}
RETURN (b);
}
static bool
_mongoc_cursor_monitor_legacy_query (mongoc_cursor_t *cursor,
mongoc_server_stream_t *server_stream,
const char *cmd_name)
{
bson_t doc;
mongoc_client_t *client;
mongoc_apm_command_started_t event;
char db[MONGOC_NAMESPACE_MAX];
ENTRY;
client = cursor->client;
if (!client->apm_callbacks.started) {
/* successful */
RETURN (true);
}
bson_init (&doc);
bson_strncpy (db, cursor->ns, cursor->dblen + 1);
if (!cursor->is_command) {
/* simulate a MongoDB 3.2+ "find" command */
if (!_mongoc_cursor_prepare_find_command (cursor, &doc, server_stream)) {
/* cursor->error is set */
bson_destroy (&doc);
RETURN (false);
}
}
mongoc_apm_command_started_init (&event,
cursor->is_command ? &cursor->filter : &doc,
db,
cmd_name,
client->cluster.request_id,
cursor->operation_id,
&server_stream->sd->host,
server_stream->sd->id,
client->apm_context);
client->apm_callbacks.started (&event);
mongoc_apm_command_started_cleanup (&event);
bson_destroy (&doc);
RETURN (true);
}
/* append array of docs from current cursor batch */
static void
_mongoc_cursor_append_docs_array (mongoc_cursor_t *cursor,
bson_t *docs)
{
bool eof = false;
char str[16];
const char *key;
uint32_t i = 0;
size_t keylen;
const bson_t *doc;
while ((doc = bson_reader_read (cursor->reader, &eof))) {
keylen = bson_uint32_to_string (i, &key, str, sizeof str);
bson_append_document (docs, key, (int) keylen, doc);
}
bson_reader_reset (cursor->reader);
}
static void
_mongoc_cursor_monitor_succeeded (mongoc_cursor_t *cursor,
int64_t duration,
bool first_batch,
mongoc_server_stream_t *stream,
const char *cmd_name)
{
mongoc_apm_command_succeeded_t event;
mongoc_client_t *client;
bson_t reply;
bson_t reply_cursor;
ENTRY;
client = cursor->client;
if (!client->apm_callbacks.succeeded) {
EXIT;
}
if (cursor->is_command) {
/* cursor is from mongoc_client_command. we're in mongoc_cursor_next. */
if (!_mongoc_rpc_reply_get_first(&cursor->rpc.reply, &reply)) {
MONGOC_ERROR ("_mongoc_cursor_monitor_succeeded can't parse reply");
EXIT;
}
} else {
bson_t docs_array;
/* fake reply to find/getMore command:
* {ok: 1, cursor: {id: 17, ns: "...", first/nextBatch: [ ... docs ... ]}}
*/
bson_init (&docs_array);
_mongoc_cursor_append_docs_array (cursor, &docs_array);
bson_init (&reply);
bson_append_int32 (&reply, "ok", 2, 1);
bson_append_document_begin (&reply, "cursor", 6, &reply_cursor);
bson_append_int64 (&reply_cursor, "id", 2, mongoc_cursor_get_id (cursor));
bson_append_utf8 (&reply_cursor, "ns", 2, cursor->ns, cursor->nslen);
bson_append_array (&reply_cursor,
first_batch ? "firstBatch" : "nextBatch",
first_batch ? 10 : 9,
&docs_array);
bson_append_document_end (&reply, &reply_cursor);
bson_destroy (&docs_array);
}
mongoc_apm_command_succeeded_init (&event,
duration,
&reply,
cmd_name,
client->cluster.request_id,
cursor->operation_id,
&stream->sd->host,
stream->sd->id,
client->apm_context);
client->apm_callbacks.succeeded (&event);
mongoc_apm_command_succeeded_cleanup (&event);
bson_destroy (&reply);
EXIT;
}
static void
_mongoc_cursor_monitor_failed (mongoc_cursor_t *cursor,
int64_t duration,
mongoc_server_stream_t *stream,
const char *cmd_name)
{
mongoc_apm_command_failed_t event;
mongoc_client_t *client;
ENTRY;
client = cursor->client;
if (!client->apm_callbacks.failed) {
EXIT;
}
mongoc_apm_command_failed_init (&event,
duration,
cmd_name,
&cursor->error,
client->cluster.request_id,
cursor->operation_id,
&stream->sd->host,
stream->sd->id,
client->apm_context);
client->apm_callbacks.failed (&event);
mongoc_apm_command_failed_cleanup (&event);
EXIT;
}
#define OPT_CHECK(_type) do { \
if (!BSON_ITER_HOLDS_##_type (&iter)) { \
bson_set_error (&cursor->error, \
MONGOC_ERROR_COMMAND, \
MONGOC_ERROR_COMMAND_INVALID_ARG, \
"invalid option %s, should be type %s", \
key, #_type); \
return NULL; \
} \
} while (false)
#define OPT_CHECK_INT() do { \
if (!BSON_ITER_HOLDS_INT64 (&iter) && \
!BSON_ITER_HOLDS_INT32 (&iter)) { \
bson_set_error (&cursor->error, \
MONGOC_ERROR_COMMAND, \
MONGOC_ERROR_COMMAND_INVALID_ARG, \
"invalid option %s, should be integer", key); \
return NULL; \
} \
} while (false)
#define OPT_ERR(_msg) do { \
bson_set_error (&cursor->error, MONGOC_ERROR_COMMAND, \
MONGOC_ERROR_COMMAND_INVALID_ARG, _msg); \
return NULL; \
} while (false)
#define OPT_BSON_ERR(_msg) do { \
bson_set_error (&cursor->error, MONGOC_ERROR_BSON, \
MONGOC_ERROR_BSON_INVALID, _msg); \
return NULL; \
} while (false)
#define OPT_FLAG(_flag) do { \
OPT_CHECK (BOOL); \
if (bson_iter_as_bool (&iter)) { \
*flags |= _flag; \
} \
} while (false)
#define PUSH_DOLLAR_QUERY() do { \
if (!pushed_dollar_query) { \
pushed_dollar_query = true; \
bson_append_document (query, "$query", 6, &cursor->filter); \
} \
} while (false)
#define OPT_SUBDOCUMENT(_opt_name, _legacy_name) do { \
OPT_CHECK (DOCUMENT); \
bson_iter_document (&iter, &len, &data); \
if (!bson_init_static (&subdocument, data, (size_t) len)) { \
OPT_BSON_ERR ("Invalid '" #_opt_name "' subdocument in 'opts'."); \
} \
BSON_APPEND_DOCUMENT (query, "$" #_legacy_name, &subdocument); \
} while (false)
#define ADD_FLAG(_flags, _value) do { \
if (!BSON_ITER_HOLDS_BOOL(&iter)) { \
bson_set_error (&cursor->error, \
MONGOC_ERROR_COMMAND, \
MONGOC_ERROR_COMMAND_INVALID_ARG, \
"invalid option %s, should be type bool", key); \
return false; \
} \
if (bson_iter_as_bool (&iter)) { \
*_flags |= _value; \
} \
} while (false);
static bool
_mongoc_cursor_flags (mongoc_cursor_t *cursor,
mongoc_server_stream_t *stream,
mongoc_query_flags_t *flags /* OUT */)
{
bson_iter_t iter;
const char *key;
*flags = MONGOC_QUERY_NONE;
if (!bson_iter_init (&iter, &cursor->opts)) {
bson_set_error (&cursor->error, MONGOC_ERROR_BSON,
MONGOC_ERROR_BSON_INVALID, "Invalid 'opts' parameter.");
return false;
}
while (bson_iter_next (&iter)) {
key = bson_iter_key (&iter);
if (!strcmp (key, MONGOC_CURSOR_ALLOW_PARTIAL_RESULTS)) {
ADD_FLAG (flags, MONGOC_QUERY_PARTIAL);
} else if (!strcmp (key, MONGOC_CURSOR_AWAIT_DATA)) {
ADD_FLAG (flags, MONGOC_QUERY_AWAIT_DATA);
} else if (!strcmp (key, MONGOC_CURSOR_EXHAUST)) {
ADD_FLAG (flags, MONGOC_QUERY_EXHAUST);
} else if (!strcmp (key, MONGOC_CURSOR_NO_CURSOR_TIMEOUT)) {
ADD_FLAG (flags, MONGOC_QUERY_NO_CURSOR_TIMEOUT);
} else if (!strcmp (key, MONGOC_CURSOR_OPLOG_REPLAY)) {
ADD_FLAG (flags, MONGOC_QUERY_OPLOG_REPLAY);
} else if (!strcmp (key, MONGOC_CURSOR_TAILABLE)) {
ADD_FLAG (flags, MONGOC_QUERY_TAILABLE_CURSOR);
}
}
if (cursor->slave_ok) {
*flags |= MONGOC_QUERY_SLAVE_OK;
} else if (cursor->server_id_set &&
(stream->topology_type == MONGOC_TOPOLOGY_RS_WITH_PRIMARY ||
stream->topology_type == MONGOC_TOPOLOGY_RS_NO_PRIMARY) &&
stream->sd->type != MONGOC_SERVER_RS_PRIMARY) {
*flags |= MONGOC_QUERY_SLAVE_OK;
}
return true;
}
static bson_t *
_mongoc_cursor_parse_opts_for_op_query (mongoc_cursor_t *cursor,
mongoc_server_stream_t *stream,
bson_t *query /* OUT */,
bson_t *fields/* OUT */,
mongoc_query_flags_t *flags /* OUT */,
int32_t *skip /* OUT */)
{
bool pushed_dollar_query;
bson_iter_t iter;
uint32_t len;
const uint8_t *data;
bson_t subdocument;
const char *key;
char *dollar_modifier;
*flags = MONGOC_QUERY_NONE;
*skip = 0;
/* assume we'll send filter straight to server, like "{a: 1}". if we find an
* opt we must add, like "sort", we push the query like "$query: {a: 1}",
* then add a query modifier for the option, in this example "$orderby".
*/
pushed_dollar_query = false;
if (!bson_iter_init (&iter, &cursor->opts)) {
OPT_BSON_ERR ("Invalid 'opts' parameter.");
}
while (bson_iter_next (&iter)) {
key = bson_iter_key (&iter);
/* most common options first */
if (!strcmp (key, MONGOC_CURSOR_PROJECTION)) {
OPT_CHECK (DOCUMENT);
bson_iter_document (&iter, &len, &data);
if (!bson_init_static (&subdocument, data, (size_t) len)) {
OPT_BSON_ERR ("Invalid 'projection' subdocument in 'opts'.");
}
bson_copy_to (&subdocument, fields);
} else if (!strcmp (key, MONGOC_CURSOR_SORT)) {
PUSH_DOLLAR_QUERY ();
OPT_SUBDOCUMENT (sort, orderby);
} else if (!strcmp (key, MONGOC_CURSOR_SKIP)) {
OPT_CHECK_INT ();
*skip = (int32_t) bson_iter_as_int64 (&iter);
}
/* the rest of the options, alphabetically */
else if (!strcmp (key, MONGOC_CURSOR_ALLOW_PARTIAL_RESULTS)) {
OPT_FLAG (MONGOC_QUERY_PARTIAL);
} else if (!strcmp (key, MONGOC_CURSOR_AWAIT_DATA)) {
OPT_FLAG (MONGOC_QUERY_AWAIT_DATA);
} else if (!strcmp (key, MONGOC_CURSOR_COMMENT)) {
OPT_CHECK (UTF8);
PUSH_DOLLAR_QUERY ();
BSON_APPEND_UTF8 (query, "$comment", bson_iter_utf8 (&iter, NULL));
} else if (!strcmp (key, MONGOC_CURSOR_HINT)) {
if (BSON_ITER_HOLDS_UTF8 (&iter)) {
PUSH_DOLLAR_QUERY ();
BSON_APPEND_UTF8 (query, "$hint", bson_iter_utf8 (&iter, NULL));
} else if (BSON_ITER_HOLDS_DOCUMENT (&iter)) {
PUSH_DOLLAR_QUERY ();
OPT_SUBDOCUMENT (hint, hint);
} else {
OPT_ERR ("Wrong type for 'hint' field in 'opts'.");
}
} else if (!strcmp (key, MONGOC_CURSOR_MAX)) {
PUSH_DOLLAR_QUERY ();
OPT_SUBDOCUMENT (max, max);
} else if (!strcmp (key, MONGOC_CURSOR_MAX_SCAN)) {
OPT_CHECK_INT ();
PUSH_DOLLAR_QUERY ();
BSON_APPEND_INT64 (query, "$maxScan", bson_iter_as_int64 (&iter));
} else if (!strcmp (key, MONGOC_CURSOR_MAX_TIME_MS)) {
OPT_CHECK_INT ();
PUSH_DOLLAR_QUERY ();
BSON_APPEND_INT64 (query, "$maxTimeMS", bson_iter_as_int64 (&iter));
} else if (!strcmp (key, MONGOC_CURSOR_MIN)) {
PUSH_DOLLAR_QUERY ();
OPT_SUBDOCUMENT (min, min);
} else if (!strcmp (key, MONGOC_CURSOR_READ_CONCERN)) {
OPT_ERR ("Set readConcern on client, database, or collection,"
" not in a query.");
} else if (!strcmp (key, MONGOC_CURSOR_RETURN_KEY)) {
OPT_CHECK (BOOL);
PUSH_DOLLAR_QUERY ();
BSON_APPEND_BOOL (query, "$returnKey", bson_iter_as_bool (&iter));
} else if (!strcmp (key, MONGOC_CURSOR_SHOW_RECORD_ID)) {
OPT_CHECK (BOOL);
PUSH_DOLLAR_QUERY ();
BSON_APPEND_BOOL (query, "$showDiskLoc", bson_iter_as_bool (&iter));
} else if (!strcmp (key, MONGOC_CURSOR_SNAPSHOT)) {
OPT_CHECK (BOOL);
PUSH_DOLLAR_QUERY ();
BSON_APPEND_BOOL (query, "$snapshot", bson_iter_as_bool (&iter));
} else if (!strcmp (key, MONGOC_CURSOR_COLLATION)) {
bson_set_error (&cursor->error,
MONGOC_ERROR_CURSOR,
MONGOC_ERROR_PROTOCOL_BAD_WIRE_VERSION,
"Collation is not supported by this server");
return NULL;
}
/* singleBatch limit and batchSize are handled in _mongoc_n_return,
* exhaust noCursorTimeout oplogReplay tailable in _mongoc_cursor_flags
* maxAwaitTimeMS is handled in _mongoc_cursor_prepare_getmore_command
*/
else if (strcmp (key, MONGOC_CURSOR_SINGLE_BATCH) &&
strcmp (key, MONGOC_CURSOR_LIMIT) &&
strcmp (key, MONGOC_CURSOR_BATCH_SIZE) &&
strcmp (key, MONGOC_CURSOR_EXHAUST) &&
strcmp (key, MONGOC_CURSOR_NO_CURSOR_TIMEOUT) &&
strcmp (key, MONGOC_CURSOR_OPLOG_REPLAY) &&
strcmp (key, MONGOC_CURSOR_TAILABLE) &&
strcmp (key, MONGOC_CURSOR_MAX_AWAIT_TIME_MS)) {
/* pass unrecognized options to server, prefixed with $ */
PUSH_DOLLAR_QUERY ();
dollar_modifier = bson_strdup_printf ("$%s", key);
bson_append_iter (query, dollar_modifier, -1, &iter);
bson_free (dollar_modifier);
}
}
if (!_mongoc_cursor_flags (cursor, stream, flags)) {
/* cursor->error is set */
return NULL;
}
return pushed_dollar_query ? query : &cursor->filter;
}
#undef OPT_CHECK
#undef OPT_ERR
#undef OPT_BSON_ERR
#undef OPT_FLAG
#undef OPT_SUBDOCUMENT
static const bson_t *
_mongoc_cursor_op_query (mongoc_cursor_t *cursor,
mongoc_server_stream_t *server_stream)
{
int64_t started;
uint32_t request_id;
mongoc_rpc_t rpc;
const char *cmd_name; /* for command monitoring */
const bson_t *query_ptr;
bson_t query = BSON_INITIALIZER;
bson_t fields = BSON_INITIALIZER;
mongoc_query_flags_t flags;
mongoc_apply_read_prefs_result_t result = READ_PREFS_RESULT_INIT;
const bson_t *ret = NULL;
bool succeeded = false;
ENTRY;
started = bson_get_monotonic_time ();
cursor->sent = true;
cursor->operation_id = ++cursor->client->cluster.operation_id;
request_id = ++cursor->client->cluster.request_id;
rpc.query.msg_len = 0;
rpc.query.request_id = request_id;
rpc.query.response_to = 0;
rpc.query.opcode = MONGOC_OPCODE_QUERY;
rpc.query.flags = MONGOC_QUERY_NONE;
rpc.query.collection = cursor->ns;
rpc.query.skip = 0;
rpc.query.n_return = 0;
rpc.query.fields = NULL;
if (cursor->is_command) {
/* "filter" isn't a query, it's like {commandName: ... }*/
cmd_name = _mongoc_get_command_name (&cursor->filter);
BSON_ASSERT (cmd_name);
} else {
cmd_name = "find";
}
query_ptr = _mongoc_cursor_parse_opts_for_op_query (cursor,
server_stream,
&query,
&fields,
&flags,
&rpc.query.skip);
if (!query_ptr) {
/* invalid opts. cursor->error is set */
GOTO (done);
}
apply_read_preferences (cursor->read_prefs, server_stream,
query_ptr, flags, &result);
rpc.query.query = bson_get_data (result.query_with_read_prefs);
rpc.query.flags = result.flags;
rpc.query.n_return = _mongoc_n_return (cursor);
if (!bson_empty (&fields)) {
rpc.query.fields = bson_get_data (&fields);
}
if (!_mongoc_cursor_monitor_legacy_query (cursor, server_stream, cmd_name)) {
GOTO (done);
}
if (!mongoc_cluster_sendv_to_server (&cursor->client->cluster,
&rpc, 1, server_stream,
NULL, &cursor->error)) {
GOTO (done);
}
_mongoc_buffer_clear (&cursor->buffer, false);
if (!_mongoc_client_recv (cursor->client,
&cursor->rpc,
&cursor->buffer,
server_stream,
&cursor->error)) {
GOTO (done);
}
if (cursor->rpc.header.opcode != MONGOC_OPCODE_REPLY) {
bson_set_error (&cursor->error,
MONGOC_ERROR_PROTOCOL,
MONGOC_ERROR_PROTOCOL_INVALID_REPLY,
"Invalid opcode. Expected %d, got %d.",
MONGOC_OPCODE_REPLY, cursor->rpc.header.opcode);
GOTO (done);
}
if (cursor->rpc.header.response_to != request_id) {
bson_set_error (&cursor->error,
MONGOC_ERROR_PROTOCOL,
MONGOC_ERROR_PROTOCOL_INVALID_REPLY,
"Invalid response_to for query. Expected %d, got %d.",
request_id, cursor->rpc.header.response_to);
GOTO (done);
}
if (cursor->is_command) {
if (_mongoc_rpc_parse_command_error (&cursor->rpc,
cursor->client->error_api_version,
&cursor->error)) {
GOTO (done);
}
} else {
if (_mongoc_rpc_parse_query_error (&cursor->rpc,
cursor->client->error_api_version,
&cursor->error)) {
GOTO (done);
}
}
if (cursor->reader) {
bson_reader_destroy (cursor->reader);
}
cursor->reader = bson_reader_new_from_data (
cursor->rpc.reply.documents,
(size_t) cursor->rpc.reply.documents_len);
if (_mongoc_cursor_get_opt_bool (cursor, MONGOC_CURSOR_EXHAUST)) {
cursor->in_exhaust = true;
cursor->client->in_exhaust = true;
}
_mongoc_cursor_monitor_succeeded (cursor,
bson_get_monotonic_time () - started,
true, /* first_batch */
server_stream,
cmd_name);
cursor->done = false;
cursor->end_of_event = false;
succeeded = true;
_mongoc_read_from_buffer (cursor, &ret);
done:
if (!succeeded) {
_mongoc_cursor_monitor_failed (cursor,
bson_get_monotonic_time () - started,
server_stream, cmd_name);
}
apply_read_prefs_result_cleanup (&result);
bson_destroy (&query);
bson_destroy (&fields);
if (!ret) {
cursor->done = true;
}
RETURN (ret);
}
bool
_mongoc_cursor_run_command (mongoc_cursor_t *cursor,
const bson_t *command,
bson_t *reply)
{
mongoc_cluster_t *cluster;
mongoc_server_stream_t *server_stream;
char db[MONGOC_NAMESPACE_MAX];
mongoc_query_flags_t flags;
mongoc_apply_read_prefs_result_t read_prefs_result = READ_PREFS_RESULT_INIT;
bool ret = false;
ENTRY;
cluster = &cursor->client->cluster;
server_stream = _mongoc_cursor_fetch_stream (cursor);
if (!server_stream) {
GOTO (done);
}
bson_strncpy (db, cursor->ns, cursor->dblen + 1);
if (!_mongoc_cursor_flags (cursor, server_stream, &flags)) {
GOTO (done);
}
apply_read_preferences (cursor->read_prefs, server_stream,
command, flags, &read_prefs_result);
if (cursor->write_concern &&
!_mongoc_write_concern_is_default (cursor->write_concern) &&
server_stream->sd->max_wire_version >= WIRE_VERSION_CMD_WRITE_CONCERN) {
mongoc_write_concern_append (cursor->write_concern,
read_prefs_result.query_with_read_prefs);
}
- if (cursor->read_concern &&
- server_stream->sd->max_wire_version >= WIRE_VERSION_READ_CONCERN) {
- mongoc_read_concern_append (cursor->read_concern,
- read_prefs_result.query_with_read_prefs);
- }
-
ret = mongoc_cluster_run_command_monitored (
cluster,
server_stream,
read_prefs_result.flags,
db,
read_prefs_result.query_with_read_prefs,
reply,
&cursor->error);
/* Read and Write Concern Spec: "Drivers SHOULD parse server replies for a
* "writeConcernError" field and report the error only in command-specific
* helper methods that take a separate write concern parameter or an options
* parameter that may contain a write concern option.
*
* Only command helpers with names like "_with_write_concern" can create
* cursors with a non-NULL write_concern field.
*/
if (ret && cursor->write_concern) {
ret = !_mongoc_parse_wc_err (reply, &cursor->error);
}
done:
apply_read_prefs_result_cleanup (&read_prefs_result);
mongoc_server_stream_cleanup (server_stream);
return ret;
}
static bool
_translate_query_opt (const char *query_field,
const char **cmd_field,
int *len)
{
if (query_field[0] != '$') {
*cmd_field = query_field;
*len = -1;
return true;
}
/* strip the leading '$' */
query_field++;
if (!strcmp (MONGOC_CURSOR_ORDERBY, query_field)) {
*cmd_field = MONGOC_CURSOR_SORT;
*len = MONGOC_CURSOR_SORT_LEN;
} else if (!strcmp (MONGOC_CURSOR_SHOW_DISK_LOC, query_field)) { /* <= MongoDb 3.0 */
*cmd_field = MONGOC_CURSOR_SHOW_RECORD_ID;
*len = MONGOC_CURSOR_SHOW_RECORD_ID_LEN;
} else if (!strcmp (MONGOC_CURSOR_HINT, query_field)) {
*cmd_field = MONGOC_CURSOR_HINT;
*len = MONGOC_CURSOR_HINT_LEN;
} else if (!strcmp (MONGOC_CURSOR_COMMENT, query_field)) {
*cmd_field = MONGOC_CURSOR_COMMENT;
*len = MONGOC_CURSOR_COMMENT_LEN;
} else if (!strcmp (MONGOC_CURSOR_MAX_SCAN, query_field)) {
*cmd_field = MONGOC_CURSOR_MAX_SCAN;
*len = MONGOC_CURSOR_MAX_SCAN_LEN;
} else if (!strcmp (MONGOC_CURSOR_MAX_TIME_MS, query_field)) {
*cmd_field = MONGOC_CURSOR_MAX_TIME_MS;
*len = MONGOC_CURSOR_MAX_TIME_MS_LEN;
} else if (!strcmp (MONGOC_CURSOR_MAX, query_field)) {
*cmd_field = MONGOC_CURSOR_MAX;
*len = MONGOC_CURSOR_MAX_LEN;
} else if (!strcmp (MONGOC_CURSOR_MIN, query_field)) {
*cmd_field = MONGOC_CURSOR_MIN;
*len = MONGOC_CURSOR_MIN_LEN;
} else if (!strcmp (MONGOC_CURSOR_RETURN_KEY, query_field)) {
*cmd_field = MONGOC_CURSOR_RETURN_KEY;
*len = MONGOC_CURSOR_RETURN_KEY_LEN;
} else if (!strcmp (MONGOC_CURSOR_SNAPSHOT, query_field)) {
*cmd_field = MONGOC_CURSOR_SNAPSHOT;
*len = MONGOC_CURSOR_SNAPSHOT_LEN;
} else {
/* not a special command field, must be a query operator like $or */
return false;
}
return true;
}
void
_mongoc_cursor_collection (const mongoc_cursor_t *cursor,
const char **collection,
int *collection_len)
{
/* ns is like "db.collection". Collection name is located past the ".". */
*collection = cursor->ns + (cursor->dblen + 1);
/* Collection name's length is ns length, minus length of db name and ".". */
*collection_len = cursor->nslen - cursor->dblen - 1;
BSON_ASSERT (*collection_len > 0);
}
static bool
_mongoc_cursor_prepare_find_command (mongoc_cursor_t *cursor,
bson_t *command,
mongoc_server_stream_t *server_stream)
{
const char *collection;
int collection_len;
bson_iter_t iter;
_mongoc_cursor_collection (cursor, &collection, &collection_len);
bson_append_utf8 (command, MONGOC_CURSOR_FIND, MONGOC_CURSOR_FIND_LEN, collection, collection_len);
bson_append_document (command, MONGOC_CURSOR_FILTER, MONGOC_CURSOR_FILTER_LEN, &cursor->filter);
bson_iter_init (&iter, &cursor->opts);
while (bson_iter_next (&iter)) {
/* don't append "maxAwaitTimeMS" */
if (!strcmp (bson_iter_key (&iter), MONGOC_CURSOR_COLLATION) &&
server_stream->sd->max_wire_version < WIRE_VERSION_COLLATION) {
bson_set_error (&cursor->error,
MONGOC_ERROR_CURSOR,
MONGOC_ERROR_PROTOCOL_BAD_WIRE_VERSION,
"Collation is not supported by this server");
MARK_FAILED (cursor);
return false;
} else if (strcmp (bson_iter_key (&iter), MONGOC_CURSOR_MAX_AWAIT_TIME_MS)) {
if (!bson_append_iter (command, bson_iter_key (&iter), -1, &iter)) {
bson_set_error (&cursor->error, MONGOC_ERROR_BSON,
MONGOC_ERROR_BSON_INVALID, "Cursor opts too large");
MARK_FAILED (cursor);
return false;
}
}
}
if (cursor->read_concern->level != NULL) {
const bson_t *read_concern_bson;
read_concern_bson = _mongoc_read_concern_get_bson (cursor->read_concern);
bson_append_document (
command, MONGOC_CURSOR_READ_CONCERN, MONGOC_CURSOR_READ_CONCERN_LEN, read_concern_bson);
}
return true;
}
static const bson_t *
_mongoc_cursor_find_command (mongoc_cursor_t *cursor,
mongoc_server_stream_t *server_stream)
{
bson_t command = BSON_INITIALIZER;
const bson_t *bson = NULL;
ENTRY;
if (!_mongoc_cursor_prepare_find_command (cursor, &command, server_stream)) {
RETURN (NULL);
}
_mongoc_cursor_cursorid_init (cursor, &command);
bson_destroy (&command);
BSON_ASSERT (cursor->iface.next);
_mongoc_cursor_cursorid_next (cursor, &bson);
RETURN (bson);
}
static const bson_t *
_mongoc_cursor_get_more (mongoc_cursor_t *cursor)
{
mongoc_server_stream_t *server_stream;
const bson_t *b = NULL;
ENTRY;
BSON_ASSERT (cursor);
server_stream = _mongoc_cursor_fetch_stream (cursor);
if (!server_stream) {
GOTO (failure);
}
if (!cursor->in_exhaust && !cursor->rpc.reply.cursor_id) {
bson_set_error (&cursor->error,
MONGOC_ERROR_CURSOR,
MONGOC_ERROR_CURSOR_INVALID_CURSOR,
"No valid cursor was provided.");
GOTO (failure);
}
if (!_mongoc_cursor_op_getmore (cursor, server_stream)) {
GOTO (failure);
}
mongoc_server_stream_cleanup (server_stream);
if (cursor->reader) {
_mongoc_read_from_buffer (cursor, &b);
}
RETURN (b);
failure:
cursor->done = true;
mongoc_server_stream_cleanup (server_stream);
RETURN (NULL);
}
static bool
_mongoc_cursor_monitor_legacy_get_more (mongoc_cursor_t *cursor,
mongoc_server_stream_t *server_stream)
{
bson_t doc;
char db[MONGOC_NAMESPACE_MAX];
mongoc_client_t *client;
mongoc_apm_command_started_t event;
ENTRY;
client = cursor->client;
if (!client->apm_callbacks.started) {
/* successful */
RETURN (true);
}
bson_init (&doc);
if (!_mongoc_cursor_prepare_getmore_command (cursor, &doc)) {
bson_destroy (&doc);
RETURN (false);
}
bson_strncpy (db, cursor->ns, cursor->dblen + 1);
mongoc_apm_command_started_init (&event,
&doc,
db,
"getMore",
client->cluster.request_id,
cursor->operation_id,
&server_stream->sd->host,
server_stream->sd->id,
client->apm_context);
client->apm_callbacks.started (&event);
mongoc_apm_command_started_cleanup (&event);
bson_destroy (&doc);
RETURN (true);
}
bool
_mongoc_cursor_op_getmore (mongoc_cursor_t *cursor,
mongoc_server_stream_t *server_stream)
{
int64_t started;
mongoc_rpc_t rpc;
uint32_t request_id;
mongoc_cluster_t *cluster;
mongoc_query_flags_t flags;
ENTRY;
started = bson_get_monotonic_time ();
cluster = &cursor->client->cluster;
if (!_mongoc_cursor_flags (cursor, server_stream, &flags)) {
GOTO (fail);
}
if (cursor->in_exhaust) {
request_id = (uint32_t) cursor->rpc.header.request_id;
} else {
request_id = ++cluster->request_id;
rpc.get_more.cursor_id = cursor->rpc.reply.cursor_id;
rpc.get_more.msg_len = 0;
rpc.get_more.request_id = request_id;
rpc.get_more.response_to = 0;
rpc.get_more.opcode = MONGOC_OPCODE_GET_MORE;
rpc.get_more.zero = 0;
rpc.get_more.collection = cursor->ns;
if (flags & MONGOC_QUERY_TAILABLE_CURSOR) {
rpc.get_more.n_return = 0;
} else {
rpc.get_more.n_return = _mongoc_n_return(cursor);
}
if (!_mongoc_cursor_monitor_legacy_get_more (cursor, server_stream)) {
GOTO (fail);
}
if (!mongoc_cluster_sendv_to_server (cluster, &rpc, 1, server_stream,
NULL, &cursor->error)) {
GOTO (fail);
}
}
_mongoc_buffer_clear (&cursor->buffer, false);
if (!_mongoc_client_recv (cursor->client,
&cursor->rpc,
&cursor->buffer,
server_stream,
&cursor->error)) {
GOTO (fail);
}
if (cursor->rpc.header.opcode != MONGOC_OPCODE_REPLY) {
bson_set_error (&cursor->error,
MONGOC_ERROR_PROTOCOL,
MONGOC_ERROR_PROTOCOL_INVALID_REPLY,
"Invalid opcode. Expected %d, got %d.",
MONGOC_OPCODE_REPLY, cursor->rpc.header.opcode);
GOTO (fail);
}
if (cursor->rpc.header.response_to != request_id) {
bson_set_error (&cursor->error,
MONGOC_ERROR_PROTOCOL,
MONGOC_ERROR_PROTOCOL_INVALID_REPLY,
"Invalid response_to for getmore. Expected %d, got %d.",
request_id, cursor->rpc.header.response_to);
GOTO (fail);
}
if (_mongoc_rpc_parse_query_error (&cursor->rpc,
cursor->client->error_api_version,
&cursor->error)) {
GOTO (fail);
}
if (cursor->reader) {
bson_reader_destroy (cursor->reader);
}
cursor->reader = bson_reader_new_from_data (
cursor->rpc.reply.documents,
(size_t)cursor->rpc.reply.documents_len);
_mongoc_cursor_monitor_succeeded (cursor,
bson_get_monotonic_time () - started,
false, /* not first batch */
server_stream,
"getMore");
RETURN (true);
fail:
_mongoc_cursor_monitor_failed (cursor,
bson_get_monotonic_time () - started,
server_stream,
"getMore");
RETURN (false);
}
bool
mongoc_cursor_error (mongoc_cursor_t *cursor,
bson_error_t *error)
{
bool ret;
ENTRY;
BSON_ASSERT(cursor);
if (cursor->iface.error) {
ret = cursor->iface.error(cursor, error);
} else {
ret = _mongoc_cursor_error(cursor, error);
}
RETURN(ret);
}
bool
_mongoc_cursor_error (mongoc_cursor_t *cursor,
bson_error_t *error)
{
ENTRY;
BSON_ASSERT (cursor);
if (BSON_UNLIKELY(CURSOR_FAILED (cursor))) {
bson_set_error(error,
cursor->error.domain,
cursor->error.code,
"%s",
cursor->error.message);
RETURN(true);
}
RETURN(false);
}
bool
mongoc_cursor_next (mongoc_cursor_t *cursor,
const bson_t **bson)
{
bool ret;
ENTRY;
BSON_ASSERT(cursor);
BSON_ASSERT(bson);
TRACE ("cursor_id(%"PRId64")", cursor->rpc.reply.cursor_id);
if (bson) {
*bson = NULL;
}
if (CURSOR_FAILED (cursor)) {
return false;
}
if (cursor->done) {
bson_set_error (&cursor->error,
MONGOC_ERROR_CURSOR,
MONGOC_ERROR_CURSOR_INVALID_CURSOR,
"Cannot advance a completed or failed cursor.");
return false;
}
/*
* We cannot proceed if another cursor is receiving results in exhaust mode.
*/
if (cursor->client->in_exhaust && !cursor->in_exhaust) {
bson_set_error (&cursor->error,
MONGOC_ERROR_CLIENT,
MONGOC_ERROR_CLIENT_IN_EXHAUST,
"Another cursor derived from this client is in exhaust.");
RETURN (false);
}
if (cursor->iface.next) {
ret = cursor->iface.next(cursor, bson);
} else {
ret = _mongoc_cursor_next(cursor, bson);
}
cursor->current = *bson;
cursor->count++;
RETURN(ret);
}
bool
_mongoc_read_from_buffer (mongoc_cursor_t *cursor,
const bson_t **bson)
{
bool eof = false;
BSON_ASSERT (cursor->reader);
*bson = bson_reader_read (cursor->reader, &eof);
cursor->end_of_event = eof ? 1 : 0;
return *bson ? true : false;
}
bool
_mongoc_cursor_next (mongoc_cursor_t *cursor,
const bson_t **bson)
{
int64_t limit;
const bson_t *b = NULL;
bool tailable;
ENTRY;
BSON_ASSERT (cursor);
if (bson) {
*bson = NULL;
}
/*
* If we reached our limit, make sure we mark this as done and do not try to
* make further progress.
*/
limit = mongoc_cursor_get_limit (cursor);
if (limit && cursor->count >= llabs (limit)) {
cursor->done = true;
RETURN (false);
}
/*
* Try to read the next document from the reader if it exists, we might
* get NULL back and EOF, in which case we need to submit a getmore.
*/
if (cursor->reader) {
_mongoc_read_from_buffer (cursor, &b);
if (b) {
GOTO (complete);
}
}
/*
* Check to see if we need to send a GET_MORE for more results.
*/
if (!cursor->sent) {
b = _mongoc_cursor_initial_query (cursor);
} else if (BSON_UNLIKELY (cursor->end_of_event) && cursor->rpc.reply.cursor_id) {
b = _mongoc_cursor_get_more (cursor);
}
complete:
tailable = _mongoc_cursor_get_opt_bool (cursor, "tailable");
cursor->done = (cursor->end_of_event &&
((cursor->in_exhaust && !cursor->rpc.reply.cursor_id) ||
(!b && !tailable)));
if (bson) {
*bson = b;
}
RETURN (!!b);
}
bool
mongoc_cursor_more (mongoc_cursor_t *cursor)
{
bool ret;
ENTRY;
BSON_ASSERT(cursor);
if (cursor->iface.more) {
ret = cursor->iface.more(cursor);
} else {
ret = _mongoc_cursor_more(cursor);
}
RETURN(ret);
}
bool
_mongoc_cursor_more (mongoc_cursor_t *cursor)
{
BSON_ASSERT (cursor);
if (CURSOR_FAILED (cursor)) {
return false;
}
return (!cursor->sent ||
cursor->rpc.reply.cursor_id ||
!cursor->end_of_event);
}
void
mongoc_cursor_get_host (mongoc_cursor_t *cursor,
mongoc_host_list_t *host)
{
BSON_ASSERT(cursor);
BSON_ASSERT(host);
if (cursor->iface.get_host) {
cursor->iface.get_host(cursor, host);
} else {
_mongoc_cursor_get_host(cursor, host);
}
EXIT;
}
void
_mongoc_cursor_get_host (mongoc_cursor_t *cursor,
mongoc_host_list_t *host)
{
mongoc_server_description_t *description;
BSON_ASSERT (cursor);
BSON_ASSERT (host);
memset(host, 0, sizeof *host);
if (!cursor->server_id) {
MONGOC_WARNING("%s(): Must send query before fetching peer.",
BSON_FUNC);
return;
}
description = mongoc_topology_server_by_id(cursor->client->topology,
cursor->server_id,
&cursor->error);
if (!description) {
return;
}
*host = description->host;
mongoc_server_description_destroy (description);
return;
}
mongoc_cursor_t *
mongoc_cursor_clone (const mongoc_cursor_t *cursor)
{
mongoc_cursor_t *ret;
BSON_ASSERT(cursor);
if (cursor->iface.clone) {
ret = cursor->iface.clone(cursor);
} else {
ret = _mongoc_cursor_clone(cursor);
}
RETURN(ret);
}
mongoc_cursor_t *
_mongoc_cursor_clone (const mongoc_cursor_t *cursor)
{
mongoc_cursor_t *_clone;
ENTRY;
BSON_ASSERT (cursor);
_clone = (mongoc_cursor_t *)bson_malloc0 (sizeof *_clone);
_clone->client = cursor->client;
_clone->is_command = cursor->is_command;
_clone->nslen = cursor->nslen;
_clone->dblen = cursor->dblen;
_clone->has_fields = cursor->has_fields;
if (cursor->read_prefs) {
_clone->read_prefs = mongoc_read_prefs_copy (cursor->read_prefs);
}
if (cursor->read_concern) {
_clone->read_concern = mongoc_read_concern_copy (cursor->read_concern);
}
bson_copy_to (&cursor->filter, &_clone->filter);
bson_copy_to (&cursor->opts, &_clone->opts);
bson_strncpy (_clone->ns, cursor->ns, sizeof _clone->ns);
_mongoc_buffer_init (&_clone->buffer, NULL, 0, NULL, NULL);
mongoc_counter_cursors_active_inc ();
RETURN (_clone);
}
/*
*--------------------------------------------------------------------------
*
* mongoc_cursor_is_alive --
*
* Checks to see if a cursor is alive.
*
* This is primarily useful with tailable cursors.
*
* Returns:
* true if the cursor is alive.
*
* Side effects:
* None.
*
*--------------------------------------------------------------------------
*/
bool
mongoc_cursor_is_alive (const mongoc_cursor_t *cursor) /* IN */
{
BSON_ASSERT (cursor);
return !cursor->done;
}
const bson_t *
mongoc_cursor_current (const mongoc_cursor_t *cursor) /* IN */
{
BSON_ASSERT (cursor);
return cursor->current;
}
void
mongoc_cursor_set_batch_size (mongoc_cursor_t *cursor,
uint32_t batch_size)
{
BSON_ASSERT (cursor);
_mongoc_cursor_set_opt_int64 (cursor, MONGOC_CURSOR_BATCH_SIZE, (int64_t) batch_size);
}
uint32_t
mongoc_cursor_get_batch_size (const mongoc_cursor_t *cursor)
{
BSON_ASSERT (cursor);
return (uint32_t) _mongoc_cursor_get_opt_int64 (cursor, MONGOC_CURSOR_BATCH_SIZE, 0);
}
bool
mongoc_cursor_set_limit (mongoc_cursor_t *cursor,
int64_t limit)
{
BSON_ASSERT (cursor);
if (!cursor->sent) {
if (limit < 0) {
return _mongoc_cursor_set_opt_int64 (cursor, MONGOC_CURSOR_LIMIT, -limit) &&
_mongoc_cursor_set_opt_bool (cursor, MONGOC_CURSOR_SINGLE_BATCH, true);
} else {
return _mongoc_cursor_set_opt_int64 (cursor, MONGOC_CURSOR_LIMIT, limit);
}
} else {
return false;
}
}
int64_t
mongoc_cursor_get_limit (const mongoc_cursor_t *cursor)
{
int64_t limit;
bool single_batch;
BSON_ASSERT (cursor);
limit = _mongoc_cursor_get_opt_int64 (cursor, MONGOC_CURSOR_LIMIT, 0);
single_batch = _mongoc_cursor_get_opt_bool (cursor, MONGOC_CURSOR_SINGLE_BATCH);
if (limit > 0 && single_batch) {
limit = -limit;
}
return limit;
}
bool
mongoc_cursor_set_hint (mongoc_cursor_t *cursor,
uint32_t server_id)
{
BSON_ASSERT (cursor);
if (cursor->server_id) {
MONGOC_ERROR ("mongoc_cursor_set_hint: server_id already set");
return false;
}
if (!server_id) {
MONGOC_ERROR ("mongoc_cursor_set_hint: cannot set server_id to 0");
return false;
}
cursor->server_id = server_id;
cursor->server_id_set = true;
return true;
}
uint32_t
mongoc_cursor_get_hint (const mongoc_cursor_t *cursor)
{
BSON_ASSERT (cursor);
return cursor->server_id;
}
int64_t
mongoc_cursor_get_id (const mongoc_cursor_t *cursor)
{
BSON_ASSERT(cursor);
return cursor->rpc.reply.cursor_id;
}
void
mongoc_cursor_set_max_await_time_ms (mongoc_cursor_t *cursor,
uint32_t max_await_time_ms)
{
BSON_ASSERT (cursor);
if (!cursor->sent) {
_mongoc_cursor_set_opt_int64 (
cursor, MONGOC_CURSOR_MAX_AWAIT_TIME_MS, (int64_t) max_await_time_ms);
}
}
uint32_t
mongoc_cursor_get_max_await_time_ms (const mongoc_cursor_t *cursor)
{
bson_iter_t iter;
BSON_ASSERT (cursor);
if (bson_iter_init_find (&iter, &cursor->opts, MONGOC_CURSOR_MAX_AWAIT_TIME_MS)) {
return (uint32_t) bson_iter_as_int64 (&iter);
}
return 0;
}
/*
*--------------------------------------------------------------------------
*
* mongoc_cursor_new_from_command_reply --
*
* Low-level function to initialize a mongoc_cursor_t from the
* reply to a command like "aggregate", "find", or "listCollections".
*
* Useful in drivers that wrap the C driver; in applications, use
* high-level functions like mongoc_collection_aggregate instead.
*
* Returns:
* A cursor.
*
* Side effects:
* On failure, the cursor's error is set: retrieve it with
* mongoc_cursor_error. On success or failure, "reply" is
* destroyed.
*
*--------------------------------------------------------------------------
*/
mongoc_cursor_t *
mongoc_cursor_new_from_command_reply (mongoc_client_t *client,
bson_t *reply,
uint32_t server_id)
{
mongoc_cursor_t *cursor;
bson_t cmd = BSON_INITIALIZER;
BSON_ASSERT (client);
BSON_ASSERT (reply);
cursor = _mongoc_cursor_new_with_opts (client, NULL, false /* is_command */,
NULL, NULL, NULL, NULL);
_mongoc_cursor_cursorid_init (cursor, &cmd);
_mongoc_cursor_cursorid_init_with_reply (cursor, reply, server_id);
bson_destroy (&cmd);
return cursor;
}
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-cursor.h b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-cursor.h
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-cursor.h
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-cursor.h
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-database-private.h b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-database-private.h
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-database-private.h
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-database-private.h
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-database.c b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-database.c
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-database.c
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-database.c
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-database.h b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-database.h
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-database.h
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-database.h
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-errno-private.h b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-errno-private.h
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-errno-private.h
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-errno-private.h
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-error.h b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-error.h
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-error.h
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-error.h
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-find-and-modify-private.h b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-find-and-modify-private.h
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-find-and-modify-private.h
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-find-and-modify-private.h
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-find-and-modify.c b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-find-and-modify.c
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-find-and-modify.c
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-find-and-modify.c
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-find-and-modify.h b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-find-and-modify.h
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-find-and-modify.h
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-find-and-modify.h
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-flags.h b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-flags.h
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-flags.h
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-flags.h
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-gridfs-file-list-private.h b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-gridfs-file-list-private.h
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-gridfs-file-list-private.h
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-gridfs-file-list-private.h
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-gridfs-file-list.c b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-gridfs-file-list.c
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-gridfs-file-list.c
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-gridfs-file-list.c
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-gridfs-file-list.h b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-gridfs-file-list.h
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-gridfs-file-list.h
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-gridfs-file-list.h
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-gridfs-file-page-private.h b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-gridfs-file-page-private.h
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-gridfs-file-page-private.h
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-gridfs-file-page-private.h
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-gridfs-file-page.c b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-gridfs-file-page.c
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-gridfs-file-page.c
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-gridfs-file-page.c
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-gridfs-file-page.h b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-gridfs-file-page.h
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-gridfs-file-page.h
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-gridfs-file-page.h
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-gridfs-file-private.h b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-gridfs-file-private.h
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-gridfs-file-private.h
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-gridfs-file-private.h
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-gridfs-file.c b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-gridfs-file.c
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-gridfs-file.c
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-gridfs-file.c
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-gridfs-file.h b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-gridfs-file.h
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-gridfs-file.h
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-gridfs-file.h
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-gridfs-private.h b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-gridfs-private.h
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-gridfs-private.h
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-gridfs-private.h
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-gridfs.c b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-gridfs.c
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-gridfs.c
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-gridfs.c
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-gridfs.h b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-gridfs.h
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-gridfs.h
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-gridfs.h
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-handshake-compiler-private.h b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-handshake-compiler-private.h
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-handshake-compiler-private.h
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-handshake-compiler-private.h
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-handshake-os-private.h b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-handshake-os-private.h
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-handshake-os-private.h
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-handshake-os-private.h
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-handshake-private.h b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-handshake-private.h
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-handshake-private.h
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-handshake-private.h
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-handshake.c b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-handshake.c
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-handshake.c
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-handshake.c
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-handshake.h b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-handshake.h
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-handshake.h
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-handshake.h
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-host-list-private.h b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-host-list-private.h
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-host-list-private.h
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-host-list-private.h
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-host-list.c b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-host-list.c
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-host-list.c
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-host-list.c
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-host-list.h b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-host-list.h
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-host-list.h
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-host-list.h
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-index.c b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-index.c
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-index.c
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-index.c
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-index.h b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-index.h
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-index.h
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-index.h
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-init.c b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-init.c
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-init.c
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-init.c
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-init.h b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-init.h
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-init.h
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-init.h
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-iovec.h b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-iovec.h
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-iovec.h
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-iovec.h
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-libressl-private.h b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-libressl-private.h
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-libressl-private.h
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-libressl-private.h
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-libressl.c b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-libressl.c
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-libressl.c
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-libressl.c
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-linux-distro-scanner-private.h b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-linux-distro-scanner-private.h
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-linux-distro-scanner-private.h
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-linux-distro-scanner-private.h
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-linux-distro-scanner.c b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-linux-distro-scanner.c
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-linux-distro-scanner.c
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-linux-distro-scanner.c
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-list-private.h b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-list-private.h
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-list-private.h
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-list-private.h
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-list.c b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-list.c
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-list.c
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-list.c
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-log-private.h b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-log-private.h
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-log-private.h
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-log-private.h
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-log.c b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-log.c
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-log.c
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-log.c
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-log.h b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-log.h
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-log.h
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-log.h
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-matcher-op-private.h b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-matcher-op-private.h
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-matcher-op-private.h
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-matcher-op-private.h
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-matcher-op.c b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-matcher-op.c
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-matcher-op.c
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-matcher-op.c
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-matcher-private.h b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-matcher-private.h
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-matcher-private.h
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-matcher-private.h
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-matcher.c b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-matcher.c
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-matcher.c
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-matcher.c
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-matcher.h b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-matcher.h
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-matcher.h
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-matcher.h
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-memcmp-private.h b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-memcmp-private.h
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-memcmp-private.h
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-memcmp-private.h
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-memcmp.c b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-memcmp.c
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-memcmp.c
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-memcmp.c
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-opcode-private.h b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-opcode-private.h
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-opcode-private.h
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-opcode-private.h
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-opcode.c b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-opcode.c
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-opcode.c
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-opcode.c
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-opcode.h b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-opcode.h
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-opcode.h
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-opcode.h
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-openssl-private.h b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-openssl-private.h
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-openssl-private.h
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-openssl-private.h
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-openssl.c b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-openssl.c
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-openssl.c
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-openssl.c
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-queue-private.h b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-queue-private.h
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-queue-private.h
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-queue-private.h
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-queue.c b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-queue.c
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-queue.c
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-queue.c
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-rand-cng.c b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-rand-cng.c
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-rand-cng.c
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-rand-cng.c
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-rand-common-crypto.c b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-rand-common-crypto.c
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-rand-common-crypto.c
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-rand-common-crypto.c
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-rand-openssl.c b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-rand-openssl.c
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-rand-openssl.c
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-rand-openssl.c
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-rand-private.h b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-rand-private.h
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-rand-private.h
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-rand-private.h
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-rand.h b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-rand.h
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-rand.h
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-rand.h
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-read-concern-private.h b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-read-concern-private.h
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-read-concern-private.h
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-read-concern-private.h
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-read-concern.c b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-read-concern.c
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-read-concern.c
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-read-concern.c
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-read-concern.h b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-read-concern.h
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-read-concern.h
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-read-concern.h
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-read-prefs-private.h b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-read-prefs-private.h
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-read-prefs-private.h
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-read-prefs-private.h
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-read-prefs.c b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-read-prefs.c
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-read-prefs.c
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-read-prefs.c
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-read-prefs.h b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-read-prefs.h
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-read-prefs.h
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-read-prefs.h
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-rpc-private.h b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-rpc-private.h
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-rpc-private.h
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-rpc-private.h
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-rpc.c b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-rpc.c
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-rpc.c
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-rpc.c
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-sasl-private.h b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-sasl-private.h
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-sasl-private.h
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-sasl-private.h
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-sasl.c b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-sasl.c
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-sasl.c
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-sasl.c
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-scram-private.h b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-scram-private.h
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-scram-private.h
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-scram-private.h
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-scram.c b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-scram.c
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-scram.c
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-scram.c
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-secure-channel-private.h b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-secure-channel-private.h
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-secure-channel-private.h
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-secure-channel-private.h
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-secure-channel.c b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-secure-channel.c
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-secure-channel.c
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-secure-channel.c
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-secure-transport-private.h b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-secure-transport-private.h
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-secure-transport-private.h
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-secure-transport-private.h
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-secure-transport.c b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-secure-transport.c
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-secure-transport.c
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-secure-transport.c
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-server-description-private.h b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-server-description-private.h
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-server-description-private.h
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-server-description-private.h
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-server-description.c b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-server-description.c
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-server-description.c
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-server-description.c
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-server-description.h b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-server-description.h
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-server-description.h
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-server-description.h
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-server-stream-private.h b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-server-stream-private.h
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-server-stream-private.h
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-server-stream-private.h
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-server-stream.c b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-server-stream.c
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-server-stream.c
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-server-stream.c
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-set-private.h b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-set-private.h
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-set-private.h
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-set-private.h
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-set.c b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-set.c
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-set.c
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-set.c
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-socket-private.h b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-socket-private.h
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-socket-private.h
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-socket-private.h
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-socket.c b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-socket.c
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-socket.c
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-socket.c
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-socket.h b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-socket.h
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-socket.h
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-socket.h
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-ssl-private.h b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-ssl-private.h
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-ssl-private.h
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-ssl-private.h
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-ssl.c b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-ssl.c
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-ssl.c
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-ssl.c
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-ssl.h b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-ssl.h
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-ssl.h
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-ssl.h
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-stream-buffered.c b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-stream-buffered.c
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-stream-buffered.c
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-stream-buffered.c
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-stream-buffered.h b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-stream-buffered.h
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-stream-buffered.h
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-stream-buffered.h
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-stream-file.c b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-stream-file.c
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-stream-file.c
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-stream-file.c
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-stream-file.h b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-stream-file.h
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-stream-file.h
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-stream-file.h
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-stream-gridfs.c b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-stream-gridfs.c
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-stream-gridfs.c
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-stream-gridfs.c
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-stream-gridfs.h b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-stream-gridfs.h
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-stream-gridfs.h
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-stream-gridfs.h
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-stream-private.h b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-stream-private.h
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-stream-private.h
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-stream-private.h
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-stream-socket.c b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-stream-socket.c
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-stream-socket.c
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-stream-socket.c
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-stream-socket.h b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-stream-socket.h
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-stream-socket.h
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-stream-socket.h
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-stream-tls-libressl-private.h b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-stream-tls-libressl-private.h
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-stream-tls-libressl-private.h
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-stream-tls-libressl-private.h
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-stream-tls-libressl.c b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-stream-tls-libressl.c
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-stream-tls-libressl.c
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-stream-tls-libressl.c
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-stream-tls-libressl.h b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-stream-tls-libressl.h
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-stream-tls-libressl.h
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-stream-tls-libressl.h
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-stream-tls-openssl-bio-private.h b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-stream-tls-openssl-bio-private.h
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-stream-tls-openssl-bio-private.h
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-stream-tls-openssl-bio-private.h
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-stream-tls-openssl-bio.c b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-stream-tls-openssl-bio.c
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-stream-tls-openssl-bio.c
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-stream-tls-openssl-bio.c
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-stream-tls-openssl-private.h b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-stream-tls-openssl-private.h
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-stream-tls-openssl-private.h
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-stream-tls-openssl-private.h
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-stream-tls-openssl.c b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-stream-tls-openssl.c
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-stream-tls-openssl.c
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-stream-tls-openssl.c
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-stream-tls-openssl.h b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-stream-tls-openssl.h
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-stream-tls-openssl.h
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-stream-tls-openssl.h
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-stream-tls-private.h b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-stream-tls-private.h
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-stream-tls-private.h
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-stream-tls-private.h
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-stream-tls-secure-channel-private.h b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-stream-tls-secure-channel-private.h
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-stream-tls-secure-channel-private.h
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-stream-tls-secure-channel-private.h
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-stream-tls-secure-channel.c b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-stream-tls-secure-channel.c
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-stream-tls-secure-channel.c
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-stream-tls-secure-channel.c
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-stream-tls-secure-channel.h b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-stream-tls-secure-channel.h
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-stream-tls-secure-channel.h
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-stream-tls-secure-channel.h
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-stream-tls-secure-transport-private.h b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-stream-tls-secure-transport-private.h
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-stream-tls-secure-transport-private.h
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-stream-tls-secure-transport-private.h
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-stream-tls-secure-transport.c b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-stream-tls-secure-transport.c
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-stream-tls-secure-transport.c
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-stream-tls-secure-transport.c
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-stream-tls-secure-transport.h b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-stream-tls-secure-transport.h
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-stream-tls-secure-transport.h
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-stream-tls-secure-transport.h
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-stream-tls.c b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-stream-tls.c
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-stream-tls.c
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-stream-tls.c
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-stream-tls.h b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-stream-tls.h
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-stream-tls.h
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-stream-tls.h
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-stream.c b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-stream.c
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-stream.c
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-stream.c
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-stream.h b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-stream.h
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-stream.h
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-stream.h
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-thread-private.h b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-thread-private.h
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-thread-private.h
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-thread-private.h
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-topology-description-apm-private.h b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-topology-description-apm-private.h
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-topology-description-apm-private.h
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-topology-description-apm-private.h
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-topology-description-apm.c b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-topology-description-apm.c
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-topology-description-apm.c
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-topology-description-apm.c
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-topology-description-private.h b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-topology-description-private.h
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-topology-description-private.h
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-topology-description-private.h
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-topology-description.c b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-topology-description.c
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-topology-description.c
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-topology-description.c
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-topology-description.h b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-topology-description.h
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-topology-description.h
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-topology-description.h
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-topology-private.h b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-topology-private.h
similarity index 98%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-topology-private.h
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-topology-private.h
index e5dfdf74..8f5e6a10 100644
--- a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-topology-private.h
+++ b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-topology-private.h
@@ -1,127 +1,127 @@
/*
* Copyright 2014 MongoDB, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef MONGOC_TOPOLOGY_PRIVATE_H
#define MONGOC_TOPOLOGY_PRIVATE_H
#include "mongoc-read-prefs-private.h"
#include "mongoc-topology-scanner-private.h"
#include "mongoc-server-description-private.h"
#include "mongoc-topology-description-private.h"
#include "mongoc-thread-private.h"
#include "mongoc-uri.h"
#define MONGOC_TOPOLOGY_MIN_HEARTBEAT_FREQUENCY_MS 500
#define MONGOC_TOPOLOGY_SOCKET_CHECK_INTERVAL_MS 5000
#define MONGOC_TOPOLOGY_COOLDOWN_MS 5000
-#define MONGOC_TOPOLOGY_LOCAL_THRESHOLD_MS 15000
+#define MONGOC_TOPOLOGY_LOCAL_THRESHOLD_MS 15
#define MONGOC_TOPOLOGY_SERVER_SELECTION_TIMEOUT_MS 30000
#define MONGOC_TOPOLOGY_HEARTBEAT_FREQUENCY_MS_MULTI_THREADED 10000
#define MONGOC_TOPOLOGY_HEARTBEAT_FREQUENCY_MS_SINGLE_THREADED 60000
typedef enum {
MONGOC_TOPOLOGY_SCANNER_OFF,
MONGOC_TOPOLOGY_SCANNER_BG_RUNNING,
MONGOC_TOPOLOGY_SCANNER_SHUTTING_DOWN,
MONGOC_TOPOLOGY_SCANNER_SINGLE_THREADED,
} mongoc_topology_scanner_state_t;
typedef struct _mongoc_topology_t
{
mongoc_topology_description_t description;
mongoc_uri_t *uri;
mongoc_topology_scanner_t *scanner;
bool server_selection_try_once;
int64_t last_scan;
int64_t local_threshold_msec;
int64_t connect_timeout_msec;
int64_t server_selection_timeout_msec;
mongoc_mutex_t mutex;
mongoc_cond_t cond_client;
mongoc_cond_t cond_server;
mongoc_thread_t thread;
mongoc_topology_scanner_state_t scanner_state;
bool scan_requested;
bool shutdown_requested;
bool single_threaded;
bool stale;
} mongoc_topology_t;
mongoc_topology_t *
mongoc_topology_new (const mongoc_uri_t *uri,
bool single_threaded);
void
mongoc_topology_set_apm_callbacks (mongoc_topology_t *topology,
mongoc_apm_callbacks_t *callbacks,
void *context);
void
mongoc_topology_destroy (mongoc_topology_t *topology);
bool
mongoc_topology_compatible (const mongoc_topology_description_t *td,
const mongoc_read_prefs_t *read_prefs,
bson_error_t *error);
mongoc_server_description_t *
mongoc_topology_select (mongoc_topology_t *topology,
mongoc_ss_optype_t optype,
const mongoc_read_prefs_t *read_prefs,
bson_error_t *error);
uint32_t
mongoc_topology_select_server_id (mongoc_topology_t *topology,
mongoc_ss_optype_t optype,
const mongoc_read_prefs_t *read_prefs,
bson_error_t *error);
mongoc_server_description_t *
mongoc_topology_server_by_id (mongoc_topology_t *topology,
uint32_t id,
bson_error_t *error);
mongoc_host_list_t *
_mongoc_topology_host_by_id (mongoc_topology_t *topology,
uint32_t id,
bson_error_t *error);
void
mongoc_topology_invalidate_server (mongoc_topology_t *topology,
uint32_t id,
const bson_error_t *error);
bool
_mongoc_topology_update_from_handshake (mongoc_topology_t *topology,
const mongoc_server_description_t *sd);
int64_t
mongoc_topology_server_timestamp (mongoc_topology_t *topology,
uint32_t id);
mongoc_topology_description_type_t
_mongoc_topology_get_type (mongoc_topology_t *topology);
bool
_mongoc_topology_start_background_scanner (mongoc_topology_t *topology);
bool
_mongoc_topology_set_appname (mongoc_topology_t *topology,
const char *appname);
#endif
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-topology-scanner-private.h b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-topology-scanner-private.h
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-topology-scanner-private.h
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-topology-scanner-private.h
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-topology-scanner.c b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-topology-scanner.c
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-topology-scanner.c
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-topology-scanner.c
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-topology.c b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-topology.c
similarity index 99%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-topology.c
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-topology.c
index b469bea2..2b894f4e 100644
--- a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-topology.c
+++ b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-topology.c
@@ -1,1129 +1,1128 @@
/*
* Copyright 2014 MongoDB, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "mongoc-config.h"
#include "mongoc-handshake.h"
#include "mongoc-handshake-private.h"
#include "mongoc-error.h"
#include "mongoc-log.h"
#include "mongoc-topology-private.h"
#include "mongoc-topology-description-apm-private.h"
#include "mongoc-client-private.h"
+#include "mongoc-uri-private.h"
#include "mongoc-util-private.h"
#include "utlist.h"
static void
_mongoc_topology_background_thread_stop (mongoc_topology_t *topology);
static void
_mongoc_topology_request_scan (mongoc_topology_t *topology);
static bool
_mongoc_topology_reconcile_add_nodes (void *item,
void *ctx)
{
mongoc_server_description_t *sd = item;
mongoc_topology_t *topology = (mongoc_topology_t *)ctx;
mongoc_topology_scanner_t *scanner = topology->scanner;
/* quickly search by id, then check if a node for this host was retired in
* this scan. */
if (! mongoc_topology_scanner_get_node (scanner, sd->id) &&
! mongoc_topology_scanner_has_node_for_host (scanner, &sd->host)) {
mongoc_topology_scanner_add_and_scan (scanner, &sd->host, sd->id,
topology->connect_timeout_msec);
}
return true;
}
void
mongoc_topology_reconcile (mongoc_topology_t *topology) {
mongoc_topology_scanner_node_t *ele, *tmp;
mongoc_topology_description_t *description;
mongoc_topology_scanner_t *scanner;
description = &topology->description;
scanner = topology->scanner;
/* Add newly discovered nodes */
mongoc_set_for_each(description->servers,
_mongoc_topology_reconcile_add_nodes,
topology);
/* Remove removed nodes */
DL_FOREACH_SAFE (scanner->nodes, ele, tmp) {
if (!mongoc_topology_description_server_by_id (description, ele->id, NULL)) {
mongoc_topology_scanner_node_retire (ele);
}
}
}
/* call this while already holding the lock */
static bool
_mongoc_topology_update_no_lock (uint32_t id,
const bson_t *ismaster_response,
int64_t rtt_msec,
mongoc_topology_t *topology,
const bson_error_t *error /* IN */)
{
mongoc_topology_description_handle_ismaster (&topology->description, id,
ismaster_response, rtt_msec,
error);
/* The processing of the ismaster results above may have added/removed
* server descriptions. We need to reconcile that with our monitoring agents
*/
mongoc_topology_reconcile(topology);
/* return false if server removed from topology */
return mongoc_topology_description_server_by_id (&topology->description,
id, NULL) != NULL;
}
/*
*-------------------------------------------------------------------------
*
* _mongoc_topology_scanner_setup_err_cb --
*
* Callback method to handle errors during topology scanner node
* setup, typically DNS or SSL errors.
*
*-------------------------------------------------------------------------
*/
void
_mongoc_topology_scanner_setup_err_cb (uint32_t id,
void *data,
const bson_error_t *error /* IN */)
{
mongoc_topology_t *topology;
BSON_ASSERT (data);
topology = (mongoc_topology_t *) data;
mongoc_topology_description_handle_ismaster (&topology->description,
id,
NULL /* ismaster reply */,
-1 /* rtt_msec */,
error);
}
/*
*-------------------------------------------------------------------------
*
* _mongoc_topology_scanner_cb --
*
* Callback method to handle ismaster responses received by async
* command objects.
*
* NOTE: This method locks the given topology's mutex.
*
*-------------------------------------------------------------------------
*/
void
_mongoc_topology_scanner_cb (uint32_t id,
const bson_t *ismaster_response,
int64_t rtt_msec,
void *data,
const bson_error_t *error /* IN */)
{
mongoc_topology_t *topology;
BSON_ASSERT (data);
topology = (mongoc_topology_t *)data;
mongoc_mutex_lock (&topology->mutex);
_mongoc_topology_update_no_lock (id, ismaster_response, rtt_msec, topology,
error);
mongoc_cond_broadcast (&topology->cond_client);
mongoc_mutex_unlock (&topology->mutex);
}
/*
*-------------------------------------------------------------------------
*
* mongoc_topology_new --
*
* Creates and returns a new topology object.
*
* Returns:
* A new topology object.
*
* Side effects:
* None.
*
*-------------------------------------------------------------------------
*/
mongoc_topology_t *
mongoc_topology_new (const mongoc_uri_t *uri,
bool single_threaded)
{
int64_t heartbeat_default;
int64_t heartbeat;
mongoc_topology_t *topology;
mongoc_topology_description_type_t init_type;
uint32_t id;
const mongoc_host_list_t *hl;
BSON_ASSERT (uri);
topology = (mongoc_topology_t *)bson_malloc0(sizeof *topology);
/*
* Not ideal, but there's no great way to do this.
* Base on the URI, we assume:
* - if we've got a replicaSet name, initialize to RS_NO_PRIMARY
* - otherwise, if the seed list has a single host, initialize to SINGLE
* - everything else gets initialized to UNKNOWN
*/
if (mongoc_uri_get_replica_set(uri)) {
init_type = MONGOC_TOPOLOGY_RS_NO_PRIMARY;
} else {
hl = mongoc_uri_get_hosts(uri);
if (hl->next) {
init_type = MONGOC_TOPOLOGY_UNKNOWN;
} else {
init_type = MONGOC_TOPOLOGY_SINGLE;
}
}
heartbeat_default = single_threaded ?
MONGOC_TOPOLOGY_HEARTBEAT_FREQUENCY_MS_SINGLE_THREADED :
MONGOC_TOPOLOGY_HEARTBEAT_FREQUENCY_MS_MULTI_THREADED;
heartbeat = mongoc_uri_get_option_as_int32 (uri, "heartbeatfrequencyms",
heartbeat_default);
mongoc_topology_description_init (&topology->description, init_type,
heartbeat);
topology->description.set_name = bson_strdup(mongoc_uri_get_replica_set(uri));
topology->uri = mongoc_uri_copy (uri);
topology->scanner_state = MONGOC_TOPOLOGY_SCANNER_OFF;
topology->scanner = mongoc_topology_scanner_new (topology->uri,
_mongoc_topology_scanner_setup_err_cb,
_mongoc_topology_scanner_cb,
topology);
topology->single_threaded = single_threaded;
if (single_threaded) {
/* Server Selection Spec:
*
* "Single-threaded drivers MUST provide a "serverSelectionTryOnce"
* mode, in which the driver scans the topology exactly once after
* server selection fails, then either selects a server or raises an
* error.
*
* "The serverSelectionTryOnce option MUST be true by default."
*/
topology->server_selection_try_once = mongoc_uri_get_option_as_bool (
uri,
"serverselectiontryonce",
true);
} else {
topology->server_selection_try_once = false;
}
topology->server_selection_timeout_msec = mongoc_uri_get_option_as_int32(
topology->uri, "serverselectiontimeoutms",
MONGOC_TOPOLOGY_SERVER_SELECTION_TIMEOUT_MS);
- topology->local_threshold_msec = mongoc_uri_get_option_as_int32 (
- topology->uri, "localthresholdms",
- MONGOC_TOPOLOGY_LOCAL_THRESHOLD_MS);
+ topology->local_threshold_msec = mongoc_uri_get_local_threshold_option (topology->uri);
/* Total time allowed to check a server is connectTimeoutMS.
* Server Discovery And Monitoring Spec:
*
* "The socket used to check a server MUST use the same connectTimeoutMS as
* regular sockets. Multi-threaded clients SHOULD set monitoring sockets'
* socketTimeoutMS to the connectTimeoutMS."
*/
topology->connect_timeout_msec = mongoc_uri_get_option_as_int32(
topology->uri, "connecttimeoutms",
MONGOC_DEFAULT_CONNECTTIMEOUTMS);
mongoc_mutex_init (&topology->mutex);
mongoc_cond_init (&topology->cond_client);
mongoc_cond_init (&topology->cond_server);
for ( hl = mongoc_uri_get_hosts (uri); hl; hl = hl->next) {
mongoc_topology_description_add_server (&topology->description,
hl->host_and_port,
&id);
mongoc_topology_scanner_add (topology->scanner, hl, id);
}
return topology;
}
/*
*-------------------------------------------------------------------------
*
* mongoc_topology_set_apm_callbacks --
*
* Set Application Performance Monitoring callbacks.
*
*-------------------------------------------------------------------------
*/
void
mongoc_topology_set_apm_callbacks (mongoc_topology_t *topology,
mongoc_apm_callbacks_t *callbacks,
void *context)
{
if (callbacks) {
memcpy (&topology->description.apm_callbacks, callbacks,
sizeof (mongoc_apm_callbacks_t));
memcpy (&topology->scanner->apm_callbacks, callbacks,
sizeof (mongoc_apm_callbacks_t));
}
topology->description.apm_context = context;
topology->scanner->apm_context = context;
}
/*
*-------------------------------------------------------------------------
*
* mongoc_topology_destroy --
*
* Free the memory associated with this topology object.
*
* Returns:
* None.
*
* Side effects:
* @topology will be cleaned up.
*
*-------------------------------------------------------------------------
*/
void
mongoc_topology_destroy (mongoc_topology_t *topology)
{
if (!topology) {
return;
}
_mongoc_topology_background_thread_stop (topology);
_mongoc_topology_description_monitor_closed (&topology->description);
mongoc_uri_destroy (topology->uri);
mongoc_topology_description_destroy(&topology->description);
mongoc_topology_scanner_destroy (topology->scanner);
mongoc_cond_destroy (&topology->cond_client);
mongoc_cond_destroy (&topology->cond_server);
mongoc_mutex_destroy (&topology->mutex);
bson_free(topology);
}
/*
*--------------------------------------------------------------------------
*
* _mongoc_topology_do_blocking_scan --
*
* Monitoring entry for single-threaded use case. Assumes the caller
* has checked that it's the right time to scan.
*
*--------------------------------------------------------------------------
*/
static void
_mongoc_topology_do_blocking_scan (mongoc_topology_t *topology,
bson_error_t *error)
{
mongoc_topology_scanner_t *scanner;
topology->scanner_state = MONGOC_TOPOLOGY_SCANNER_SINGLE_THREADED;
_mongoc_handshake_freeze ();
scanner = topology->scanner;
mongoc_topology_scanner_start (scanner,
(int32_t) topology->connect_timeout_msec,
true);
mongoc_topology_scanner_work (topology->scanner,
topology->connect_timeout_msec);
mongoc_mutex_lock (&topology->mutex);
_mongoc_topology_scanner_finish (scanner);
mongoc_topology_scanner_get_error (scanner, error);
/* "retired" nodes can be checked again in the next scan */
mongoc_topology_scanner_reset (scanner);
topology->last_scan = bson_get_monotonic_time ();
topology->stale = false;
mongoc_mutex_unlock (&topology->mutex);
}
bool
mongoc_topology_compatible (const mongoc_topology_description_t *td,
const mongoc_read_prefs_t *read_prefs,
bson_error_t *error)
{
int64_t max_staleness_seconds;
int32_t max_wire_version;
if (!read_prefs) {
/* NULL means read preference Primary */
return true;
}
max_staleness_seconds = mongoc_read_prefs_get_max_staleness_seconds (
read_prefs);
if (max_staleness_seconds != MONGOC_NO_MAX_STALENESS) {
max_wire_version = mongoc_topology_description_lowest_max_wire_version (
td);
if (max_wire_version < WIRE_VERSION_MAX_STALENESS) {
bson_set_error (error, MONGOC_ERROR_COMMAND,
MONGOC_ERROR_PROTOCOL_BAD_WIRE_VERSION,
"Not all servers support maxStalenessSeconds");
return false;
}
/* shouldn't happen if we've properly enforced wire version */
if (!mongoc_topology_description_all_sds_have_write_date (td)) {
bson_set_error (error, MONGOC_ERROR_COMMAND,
MONGOC_ERROR_PROTOCOL_BAD_WIRE_VERSION,
"Not all servers have lastWriteDate");
return false;
}
if (!_mongoc_topology_description_validate_max_staleness (
td, max_staleness_seconds, error)) {
return false;
}
}
return true;
}
static void
_mongoc_server_selection_error (const char *msg,
const bson_error_t *scanner_error,
bson_error_t *error)
{
if (scanner_error && scanner_error->code) {
bson_set_error (error,
MONGOC_ERROR_SERVER_SELECTION,
MONGOC_ERROR_SERVER_SELECTION_FAILURE,
"%s: %s",
msg, scanner_error->message);
} else {
bson_set_error (error,
MONGOC_ERROR_SERVER_SELECTION,
MONGOC_ERROR_SERVER_SELECTION_FAILURE,
"%s", msg);
}
}
/*
*-------------------------------------------------------------------------
*
* mongoc_topology_select --
*
* Selects a server description for an operation based on @optype
* and @read_prefs.
*
* NOTE: this method returns a copy of the original server
* description. Callers must own and clean up this copy.
*
* NOTE: this method locks and unlocks @topology's mutex.
*
* Parameters:
* @topology: The topology.
* @optype: Whether we are selecting for a read or write operation.
* @read_prefs: Required, the read preferences for the command.
* @error: Required, out pointer for error info.
*
* Returns:
* A mongoc_server_description_t, or NULL on failure, in which case
* @error will be set.
*
* Side effects:
* @error may be set.
*
*-------------------------------------------------------------------------
*/
mongoc_server_description_t *
mongoc_topology_select (mongoc_topology_t *topology,
mongoc_ss_optype_t optype,
const mongoc_read_prefs_t *read_prefs,
bson_error_t *error)
{
uint32_t server_id = mongoc_topology_select_server_id (topology, optype,
read_prefs, error);
if (server_id) {
/* new copy of the server description */
return mongoc_topology_server_by_id (topology, server_id, error);
} else {
return NULL;
}
}
/*
*-------------------------------------------------------------------------
*
* mongoc_topology_select_server_id --
*
* Alternative to mongoc_topology_select when you only need the id.
*
* Returns:
* A server id, or 0 on failure, in which case @error will be set.
*
*-------------------------------------------------------------------------
*/
uint32_t
mongoc_topology_select_server_id (mongoc_topology_t *topology,
mongoc_ss_optype_t optype,
const mongoc_read_prefs_t *read_prefs,
bson_error_t *error)
{
static const char *timeout_msg =
"No suitable servers found: `serverSelectionTimeoutMS` expired";
int r;
int64_t local_threshold_ms;
mongoc_server_description_t *selected_server = NULL;
bool try_once;
int64_t sleep_usec;
bool tried_once;
bson_error_t scanner_error = { 0 };
int64_t heartbeat_msec;
uint32_t server_id;
/* These names come from the Server Selection Spec pseudocode */
int64_t loop_start; /* when we entered this function */
int64_t loop_end; /* when we last completed a loop (single-threaded) */
int64_t scan_ready; /* the soonest we can do a blocking scan */
int64_t next_update; /* the latest we must do a blocking scan */
int64_t expire_at; /* when server selection timeout expires */
BSON_ASSERT (topology);
heartbeat_msec = topology->description.heartbeat_msec;
local_threshold_ms = topology->local_threshold_msec;
try_once = topology->server_selection_try_once;
loop_start = loop_end = bson_get_monotonic_time ();
expire_at = loop_start
+ ((int64_t) topology->server_selection_timeout_msec * 1000);
if (topology->single_threaded) {
_mongoc_topology_description_monitor_opening (&topology->description);
tried_once = false;
next_update = topology->last_scan + heartbeat_msec * 1000;
if (next_update < loop_start) {
/* we must scan now */
topology->stale = true;
}
/* until we find a server or time out */
for (;;) {
if (topology->stale) {
/* how soon are we allowed to scan? */
scan_ready = topology->last_scan
+ MONGOC_TOPOLOGY_MIN_HEARTBEAT_FREQUENCY_MS * 1000;
if (scan_ready > expire_at && !try_once) {
/* selection timeout will expire before min heartbeat passes */
_mongoc_server_selection_error (
"No suitable servers found: "
"`serverselectiontimeoutms` timed out",
&scanner_error, error);
topology->stale = true;
return 0;
}
sleep_usec = scan_ready - loop_end;
if (sleep_usec > 0) {
_mongoc_usleep (sleep_usec);
}
/* takes up to connectTimeoutMS. sets "last_scan", clears "stale" */
_mongoc_topology_do_blocking_scan (topology, &scanner_error);
loop_end = topology->last_scan;
tried_once = true;
}
if (!mongoc_topology_compatible (&topology->description, read_prefs,
error)) {
return 0;
}
selected_server = mongoc_topology_description_select (
&topology->description,
optype,
read_prefs,
local_threshold_ms);
if (selected_server) {
return selected_server->id;
}
topology->stale = true;
if (try_once) {
if (tried_once) {
_mongoc_server_selection_error (
"No suitable servers found (`serverSelectionTryOnce` set)",
&scanner_error, error);
return 0;
}
} else {
loop_end = bson_get_monotonic_time ();
if (loop_end > expire_at) {
/* no time left in server_selection_timeout_msec */
_mongoc_server_selection_error (timeout_msg,
&scanner_error, error);
return 0;
}
}
}
}
/* With background thread */
/* we break out when we've found a server or timed out */
for (;;) {
mongoc_mutex_lock (&topology->mutex);
if (!mongoc_topology_compatible (&topology->description, read_prefs,
error)) {
mongoc_mutex_unlock (&topology->mutex);
return 0;
}
selected_server = mongoc_topology_description_select (
&topology->description,
optype,
read_prefs,
local_threshold_ms);
if (! selected_server) {
_mongoc_topology_request_scan (topology);
r = mongoc_cond_timedwait (&topology->cond_client, &topology->mutex,
(expire_at - loop_start) / 1000);
mongoc_topology_scanner_get_error (topology->scanner, &scanner_error);
mongoc_mutex_unlock (&topology->mutex);
#ifdef _WIN32
if (r == WSAETIMEDOUT) {
#else
if (r == ETIMEDOUT) {
#endif
/* handle timeouts */
_mongoc_server_selection_error (timeout_msg,
&scanner_error, error);
return 0;
} else if (r) {
bson_set_error(error,
MONGOC_ERROR_SERVER_SELECTION,
MONGOC_ERROR_SERVER_SELECTION_FAILURE,
"Unknown error '%d' received while waiting on "
"thread condition", r);
return 0;
}
loop_start = bson_get_monotonic_time ();
if (loop_start > expire_at) {
_mongoc_server_selection_error (timeout_msg,
&scanner_error, error);
return 0;
}
} else {
server_id = selected_server->id;
mongoc_mutex_unlock (&topology->mutex);
return server_id;
}
}
}
/*
*-------------------------------------------------------------------------
*
* mongoc_topology_server_by_id --
*
* Get the server description for @id, if that server is present
* in @description. Otherwise, return NULL and fill out the optional
* @error.
*
* NOTE: this method returns a copy of the original server
* description. Callers must own and clean up this copy.
*
* NOTE: this method locks and unlocks @topology's mutex.
*
* Returns:
* A mongoc_server_description_t, or NULL.
*
* Side effects:
* Fills out optional @error if server not found.
*
*-------------------------------------------------------------------------
*/
mongoc_server_description_t *
mongoc_topology_server_by_id (mongoc_topology_t *topology,
uint32_t id,
bson_error_t *error)
{
mongoc_server_description_t *sd;
mongoc_mutex_lock (&topology->mutex);
sd = mongoc_server_description_new_copy (
mongoc_topology_description_server_by_id (&topology->description,
id,
error));
mongoc_mutex_unlock (&topology->mutex);
return sd;
}
/*
*-------------------------------------------------------------------------
*
* mongoc_topology_host_by_id --
*
* Copy the mongoc_host_list_t for @id, if that server is present
* in @description. Otherwise, return NULL and fill out the optional
* @error.
*
* NOTE: this method returns a copy of the original mongoc_host_list_t.
* Callers must own and clean up this copy.
*
* NOTE: this method locks and unlocks @topology's mutex.
*
* Returns:
* A mongoc_host_list_t, or NULL.
*
* Side effects:
* Fills out optional @error if server not found.
*
*-------------------------------------------------------------------------
*/
mongoc_host_list_t *
_mongoc_topology_host_by_id (mongoc_topology_t *topology,
uint32_t id,
bson_error_t *error)
{
mongoc_server_description_t *sd;
mongoc_host_list_t *host = NULL;
mongoc_mutex_lock (&topology->mutex);
/* not a copy - direct pointer into topology description data */
sd = mongoc_topology_description_server_by_id (&topology->description,
id,
error);
if (sd) {
host = bson_malloc0 (sizeof (mongoc_host_list_t));
memcpy (host, &sd->host, sizeof (mongoc_host_list_t));
}
mongoc_mutex_unlock (&topology->mutex);
return host;
}
/*
*--------------------------------------------------------------------------
*
* _mongoc_topology_request_scan --
*
* Non-locking variant
*
*--------------------------------------------------------------------------
*/
static void
_mongoc_topology_request_scan (mongoc_topology_t *topology)
{
topology->scan_requested = true;
mongoc_cond_signal (&topology->cond_server);
}
/*
*--------------------------------------------------------------------------
*
* mongoc_topology_invalidate_server --
*
* Invalidate the given server after receiving a network error in
* another part of the client.
*
* NOTE: this method uses @topology's mutex.
*
*--------------------------------------------------------------------------
*/
void
mongoc_topology_invalidate_server (mongoc_topology_t *topology,
uint32_t id,
const bson_error_t *error)
{
BSON_ASSERT (error);
mongoc_mutex_lock (&topology->mutex);
mongoc_topology_description_invalidate_server (&topology->description,
id, error);
mongoc_mutex_unlock (&topology->mutex);
}
/*
*--------------------------------------------------------------------------
*
* _mongoc_topology_update_from_handshake --
*
* A client opens a new connection and calls ismaster on it when it
* detects a closed connection in _mongoc_cluster_check_interval, or if
* mongoc_client_pool_pop creates a new client. Update the topology
* description from the ismaster response.
*
* NOTE: this method uses @topology's mutex.
*
* Returns:
* false if the server was removed from the topology
*--------------------------------------------------------------------------
*/
bool
_mongoc_topology_update_from_handshake (mongoc_topology_t *topology,
const mongoc_server_description_t *sd)
{
bool has_server;
BSON_ASSERT (topology);
BSON_ASSERT (sd);
mongoc_mutex_lock (&topology->mutex);
has_server = _mongoc_topology_update_no_lock (sd->id, &sd->last_is_master,
sd->round_trip_time_msec,
topology, NULL);
/* if pooled, wake threads waiting in mongoc_topology_server_by_id */
mongoc_cond_broadcast (&topology->cond_client);
mongoc_mutex_unlock (&topology->mutex);
return has_server;
}
/*
*--------------------------------------------------------------------------
*
* mongoc_topology_server_timestamp --
*
* Return the topology's scanner's timestamp for the given server,
* or -1 if there is no scanner node for the given server.
*
* NOTE: this method uses @topology's mutex.
*
* Returns:
* Timestamp, or -1
*
*--------------------------------------------------------------------------
*/
int64_t
mongoc_topology_server_timestamp (mongoc_topology_t *topology,
uint32_t id)
{
mongoc_topology_scanner_node_t *node;
int64_t timestamp = -1;
mongoc_mutex_lock (&topology->mutex);
node = mongoc_topology_scanner_get_node (topology->scanner, id);
if (node) {
timestamp = node->timestamp;
}
mongoc_mutex_unlock (&topology->mutex);
return timestamp;
}
/*
*--------------------------------------------------------------------------
*
* _mongoc_topology_get_type --
*
* Return the topology's description's type.
*
* NOTE: this method uses @topology's mutex.
*
* Returns:
* The topology description type.
*
*--------------------------------------------------------------------------
*/
mongoc_topology_description_type_t
_mongoc_topology_get_type (mongoc_topology_t *topology)
{
mongoc_topology_description_type_t td_type;
mongoc_mutex_lock (&topology->mutex);
td_type = topology->description.type;
mongoc_mutex_unlock (&topology->mutex);
return td_type;
}
/*
*--------------------------------------------------------------------------
*
* _mongoc_topology_run_background --
*
* The background topology monitoring thread runs in this loop.
*
* NOTE: this method uses @topology's mutex.
*
*--------------------------------------------------------------------------
*/
static
void * _mongoc_topology_run_background (void *data)
{
mongoc_topology_t *topology;
int64_t now;
int64_t last_scan;
int64_t timeout;
int64_t force_timeout;
int64_t heartbeat_msec;
int r;
BSON_ASSERT (data);
last_scan = 0;
topology = (mongoc_topology_t *)data;
heartbeat_msec = topology->description.heartbeat_msec;
/* we exit this loop when shutdown_requested, or on error */
for (;;) {
/* unlocked after starting a scan or after breaking out of the loop */
mongoc_mutex_lock (&topology->mutex);
/* we exit this loop on error, or when we should scan immediately */
for (;;) {
if (topology->shutdown_requested) goto DONE;
now = bson_get_monotonic_time ();
if (last_scan == 0) {
/* set up the "last scan" as exactly long enough to force an
* immediate scan on the first pass */
last_scan = now - (heartbeat_msec * 1000);
}
timeout = heartbeat_msec - ((now - last_scan) / 1000);
/* if someone's specifically asked for a scan, use a shorter interval */
if (topology->scan_requested) {
force_timeout = MONGOC_TOPOLOGY_MIN_HEARTBEAT_FREQUENCY_MS - ((now - last_scan) / 1000);
timeout = BSON_MIN (timeout, force_timeout);
}
/* if we can start scanning, do so immediately */
if (timeout <= 0) {
mongoc_topology_scanner_start (topology->scanner,
topology->connect_timeout_msec,
false);
break;
} else {
/* otherwise wait until someone:
* o requests a scan
* o we time out
* o requests a shutdown
*/
r = mongoc_cond_timedwait (&topology->cond_server, &topology->mutex, timeout);
#ifdef _WIN32
if (! (r == 0 || r == WSAETIMEDOUT)) {
#else
if (! (r == 0 || r == ETIMEDOUT)) {
#endif
/* handle errors */
goto DONE;
}
/* if we timed out, or were woken up, check if it's time to scan
* again, or bail out */
}
}
topology->scan_requested = false;
/* scanning locks and unlocks the mutex itself until the scan is done */
mongoc_mutex_unlock (&topology->mutex);
mongoc_topology_scanner_work (topology->scanner,
topology->connect_timeout_msec);
mongoc_mutex_lock (&topology->mutex);
_mongoc_topology_scanner_finish (topology->scanner);
/* "retired" nodes can be checked again in the next scan */
mongoc_topology_scanner_reset (topology->scanner);
topology->last_scan = bson_get_monotonic_time ();
mongoc_mutex_unlock (&topology->mutex);
last_scan = bson_get_monotonic_time();
}
DONE:
mongoc_mutex_unlock (&topology->mutex);
return NULL;
}
/*
*--------------------------------------------------------------------------
*
* mongoc_topology_start_background_scanner
*
* Start the topology background thread running. This should only be
* called once per pool. If clients are created separately (not
* through a pool) the SDAM logic will not be run in a background
* thread. Returns whether or not the scanner is running on termination
* of the function.
*
* NOTE: this method uses @topology's mutex.
*
*--------------------------------------------------------------------------
*/
bool
_mongoc_topology_start_background_scanner (mongoc_topology_t *topology)
{
int r;
if (topology->single_threaded) {
return false;
}
mongoc_mutex_lock (&topology->mutex);
if (topology->scanner_state == MONGOC_TOPOLOGY_SCANNER_OFF) {
topology->scanner_state = MONGOC_TOPOLOGY_SCANNER_BG_RUNNING;
_mongoc_handshake_freeze ();
_mongoc_topology_description_monitor_opening (&topology->description);
r = mongoc_thread_create (&topology->thread,
_mongoc_topology_run_background, topology);
if (r != 0) {
MONGOC_ERROR ("could not start topology scanner thread: %s",
strerror (r));
abort ();
}
}
mongoc_mutex_unlock (&topology->mutex);
return true;
}
/*
*--------------------------------------------------------------------------
*
* mongoc_topology_background_thread_stop --
*
* Stop the topology background thread. Called by the owning pool at
* its destruction.
*
* NOTE: this method uses @topology's mutex.
*
*--------------------------------------------------------------------------
*/
static void
_mongoc_topology_background_thread_stop (mongoc_topology_t *topology)
{
bool join_thread = false;
if (topology->single_threaded) {
return;
}
mongoc_mutex_lock (&topology->mutex);
if (topology->scanner_state == MONGOC_TOPOLOGY_SCANNER_BG_RUNNING) {
/* if the background thread is running, request a shutdown and signal the
* thread */
topology->shutdown_requested = true;
mongoc_cond_signal (&topology->cond_server);
topology->scanner_state = MONGOC_TOPOLOGY_SCANNER_SHUTTING_DOWN;
join_thread = true;
} else if (topology->scanner_state == MONGOC_TOPOLOGY_SCANNER_SHUTTING_DOWN) {
/* if we're mid shutdown, wait until it shuts down */
while (topology->scanner_state != MONGOC_TOPOLOGY_SCANNER_OFF) {
mongoc_cond_wait (&topology->cond_client, &topology->mutex);
}
} else {
/* nothing to do if it's already off */
}
mongoc_mutex_unlock (&topology->mutex);
if (join_thread) {
/* if we're joining the thread, wait for it to come back and broadcast
* all listeners */
mongoc_thread_join (topology->thread);
mongoc_cond_broadcast (&topology->cond_client);
}
}
bool
_mongoc_topology_set_appname (mongoc_topology_t *topology,
const char *appname)
{
bool ret = false;
mongoc_mutex_lock (&topology->mutex);
if (topology->scanner_state == MONGOC_TOPOLOGY_SCANNER_OFF) {
ret = _mongoc_topology_scanner_set_appname (topology->scanner,
appname);
} else {
MONGOC_ERROR ("Cannot set appname after handshake initiated");
}
mongoc_mutex_unlock (&topology->mutex);
return ret;
}
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-trace-private.h b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-trace-private.h
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-trace-private.h
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-trace-private.h
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-uri-private.h b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-uri-private.h
similarity index 94%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-uri-private.h
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-uri-private.h
index d39920d4..6188b28c 100644
--- a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-uri-private.h
+++ b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-uri-private.h
@@ -1,45 +1,48 @@
/*
* Copyright 2015 MongoDB, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef MONGOC_URI_PRIVATE_H
#define MONGOC_URI_PRIVATE_H
#if !defined (MONGOC_COMPILATION)
#error "Only <mongoc.h> can be included directly."
#endif
#include "mongoc-uri.h"
BSON_BEGIN_DECLS
void
mongoc_uri_lowercase_hostname ( const char *src,
char *buf /* OUT */,
int len);
bool
mongoc_uri_append_host ( mongoc_uri_t *uri,
const char *host,
uint16_t port);
bool
mongoc_uri_parse_host ( mongoc_uri_t *uri,
const char *str);
+int32_t
+mongoc_uri_get_local_threshold_option (const mongoc_uri_t *uri);
+
BSON_END_DECLS
#endif /* MONGOC_URI_PRIVATE_H */
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-uri.c b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-uri.c
similarity index 98%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-uri.c
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-uri.c
index c5248b29..4bc24843 100644
--- a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-uri.c
+++ b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-uri.c
@@ -1,1718 +1,1741 @@
/*
* Copyright 2013 MongoDB, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <ctype.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <math.h>
/* strcasecmp on windows */
#include "mongoc-util-private.h"
#include "mongoc-config.h"
#include "mongoc-host-list.h"
#include "mongoc-host-list-private.h"
#include "mongoc-log.h"
#include "mongoc-handshake-private.h"
#include "mongoc-socket.h"
+#include "mongoc-topology-private.h"
#include "mongoc-uri-private.h"
#include "mongoc-read-concern-private.h"
#include "mongoc-write-concern-private.h"
struct _mongoc_uri_t
{
char *str;
mongoc_host_list_t *hosts;
char *username;
char *password;
char *database;
bson_t options;
bson_t credentials;
mongoc_read_prefs_t *read_prefs;
mongoc_read_concern_t *read_concern;
mongoc_write_concern_t *write_concern;
};
static void
mongoc_uri_do_unescape (char **str)
{
char *tmp;
if ((tmp = *str)) {
*str = mongoc_uri_unescape(tmp);
bson_free(tmp);
}
}
void
mongoc_uri_lowercase_hostname (const char *src,
char *buf /* OUT */,
int len)
{
bson_unichar_t c;
const char *iter;
char *buf_iter;
/* TODO: this code only accepts ascii, and assumes that lowercased
chars are the same width as originals */
for (iter = src, buf_iter = buf;
iter && *iter && (c = bson_utf8_get_char(iter)) && buf_iter - buf < len;
iter = bson_utf8_next_char(iter), buf_iter++) {
assert(c < 128);
*buf_iter = tolower(c);
}
}
bool
mongoc_uri_append_host (mongoc_uri_t *uri,
const char *host,
uint16_t port)
{
mongoc_host_list_t *iter;
mongoc_host_list_t *link_;
if (strlen (host) > BSON_HOST_NAME_MAX) {
MONGOC_ERROR ("Hostname provided in URI is too long, max is %d chars",
BSON_HOST_NAME_MAX);
return false;
}
link_ = (mongoc_host_list_t *)bson_malloc0(sizeof *link_);
mongoc_uri_lowercase_hostname(host, link_->host, sizeof link_->host);
if (strchr (host, ':')) {
bson_snprintf (link_->host_and_port, sizeof link_->host_and_port,
"[%s]:%hu", host, port);
link_->family = AF_INET6;
} else {
bson_snprintf (link_->host_and_port, sizeof link_->host_and_port,
"%s:%hu", host, port);
link_->family = strstr (host, ".sock") ? AF_UNIX : AF_INET;
}
link_->host_and_port[sizeof link_->host_and_port - 1] = '\0';
link_->port = port;
if ((iter = uri->hosts)) {
for (; iter && iter->next; iter = iter->next) {}
iter->next = link_;
} else {
uri->hosts = link_;
}
return true;
}
/*
*--------------------------------------------------------------------------
*
* scan_to_unichar --
*
* Scans 'str' until either a character matching 'match' is found,
* until one of the characters in 'terminators' is encountered, or
* until we reach the end of 'str'.
*
* NOTE: 'terminators' may not include multibyte UTF-8 characters.
*
* Returns:
* If 'match' is found, returns a copy of the section of 'str' before
* that character. Otherwise, returns NULL.
*
* Side Effects:
* If 'match' is found, sets 'end' to begin at the matching character
* in 'str'.
*
*--------------------------------------------------------------------------
*/
static char *
scan_to_unichar (const char *str,
bson_unichar_t match,
const char *terminators,
const char **end)
{
bson_unichar_t c;
const char *iter;
for (iter = str;
iter && *iter && (c = bson_utf8_get_char(iter));
iter = bson_utf8_next_char(iter)) {
if (c == match) {
*end = iter;
return bson_strndup(str, iter - str);
} else if (c == '\\') {
iter = bson_utf8_next_char(iter);
if (!bson_utf8_get_char(iter)) {
break;
}
} else {
const char *term_iter;
for (term_iter = terminators; *term_iter; term_iter++) {
if (c == *term_iter) {
return NULL;
}
}
}
}
return NULL;
}
static bool
mongoc_uri_parse_scheme (const char *str,
const char **end)
{
if (!!strncmp(str, "mongodb://", 10)) {
return false;
}
*end = str + 10;
return true;
}
static bool
mongoc_uri_parse_userpass (mongoc_uri_t *uri,
const char *str,
const char **end)
{
bool ret = false;
const char *end_userpass;
const char *end_user;
char *s;
if ((s = scan_to_unichar(str, '@', "", &end_userpass))) {
if ((uri->username = scan_to_unichar(s, ':', "", &end_user))) {
uri->password = bson_strdup(end_user + 1);
} else {
uri->username = bson_strndup(str, end_userpass - str);
uri->password = NULL;
}
mongoc_uri_do_unescape(&uri->username);
mongoc_uri_do_unescape(&uri->password);
*end = end_userpass + 1;
bson_free(s);
ret = true;
} else {
ret = true;
}
return ret;
}
static bool
mongoc_uri_parse_port (uint16_t *port,
const char *str)
{
unsigned long ul_port;
ul_port = strtoul (str, NULL, 10);
if (ul_port == 0 || ul_port > UINT16_MAX) {
/* Parse error or port number out of range. mongod prohibits port 0. */
return false;
}
*port = (uint16_t)ul_port;
return true;
}
static bool
mongoc_uri_parse_host6 (mongoc_uri_t *uri,
const char *str)
{
uint16_t port = MONGOC_DEFAULT_PORT;
const char *portstr;
const char *end_host;
char *hostname;
bool r;
if ((portstr = strrchr (str, ':')) && !strstr (portstr, "]")) {
if (!mongoc_uri_parse_port(&port, portstr + 1)) {
return false;
}
}
hostname = scan_to_unichar (str + 1, ']', "", &end_host);
mongoc_uri_do_unescape (&hostname);
if (!hostname) {
return false;
}
r = mongoc_uri_append_host (uri, hostname, port);
bson_free (hostname);
return r;
}
bool
mongoc_uri_parse_host (mongoc_uri_t *uri,
const char *str)
{
uint16_t port;
const char *end_host;
char *hostname;
bool r;
if (*str == '[' && strchr (str, ']')) {
return mongoc_uri_parse_host6 (uri, str);
}
if ((hostname = scan_to_unichar(str, ':', "?/,", &end_host))) {
end_host++;
if (!mongoc_uri_parse_port(&port, end_host)) {
bson_free (hostname);
return false;
}
} else {
hostname = bson_strdup(str);
port = MONGOC_DEFAULT_PORT;
}
mongoc_uri_do_unescape(&hostname);
if (!hostname) {
/* invalid */
bson_free (hostname);
return false;
}
r = mongoc_uri_append_host (uri, hostname, port);
bson_free(hostname);
return r;
}
bool
_mongoc_host_list_from_string (mongoc_host_list_t *host_list,
const char *host_and_port)
{
bool rval = false;
char *uri_str = NULL;
mongoc_uri_t *uri = NULL;
const mongoc_host_list_t *uri_hl;
BSON_ASSERT (host_list);
BSON_ASSERT (host_and_port);
uri_str = bson_strdup_printf("mongodb://%s/", host_and_port);
if (! uri_str) goto CLEANUP;
uri = mongoc_uri_new(uri_str);
if (! uri) goto CLEANUP;
uri_hl = mongoc_uri_get_hosts(uri);
if (uri_hl->next) goto CLEANUP;
memcpy(host_list, uri_hl, sizeof(*uri_hl));
rval = true;
CLEANUP:
bson_free(uri_str);
if (uri) mongoc_uri_destroy(uri);
return rval;
}
static bool
mongoc_uri_parse_hosts (mongoc_uri_t *uri,
const char *str,
const char **end)
{
bool ret = false;
const char *end_hostport;
const char *sock;
const char *tmp;
char *s;
/*
* Parsing the series of hosts is a lot more complicated than you might
* imagine. This is due to some characters being both separators as well as
* valid characters within the "hostname". In particularly, we can have file
* paths to specify paths to UNIX domain sockets. We impose the restriction
* that they must be suffixed with ".sock" to simplify the parsing.
*
* You can separate hosts and file system paths to UNIX domain sockets with
* ",".
*
* When you reach a "/" or "?" that is not part of a file-system path, we
* have completed our parsing of hosts.
*/
again:
if (((*str == '/') && (sock = strstr(str, ".sock"))) &&
(!(tmp = strstr(str, ",")) || (tmp > sock)) &&
(!(tmp = strstr(str, "?")) || (tmp > sock))) {
s = bson_strndup(str, sock + 5 - str);
if (!mongoc_uri_parse_host(uri, s)) {
bson_free(s);
return false;
}
bson_free(s);
str = sock + 5;
ret = true;
if (*str == ',') {
str++;
goto again;
}
} else if ((s = scan_to_unichar(str, ',', "/", &end_hostport))) {
if (!mongoc_uri_parse_host(uri, s)) {
bson_free(s);
return false;
}
bson_free(s);
str = end_hostport + 1;
ret = true;
goto again;
} else if ((s = scan_to_unichar(str, '/', "", &end_hostport)) ||
(s = scan_to_unichar(str, '?', "", &end_hostport))) {
if (!mongoc_uri_parse_host(uri, s)) {
bson_free(s);
return false;
}
bson_free(s);
*end = end_hostport;
return true;
} else if (*str) {
if (!mongoc_uri_parse_host(uri, str)) {
return false;
}
*end = str + strlen(str);
return true;
}
return ret;
}
static bool
mongoc_uri_parse_database (mongoc_uri_t *uri,
const char *str,
const char **end)
{
const char *end_database;
if ((uri->database = scan_to_unichar(str, '?', "", &end_database))) {
*end = end_database;
} else if (*str) {
uri->database = bson_strdup(str);
*end = str + strlen(str);
}
mongoc_uri_do_unescape(&uri->database);
if (!uri->database) {
/* invalid */
return false;
}
return true;
}
static bool
mongoc_uri_parse_auth_mechanism_properties (mongoc_uri_t *uri,
const char *str)
{
char *field;
char *value;
const char *end_scan;
bson_t properties;
bson_init(&properties);
/* build up the properties document */
while ((field = scan_to_unichar(str, ':', "&", &end_scan))) {
str = end_scan + 1;
if (!(value = scan_to_unichar(str, ',', ":&", &end_scan))) {
value = bson_strdup(str);
str = "";
} else {
str = end_scan + 1;
}
bson_append_utf8(&properties, field, -1, value, -1);
bson_free(field);
bson_free(value);
}
/* append our auth properties to our credentials */
bson_append_document(&uri->credentials, "mechanismProperties",
-1, (const bson_t *)&properties);
return true;
}
static bool
mongoc_uri_parse_tags (mongoc_uri_t *uri, /* IN */
const char *str) /* IN */
{
const char *end_keyval;
const char *end_key;
bson_t b;
char *keyval;
char *key;
bson_init(&b);
again:
if ((keyval = scan_to_unichar(str, ',', "", &end_keyval))) {
if (!(key = scan_to_unichar(keyval, ':', "", &end_key))) {
bson_free (keyval);
goto fail;
}
bson_append_utf8(&b, key, -1, end_key + 1, -1);
bson_free(key);
bson_free(keyval);
str = end_keyval + 1;
goto again;
} else if ((key = scan_to_unichar(str, ':', "", &end_key))) {
bson_append_utf8(&b, key, -1, end_key + 1, -1);
bson_free(key);
} else if (strlen (str)) {
/* we're not finished but we couldn't parse the string */
goto fail;
}
mongoc_read_prefs_add_tag(uri->read_prefs, &b);
bson_destroy(&b);
return true;
fail:
MONGOC_WARNING ("invalid readPreferenceTags: \"%s\"", str);
bson_destroy (&b);
return false;
}
/*
*--------------------------------------------------------------------------
*
* mongoc_uri_bson_append_or_replace_key --
*
*
* Appends 'option' to the end of 'options' if not already set.
*
* Since we cannot grow utf8 strings inline, we have to allocate a temporary
* bson variable and splice in the new value if the key is already set.
*
* NOTE: This function keeps the order of the BSON keys.
*
* NOTE: 'option' is case*in*sensitive.
*
*
*--------------------------------------------------------------------------
*/
static void
mongoc_uri_bson_append_or_replace_key (bson_t *options, const char *option, const char *value)
{
bson_iter_t iter;
bool found = false;
if (bson_iter_init (&iter, options)) {
bson_t tmp = BSON_INITIALIZER;
while (bson_iter_next (&iter)) {
const bson_value_t *bvalue;
if (!strcasecmp(bson_iter_key (&iter), option)) {
bson_append_utf8(&tmp, option, -1, value, -1);
found = true;
continue;
}
bvalue = bson_iter_value (&iter);
BSON_APPEND_VALUE (&tmp, bson_iter_key (&iter), bvalue);
}
if (! found) {
bson_append_utf8(&tmp, option, -1, value, -1);
}
bson_destroy (options);
bson_copy_to (&tmp, options);
bson_destroy (&tmp);
}
}
bool
mongoc_uri_option_is_int32 (const char *key)
{
return !strcasecmp(key, "connecttimeoutms") ||
!strcasecmp(key, "heartbeatfrequencyms") ||
!strcasecmp(key, "serverselectiontimeoutms") ||
!strcasecmp(key, "socketcheckintervalms") ||
!strcasecmp(key, "sockettimeoutms") ||
!strcasecmp(key, "localthresholdms") ||
!strcasecmp(key, "maxpoolsize") ||
!strcasecmp(key, "maxstalenessseconds") ||
!strcasecmp(key, "minpoolsize") ||
!strcasecmp(key, "maxidletimems") ||
!strcasecmp(key, "waitqueuemultiple") ||
!strcasecmp(key, "waitqueuetimeoutms") ||
!strcasecmp(key, "wtimeoutms");
}
bool
mongoc_uri_option_is_bool (const char *key)
{
return !strcasecmp(key, "canonicalizeHostname") ||
!strcasecmp(key, "journal") ||
!strcasecmp(key, "safe") ||
!strcasecmp(key, "serverSelectionTryOnce") ||
!strcasecmp(key, "slaveok") ||
!strcasecmp(key, "ssl");
}
bool
mongoc_uri_option_is_utf8 (const char *key)
{
if (mongoc_uri_option_is_bool(key) || mongoc_uri_option_is_int32(key)) {
return false;
}
if (!strcasecmp(key, "readpreferencetags") ||
!strcasecmp(key, "authmechanismproperties")) {
return false;
}
if (!strcasecmp(key, "username") || !strcasecmp(key, "password")
|| !strcasecmp(key, "authsource") || !strcasecmp(key, "database")) {
return false;
}
return true;
}
static bool
mongoc_uri_parse_int32 (const char *key,
const char *value,
int32_t *result)
{
char *endptr;
int64_t i;
errno = 0;
i = bson_ascii_strtoll (value, &endptr, 10);
if (errno || endptr < value + strlen (value)) {
MONGOC_WARNING ("Invalid %s: cannot parse integer\n", key);
return false;
}
if (i > INT32_MAX || i < INT32_MIN) {
MONGOC_WARNING ("Invalid %s: cannot fit in int32\n", key);
return false;
}
*result = (int32_t) i;
return true;
}
static bool
mongoc_uri_parse_option (mongoc_uri_t *uri,
const char *str)
{
int32_t v_int;
const char *end_key;
char *key = NULL;
char *value = NULL;
bool ret = false;
if (!(key = scan_to_unichar(str, '=', "", &end_key))) {
goto CLEANUP;
}
value = bson_strdup(end_key + 1);
mongoc_uri_do_unescape(&value);
if (!value) {
/* do_unescape detected invalid UTF-8 and freed value */
goto CLEANUP;
}
if (mongoc_uri_option_is_int32(key)) {
if (!mongoc_uri_parse_int32 (key, value, &v_int)) {
goto CLEANUP;
}
BSON_APPEND_INT32 (&uri->options, key, v_int);
} else if (!strcasecmp(key, "w")) {
if (*value == '-' || isdigit(*value)) {
v_int = (int) strtol (value, NULL, 10);
BSON_APPEND_INT32 (&uri->options, "w", v_int);
} else if (0 == strcasecmp (value, "majority")) {
BSON_APPEND_UTF8 (&uri->options, "w", "majority");
} else if (*value) {
BSON_APPEND_UTF8 (&uri->options, "w", value);
}
} else if (mongoc_uri_option_is_bool(key)) {
bson_append_bool (&uri->options, key, -1,
(0 == strcasecmp (value, "true")) ||
(0 == strcasecmp (value, "t")) ||
(0 == strcmp (value, "1")));
} else if (!strcasecmp(key, "readpreferencetags")) {
if (!mongoc_uri_parse_tags(uri, value)) {
goto CLEANUP;
}
} else if (!strcasecmp(key, "authmechanism") ||
!strcasecmp(key, "authsource")) {
bson_append_utf8(&uri->credentials, key, -1, value, -1);
} else if (!strcasecmp(key, "readconcernlevel")) {
mongoc_read_concern_set_level (uri->read_concern, value);
} else if (!strcasecmp(key, "authmechanismproperties")) {
if (!mongoc_uri_parse_auth_mechanism_properties(uri, value)) {
goto CLEANUP;
}
} else if (!strcasecmp (key, "appname")) {
if (!mongoc_uri_set_appname (uri, value)) {
MONGOC_WARNING ("Cannot set appname: %s is invalid", value);
goto CLEANUP;
}
} else {
bson_append_utf8(&uri->options, key, -1, value, -1);
}
ret = true;
CLEANUP:
bson_free(key);
bson_free(value);
return ret;
}
static bool
mongoc_uri_parse_options (mongoc_uri_t *uri,
const char *str)
{
const char *end_option;
char *option;
again:
if ((option = scan_to_unichar(str, '&', "", &end_option))) {
if (!mongoc_uri_parse_option(uri, option)) {
bson_free(option);
return false;
}
bson_free(option);
str = end_option + 1;
goto again;
} else if (*str) {
if (!mongoc_uri_parse_option(uri, str)) {
return false;
}
}
return true;
}
static bool
mongoc_uri_finalize_auth (mongoc_uri_t *uri) {
bson_iter_t iter;
const char *source = NULL;
const char *mechanism = mongoc_uri_get_auth_mechanism(uri);
if (bson_iter_init_find_case(&iter, &uri->credentials, "authSource")) {
source = bson_iter_utf8(&iter, NULL);
}
/* authSource with GSSAPI or X509 should always be external */
if (mechanism) {
if (!strcasecmp(mechanism, "GSSAPI") ||
!strcasecmp(mechanism, "MONGODB-X509")) {
if (source) {
if (strcasecmp(source, "$external")) {
return false;
}
} else {
bson_append_utf8(&uri->credentials, "authsource", -1, "$external", -1);
}
}
}
return true;
}
static bool
mongoc_uri_parse (mongoc_uri_t *uri,
const char *str)
{
if (!mongoc_uri_parse_scheme(str, &str)) {
return false;
}
if (!*str || !mongoc_uri_parse_userpass(uri, str, &str)) {
return false;
}
if (!*str || !mongoc_uri_parse_hosts(uri, str, &str)) {
return false;
}
switch (*str) {
case '/':
str++;
if (*str && !mongoc_uri_parse_database(uri, str, &str)) {
return false;
}
if (!*str) {
break;
}
/* Fall through */
case '?':
str++;
if (*str && !mongoc_uri_parse_options(uri, str)) {
return false;
}
break;
default:
break;
}
return mongoc_uri_finalize_auth(uri);
}
const mongoc_host_list_t *
mongoc_uri_get_hosts (const mongoc_uri_t *uri)
{
BSON_ASSERT (uri);
return uri->hosts;
}
const char *
mongoc_uri_get_replica_set (const mongoc_uri_t *uri)
{
bson_iter_t iter;
BSON_ASSERT (uri);
if (bson_iter_init_find_case(&iter, &uri->options, "replicaSet") &&
BSON_ITER_HOLDS_UTF8(&iter)) {
return bson_iter_utf8(&iter, NULL);
}
return NULL;
}
const bson_t *
mongoc_uri_get_credentials (const mongoc_uri_t *uri)
{
BSON_ASSERT (uri);
return &uri->credentials;
}
const char *
mongoc_uri_get_auth_mechanism (const mongoc_uri_t *uri)
{
bson_iter_t iter;
BSON_ASSERT (uri);
if (bson_iter_init_find_case (&iter, &uri->credentials, "authMechanism") &&
BSON_ITER_HOLDS_UTF8 (&iter)) {
return bson_iter_utf8 (&iter, NULL);
}
return NULL;
}
bool
mongoc_uri_get_mechanism_properties (const mongoc_uri_t *uri, bson_t *properties)
{
bson_iter_t iter;
if (!uri) {
return false;
}
if (bson_iter_init_find_case (&iter, &uri->credentials, "mechanismProperties") &&
BSON_ITER_HOLDS_DOCUMENT (&iter)) {
uint32_t len = 0;
const uint8_t *data = NULL;
bson_iter_document (&iter, &len, &data);
bson_init_static (properties, data, len);
return true;
}
return false;
}
static void
_mongoc_uri_assign_read_prefs_mode (mongoc_uri_t *uri) /* IN */
{
const char *str;
bson_iter_t iter;
BSON_ASSERT(uri);
if (mongoc_uri_get_option_as_bool (uri, "slaveok", false)) {
mongoc_read_prefs_set_mode(uri->read_prefs, MONGOC_READ_SECONDARY_PREFERRED);
}
if (bson_iter_init_find_case(&iter, &uri->options, "readpreference") &&
BSON_ITER_HOLDS_UTF8(&iter)) {
str = bson_iter_utf8(&iter, NULL);
if (0 == strcasecmp("primary", str)) {
mongoc_read_prefs_set_mode(uri->read_prefs, MONGOC_READ_PRIMARY);
} else if (0 == strcasecmp("primarypreferred", str)) {
mongoc_read_prefs_set_mode(uri->read_prefs, MONGOC_READ_PRIMARY_PREFERRED);
} else if (0 == strcasecmp("secondary", str)) {
mongoc_read_prefs_set_mode(uri->read_prefs, MONGOC_READ_SECONDARY);
} else if (0 == strcasecmp("secondarypreferred", str)) {
mongoc_read_prefs_set_mode(uri->read_prefs, MONGOC_READ_SECONDARY_PREFERRED);
} else if (0 == strcasecmp("nearest", str)) {
mongoc_read_prefs_set_mode(uri->read_prefs, MONGOC_READ_NEAREST);
} else {
MONGOC_WARNING("Unsupported readPreference value [readPreference=%s].", str);
}
}
/* Warn on conflict, since read preference will be validated later */
if (mongoc_read_prefs_get_mode(uri->read_prefs) == MONGOC_READ_PRIMARY &&
!bson_empty(mongoc_read_prefs_get_tags(uri->read_prefs))) {
MONGOC_WARNING("Primary read preference mode conflicts with tags.");
}
}
static void
_mongoc_uri_build_write_concern (mongoc_uri_t *uri) /* IN */
{
mongoc_write_concern_t *write_concern;
const char *str;
bson_iter_t iter;
int32_t wtimeoutms;
int value;
BSON_ASSERT (uri);
write_concern = mongoc_write_concern_new ();
if (bson_iter_init_find_case (&iter, &uri->options, "safe") &&
BSON_ITER_HOLDS_BOOL (&iter)) {
mongoc_write_concern_set_w (write_concern,
bson_iter_bool (&iter) ? 1 : MONGOC_WRITE_CONCERN_W_UNACKNOWLEDGED);
}
wtimeoutms = mongoc_uri_get_option_as_int32(uri, "wtimeoutms", 0);
if (bson_iter_init_find_case (&iter, &uri->options, "journal") &&
BSON_ITER_HOLDS_BOOL (&iter)) {
mongoc_write_concern_set_journal (write_concern, bson_iter_bool (&iter));
}
if (bson_iter_init_find_case (&iter, &uri->options, "w")) {
if (BSON_ITER_HOLDS_INT32 (&iter)) {
value = bson_iter_int32 (&iter);
switch (value) {
case MONGOC_WRITE_CONCERN_W_ERRORS_IGNORED:
case MONGOC_WRITE_CONCERN_W_UNACKNOWLEDGED:
/* Warn on conflict, since write concern will be validated later */
if (mongoc_write_concern_get_journal(write_concern)) {
MONGOC_WARNING("Journal conflicts with w value [w=%d].", value);
}
mongoc_write_concern_set_w(write_concern, value);
break;
default:
if (value > 0) {
mongoc_write_concern_set_w (write_concern, value);
if (value > 1) {
mongoc_write_concern_set_wtimeout (write_concern, wtimeoutms);
}
break;
}
MONGOC_WARNING ("Unsupported w value [w=%d].", value);
break;
}
} else if (BSON_ITER_HOLDS_UTF8 (&iter)) {
str = bson_iter_utf8 (&iter, NULL);
if (0 == strcasecmp ("majority", str)) {
mongoc_write_concern_set_wmajority (write_concern, wtimeoutms);
} else {
mongoc_write_concern_set_wtag (write_concern, str);
mongoc_write_concern_set_wtimeout (write_concern, wtimeoutms);
}
} else {
BSON_ASSERT (false);
}
}
uri->write_concern = write_concern;
}
/* can't use mongoc_uri_get_option_as_int32, it treats 0 specially */
static int32_t
_mongoc_uri_get_max_staleness_option (const mongoc_uri_t *uri)
{
const bson_t *options;
bson_iter_t iter;
int32_t retval = MONGOC_NO_MAX_STALENESS;
if ((options = mongoc_uri_get_options (uri)) &&
bson_iter_init_find_case (&iter, options, "maxstalenessseconds") &&
BSON_ITER_HOLDS_INT32 (&iter)) {
retval = bson_iter_int32 (&iter);
if (retval == 0) {
MONGOC_WARNING ("Invalid: maxStalenessSeconds cannot be zero");
retval = -1;
} else if (retval < 0 && retval != -1) {
MONGOC_WARNING ("Invalid maxStalenessSeconds: %d", retval);
retval = MONGOC_NO_MAX_STALENESS;
}
}
return retval;
}
mongoc_uri_t *
mongoc_uri_new (const char *uri_string)
{
mongoc_uri_t *uri;
int32_t max_staleness_seconds;
uri = (mongoc_uri_t *)bson_malloc0(sizeof *uri);
bson_init(&uri->options);
bson_init(&uri->credentials);
/* Initialize read_prefs, since parsing may add to it */
uri->read_prefs = mongoc_read_prefs_new(MONGOC_READ_PRIMARY);
/* Initialize empty read_concern */
uri->read_concern = mongoc_read_concern_new ();
if (!uri_string) {
uri_string = "mongodb://127.0.0.1/";
}
if (!mongoc_uri_parse(uri, uri_string)) {
mongoc_uri_destroy(uri);
return NULL;
}
uri->str = bson_strdup(uri_string);
_mongoc_uri_assign_read_prefs_mode(uri);
max_staleness_seconds = _mongoc_uri_get_max_staleness_option (uri);
mongoc_read_prefs_set_max_staleness_seconds (uri->read_prefs,
max_staleness_seconds);
if (!mongoc_read_prefs_is_valid(uri->read_prefs)) {
mongoc_uri_destroy(uri);
return NULL;
}
_mongoc_uri_build_write_concern (uri);
if (!mongoc_write_concern_is_valid (uri->write_concern)) {
mongoc_uri_destroy(uri);
return NULL;
}
return uri;
}
mongoc_uri_t *
mongoc_uri_new_for_host_port (const char *hostname,
uint16_t port)
{
mongoc_uri_t *uri;
char *str;
BSON_ASSERT (hostname);
BSON_ASSERT (port);
str = bson_strdup_printf("mongodb://%s:%hu/", hostname, port);
uri = mongoc_uri_new(str);
bson_free(str);
return uri;
}
const char *
mongoc_uri_get_username (const mongoc_uri_t *uri)
{
BSON_ASSERT (uri);
return uri->username;
}
bool
mongoc_uri_set_username (mongoc_uri_t *uri, const char *username)
{
size_t len;
BSON_ASSERT (username);
len = strlen(username);
if (!bson_utf8_validate (username, len, false)) {
return false;
}
if (uri->username) {
bson_free (uri->username);
}
uri->username = bson_strdup (username);
return true;
}
const char *
mongoc_uri_get_password (const mongoc_uri_t *uri)
{
BSON_ASSERT (uri);
return uri->password;
}
bool
mongoc_uri_set_password (mongoc_uri_t *uri, const char *password)
{
size_t len;
BSON_ASSERT (password);
len = strlen(password);
if (!bson_utf8_validate (password, len, false)) {
return false;
}
if (uri->password) {
bson_free (uri->password);
}
uri->password = bson_strdup (password);
return true;
}
const char *
mongoc_uri_get_database (const mongoc_uri_t *uri)
{
BSON_ASSERT (uri);
return uri->database;
}
bool
mongoc_uri_set_database (mongoc_uri_t *uri, const char *database)
{
size_t len;
BSON_ASSERT (database);
len = strlen(database);
if (!bson_utf8_validate (database, len, false)) {
return false;
}
if (uri->database) {
bson_free (uri->database);
}
uri->database = bson_strdup(database);
return true;
}
const char *
mongoc_uri_get_auth_source (const mongoc_uri_t *uri)
{
bson_iter_t iter;
BSON_ASSERT (uri);
if (bson_iter_init_find_case(&iter, &uri->credentials, "authSource")) {
return bson_iter_utf8(&iter, NULL);
}
return uri->database ? uri->database : "admin";
}
bool
mongoc_uri_set_auth_source (mongoc_uri_t *uri, const char *value)
{
size_t len;
BSON_ASSERT (value);
len = strlen(value);
if (!bson_utf8_validate (value, len, false)) {
return false;
}
mongoc_uri_bson_append_or_replace_key (&uri->credentials, "authSource", value);
return true;
}
const char *
mongoc_uri_get_appname (const mongoc_uri_t *uri)
{
BSON_ASSERT (uri);
return mongoc_uri_get_option_as_utf8 (uri, "appname", NULL);
}
bool
mongoc_uri_set_appname (mongoc_uri_t *uri,
const char *value)
{
BSON_ASSERT (value);
if (!bson_utf8_validate (value, strlen (value), false)) {
return false;
}
if (!_mongoc_handshake_appname_is_valid (value)) {
return false;
}
mongoc_uri_bson_append_or_replace_key (&uri->options, "appname", value);
return true;
}
+/* can't use mongoc_uri_get_option_as_int32, it treats 0 specially */
+int32_t
+mongoc_uri_get_local_threshold_option (const mongoc_uri_t *uri)
+{
+ const bson_t *options;
+ bson_iter_t iter;
+ int32_t retval = MONGOC_TOPOLOGY_LOCAL_THRESHOLD_MS;
+
+ if ((options = mongoc_uri_get_options (uri)) &&
+ bson_iter_init_find_case (&iter, options, "localthresholdms") &&
+ BSON_ITER_HOLDS_INT32 (&iter)) {
+ retval = bson_iter_int32 (&iter);
+
+ if (retval < 0) {
+ MONGOC_WARNING ("Invalid localThresholdMS: %d", retval);
+ retval = MONGOC_TOPOLOGY_LOCAL_THRESHOLD_MS;
+ }
+ }
+
+ return retval;
+}
+
const bson_t *
mongoc_uri_get_options (const mongoc_uri_t *uri)
{
BSON_ASSERT (uri);
return &uri->options;
}
void
mongoc_uri_destroy (mongoc_uri_t *uri)
{
if (uri) {
_mongoc_host_list_destroy_all (uri->hosts);
bson_free(uri->str);
bson_free(uri->database);
bson_free(uri->username);
bson_destroy(&uri->options);
bson_destroy(&uri->credentials);
mongoc_read_prefs_destroy(uri->read_prefs);
mongoc_read_concern_destroy(uri->read_concern);
mongoc_write_concern_destroy(uri->write_concern);
if (uri->password) {
bson_zero_free(uri->password, strlen(uri->password));
}
bson_free(uri);
}
}
mongoc_uri_t *
mongoc_uri_copy (const mongoc_uri_t *uri)
{
mongoc_uri_t *copy;
mongoc_host_list_t *iter;
BSON_ASSERT (uri);
copy = (mongoc_uri_t *)bson_malloc0(sizeof (*copy));
copy->str = bson_strdup (uri->str);
copy->username = bson_strdup (uri->username);
copy->password = bson_strdup (uri->password);
copy->database = bson_strdup (uri->database);
copy->read_prefs = mongoc_read_prefs_copy (uri->read_prefs);
copy->read_concern = mongoc_read_concern_copy (uri->read_concern);
copy->write_concern = mongoc_write_concern_copy (uri->write_concern);
for (iter = uri->hosts; iter; iter = iter->next) {
if (!mongoc_uri_append_host (copy, iter->host, iter->port)) {
mongoc_uri_destroy (copy);
return NULL;
}
}
bson_copy_to (&uri->options, &copy->options);
bson_copy_to (&uri->credentials, &copy->credentials);
return copy;
}
const char *
mongoc_uri_get_string (const mongoc_uri_t *uri)
{
BSON_ASSERT (uri);
return uri->str;
}
const bson_t *
mongoc_uri_get_read_prefs (const mongoc_uri_t *uri)
{
BSON_ASSERT (uri);
return mongoc_read_prefs_get_tags(uri->read_prefs);
}
/*
*--------------------------------------------------------------------------
*
* mongoc_uri_unescape --
*
* Escapes an UTF-8 encoded string containing URI escaped segments
* such as %20.
*
* It is a programming error to call this function with a string
* that is not UTF-8 encoded!
*
* Returns:
* A newly allocated string that should be freed with bson_free().
*
* Side effects:
* None.
*
*--------------------------------------------------------------------------
*/
char *
mongoc_uri_unescape (const char *escaped_string)
{
bson_unichar_t c;
bson_string_t *str;
unsigned int hex = 0;
const char *ptr;
const char *end;
size_t len;
BSON_ASSERT (escaped_string);
len = strlen(escaped_string);
/*
* Double check that this is a UTF-8 valid string. Bail out if necessary.
*/
if (!bson_utf8_validate(escaped_string, len, false)) {
MONGOC_WARNING("%s(): escaped_string contains invalid UTF-8",
BSON_FUNC);
return NULL;
}
ptr = escaped_string;
end = ptr + len;
str = bson_string_new(NULL);
for (; *ptr; ptr = bson_utf8_next_char(ptr)) {
c = bson_utf8_get_char(ptr);
switch (c) {
case '%':
if (((end - ptr) < 2) ||
!isxdigit(ptr[1]) ||
!isxdigit(ptr[2]) ||
#ifdef _MSC_VER
(1 != sscanf_s(&ptr[1], "%02x", &hex)) ||
#else
(1 != sscanf(&ptr[1], "%02x", &hex)) ||
#endif
!isprint(hex)) {
bson_string_free(str, true);
return NULL;
}
bson_string_append_c(str, hex);
ptr += 2;
break;
default:
bson_string_append_unichar(str, c);
break;
}
}
return bson_string_free(str, false);
}
const mongoc_read_prefs_t *
mongoc_uri_get_read_prefs_t (const mongoc_uri_t *uri) /* IN */
{
BSON_ASSERT (uri);
return uri->read_prefs;
}
void
mongoc_uri_set_read_prefs_t (mongoc_uri_t *uri,
const mongoc_read_prefs_t *prefs)
{
BSON_ASSERT (uri);
BSON_ASSERT (prefs);
mongoc_read_prefs_destroy (uri->read_prefs);
uri->read_prefs = mongoc_read_prefs_copy (prefs);
}
const mongoc_read_concern_t *
mongoc_uri_get_read_concern (const mongoc_uri_t *uri) /* IN */
{
BSON_ASSERT (uri);
return uri->read_concern;
}
void
mongoc_uri_set_read_concern (mongoc_uri_t *uri,
const mongoc_read_concern_t *rc)
{
BSON_ASSERT (uri);
BSON_ASSERT (rc);
mongoc_read_concern_destroy (uri->read_concern);
uri->read_concern = mongoc_read_concern_copy (rc);
}
const mongoc_write_concern_t *
mongoc_uri_get_write_concern (const mongoc_uri_t *uri) /* IN */
{
BSON_ASSERT (uri);
return uri->write_concern;
}
void
mongoc_uri_set_write_concern (mongoc_uri_t *uri,
const mongoc_write_concern_t *wc)
{
BSON_ASSERT (uri);
BSON_ASSERT (wc);
mongoc_write_concern_destroy (uri->write_concern);
uri->write_concern = mongoc_write_concern_copy (wc);
}
bool
mongoc_uri_get_ssl (const mongoc_uri_t *uri) /* IN */
{
bson_iter_t iter;
BSON_ASSERT (uri);
return (bson_iter_init_find_case (&iter, &uri->options, "ssl") &&
BSON_ITER_HOLDS_BOOL (&iter) &&
bson_iter_bool (&iter));
}
/*
*--------------------------------------------------------------------------
*
* mongoc_uri_get_option_as_int32 --
*
* Checks if the URI 'option' is set and of correct type (int32).
* The special value '0' is considered as "unset".
* This is so users can provide
* sprintf(mongodb://localhost/?option=%d, myvalue) style connection strings,
* and still apply default values.
*
* If not set, or set to invalid type, 'fallback' is returned.
*
* NOTE: 'option' is case*in*sensitive.
*
* Returns:
* The value of 'option' if available as int32 (and not 0), or 'fallback'.
*
*--------------------------------------------------------------------------
*/
int32_t
mongoc_uri_get_option_as_int32 (const mongoc_uri_t *uri,
const char *option,
int32_t fallback)
{
const bson_t *options;
bson_iter_t iter;
int32_t retval = fallback;
if ((options = mongoc_uri_get_options (uri)) &&
bson_iter_init_find_case (&iter, options, option) &&
BSON_ITER_HOLDS_INT32 (&iter)) {
if (!(retval = bson_iter_int32(&iter))) {
retval = fallback;
}
}
return retval;
}
/*
*--------------------------------------------------------------------------
*
* mongoc_uri_set_option_as_int32 --
*
* Sets a URI option 'after the fact'. Allows users to set individual
* URI options without passing them as a connection string.
*
* Only allows a set of known options to be set.
* @see mongoc_uri_option_is_int32 ().
*
* Does in-place-update of the option BSON if 'option' is already set.
* Appends the option to the end otherwise.
*
* NOTE: If 'option' is already set, and is of invalid type, this
* function will return false.
*
* NOTE: 'option' is case*in*sensitive.
*
* Returns:
* true on successfully setting the option, false on failure.
*
*--------------------------------------------------------------------------
*/
bool
mongoc_uri_set_option_as_int32 (mongoc_uri_t *uri,
const char *option,
int32_t value)
{
const bson_t *options;
bson_iter_t iter;
BSON_ASSERT (option);
if (!mongoc_uri_option_is_int32 (option)) {
return false;
}
if ((options = mongoc_uri_get_options (uri)) &&
bson_iter_init_find_case (&iter, options, option)) {
if (BSON_ITER_HOLDS_INT32 (&iter)) {
bson_iter_overwrite_int32 (&iter, value);
return true;
} else {
return false;
}
}
bson_append_int32(&uri->options, option, -1, value);
return true;
}
/*
*--------------------------------------------------------------------------
*
* mongoc_uri_get_option_as_bool --
*
* Checks if the URI 'option' is set and of correct type (bool).
*
* If not set, or set to invalid type, 'fallback' is returned.
*
* NOTE: 'option' is case*in*sensitive.
*
* Returns:
* The value of 'option' if available as bool, or 'fallback'.
*
*--------------------------------------------------------------------------
*/
bool
mongoc_uri_get_option_as_bool (const mongoc_uri_t *uri,
const char *option,
bool fallback)
{
const bson_t *options;
bson_iter_t iter;
if ((options = mongoc_uri_get_options (uri)) &&
bson_iter_init_find_case (&iter, options, option) &&
BSON_ITER_HOLDS_BOOL (&iter)) {
return bson_iter_bool (&iter);
}
return fallback;
}
/*
*--------------------------------------------------------------------------
*
* mongoc_uri_set_option_as_bool --
*
* Sets a URI option 'after the fact'. Allows users to set individual
* URI options without passing them as a connection string.
*
* Only allows a set of known options to be set.
* @see mongoc_uri_option_is_bool ().
*
* Does in-place-update of the option BSON if 'option' is already set.
* Appends the option to the end otherwise.
*
* NOTE: If 'option' is already set, and is of invalid type, this
* function will return false.
*
* NOTE: 'option' is case*in*sensitive.
*
* Returns:
* true on successfully setting the option, false on failure.
*
*--------------------------------------------------------------------------
*/
bool
mongoc_uri_set_option_as_bool (mongoc_uri_t *uri,
const char *option,
bool value)
{
const bson_t *options;
bson_iter_t iter;
BSON_ASSERT (option);
if (!mongoc_uri_option_is_bool (option)) {
return false;
}
if ((options = mongoc_uri_get_options (uri)) &&
bson_iter_init_find_case (&iter, options, option)) {
if (BSON_ITER_HOLDS_BOOL (&iter)) {
bson_iter_overwrite_bool (&iter, value);
return true;
} else {
return false;
}
}
bson_append_bool(&uri->options, option, -1, value);
return true;
}
/*
*--------------------------------------------------------------------------
*
* mongoc_uri_get_option_as_utf8 --
*
* Checks if the URI 'option' is set and of correct type (utf8).
*
* If not set, or set to invalid type, 'fallback' is returned.
*
* NOTE: 'option' is case*in*sensitive.
*
* Returns:
* The value of 'option' if available as utf8, or 'fallback'.
*
*--------------------------------------------------------------------------
*/
const char*
mongoc_uri_get_option_as_utf8 (const mongoc_uri_t *uri,
const char *option,
const char *fallback)
{
const bson_t *options;
bson_iter_t iter;
if ((options = mongoc_uri_get_options (uri)) &&
bson_iter_init_find_case (&iter, options, option) &&
BSON_ITER_HOLDS_UTF8 (&iter)) {
return bson_iter_utf8 (&iter, NULL);
}
return fallback;
}
/*
*--------------------------------------------------------------------------
*
* mongoc_uri_set_option_as_utf8 --
*
* Sets a URI option 'after the fact'. Allows users to set individual
* URI options without passing them as a connection string.
*
* Only allows a set of known options to be set.
* @see mongoc_uri_option_is_utf8 ().
*
* If the option is not already set, this function will append it to the end
* of the options bson.
* NOTE: If the option is already set the entire options bson will be
* overwritten, containing the new option=value (at the same position).
*
* NOTE: If 'option' is already set, and is of invalid type, this
* function will return false.
*
* NOTE: 'option' must be valid utf8.
*
* NOTE: 'option' is case*in*sensitive.
*
* Returns:
* true on successfully setting the option, false on failure.
*
*--------------------------------------------------------------------------
*/
bool
mongoc_uri_set_option_as_utf8 (mongoc_uri_t *uri,
const char *option,
const char *value)
{
size_t len;
BSON_ASSERT (option);
len = strlen(value);
if (!bson_utf8_validate (value, len, false)) {
return false;
}
if (!mongoc_uri_option_is_utf8 (option)) {
return false;
}
mongoc_uri_bson_append_or_replace_key (&uri->options, option, value);
return true;
}
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-uri.h b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-uri.h
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-uri.h
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-uri.h
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-util-private.h b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-util-private.h
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-util-private.h
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-util-private.h
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-util.c b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-util.c
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-util.c
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-util.c
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-version-functions.c b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-version-functions.c
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-version-functions.c
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-version-functions.c
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-version-functions.h b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-version-functions.h
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-version-functions.h
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-version-functions.h
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-version.h b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-version.h
similarity index 96%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-version.h
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-version.h
index 67b0e854..cc372f9b 100644
--- a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-version.h
+++ b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-version.h
@@ -1,102 +1,102 @@
/*
* Copyright 2013 MongoDB, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#if !defined (MONGOC_INSIDE) && !defined (MONGOC_COMPILATION)
#error "Only <mongoc.h> can be included directly."
#endif
#ifndef MONGOC_VERSION_H
#define MONGOC_VERSION_H
/**
* MONGOC_MAJOR_VERSION:
*
* MONGOC major version component (e.g. 1 if %MONGOC_VERSION is 1.2.3)
*/
#define MONGOC_MAJOR_VERSION (1)
/**
* MONGOC_MINOR_VERSION:
*
* MONGOC minor version component (e.g. 2 if %MONGOC_VERSION is 1.2.3)
*/
#define MONGOC_MINOR_VERSION (5)
/**
* MONGOC_MICRO_VERSION:
*
* MONGOC micro version component (e.g. 3 if %MONGOC_VERSION is 1.2.3)
*/
-#define MONGOC_MICRO_VERSION (3)
+#define MONGOC_MICRO_VERSION (5)
/**
* MONGOC_PRERELEASE_VERSION:
*
* MONGOC prerelease version component (e.g. rc0 if %MONGOC_VERSION is 1.2.3-rc0)
*/
#define MONGOC_PRERELEASE_VERSION ()
/**
* MONGOC_VERSION:
*
* MONGOC version.
*/
-#define MONGOC_VERSION (1.5.3)
+#define MONGOC_VERSION (1.5.5)
/**
* MONGOC_VERSION_S:
*
* MONGOC version, encoded as a string, useful for printing and
* concatenation.
*/
-#define MONGOC_VERSION_S "1.5.3"
+#define MONGOC_VERSION_S "1.5.5"
/**
* MONGOC_VERSION_HEX:
*
* MONGOC version, encoded as an hexadecimal number, useful for
* integer comparisons.
*/
#define MONGOC_VERSION_HEX (MONGOC_MAJOR_VERSION << 24 | \
MONGOC_MINOR_VERSION << 16 | \
MONGOC_MICRO_VERSION << 8)
/**
* MONGOC_CHECK_VERSION:
* @major: required major version
* @minor: required minor version
* @micro: required micro version
*
* Compile-time version checking. Evaluates to %TRUE if the version
* of MONGOC is greater than the required one.
*/
#define MONGOC_CHECK_VERSION(major,minor,micro) \
(MONGOC_MAJOR_VERSION > (major) || \
(MONGOC_MAJOR_VERSION == (major) && MONGOC_MINOR_VERSION > (minor)) || \
(MONGOC_MAJOR_VERSION == (major) && MONGOC_MINOR_VERSION == (minor) && \
MONGOC_MICRO_VERSION >= (micro)))
#endif /* MONGOC_VERSION_H */
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-version.h.in b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-version.h.in
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-version.h.in
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-version.h.in
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-write-command-private.h b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-write-command-private.h
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-write-command-private.h
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-write-command-private.h
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-write-command.c b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-write-command.c
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-write-command.c
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-write-command.c
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-write-concern-private.h b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-write-concern-private.h
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-write-concern-private.h
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-write-concern-private.h
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-write-concern.c b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-write-concern.c
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-write-concern.c
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-write-concern.c
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-write-concern.h b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-write-concern.h
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc-write-concern.h
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc-write-concern.h
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc.h b/mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc.h
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/mongoc.h
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/mongoc.h
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/op-delete.def b/mongodb-1.2.8/src/libmongoc/src/mongoc/op-delete.def
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/op-delete.def
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/op-delete.def
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/op-get-more.def b/mongodb-1.2.8/src/libmongoc/src/mongoc/op-get-more.def
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/op-get-more.def
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/op-get-more.def
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/op-header.def b/mongodb-1.2.8/src/libmongoc/src/mongoc/op-header.def
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/op-header.def
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/op-header.def
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/op-insert.def b/mongodb-1.2.8/src/libmongoc/src/mongoc/op-insert.def
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/op-insert.def
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/op-insert.def
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/op-kill-cursors.def b/mongodb-1.2.8/src/libmongoc/src/mongoc/op-kill-cursors.def
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/op-kill-cursors.def
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/op-kill-cursors.def
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/op-msg.def b/mongodb-1.2.8/src/libmongoc/src/mongoc/op-msg.def
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/op-msg.def
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/op-msg.def
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/op-query.def b/mongodb-1.2.8/src/libmongoc/src/mongoc/op-query.def
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/op-query.def
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/op-query.def
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/op-reply-header.def b/mongodb-1.2.8/src/libmongoc/src/mongoc/op-reply-header.def
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/op-reply-header.def
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/op-reply-header.def
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/op-reply.def b/mongodb-1.2.8/src/libmongoc/src/mongoc/op-reply.def
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/op-reply.def
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/op-reply.def
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/op-update.def b/mongodb-1.2.8/src/libmongoc/src/mongoc/op-update.def
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/op-update.def
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/op-update.def
diff --git a/mongodb-1.2.3/src/libmongoc/src/mongoc/utlist.h b/mongodb-1.2.8/src/libmongoc/src/mongoc/utlist.h
similarity index 100%
rename from mongodb-1.2.3/src/libmongoc/src/mongoc/utlist.h
rename to mongodb-1.2.8/src/libmongoc/src/mongoc/utlist.h
diff --git a/mongodb-1.2.3/tests/bson/bson-binary-001.phpt b/mongodb-1.2.8/tests/bson/bson-binary-001.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bson-binary-001.phpt
rename to mongodb-1.2.8/tests/bson/bson-binary-001.phpt
diff --git a/mongodb-1.2.3/tests/bson/bson-binary-compare-001.phpt b/mongodb-1.2.8/tests/bson/bson-binary-compare-001.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bson-binary-compare-001.phpt
rename to mongodb-1.2.8/tests/bson/bson-binary-compare-001.phpt
diff --git a/mongodb-1.2.3/tests/bson/bson-binary-compare-002.phpt b/mongodb-1.2.8/tests/bson/bson-binary-compare-002.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bson-binary-compare-002.phpt
rename to mongodb-1.2.8/tests/bson/bson-binary-compare-002.phpt
diff --git a/mongodb-1.2.3/tests/bson/bson-binary-jsonserialize-001.phpt b/mongodb-1.2.8/tests/bson/bson-binary-jsonserialize-001.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bson-binary-jsonserialize-001.phpt
rename to mongodb-1.2.8/tests/bson/bson-binary-jsonserialize-001.phpt
diff --git a/mongodb-1.2.3/tests/bson/bson-binary-jsonserialize-002.phpt b/mongodb-1.2.8/tests/bson/bson-binary-jsonserialize-002.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bson-binary-jsonserialize-002.phpt
rename to mongodb-1.2.8/tests/bson/bson-binary-jsonserialize-002.phpt
diff --git a/mongodb-1.2.3/tests/bson/bson-binary-serialization-001.phpt b/mongodb-1.2.8/tests/bson/bson-binary-serialization-001.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bson-binary-serialization-001.phpt
rename to mongodb-1.2.8/tests/bson/bson-binary-serialization-001.phpt
diff --git a/mongodb-1.2.3/tests/bson/bson-binary-serialization_error-001.phpt b/mongodb-1.2.8/tests/bson/bson-binary-serialization_error-001.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bson-binary-serialization_error-001.phpt
rename to mongodb-1.2.8/tests/bson/bson-binary-serialization_error-001.phpt
diff --git a/mongodb-1.2.3/tests/bson/bson-binary-serialization_error-002.phpt b/mongodb-1.2.8/tests/bson/bson-binary-serialization_error-002.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bson-binary-serialization_error-002.phpt
rename to mongodb-1.2.8/tests/bson/bson-binary-serialization_error-002.phpt
diff --git a/mongodb-1.2.3/tests/bson/bson-binary-set_state-001.phpt b/mongodb-1.2.8/tests/bson/bson-binary-set_state-001.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bson-binary-set_state-001.phpt
rename to mongodb-1.2.8/tests/bson/bson-binary-set_state-001.phpt
diff --git a/mongodb-1.2.3/tests/bson/bson-binary-set_state_error-001.phpt b/mongodb-1.2.8/tests/bson/bson-binary-set_state_error-001.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bson-binary-set_state_error-001.phpt
rename to mongodb-1.2.8/tests/bson/bson-binary-set_state_error-001.phpt
diff --git a/mongodb-1.2.3/tests/bson/bson-binary-set_state_error-002.phpt b/mongodb-1.2.8/tests/bson/bson-binary-set_state_error-002.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bson-binary-set_state_error-002.phpt
rename to mongodb-1.2.8/tests/bson/bson-binary-set_state_error-002.phpt
diff --git a/mongodb-1.2.3/tests/bson/bson-binary-tostring-001.phpt b/mongodb-1.2.8/tests/bson/bson-binary-tostring-001.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bson-binary-tostring-001.phpt
rename to mongodb-1.2.8/tests/bson/bson-binary-tostring-001.phpt
diff --git a/mongodb-1.2.3/tests/bson/bson-binary_error-001.phpt b/mongodb-1.2.8/tests/bson/bson-binary_error-001.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bson-binary_error-001.phpt
rename to mongodb-1.2.8/tests/bson/bson-binary_error-001.phpt
diff --git a/mongodb-1.2.3/tests/bson/bson-binary_error-002.phpt b/mongodb-1.2.8/tests/bson/bson-binary_error-002.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bson-binary_error-002.phpt
rename to mongodb-1.2.8/tests/bson/bson-binary_error-002.phpt
diff --git a/mongodb-1.2.3/tests/bson/bson-binary_error-003.phpt b/mongodb-1.2.8/tests/bson/bson-binary_error-003.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bson-binary_error-003.phpt
rename to mongodb-1.2.8/tests/bson/bson-binary_error-003.phpt
diff --git a/mongodb-1.2.3/tests/bson/bson-decimal128-001.phpt b/mongodb-1.2.8/tests/bson/bson-decimal128-001.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bson-decimal128-001.phpt
rename to mongodb-1.2.8/tests/bson/bson-decimal128-001.phpt
diff --git a/mongodb-1.2.3/tests/bson/bson-decimal128-002.phpt b/mongodb-1.2.8/tests/bson/bson-decimal128-002.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bson-decimal128-002.phpt
rename to mongodb-1.2.8/tests/bson/bson-decimal128-002.phpt
diff --git a/mongodb-1.2.3/tests/bson/bson-decimal128-003.phpt b/mongodb-1.2.8/tests/bson/bson-decimal128-003.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bson-decimal128-003.phpt
rename to mongodb-1.2.8/tests/bson/bson-decimal128-003.phpt
diff --git a/mongodb-1.2.3/tests/bson/bson-decimal128-004.phpt b/mongodb-1.2.8/tests/bson/bson-decimal128-004.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bson-decimal128-004.phpt
rename to mongodb-1.2.8/tests/bson/bson-decimal128-004.phpt
diff --git a/mongodb-1.2.3/tests/bson/bson-decimal128-jsonserialize-001.phpt b/mongodb-1.2.8/tests/bson/bson-decimal128-jsonserialize-001.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bson-decimal128-jsonserialize-001.phpt
rename to mongodb-1.2.8/tests/bson/bson-decimal128-jsonserialize-001.phpt
diff --git a/mongodb-1.2.3/tests/bson/bson-decimal128-jsonserialize-002.phpt b/mongodb-1.2.8/tests/bson/bson-decimal128-jsonserialize-002.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bson-decimal128-jsonserialize-002.phpt
rename to mongodb-1.2.8/tests/bson/bson-decimal128-jsonserialize-002.phpt
diff --git a/mongodb-1.2.3/tests/bson/bson-decimal128-serialization-001.phpt b/mongodb-1.2.8/tests/bson/bson-decimal128-serialization-001.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bson-decimal128-serialization-001.phpt
rename to mongodb-1.2.8/tests/bson/bson-decimal128-serialization-001.phpt
diff --git a/mongodb-1.2.3/tests/bson/bson-decimal128-serialization_error-001.phpt b/mongodb-1.2.8/tests/bson/bson-decimal128-serialization_error-001.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bson-decimal128-serialization_error-001.phpt
rename to mongodb-1.2.8/tests/bson/bson-decimal128-serialization_error-001.phpt
diff --git a/mongodb-1.2.3/tests/bson/bson-decimal128-serialization_error-002.phpt b/mongodb-1.2.8/tests/bson/bson-decimal128-serialization_error-002.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bson-decimal128-serialization_error-002.phpt
rename to mongodb-1.2.8/tests/bson/bson-decimal128-serialization_error-002.phpt
diff --git a/mongodb-1.2.3/tests/bson/bson-decimal128-set_state-001.phpt b/mongodb-1.2.8/tests/bson/bson-decimal128-set_state-001.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bson-decimal128-set_state-001.phpt
rename to mongodb-1.2.8/tests/bson/bson-decimal128-set_state-001.phpt
diff --git a/mongodb-1.2.3/tests/bson/bson-decimal128-set_state_error-001.phpt b/mongodb-1.2.8/tests/bson/bson-decimal128-set_state_error-001.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bson-decimal128-set_state_error-001.phpt
rename to mongodb-1.2.8/tests/bson/bson-decimal128-set_state_error-001.phpt
diff --git a/mongodb-1.2.3/tests/bson/bson-decimal128-set_state_error-002.phpt b/mongodb-1.2.8/tests/bson/bson-decimal128-set_state_error-002.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bson-decimal128-set_state_error-002.phpt
rename to mongodb-1.2.8/tests/bson/bson-decimal128-set_state_error-002.phpt
diff --git a/mongodb-1.2.3/tests/bson/bson-decimal128_error-001.phpt b/mongodb-1.2.8/tests/bson/bson-decimal128_error-001.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bson-decimal128_error-001.phpt
rename to mongodb-1.2.8/tests/bson/bson-decimal128_error-001.phpt
diff --git a/mongodb-1.2.3/tests/bson/bson-decimal128_error-002.phpt b/mongodb-1.2.8/tests/bson/bson-decimal128_error-002.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bson-decimal128_error-002.phpt
rename to mongodb-1.2.8/tests/bson/bson-decimal128_error-002.phpt
diff --git a/mongodb-1.2.3/tests/bson/bson-decode-001.phpt b/mongodb-1.2.8/tests/bson/bson-decode-001.phpt
similarity index 97%
rename from mongodb-1.2.3/tests/bson/bson-decode-001.phpt
rename to mongodb-1.2.8/tests/bson/bson-decode-001.phpt
index 2153dd95..64b24430 100644
--- a/mongodb-1.2.3/tests/bson/bson-decode-001.phpt
+++ b/mongodb-1.2.8/tests/bson/bson-decode-001.phpt
@@ -1,79 +1,78 @@
--TEST--
BSON encoding: Encoding data into BSON representation, and BSON into Extended JSON
--FILE--
<?php
require_once __DIR__ . '/../utils/tools.php';
$tests = array(
array("hello" => "world"),
array((object)array("hello" => "world")),
array(null),
array(123),
-
- array(4.23),
+ array(4.125),
array(true),
array(false),
array("string"),
array("string", true),
array('test', 'foo', 'bar'),
array('test' => 'test', 'foo' => 'foo', 'bar' => 'bar'),
array('foo' => 'test', 'foo', 'bar'),
/*
(object)array("hello" => "world"),
array(array("hello" => "world")),
array(array(1, 2, 3, 4, 5, 6, 7, 8, 9)),
array((object)array(1, 2, 3, 4, 5, 6, 7, 8, 9)),
array(array("0" => 1, "1" => 2, "2" => 3, "3" => 4, "4" => 5, "5" => 6, "6" => 7, "7" => 8, "8" => 9)),
array("int" => 3, "boolean" => true, "array" => array("foo", "bar"), "object" => new stdclass, "string" => "test", 3 => "test"),
array(array("string", true)),
array(array('test', 'foo', 'bar')),
array(array('test' => 'test', 'foo' => 'foo', 'bar' => 'bar')),
array(array('foo' => 'test', 'foo', 'bar')),
array(array("int" => 3, "boolean" => true, "array" => array("foo", "bar"), "object" => new stdclass, "string" => "test", 3 => "test")),
*/
);
foreach($tests as $n => $test) {
$s = fromPHP($test);
echo "Test#{$n} ", toJSON($s), "\n";
$val = toPHP($s);
if ($val == (object) $test) {
echo "OK\n";
} else {
var_dump($val, $test);
}
}
?>
===DONE===
<?php exit(0); ?>
--EXPECT--
Test#0 { "hello" : "world" }
OK
Test#1 { "0" : { "hello" : "world" } }
OK
Test#2 { "0" : null }
OK
Test#3 { "0" : 123 }
OK
-Test#4 { "0" : 4.23 }
+Test#4 { "0" : 4.125 }
OK
Test#5 { "0" : true }
OK
Test#6 { "0" : false }
OK
Test#7 { "0" : "string" }
OK
Test#8 { "0" : "string", "1" : true }
OK
Test#9 { "0" : "test", "1" : "foo", "2" : "bar" }
OK
Test#10 { "test" : "test", "foo" : "foo", "bar" : "bar" }
OK
Test#11 { "foo" : "test", "0" : "foo", "1" : "bar" }
OK
===DONE===
diff --git a/mongodb-1.2.3/tests/bson/bson-decode-002.phpt b/mongodb-1.2.8/tests/bson/bson-decode-002.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bson-decode-002.phpt
rename to mongodb-1.2.8/tests/bson/bson-decode-002.phpt
diff --git a/mongodb-1.2.3/tests/bson/bson-encode-001.phpt b/mongodb-1.2.8/tests/bson/bson-encode-001.phpt
similarity index 98%
rename from mongodb-1.2.3/tests/bson/bson-encode-001.phpt
rename to mongodb-1.2.8/tests/bson/bson-encode-001.phpt
index 257e0de3..f3d2649d 100644
--- a/mongodb-1.2.3/tests/bson/bson-encode-001.phpt
+++ b/mongodb-1.2.8/tests/bson/bson-encode-001.phpt
@@ -1,134 +1,134 @@
--TEST--
BSON encoding: Encoding data into BSON representation, and BSON into Extended JSON
--FILE--
<?php
require_once __DIR__ . '/../utils/tools.php';
$tests = array(
array("hello" => "world"),
(object)array("hello" => "world"),
array(array("hello" => "world")),
array((object)array("hello" => "world")),
array(array(1, 2, 3, 4, 5, 6, 7, 8, 9)),
array((object)array(1, 2, 3, 4, 5, 6, 7, 8, 9)),
array(array("0" => 1, "1" => 2, "2" => 3, "3" => 4, "4" => 5, "5" => 6, "6" => 7, "7" => 8, "8" => 9)),
array(null),
array(123),
- array(4.23),
+ array(4.125),
array(true),
array(false),
array("string"),
array("string", true),
array('test', 'foo', 'bar'),
array('test' => 'test', 'foo' => 'foo', 'bar' => 'bar'),
array('foo' => 'test', 'foo', 'bar'),
array("int" => 3, "boolean" => true, "array" => array("foo", "bar"), "object" => new stdclass, "string" => "test", 3 => "test"),
array(array("string", true)),
array(array('test', 'foo', 'bar')),
array(array('test' => 'test', 'foo' => 'foo', 'bar' => 'bar')),
array(array('foo' => 'test', 'foo', 'bar')),
array(array("int" => 3, "boolean" => true, "array" => array("foo", "bar"), "object" => new stdclass, "string" => "test", 3 => "test")),
);
foreach($tests as $n => $test) {
$s = fromPHP($test);
echo "Test#{$n} ", toJSON($s), "\n";
hex_dump($s);
}
?>
===DONE===
<?php exit(0); ?>
--EXPECT--
Test#0 { "hello" : "world" }
0 : 16 00 00 00 02 68 65 6c 6c 6f 00 06 00 00 00 77 [.....hello.....w]
10 : 6f 72 6c 64 00 00 [orld..]
Test#1 { "hello" : "world" }
0 : 16 00 00 00 02 68 65 6c 6c 6f 00 06 00 00 00 77 [.....hello.....w]
10 : 6f 72 6c 64 00 00 [orld..]
Test#2 { "0" : { "hello" : "world" } }
0 : 1e 00 00 00 03 30 00 16 00 00 00 02 68 65 6c 6c [.....0......hell]
10 : 6f 00 06 00 00 00 77 6f 72 6c 64 00 00 00 [o.....world...]
Test#3 { "0" : { "hello" : "world" } }
0 : 1e 00 00 00 03 30 00 16 00 00 00 02 68 65 6c 6c [.....0......hell]
10 : 6f 00 06 00 00 00 77 6f 72 6c 64 00 00 00 [o.....world...]
Test#4 { "0" : [ 1, 2, 3, 4, 5, 6, 7, 8, 9 ] }
0 : 4c 00 00 00 04 30 00 44 00 00 00 10 30 00 01 00 [L....0.D....0...]
10 : 00 00 10 31 00 02 00 00 00 10 32 00 03 00 00 00 [...1......2.....]
20 : 10 33 00 04 00 00 00 10 34 00 05 00 00 00 10 35 [.3......4......5]
30 : 00 06 00 00 00 10 36 00 07 00 00 00 10 37 00 08 [......6......7..]
40 : 00 00 00 10 38 00 09 00 00 00 00 00 [....8.......]
Test#5 { "0" : { "0" : 1, "1" : 2, "2" : 3, "3" : 4, "4" : 5, "5" : 6, "6" : 7, "7" : 8, "8" : 9 } }
0 : 4c 00 00 00 03 30 00 44 00 00 00 10 30 00 01 00 [L....0.D....0...]
10 : 00 00 10 31 00 02 00 00 00 10 32 00 03 00 00 00 [...1......2.....]
20 : 10 33 00 04 00 00 00 10 34 00 05 00 00 00 10 35 [.3......4......5]
30 : 00 06 00 00 00 10 36 00 07 00 00 00 10 37 00 08 [......6......7..]
40 : 00 00 00 10 38 00 09 00 00 00 00 00 [....8.......]
Test#6 { "0" : [ 1, 2, 3, 4, 5, 6, 7, 8, 9 ] }
0 : 4c 00 00 00 04 30 00 44 00 00 00 10 30 00 01 00 [L....0.D....0...]
10 : 00 00 10 31 00 02 00 00 00 10 32 00 03 00 00 00 [...1......2.....]
20 : 10 33 00 04 00 00 00 10 34 00 05 00 00 00 10 35 [.3......4......5]
30 : 00 06 00 00 00 10 36 00 07 00 00 00 10 37 00 08 [......6......7..]
40 : 00 00 00 10 38 00 09 00 00 00 00 00 [....8.......]
Test#7 { "0" : null }
0 : 08 00 00 00 0a 30 00 00 [.....0..]
Test#8 { "0" : 123 }
0 : 0c 00 00 00 10 30 00 7b 00 00 00 00 [.....0.{....]
-Test#9 { "0" : 4.23 }
- 0 : 10 00 00 00 01 30 00 ec 51 b8 1e 85 eb 10 40 00 [.....0..Q.....@.]
+Test#9 { "0" : 4.125 }
+ 0 : 10 00 00 00 01 30 00 00 00 00 00 00 80 10 40 00 [.....0........@.]
Test#10 { "0" : true }
0 : 09 00 00 00 08 30 00 01 00 [.....0...]
Test#11 { "0" : false }
0 : 09 00 00 00 08 30 00 00 00 [.....0...]
Test#12 { "0" : "string" }
0 : 13 00 00 00 02 30 00 07 00 00 00 73 74 72 69 6e [.....0.....strin]
10 : 67 00 00 [g..]
Test#13 { "0" : "string", "1" : true }
0 : 17 00 00 00 02 30 00 07 00 00 00 73 74 72 69 6e [.....0.....strin]
10 : 67 00 08 31 00 01 00 [g..1...]
Test#14 { "0" : "test", "1" : "foo", "2" : "bar" }
0 : 27 00 00 00 02 30 00 05 00 00 00 74 65 73 74 00 ['....0.....test.]
10 : 02 31 00 04 00 00 00 66 6f 6f 00 02 32 00 04 00 [.1.....foo..2...]
20 : 00 00 62 61 72 00 00 [..bar..]
Test#15 { "test" : "test", "foo" : "foo", "bar" : "bar" }
0 : 2e 00 00 00 02 74 65 73 74 00 05 00 00 00 74 65 [.....test.....te]
10 : 73 74 00 02 66 6f 6f 00 04 00 00 00 66 6f 6f 00 [st..foo.....foo.]
20 : 02 62 61 72 00 04 00 00 00 62 61 72 00 00 [.bar.....bar..]
Test#16 { "foo" : "test", "0" : "foo", "1" : "bar" }
0 : 29 00 00 00 02 66 6f 6f 00 05 00 00 00 74 65 73 [)....foo.....tes]
10 : 74 00 02 30 00 04 00 00 00 66 6f 6f 00 02 31 00 [t..0.....foo..1.]
20 : 04 00 00 00 62 61 72 00 00 [....bar..]
Test#17 { "int" : 3, "boolean" : true, "array" : [ "foo", "bar" ], "object" : { }, "string" : "test", "3" : "test" }
0 : 64 00 00 00 10 69 6e 74 00 03 00 00 00 08 62 6f [d....int......bo]
10 : 6f 6c 65 61 6e 00 01 04 61 72 72 61 79 00 1b 00 [olean...array...]
20 : 00 00 02 30 00 04 00 00 00 66 6f 6f 00 02 31 00 [...0.....foo..1.]
30 : 04 00 00 00 62 61 72 00 00 03 6f 62 6a 65 63 74 [....bar...object]
40 : 00 05 00 00 00 00 02 73 74 72 69 6e 67 00 05 00 [.......string...]
50 : 00 00 74 65 73 74 00 02 33 00 05 00 00 00 74 65 [..test..3.....te]
60 : 73 74 00 00 [st..]
Test#18 { "0" : [ "string", true ] }
0 : 1f 00 00 00 04 30 00 17 00 00 00 02 30 00 07 00 [.....0......0...]
10 : 00 00 73 74 72 69 6e 67 00 08 31 00 01 00 00 [..string..1....]
Test#19 { "0" : [ "test", "foo", "bar" ] }
0 : 2f 00 00 00 04 30 00 27 00 00 00 02 30 00 05 00 [/....0.'....0...]
10 : 00 00 74 65 73 74 00 02 31 00 04 00 00 00 66 6f [..test..1.....fo]
20 : 6f 00 02 32 00 04 00 00 00 62 61 72 00 00 00 [o..2.....bar...]
Test#20 { "0" : { "test" : "test", "foo" : "foo", "bar" : "bar" } }
0 : 36 00 00 00 03 30 00 2e 00 00 00 02 74 65 73 74 [6....0......test]
10 : 00 05 00 00 00 74 65 73 74 00 02 66 6f 6f 00 04 [.....test..foo..]
20 : 00 00 00 66 6f 6f 00 02 62 61 72 00 04 00 00 00 [...foo..bar.....]
30 : 62 61 72 00 00 00 [bar...]
Test#21 { "0" : { "foo" : "test", "0" : "foo", "1" : "bar" } }
0 : 31 00 00 00 03 30 00 29 00 00 00 02 66 6f 6f 00 [1....0.)....foo.]
10 : 05 00 00 00 74 65 73 74 00 02 30 00 04 00 00 00 [....test..0.....]
20 : 66 6f 6f 00 02 31 00 04 00 00 00 62 61 72 00 00 [foo..1.....bar..]
30 : 00 [.]
Test#22 { "0" : { "int" : 3, "boolean" : true, "array" : [ "foo", "bar" ], "object" : { }, "string" : "test", "3" : "test" } }
0 : 6c 00 00 00 03 30 00 64 00 00 00 10 69 6e 74 00 [l....0.d....int.]
10 : 03 00 00 00 08 62 6f 6f 6c 65 61 6e 00 01 04 61 [.....boolean...a]
20 : 72 72 61 79 00 1b 00 00 00 02 30 00 04 00 00 00 [rray......0.....]
30 : 66 6f 6f 00 02 31 00 04 00 00 00 62 61 72 00 00 [foo..1.....bar..]
40 : 03 6f 62 6a 65 63 74 00 05 00 00 00 00 02 73 74 [.object.......st]
50 : 72 69 6e 67 00 05 00 00 00 74 65 73 74 00 02 33 [ring.....test..3]
60 : 00 05 00 00 00 74 65 73 74 00 00 00 [.....test...]
===DONE===
diff --git a/mongodb-1.2.3/tests/bson/bson-encode-002.phpt b/mongodb-1.2.8/tests/bson/bson-encode-002.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bson-encode-002.phpt
rename to mongodb-1.2.8/tests/bson/bson-encode-002.phpt
diff --git a/mongodb-1.2.3/tests/bson/bson-encode-003.phpt b/mongodb-1.2.8/tests/bson/bson-encode-003.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bson-encode-003.phpt
rename to mongodb-1.2.8/tests/bson/bson-encode-003.phpt
diff --git a/mongodb-1.2.3/tests/bson/bson-encode-004.phpt b/mongodb-1.2.8/tests/bson/bson-encode-004.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bson-encode-004.phpt
rename to mongodb-1.2.8/tests/bson/bson-encode-004.phpt
diff --git a/mongodb-1.2.3/tests/bson/bson-encode-005.phpt b/mongodb-1.2.8/tests/bson/bson-encode-005.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bson-encode-005.phpt
rename to mongodb-1.2.8/tests/bson/bson-encode-005.phpt
diff --git a/mongodb-1.2.3/tests/bson/bson-fromJSON-001.phpt b/mongodb-1.2.8/tests/bson/bson-fromJSON-001.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bson-fromJSON-001.phpt
rename to mongodb-1.2.8/tests/bson/bson-fromJSON-001.phpt
diff --git a/mongodb-1.2.3/tests/bson/bson-fromJSON-002.phpt b/mongodb-1.2.8/tests/bson/bson-fromJSON-002.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bson-fromJSON-002.phpt
rename to mongodb-1.2.8/tests/bson/bson-fromJSON-002.phpt
diff --git a/mongodb-1.2.3/tests/bson/bson-fromJSON_error-001.phpt b/mongodb-1.2.8/tests/bson/bson-fromJSON_error-001.phpt
similarity index 52%
rename from mongodb-1.2.3/tests/bson/bson-fromJSON_error-001.phpt
rename to mongodb-1.2.8/tests/bson/bson-fromJSON_error-001.phpt
index a86ca7a6..a0f91a09 100644
--- a/mongodb-1.2.3/tests/bson/bson-fromJSON_error-001.phpt
+++ b/mongodb-1.2.8/tests/bson/bson-fromJSON_error-001.phpt
@@ -1,21 +1,17 @@
--TEST--
MongoDB\BSON\fromJSON(): invalid JSON
--FILE--
<?php
require_once __DIR__ . '/../utils/tools.php';
-echo throws(function() {
+throws(function() {
fromJSON('foo');
-}, 'MongoDB\Driver\Exception\UnexpectedValueException'), "\n";
+}, 'MongoDB\Driver\Exception\UnexpectedValueException');
?>
===DONE===
<?php exit(0); ?>
--EXPECT--
OK: Got MongoDB\Driver\Exception\UnexpectedValueException
-lexical error: invalid string in json text.
- foo
- (right here) ------^
-
===DONE===
diff --git a/mongodb-1.2.3/tests/bson/bson-fromPHP-001.phpt b/mongodb-1.2.8/tests/bson/bson-fromPHP-001.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bson-fromPHP-001.phpt
rename to mongodb-1.2.8/tests/bson/bson-fromPHP-001.phpt
diff --git a/mongodb-1.2.3/tests/bson/bson-fromPHP-002.phpt b/mongodb-1.2.8/tests/bson/bson-fromPHP-002.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bson-fromPHP-002.phpt
rename to mongodb-1.2.8/tests/bson/bson-fromPHP-002.phpt
diff --git a/mongodb-1.2.3/tests/bson/bson-fromPHP-003.phpt b/mongodb-1.2.8/tests/bson/bson-fromPHP-003.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bson-fromPHP-003.phpt
rename to mongodb-1.2.8/tests/bson/bson-fromPHP-003.phpt
diff --git a/mongodb-1.2.3/tests/bson/bson-fromPHP-004.phpt b/mongodb-1.2.8/tests/bson/bson-fromPHP-004.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bson-fromPHP-004.phpt
rename to mongodb-1.2.8/tests/bson/bson-fromPHP-004.phpt
diff --git a/mongodb-1.2.3/tests/bson/bson-fromPHP-005.phpt b/mongodb-1.2.8/tests/bson/bson-fromPHP-005.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bson-fromPHP-005.phpt
rename to mongodb-1.2.8/tests/bson/bson-fromPHP-005.phpt
diff --git a/mongodb-1.2.3/tests/bson/bson-fromPHP-006.phpt b/mongodb-1.2.8/tests/bson/bson-fromPHP-006.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bson-fromPHP-006.phpt
rename to mongodb-1.2.8/tests/bson/bson-fromPHP-006.phpt
diff --git a/mongodb-1.2.3/tests/bson/bson-fromPHP_error-001.phpt b/mongodb-1.2.8/tests/bson/bson-fromPHP_error-001.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bson-fromPHP_error-001.phpt
rename to mongodb-1.2.8/tests/bson/bson-fromPHP_error-001.phpt
diff --git a/mongodb-1.2.3/tests/bson/bson-fromPHP_error-002.phpt b/mongodb-1.2.8/tests/bson/bson-fromPHP_error-002.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bson-fromPHP_error-002.phpt
rename to mongodb-1.2.8/tests/bson/bson-fromPHP_error-002.phpt
diff --git a/mongodb-1.2.3/tests/bson/bson-fromPHP_error-003.phpt b/mongodb-1.2.8/tests/bson/bson-fromPHP_error-003.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bson-fromPHP_error-003.phpt
rename to mongodb-1.2.8/tests/bson/bson-fromPHP_error-003.phpt
diff --git a/mongodb-1.2.3/tests/bson/bson-generate-document-id.phpt b/mongodb-1.2.8/tests/bson/bson-generate-document-id.phpt
similarity index 92%
rename from mongodb-1.2.3/tests/bson/bson-generate-document-id.phpt
rename to mongodb-1.2.8/tests/bson/bson-generate-document-id.phpt
index 7677c214..bc2f1ee1 100644
--- a/mongodb-1.2.3/tests/bson/bson-generate-document-id.phpt
+++ b/mongodb-1.2.8/tests/bson/bson-generate-document-id.phpt
@@ -1,71 +1,72 @@
--TEST--
_id should only be generated for top-level document, not embedded docs
--SKIPIF--
-<?php require __DIR__ . "/../utils/basic-skipif.inc"; CLEANUP(STANDALONE) ?>
+<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
+<?php NEEDS('STANDALONE'); CLEANUP(STANDALONE); ?>
--FILE--
<?php
require_once __DIR__ . "/../utils/basic.inc";
$manager = new MongoDB\Driver\Manager(STANDALONE);
$user = array(
"username" => "bob",
"address" => array(
"street" => "Main St.",
"city" => "New York",
),
);
$bulk = new MongoDB\Driver\BulkWrite();
$user["_id"] = $bulk->insert($user);
$result = $manager->executeBulkWrite(NS, $bulk);
echo "Dumping inserted user document with injected _id:\n";
var_dump($user);
$cursor = $manager->executeQuery(NS, new MongoDB\Driver\Query(array("_id" => $user["_id"])));
echo "\nDumping fetched user document:\n";
$array = $cursor->toArray();
var_dump($array[0]);
?>
===DONE===
<?php exit(0); ?>
--EXPECTF--
Dumping inserted user document with injected _id:
array(3) {
["username"]=>
string(3) "bob"
["address"]=>
array(2) {
["street"]=>
string(8) "Main St."
["city"]=>
string(8) "New York"
}
["_id"]=>
object(%s\ObjectID)#%d (%d) {
["oid"]=>
string(24) "%s"
}
}
Dumping fetched user document:
object(stdClass)#%d (3) {
["_id"]=>
object(%s\ObjectID)#%d (%d) {
["oid"]=>
string(24) "%s"
}
["username"]=>
string(3) "bob"
["address"]=>
object(stdClass)#%d (%d) {
["street"]=>
string(8) "Main St."
["city"]=>
string(8) "New York"
}
}
===DONE===
diff --git a/mongodb-1.2.3/tests/bson/bson-javascript-001.phpt b/mongodb-1.2.8/tests/bson/bson-javascript-001.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bson-javascript-001.phpt
rename to mongodb-1.2.8/tests/bson/bson-javascript-001.phpt
diff --git a/mongodb-1.2.3/tests/bson/bson-javascript-002.phpt b/mongodb-1.2.8/tests/bson/bson-javascript-002.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bson-javascript-002.phpt
rename to mongodb-1.2.8/tests/bson/bson-javascript-002.phpt
diff --git a/mongodb-1.2.3/tests/bson/bson-javascript-compare-001.phpt b/mongodb-1.2.8/tests/bson/bson-javascript-compare-001.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bson-javascript-compare-001.phpt
rename to mongodb-1.2.8/tests/bson/bson-javascript-compare-001.phpt
diff --git a/mongodb-1.2.3/tests/bson/bson-javascript-compare-002.phpt b/mongodb-1.2.8/tests/bson/bson-javascript-compare-002.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bson-javascript-compare-002.phpt
rename to mongodb-1.2.8/tests/bson/bson-javascript-compare-002.phpt
diff --git a/mongodb-1.2.3/tests/bson/bson-javascript-getCode-001.phpt b/mongodb-1.2.8/tests/bson/bson-javascript-getCode-001.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bson-javascript-getCode-001.phpt
rename to mongodb-1.2.8/tests/bson/bson-javascript-getCode-001.phpt
diff --git a/mongodb-1.2.3/tests/bson/bson-javascript-getScope-001.phpt b/mongodb-1.2.8/tests/bson/bson-javascript-getScope-001.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bson-javascript-getScope-001.phpt
rename to mongodb-1.2.8/tests/bson/bson-javascript-getScope-001.phpt
diff --git a/mongodb-1.2.3/tests/bson/bson-javascript-jsonserialize-001.phpt b/mongodb-1.2.8/tests/bson/bson-javascript-jsonserialize-001.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bson-javascript-jsonserialize-001.phpt
rename to mongodb-1.2.8/tests/bson/bson-javascript-jsonserialize-001.phpt
diff --git a/mongodb-1.2.3/tests/bson/bson-javascript-jsonserialize-002.phpt b/mongodb-1.2.8/tests/bson/bson-javascript-jsonserialize-002.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bson-javascript-jsonserialize-002.phpt
rename to mongodb-1.2.8/tests/bson/bson-javascript-jsonserialize-002.phpt
diff --git a/mongodb-1.2.3/tests/bson/bson-javascript-jsonserialize-003.phpt b/mongodb-1.2.8/tests/bson/bson-javascript-jsonserialize-003.phpt
similarity index 87%
rename from mongodb-1.2.3/tests/bson/bson-javascript-jsonserialize-003.phpt
rename to mongodb-1.2.8/tests/bson/bson-javascript-jsonserialize-003.phpt
index 0478bb43..c551483a 100644
--- a/mongodb-1.2.3/tests/bson/bson-javascript-jsonserialize-003.phpt
+++ b/mongodb-1.2.8/tests/bson/bson-javascript-jsonserialize-003.phpt
@@ -1,28 +1,28 @@
--TEST--
MongoDB\BSON\Javascript::jsonSerialize() with json_encode() (without scope)
--FILE--
<?php
require_once __DIR__ . '/../utils/tools.php';
$doc = ['foo' => new MongoDB\BSON\Javascript('function foo(bar) { return bar; }')];
$json = json_encode($doc);
echo toJSON(fromPHP($doc)), "\n";
echo $json, "\n";
var_dump(toPHP(fromJSON($json)));
?>
===DONE===
<?php exit(0); ?>
--EXPECTF--
{ "foo" : { "$code" : "function foo(bar) { return bar; }" } }
{"foo":{"$code":"function foo(bar) { return bar; }"}}
object(stdClass)#%d (%d) {
["foo"]=>
- object(stdClass)#%d (%d) {
- ["$code"]=>
+ object(%r(stdClass|MongoDB\\BSON\\Javascript)%r)#%d (%d) {
+ ["%r(\$?)%rcode"]=>
string(33) "function foo(bar) { return bar; }"
- }
+ %A}
}
===DONE===
diff --git a/mongodb-1.2.3/tests/bson/bson-javascript-jsonserialize-004.phpt b/mongodb-1.2.8/tests/bson/bson-javascript-jsonserialize-004.phpt
similarity index 87%
rename from mongodb-1.2.3/tests/bson/bson-javascript-jsonserialize-004.phpt
rename to mongodb-1.2.8/tests/bson/bson-javascript-jsonserialize-004.phpt
index a3daaa5d..f134edb2 100644
--- a/mongodb-1.2.3/tests/bson/bson-javascript-jsonserialize-004.phpt
+++ b/mongodb-1.2.8/tests/bson/bson-javascript-jsonserialize-004.phpt
@@ -1,33 +1,33 @@
--TEST--
MongoDB\BSON\Javascript::jsonSerialize() with json_encode() (with scope)
--FILE--
<?php
require_once __DIR__ . '/../utils/tools.php';
$doc = ['foo' => new MongoDB\BSON\Javascript('function foo(bar) { return bar; }', ['foo' => 42])];
$json = json_encode($doc);
echo toJSON(fromPHP($doc)), "\n";
echo $json, "\n";
var_dump(toPHP(fromJSON($json)));
?>
===DONE===
<?php exit(0); ?>
--EXPECTF--
{ "foo" : { "$code" : "function foo(bar) { return bar; }", "$scope" : { "foo" : 42 } } }
{"foo":{"$code":"function foo(bar) { return bar; }","$scope":{"foo":42}}}
object(stdClass)#%d (%d) {
["foo"]=>
- object(stdClass)#%d (%d) {
- ["$code"]=>
+ object(%r(stdClass|MongoDB\\BSON\\Javascript)%r)#%d (%d) {
+ ["%r(\$?)%rcode"]=>
string(33) "function foo(bar) { return bar; }"
- ["$scope"]=>
+ ["%r(\$?)%rscope"]=>
object(stdClass)#%d (%d) {
["foo"]=>
int(42)
}
}
}
===DONE===
diff --git a/mongodb-1.2.3/tests/bson/bson-javascript-serialization-001.phpt b/mongodb-1.2.8/tests/bson/bson-javascript-serialization-001.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bson-javascript-serialization-001.phpt
rename to mongodb-1.2.8/tests/bson/bson-javascript-serialization-001.phpt
diff --git a/mongodb-1.2.3/tests/bson/bson-javascript-serialization_error-001.phpt b/mongodb-1.2.8/tests/bson/bson-javascript-serialization_error-001.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bson-javascript-serialization_error-001.phpt
rename to mongodb-1.2.8/tests/bson/bson-javascript-serialization_error-001.phpt
diff --git a/mongodb-1.2.3/tests/bson/bson-javascript-serialization_error-002.phpt b/mongodb-1.2.8/tests/bson/bson-javascript-serialization_error-002.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bson-javascript-serialization_error-002.phpt
rename to mongodb-1.2.8/tests/bson/bson-javascript-serialization_error-002.phpt
diff --git a/mongodb-1.2.3/tests/bson/bson-javascript-serialization_error-003.phpt b/mongodb-1.2.8/tests/bson/bson-javascript-serialization_error-003.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bson-javascript-serialization_error-003.phpt
rename to mongodb-1.2.8/tests/bson/bson-javascript-serialization_error-003.phpt
diff --git a/mongodb-1.2.3/tests/bson/bson-javascript-set_state-001.phpt b/mongodb-1.2.8/tests/bson/bson-javascript-set_state-001.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bson-javascript-set_state-001.phpt
rename to mongodb-1.2.8/tests/bson/bson-javascript-set_state-001.phpt
diff --git a/mongodb-1.2.3/tests/bson/bson-javascript-set_state_error-001.phpt b/mongodb-1.2.8/tests/bson/bson-javascript-set_state_error-001.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bson-javascript-set_state_error-001.phpt
rename to mongodb-1.2.8/tests/bson/bson-javascript-set_state_error-001.phpt
diff --git a/mongodb-1.2.3/tests/bson/bson-javascript-set_state_error-002.phpt b/mongodb-1.2.8/tests/bson/bson-javascript-set_state_error-002.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bson-javascript-set_state_error-002.phpt
rename to mongodb-1.2.8/tests/bson/bson-javascript-set_state_error-002.phpt
diff --git a/mongodb-1.2.3/tests/bson/bson-javascript-set_state_error-003.phpt b/mongodb-1.2.8/tests/bson/bson-javascript-set_state_error-003.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bson-javascript-set_state_error-003.phpt
rename to mongodb-1.2.8/tests/bson/bson-javascript-set_state_error-003.phpt
diff --git a/mongodb-1.2.3/tests/bson/bson-javascript-tostring-001.phpt b/mongodb-1.2.8/tests/bson/bson-javascript-tostring-001.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bson-javascript-tostring-001.phpt
rename to mongodb-1.2.8/tests/bson/bson-javascript-tostring-001.phpt
diff --git a/mongodb-1.2.3/tests/bson/bson-javascript_error-001.phpt b/mongodb-1.2.8/tests/bson/bson-javascript_error-001.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bson-javascript_error-001.phpt
rename to mongodb-1.2.8/tests/bson/bson-javascript_error-001.phpt
diff --git a/mongodb-1.2.3/tests/bson/bson-javascript_error-002.phpt b/mongodb-1.2.8/tests/bson/bson-javascript_error-002.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bson-javascript_error-002.phpt
rename to mongodb-1.2.8/tests/bson/bson-javascript_error-002.phpt
diff --git a/mongodb-1.2.3/tests/bson/bson-javascript_error-003.phpt b/mongodb-1.2.8/tests/bson/bson-javascript_error-003.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bson-javascript_error-003.phpt
rename to mongodb-1.2.8/tests/bson/bson-javascript_error-003.phpt
diff --git a/mongodb-1.2.3/tests/bson/bson-maxkey-001.phpt b/mongodb-1.2.8/tests/bson/bson-maxkey-001.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bson-maxkey-001.phpt
rename to mongodb-1.2.8/tests/bson/bson-maxkey-001.phpt
diff --git a/mongodb-1.2.3/tests/bson/bson-maxkey-compare-001.phpt b/mongodb-1.2.8/tests/bson/bson-maxkey-compare-001.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bson-maxkey-compare-001.phpt
rename to mongodb-1.2.8/tests/bson/bson-maxkey-compare-001.phpt
diff --git a/mongodb-1.2.3/tests/bson/bson-maxkey-jsonserialize-001.phpt b/mongodb-1.2.8/tests/bson/bson-maxkey-jsonserialize-001.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bson-maxkey-jsonserialize-001.phpt
rename to mongodb-1.2.8/tests/bson/bson-maxkey-jsonserialize-001.phpt
diff --git a/mongodb-1.2.3/tests/bson/bson-maxkey-jsonserialize-002.phpt b/mongodb-1.2.8/tests/bson/bson-maxkey-jsonserialize-002.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bson-maxkey-jsonserialize-002.phpt
rename to mongodb-1.2.8/tests/bson/bson-maxkey-jsonserialize-002.phpt
diff --git a/mongodb-1.2.3/tests/bson/bson-maxkey-serialization-001.phpt b/mongodb-1.2.8/tests/bson/bson-maxkey-serialization-001.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bson-maxkey-serialization-001.phpt
rename to mongodb-1.2.8/tests/bson/bson-maxkey-serialization-001.phpt
diff --git a/mongodb-1.2.3/tests/bson/bson-maxkey-set_state-001.phpt b/mongodb-1.2.8/tests/bson/bson-maxkey-set_state-001.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bson-maxkey-set_state-001.phpt
rename to mongodb-1.2.8/tests/bson/bson-maxkey-set_state-001.phpt
diff --git a/mongodb-1.2.3/tests/bson/bson-maxkey_error-001.phpt b/mongodb-1.2.8/tests/bson/bson-maxkey_error-001.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bson-maxkey_error-001.phpt
rename to mongodb-1.2.8/tests/bson/bson-maxkey_error-001.phpt
diff --git a/mongodb-1.2.3/tests/bson/bson-minkey-001.phpt b/mongodb-1.2.8/tests/bson/bson-minkey-001.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bson-minkey-001.phpt
rename to mongodb-1.2.8/tests/bson/bson-minkey-001.phpt
diff --git a/mongodb-1.2.3/tests/bson/bson-minkey-compare-001.phpt b/mongodb-1.2.8/tests/bson/bson-minkey-compare-001.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bson-minkey-compare-001.phpt
rename to mongodb-1.2.8/tests/bson/bson-minkey-compare-001.phpt
diff --git a/mongodb-1.2.3/tests/bson/bson-minkey-jsonserialize-001.phpt b/mongodb-1.2.8/tests/bson/bson-minkey-jsonserialize-001.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bson-minkey-jsonserialize-001.phpt
rename to mongodb-1.2.8/tests/bson/bson-minkey-jsonserialize-001.phpt
diff --git a/mongodb-1.2.3/tests/bson/bson-minkey-jsonserialize-002.phpt b/mongodb-1.2.8/tests/bson/bson-minkey-jsonserialize-002.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bson-minkey-jsonserialize-002.phpt
rename to mongodb-1.2.8/tests/bson/bson-minkey-jsonserialize-002.phpt
diff --git a/mongodb-1.2.3/tests/bson/bson-minkey-serialization-001.phpt b/mongodb-1.2.8/tests/bson/bson-minkey-serialization-001.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bson-minkey-serialization-001.phpt
rename to mongodb-1.2.8/tests/bson/bson-minkey-serialization-001.phpt
diff --git a/mongodb-1.2.3/tests/bson/bson-minkey-set_state-001.phpt b/mongodb-1.2.8/tests/bson/bson-minkey-set_state-001.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bson-minkey-set_state-001.phpt
rename to mongodb-1.2.8/tests/bson/bson-minkey-set_state-001.phpt
diff --git a/mongodb-1.2.3/tests/bson/bson-minkey_error-001.phpt b/mongodb-1.2.8/tests/bson/bson-minkey_error-001.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bson-minkey_error-001.phpt
rename to mongodb-1.2.8/tests/bson/bson-minkey_error-001.phpt
diff --git a/mongodb-1.2.3/tests/bson/bson-objectid-001.phpt b/mongodb-1.2.8/tests/bson/bson-objectid-001.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bson-objectid-001.phpt
rename to mongodb-1.2.8/tests/bson/bson-objectid-001.phpt
diff --git a/mongodb-1.2.3/tests/bson/bson-objectid-002.phpt b/mongodb-1.2.8/tests/bson/bson-objectid-002.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bson-objectid-002.phpt
rename to mongodb-1.2.8/tests/bson/bson-objectid-002.phpt
diff --git a/mongodb-1.2.3/tests/bson/bson-objectid-003.phpt b/mongodb-1.2.8/tests/bson/bson-objectid-003.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bson-objectid-003.phpt
rename to mongodb-1.2.8/tests/bson/bson-objectid-003.phpt
diff --git a/mongodb-1.2.3/tests/bson/bson-objectid-004.phpt b/mongodb-1.2.8/tests/bson/bson-objectid-004.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bson-objectid-004.phpt
rename to mongodb-1.2.8/tests/bson/bson-objectid-004.phpt
diff --git a/mongodb-1.2.3/tests/bson/bson-objectid-compare-001.phpt b/mongodb-1.2.8/tests/bson/bson-objectid-compare-001.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bson-objectid-compare-001.phpt
rename to mongodb-1.2.8/tests/bson/bson-objectid-compare-001.phpt
diff --git a/mongodb-1.2.3/tests/bson/bson-objectid-compare-002.phpt b/mongodb-1.2.8/tests/bson/bson-objectid-compare-002.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bson-objectid-compare-002.phpt
rename to mongodb-1.2.8/tests/bson/bson-objectid-compare-002.phpt
diff --git a/mongodb-1.2.3/tests/bson/bson-objectid-getTimestamp-001.phpt b/mongodb-1.2.8/tests/bson/bson-objectid-getTimestamp-001.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bson-objectid-getTimestamp-001.phpt
rename to mongodb-1.2.8/tests/bson/bson-objectid-getTimestamp-001.phpt
diff --git a/mongodb-1.2.3/tests/bson/bson-objectid-jsonserialize-001.phpt b/mongodb-1.2.8/tests/bson/bson-objectid-jsonserialize-001.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bson-objectid-jsonserialize-001.phpt
rename to mongodb-1.2.8/tests/bson/bson-objectid-jsonserialize-001.phpt
diff --git a/mongodb-1.2.3/tests/bson/bson-objectid-jsonserialize-002.phpt b/mongodb-1.2.8/tests/bson/bson-objectid-jsonserialize-002.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bson-objectid-jsonserialize-002.phpt
rename to mongodb-1.2.8/tests/bson/bson-objectid-jsonserialize-002.phpt
diff --git a/mongodb-1.2.3/tests/bson/bson-objectid-serialization-001.phpt b/mongodb-1.2.8/tests/bson/bson-objectid-serialization-001.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bson-objectid-serialization-001.phpt
rename to mongodb-1.2.8/tests/bson/bson-objectid-serialization-001.phpt
diff --git a/mongodb-1.2.3/tests/bson/bson-objectid-serialization_error-001.phpt b/mongodb-1.2.8/tests/bson/bson-objectid-serialization_error-001.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bson-objectid-serialization_error-001.phpt
rename to mongodb-1.2.8/tests/bson/bson-objectid-serialization_error-001.phpt
diff --git a/mongodb-1.2.3/tests/bson/bson-objectid-serialization_error-002.phpt b/mongodb-1.2.8/tests/bson/bson-objectid-serialization_error-002.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bson-objectid-serialization_error-002.phpt
rename to mongodb-1.2.8/tests/bson/bson-objectid-serialization_error-002.phpt
diff --git a/mongodb-1.2.3/tests/bson/bson-objectid-set_state-001.phpt b/mongodb-1.2.8/tests/bson/bson-objectid-set_state-001.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bson-objectid-set_state-001.phpt
rename to mongodb-1.2.8/tests/bson/bson-objectid-set_state-001.phpt
diff --git a/mongodb-1.2.3/tests/bson/bson-objectid-set_state_error-001.phpt b/mongodb-1.2.8/tests/bson/bson-objectid-set_state_error-001.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bson-objectid-set_state_error-001.phpt
rename to mongodb-1.2.8/tests/bson/bson-objectid-set_state_error-001.phpt
diff --git a/mongodb-1.2.3/tests/bson/bson-objectid-set_state_error-002.phpt b/mongodb-1.2.8/tests/bson/bson-objectid-set_state_error-002.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bson-objectid-set_state_error-002.phpt
rename to mongodb-1.2.8/tests/bson/bson-objectid-set_state_error-002.phpt
diff --git a/mongodb-1.2.3/tests/bson/bson-objectid_error-001.phpt b/mongodb-1.2.8/tests/bson/bson-objectid_error-001.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bson-objectid_error-001.phpt
rename to mongodb-1.2.8/tests/bson/bson-objectid_error-001.phpt
diff --git a/mongodb-1.2.3/tests/bson/bson-objectid_error-002.phpt b/mongodb-1.2.8/tests/bson/bson-objectid_error-002.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bson-objectid_error-002.phpt
rename to mongodb-1.2.8/tests/bson/bson-objectid_error-002.phpt
diff --git a/mongodb-1.2.3/tests/bson/bson-objectid_error-003.phpt b/mongodb-1.2.8/tests/bson/bson-objectid_error-003.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bson-objectid_error-003.phpt
rename to mongodb-1.2.8/tests/bson/bson-objectid_error-003.phpt
diff --git a/mongodb-1.2.3/tests/bson/bson-regex-001.phpt b/mongodb-1.2.8/tests/bson/bson-regex-001.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bson-regex-001.phpt
rename to mongodb-1.2.8/tests/bson/bson-regex-001.phpt
diff --git a/mongodb-1.2.3/tests/bson/bson-regex-002.phpt b/mongodb-1.2.8/tests/bson/bson-regex-002.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bson-regex-002.phpt
rename to mongodb-1.2.8/tests/bson/bson-regex-002.phpt
diff --git a/mongodb-1.2.3/tests/bson/bson-regex-003.phpt b/mongodb-1.2.8/tests/bson/bson-regex-003.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bson-regex-003.phpt
rename to mongodb-1.2.8/tests/bson/bson-regex-003.phpt
diff --git a/mongodb-1.2.3/tests/bson/bson-regex-004.phpt b/mongodb-1.2.8/tests/bson/bson-regex-004.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bson-regex-004.phpt
rename to mongodb-1.2.8/tests/bson/bson-regex-004.phpt
diff --git a/mongodb-1.2.3/tests/bson/bson-regex-005.phpt b/mongodb-1.2.8/tests/bson/bson-regex-005.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bson-regex-005.phpt
rename to mongodb-1.2.8/tests/bson/bson-regex-005.phpt
diff --git a/mongodb-1.2.3/tests/bson/bson-regex-compare-001.phpt b/mongodb-1.2.8/tests/bson/bson-regex-compare-001.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bson-regex-compare-001.phpt
rename to mongodb-1.2.8/tests/bson/bson-regex-compare-001.phpt
diff --git a/mongodb-1.2.3/tests/bson/bson-regex-compare-002.phpt b/mongodb-1.2.8/tests/bson/bson-regex-compare-002.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bson-regex-compare-002.phpt
rename to mongodb-1.2.8/tests/bson/bson-regex-compare-002.phpt
diff --git a/mongodb-1.2.3/tests/bson/bson-regex-jsonserialize-001.phpt b/mongodb-1.2.8/tests/bson/bson-regex-jsonserialize-001.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bson-regex-jsonserialize-001.phpt
rename to mongodb-1.2.8/tests/bson/bson-regex-jsonserialize-001.phpt
diff --git a/mongodb-1.2.3/tests/bson/bson-regex-jsonserialize-002.phpt b/mongodb-1.2.8/tests/bson/bson-regex-jsonserialize-002.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bson-regex-jsonserialize-002.phpt
rename to mongodb-1.2.8/tests/bson/bson-regex-jsonserialize-002.phpt
diff --git a/mongodb-1.2.3/tests/bson/bson-regex-jsonserialize-003.phpt b/mongodb-1.2.8/tests/bson/bson-regex-jsonserialize-003.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bson-regex-jsonserialize-003.phpt
rename to mongodb-1.2.8/tests/bson/bson-regex-jsonserialize-003.phpt
diff --git a/mongodb-1.2.3/tests/bson/bson-regex-jsonserialize-004.phpt b/mongodb-1.2.8/tests/bson/bson-regex-jsonserialize-004.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bson-regex-jsonserialize-004.phpt
rename to mongodb-1.2.8/tests/bson/bson-regex-jsonserialize-004.phpt
diff --git a/mongodb-1.2.3/tests/bson/bson-regex-serialization-001.phpt b/mongodb-1.2.8/tests/bson/bson-regex-serialization-001.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bson-regex-serialization-001.phpt
rename to mongodb-1.2.8/tests/bson/bson-regex-serialization-001.phpt
diff --git a/mongodb-1.2.3/tests/bson/bson-regex-serialization-002.phpt b/mongodb-1.2.8/tests/bson/bson-regex-serialization-002.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bson-regex-serialization-002.phpt
rename to mongodb-1.2.8/tests/bson/bson-regex-serialization-002.phpt
diff --git a/mongodb-1.2.3/tests/bson/bson-regex-serialization-003.phpt b/mongodb-1.2.8/tests/bson/bson-regex-serialization-003.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bson-regex-serialization-003.phpt
rename to mongodb-1.2.8/tests/bson/bson-regex-serialization-003.phpt
diff --git a/mongodb-1.2.3/tests/bson/bson-regex-serialization_error-001.phpt b/mongodb-1.2.8/tests/bson/bson-regex-serialization_error-001.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bson-regex-serialization_error-001.phpt
rename to mongodb-1.2.8/tests/bson/bson-regex-serialization_error-001.phpt
diff --git a/mongodb-1.2.3/tests/bson/bson-regex-serialization_error-002.phpt b/mongodb-1.2.8/tests/bson/bson-regex-serialization_error-002.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bson-regex-serialization_error-002.phpt
rename to mongodb-1.2.8/tests/bson/bson-regex-serialization_error-002.phpt
diff --git a/mongodb-1.2.3/tests/bson/bson-regex-set_state-001.phpt b/mongodb-1.2.8/tests/bson/bson-regex-set_state-001.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bson-regex-set_state-001.phpt
rename to mongodb-1.2.8/tests/bson/bson-regex-set_state-001.phpt
diff --git a/mongodb-1.2.3/tests/bson/bson-regex-set_state-002.phpt b/mongodb-1.2.8/tests/bson/bson-regex-set_state-002.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bson-regex-set_state-002.phpt
rename to mongodb-1.2.8/tests/bson/bson-regex-set_state-002.phpt
diff --git a/mongodb-1.2.3/tests/bson/bson-regex-set_state_error-001.phpt b/mongodb-1.2.8/tests/bson/bson-regex-set_state_error-001.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bson-regex-set_state_error-001.phpt
rename to mongodb-1.2.8/tests/bson/bson-regex-set_state_error-001.phpt
diff --git a/mongodb-1.2.3/tests/bson/bson-regex-set_state_error-002.phpt b/mongodb-1.2.8/tests/bson/bson-regex-set_state_error-002.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bson-regex-set_state_error-002.phpt
rename to mongodb-1.2.8/tests/bson/bson-regex-set_state_error-002.phpt
diff --git a/mongodb-1.2.3/tests/bson/bson-regex_error-001.phpt b/mongodb-1.2.8/tests/bson/bson-regex_error-001.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bson-regex_error-001.phpt
rename to mongodb-1.2.8/tests/bson/bson-regex_error-001.phpt
diff --git a/mongodb-1.2.3/tests/bson/bson-regex_error-002.phpt b/mongodb-1.2.8/tests/bson/bson-regex_error-002.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bson-regex_error-002.phpt
rename to mongodb-1.2.8/tests/bson/bson-regex_error-002.phpt
diff --git a/mongodb-1.2.3/tests/bson/bson-regex_error-003.phpt b/mongodb-1.2.8/tests/bson/bson-regex_error-003.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bson-regex_error-003.phpt
rename to mongodb-1.2.8/tests/bson/bson-regex_error-003.phpt
diff --git a/mongodb-1.2.3/tests/bson/bson-timestamp-001.phpt b/mongodb-1.2.8/tests/bson/bson-timestamp-001.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bson-timestamp-001.phpt
rename to mongodb-1.2.8/tests/bson/bson-timestamp-001.phpt
diff --git a/mongodb-1.2.3/tests/bson/bson-timestamp-002.phpt b/mongodb-1.2.8/tests/bson/bson-timestamp-002.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bson-timestamp-002.phpt
rename to mongodb-1.2.8/tests/bson/bson-timestamp-002.phpt
diff --git a/mongodb-1.2.3/tests/bson/bson-timestamp-003.phpt b/mongodb-1.2.8/tests/bson/bson-timestamp-003.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bson-timestamp-003.phpt
rename to mongodb-1.2.8/tests/bson/bson-timestamp-003.phpt
diff --git a/mongodb-1.2.3/tests/bson/bson-timestamp-004.phpt b/mongodb-1.2.8/tests/bson/bson-timestamp-004.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bson-timestamp-004.phpt
rename to mongodb-1.2.8/tests/bson/bson-timestamp-004.phpt
diff --git a/mongodb-1.2.3/tests/bson/bson-timestamp-005.phpt b/mongodb-1.2.8/tests/bson/bson-timestamp-005.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bson-timestamp-005.phpt
rename to mongodb-1.2.8/tests/bson/bson-timestamp-005.phpt
diff --git a/mongodb-1.2.3/tests/bson/bson-timestamp-compare-001.phpt b/mongodb-1.2.8/tests/bson/bson-timestamp-compare-001.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bson-timestamp-compare-001.phpt
rename to mongodb-1.2.8/tests/bson/bson-timestamp-compare-001.phpt
diff --git a/mongodb-1.2.3/tests/bson/bson-timestamp-jsonserialize-001.phpt b/mongodb-1.2.8/tests/bson/bson-timestamp-jsonserialize-001.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bson-timestamp-jsonserialize-001.phpt
rename to mongodb-1.2.8/tests/bson/bson-timestamp-jsonserialize-001.phpt
diff --git a/mongodb-1.2.3/tests/bson/bson-timestamp-jsonserialize-002.phpt b/mongodb-1.2.8/tests/bson/bson-timestamp-jsonserialize-002.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bson-timestamp-jsonserialize-002.phpt
rename to mongodb-1.2.8/tests/bson/bson-timestamp-jsonserialize-002.phpt
diff --git a/mongodb-1.2.3/tests/bson/bson-timestamp-serialization-001.phpt b/mongodb-1.2.8/tests/bson/bson-timestamp-serialization-001.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bson-timestamp-serialization-001.phpt
rename to mongodb-1.2.8/tests/bson/bson-timestamp-serialization-001.phpt
diff --git a/mongodb-1.2.3/tests/bson/bson-timestamp-serialization-002.phpt b/mongodb-1.2.8/tests/bson/bson-timestamp-serialization-002.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bson-timestamp-serialization-002.phpt
rename to mongodb-1.2.8/tests/bson/bson-timestamp-serialization-002.phpt
diff --git a/mongodb-1.2.3/tests/bson/bson-timestamp-serialization_error-001.phpt b/mongodb-1.2.8/tests/bson/bson-timestamp-serialization_error-001.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bson-timestamp-serialization_error-001.phpt
rename to mongodb-1.2.8/tests/bson/bson-timestamp-serialization_error-001.phpt
diff --git a/mongodb-1.2.3/tests/bson/bson-timestamp-serialization_error-002.phpt b/mongodb-1.2.8/tests/bson/bson-timestamp-serialization_error-002.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bson-timestamp-serialization_error-002.phpt
rename to mongodb-1.2.8/tests/bson/bson-timestamp-serialization_error-002.phpt
diff --git a/mongodb-1.2.3/tests/bson/bson-timestamp-serialization_error-003.phpt b/mongodb-1.2.8/tests/bson/bson-timestamp-serialization_error-003.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bson-timestamp-serialization_error-003.phpt
rename to mongodb-1.2.8/tests/bson/bson-timestamp-serialization_error-003.phpt
diff --git a/mongodb-1.2.3/tests/bson/bson-timestamp-serialization_error-004.phpt b/mongodb-1.2.8/tests/bson/bson-timestamp-serialization_error-004.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bson-timestamp-serialization_error-004.phpt
rename to mongodb-1.2.8/tests/bson/bson-timestamp-serialization_error-004.phpt
diff --git a/mongodb-1.2.3/tests/bson/bson-timestamp-set_state-001.phpt b/mongodb-1.2.8/tests/bson/bson-timestamp-set_state-001.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bson-timestamp-set_state-001.phpt
rename to mongodb-1.2.8/tests/bson/bson-timestamp-set_state-001.phpt
diff --git a/mongodb-1.2.3/tests/bson/bson-timestamp-set_state-002.phpt b/mongodb-1.2.8/tests/bson/bson-timestamp-set_state-002.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bson-timestamp-set_state-002.phpt
rename to mongodb-1.2.8/tests/bson/bson-timestamp-set_state-002.phpt
diff --git a/mongodb-1.2.3/tests/bson/bson-timestamp-set_state_error-001.phpt b/mongodb-1.2.8/tests/bson/bson-timestamp-set_state_error-001.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bson-timestamp-set_state_error-001.phpt
rename to mongodb-1.2.8/tests/bson/bson-timestamp-set_state_error-001.phpt
diff --git a/mongodb-1.2.3/tests/bson/bson-timestamp-set_state_error-002.phpt b/mongodb-1.2.8/tests/bson/bson-timestamp-set_state_error-002.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bson-timestamp-set_state_error-002.phpt
rename to mongodb-1.2.8/tests/bson/bson-timestamp-set_state_error-002.phpt
diff --git a/mongodb-1.2.3/tests/bson/bson-timestamp-set_state_error-003.phpt b/mongodb-1.2.8/tests/bson/bson-timestamp-set_state_error-003.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bson-timestamp-set_state_error-003.phpt
rename to mongodb-1.2.8/tests/bson/bson-timestamp-set_state_error-003.phpt
diff --git a/mongodb-1.2.3/tests/bson/bson-timestamp-set_state_error-004.phpt b/mongodb-1.2.8/tests/bson/bson-timestamp-set_state_error-004.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bson-timestamp-set_state_error-004.phpt
rename to mongodb-1.2.8/tests/bson/bson-timestamp-set_state_error-004.phpt
diff --git a/mongodb-1.2.3/tests/bson/bson-timestamp_error-001.phpt b/mongodb-1.2.8/tests/bson/bson-timestamp_error-001.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bson-timestamp_error-001.phpt
rename to mongodb-1.2.8/tests/bson/bson-timestamp_error-001.phpt
diff --git a/mongodb-1.2.3/tests/bson/bson-timestamp_error-002.phpt b/mongodb-1.2.8/tests/bson/bson-timestamp_error-002.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bson-timestamp_error-002.phpt
rename to mongodb-1.2.8/tests/bson/bson-timestamp_error-002.phpt
diff --git a/mongodb-1.2.3/tests/bson/bson-timestamp_error-003.phpt b/mongodb-1.2.8/tests/bson/bson-timestamp_error-003.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bson-timestamp_error-003.phpt
rename to mongodb-1.2.8/tests/bson/bson-timestamp_error-003.phpt
diff --git a/mongodb-1.2.3/tests/bson/bson-timestamp_error-004.phpt b/mongodb-1.2.8/tests/bson/bson-timestamp_error-004.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bson-timestamp_error-004.phpt
rename to mongodb-1.2.8/tests/bson/bson-timestamp_error-004.phpt
diff --git a/mongodb-1.2.3/tests/bson/bson-timestamp_error-005.phpt b/mongodb-1.2.8/tests/bson/bson-timestamp_error-005.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bson-timestamp_error-005.phpt
rename to mongodb-1.2.8/tests/bson/bson-timestamp_error-005.phpt
diff --git a/mongodb-1.2.3/tests/bson/bson-timestamp_error-006.phpt b/mongodb-1.2.8/tests/bson/bson-timestamp_error-006.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bson-timestamp_error-006.phpt
rename to mongodb-1.2.8/tests/bson/bson-timestamp_error-006.phpt
diff --git a/mongodb-1.2.3/tests/bson/bson-toJSON-001.phpt b/mongodb-1.2.8/tests/bson/bson-toJSON-001.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bson-toJSON-001.phpt
rename to mongodb-1.2.8/tests/bson/bson-toJSON-001.phpt
diff --git a/mongodb-1.2.3/tests/bson/bson-toJSON-002.phpt b/mongodb-1.2.8/tests/bson/bson-toJSON-002.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bson-toJSON-002.phpt
rename to mongodb-1.2.8/tests/bson/bson-toJSON-002.phpt
diff --git a/mongodb-1.2.3/tests/bson/bson-toJSON_error-001.phpt b/mongodb-1.2.8/tests/bson/bson-toJSON_error-001.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bson-toJSON_error-001.phpt
rename to mongodb-1.2.8/tests/bson/bson-toJSON_error-001.phpt
diff --git a/mongodb-1.2.3/tests/bson/bson-toJSON_error-002.phpt b/mongodb-1.2.8/tests/bson/bson-toJSON_error-002.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bson-toJSON_error-002.phpt
rename to mongodb-1.2.8/tests/bson/bson-toJSON_error-002.phpt
diff --git a/mongodb-1.2.3/tests/bson/bson-toJSON_error-003.phpt b/mongodb-1.2.8/tests/bson/bson-toJSON_error-003.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bson-toJSON_error-003.phpt
rename to mongodb-1.2.8/tests/bson/bson-toJSON_error-003.phpt
diff --git a/mongodb-1.2.3/tests/bson/bson-toPHP-001.phpt b/mongodb-1.2.8/tests/bson/bson-toPHP-001.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bson-toPHP-001.phpt
rename to mongodb-1.2.8/tests/bson/bson-toPHP-001.phpt
diff --git a/mongodb-1.2.3/tests/bson/bson-toPHP-002.phpt b/mongodb-1.2.8/tests/bson/bson-toPHP-002.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bson-toPHP-002.phpt
rename to mongodb-1.2.8/tests/bson/bson-toPHP-002.phpt
diff --git a/mongodb-1.2.3/tests/bson/bson-toPHP-003.phpt b/mongodb-1.2.8/tests/bson/bson-toPHP-003.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bson-toPHP-003.phpt
rename to mongodb-1.2.8/tests/bson/bson-toPHP-003.phpt
diff --git a/mongodb-1.2.3/tests/bson/bson-toPHP-004.phpt b/mongodb-1.2.8/tests/bson/bson-toPHP-004.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bson-toPHP-004.phpt
rename to mongodb-1.2.8/tests/bson/bson-toPHP-004.phpt
diff --git a/mongodb-1.2.3/tests/bson/bson-toPHP_error-001.phpt b/mongodb-1.2.8/tests/bson/bson-toPHP_error-001.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bson-toPHP_error-001.phpt
rename to mongodb-1.2.8/tests/bson/bson-toPHP_error-001.phpt
diff --git a/mongodb-1.2.3/tests/bson/bson-toPHP_error-002.phpt b/mongodb-1.2.8/tests/bson/bson-toPHP_error-002.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bson-toPHP_error-002.phpt
rename to mongodb-1.2.8/tests/bson/bson-toPHP_error-002.phpt
diff --git a/mongodb-1.2.3/tests/bson/bson-toPHP_error-003.phpt b/mongodb-1.2.8/tests/bson/bson-toPHP_error-003.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bson-toPHP_error-003.phpt
rename to mongodb-1.2.8/tests/bson/bson-toPHP_error-003.phpt
diff --git a/mongodb-1.2.3/tests/bson/bson-toPHP_error-004.phpt b/mongodb-1.2.8/tests/bson/bson-toPHP_error-004.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bson-toPHP_error-004.phpt
rename to mongodb-1.2.8/tests/bson/bson-toPHP_error-004.phpt
diff --git a/mongodb-1.2.3/tests/bson/bson-unknown-001.phpt b/mongodb-1.2.8/tests/bson/bson-unknown-001.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bson-unknown-001.phpt
rename to mongodb-1.2.8/tests/bson/bson-unknown-001.phpt
diff --git a/mongodb-1.2.3/tests/bson/bson-utcdatetime-001.phpt b/mongodb-1.2.8/tests/bson/bson-utcdatetime-001.phpt
similarity index 92%
rename from mongodb-1.2.3/tests/bson/bson-utcdatetime-001.phpt
rename to mongodb-1.2.8/tests/bson/bson-utcdatetime-001.phpt
index 1559a7c9..223629c7 100644
--- a/mongodb-1.2.3/tests/bson/bson-utcdatetime-001.phpt
+++ b/mongodb-1.2.8/tests/bson/bson-utcdatetime-001.phpt
@@ -1,49 +1,50 @@
--TEST--
MongoDB\BSON\UTCDateTime #001
--INI--
date.timezone=America/Los_Angeles
--SKIPIF--
-<?php require __DIR__ . "/../utils/basic-skipif.inc"; CLEANUP(STANDALONE) ?>
+<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
+<?php NEEDS('STANDALONE'); CLEANUP(STANDALONE); ?>
--FILE--
<?php
require_once __DIR__ . "/../utils/basic.inc";
$manager = new MongoDB\Driver\Manager(STANDALONE);
$utcdatetime = new MongoDB\BSON\UTCDateTime("1416445411987");
$bulk = new MongoDB\Driver\BulkWrite();
$bulk->insert(array('_id' => 1, 'x' => $utcdatetime));
$manager->executeBulkWrite(NS, $bulk);
$query = new MongoDB\Driver\Query(array('_id' => 1));
$cursor = $manager->executeQuery(NS, $query);
$results = iterator_to_array($cursor);
$tests = array(
array($utcdatetime),
array($results[0]->x),
);
foreach($tests as $n => $test) {
$s = fromPHP($test);
echo "Test#{$n} ", $json = toJSON($s), "\n";
$bson = fromJSON($json);
$testagain = toPHP($bson);
var_dump(toJSON(fromPHP($test)), toJSON(fromPHP($testagain)));
var_dump((object)$test == (object)$testagain);
}
?>
===DONE===
<?php exit(0); ?>
--EXPECT--
Test#0 { "0" : { "$date" : 1416445411987 } }
string(37) "{ "0" : { "$date" : 1416445411987 } }"
string(37) "{ "0" : { "$date" : 1416445411987 } }"
bool(true)
Test#1 { "0" : { "$date" : 1416445411987 } }
string(37) "{ "0" : { "$date" : 1416445411987 } }"
string(37) "{ "0" : { "$date" : 1416445411987 } }"
bool(true)
===DONE===
diff --git a/mongodb-1.2.3/tests/bson/bson-utcdatetime-002.phpt b/mongodb-1.2.8/tests/bson/bson-utcdatetime-002.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bson-utcdatetime-002.phpt
rename to mongodb-1.2.8/tests/bson/bson-utcdatetime-002.phpt
diff --git a/mongodb-1.2.3/tests/bson/bson-utcdatetime-003.phpt b/mongodb-1.2.8/tests/bson/bson-utcdatetime-003.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bson-utcdatetime-003.phpt
rename to mongodb-1.2.8/tests/bson/bson-utcdatetime-003.phpt
diff --git a/mongodb-1.2.3/tests/bson/bson-utcdatetime-004.phpt b/mongodb-1.2.8/tests/bson/bson-utcdatetime-004.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bson-utcdatetime-004.phpt
rename to mongodb-1.2.8/tests/bson/bson-utcdatetime-004.phpt
diff --git a/mongodb-1.2.3/tests/bson/bson-utcdatetime-005.phpt b/mongodb-1.2.8/tests/bson/bson-utcdatetime-005.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bson-utcdatetime-005.phpt
rename to mongodb-1.2.8/tests/bson/bson-utcdatetime-005.phpt
diff --git a/mongodb-1.2.3/tests/bson/bson-utcdatetime-006.phpt b/mongodb-1.2.8/tests/bson/bson-utcdatetime-006.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bson-utcdatetime-006.phpt
rename to mongodb-1.2.8/tests/bson/bson-utcdatetime-006.phpt
diff --git a/mongodb-1.2.3/tests/bson/bson-utcdatetime-007.phpt b/mongodb-1.2.8/tests/bson/bson-utcdatetime-007.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bson-utcdatetime-007.phpt
rename to mongodb-1.2.8/tests/bson/bson-utcdatetime-007.phpt
diff --git a/mongodb-1.2.3/tests/bson/bson-utcdatetime-compare-001.phpt b/mongodb-1.2.8/tests/bson/bson-utcdatetime-compare-001.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bson-utcdatetime-compare-001.phpt
rename to mongodb-1.2.8/tests/bson/bson-utcdatetime-compare-001.phpt
diff --git a/mongodb-1.2.3/tests/bson/bson-utcdatetime-int-size-001.phpt b/mongodb-1.2.8/tests/bson/bson-utcdatetime-int-size-001.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bson-utcdatetime-int-size-001.phpt
rename to mongodb-1.2.8/tests/bson/bson-utcdatetime-int-size-001.phpt
diff --git a/mongodb-1.2.3/tests/bson/bson-utcdatetime-int-size-002.phpt b/mongodb-1.2.8/tests/bson/bson-utcdatetime-int-size-002.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bson-utcdatetime-int-size-002.phpt
rename to mongodb-1.2.8/tests/bson/bson-utcdatetime-int-size-002.phpt
diff --git a/mongodb-1.2.3/tests/bson/bson-utcdatetime-jsonserialize-001.phpt b/mongodb-1.2.8/tests/bson/bson-utcdatetime-jsonserialize-001.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bson-utcdatetime-jsonserialize-001.phpt
rename to mongodb-1.2.8/tests/bson/bson-utcdatetime-jsonserialize-001.phpt
diff --git a/mongodb-1.2.3/tests/bson/bson-utcdatetime-jsonserialize-002.phpt b/mongodb-1.2.8/tests/bson/bson-utcdatetime-jsonserialize-002.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bson-utcdatetime-jsonserialize-002.phpt
rename to mongodb-1.2.8/tests/bson/bson-utcdatetime-jsonserialize-002.phpt
diff --git a/mongodb-1.2.3/tests/bson/bson-utcdatetime-serialization-001.phpt b/mongodb-1.2.8/tests/bson/bson-utcdatetime-serialization-001.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bson-utcdatetime-serialization-001.phpt
rename to mongodb-1.2.8/tests/bson/bson-utcdatetime-serialization-001.phpt
diff --git a/mongodb-1.2.3/tests/bson/bson-utcdatetime-serialization-002.phpt b/mongodb-1.2.8/tests/bson/bson-utcdatetime-serialization-002.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bson-utcdatetime-serialization-002.phpt
rename to mongodb-1.2.8/tests/bson/bson-utcdatetime-serialization-002.phpt
diff --git a/mongodb-1.2.3/tests/bson/bson-utcdatetime-serialization_error-001.phpt b/mongodb-1.2.8/tests/bson/bson-utcdatetime-serialization_error-001.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bson-utcdatetime-serialization_error-001.phpt
rename to mongodb-1.2.8/tests/bson/bson-utcdatetime-serialization_error-001.phpt
diff --git a/mongodb-1.2.3/tests/bson/bson-utcdatetime-serialization_error-002.phpt b/mongodb-1.2.8/tests/bson/bson-utcdatetime-serialization_error-002.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bson-utcdatetime-serialization_error-002.phpt
rename to mongodb-1.2.8/tests/bson/bson-utcdatetime-serialization_error-002.phpt
diff --git a/mongodb-1.2.3/tests/bson/bson-utcdatetime-set_state-001.phpt b/mongodb-1.2.8/tests/bson/bson-utcdatetime-set_state-001.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bson-utcdatetime-set_state-001.phpt
rename to mongodb-1.2.8/tests/bson/bson-utcdatetime-set_state-001.phpt
diff --git a/mongodb-1.2.3/tests/bson/bson-utcdatetime-set_state-002.phpt b/mongodb-1.2.8/tests/bson/bson-utcdatetime-set_state-002.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bson-utcdatetime-set_state-002.phpt
rename to mongodb-1.2.8/tests/bson/bson-utcdatetime-set_state-002.phpt
diff --git a/mongodb-1.2.3/tests/bson/bson-utcdatetime-set_state_error-001.phpt b/mongodb-1.2.8/tests/bson/bson-utcdatetime-set_state_error-001.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bson-utcdatetime-set_state_error-001.phpt
rename to mongodb-1.2.8/tests/bson/bson-utcdatetime-set_state_error-001.phpt
diff --git a/mongodb-1.2.3/tests/bson/bson-utcdatetime-set_state_error-002.phpt b/mongodb-1.2.8/tests/bson/bson-utcdatetime-set_state_error-002.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bson-utcdatetime-set_state_error-002.phpt
rename to mongodb-1.2.8/tests/bson/bson-utcdatetime-set_state_error-002.phpt
diff --git a/mongodb-1.2.3/tests/bson/bson-utcdatetime-todatetime-001.phpt b/mongodb-1.2.8/tests/bson/bson-utcdatetime-todatetime-001.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bson-utcdatetime-todatetime-001.phpt
rename to mongodb-1.2.8/tests/bson/bson-utcdatetime-todatetime-001.phpt
diff --git a/mongodb-1.2.3/tests/bson/bson-utcdatetime-todatetime-002.phpt b/mongodb-1.2.8/tests/bson/bson-utcdatetime-todatetime-002.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bson-utcdatetime-todatetime-002.phpt
rename to mongodb-1.2.8/tests/bson/bson-utcdatetime-todatetime-002.phpt
diff --git a/mongodb-1.2.3/tests/bson/bson-utcdatetime-tostring-001.phpt b/mongodb-1.2.8/tests/bson/bson-utcdatetime-tostring-001.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bson-utcdatetime-tostring-001.phpt
rename to mongodb-1.2.8/tests/bson/bson-utcdatetime-tostring-001.phpt
diff --git a/mongodb-1.2.3/tests/bson/bson-utcdatetime_error-001.phpt b/mongodb-1.2.8/tests/bson/bson-utcdatetime_error-001.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bson-utcdatetime_error-001.phpt
rename to mongodb-1.2.8/tests/bson/bson-utcdatetime_error-001.phpt
diff --git a/mongodb-1.2.3/tests/bson/bson-utcdatetime_error-002.phpt b/mongodb-1.2.8/tests/bson/bson-utcdatetime_error-002.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bson-utcdatetime_error-002.phpt
rename to mongodb-1.2.8/tests/bson/bson-utcdatetime_error-002.phpt
diff --git a/mongodb-1.2.3/tests/bson/bson-utcdatetime_error-003.phpt b/mongodb-1.2.8/tests/bson/bson-utcdatetime_error-003.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bson-utcdatetime_error-003.phpt
rename to mongodb-1.2.8/tests/bson/bson-utcdatetime_error-003.phpt
diff --git a/mongodb-1.2.3/tests/bson/bson-utcdatetime_error-004.phpt b/mongodb-1.2.8/tests/bson/bson-utcdatetime_error-004.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bson-utcdatetime_error-004.phpt
rename to mongodb-1.2.8/tests/bson/bson-utcdatetime_error-004.phpt
diff --git a/mongodb-1.2.3/tests/bson/bug0274.phpt b/mongodb-1.2.8/tests/bson/bug0274.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bug0274.phpt
rename to mongodb-1.2.8/tests/bson/bug0274.phpt
diff --git a/mongodb-1.2.3/tests/bson/bug0313.phpt b/mongodb-1.2.8/tests/bson/bug0313.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bug0313.phpt
rename to mongodb-1.2.8/tests/bson/bug0313.phpt
diff --git a/mongodb-1.2.3/tests/bson/bug0325.phpt b/mongodb-1.2.8/tests/bson/bug0325.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bug0325.phpt
rename to mongodb-1.2.8/tests/bson/bug0325.phpt
diff --git a/mongodb-1.2.3/tests/bson/bug0334-001.phpt b/mongodb-1.2.8/tests/bson/bug0334-001.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bug0334-001.phpt
rename to mongodb-1.2.8/tests/bson/bug0334-001.phpt
diff --git a/mongodb-1.2.3/tests/bson/bug0334-002.phpt b/mongodb-1.2.8/tests/bson/bug0334-002.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bug0334-002.phpt
rename to mongodb-1.2.8/tests/bson/bug0334-002.phpt
diff --git a/mongodb-1.2.3/tests/bson/bug0341.phpt b/mongodb-1.2.8/tests/bson/bug0341.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bug0341.phpt
rename to mongodb-1.2.8/tests/bson/bug0341.phpt
diff --git a/mongodb-1.2.3/tests/bson/bug0347.phpt b/mongodb-1.2.8/tests/bson/bug0347.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bug0347.phpt
rename to mongodb-1.2.8/tests/bson/bug0347.phpt
diff --git a/mongodb-1.2.3/tests/bson/bug0528.phpt b/mongodb-1.2.8/tests/bson/bug0528.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bug0528.phpt
rename to mongodb-1.2.8/tests/bson/bug0528.phpt
diff --git a/mongodb-1.2.3/tests/bson/bug0531.phpt b/mongodb-1.2.8/tests/bson/bug0531.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bug0531.phpt
rename to mongodb-1.2.8/tests/bson/bug0531.phpt
diff --git a/mongodb-1.2.3/tests/bson/bug0544.phpt b/mongodb-1.2.8/tests/bson/bug0544.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bug0544.phpt
rename to mongodb-1.2.8/tests/bson/bug0544.phpt
diff --git a/mongodb-1.2.3/tests/bson/bug0592.phpt b/mongodb-1.2.8/tests/bson/bug0592.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bug0592.phpt
rename to mongodb-1.2.8/tests/bson/bug0592.phpt
diff --git a/mongodb-1.2.3/tests/bson/bug0623.phpt b/mongodb-1.2.8/tests/bson/bug0623.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bug0623.phpt
rename to mongodb-1.2.8/tests/bson/bug0623.phpt
diff --git a/mongodb-1.2.3/tests/bson/bug0631.phpt b/mongodb-1.2.8/tests/bson/bug0631.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bug0631.phpt
rename to mongodb-1.2.8/tests/bson/bug0631.phpt
diff --git a/mongodb-1.2.3/tests/bson/bug0672.phpt b/mongodb-1.2.8/tests/bson/bug0672.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bson/bug0672.phpt
rename to mongodb-1.2.8/tests/bson/bug0672.phpt
diff --git a/mongodb-1.2.8/tests/bson/bug0894-001.phpt b/mongodb-1.2.8/tests/bson/bug0894-001.phpt
new file mode 100644
index 00000000..ae48d6b2
--- /dev/null
+++ b/mongodb-1.2.8/tests/bson/bug0894-001.phpt
@@ -0,0 +1,27 @@
+--TEST--
+PHPC-849: BSON get_properties handlers leak during gc_possible_root() checks
+--FILE--
+<?php
+
+$objects = [
+ new MongoDB\BSON\Binary('foo', MongoDB\BSON\Binary::TYPE_GENERIC),
+ new MongoDB\BSON\Decimal128('3.14'),
+ new MongoDB\BSON\Javascript('function foo() { return bar; }', ['bar' => 42]),
+ new MongoDB\BSON\MaxKey,
+ new MongoDB\BSON\MinKey,
+ new MongoDB\BSON\ObjectID,
+ new MongoDB\BSON\Regex('foo', 'i'),
+ new MongoDB\BSON\Timestamp(1234, 5678),
+ new MongoDB\BSON\UTCDateTime,
+];
+
+printf("Created array of %d BSON objects\n", count($objects));
+
+gc_collect_cycles();
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+Created array of 9 BSON objects
+===DONE===
diff --git a/mongodb-1.2.8/tests/bson/bug0923-001.phpt b/mongodb-1.2.8/tests/bson/bug0923-001.phpt
new file mode 100644
index 00000000..121ad368
--- /dev/null
+++ b/mongodb-1.2.8/tests/bson/bug0923-001.phpt
@@ -0,0 +1,34 @@
+--TEST--
+PHPC-923: Use zend_string_release() to free class names (type map)
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+/* Register an autoloader that does nothing more than append the class name to
+ * an array. This adds a reference to the zend_string in PHP 7, which exposes an
+ * assert failure if the value is then freed with zend_string_free() instead of
+ * zend_string_release(). */
+$classes = [];
+
+spl_autoload_register(function ($class) use (&$classes) {
+ $classes[] = $class;
+});
+
+echo throws(function() {
+ var_dump(toPHP(fromJSON('{"x":1}'), ['root' => 'MissingClass']));
+}, 'MongoDB\Driver\Exception\InvalidArgumentException'), "\n";
+
+var_dump($classes);
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+OK: Got MongoDB\Driver\Exception\InvalidArgumentException
+Class MissingClass does not exist
+array(1) {
+ [0]=>
+ string(12) "MissingClass"
+}
+===DONE===
diff --git a/mongodb-1.2.8/tests/bson/bug0923-002.phpt b/mongodb-1.2.8/tests/bson/bug0923-002.phpt
new file mode 100644
index 00000000..1d89df2c
--- /dev/null
+++ b/mongodb-1.2.8/tests/bson/bug0923-002.phpt
@@ -0,0 +1,44 @@
+--TEST--
+PHPC-923: Use zend_string_release() to free class names (__pclass)
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+/* Register an autoloader that does nothing more than append the class name to
+ * an array. This adds a reference to the zend_string in PHP 7, which exposes an
+ * assert failure if the value is then freed with zend_string_free() instead of
+ * zend_string_release(). */
+$classes = [];
+
+spl_autoload_register(function ($class) use (&$classes) {
+ $classes[] = $class;
+});
+
+/* Note: An exception is not thrown if the __pclass field fails to denote a
+ * valid class. Instead, it is left as-is and the general type map applies. */
+var_dump(toPHP(fromJSON('{"x":{"__pclass":{"$binary":"TWlzc2luZ0NsYXNz","$type":"80"}}}')));
+
+var_dump($classes);
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECTF--
+object(stdClass)#%d (%d) {
+ ["x"]=>
+ object(stdClass)#%d (%d) {
+ ["__pclass"]=>
+ object(MongoDB\BSON\Binary)#%d (%d) {
+ ["data"]=>
+ string(12) "MissingClass"
+ ["type"]=>
+ int(128)
+ }
+ }
+}
+array(1) {
+ [0]=>
+ string(12) "MissingClass"
+}
+===DONE===
diff --git a/mongodb-1.2.3/tests/bson/typemap-001.phpt b/mongodb-1.2.8/tests/bson/typemap-001.phpt
similarity index 97%
rename from mongodb-1.2.3/tests/bson/typemap-001.phpt
rename to mongodb-1.2.8/tests/bson/typemap-001.phpt
index 38a72e3f..5fbb5528 100644
--- a/mongodb-1.2.3/tests/bson/typemap-001.phpt
+++ b/mongodb-1.2.8/tests/bson/typemap-001.phpt
@@ -1,120 +1,121 @@
--TEST--
MongoDB\Driver\Cursor::setTypeMap(): Setting typemaps
--SKIPIF--
-<?php require __DIR__ . "/../utils/basic-skipif.inc"; CLEANUP(STANDALONE) ?>
+<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
+<?php NEEDS('STANDALONE'); CLEANUP(STANDALONE); ?>
--FILE--
<?php
require_once __DIR__ . "/../utils/basic.inc";
class MyArrayObject extends ArrayObject implements MongoDB\BSON\Unserializable
{
function bsonUnserialize(array $data)
{
parent::__construct($data);
}
}
$manager = new MongoDB\Driver\Manager(STANDALONE);
$bulk = new MongoDB\Driver\BulkWrite();
$bulk->insert(array('_id' => 1, 'bson_array' => array(1, 2, 3), 'bson_object' => array("string" => "keys", "for" => "ever")));
$bulk->insert(array('_id' => 2, 'bson_array' => array(4, 5, 6)));
$manager->executeBulkWrite(NS, $bulk);
function fetch($manager, $typemap = array()) {
$cursor = $manager->executeQuery(NS, new MongoDB\Driver\Query(array('bson_array' => 1)));
if ($typemap) {
$cursor->setTypeMap($typemap);
}
$documents = $cursor->toArray();
return $documents;
}
echo "Default\n";
$documents = fetch($manager);
var_dump($documents[0] instanceof stdClass);
var_dump(is_array($documents[0]->bson_array));
var_dump($documents[0]->bson_object instanceof stdClass);
echo "\nSetting to 'MyArrayObject' for arrays\n";
$documents = fetch($manager, array("array" => "MyArrayObject"));
var_dump($documents[0] instanceof stdClass);
var_dump($documents[0]->bson_array instanceof MyArrayObject);
var_dump($documents[0]->bson_object instanceof stdClass);
echo "\nSetting to 'MyArrayObject' for arrays, embedded, and root documents\n";
$documents = fetch($manager, array("array" => "MyArrayObject", "document" => "MyArrayObject", "root" => "MyArrayObject"));
var_dump($documents[0] instanceof MyArrayObject);
var_dump($documents[0]['bson_array'] instanceof MyArrayObject);
var_dump($documents[0]['bson_object'] instanceof MyArrayObject);
echo "\nSetting to 'array' for arrays, embedded, and root documents\n";
$documents = fetch($manager, array("array" => "array", "document" => "array", "root" => "array"));
var_dump(is_array($documents[0]));
var_dump(is_array($documents[0]['bson_array']));
var_dump(is_array($documents[0]['bson_object']));
echo "\nSetting to 'stdclass' for arrays and 'array' for embedded and root documents\n";
$documents = fetch($manager, array("array" => "stdclass", "document" => "array", "root" => "array"));
var_dump(is_array($documents[0]));
var_dump($documents[0]['bson_array'] instanceof stdClass);
var_dump(is_array($documents[0]['bson_object']));
echo "\nSetting to 'array' for arrays, 'stdclass' for embedded document, and 'MyArrayObject' for root document\n";
$documents = fetch($manager, array("array" => "array", "document" => "stdclass", "root" => "MyArrayObject"));
var_dump($documents[0] instanceof MyArrayObject);
var_dump(is_array($documents[0]['bson_array']));
var_dump($documents[0]['bson_object'] instanceof stdClass);
echo "\nSetting to 'stdclass' for arrays, embedded, and root documents\n";
$documents = fetch($manager, array("array" => "stdclass", "document" => "stdclass", "root" => "stdclass"));
var_dump($documents[0] instanceof stdClass);
var_dump($documents[0]->bson_array instanceof stdClass);
var_dump($documents[0]->bson_object instanceof stdClass);
?>
===DONE===
<?php exit(0); ?>
--EXPECT--
Default
bool(true)
bool(true)
bool(true)
Setting to 'MyArrayObject' for arrays
bool(true)
bool(true)
bool(true)
Setting to 'MyArrayObject' for arrays, embedded, and root documents
bool(true)
bool(true)
bool(true)
Setting to 'array' for arrays, embedded, and root documents
bool(true)
bool(true)
bool(true)
Setting to 'stdclass' for arrays and 'array' for embedded and root documents
bool(true)
bool(true)
bool(true)
Setting to 'array' for arrays, 'stdclass' for embedded document, and 'MyArrayObject' for root document
bool(true)
bool(true)
bool(true)
Setting to 'stdclass' for arrays, embedded, and root documents
bool(true)
bool(true)
bool(true)
===DONE===
diff --git a/mongodb-1.2.3/tests/bson/typemap-002.phpt b/mongodb-1.2.8/tests/bson/typemap-002.phpt
similarity index 95%
rename from mongodb-1.2.3/tests/bson/typemap-002.phpt
rename to mongodb-1.2.8/tests/bson/typemap-002.phpt
index ca5494be..ba047109 100644
--- a/mongodb-1.2.3/tests/bson/typemap-002.phpt
+++ b/mongodb-1.2.8/tests/bson/typemap-002.phpt
@@ -1,73 +1,74 @@
--TEST--
MongoDB\Driver\Cursor::setTypeMap(): Setting using type "object"
--SKIPIF--
-<?php require __DIR__ . "/../utils/basic-skipif.inc"; CLEANUP(STANDALONE) ?>
+<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
+<?php NEEDS('STANDALONE'); CLEANUP(STANDALONE); ?>
--FILE--
<?php
require_once __DIR__ . "/../utils/basic.inc";
class MyArrayObject extends ArrayObject implements MongoDB\BSON\Unserializable
{
function bsonUnserialize(array $data)
{
parent::__construct($data);
}
}
$manager = new MongoDB\Driver\Manager(STANDALONE);
$bulk = new MongoDB\Driver\BulkWrite();
$bulk->insert(array('_id' => 1, 'bson_array' => array(1, 2, 3), 'bson_object' => array("string" => "keys", "for" => "ever")));
$bulk->insert(array('_id' => 2, 'bson_array' => array(4, 5, 6)));
$manager->executeBulkWrite(NS, $bulk);
function fetch($manager, $typemap = array()) {
$cursor = $manager->executeQuery(NS, new MongoDB\Driver\Query(array('bson_array' => 1)));
if ($typemap) {
$cursor->setTypeMap($typemap);
}
$documents = $cursor->toArray();
return $documents;
}
echo "Setting to 'object' for arrays and 'array' for embedded and root documents\n";
$documents = fetch($manager, array("array" => "object", "document" => "array", "root" => "array"));
var_dump(is_array($documents[0]));
var_dump($documents[0]['bson_array'] instanceof stdClass);
var_dump(is_array($documents[0]['bson_object']));
echo "\nSetting to 'array' for arrays and 'object' for embedded and root documents\n";
$documents = fetch($manager, array("array" => "array", "document" => "object", "root" => "object"));
var_dump($documents[0] instanceof stdClass);
var_dump(is_array($documents[0]->bson_array));
var_dump($documents[0]->bson_object instanceof stdClass);
echo "\nSetting to 'object' for arrays, embedded, and root documents\n";
$documents = fetch($manager, array("array" => "object", "document" => "object", "root" => "object"));
var_dump($documents[0] instanceof stdClass);
var_dump($documents[0]->bson_array instanceof stdClass);
var_dump($documents[0]->bson_object instanceof stdClass);
?>
===DONE===
<?php exit(0); ?>
--EXPECT--
Setting to 'object' for arrays and 'array' for embedded and root documents
bool(true)
bool(true)
bool(true)
Setting to 'array' for arrays and 'object' for embedded and root documents
bool(true)
bool(true)
bool(true)
Setting to 'object' for arrays, embedded, and root documents
bool(true)
bool(true)
bool(true)
===DONE===
diff --git a/mongodb-1.2.3/tests/bulk/bug0667.phpt b/mongodb-1.2.8/tests/bulk/bug0667.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bulk/bug0667.phpt
rename to mongodb-1.2.8/tests/bulk/bug0667.phpt
diff --git a/mongodb-1.2.3/tests/bulk/bulkwrite-count-001.phpt b/mongodb-1.2.8/tests/bulk/bulkwrite-count-001.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bulk/bulkwrite-count-001.phpt
rename to mongodb-1.2.8/tests/bulk/bulkwrite-count-001.phpt
diff --git a/mongodb-1.2.3/tests/bulk/bulkwrite-countable-001.phpt b/mongodb-1.2.8/tests/bulk/bulkwrite-countable-001.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bulk/bulkwrite-countable-001.phpt
rename to mongodb-1.2.8/tests/bulk/bulkwrite-countable-001.phpt
diff --git a/mongodb-1.2.3/tests/bulk/bulkwrite-debug-001.phpt b/mongodb-1.2.8/tests/bulk/bulkwrite-debug-001.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bulk/bulkwrite-debug-001.phpt
rename to mongodb-1.2.8/tests/bulk/bulkwrite-debug-001.phpt
diff --git a/mongodb-1.2.3/tests/bulk/bulkwrite-delete-001.phpt b/mongodb-1.2.8/tests/bulk/bulkwrite-delete-001.phpt
similarity index 94%
rename from mongodb-1.2.3/tests/bulk/bulkwrite-delete-001.phpt
rename to mongodb-1.2.8/tests/bulk/bulkwrite-delete-001.phpt
index 48321249..8eb726b0 100644
--- a/mongodb-1.2.3/tests/bulk/bulkwrite-delete-001.phpt
+++ b/mongodb-1.2.8/tests/bulk/bulkwrite-delete-001.phpt
@@ -1,82 +1,83 @@
--TEST--
MongoDB\Driver\BulkWrite::delete() should always encode __pclass for Persistable objects
--SKIPIF--
-<?php require __DIR__ . "/../utils/basic-skipif.inc"; CLEANUP(STANDALONE); ?>
+<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
+<?php NEEDS('STANDALONE'); CLEANUP(STANDALONE); ?>
--FILE--
<?php
require_once __DIR__ . "/../utils/basic.inc";
class MyClass implements MongoDB\BSON\Persistable
{
private $id;
private $child;
public function __construct($id, MyClass $child = null)
{
$this->id = $id;
$this->child = $child;
}
public function bsonSerialize()
{
return [
'_id' => $this->id,
'child' => $this->child,
];
}
public function bsonUnserialize(array $data)
{
$this->id = $data['_id'];
$this->child = $data['child'];
}
}
$manager = new MongoDB\Driver\Manager(STANDALONE);
$document = new MyClass('foo', new MyClass('bar', new MyClass('baz')));
$bulk = new MongoDB\Driver\BulkWrite();
$bulk->insert($document);
$result = $manager->executeBulkWrite(NS, $bulk);
printf("Inserted %d document(s)\n", $result->getInsertedCount());
$cursor = $manager->executeQuery(NS, new MongoDB\Driver\Query([]));
var_dump($cursor->toArray());
$bulk = new MongoDB\Driver\BulkWrite();
$bulk->delete($document);
$result = $manager->executeBulkWrite(NS, $bulk);
printf("Deleted %d document(s)\n", $result->getDeletedCount());
$cursor = $manager->executeQuery(NS, new MongoDB\Driver\Query([]));
var_dump($cursor->toArray());
?>
===DONE===
<?php exit(0); ?>
--EXPECTF--
Inserted 1 document(s)
array(1) {
[0]=>
object(MyClass)#%d (%d) {
["id":"MyClass":private]=>
string(3) "foo"
["child":"MyClass":private]=>
object(MyClass)#%d (%d) {
["id":"MyClass":private]=>
string(3) "bar"
["child":"MyClass":private]=>
object(MyClass)#%d (%d) {
["id":"MyClass":private]=>
string(3) "baz"
["child":"MyClass":private]=>
NULL
}
}
}
}
Deleted 1 document(s)
array(0) {
}
===DONE===
diff --git a/mongodb-1.2.3/tests/bulk/bulkwrite-delete_error-001.phpt b/mongodb-1.2.8/tests/bulk/bulkwrite-delete_error-001.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bulk/bulkwrite-delete_error-001.phpt
rename to mongodb-1.2.8/tests/bulk/bulkwrite-delete_error-001.phpt
diff --git a/mongodb-1.2.3/tests/bulk/bulkwrite-insert-001.phpt b/mongodb-1.2.8/tests/bulk/bulkwrite-insert-001.phpt
similarity index 93%
rename from mongodb-1.2.3/tests/bulk/bulkwrite-insert-001.phpt
rename to mongodb-1.2.8/tests/bulk/bulkwrite-insert-001.phpt
index d08792d2..7ceaa36b 100644
--- a/mongodb-1.2.3/tests/bulk/bulkwrite-insert-001.phpt
+++ b/mongodb-1.2.8/tests/bulk/bulkwrite-insert-001.phpt
@@ -1,69 +1,70 @@
--TEST--
MongoDB\Driver\BulkWrite::insert() should always encode __pclass for Persistable objects
--SKIPIF--
-<?php require __DIR__ . "/../utils/basic-skipif.inc"; CLEANUP(STANDALONE); ?>
+<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
+<?php NEEDS('STANDALONE'); CLEANUP(STANDALONE); ?>
--FILE--
<?php
require_once __DIR__ . "/../utils/basic.inc";
class MyClass implements MongoDB\BSON\Persistable
{
private $id;
private $child;
public function __construct($id, MyClass $child = null)
{
$this->id = $id;
$this->child = $child;
}
public function bsonSerialize()
{
return [
'_id' => $this->id,
'child' => $this->child,
];
}
public function bsonUnserialize(array $data)
{
$this->id = $data['_id'];
$this->child = $data['child'];
}
}
$manager = new MongoDB\Driver\Manager(STANDALONE);
$bulk = new MongoDB\Driver\BulkWrite();
$bulk->insert(new MyClass('foo', new MyClass('bar', new MyClass('baz'))));
$result = $manager->executeBulkWrite(NS, $bulk);
printf("Inserted %d document(s)\n", $result->getInsertedCount());
$cursor = $manager->executeQuery(NS, new MongoDB\Driver\Query([]));
var_dump($cursor->toArray());
?>
===DONE===
<?php exit(0); ?>
--EXPECTF--
Inserted 1 document(s)
array(1) {
[0]=>
object(MyClass)#%d (%d) {
["id":"MyClass":private]=>
string(3) "foo"
["child":"MyClass":private]=>
object(MyClass)#%d (%d) {
["id":"MyClass":private]=>
string(3) "bar"
["child":"MyClass":private]=>
object(MyClass)#%d (%d) {
["id":"MyClass":private]=>
string(3) "baz"
["child":"MyClass":private]=>
NULL
}
}
}
}
===DONE===
diff --git a/mongodb-1.2.3/tests/bulk/bulkwrite-update-001.phpt b/mongodb-1.2.8/tests/bulk/bulkwrite-update-001.phpt
similarity index 95%
rename from mongodb-1.2.3/tests/bulk/bulkwrite-update-001.phpt
rename to mongodb-1.2.8/tests/bulk/bulkwrite-update-001.phpt
index 674abbd3..009cfeab 100644
--- a/mongodb-1.2.3/tests/bulk/bulkwrite-update-001.phpt
+++ b/mongodb-1.2.8/tests/bulk/bulkwrite-update-001.phpt
@@ -1,106 +1,107 @@
--TEST--
MongoDB\Driver\BulkWrite::update() should always encode __pclass for Persistable objects
--SKIPIF--
-<?php require __DIR__ . "/../utils/basic-skipif.inc"; CLEANUP(STANDALONE); ?>
+<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
+<?php NEEDS('STANDALONE'); CLEANUP(STANDALONE); ?>
--FILE--
<?php
require_once __DIR__ . "/../utils/basic.inc";
class MyClass implements MongoDB\BSON\Persistable
{
private $id;
private $child;
public function __construct($id, MyClass $child = null)
{
$this->id = $id;
$this->child = $child;
}
public function bsonSerialize()
{
return [
'_id' => $this->id,
'child' => $this->child,
];
}
public function bsonUnserialize(array $data)
{
$this->id = $data['_id'];
$this->child = $data['child'];
}
}
$manager = new MongoDB\Driver\Manager(STANDALONE);
$document = new MyClass('foo', new MyClass('bar', new MyClass('baz')));
$bulk = new MongoDB\Driver\BulkWrite();
$bulk->update(
['_id' => 'foo'],
$document,
['upsert' => true]
);
$result = $manager->executeBulkWrite(NS, $bulk);
printf("Upserted %d document(s)\n", $result->getUpsertedCount());
$cursor = $manager->executeQuery(NS, new MongoDB\Driver\Query([]));
var_dump($cursor->toArray());
$bulk = new MongoDB\Driver\BulkWrite();
$bulk->update(
$document,
['$set' => ['child' => new MyClass('yip', new MyClass('yap'))]]
);
$result = $manager->executeBulkWrite(NS, $bulk);
printf("Modified %d document(s)\n", $result->getModifiedCount());
$cursor = $manager->executeQuery(NS, new MongoDB\Driver\Query([]));
var_dump($cursor->toArray());
?>
===DONE===
<?php exit(0); ?>
--EXPECTF--
Upserted 1 document(s)
array(1) {
[0]=>
object(MyClass)#%d (%d) {
["id":"MyClass":private]=>
string(3) "foo"
["child":"MyClass":private]=>
object(MyClass)#%d (%d) {
["id":"MyClass":private]=>
string(3) "bar"
["child":"MyClass":private]=>
object(MyClass)#%d (%d) {
["id":"MyClass":private]=>
string(3) "baz"
["child":"MyClass":private]=>
NULL
}
}
}
}
Modified 1 document(s)
array(1) {
[0]=>
object(MyClass)#%d (%d) {
["id":"MyClass":private]=>
string(3) "foo"
["child":"MyClass":private]=>
object(MyClass)#%d (%d) {
["id":"MyClass":private]=>
string(3) "yip"
["child":"MyClass":private]=>
object(MyClass)#%d (%d) {
["id":"MyClass":private]=>
string(3) "yap"
["child":"MyClass":private]=>
NULL
}
}
}
}
===DONE===
diff --git a/mongodb-1.2.3/tests/bulk/bulkwrite-update_error-001.phpt b/mongodb-1.2.8/tests/bulk/bulkwrite-update_error-001.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bulk/bulkwrite-update_error-001.phpt
rename to mongodb-1.2.8/tests/bulk/bulkwrite-update_error-001.phpt
diff --git a/mongodb-1.2.3/tests/bulk/bulkwrite_error-001.phpt b/mongodb-1.2.8/tests/bulk/bulkwrite_error-001.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/bulk/bulkwrite_error-001.phpt
rename to mongodb-1.2.8/tests/bulk/bulkwrite_error-001.phpt
diff --git a/mongodb-1.2.3/tests/bulk/bulkwrite_error-002.phpt b/mongodb-1.2.8/tests/bulk/bulkwrite_error-002.phpt
similarity index 87%
rename from mongodb-1.2.3/tests/bulk/bulkwrite_error-002.phpt
rename to mongodb-1.2.8/tests/bulk/bulkwrite_error-002.phpt
index bbef30f1..f6ec299e 100644
--- a/mongodb-1.2.3/tests/bulk/bulkwrite_error-002.phpt
+++ b/mongodb-1.2.8/tests/bulk/bulkwrite_error-002.phpt
@@ -1,27 +1,28 @@
--TEST--
MongoDB\Driver\BulkWrite cannot be executed multiple times
--SKIPIF--
-<?php require __DIR__ . "/../utils/basic-skipif.inc"; CLEANUP(STANDALONE); ?>
+<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
+<?php NEEDS('STANDALONE'); CLEANUP(STANDALONE); ?>
--FILE--
<?php
require_once __DIR__ . "/../utils/basic.inc";
$manager = new MongoDB\Driver\Manager(STANDALONE);
$bulk = new MongoDB\Driver\BulkWrite;
$bulk->insert(['x' => 1]);
$result = $manager->executeBulkWrite(NS, $bulk);
printf("Inserted %d document(s)\n", $result->getInsertedCount());
echo throws(function() use ($manager, $bulk) {
$result = $manager->executeBulkWrite(NS, $bulk);
}, 'MongoDB\Driver\Exception\BulkWriteException'), "\n";
?>
===DONE===
<?php exit(0); ?>
--EXPECTF--
Inserted 1 document(s)
OK: Got MongoDB\Driver\Exception\BulkWriteException
BulkWrite objects may only be executed once and this instance has already been executed
===DONE===
diff --git a/mongodb-1.2.3/tests/bulk/write-0001.phpt b/mongodb-1.2.8/tests/bulk/write-0001.phpt
similarity index 95%
rename from mongodb-1.2.3/tests/bulk/write-0001.phpt
rename to mongodb-1.2.8/tests/bulk/write-0001.phpt
index 9bc3dfd6..dadbfc3d 100644
--- a/mongodb-1.2.3/tests/bulk/write-0001.phpt
+++ b/mongodb-1.2.8/tests/bulk/write-0001.phpt
@@ -1,125 +1,126 @@
--TEST--
MongoDB\Driver\BulkWrite: #001 Variety Bulk
--SKIPIF--
-<?php require __DIR__ . "/../utils/basic-skipif.inc"; CLEANUP(STANDALONE); ?>
+<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
+<?php NEEDS('STANDALONE'); CLEANUP(STANDALONE); ?>
--FILE--
<?php
require_once __DIR__ . "/../utils/basic.inc";
$manager = new MongoDB\Driver\Manager(STANDALONE);
$bulk = new MongoDB\Driver\BulkWrite;
var_dump($bulk);
$bulk->insert(array("my" => "value"));
$bulk->insert(array("my" => "value", "foo" => "bar"));
$bulk->insert(array("my" => "value", "foo" => "bar"));
var_dump($bulk);
$bulk->delete(array("my" => "value", "foo" => "bar"), array("limit" => 1));
var_dump($bulk);
$bulk->update(array("foo" => "bar"), array('$set' => array("foo" => "baz")), array("limit" => 1, "upsert" => 0));
var_dump($bulk);
$retval = $manager->executeBulkWrite(NS, $bulk);
var_dump($bulk);
printf("Inserted: %d\n", getInsertCount($retval));
printf("Deleted: %d\n", getDeletedCount($retval));
printf("Updated: %d\n", getModifiedCount($retval));
printf("Upserted: %d\n", getUpsertedCount($retval));
foreach(getWriteErrors($retval) as $error) {
printf("WriteErrors: %", $error);
}
?>
===DONE===
<?php exit(0); ?>
--EXPECTF--
object(MongoDB\Driver\BulkWrite)#%d (%d) {
["database"]=>
NULL
["collection"]=>
NULL
["ordered"]=>
bool(true)
["bypassDocumentValidation"]=>
NULL
["executed"]=>
bool(false)
["server_id"]=>
int(0)
["write_concern"]=>
NULL
}
object(MongoDB\Driver\BulkWrite)#%d (%d) {
["database"]=>
NULL
["collection"]=>
NULL
["ordered"]=>
bool(true)
["bypassDocumentValidation"]=>
NULL
["executed"]=>
bool(false)
["server_id"]=>
int(0)
["write_concern"]=>
NULL
}
object(MongoDB\Driver\BulkWrite)#%d (%d) {
["database"]=>
NULL
["collection"]=>
NULL
["ordered"]=>
bool(true)
["bypassDocumentValidation"]=>
NULL
["executed"]=>
bool(false)
["server_id"]=>
int(0)
["write_concern"]=>
NULL
}
object(MongoDB\Driver\BulkWrite)#%d (%d) {
["database"]=>
NULL
["collection"]=>
NULL
["ordered"]=>
bool(true)
["bypassDocumentValidation"]=>
NULL
["executed"]=>
bool(false)
["server_id"]=>
int(0)
["write_concern"]=>
NULL
}
object(MongoDB\Driver\BulkWrite)#%d (%d) {
["database"]=>
string(6) "phongo"
["collection"]=>
string(15) "bulk_write_0001"
["ordered"]=>
bool(true)
["bypassDocumentValidation"]=>
NULL
["executed"]=>
bool(true)
["server_id"]=>
int(1)
["write_concern"]=>
NULL
}
Inserted: 3
Deleted: 1
Updated: 1
Upserted: 0
===DONE===
diff --git a/mongodb-1.2.3/tests/bulk/write-0002.phpt b/mongodb-1.2.8/tests/bulk/write-0002.phpt
similarity index 93%
rename from mongodb-1.2.3/tests/bulk/write-0002.phpt
rename to mongodb-1.2.8/tests/bulk/write-0002.phpt
index ddef45fc..0dc9fa36 100644
--- a/mongodb-1.2.3/tests/bulk/write-0002.phpt
+++ b/mongodb-1.2.8/tests/bulk/write-0002.phpt
@@ -1,77 +1,78 @@
--TEST--
MongoDB\Driver\BulkWrite: #002 Get the generated ID
--SKIPIF--
-<?php require __DIR__ . "/../utils/basic-skipif.inc"; CLEANUP(STANDALONE); ?>
+<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
+<?php NEEDS('STANDALONE'); CLEANUP(STANDALONE); ?>
--FILE--
<?php
require_once __DIR__ . "/../utils/basic.inc";
$manager = new MongoDB\Driver\Manager(STANDALONE);
$hannes = array("name" => "Hannes", "country" => "USA", "gender" => "male");
$hayley = array("name" => "Bayley", "country" => "USA", "gender" => "female");
$insertBulk = new \MongoDB\Driver\BulkWrite(['ordered' => true]);
$hannes_id = $insertBulk->insert($hannes);
$hayley_id = $insertBulk->insert($hayley);
$w = 1;
$wtimeout = 1000;
$writeConcern = new \MongoDB\Driver\WriteConcern($w, $wtimeout);
var_dump($insertBulk);
$result = $manager->executeBulkWrite(NS, $insertBulk, $writeConcern);
var_dump($insertBulk);
assert($result instanceof \MongoDB\Driver\WriteResult);
printf(
"Inserted %d documents to %s\n",
$result->getInsertedCount(),
$result->getServer()->getHost()
);
printf("hannes: %s\nhayley: %s\n", $hannes_id, $hayley_id);
?>
===DONE===
<?php exit(0); ?>
--EXPECTF--
object(MongoDB\Driver\BulkWrite)#%d (%d) {
["database"]=>
NULL
["collection"]=>
NULL
["ordered"]=>
bool(true)
["bypassDocumentValidation"]=>
NULL
["executed"]=>
bool(false)
["server_id"]=>
int(0)
["write_concern"]=>
NULL
}
object(MongoDB\Driver\BulkWrite)#%d (%d) {
["database"]=>
string(6) "phongo"
["collection"]=>
string(15) "bulk_write_0002"
["ordered"]=>
bool(true)
["bypassDocumentValidation"]=>
NULL
["executed"]=>
bool(true)
["server_id"]=>
int(1)
["write_concern"]=>
array(%d) {
["w"]=>
int(1)
["wtimeout"]=>
int(1000)
}
}
Inserted 2 documents to %s
hannes: %s
hayley: %s
===DONE===
diff --git a/mongodb-1.2.3/tests/connect/bug0720.phpt b/mongodb-1.2.8/tests/connect/bug0720.phpt
similarity index 91%
rename from mongodb-1.2.3/tests/connect/bug0720.phpt
rename to mongodb-1.2.8/tests/connect/bug0720.phpt
index 550d3529..d31bbeda 100644
--- a/mongodb-1.2.3/tests/connect/bug0720.phpt
+++ b/mongodb-1.2.8/tests/connect/bug0720.phpt
@@ -1,39 +1,40 @@
--TEST--
PHPC-720: Do not persist SSL streams to avoid SSL reinitialization errors
--SKIPIF--
-<?php require __DIR__ . "/../utils/basic-skipif.inc"; NEEDS("STANDALONE_SSL"); ?>
+<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
+<?php NEEDS('STANDALONE_SSL'); ?>
--FILE--
<?php
require_once __DIR__ . "/../utils/basic.inc";
$SSL_DIR = realpath(__DIR__ . '/../../scripts/ssl/');
$driverOptions = [
// libmongoc does not allow the hostname to be overridden as "server"
'allow_invalid_hostname' => true,
'ca_file' => $SSL_DIR . '/ca.pem',
];
$manager = new MongoDB\Driver\Manager(STANDALONE_SSL, ['ssl' => true], $driverOptions);
$cursor = $manager->executeCommand(DATABASE_NAME, new MongoDB\Driver\Command(['ping' => 1]));
var_dump($cursor->toArray()[0]);
unset($manager, $cursor);
$manager = new MongoDB\Driver\Manager(STANDALONE_SSL, ['ssl' => true], $driverOptions);
$cursor = $manager->executeCommand(DATABASE_NAME, new MongoDB\Driver\Command(['ping' => 1]));
var_dump($cursor->toArray()[0]);
?>
===DONE===
<?php exit(0); ?>
--EXPECTF--
object(stdClass)#%d (%d) {
["ok"]=>
float(1)
}
object(stdClass)#%d (%d) {
["ok"]=>
float(1)
}
===DONE===
diff --git a/mongodb-1.2.3/tests/connect/replicaset-seedlist-001.phpt b/mongodb-1.2.8/tests/connect/replicaset-seedlist-001.phpt
similarity index 82%
rename from mongodb-1.2.3/tests/connect/replicaset-seedlist-001.phpt
rename to mongodb-1.2.8/tests/connect/replicaset-seedlist-001.phpt
index a08e7817..ba74acd9 100644
--- a/mongodb-1.2.3/tests/connect/replicaset-seedlist-001.phpt
+++ b/mongodb-1.2.8/tests/connect/replicaset-seedlist-001.phpt
@@ -1,24 +1,24 @@
--TEST--
MongoDB\Driver\Manager: Connecting to Replica Set with only secondary in seedlist
--SKIPIF--
-<?php require __DIR__ . "/../utils/basic-skipif.inc"; NEEDS("REPLICASET"); ?>
-<?php CLEANUP(REPLICASET); PREDICTABLE(); ?>
+<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
+<?php NEEDS('REPLICASET'); CLEANUP(REPLICASET); PREDICTABLE(); ?>
--FILE--
<?php
require_once __DIR__ . "/../utils/basic.inc";
$dsn = "mongodb://192.168.112.10:3001/?replicaSet=REPLICASET";
$manager = new MongoDB\Driver\Manager($dsn);
// load fixtures for test
$bulk = new \MongoDB\Driver\BulkWrite();
$bulk->insert(array("_id" => 1, "x" => 2, "y" => 3));
$bulk->insert(array("_id" => 2, "x" => 3, "y" => 4));
$bulk->insert(array("_id" => 3, "x" => 4, "y" => 5));
$manager->executeBulkWrite(NS, $bulk);
?>
===DONE===
<?php exit(0); ?>
--EXPECT--
===DONE===
diff --git a/mongodb-1.2.3/tests/connect/replicaset-seedlist-002.phpt b/mongodb-1.2.8/tests/connect/replicaset-seedlist-002.phpt
similarity index 82%
rename from mongodb-1.2.3/tests/connect/replicaset-seedlist-002.phpt
rename to mongodb-1.2.8/tests/connect/replicaset-seedlist-002.phpt
index f3a89952..c17ade7a 100644
--- a/mongodb-1.2.3/tests/connect/replicaset-seedlist-002.phpt
+++ b/mongodb-1.2.8/tests/connect/replicaset-seedlist-002.phpt
@@ -1,24 +1,24 @@
--TEST--
MongoDB\Driver\Manager: Connecting to Replica Set with only arbiter in seedlist
--SKIPIF--
-<?php require __DIR__ . "/../utils/basic-skipif.inc"; NEEDS("REPLICASET"); ?>
-<?php CLEANUP(REPLICASET); PREDICTABLE(); ?>
+<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
+<?php NEEDS('REPLICASET'); CLEANUP(REPLICASET); PREDICTABLE(); ?>
--FILE--
<?php
require_once __DIR__ . "/../utils/basic.inc";
$dsn = "mongodb://192.168.112.10:3002/?replicaSet=REPLICASET";
$manager = new MongoDB\Driver\Manager($dsn);
// load fixtures for test
$bulk = new \MongoDB\Driver\BulkWrite();
$bulk->insert(array("_id" => 1, "x" => 2, "y" => 3));
$bulk->insert(array("_id" => 2, "x" => 3, "y" => 4));
$bulk->insert(array("_id" => 3, "x" => 4, "y" => 5));
$manager->executeBulkWrite(NS, $bulk);
?>
===DONE===
<?php exit(0); ?>
--EXPECT--
===DONE===
diff --git a/mongodb-1.2.3/tests/connect/standalone-auth-0001.phpt b/mongodb-1.2.8/tests/connect/standalone-auth-0001.phpt
similarity index 89%
rename from mongodb-1.2.3/tests/connect/standalone-auth-0001.phpt
rename to mongodb-1.2.8/tests/connect/standalone-auth-0001.phpt
index aff6953d..2e46db51 100644
--- a/mongodb-1.2.3/tests/connect/standalone-auth-0001.phpt
+++ b/mongodb-1.2.8/tests/connect/standalone-auth-0001.phpt
@@ -1,39 +1,39 @@
--TEST--
Connect to MongoDB with using default auth mechanism
--SKIPIF--
-<?php require __DIR__ . "/../utils/basic-skipif.inc"; NEEDS("STANDALONE_AUTH"); ?>
-<?php CLEANUP(STANDALONE_AUTH) ?>
+<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
+<?php NEEDS('STANDALONE_AUTH'); CLEANUP(STANDALONE_AUTH); ?>
--FILE--
<?php
require_once __DIR__ . "/../utils/basic.inc";
$manager = new MongoDB\Driver\Manager(STANDALONE_AUTH);
$bulk = new MongoDB\Driver\BulkWrite;
$bulk->insert(array("my" => "value"));
$bulk->insert(array("my" => "value", "foo" => "bar"));
$bulk->insert(array("my" => "value", "foo" => "bar"));
$bulk->delete(array("my" => "value", "foo" => "bar"), array("limit" => 1));
$bulk->update(array("foo" => "bar"), array('$set' => array("foo" => "baz")), array("limit" => 1, "upsert" => 0));
$retval = $manager->executeBulkWrite(NS, $bulk);
printf("Inserted: %d\n", getInsertCount($retval));
printf("Deleted: %d\n", getDeletedCount($retval));
printf("Updated: %d\n", getModifiedCount($retval));
printf("Upserted: %d\n", getUpsertedCount($retval));
foreach(getWriteErrors($retval) as $error) {
printf("WriteErrors: %", $error);
}
?>
===DONE===
<?php exit(0); ?>
--EXPECT--
Inserted: 3
Deleted: 1
Updated: 1
Upserted: 0
===DONE===
diff --git a/mongodb-1.2.3/tests/connect/standalone-auth-0002.phpt b/mongodb-1.2.8/tests/connect/standalone-auth-0002.phpt
similarity index 86%
rename from mongodb-1.2.3/tests/connect/standalone-auth-0002.phpt
rename to mongodb-1.2.8/tests/connect/standalone-auth-0002.phpt
index 1bedafb8..75e6b7a9 100644
--- a/mongodb-1.2.3/tests/connect/standalone-auth-0002.phpt
+++ b/mongodb-1.2.8/tests/connect/standalone-auth-0002.phpt
@@ -1,30 +1,30 @@
--TEST--
Connect to MongoDB with using default auth mechanism #002
--SKIPIF--
-<?php require __DIR__ . "/../utils/basic-skipif.inc"; NEEDS("STANDALONE_AUTH"); ?>
-<?php CLEANUP(STANDALONE_AUTH) ?>
+<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
+<?php NEEDS('STANDALONE_AUTH'); CLEANUP(STANDALONE_AUTH); ?>
--FILE--
<?php
require_once __DIR__ . "/../utils/basic.inc";
$username = "root";
$password = "tooring";
$database = "admin";
$parsed = parse_url(STANDALONE_AUTH);
$dsn = sprintf("mongodb://%s:%s@%s:%d/%s", $username, $password, $parsed["host"], $parsed["port"], $database);
$manager = new MongoDB\Driver\Manager($dsn);
$bulk = new MongoDB\Driver\BulkWrite;
$bulk->insert(array("my" => "value"));
throws(function() use($manager, $bulk) {
$retval = $manager->executeBulkWrite(NS, $bulk);
}, "MongoDB\Driver\Exception\AuthenticationException");
?>
===DONE===
<?php exit(0); ?>
--EXPECT--
OK: Got MongoDB\Driver\Exception\AuthenticationException
===DONE===
diff --git a/mongodb-1.2.3/tests/connect/standalone-plain-0001.phpt b/mongodb-1.2.8/tests/connect/standalone-plain-0001.phpt
similarity index 93%
rename from mongodb-1.2.3/tests/connect/standalone-plain-0001.phpt
rename to mongodb-1.2.8/tests/connect/standalone-plain-0001.phpt
index 41339659..30e1698b 100644
--- a/mongodb-1.2.3/tests/connect/standalone-plain-0001.phpt
+++ b/mongodb-1.2.8/tests/connect/standalone-plain-0001.phpt
@@ -1,70 +1,70 @@
--TEST--
Connect to MongoDB with using PLAIN auth mechanism
--SKIPIF--
-<?php require __DIR__ . "/../utils/basic-skipif.inc"; NEEDS("STANDALONE_PLAIN"); ?>
-<?php CLEANUP(STANDALONE_PLAIN) ?>
+<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
+<?php NEEDS('STANDALONE_PLAIN'); CLEANUP(STANDALONE_PLAIN); ?>
--FILE--
<?php
require_once __DIR__ . "/../utils/basic.inc";
$username = "root";
$password = "toor";
$database = "admin";
$parsed = parse_url(STANDALONE_PLAIN);
$dsn = sprintf("mongodb://%s:%s@%s:%d/%s", $username, $password, $parsed["host"], $parsed["port"], $database);
$adminmanager = new MongoDB\Driver\Manager($dsn);
$cmd = array(
"createUser" => "bugs",
"roles" => array(array("role" => "readWrite", "db" => DATABASE_NAME)),
);
$command = new MongoDB\Driver\Command($cmd);
try {
$result = $adminmanager->executeCommand('$external', $command);
echo "User Created\n";
} catch(Exception $e) {
echo $e->getMessage(), "\n";
}
$username = "bugs";
$password = "password";
$database = '$external';
$dsn = sprintf("mongodb://%s:%s@%s:%d/%s?authMechanism=PLAIN", $username, $password, $parsed["host"], $parsed["port"], $database);
$manager = new MongoDB\Driver\Manager($dsn);
$bulk = new MongoDB\Driver\BulkWrite();
$bulk->insert(array("very" => "important"));
try {
$manager->executeBulkWrite(NS, $bulk);
$query = new MongoDB\Driver\Query(array("very" => "important"));
$cursor = $manager->executeQuery(NS, $query);
foreach($cursor as $document) {
var_dump($document->very);
}
$cmd = new MongoDB\Driver\Command(array("drop" => COLLECTION_NAME));
$result = $manager->executeCommand(DATABASE_NAME, $cmd);
} catch(Exception $e) {
printf("Caught %s: %s\n", get_class($e), $e->getMessage());
}
$cmd = array(
"dropUser" => "bugs",
);
$command = new MongoDB\Driver\Command($cmd);
try {
$result = $adminmanager->executeCommand('$external', $command);
echo "User deleted\n";
} catch(Exception $e) {
echo $e->getMessage(), "\n";
}
?>
===DONE===
<?php exit(0); ?>
--EXPECT--
User Created
string(9) "important"
User deleted
===DONE===
diff --git a/mongodb-1.2.3/tests/connect/standalone-plain-0002.phpt b/mongodb-1.2.8/tests/connect/standalone-plain-0002.phpt
similarity index 94%
rename from mongodb-1.2.3/tests/connect/standalone-plain-0002.phpt
rename to mongodb-1.2.8/tests/connect/standalone-plain-0002.phpt
index 1a505b94..77a047d8 100644
--- a/mongodb-1.2.3/tests/connect/standalone-plain-0002.phpt
+++ b/mongodb-1.2.8/tests/connect/standalone-plain-0002.phpt
@@ -1,61 +1,62 @@
--TEST--
Connect to MongoDB with using PLAIN auth mechanism #002
--SKIPIF--
-<?php require __DIR__ . "/../utils/basic-skipif.inc"; NEEDS("STANDALONE_PLAIN"); ?>
+<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
+<?php NEEDS('STANDALONE_PLAIN'); ?>
--FILE--
<?php
require_once __DIR__ . "/../utils/basic.inc";
$username = "root";
$password = "toor";
$database = "admin";
$parsed = parse_url(STANDALONE_PLAIN);
$dsn = sprintf("mongodb://%s:%s@%s:%d/%s", $username, $password, $parsed["host"], $parsed["port"], $database);
$adminmanager = new MongoDB\Driver\Manager($dsn);
$cmd = array(
"createUser" => "bugs",
"roles" => array(array("role" => "readWrite", "db" => DATABASE_NAME)),
);
$command = new MongoDB\Driver\Command($cmd);
try {
$result = $adminmanager->executeCommand('$external', $command);
echo "User Created\n";
} catch(Exception $e) {
echo $e->getMessage(), "\n";
}
$username = "bugs";
$password = "wrong-password";
$database = '$external';
$dsn = sprintf("mongodb://%s:%s@%s:%d/%s?authMechanism=PLAIN", $username, $password, $parsed["host"], $parsed["port"], $database);
$manager = new MongoDB\Driver\Manager($dsn);
$bulk = new MongoDB\Driver\BulkWrite();
$bulk->insert(array("very" => "important"));
throws(function() use($manager, $bulk) {
$manager->executeBulkWrite(NS, $bulk);
}, "MongoDB\Driver\Exception\AuthenticationException");
$cmd = array(
"dropUser" => "bugs",
);
$command = new MongoDB\Driver\Command($cmd);
try {
$result = $adminmanager->executeCommand('$external', $command);
echo "User deleted\n";
} catch(Exception $e) {
echo $e->getMessage(), "\n";
}
?>
===DONE===
<?php exit(0); ?>
--EXPECT--
User Created
OK: Got MongoDB\Driver\Exception\AuthenticationException
User deleted
===DONE===
diff --git a/mongodb-1.2.3/tests/connect/standalone-ssl-no_verify-001.phpt b/mongodb-1.2.8/tests/connect/standalone-ssl-no_verify-001.phpt
similarity index 86%
rename from mongodb-1.2.3/tests/connect/standalone-ssl-no_verify-001.phpt
rename to mongodb-1.2.8/tests/connect/standalone-ssl-no_verify-001.phpt
index e1ce4c78..cc813d87 100644
--- a/mongodb-1.2.3/tests/connect/standalone-ssl-no_verify-001.phpt
+++ b/mongodb-1.2.8/tests/connect/standalone-ssl-no_verify-001.phpt
@@ -1,26 +1,27 @@
--TEST--
Connect to MongoDB with SSL and no host/cert verification
--SKIPIF--
-<?php require __DIR__ . "/../utils/basic-skipif.inc"; NEEDS("STANDALONE_SSL"); ?>
+<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
+<?php NEEDS('STANDALONE_SSL'); ?>
--FILE--
<?php
require_once __DIR__ . "/../utils/basic.inc";
$driverOptions = [
'allow_invalid_hostname' => true,
"weak_cert_validation" => true,
];
$manager = new MongoDB\Driver\Manager(STANDALONE_SSL, ['ssl' => true], $driverOptions);
$cursor = $manager->executeCommand(DATABASE_NAME, new MongoDB\Driver\Command(['ping' => 1]));
var_dump($cursor->toArray()[0]);
?>
===DONE===
<?php exit(0); ?>
--EXPECTF--
object(stdClass)#%d (%d) {
["ok"]=>
float(1)
}
===DONE===
diff --git a/mongodb-1.2.3/tests/connect/standalone-ssl-no_verify-002.phpt b/mongodb-1.2.8/tests/connect/standalone-ssl-no_verify-002.phpt
similarity index 88%
rename from mongodb-1.2.3/tests/connect/standalone-ssl-no_verify-002.phpt
rename to mongodb-1.2.8/tests/connect/standalone-ssl-no_verify-002.phpt
index 599e4195..574fa10c 100644
--- a/mongodb-1.2.3/tests/connect/standalone-ssl-no_verify-002.phpt
+++ b/mongodb-1.2.8/tests/connect/standalone-ssl-no_verify-002.phpt
@@ -1,30 +1,31 @@
--TEST--
Connect to MongoDB with SSL and no host/cert verification (context options)
--SKIPIF--
-<?php require __DIR__ . "/../utils/basic-skipif.inc"; NEEDS("STANDALONE_SSL"); ?>
+<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
+<?php NEEDS('STANDALONE_SSL'); ?>
--FILE--
<?php
require_once __DIR__ . "/../utils/basic.inc";
$driverOptions = [
'context' => stream_context_create([
'ssl' => [
'allow_invalid_hostname' => true,
'allow_self_signed' => true, // "weak_cert_validation" alias
],
]),
];
$manager = new MongoDB\Driver\Manager(STANDALONE_SSL, ['ssl' => true], $driverOptions);
$cursor = $manager->executeCommand(DATABASE_NAME, new MongoDB\Driver\Command(['ping' => 1]));
var_dump($cursor->toArray()[0]);
?>
===DONE===
<?php exit(0); ?>
--EXPECTF--
object(stdClass)#%d (%d) {
["ok"]=>
float(1)
}
===DONE===
diff --git a/mongodb-1.2.3/tests/connect/standalone-ssl-verify_cert-001.phpt b/mongodb-1.2.8/tests/connect/standalone-ssl-verify_cert-001.phpt
similarity index 88%
rename from mongodb-1.2.3/tests/connect/standalone-ssl-verify_cert-001.phpt
rename to mongodb-1.2.8/tests/connect/standalone-ssl-verify_cert-001.phpt
index ab5f6f7f..9d438488 100644
--- a/mongodb-1.2.3/tests/connect/standalone-ssl-verify_cert-001.phpt
+++ b/mongodb-1.2.8/tests/connect/standalone-ssl-verify_cert-001.phpt
@@ -1,30 +1,31 @@
--TEST--
Connect to MongoDB with SSL and cert verification
--SKIPIF--
-<?php require __DIR__ . "/../utils/basic-skipif.inc"; NEEDS("STANDALONE_SSL"); ?>
+<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
+<?php NEEDS('STANDALONE_SSL'); ?>
--FILE--
<?php
require_once __DIR__ . "/../utils/basic.inc";
$SSL_DIR = realpath(__DIR__ . '/../../scripts/ssl/');
$driverOptions = [
// libmongoc does not allow the hostname to be overridden as "server"
'allow_invalid_hostname' => true,
'weak_cert_validation' => false,
'ca_file' => $SSL_DIR . '/ca.pem',
];
$manager = new MongoDB\Driver\Manager(STANDALONE_SSL, ['ssl' => true], $driverOptions);
$cursor = $manager->executeCommand(DATABASE_NAME, new MongoDB\Driver\Command(['ping' => 1]));
var_dump($cursor->toArray()[0]);
?>
===DONE===
<?php exit(0); ?>
--EXPECTF--
object(stdClass)#%d (%d) {
["ok"]=>
float(1)
}
===DONE===
diff --git a/mongodb-1.2.3/tests/connect/standalone-ssl-verify_cert-002.phpt b/mongodb-1.2.8/tests/connect/standalone-ssl-verify_cert-002.phpt
similarity index 90%
rename from mongodb-1.2.3/tests/connect/standalone-ssl-verify_cert-002.phpt
rename to mongodb-1.2.8/tests/connect/standalone-ssl-verify_cert-002.phpt
index e652987f..9c4ac959 100644
--- a/mongodb-1.2.3/tests/connect/standalone-ssl-verify_cert-002.phpt
+++ b/mongodb-1.2.8/tests/connect/standalone-ssl-verify_cert-002.phpt
@@ -1,34 +1,35 @@
--TEST--
Connect to MongoDB with SSL and cert verification (context options)
--SKIPIF--
-<?php require __DIR__ . "/../utils/basic-skipif.inc"; NEEDS("STANDALONE_SSL"); ?>
+<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
+<?php NEEDS('STANDALONE_SSL'); ?>
--FILE--
<?php
require_once __DIR__ . "/../utils/basic.inc";
$SSL_DIR = realpath(__DIR__ . '/../../scripts/ssl/');
$driverOptions = [
'context' => stream_context_create([
'ssl' => [
// libmongoc does not allow the hostname to be overridden as "server"
'allow_invalid_hostname' => true,
'allow_self_signed' => false, // "weak_cert_validation" alias
'cafile' => $SSL_DIR . '/ca.pem', // "ca_file" alias
],
]),
];
$manager = new MongoDB\Driver\Manager(STANDALONE_SSL, ['ssl' => true], $driverOptions);
$cursor = $manager->executeCommand(DATABASE_NAME, new MongoDB\Driver\Command(['ping' => 1]));
var_dump($cursor->toArray()[0]);
?>
===DONE===
<?php exit(0); ?>
--EXPECTF--
object(stdClass)#%d (%d) {
["ok"]=>
float(1)
}
===DONE===
diff --git a/mongodb-1.2.3/tests/connect/standalone-ssl-verify_cert-error-001.phpt b/mongodb-1.2.8/tests/connect/standalone-ssl-verify_cert-error-001.phpt
similarity index 90%
rename from mongodb-1.2.3/tests/connect/standalone-ssl-verify_cert-error-001.phpt
rename to mongodb-1.2.8/tests/connect/standalone-ssl-verify_cert-error-001.phpt
index efea0e29..776d1105 100644
--- a/mongodb-1.2.3/tests/connect/standalone-ssl-verify_cert-error-001.phpt
+++ b/mongodb-1.2.8/tests/connect/standalone-ssl-verify_cert-error-001.phpt
@@ -1,27 +1,28 @@
--TEST--
Connect to MongoDB with SSL and cert verification error
--SKIPIF--
-<?php require __DIR__ . "/../utils/basic-skipif.inc"; NEEDS("STANDALONE_SSL"); ?>
+<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
+<?php NEEDS('STANDALONE_SSL'); ?>
--FILE--
<?php
require_once __DIR__ . "/../utils/basic.inc";
$driverOptions = [
// libmongoc does not allow the hostname to be overridden as "server"
'allow_invalid_hostname' => true,
'weak_cert_validation' => false,
];
echo throws(function() use ($driverOptions) {
$manager = new MongoDB\Driver\Manager(STANDALONE_SSL, ['ssl' => true], $driverOptions);
$cursor = $manager->executeCommand(DATABASE_NAME, new MongoDB\Driver\Command(['ping' => 1]));
var_dump($cursor->toArray()[0]);
}, 'MongoDB\Driver\Exception\ConnectionTimeoutException', 'executeCommand'), "\n";
?>
===DONE===
<?php exit(0); ?>
--EXPECTF--
OK: Got MongoDB\Driver\Exception\ConnectionTimeoutException thrown from executeCommand
No suitable servers found (`serverSelectionTryOnce` set): [%s calling ismaster on '%s:%d']
===DONE===
diff --git a/mongodb-1.2.3/tests/connect/standalone-ssl-verify_cert-error-002.phpt b/mongodb-1.2.8/tests/connect/standalone-ssl-verify_cert-error-002.phpt
similarity index 92%
rename from mongodb-1.2.3/tests/connect/standalone-ssl-verify_cert-error-002.phpt
rename to mongodb-1.2.8/tests/connect/standalone-ssl-verify_cert-error-002.phpt
index 350931e9..5ac2eefd 100644
--- a/mongodb-1.2.3/tests/connect/standalone-ssl-verify_cert-error-002.phpt
+++ b/mongodb-1.2.8/tests/connect/standalone-ssl-verify_cert-error-002.phpt
@@ -1,31 +1,32 @@
--TEST--
Connect to MongoDB with SSL and cert verification error (context options)
--SKIPIF--
-<?php require __DIR__ . "/../utils/basic-skipif.inc"; NEEDS("STANDALONE_SSL"); ?>
+<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
+<?php NEEDS('STANDALONE_SSL'); ?>
--FILE--
<?php
require_once __DIR__ . "/../utils/basic.inc";
$driverOptions = [
'context' => stream_context_create([
'ssl' => [
// libmongoc does not allow the hostname to be overridden as "server"
'allow_invalid_hostname' => true,
'allow_self_signed' => false, // "weak_cert_validation" alias
],
]),
];
echo throws(function() use ($driverOptions) {
$manager = new MongoDB\Driver\Manager(STANDALONE_SSL, ['ssl' => true], $driverOptions);
$cursor = $manager->executeCommand(DATABASE_NAME, new MongoDB\Driver\Command(['ping' => 1]));
var_dump($cursor->toArray()[0]);
}, 'MongoDB\Driver\Exception\ConnectionTimeoutException', 'executeCommand'), "\n";
?>
===DONE===
<?php exit(0); ?>
--EXPECTF--
OK: Got MongoDB\Driver\Exception\ConnectionTimeoutException thrown from executeCommand
No suitable servers found (`serverSelectionTryOnce` set): [%s calling ismaster on '%s:%d']
===DONE===
diff --git a/mongodb-1.2.3/tests/connect/standalone-x509-auth-001.phpt b/mongodb-1.2.8/tests/connect/standalone-x509-auth-001.phpt
similarity index 89%
rename from mongodb-1.2.3/tests/connect/standalone-x509-auth-001.phpt
rename to mongodb-1.2.8/tests/connect/standalone-x509-auth-001.phpt
index e8561a60..aa2f4fdc 100644
--- a/mongodb-1.2.3/tests/connect/standalone-x509-auth-001.phpt
+++ b/mongodb-1.2.8/tests/connect/standalone-x509-auth-001.phpt
@@ -1,31 +1,32 @@
--TEST--
Connect to MongoDB with SSL and X509 auth
--SKIPIF--
-<?php require __DIR__ . "/../utils/basic-skipif.inc"; NEEDS("STANDALONE_X509"); ?>
+<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
+<?php NEEDS('STANDALONE_X509'); ?>
--FILE--
<?php
require_once __DIR__ . "/../utils/basic.inc";
$SSL_DIR = realpath(__DIR__ . '/../../scripts/ssl/');
$driverOptions = [
// libmongoc does not allow the hostname to be overridden as "server"
'allow_invalid_hostname' => true,
'weak_cert_validation' => false,
'ca_file' => $SSL_DIR . '/ca.pem',
'pem_file' => $SSL_DIR . '/client.pem',
];
$manager = new MongoDB\Driver\Manager(STANDALONE_X509, ['ssl' => true], $driverOptions);
$cursor = $manager->executeCommand(DATABASE_NAME, new MongoDB\Driver\Command(['ping' => 1]));
var_dump($cursor->toArray()[0]);
?>
===DONE===
<?php exit(0); ?>
--EXPECTF--
object(stdClass)#%d (%d) {
["ok"]=>
float(1)
}
===DONE===
diff --git a/mongodb-1.2.3/tests/connect/standalone-x509-auth-002.phpt b/mongodb-1.2.8/tests/connect/standalone-x509-auth-002.phpt
similarity index 91%
rename from mongodb-1.2.3/tests/connect/standalone-x509-auth-002.phpt
rename to mongodb-1.2.8/tests/connect/standalone-x509-auth-002.phpt
index 2e79a4bd..78785f51 100644
--- a/mongodb-1.2.3/tests/connect/standalone-x509-auth-002.phpt
+++ b/mongodb-1.2.8/tests/connect/standalone-x509-auth-002.phpt
@@ -1,35 +1,36 @@
--TEST--
Connect to MongoDB with SSL and X509 auth (stream context)
--SKIPIF--
-<?php require __DIR__ . "/../utils/basic-skipif.inc"; NEEDS("STANDALONE_X509"); ?>
+<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
+<?php NEEDS('STANDALONE_X509'); ?>
--FILE--
<?php
require_once __DIR__ . "/../utils/basic.inc";
$SSL_DIR = realpath(__DIR__ . '/../../scripts/ssl/');
$driverOptions = [
'context' => stream_context_create([
'ssl' => [
// libmongoc does not allow the hostname to be overridden as "server"
'allow_invalid_hostname' => true,
'allow_self_signed' => false, // "weak_cert_validation" alias
'cafile' => $SSL_DIR . '/ca.pem', // "ca_file" alias
'local_cert' => $SSL_DIR . '/client.pem', // "pem_file" alias
],
]),
];
$manager = new MongoDB\Driver\Manager(STANDALONE_X509, ['ssl' => true], $driverOptions);
$cursor = $manager->executeCommand(DATABASE_NAME, new MongoDB\Driver\Command(['ping' => 1]));
var_dump($cursor->toArray()[0]);
?>
===DONE===
<?php exit(0); ?>
--EXPECTF--
object(stdClass)#%d (%d) {
["ok"]=>
float(1)
}
===DONE===
diff --git a/mongodb-1.2.3/tests/connect/standalone-x509-error-0001.phpt b/mongodb-1.2.8/tests/connect/standalone-x509-error-0001.phpt
similarity index 93%
rename from mongodb-1.2.3/tests/connect/standalone-x509-error-0001.phpt
rename to mongodb-1.2.8/tests/connect/standalone-x509-error-0001.phpt
index 3c03814b..4196e6b1 100644
--- a/mongodb-1.2.3/tests/connect/standalone-x509-error-0001.phpt
+++ b/mongodb-1.2.8/tests/connect/standalone-x509-error-0001.phpt
@@ -1,39 +1,40 @@
--TEST--
X509 connection should not reuse previous stream after an auth failure
--SKIPIF--
-<?php require __DIR__ . "/../utils/basic-skipif.inc"; NEEDS("STANDALONE_X509"); ?>
+<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
+<?php NEEDS('STANDALONE_X509'); ?>
--FILE--
<?php
require_once __DIR__ . "/../utils/basic.inc";
$SSL_DIR = realpath(__DIR__ . '/../../scripts/ssl/');
$driverOptions = [
// libmongoc does not allow the hostname to be overridden as "server"
'allow_invalid_hostname' => true,
'ca_file' => $SSL_DIR . '/ca.pem',
'pem_file' => $SSL_DIR . '/client.pem',
];
// Wrong username for X509 authentication
$parsed = parse_url(STANDALONE_X509);
$dsn = sprintf('mongodb://username@%s:%d/?ssl=true&authMechanism=MONGODB-X509', $parsed['host'], $parsed['port']);
// Both should fail with auth failure, without reusing the previous stream
for ($i = 0; $i < 2; $i++) {
echo throws(function() use ($dsn, $driverOptions) {
$manager = new MongoDB\Driver\Manager($dsn, [], $driverOptions);
$cursor = $manager->executeCommand(DATABASE_NAME, new MongoDB\Driver\Command(['ping' => 1]));
var_dump($cursor->toArray()[0]);
}, 'MongoDB\Driver\Exception\AuthenticationException', 'executeCommand'), "\n";
}
?>
===DONE===
<?php exit(0); ?>
--EXPECTF--
OK: Got MongoDB\Driver\Exception\AuthenticationException thrown from executeCommand
auth failed
OK: Got MongoDB\Driver\Exception\AuthenticationException thrown from executeCommand
auth failed
===DONE===
diff --git a/mongodb-1.2.3/tests/connect/standalone-x509-extract_username-001.phpt b/mongodb-1.2.8/tests/connect/standalone-x509-extract_username-001.phpt
similarity index 91%
rename from mongodb-1.2.3/tests/connect/standalone-x509-extract_username-001.phpt
rename to mongodb-1.2.8/tests/connect/standalone-x509-extract_username-001.phpt
index 40eea3d4..c1cb9f8a 100644
--- a/mongodb-1.2.3/tests/connect/standalone-x509-extract_username-001.phpt
+++ b/mongodb-1.2.8/tests/connect/standalone-x509-extract_username-001.phpt
@@ -1,35 +1,36 @@
--TEST--
Connect to MongoDB with SSL and X509 auth and username retrieved from cert
--SKIPIF--
-<?php require __DIR__ . "/../utils/basic-skipif.inc"; NEEDS("STANDALONE_X509"); ?>
+<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
+<?php NEEDS('STANDALONE_X509'); ?>
--FILE--
<?php
require_once __DIR__ . "/../utils/basic.inc";
$SSL_DIR = realpath(__DIR__ . '/../../scripts/ssl/');
$driverOptions = [
// libmongoc does not allow the hostname to be overridden as "server"
'allow_invalid_hostname' => true,
'weak_cert_validation' => false,
'ca_file' => $SSL_DIR . '/ca.pem',
'pem_file' => $SSL_DIR . '/client.pem',
];
$parsed = parse_url(STANDALONE_X509);
// TODO: authMechanism cannot be parsed from URI options array (PHPC-772)
$uri = sprintf('mongodb://%s:%d/?ssl=true&authMechanism=MONGODB-X509', $parsed['host'], $parsed['port']);
$manager = new MongoDB\Driver\Manager($uri, [], $driverOptions);
$cursor = $manager->executeCommand(DATABASE_NAME, new MongoDB\Driver\Command(['ping' => 1]));
var_dump($cursor->toArray()[0]);
?>
===DONE===
<?php exit(0); ?>
--EXPECTF--
object(stdClass)#%d (%d) {
["ok"]=>
float(1)
}
===DONE===
diff --git a/mongodb-1.2.3/tests/connect/standalone-x509-extract_username-002.phpt b/mongodb-1.2.8/tests/connect/standalone-x509-extract_username-002.phpt
similarity index 92%
rename from mongodb-1.2.3/tests/connect/standalone-x509-extract_username-002.phpt
rename to mongodb-1.2.8/tests/connect/standalone-x509-extract_username-002.phpt
index 30854cc3..7be8d517 100644
--- a/mongodb-1.2.3/tests/connect/standalone-x509-extract_username-002.phpt
+++ b/mongodb-1.2.8/tests/connect/standalone-x509-extract_username-002.phpt
@@ -1,39 +1,40 @@
--TEST--
Connect to MongoDB with SSL and X509 auth and username retrieved from cert (stream context)
--SKIPIF--
-<?php require __DIR__ . "/../utils/basic-skipif.inc"; NEEDS("STANDALONE_X509"); ?>
+<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
+<?php NEEDS('STANDALONE_X509'); ?>
--FILE--
<?php
require_once __DIR__ . "/../utils/basic.inc";
$SSL_DIR = realpath(__DIR__ . '/../../scripts/ssl/');
$driverOptions = [
'context' => stream_context_create([
'ssl' => [
// libmongoc does not allow the hostname to be overridden as "server"
'allow_invalid_hostname' => true,
'allow_self_signed' => false, // "weak_cert_validation" alias
'cafile' => $SSL_DIR . '/ca.pem', // "ca_file" alias
'local_cert' => $SSL_DIR . '/client.pem', // "pem_file" alias
],
]),
];
$parsed = parse_url(STANDALONE_X509);
// TODO: authMechanism cannot be parsed from URI options array (PHPC-772)
$uri = sprintf('mongodb://%s:%d/?ssl=true&authMechanism=MONGODB-X509', $parsed['host'], $parsed['port']);
$manager = new MongoDB\Driver\Manager($uri, [], $driverOptions);
$cursor = $manager->executeCommand(DATABASE_NAME, new MongoDB\Driver\Command(['ping' => 1]));
var_dump($cursor->toArray()[0]);
?>
===DONE===
<?php exit(0); ?>
--EXPECTF--
object(stdClass)#%d (%d) {
["ok"]=>
float(1)
}
===DONE===
diff --git a/mongodb-1.2.3/tests/functional/cursor-001.phpt b/mongodb-1.2.8/tests/functional/cursor-001.phpt
similarity index 96%
rename from mongodb-1.2.3/tests/functional/cursor-001.phpt
rename to mongodb-1.2.8/tests/functional/cursor-001.phpt
index f71c238b..30c0e314 100644
--- a/mongodb-1.2.3/tests/functional/cursor-001.phpt
+++ b/mongodb-1.2.8/tests/functional/cursor-001.phpt
@@ -1,132 +1,132 @@
--TEST--
Sorting single field, ascending, using the Cursor Iterator
--SKIPIF--
<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
-<?php CLEANUP(STANDALONE); LOAD(STANDALONE); ?>
+<?php NEEDS('STANDALONE'); CLEANUP(STANDALONE); LOAD(STANDALONE); ?>
--FILE--
<?php
require_once __DIR__ . "/../utils/basic.inc";
$manager = new MongoDB\Driver\Manager(STANDALONE);
$query = new MongoDB\Driver\Query(array(), array(
'projection' => array('_id' => 0, 'username' => 1),
'sort' => array('username' => 1),
'limit' => 104,
));
$cursor = $manager->executeQuery(NS, $query);
foreach ($cursor as $document) {
echo $document->username . "\n";
}
?>
===DONE===
<?php exit(0); ?>
--EXPECT--
aaliyah.kertzmann
aaron89
abbott.alden
abbott.flo
abby76
abernathy.adrienne
abernathy.audrey
abner.kreiger
aboehm
abshire.icie
abshire.jazlyn
adams.delta
adolph20
adonis.schamberger
agleason
ahartmann
ahettinger
akreiger
al.cormier
al97
albin95
alda.murray
alden.blanda
alessandra76
alex73
alexa01
alfred.ritchie
alia07
alia72
alize.hegmann
allie48
alta.sawayn
alvena.pacocha
alvis22
alycia48
amalia84
amely01
amos.corkery
amos78
anahi95
anais.feest
anais58
andreanne.steuber
angela.dickinson
angelina.bartoletti
angelina31
aniyah.franecki
annalise40
antoinette.gaylord
antoinette.weissnat
aoberbrunner
apacocha
apollich
ara92
arch44
arely.ryan
armstrong.clara
armstrong.gordon
arnold.kiehn
arvel.hilll
asatterfield
aschuppe
ashlynn71
ashlynn85
ashton.o'kon
austen03
austen47
austin67
awintheiser
awyman
ayana.brakus
bailey.mertz
bailey.sarina
balistreri.donald
barrett.prohaska
bartell.susie
bashirian.lina
bayer.ova
baylee.maggio
bbernier
bblick
beahan.oleta
beatty.layne
beatty.myrtis
beau49
beaulah.mann
bechtelar.nadia
becker.theron
beer.mossie
beer.roselyn
benedict.johnson
berge.enoch
bergnaum.roberto
bernardo.mccullough
bernardo52
bernhard.margaretta
bernie.morissette
bethel20
betty09
bins.aliyah
bins.laisha
bjori
blanda.danielle
blanda.irving
===DONE===
diff --git a/mongodb-1.2.3/tests/functional/cursorid-001.phpt b/mongodb-1.2.8/tests/functional/cursorid-001.phpt
similarity index 91%
rename from mongodb-1.2.3/tests/functional/cursorid-001.phpt
rename to mongodb-1.2.8/tests/functional/cursorid-001.phpt
index c5d086e5..926d5afa 100644
--- a/mongodb-1.2.3/tests/functional/cursorid-001.phpt
+++ b/mongodb-1.2.8/tests/functional/cursorid-001.phpt
@@ -1,39 +1,39 @@
--TEST--
Sorting single field, ascending, using the Cursor Iterator
--SKIPIF--
<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
-<?php CLEANUP(STANDALONE); LOAD(STANDALONE); ?>
+<?php NEEDS('STANDALONE'); CLEANUP(STANDALONE); LOAD(STANDALONE); ?>
--FILE--
<?php
require_once __DIR__ . "/../utils/basic.inc";
$manager = new MongoDB\Driver\Manager(STANDALONE);
$query = new MongoDB\Driver\Query(array(), array(
'projection' => array('_id' => 0, 'username' => 1),
'sort' => array('username' => 1),
'batchSize' => 11,
'limit' => 110,
));
$cursor = $manager->executeQuery(NS, $query);
$cursorid = $cursor->getId();
$s1 = (string)$cursorid;
var_dump(
$cursorid,
$s1
);
var_dump($s1 > 0);
?>
===DONE===
<?php exit(0); ?>
--EXPECTF--
object(MongoDB\Driver\CursorId)#%d (%d) {
["id"]=>
%rint\(\d+\)|string\(\d+\) "\d+"%r
}
string(%d) "%d"
bool(true)
===DONE===
diff --git a/mongodb-1.2.8/tests/functional/phpinfo-1.phpt b/mongodb-1.2.8/tests/functional/phpinfo-1.phpt
new file mode 100644
index 00000000..c752cd9e
--- /dev/null
+++ b/mongodb-1.2.8/tests/functional/phpinfo-1.phpt
@@ -0,0 +1,17 @@
+--TEST--
+phpinfo() reports mongodb.debug (no value)
+--SKIPIF--
+<?php if (defined("HHVM_VERSION_ID")) exit("skip HHVM does not do phpinfo() this way"); ?>
+--FILE--
+<?php
+
+phpinfo();
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECTF--
+%a
+mongodb.debug => no value => no value
+%a
+===DONE===
diff --git a/mongodb-1.2.8/tests/functional/phpinfo-2.phpt b/mongodb-1.2.8/tests/functional/phpinfo-2.phpt
new file mode 100644
index 00000000..7549077d
--- /dev/null
+++ b/mongodb-1.2.8/tests/functional/phpinfo-2.phpt
@@ -0,0 +1,20 @@
+--TEST--
+phpinfo() reports mongodb.debug (default and overridden)
+--INI--
+mongodb.debug=stderr
+--SKIPIF--
+<?php if (defined("HHVM_VERSION_ID")) exit("skip HHVM does not do phpinfo() this way"); ?>
+--FILE--
+<?php
+
+ini_set("mongodb.debug", "stdout");
+phpinfo();
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECTF--
+%a
+mongodb.debug => stdout => stderr
+%a
+===DONE===
diff --git a/mongodb-1.2.3/tests/functional/query-sort-001.phpt b/mongodb-1.2.8/tests/functional/query-sort-001.phpt
similarity index 96%
rename from mongodb-1.2.3/tests/functional/query-sort-001.phpt
rename to mongodb-1.2.8/tests/functional/query-sort-001.phpt
index 5497eb96..b27e2a25 100644
--- a/mongodb-1.2.3/tests/functional/query-sort-001.phpt
+++ b/mongodb-1.2.8/tests/functional/query-sort-001.phpt
@@ -1,128 +1,128 @@
--TEST--
Sorting single field, ascending
--SKIPIF--
<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
-<?php CLEANUP(STANDALONE); LOAD(STANDALONE); ?>
+<?php NEEDS('STANDALONE'); CLEANUP(STANDALONE); LOAD(STANDALONE); ?>
--FILE--
<?php
require_once __DIR__ . "/../utils/basic.inc";
$manager = new MongoDB\Driver\Manager(STANDALONE);
$query = new MongoDB\Driver\Query(array(), array(
'projection' => array('_id' => 0, 'username' => 1),
'sort' => array('username' => 1),
"limit" => 100,
));
$cursor = $manager->executeQuery(NS, $query);
foreach ($cursor as $document) {
echo $document->username . "\n";
}
?>
===DONE===
<?php exit(0); ?>
--EXPECT--
aaliyah.kertzmann
aaron89
abbott.alden
abbott.flo
abby76
abernathy.adrienne
abernathy.audrey
abner.kreiger
aboehm
abshire.icie
abshire.jazlyn
adams.delta
adolph20
adonis.schamberger
agleason
ahartmann
ahettinger
akreiger
al.cormier
al97
albin95
alda.murray
alden.blanda
alessandra76
alex73
alexa01
alfred.ritchie
alia07
alia72
alize.hegmann
allie48
alta.sawayn
alvena.pacocha
alvis22
alycia48
amalia84
amely01
amos.corkery
amos78
anahi95
anais.feest
anais58
andreanne.steuber
angela.dickinson
angelina.bartoletti
angelina31
aniyah.franecki
annalise40
antoinette.gaylord
antoinette.weissnat
aoberbrunner
apacocha
apollich
ara92
arch44
arely.ryan
armstrong.clara
armstrong.gordon
arnold.kiehn
arvel.hilll
asatterfield
aschuppe
ashlynn71
ashlynn85
ashton.o'kon
austen03
austen47
austin67
awintheiser
awyman
ayana.brakus
bailey.mertz
bailey.sarina
balistreri.donald
barrett.prohaska
bartell.susie
bashirian.lina
bayer.ova
baylee.maggio
bbernier
bblick
beahan.oleta
beatty.layne
beatty.myrtis
beau49
beaulah.mann
bechtelar.nadia
becker.theron
beer.mossie
beer.roselyn
benedict.johnson
berge.enoch
bergnaum.roberto
bernardo.mccullough
bernardo52
bernhard.margaretta
bernie.morissette
bethel20
betty09
bins.aliyah
===DONE===
diff --git a/mongodb-1.2.3/tests/functional/query-sort-002.phpt b/mongodb-1.2.8/tests/functional/query-sort-002.phpt
similarity index 95%
rename from mongodb-1.2.3/tests/functional/query-sort-002.phpt
rename to mongodb-1.2.8/tests/functional/query-sort-002.phpt
index c6c993e3..1355b81b 100644
--- a/mongodb-1.2.3/tests/functional/query-sort-002.phpt
+++ b/mongodb-1.2.8/tests/functional/query-sort-002.phpt
@@ -1,128 +1,128 @@
--TEST--
Sorting single field, descending
--SKIPIF--
<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
-<?php CLEANUP(STANDALONE); LOAD(STANDALONE); ?>
+<?php NEEDS('STANDALONE'); CLEANUP(STANDALONE); LOAD(STANDALONE); ?>
--FILE--
<?php
require_once __DIR__ . "/../utils/basic.inc";
$manager = new MongoDB\Driver\Manager(STANDALONE);
$query = new MongoDB\Driver\Query(array(), array(
'projection' => array('_id' => 0, 'username' => 1),
'sort' => array('username' => -1),
'limit' => 100,
));
$cursor = $manager->executeQuery(NS, $query);
foreach ($cursor as $document) {
echo $document->username . "\n";
}
?>
===DONE===
<?php exit(0); ?>
--EXPECT--
zulauf.amaya
zstanton
zoe41
zieme.noemi
ziemann.webster
zheathcote
zella78
zboyle
zachery33
yyost
ywyman
ywiza
ypredovic
yost.magali
yost.ari
ylarkin
yklein
yhudson
yfritsch
ycole
yasmine.lowe
yasmin55
xrodriguez
xkohler
xhermann
xgutmann
xgibson
xcassin
wwilkinson
wunsch.mose
wschimmel
wschaefer
wpacocha
wolff.caroline
wkertzmann
wiza.carmel
witting.walker
witting.chris
wisozk.cortez
winnifred08
wilson.white
willms.amari
will.lamont
will.jerod
will.edwina
wilfred.feil
wilderman.sophia
wiegand.blanche
west.jude
west.cristobal
weimann.tillman
webster70
webster48
watson70
warren.feest
walton33
walter.norval
walter.lester
walsh.vincenza
walker.alec
wade91
vwaters
vvolkman
vschulist
vrolfson
vpfeffer
vorn
von.britney
vivianne.macejkovic
veum.tyrell
vesta.ritchie
verda93
vena.schumm
velma37
velda.wehner
veffertz
vdickinson
vconn
vbraun
vborer
vbins
vandervort.ezekiel
van.ruecker
uzieme
uwisoky
usmith
uschumm
uschmeler
urban24
upton.zackery
unique.pagac
una.larkin
umraz
ullrich.layne
ulises44
ulises.beatty
ulesch
ukovacek
ujenkins
uhansen
===DONE===
diff --git a/mongodb-1.2.3/tests/functional/query-sort-003.phpt b/mongodb-1.2.8/tests/functional/query-sort-003.phpt
similarity index 99%
rename from mongodb-1.2.3/tests/functional/query-sort-003.phpt
rename to mongodb-1.2.8/tests/functional/query-sort-003.phpt
index 71d9e569..a86f2116 100644
--- a/mongodb-1.2.3/tests/functional/query-sort-003.phpt
+++ b/mongodb-1.2.8/tests/functional/query-sort-003.phpt
@@ -1,1079 +1,1079 @@
--TEST--
Sorting single field, ascending, using the Cursor Iterator
--SKIPIF--
<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
-<?php CLEANUP(STANDALONE); LOAD(STANDALONE); ?>
+<?php NEEDS('STANDALONE'); CLEANUP(STANDALONE); LOAD(STANDALONE); ?>
--FILE--
<?php
require_once __DIR__ . "/../utils/basic.inc";
$manager = new MongoDB\Driver\Manager(STANDALONE);
$query = new MongoDB\Driver\Query(array(), array(
'projection' => array('_id' => 0, 'username' => 1),
'sort' => array('username' => 1),
));
var_dump($query);
$cursor = $manager->executeQuery(NS, $query);
var_dump(get_class($cursor));
foreach ($cursor as $document) {
echo $document->username . "\n";
}
?>
===DONE===
<?php exit(0); ?>
--EXPECTF--
object(MongoDB\Driver\Query)#%d (%d) {
["filter"]=>
object(stdClass)#%d (%d) {
}
["options"]=>
object(stdClass)#%d (%d) {
["projection"]=>
object(stdClass)#%d (%d) {
["_id"]=>
int(0)
["username"]=>
int(1)
}
["sort"]=>
object(stdClass)#%d (%d) {
["username"]=>
int(1)
}
}
["readConcern"]=>
NULL
}
string(21) "MongoDB\Driver\Cursor"
aaliyah.kertzmann
aaron89
abbott.alden
abbott.flo
abby76
abernathy.adrienne
abernathy.audrey
abner.kreiger
aboehm
abshire.icie
abshire.jazlyn
adams.delta
adolph20
adonis.schamberger
agleason
ahartmann
ahettinger
akreiger
al.cormier
al97
albin95
alda.murray
alden.blanda
alessandra76
alex73
alexa01
alfred.ritchie
alia07
alia72
alize.hegmann
allie48
alta.sawayn
alvena.pacocha
alvis22
alycia48
amalia84
amely01
amos.corkery
amos78
anahi95
anais.feest
anais58
andreanne.steuber
angela.dickinson
angelina.bartoletti
angelina31
aniyah.franecki
annalise40
antoinette.gaylord
antoinette.weissnat
aoberbrunner
apacocha
apollich
ara92
arch44
arely.ryan
armstrong.clara
armstrong.gordon
arnold.kiehn
arvel.hilll
asatterfield
aschuppe
ashlynn71
ashlynn85
ashton.o'kon
austen03
austen47
austin67
awintheiser
awyman
ayana.brakus
bailey.mertz
bailey.sarina
balistreri.donald
barrett.prohaska
bartell.susie
bashirian.lina
bayer.ova
baylee.maggio
bbernier
bblick
beahan.oleta
beatty.layne
beatty.myrtis
beau49
beaulah.mann
bechtelar.nadia
becker.theron
beer.mossie
beer.roselyn
benedict.johnson
berge.enoch
bergnaum.roberto
bernardo.mccullough
bernardo52
bernhard.margaretta
bernie.morissette
bethel20
betty09
bins.aliyah
bins.laisha
bjori
blanda.danielle
blanda.irving
blanda.ruthe
blaze.miller
block.kasandra
block.toby
bmccullough
botsford.edwardo
botsford.jennie
boyd.balistreri
boyer.khalid
boyle.franco
bpaucek
bpurdy
bradford.heidenreich
brannon24
braun.adaline
braun.jeanie
breanne.schmeler
breitenberg.demarco
brennan.emmerich
bret57
broderick53
brooklyn22
bruecker
bstamm
buckridge.julius
buddy42
bwalker
camilla20
cara.bechtelar
carlotta.kreiger
carolyn09
carolyne63
carroll.emmalee
cartwright.garland
casimir.keebler
casper.eldred
casper.juliana
casper38
cassin.carmel
cassin.krystel
catherine.hilll
cathrine.gislason
cbartoletti
cbecker
cbednar
cbreitenberg
cecelia.schoen
celestine97
cfriesen
cgreenfelder
chad.kuphal
chance.conroy
chasity63
chet.pacocha
christina.simonis
chyna05
citlalli41
ckertzmann
clarabelle65
clementine.grimes
clotilde39
cnikolaus
cole.alice
coleman55
collier.sage
collins.skylar
columbus78
connelly.josefina
conner.doyle
coralie47
cordelia25
corkery.arch
cormier.adriana
cormier.amy
cormier.landen
cormier.vida
cory76
cpaucek
cprice
craig93
creola.emard
creola88
crona.jaclyn
cronin.clint
crooks.josh
crystel24
csipes
cummings.frederic
cwaelchi
cwest
cwhite
cwolf
cydney.hayes
dahlia.white
daisy.johns
dakota.bednar
dakota.wiza
dallas.marquardt
dante.shields
darwin.howe
dave46
davis.bennett
davis.solon
dayne.padberg
dayton03
delaney91
delbert.auer
delia.lindgren
deontae36
dereck.ward
derek.bahringer
derek79
deven.spinka
devon34
dgottlieb
dhudson
dickinson.ashleigh
dillan66
djerde
dock.bednar
dolly.beer
donnie.langosh
dorothy67
dorthy.legros
doyle.nelle
drippin
dubuque.brooklyn
dubuque.cordia
dvandervort
dwiegand
dwolf
earlene.marvin
earline.baumbach
easter73
eauer
ebert.cordie
ebony.williamson
ebony59
edgar33
edgardo.gorczany
edibbert
effertz.mateo
effie.keeling
efren31
egrimes
ehirthe
ehuel
ehuels
eino23
ekoelpin
eldora.steuber
eldred65
elenor33
elesch
eli.mann
elisabeth95
eliseo49
ella.roberts
ellen.krajcik
ellen12
elliot.kling
elliot.weissnat
ellis37
elsie.kuhic
elva.baumbach
elvis45
emelia.ortiz
emerald.shanahan
emerson07
emie.schneider
emilio.crona
emily91
emmalee.waters
enid57
enid78
enoch.hilll
enola.rath
ephraim76
erdman.ethyl
erdman.niko
eriberto.russel
erik04
erika74
ernser.addison
ernser.geovany
ervin.carter
espinka
ethan.daugherty
ethel56
ethelyn46
ethyl68
ettie49
eulah49
fabian55
fadel.trevion
fae00
fahey.rosalee
farrell.asha
farrell.lessie
fbraun
feeney.angelica
feeney.elizabeth
feeney.nathanial
feil.rae
ferdman
ferry.eusebio
fherman
filomena18
finn.torphy
flavie41
florida.o'hara
ford85
fosinski
frami.bulah
franecki.rosetta
fred35
freda25
frederik.stracke
fsporer
fstokes
fturner
gabriel.mccullough
gardner.jacobson
garnet.oberbrunner
garry.windler
gaylord.myrtis
gblock
gbrakus
georgette.mueller
geovanni.jones
geovany07
german.leffler
german40
ggislason
gia15
gibson.amiya
giovani.langworth
giovanna.hickle
giovanny.haley
gislason.mae
gisselle.jacobs
gladyce88
glang
gottlieb.jerry
goyette.roman
gparker
gprosacco
gracie.mcdermott
graciela.jacobson
grayson78
greenfelder.amya
greenfelder.larry
greenfelder.ozella
gretchen19
gretchen38
greynolds
greyson63
grimes.andreane
gulgowski.allie
gusikowski.aliyah
gutkowski.laron
gwunsch
haag.alaina
hackett.alycia
hadley.abernathy
hailee01
hal67
haley.grace
haley.krystel
haley.lauretta
halvorson.bulah
hammes.dimitri
hand.lauren
hand.tiana
hansen.vanessa
harber.larissa
harber.vicenta
harris.kailey
hartmann.dedrick
harvey.hillard
haven13
hayes.delores
hayley08
hazle21
hazle43
heathcote.ashly
hegmann.sallie
heidenreich.julia
helene.o'connell
henriette21
herman.sanford
herzog.eileen
hessel.barry
hflatley
hhackett
hhyatt
hickle.isabell
hirthe.bryana
hirthe.letitia
hirthe.reymundo
hmarvin
hoeger.anastacio
hollie29
howe.abagail
howell.daugherty
hquigley
hrodriguez
hspinka
hstamm
htowne
hudson.bernie
hudson.deion
huels.alfred
huels.enid
hugh22
humberto98
hvandervort
hyatt.astrid
hyatt.soledad
iabernathy
idaugherty
idella50
idonnelly
ifeil
ileuschke
imuller
ipredovic
irwin.gutkowski
irwin31
isabell95
isabella.parisian
isac13
isac67
isaiah47
isaiah50
isaias90
isobel.mraz
ivy73
izabella.hermann
jacobs.carmela
jada.romaguera
jadon.reinger
jailyn62
jalon90
jamaal.cassin
jamarcus.weissnat
janelle93
janice.walker
jannie71
jaquan94
jaqueline.o'kon
jarod94
jarrod.lindgren
jasmin.ruecker
javier.volkman
javier13
javier62
jayda.d'amore
jazmyne63
jborer
jeanette45
jedidiah.hyatt
jefferey02
jenkins.letha
jerald.konopelski
jeremy.o'keefe
jessika.schmeler
jessy16
jett00
jfeest
jheaney
jherzog
jlebsack
jlockman
jo'hara
jodie.casper
johnnie66
johnston.brooklyn
jonas97
jones.jazmyn
jordan.turner
joshua.mraz
josiah59
joyce.casper
jruecker
jschamberger
jschinner
jthompson
jtowne
jude.jakubowski
jude92
juliana.witting
juliet55
june.runolfsson
justina63
jwindler
kadams
kadin.mayer
kaelyn05
kaelyn88
kamille.watsica
kamron88
karson.mante
kasey.abshire
kassandra.reilly
katheryn.walsh
kathlyn02
kathryne.boehm
kattie12
kaya24
kayleigh62
kbeahan
kdicki
keagan.hirthe
keanu21
keanu42
keebler.rupert
keeling.sydnee
keira.dach
kelly.konopelski
kelvin.jakubowski
kerluke.hiram
kernser
keshawn.boyle
kessler.marisol
keyon.gaylord
keyon65
kherman
khills
khudson
kiley63
kip12
kirk40
kirstin.cruickshank
klarson
kleuschke
kling.laila
klocko.filiberto
kmohr
ko'keefe
koch.emmett
koch.sophia
koelpin.yoshiko
krystel.stark
kturcotte
kub.marcel
kuhic.hattie
kuhlman.noel
kuphal.ahmed
kutch.chase
kutch.madonna
kutch.pasquale
kuvalis.nicolette
lane05
larkin.lawson
larue.schuster
laurel35
laurel72
laurence28
lauryn.beer
lbode
lbradtke
leanne.cronin
leannon.zander
lebsack.harmony
ledner.finn
leif52
leilani73
lemke.ernestina
lempi56
leopold69
lesch.delfina
lesch.edna
lesch.nyah
leuschke.erika
lexie.bernier
lexie65
lgrady
lillian50
lilliana.schaden
lily.hansen
lind.dane
lloyd60
lmckenzie
lnicolas
london07
lonnie.little
lonnie10
loraine.hammes
lorna31
louisa76
lquitzon
lubowitz.colleen
lubowitz.jazmyne
lucas.ferry
luciano79
lucienne13
lucio.huel
lucio20
luella.deckow
lullrich
luther.lesch
mac.hermann
macey95
macie.corwin
macy.greenholt
maddison66
madilyn.wyman
madisyn51
madyson.johns
maeve.raynor
maggio.kayli
maia14
mante.ashlee
mante.maymie
marc97
marcel56
marco.gerlach
mariana.sipes
marietta.swift
marina.mayert
marion15
marion35
marjolaine45
mark.casper
marks.trace
marlen34
marlene95
marley.sipes
marvin.ivory
maryjane.kutch
maudie25
mayer.tanner
mccullough.vella
mcdermott.kaitlyn
mckenzie.maximus
mdare
meaghan89
melisa61
metz.elmer
metz.ima
michaela.wolf
miles.pollich
milford39
milford40
mills.emmanuel
mills.rickey
miracle53
misty.boyer
mitchell.delta
mitchell.rafael
mohammad.gorczany
mohammed.lemke
mohr.kylee
mollie.deckow
monroe.o'keefe
monserrate.leannon
monserrate.nikolaus
monty.mills
morar.aniya
mosciski.alanis
mraz.marcelina
mrunte
mtoy
mueller.woodrow
muller.akeem
murazik.maximillia
mwalter
mylene.rogahn
myra43
myron.bechtelar
mzemlak
mzieme
nash88
nasir24
natalia66
nathanial37
nayeli.vandervort
ndouglas
neal.hand
neichmann
neil.gorczany
nellie23
ngoldner
nhaag
nharber
nharris
nicolas.melyssa
nicolas.wendy
nikita.romaguera
nikko.langosh
nikolas.lang
nikolas78
nikolaus.celestino
njacobs
nkshlerin
noah.blick
nolan.nora
nolan.zachariah
nolan56
norma46
novella67
npurdy
nrath
nrowe
nstamm
nward
o'conner.arthur
obie.weissnat
oboyer
octavia36
oda.robel
odare
odell96
ogulgowski
ohaley
ohowe
okuneva.ebba
olga.mertz
olga.waelchi
olin13
oliver.reichert
olson.dedrick
olynch
omarvin
omer.kirlin
ondricka.alexzander
ondricka.joy
orion.quigley
orn.katelyn
orval95
oswaldo.kunze
otreutel
owehner
owen82
pacocha.quentin
pagac.coleman
paige.murphy
parisian.dena
parker.ellie
patience65
patricia.macejkovic
pattie.waters
pattie97
paul.hayes
paula.fahey
paxton73
pbotsford
pconroy
pcruickshank
pdach
perry63
pfannerstill.erna
pframi
phahn
philpert
phodkiewicz
phoebe.crona
phuel
pierre.grant
plesch
pollich.danika
polson
powlowski.alfredo
ppurdy
price49
prohaska.ransom
prudence76
prussel
pschowalter
pwaters
pwatsica
pwisozk
qarmstrong
qbatz
qgislason
qkunze
qmayert
qo'hara
qpowlowski
qromaguera
qryan
qschiller
qschneider
queen75
queenie33
quitzon.greyson
quitzon.maxime
rachel45
raphaelle55
ratke.aurelia
rau.brent
raven.walter
raven.ziemann
raymundo.ferry
raynor.wilmer
rdickens
regan86
reginald.gulgowski
reichert.margaretta
reinger.johnathan
remington.russel
renner.lucius
rey29
rice.ronaldo
rico71
river66
rkoelpin
rmayer
robel.chance
rocky.hoeger
rodger.raynor
rodolfo.effertz
rohan.harmon
rolando38
rolfson.jaren
rosalee52
rosemarie.conn
rosenbaum.elisa
rosetta45
rowe.erik
rschowalter
rubie.hyatt
russel64
rutherford.dawn
sabina11
samara90
sarina.bednar
savannah89
savion82
sawayn.catharine
sawayn.pink
sbailey
schamberger.marcelle
schiller.kameron
schimmel.mavis
schimmel.russell
schmeler.dillon
schmeler.flo
schmidt.elwyn
schmitt.magali
schneider.rita
schowalter.abbigail
schroeder.zoey
schulist.angelo
schumm.carley
schumm.danielle
sebert
selina.thiel
sferry
shaina.emard
shanie.murazik
sheathcote
shegmann
shields.bethany
shoeger
shyann28
sienna53
sigmund.schinner
simeon.nader
skihn
skiles.darrin
skye.jast
skyla.friesen
smith.nico
so'kon
soledad.connelly
sonia05
sorn
spencer.bessie
spencer.darrel
sschumm
ssteuber
stacy.leffler
stark.vladimir
stehr.odell
stella.schowalter
stracke.dakota
streich.abdiel
stroman.rae
susanna55
swyman
sylvia82
tabitha.mohr
talon74
tanya65
tatum.harvey
tbarrows
tcole
terry.corene
terry.florian
tessie.stroman
tgrady
thalia22
theo62
theodore55
theresia68
theron10
tkonopelski
tlind
tomas04
toni57
toy.deshawn
trace03
tressa.price
tressie47
treutel.evert
treutel.minnie
trolfson
tromp.kaleigh
trudie09
trutherford
tsatterfield
tstamm
turcotte.armand
turner.considine
twila75
uabshire
uchamplin
udach
ugusikowski
uhansen
ujenkins
ukovacek
ulesch
ulises.beatty
ulises44
ullrich.layne
umraz
una.larkin
unique.pagac
upton.zackery
urban24
uschmeler
uschumm
usmith
uwisoky
uzieme
van.ruecker
vandervort.ezekiel
vbins
vborer
vbraun
vconn
vdickinson
veffertz
velda.wehner
velma37
vena.schumm
verda93
vesta.ritchie
veum.tyrell
vivianne.macejkovic
von.britney
vorn
vpfeffer
vrolfson
vschulist
vvolkman
vwaters
wade91
walker.alec
walsh.vincenza
walter.lester
walter.norval
walton33
warren.feest
watson70
webster48
webster70
weimann.tillman
west.cristobal
west.jude
wiegand.blanche
wilderman.sophia
wilfred.feil
will.edwina
will.jerod
will.lamont
willms.amari
wilson.white
winnifred08
wisozk.cortez
witting.chris
witting.walker
wiza.carmel
wkertzmann
wolff.caroline
wpacocha
wschaefer
wschimmel
wunsch.mose
wwilkinson
xcassin
xgibson
xgutmann
xhermann
xkohler
xrodriguez
yasmin55
yasmine.lowe
ycole
yfritsch
yhudson
yklein
ylarkin
yost.ari
yost.magali
ypredovic
ywiza
ywyman
yyost
zachery33
zboyle
zella78
zheathcote
ziemann.webster
zieme.noemi
zoe41
zstanton
zulauf.amaya
===DONE===
diff --git a/mongodb-1.2.3/tests/functional/query-sort-004.phpt b/mongodb-1.2.8/tests/functional/query-sort-004.phpt
similarity index 95%
rename from mongodb-1.2.3/tests/functional/query-sort-004.phpt
rename to mongodb-1.2.8/tests/functional/query-sort-004.phpt
index 242a4799..267d182b 100644
--- a/mongodb-1.2.3/tests/functional/query-sort-004.phpt
+++ b/mongodb-1.2.8/tests/functional/query-sort-004.phpt
@@ -1,63 +1,63 @@
--TEST--
Sort query option is always serialized as a BSON document
--SKIPIF--
<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
-<?php CLEANUP(STANDALONE); ?>
+<?php NEEDS('STANDALONE'); CLEANUP(STANDALONE); ?>
--FILE--
<?php
require_once __DIR__ . "/../utils/basic.inc";
$manager = new MongoDB\Driver\Manager(STANDALONE);
$bulkWrite = new MongoDB\Driver\BulkWrite;
for ($i = 0; $i < 5; $i++) {
$bulkWrite->insert(array('_id' => $i, '0' => 4 - $i));
}
$writeResult = $manager->executeBulkWrite(NS, $bulkWrite);
printf("Inserted: %d\n", $writeResult->getInsertedCount());
$query = new MongoDB\Driver\Query(array(), array(
'sort' => array('0' => 1),
));
var_dump($query);
$cursor = $manager->executeQuery(NS, $query);
/* Numeric keys of stdClass instances cannot be directly accessed, so ensure the
* document is decoded as a PHP array.
*/
$cursor->setTypeMap(array('root' => 'array'));
foreach ($cursor as $document) {
echo $document['0'] . "\n";
}
?>
===DONE===
<?php exit(0); ?>
--EXPECTF--
Inserted: 5
object(MongoDB\Driver\Query)#%d (%d) {
["filter"]=>
object(stdClass)#%d (%d) {
}
["options"]=>
object(stdClass)#%d (%d) {
["sort"]=>
object(stdClass)#%d (%d) {
[0]=>
int(1)
}
}
["readConcern"]=>
NULL
}
0
1
2
3
4
===DONE===
diff --git a/mongodb-1.2.3/tests/manager/bug0572.phpt b/mongodb-1.2.8/tests/manager/bug0572.phpt
similarity index 88%
rename from mongodb-1.2.3/tests/manager/bug0572.phpt
rename to mongodb-1.2.8/tests/manager/bug0572.phpt
index 59e77191..8f846983 100644
--- a/mongodb-1.2.3/tests/manager/bug0572.phpt
+++ b/mongodb-1.2.8/tests/manager/bug0572.phpt
@@ -1,32 +1,33 @@
--TEST--
PHPC-572: Ensure stream context does not go out of scope before socket init
--SKIPIF--
-<?php require __DIR__ . "/../utils/basic-skipif.inc"; NEEDS("STANDALONE_SSL"); ?>
+<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
+<?php NEEDS('STANDALONE_SSL'); ?>
--FILE--
<?php
require_once __DIR__ . "/../utils/basic.inc";
$closure = function() {
$context = stream_context_create([
'ssl' => [
'verify_peer' => false,
'verify_peer_name' => false,
'allow_self_signed' => true,
],
]);
return new MongoDB\Driver\Manager(STANDALONE_SSL, ['ssl' => true], ['context' => $context]);
};
$manager = $closure();
$cursor = $manager->executeCommand(DATABASE_NAME, new MongoDB\Driver\Command(['ping' => 1]));
var_dump($cursor->toArray()[0]);
?>
===DONE===
<?php exit(0); ?>
--EXPECTF--
object(stdClass)#%d (%d) {
["ok"]=>
float(1)
}
===DONE===
diff --git a/mongodb-1.2.3/tests/manager/bug0851-001.phpt b/mongodb-1.2.8/tests/manager/bug0851-001.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/manager/bug0851-001.phpt
rename to mongodb-1.2.8/tests/manager/bug0851-001.phpt
diff --git a/mongodb-1.2.3/tests/manager/bug0851-002.phpt b/mongodb-1.2.8/tests/manager/bug0851-002.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/manager/bug0851-002.phpt
rename to mongodb-1.2.8/tests/manager/bug0851-002.phpt
diff --git a/mongodb-1.2.8/tests/manager/bug0912-001.phpt b/mongodb-1.2.8/tests/manager/bug0912-001.phpt
new file mode 100644
index 00000000..e2059e3b
--- /dev/null
+++ b/mongodb-1.2.8/tests/manager/bug0912-001.phpt
@@ -0,0 +1,57 @@
+--TEST--
+PHPC-912: Child process should not destroy mongoc_client_t objects from parent
+--SKIPIF--
+<?php if (!function_exists('pcntl_fork')) { die('skip pcntl_fork() not available'); } ?>
+<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
+<?php SLOW(); NEEDS('STANDALONE'); CLEANUP(STANDALONE); ?>
+--FILE--
+<?php
+require_once __DIR__ . "/../utils/basic.inc";
+
+function logMyURI(MongoDB\Driver\Manager $manager)
+{
+ $command = new MongoDB\Driver\Command(['whatsmyuri' => 1]);
+ $cursor = $manager->executeCommand(DATABASE_NAME, $command);
+ $uri = $cursor->toArray()[0]->you;
+
+ $bulk = new MongoDB\Driver\BulkWrite();
+ $bulk->insert(['pid' => getmypid(), 'uri' => $uri]);
+ $manager->executeBulkWrite(NS, $bulk);
+}
+
+$manager = new MongoDB\Driver\Manager(STANDALONE);
+logMyURI($manager);
+
+$parentPid = getmypid();
+$childPid = pcntl_fork();
+
+if ($childPid === 0) {
+ $manager = new MongoDB\Driver\Manager(STANDALONE);
+ logMyURI($manager);
+ exit;
+}
+
+if ($childPid) {
+ $waitPid = pcntl_waitpid($childPid, $status);
+
+ if ($waitPid > 0) {
+ printf("Parent(%d) waited for child(%d) to exit\n", $parentPid, $waitPid);
+ }
+
+ $cursor = $manager->executeQuery(NS, new MongoDB\Driver\Query([]));
+ $results = $cursor->toArray();
+
+ printf("%d connections were logged\n", count($results));
+ printf("PIDs differ: %s\n", $results[0]->pid !== $results[1]->pid ? 'yes' : 'no');
+ printf("URIs differ: %s\n", $results[0]->uri !== $results[1]->uri ? 'yes' : 'no');
+}
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECTF--
+Parent(%d) waited for child(%d) to exit
+2 connections were logged
+PIDs differ: yes
+URIs differ: yes
+===DONE===
diff --git a/mongodb-1.2.8/tests/manager/bug0913-001.phpt b/mongodb-1.2.8/tests/manager/bug0913-001.phpt
new file mode 100644
index 00000000..bdbef7dc
--- /dev/null
+++ b/mongodb-1.2.8/tests/manager/bug0913-001.phpt
@@ -0,0 +1,67 @@
+--TEST--
+PHPC-913: Child process should not re-use mongoc_client_t objects from parent
+--SKIPIF--
+<?php if (!function_exists('pcntl_fork')) { die('skip pcntl_fork() not available'); } ?>
+<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
+<?php SLOW(); NEEDS('STANDALONE'); CLEANUP(STANDALONE); ?>
+--FILE--
+<?php
+require_once __DIR__ . "/../utils/basic.inc";
+
+function logMyURI(MongoDB\Driver\Manager $manager)
+{
+ $command = new MongoDB\Driver\Command(['whatsmyuri' => 1]);
+ $cursor = $manager->executeCommand(DATABASE_NAME, $command);
+ $uri = $cursor->toArray()[0]->you;
+
+ $bulk = new MongoDB\Driver\BulkWrite();
+ $bulk->insert(['pid' => getmypid(), 'uri' => $uri]);
+ $manager->executeBulkWrite(NS, $bulk);
+}
+
+$manager = new MongoDB\Driver\Manager(STANDALONE);
+logMyURI($manager);
+
+$parentPid = getmypid();
+$childPid = pcntl_fork();
+
+if ($childPid === 0) {
+ $manager = new MongoDB\Driver\Manager(STANDALONE);
+ logMyURI($manager);
+
+ /* Due to PHPC-912, we cannot allow the child process to terminate before
+ * the parent is done using its client, lest it destroy the mongoc_client_t
+ * object and shutdown its socket(s). Sleep for 250ms to allow the parent
+ * time to query for our logged URI. */
+ usleep(250000);
+ exit;
+}
+
+if ($childPid) {
+ /* Sleep for 100ms to allow the child time to log its URI. Ideally, we would
+ * wait for the child to finish, but PHPC-912 prevents us from doing so. */
+ usleep(100000);
+
+ $cursor = $manager->executeQuery(NS, new MongoDB\Driver\Query([]));
+ $results = $cursor->toArray();
+
+ printf("%d connections were logged\n", count($results));
+ printf("PIDs differ: %s\n", $results[0]->pid !== $results[1]->pid ? 'yes' : 'no');
+ printf("URIs differ: %s\n", $results[0]->uri !== $results[1]->uri ? 'yes' : 'no');
+
+ $waitPid = pcntl_waitpid($childPid, $status);
+
+ if ($waitPid > 0) {
+ printf("Parent(%d) waited for child(%d) to exit\n", $parentPid, $waitPid);
+ }
+}
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECTF--
+2 connections were logged
+PIDs differ: yes
+URIs differ: yes
+Parent(%d) waited for child(%d) to exit
+===DONE===
diff --git a/mongodb-1.2.3/tests/manager/manager-ctor-001.phpt b/mongodb-1.2.8/tests/manager/manager-ctor-001.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/manager/manager-ctor-001.phpt
rename to mongodb-1.2.8/tests/manager/manager-ctor-001.phpt
diff --git a/mongodb-1.2.3/tests/manager/manager-ctor-002.phpt b/mongodb-1.2.8/tests/manager/manager-ctor-002.phpt
similarity index 68%
rename from mongodb-1.2.3/tests/manager/manager-ctor-002.phpt
rename to mongodb-1.2.8/tests/manager/manager-ctor-002.phpt
index 543f2ea1..8044f9c7 100644
--- a/mongodb-1.2.3/tests/manager/manager-ctor-002.phpt
+++ b/mongodb-1.2.8/tests/manager/manager-ctor-002.phpt
@@ -1,15 +1,16 @@
--TEST--
MongoDB\Driver\Manager::__construct() with URI
--SKIPIF--
-<?php require __DIR__ . "/../utils/basic-skipif.inc"; CLEANUP(STANDALONE) ?>
+<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
+<?php NEEDS('STANDALONE'); CLEANUP(STANDALONE); ?>
--FILE--
<?php
require_once __DIR__ . "/../utils/basic.inc";
$manager = new MongoDB\Driver\Manager(STANDALONE);
?>
===DONE===
<?php exit(0); ?>
--EXPECT--
===DONE===
diff --git a/mongodb-1.2.3/tests/manager/manager-ctor-003.phpt b/mongodb-1.2.8/tests/manager/manager-ctor-003.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/manager/manager-ctor-003.phpt
rename to mongodb-1.2.8/tests/manager/manager-ctor-003.phpt
diff --git a/mongodb-1.2.3/tests/manager/manager-ctor-appname-001.phpt b/mongodb-1.2.8/tests/manager/manager-ctor-appname-001.phpt
similarity index 80%
rename from mongodb-1.2.3/tests/manager/manager-ctor-appname-001.phpt
rename to mongodb-1.2.8/tests/manager/manager-ctor-appname-001.phpt
index 6141a8df..3064ff5e 100644
--- a/mongodb-1.2.3/tests/manager/manager-ctor-appname-001.phpt
+++ b/mongodb-1.2.8/tests/manager/manager-ctor-appname-001.phpt
@@ -1,20 +1,21 @@
--TEST--
MongoDB\Driver\Manager::__construct(): appname option
--SKIPIF--
-<?php require __DIR__ . "/../utils/basic-skipif.inc"; CLEANUP(STANDALONE) ?>
+<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
+<?php NEEDS('STANDALONE'); CLEANUP(STANDALONE); ?>
--FILE--
<?php
require_once __DIR__ . "/../utils/basic.inc";
$name1 = str_repeat('PHONGO', 20);
$name2 = str_repeat('PHONGO', 20);
$manager = new \MongoDB\Driver\Manager(STANDALONE . "/?appname={$name1}", ['appname' => "2-{$name2}"]);
$command = new MongoDB\Driver\Command(['ping' => 1]);
$manager->executeCommand("test", $command);
?>
===DONE===
--EXPECT--
===DONE===
diff --git a/mongodb-1.2.3/tests/manager/manager-ctor-appname_error-001.phpt b/mongodb-1.2.8/tests/manager/manager-ctor-appname_error-001.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/manager/manager-ctor-appname_error-001.phpt
rename to mongodb-1.2.8/tests/manager/manager-ctor-appname_error-001.phpt
diff --git a/mongodb-1.2.3/tests/manager/manager-ctor-read_preference-001.phpt b/mongodb-1.2.8/tests/manager/manager-ctor-read_preference-001.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/manager/manager-ctor-read_preference-001.phpt
rename to mongodb-1.2.8/tests/manager/manager-ctor-read_preference-001.phpt
diff --git a/mongodb-1.2.3/tests/manager/manager-ctor-read_preference-002.phpt b/mongodb-1.2.8/tests/manager/manager-ctor-read_preference-002.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/manager/manager-ctor-read_preference-002.phpt
rename to mongodb-1.2.8/tests/manager/manager-ctor-read_preference-002.phpt
diff --git a/mongodb-1.2.3/tests/manager/manager-ctor-read_preference-003.phpt b/mongodb-1.2.8/tests/manager/manager-ctor-read_preference-003.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/manager/manager-ctor-read_preference-003.phpt
rename to mongodb-1.2.8/tests/manager/manager-ctor-read_preference-003.phpt
diff --git a/mongodb-1.2.8/tests/manager/manager-ctor-read_preference-004.phpt b/mongodb-1.2.8/tests/manager/manager-ctor-read_preference-004.phpt
new file mode 100644
index 00000000..c0ef0b2d
--- /dev/null
+++ b/mongodb-1.2.8/tests/manager/manager-ctor-read_preference-004.phpt
@@ -0,0 +1,130 @@
+--TEST--
+MongoDB\Driver\Manager::__construct(): read preference options (slaveok)
+--FILE--
+<?php
+
+$tests = [
+ ['mongodb://127.0.0.1/?slaveok=true', []],
+ ['mongodb://127.0.0.1/?slaveok=false', []],
+ // True array option will override any read preference in the URI string
+ ['mongodb://127.0.0.1/?slaveok=false', ['slaveok' => true]],
+ ['mongodb://127.0.0.1/?readPreference=nearest', ['slaveok' => true]],
+ // False array option is ignored
+ ['mongodb://127.0.0.1/?slaveok=true', ['slaveok' => false]],
+ ['mongodb://127.0.0.1/?readPreference=nearest', ['slaveok' => false]],
+ // readPreference option takes priority
+ ['mongodb://127.0.0.1/?slaveok=true&readPreference=nearest', []],
+ ['mongodb://127.0.0.1/?slaveok=false&readPreference=nearest', []],
+ ['mongodb://127.0.0.1/?slaveok=true', ['readPreference' => 'nearest']],
+ ['mongodb://127.0.0.1/?slaveok=false', ['readPreference' => 'nearest']],
+ [null, ['readPreference' => 'nearest', 'slaveok' => true]],
+ [null, ['readPreference' => 'nearest', 'slaveok' => true]],
+ // Alternative values for true in URI string (all other strings are false)
+ ['mongodb://127.0.0.1/?slaveok=t', []],
+ ['mongodb://127.0.0.1/?slaveok=1', []],
+ ['mongodb://127.0.0.1/?slaveok=anything_other_than_true_t_and_0', []],
+ // Case insensitivity for URI string and array options
+ ['mongodb://127.0.0.1/?slaveOk=True', []],
+ ['mongodb://127.0.0.1/?SLAVEOK=TRUE', []],
+ [null, ['slaveOk' => true]],
+ [null, ['SLAVEOK' => true]],
+ // Strict type checking on options array (non-booleans are ignored)
+ [null, ['slaveok' => 'true']],
+ [null, ['slaveok' => 1]],
+];
+
+foreach ($tests as $test) {
+ list($uri, $options) = $test;
+
+ $manager = new MongoDB\Driver\Manager($uri, $options);
+ var_dump($manager->getReadPreference());
+}
+
+?>
+===DONE===
+--EXPECTF--
+object(MongoDB\Driver\ReadPreference)#%d (%d) {
+ ["mode"]=>
+ string(18) "secondaryPreferred"
+}
+object(MongoDB\Driver\ReadPreference)#%d (%d) {
+ ["mode"]=>
+ string(7) "primary"
+}
+object(MongoDB\Driver\ReadPreference)#%d (%d) {
+ ["mode"]=>
+ string(18) "secondaryPreferred"
+}
+object(MongoDB\Driver\ReadPreference)#%d (%d) {
+ ["mode"]=>
+ string(18) "secondaryPreferred"
+}
+object(MongoDB\Driver\ReadPreference)#%d (%d) {
+ ["mode"]=>
+ string(18) "secondaryPreferred"
+}
+object(MongoDB\Driver\ReadPreference)#%d (%d) {
+ ["mode"]=>
+ string(7) "nearest"
+}
+object(MongoDB\Driver\ReadPreference)#%d (%d) {
+ ["mode"]=>
+ string(7) "nearest"
+}
+object(MongoDB\Driver\ReadPreference)#%d (%d) {
+ ["mode"]=>
+ string(7) "nearest"
+}
+object(MongoDB\Driver\ReadPreference)#%d (%d) {
+ ["mode"]=>
+ string(7) "nearest"
+}
+object(MongoDB\Driver\ReadPreference)#%d (%d) {
+ ["mode"]=>
+ string(7) "nearest"
+}
+object(MongoDB\Driver\ReadPreference)#%d (%d) {
+ ["mode"]=>
+ string(7) "nearest"
+}
+object(MongoDB\Driver\ReadPreference)#%d (%d) {
+ ["mode"]=>
+ string(7) "nearest"
+}
+object(MongoDB\Driver\ReadPreference)#%d (%d) {
+ ["mode"]=>
+ string(18) "secondaryPreferred"
+}
+object(MongoDB\Driver\ReadPreference)#%d (%d) {
+ ["mode"]=>
+ string(18) "secondaryPreferred"
+}
+object(MongoDB\Driver\ReadPreference)#%d (%d) {
+ ["mode"]=>
+ string(7) "primary"
+}
+object(MongoDB\Driver\ReadPreference)#%d (%d) {
+ ["mode"]=>
+ string(18) "secondaryPreferred"
+}
+object(MongoDB\Driver\ReadPreference)#%d (%d) {
+ ["mode"]=>
+ string(18) "secondaryPreferred"
+}
+object(MongoDB\Driver\ReadPreference)#%d (%d) {
+ ["mode"]=>
+ string(18) "secondaryPreferred"
+}
+object(MongoDB\Driver\ReadPreference)#%d (%d) {
+ ["mode"]=>
+ string(18) "secondaryPreferred"
+}
+object(MongoDB\Driver\ReadPreference)#%d (%d) {
+ ["mode"]=>
+ string(7) "primary"
+}
+object(MongoDB\Driver\ReadPreference)#%d (%d) {
+ ["mode"]=>
+ string(7) "primary"
+}
+===DONE===
diff --git a/mongodb-1.2.3/tests/manager/manager-ctor-read_preference-error-001.phpt b/mongodb-1.2.8/tests/manager/manager-ctor-read_preference-error-001.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/manager/manager-ctor-read_preference-error-001.phpt
rename to mongodb-1.2.8/tests/manager/manager-ctor-read_preference-error-001.phpt
diff --git a/mongodb-1.2.3/tests/manager/manager-ctor-read_preference-error-002.phpt b/mongodb-1.2.8/tests/manager/manager-ctor-read_preference-error-002.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/manager/manager-ctor-read_preference-error-002.phpt
rename to mongodb-1.2.8/tests/manager/manager-ctor-read_preference-error-002.phpt
diff --git a/mongodb-1.2.3/tests/manager/manager-ctor-write_concern-error-001.phpt b/mongodb-1.2.8/tests/manager/manager-ctor-write_concern-error-001.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/manager/manager-ctor-write_concern-error-001.phpt
rename to mongodb-1.2.8/tests/manager/manager-ctor-write_concern-error-001.phpt
diff --git a/mongodb-1.2.3/tests/manager/manager-ctor_error-001.phpt b/mongodb-1.2.8/tests/manager/manager-ctor_error-001.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/manager/manager-ctor_error-001.phpt
rename to mongodb-1.2.8/tests/manager/manager-ctor_error-001.phpt
diff --git a/mongodb-1.2.3/tests/manager/manager-ctor_error-002.phpt b/mongodb-1.2.8/tests/manager/manager-ctor_error-002.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/manager/manager-ctor_error-002.phpt
rename to mongodb-1.2.8/tests/manager/manager-ctor_error-002.phpt
diff --git a/mongodb-1.2.8/tests/manager/manager-debug-001.phpt b/mongodb-1.2.8/tests/manager/manager-debug-001.phpt
new file mode 100644
index 00000000..68a4ece7
--- /dev/null
+++ b/mongodb-1.2.8/tests/manager/manager-debug-001.phpt
@@ -0,0 +1,28 @@
+--TEST--
+MongoDB\Driver\Manager: Writing debug log files
+--SKIPIF--
+<?php if (defined("HHVM_VERSION_ID")) exit("skip HHVM uses HHVM's logging functionality"); ?>
+--FILE--
+<?php
+
+$name = tempnam(sys_get_temp_dir(), "PHONGO");
+unlink($name);
+mkdir($name);
+
+ini_set('mongodb.debug', $name);
+$manager = new MongoDB\Driver\Manager;
+ini_set('mongodb.debug', 'off');
+
+foreach (glob($name."/*") as $file) {
+ echo file_get_contents($file);
+ unlink($file);
+}
+rmdir($name);
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECTF--
+%A[%s] PHONGO: DEBUG > Connection string: '%s'
+[%s] PHONGO: DEBUG > Creating Manager, phongo-1.%d.%d%S[%s] - mongoc-1.%s(%s), libbson-1.%s(%s), php-%s
+%A===DONE===%A
diff --git a/mongodb-1.2.3/tests/manager/manager-debug-002.phpt b/mongodb-1.2.8/tests/manager/manager-debug-002.phpt
similarity index 52%
rename from mongodb-1.2.3/tests/manager/manager-debug-002.phpt
rename to mongodb-1.2.8/tests/manager/manager-debug-002.phpt
index f68f7363..e98aa27a 100644
--- a/mongodb-1.2.3/tests/manager/manager-debug-002.phpt
+++ b/mongodb-1.2.8/tests/manager/manager-debug-002.phpt
@@ -1,25 +1,18 @@
--TEST--
MongoDB\Driver\Manager: mongodb.debug=stderr
--SKIPIF--
<?php if (defined("HHVM_VERSION_ID")) exit("skip HHVM uses HHVM's logging functionality"); ?>
-<?php require __DIR__ . "/../utils/basic-skipif.inc"; CLEANUP(STANDALONE) ?>
--INI--
mongodb.debug=stderr
--FILE--
<?php
-require_once __DIR__ . "/../utils/basic.inc";
-$manager = new MongoDB\Driver\Manager(STANDALONE);
-$bulk = new MongoDB\Driver\BulkWrite();
-$bulk->insert(array('_id' => 1, 'x' => 1));
-$result = $manager->executeBulkWrite(NS, $bulk);
+$manager = new MongoDB\Driver\Manager;
?>
===DONE===
<?php exit(0); ?>
--EXPECTF--
-%a
+%A[%s] PHONGO: DEBUG > Connection string: '%s'
[%s] PHONGO: DEBUG > Creating Manager, phongo-1.%d.%d%S[%s] - mongoc-1.%s(%s), libbson-1.%s(%s), php-%s
-%a
-===DONE===
-%a
+%A===DONE===%A
diff --git a/mongodb-1.2.3/tests/manager/manager-destruct-001.phpt b/mongodb-1.2.8/tests/manager/manager-destruct-001.phpt
similarity index 90%
rename from mongodb-1.2.3/tests/manager/manager-destruct-001.phpt
rename to mongodb-1.2.8/tests/manager/manager-destruct-001.phpt
index 9a5119f6..40e80fc6 100644
--- a/mongodb-1.2.3/tests/manager/manager-destruct-001.phpt
+++ b/mongodb-1.2.8/tests/manager/manager-destruct-001.phpt
@@ -1,38 +1,39 @@
--TEST--
MongoDB\Driver\Manager destruct should not free streams that are still in use
--SKIPIF--
-<?php require __DIR__ . "/../utils/basic-skipif.inc"; CLEANUP(STANDALONE) ?>
+<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
+<?php NEEDS('STANDALONE'); CLEANUP(STANDALONE); ?>
--INI--
ignore_repeated_errors=1
--FILE--
<?php
require_once __DIR__ . "/../utils/basic.inc";
$manager1 = new MongoDB\Driver\Manager(STANDALONE);
$manager2 = new MongoDB\Driver\Manager(STANDALONE);
$bulk = new MongoDB\Driver\BulkWrite();
$bulk->insert(array('_id' => 1));
$writeResult = $manager1->executeBulkWrite(NS, $bulk);
printf("Inserted: %d\n", $writeResult->getInsertedCount());
$bulk = new MongoDB\Driver\BulkWrite();
$bulk->insert(array('_id' => 2));
$writeResult = $manager2->executeBulkWrite(NS, $bulk);
printf("Inserted: %d\n", $writeResult->getInsertedCount());
$manager2 = null;
$bulk = new MongoDB\Driver\BulkWrite();
$bulk->insert(array('_id' => 3));
$writeResult = $manager1->executeBulkWrite(NS, $bulk);
printf("Inserted: %d\n", $writeResult->getInsertedCount());
?>
===DONE===
<?php exit(0); ?>
--EXPECT--
Inserted: 1
Inserted: 1
Inserted: 1
===DONE===
diff --git a/mongodb-1.2.3/tests/manager/manager-executeBulkWrite-001.phpt b/mongodb-1.2.8/tests/manager/manager-executeBulkWrite-001.phpt
similarity index 91%
rename from mongodb-1.2.3/tests/manager/manager-executeBulkWrite-001.phpt
rename to mongodb-1.2.8/tests/manager/manager-executeBulkWrite-001.phpt
index 1a501f28..99e5338b 100644
--- a/mongodb-1.2.3/tests/manager/manager-executeBulkWrite-001.phpt
+++ b/mongodb-1.2.8/tests/manager/manager-executeBulkWrite-001.phpt
@@ -1,57 +1,58 @@
--TEST--
MongoDB\Driver\Manager::executeBulkWrite()
--SKIPIF--
-<?php require __DIR__ . "/../utils/basic-skipif.inc"; CLEANUP(STANDALONE) ?>
+<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
+<?php NEEDS('STANDALONE'); CLEANUP(STANDALONE); ?>
--FILE--
<?php
require_once __DIR__ . "/../utils/basic.inc";
$manager = new MongoDB\Driver\Manager(STANDALONE);
$bulk = new MongoDB\Driver\BulkWrite();
$bulk->insert(array('_id' => 1, 'x' => 1));
$bulk->insert(array('_id' => 2, 'x' => 2));
$bulk->update(array('x' => 2), array('$set' => array('x' => 1)), array("limit" => 1, "upsert" => false));
$bulk->update(array('_id' => 3), array('$set' => array('x' => 3)), array("limit" => 1, "upsert" => true));
$bulk->delete(array('x' => 1), array("limit" => 1));
$result = $manager->executeBulkWrite(NS, $bulk);
echo "\n===> WriteResult\n";
printWriteResult($result);
echo "\n===> Collection\n";
$cursor = $manager->executeQuery(NS, new MongoDB\Driver\Query(array()));
var_dump(iterator_to_array($cursor));
?>
===DONE===
<?php exit(0); ?>
--EXPECTF--
===> WriteResult
server: %s:%d
insertedCount: 2
matchedCount: 1
modifiedCount: 1
upsertedCount: 1
deletedCount: 1
upsertedId[3]: int(3)
===> Collection
array(2) {
[0]=>
object(stdClass)#%d (2) {
["_id"]=>
int(2)
["x"]=>
int(1)
}
[1]=>
object(stdClass)#%d (2) {
["_id"]=>
int(3)
["x"]=>
int(3)
}
}
===DONE===
diff --git a/mongodb-1.2.3/tests/manager/manager-executeBulkWrite-002.phpt b/mongodb-1.2.8/tests/manager/manager-executeBulkWrite-002.phpt
similarity index 93%
rename from mongodb-1.2.3/tests/manager/manager-executeBulkWrite-002.phpt
rename to mongodb-1.2.8/tests/manager/manager-executeBulkWrite-002.phpt
index 925e8d6f..e21404d3 100644
--- a/mongodb-1.2.3/tests/manager/manager-executeBulkWrite-002.phpt
+++ b/mongodb-1.2.8/tests/manager/manager-executeBulkWrite-002.phpt
@@ -1,72 +1,73 @@
--TEST--
MongoDB\Driver\Manager::executeBulkWrite() with upserted ids
--SKIPIF--
-<?php require __DIR__ . "/../utils/basic-skipif.inc"; CLEANUP(STANDALONE) ?>
+<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
+<?php NEEDS('STANDALONE'); CLEANUP(STANDALONE); ?>
--FILE--
<?php
require_once __DIR__ . "/../utils/basic.inc";
$manager = new MongoDB\Driver\Manager(STANDALONE);
$bulk = new MongoDB\Driver\BulkWrite(['ordered' => false]);
$bulk->update(array('x' => 'foo'), array('$set' => array('y' => 'foo')), array('upsert' => true));
$bulk->update(array('x' => 'bar'), array('$set' => array('y' => 'bar')), array('upsert' => true));
$bulk->update(array('x' => 'foo'), array('$set' => array('y' => 'bar')));
$result = $manager->executeBulkWrite(NS, $bulk);
echo "\n===> WriteResult\n";
printWriteResult($result);
echo "\n===> Collection\n";
$cursor = $manager->executeQuery(NS, new MongoDB\Driver\Query(array()));
var_dump(iterator_to_array($cursor));
?>
===DONE===
<?php exit(0); ?>
--EXPECTF--
===> WriteResult
server: %s:%d
insertedCount: 0
matchedCount: 1
modifiedCount: 1
upsertedCount: 2
deletedCount: 0
upsertedId[0]: object(%s\ObjectID)#%d (%d) {
["oid"]=>
string(24) "%s"
}
upsertedId[1]: object(%s\ObjectID)#%d (%d) {
["oid"]=>
string(24) "%s"
}
===> Collection
array(2) {
[0]=>
object(stdClass)#%d (3) {
["_id"]=>
object(%s\ObjectID)#%d (%d) {
["oid"]=>
string(24) "%s"
}
["x"]=>
string(3) "foo"
["y"]=>
string(3) "bar"
}
[1]=>
object(stdClass)#%d (3) {
["_id"]=>
object(%s\ObjectID)#%d (%d) {
["oid"]=>
string(24) "%s"
}
["x"]=>
string(3) "bar"
["y"]=>
string(3) "bar"
}
}
===DONE===
diff --git a/mongodb-1.2.3/tests/manager/manager-executeBulkWrite-003.phpt b/mongodb-1.2.8/tests/manager/manager-executeBulkWrite-003.phpt
similarity index 90%
rename from mongodb-1.2.3/tests/manager/manager-executeBulkWrite-003.phpt
rename to mongodb-1.2.8/tests/manager/manager-executeBulkWrite-003.phpt
index 7662ef30..9617dba1 100644
--- a/mongodb-1.2.3/tests/manager/manager-executeBulkWrite-003.phpt
+++ b/mongodb-1.2.8/tests/manager/manager-executeBulkWrite-003.phpt
@@ -1,50 +1,51 @@
--TEST--
MongoDB\Driver\Manager::executeBulkWrite() delete one document
--SKIPIF--
-<?php require __DIR__ . "/../utils/basic-skipif.inc"; CLEANUP(STANDALONE) ?>
+<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
+<?php NEEDS('STANDALONE'); CLEANUP(STANDALONE); ?>
--FILE--
<?php
require_once __DIR__ . "/../utils/basic.inc";
$manager = new MongoDB\Driver\Manager(STANDALONE);
// load fixtures for test
$bulk = new MongoDB\Driver\BulkWrite();
$bulk->insert(array('_id' => 1, 'x' => 1));
$bulk->insert(array('_id' => 2, 'x' => 1));
$manager->executeBulkWrite(NS, $bulk);
$bulk = new MongoDB\Driver\BulkWrite();
$bulk->delete(array('x' => 1), array('limit' => 1));
$result = $manager->executeBulkWrite(NS, $bulk);
echo "\n===> WriteResult\n";
printWriteResult($result);
echo "\n===> Collection\n";
$cursor = $manager->executeQuery(NS, new MongoDB\Driver\Query(array()));
var_dump(iterator_to_array($cursor));
?>
===DONE===
<?php exit(0); ?>
--EXPECTF--
===> WriteResult
server: %s:%d
insertedCount: 0
matchedCount: 0
modifiedCount: 0
upsertedCount: 0
deletedCount: 1
===> Collection
array(1) {
[0]=>
object(stdClass)#%d (2) {
["_id"]=>
int(2)
["x"]=>
int(1)
}
}
===DONE===
diff --git a/mongodb-1.2.3/tests/manager/manager-executeBulkWrite-004.phpt b/mongodb-1.2.8/tests/manager/manager-executeBulkWrite-004.phpt
similarity index 89%
rename from mongodb-1.2.3/tests/manager/manager-executeBulkWrite-004.phpt
rename to mongodb-1.2.8/tests/manager/manager-executeBulkWrite-004.phpt
index 9f8d80be..d83a2a3d 100644
--- a/mongodb-1.2.3/tests/manager/manager-executeBulkWrite-004.phpt
+++ b/mongodb-1.2.8/tests/manager/manager-executeBulkWrite-004.phpt
@@ -1,44 +1,45 @@
--TEST--
MongoDB\Driver\Manager::executeBulkWrite() delete multiple documents
--SKIPIF--
-<?php require __DIR__ . "/../utils/basic-skipif.inc"; CLEANUP(STANDALONE) ?>
+<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
+<?php NEEDS('STANDALONE'); CLEANUP(STANDALONE); ?>
--FILE--
<?php
require_once __DIR__ . "/../utils/basic.inc";
$manager = new MongoDB\Driver\Manager(STANDALONE);
// load fixtures for test
$bulk = new MongoDB\Driver\BulkWrite();
$bulk->insert(array('_id' => 1, 'x' => 1));
$bulk->insert(array('_id' => 2, 'x' => 1));
$manager->executeBulkWrite(NS, $bulk);
$bulk = new MongoDB\Driver\BulkWrite();
$bulk->delete(array('x' => 1), array('limit' => 0));
$result = $manager->executeBulkWrite(NS, $bulk);
echo "\n===> WriteResult\n";
printWriteResult($result);
echo "\n===> Collection\n";
$cursor = $manager->executeQuery(NS, new MongoDB\Driver\Query(array()));
var_dump(iterator_to_array($cursor));
?>
===DONE===
<?php exit(0); ?>
--EXPECTF--
===> WriteResult
server: %s:%d
insertedCount: 0
matchedCount: 0
modifiedCount: 0
upsertedCount: 0
deletedCount: 2
===> Collection
array(0) {
}
===DONE===
diff --git a/mongodb-1.2.3/tests/manager/manager-executeBulkWrite-005.phpt b/mongodb-1.2.8/tests/manager/manager-executeBulkWrite-005.phpt
similarity index 88%
rename from mongodb-1.2.3/tests/manager/manager-executeBulkWrite-005.phpt
rename to mongodb-1.2.8/tests/manager/manager-executeBulkWrite-005.phpt
index d539bf22..04fd5323 100644
--- a/mongodb-1.2.3/tests/manager/manager-executeBulkWrite-005.phpt
+++ b/mongodb-1.2.8/tests/manager/manager-executeBulkWrite-005.phpt
@@ -1,44 +1,45 @@
--TEST--
MongoDB\Driver\Manager::executeBulkWrite() insert one document
--SKIPIF--
-<?php require __DIR__ . "/../utils/basic-skipif.inc"; CLEANUP(STANDALONE) ?>
+<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
+<?php NEEDS('STANDALONE'); CLEANUP(STANDALONE); ?>
--FILE--
<?php
require_once __DIR__ . "/../utils/basic.inc";
$manager = new MongoDB\Driver\Manager(STANDALONE);
$bulk = new MongoDB\Driver\BulkWrite();
$bulk->insert(array('_id' => 1, 'x' => 1));
$result = $manager->executeBulkWrite(NS, $bulk);
echo "\n===> WriteResult\n";
printWriteResult($result);
echo "\n===> Collection\n";
$cursor = $manager->executeQuery(NS, new MongoDB\Driver\Query(array()));
var_dump(iterator_to_array($cursor));
?>
===DONE===
<?php exit(0); ?>
--EXPECTF--
===> WriteResult
server: %s:%d
insertedCount: 1
matchedCount: 0
modifiedCount: 0
upsertedCount: 0
deletedCount: 0
===> Collection
array(1) {
[0]=>
object(stdClass)#%d (2) {
["_id"]=>
int(1)
["x"]=>
int(1)
}
}
===DONE===
diff --git a/mongodb-1.2.3/tests/manager/manager-executeBulkWrite-006.phpt b/mongodb-1.2.8/tests/manager/manager-executeBulkWrite-006.phpt
similarity index 94%
rename from mongodb-1.2.3/tests/manager/manager-executeBulkWrite-006.phpt
rename to mongodb-1.2.8/tests/manager/manager-executeBulkWrite-006.phpt
index 48115075..6bebfe17 100644
--- a/mongodb-1.2.3/tests/manager/manager-executeBulkWrite-006.phpt
+++ b/mongodb-1.2.8/tests/manager/manager-executeBulkWrite-006.phpt
@@ -1,92 +1,93 @@
--TEST--
MongoDB\Driver\Manager::executeBulkWrite() insert one document (with embedded)
--SKIPIF--
-<?php require __DIR__ . "/../utils/basic-skipif.inc"; CLEANUP(STANDALONE) ?>
+<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
+<?php NEEDS('STANDALONE'); CLEANUP(STANDALONE); ?>
--FILE--
<?php
require_once __DIR__ . "/../utils/basic.inc";
require_once __DIR__ . "/../utils/classes.inc";
$manager = new MongoDB\Driver\Manager(STANDALONE);
$hannes = new Person("Hannes", 42);
$sunnyvale = new Address(94086, "USA");
$kopavogur = new Address(200, "Iceland");
$hannes->addAddress($sunnyvale);
$hannes->addAddress($kopavogur);
$mikola = new Person("Jeremy", 21);
$michigan = new Address(48169, "USA");
$hannes->addFriend($mikola);
$bulk = new MongoDB\Driver\BulkWrite();
$bulk->insert($hannes);
$result = $manager->executeBulkWrite(NS, $bulk);
echo "\n===> WriteResult\n";
printWriteResult($result);
echo "\n===> Collection\n";
$cursor = $manager->executeQuery(NS, new MongoDB\Driver\Query(array()));
foreach($cursor as $object) {
var_dump($object);
}
?>
===DONE===
<?php exit(0); ?>
--EXPECTF--
===> WriteResult
server: %s:%d
insertedCount: 1
matchedCount: 0
modifiedCount: 0
upsertedCount: 0
deletedCount: 0
===> Collection
object(Person)#%d (5) {
["name":protected]=>
string(6) "Hannes"
["age":protected]=>
int(42)
["addresses":protected]=>
array(2) {
[0]=>
object(Address)#%d (2) {
["zip":protected]=>
int(94086)
["country":protected]=>
string(3) "USA"
}
[1]=>
object(Address)#%d (2) {
["zip":protected]=>
int(200)
["country":protected]=>
string(7) "Iceland"
}
}
["friends":protected]=>
array(1) {
[0]=>
object(Person)#%d (5) {
["name":protected]=>
string(6) "Jeremy"
["age":protected]=>
int(21)
["addresses":protected]=>
array(0) {
}
["friends":protected]=>
array(0) {
}
["secret":protected]=>
string(4) "none"
}
}
["secret":protected]=>
string(4) "none"
}
===DONE===
diff --git a/mongodb-1.2.3/tests/manager/manager-executeBulkWrite-007.phpt b/mongodb-1.2.8/tests/manager/manager-executeBulkWrite-007.phpt
similarity index 90%
rename from mongodb-1.2.3/tests/manager/manager-executeBulkWrite-007.phpt
rename to mongodb-1.2.8/tests/manager/manager-executeBulkWrite-007.phpt
index 99d7562a..75249b9a 100644
--- a/mongodb-1.2.3/tests/manager/manager-executeBulkWrite-007.phpt
+++ b/mongodb-1.2.8/tests/manager/manager-executeBulkWrite-007.phpt
@@ -1,53 +1,54 @@
--TEST--
MongoDB\Driver\Manager::executeBulkWrite() update one document with no upsert
--SKIPIF--
-<?php require __DIR__ . "/../utils/basic-skipif.inc"; CLEANUP(STANDALONE) ?>
+<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
+<?php NEEDS('STANDALONE'); CLEANUP(STANDALONE); ?>
--FILE--
<?php
require_once __DIR__ . "/../utils/basic.inc";
$manager = new MongoDB\Driver\Manager(STANDALONE);
// load fixtures for test
$bulk = new MongoDB\Driver\BulkWrite();
$bulk->insert(array('_id' => 1, 'x' => 1));
$manager->executeBulkWrite(NS, $bulk);
$bulk = new MongoDB\Driver\BulkWrite();
$bulk->update(
array('_id' => 1),
array('$set' => array('x' => 2)),
array('multi' => false, 'upsert' => false)
);
$result = $manager->executeBulkWrite(NS, $bulk);
echo "\n===> WriteResult\n";
printWriteResult($result);
echo "\n===> Collection\n";
$cursor = $manager->executeQuery(NS, new MongoDB\Driver\Query(array()));
var_dump(iterator_to_array($cursor));
?>
===DONE===
<?php exit(0); ?>
--EXPECTF--
===> WriteResult
server: %s:%d
insertedCount: 0
matchedCount: 1
modifiedCount: 1
upsertedCount: 0
deletedCount: 0
===> Collection
array(1) {
[0]=>
object(stdClass)#%d (2) {
["_id"]=>
int(1)
["x"]=>
int(2)
}
}
===DONE===
diff --git a/mongodb-1.2.3/tests/manager/manager-executeBulkWrite-008.phpt b/mongodb-1.2.8/tests/manager/manager-executeBulkWrite-008.phpt
similarity index 92%
rename from mongodb-1.2.3/tests/manager/manager-executeBulkWrite-008.phpt
rename to mongodb-1.2.8/tests/manager/manager-executeBulkWrite-008.phpt
index 35adb512..d4aed4d0 100644
--- a/mongodb-1.2.3/tests/manager/manager-executeBulkWrite-008.phpt
+++ b/mongodb-1.2.8/tests/manager/manager-executeBulkWrite-008.phpt
@@ -1,70 +1,71 @@
--TEST--
MongoDB\Driver\Manager::executeBulkWrite() update multiple documents with no upsert
--SKIPIF--
<?php if (getenv("TRAVIS")) exit("skip This oddly enough fails on travis and I cannot figureout why") ?>
-<?php require __DIR__ . "/../utils/basic-skipif.inc"; CLEANUP(STANDALONE) ?>
+<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
+<?php NEEDS('STANDALONE'); CLEANUP(STANDALONE); ?>
--FILE--
<?php
require_once __DIR__ . "/../utils/basic.inc";
$manager = new MongoDB\Driver\Manager(STANDALONE);
// load fixtures for test
$bulk = new MongoDB\Driver\BulkWrite();
$bulk->insert(array('_id' => 1, 'x' => 1));
$bulk->insert(array('_id' => 2, 'x' => 1));
$bulk->insert(array('_id' => 3, 'x' => 3));
$manager->executeBulkWrite(NS, $bulk);
$bulk = new MongoDB\Driver\BulkWrite();
$bulk->update(
array('x' => 1),
array('$set' => array('x' => 2)),
array('multi' => true, 'upsert' => false)
);
$result = $manager->executeBulkWrite(NS, $bulk);
echo "\n===> WriteResult\n";
printWriteResult($result);
echo "\n===> Collection\n";
$cursor = $manager->executeQuery(NS, new MongoDB\Driver\Query(array()));
var_dump(iterator_to_array($cursor));
?>
===DONE===
<?php exit(0); ?>
--EXPECTF--
===> WriteResult
server: %s:%d
insertedCount: 0
matchedCount: 2
modifiedCount: 2
upsertedCount: 0
deletedCount: 0
===> Collection
array(3) {
[0]=>
object(stdClass)#%d (2) {
["_id"]=>
int(1)
["x"]=>
int(2)
}
[1]=>
object(stdClass)#%d (2) {
["_id"]=>
int(2)
["x"]=>
int(2)
}
[2]=>
object(stdClass)#%d (2) {
["_id"]=>
int(3)
["x"]=>
int(3)
}
}
===DONE===
diff --git a/mongodb-1.2.3/tests/manager/manager-executeBulkWrite-009.phpt b/mongodb-1.2.8/tests/manager/manager-executeBulkWrite-009.phpt
similarity index 89%
rename from mongodb-1.2.3/tests/manager/manager-executeBulkWrite-009.phpt
rename to mongodb-1.2.8/tests/manager/manager-executeBulkWrite-009.phpt
index e65ff248..7799b139 100644
--- a/mongodb-1.2.3/tests/manager/manager-executeBulkWrite-009.phpt
+++ b/mongodb-1.2.8/tests/manager/manager-executeBulkWrite-009.phpt
@@ -1,49 +1,50 @@
--TEST--
MongoDB\Driver\Manager::executeBulkWrite() update one document with upsert
--SKIPIF--
-<?php require __DIR__ . "/../utils/basic-skipif.inc"; CLEANUP(STANDALONE) ?>
+<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
+<?php NEEDS('STANDALONE'); CLEANUP(STANDALONE); ?>
--FILE--
<?php
require_once __DIR__ . "/../utils/basic.inc";
$manager = new MongoDB\Driver\Manager(STANDALONE);
$bulk = new MongoDB\Driver\BulkWrite();
$bulk->update(
array('_id' => 1),
array('$set' => array('x' => 1)),
array('multi' => false, 'upsert' => true)
);
$result = $manager->executeBulkWrite(NS, $bulk);
echo "\n===> WriteResult\n";
printWriteResult($result);
echo "\n===> Collection\n";
$cursor = $manager->executeQuery(NS, new MongoDB\Driver\Query(array()));
var_dump(iterator_to_array($cursor));
?>
===DONE===
<?php exit(0); ?>
--EXPECTF--
===> WriteResult
server: %s:%d
insertedCount: 0
matchedCount: 0
modifiedCount: 0
upsertedCount: 1
deletedCount: 0
upsertedId[0]: int(1)
===> Collection
array(1) {
[0]=>
object(stdClass)#%d (2) {
["_id"]=>
int(1)
["x"]=>
int(1)
}
}
===DONE===
diff --git a/mongodb-1.2.3/tests/manager/manager-executeBulkWrite-010.phpt b/mongodb-1.2.8/tests/manager/manager-executeBulkWrite-010.phpt
similarity index 89%
rename from mongodb-1.2.3/tests/manager/manager-executeBulkWrite-010.phpt
rename to mongodb-1.2.8/tests/manager/manager-executeBulkWrite-010.phpt
index eae3a30f..4158936b 100644
--- a/mongodb-1.2.3/tests/manager/manager-executeBulkWrite-010.phpt
+++ b/mongodb-1.2.8/tests/manager/manager-executeBulkWrite-010.phpt
@@ -1,49 +1,50 @@
--TEST--
MongoDB\Driver\Manager::executeBulkWrite() update multiple documents with upsert
--SKIPIF--
-<?php require __DIR__ . "/../utils/basic-skipif.inc"; CLEANUP(STANDALONE) ?>
+<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
+<?php NEEDS('STANDALONE'); CLEANUP(STANDALONE); ?>
--FILE--
<?php
require_once __DIR__ . "/../utils/basic.inc";
$manager = new MongoDB\Driver\Manager(STANDALONE);
$bulk = new MongoDB\Driver\BulkWrite();
$bulk->update(
array('_id' => 1),
array('$set' => array('x' => 1)),
array('multi' => true, 'upsert' => true)
);
$result = $manager->executeBulkWrite(NS, $bulk);
echo "\n===> WriteResult\n";
printWriteResult($result);
echo "\n===> Collection\n";
$cursor = $manager->executeQuery(NS, new MongoDB\Driver\Query(array()));
var_dump(iterator_to_array($cursor));
?>
===DONE===
<?php exit(0); ?>
--EXPECTF--
===> WriteResult
server: %s:%d
insertedCount: 0
matchedCount: 0
modifiedCount: 0
upsertedCount: 1
deletedCount: 0
upsertedId[0]: int(1)
===> Collection
array(1) {
[0]=>
object(stdClass)#%d (2) {
["_id"]=>
int(1)
["x"]=>
int(1)
}
}
===DONE===
diff --git a/mongodb-1.2.3/tests/manager/manager-executeBulkWrite-011.phpt b/mongodb-1.2.8/tests/manager/manager-executeBulkWrite-011.phpt
similarity index 95%
rename from mongodb-1.2.3/tests/manager/manager-executeBulkWrite-011.phpt
rename to mongodb-1.2.8/tests/manager/manager-executeBulkWrite-011.phpt
index 0cd46b7a..3d7a93e8 100644
--- a/mongodb-1.2.3/tests/manager/manager-executeBulkWrite-011.phpt
+++ b/mongodb-1.2.8/tests/manager/manager-executeBulkWrite-011.phpt
@@ -1,82 +1,83 @@
--TEST--
MongoDB\Driver\BulkWrite: bypassDocumentValidation option
--SKIPIF--
-<?php require __DIR__ . "/../utils/basic-skipif.inc"; CLEANUP(STANDALONE) ?>
+<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
+<?php NEEDS('STANDALONE'); CLEANUP(STANDALONE); ?>
--FILE--
<?php
require_once __DIR__ . "/../utils/basic.inc";
$manager = new MongoDB\Driver\Manager(STANDALONE);
$command = new MongoDB\Driver\Command([
'create' => COLLECTION_NAME,
'validator' => ['x' => ['$type' => 'number']],
]);
$manager->executeCommand(DATABASE_NAME, $command);
$bulk = new MongoDB\Driver\BulkWrite();
$bulk->insert(['_id' => 1, 'x' => 1]);
$bulk->insert(['_id' => 2, 'x' => 2]);
$manager->executeBulkWrite(NS, $bulk);
$bulk = new MongoDB\Driver\BulkWrite(['bypassDocumentValidation' => true]);
$bulk->update(['_id' => 2], ['$set' => ['x' => 'two']]);
$manager->executeBulkWrite(NS, $bulk);
$bulk = new MongoDB\Driver\BulkWrite(['bypassDocumentValidation' => true]);
$bulk->insert(['_id' => 3, 'x' => 'three']);
$manager->executeBulkWrite(NS, $bulk);
$bulk = new MongoDB\Driver\BulkWrite();
$bulk->insert(['_id' => 4, 'x' => 'four']);
echo throws(function() use($manager, $bulk) {
$manager->executeBulkWrite(NS, $bulk);
}, "MongoDB\Driver\Exception\BulkWriteException"), "\n";
$bulk = new MongoDB\Driver\BulkWrite();
$bulk->update(['_id' => 1], ['$set' => ['x' => 'one']]);
echo throws(function() use($manager, $bulk) {
$manager->executeBulkWrite(NS, $bulk);
}, "MongoDB\Driver\Exception\BulkWriteException"), "\n";
$bulk = new MongoDB\Driver\BulkWrite();
$bulk->update(['_id' => 2], ['$set' => ['x' => 2]]);
$manager->executeBulkWrite(NS, $bulk);
$cursor = $manager->executeQuery(NS, new MongoDB\Driver\Query([]));
var_dump(iterator_to_array($cursor));
?>
===DONE===
<?php exit(0); ?>
--EXPECTF--
OK: Got MongoDB\Driver\Exception\BulkWriteException
Document failed validation
OK: Got MongoDB\Driver\Exception\BulkWriteException
Document failed validation
array(3) {
[0]=>
object(stdClass)#%d (2) {
["_id"]=>
int(1)
["x"]=>
int(1)
}
[1]=>
object(stdClass)#%d (2) {
["_id"]=>
int(2)
["x"]=>
int(2)
}
[2]=>
object(stdClass)#%d (2) {
["_id"]=>
int(3)
["x"]=>
string(5) "three"
}
}
===DONE===
diff --git a/mongodb-1.2.3/tests/manager/manager-executeBulkWrite_error-001.phpt b/mongodb-1.2.8/tests/manager/manager-executeBulkWrite_error-001.phpt
similarity index 92%
rename from mongodb-1.2.3/tests/manager/manager-executeBulkWrite_error-001.phpt
rename to mongodb-1.2.8/tests/manager/manager-executeBulkWrite_error-001.phpt
index dbaa8f56..aff060ec 100644
--- a/mongodb-1.2.3/tests/manager/manager-executeBulkWrite_error-001.phpt
+++ b/mongodb-1.2.8/tests/manager/manager-executeBulkWrite_error-001.phpt
@@ -1,65 +1,66 @@
--TEST--
MongoDB\Driver\Manager::executeBulkWrite() with duplicate key errors (ordered)
--SKIPIF--
-<?php require __DIR__ . "/../utils/basic-skipif.inc"; CLEANUP(STANDALONE) ?>
+<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
+<?php NEEDS('STANDALONE'); CLEANUP(STANDALONE); ?>
--FILE--
<?php
require_once __DIR__ . "/../utils/basic.inc";
$manager = new MongoDB\Driver\Manager(STANDALONE);
$bulk = new MongoDB\Driver\BulkWrite(['ordered' => true]);
$bulk->insert(array('_id' => 1));
$bulk->insert(array('_id' => 1));
$bulk->insert(array('_id' => 2));
$bulk->insert(array('_id' => 2));
try {
$result = $manager->executeBulkWrite(NS, $bulk);
echo "FAILED\n";
} catch (MongoDB\Driver\Exception\BulkWriteException $e) {
printf("BulkWriteException: %s\n", $e->getMessage());
echo "\n===> WriteResult\n";
printWriteResult($e->getWriteResult());
}
echo "\n===> Collection\n";
$cursor = $manager->executeQuery(NS, new MongoDB\Driver\Query(array()));
var_dump(iterator_to_array($cursor));
?>
===DONE===
<?php exit(0); ?>
--EXPECTF--
BulkWriteException: E11000 duplicate key error %s: phongo.manager_manager_executeBulkWrite_error_001%sdup key: { : 1 }
===> WriteResult
server: %s:%d
insertedCount: 1
matchedCount: 0
modifiedCount: 0
upsertedCount: 0
deletedCount: 0
object(MongoDB\Driver\WriteError)#%d (%d) {
["message"]=>
string(%d) "%s"
["code"]=>
int(11000)
["index"]=>
int(1)
["info"]=>
NULL
}
writeError[1].message: %s
writeError[1].code: 11000
===> Collection
array(1) {
[0]=>
object(stdClass)#%d (1) {
["_id"]=>
int(1)
}
}
===DONE===
diff --git a/mongodb-1.2.3/tests/manager/manager-executeBulkWrite_error-002.phpt b/mongodb-1.2.8/tests/manager/manager-executeBulkWrite_error-002.phpt
similarity index 94%
rename from mongodb-1.2.3/tests/manager/manager-executeBulkWrite_error-002.phpt
rename to mongodb-1.2.8/tests/manager/manager-executeBulkWrite_error-002.phpt
index a4e0f3e8..7cb49df8 100644
--- a/mongodb-1.2.3/tests/manager/manager-executeBulkWrite_error-002.phpt
+++ b/mongodb-1.2.8/tests/manager/manager-executeBulkWrite_error-002.phpt
@@ -1,82 +1,83 @@
--TEST--
MongoDB\Driver\Manager::executeBulkWrite() with duplicate key errors (unordered)
--SKIPIF--
-<?php require __DIR__ . "/../utils/basic-skipif.inc"; CLEANUP(STANDALONE) ?>
+<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
+<?php NEEDS('STANDALONE'); CLEANUP(STANDALONE); ?>
--FILE--
<?php
require_once __DIR__ . "/../utils/basic.inc";
$manager = new MongoDB\Driver\Manager(STANDALONE);
$bulk = new MongoDB\Driver\BulkWrite(['ordered' => false]);
$bulk->insert(array('_id' => 1));
$bulk->insert(array('_id' => 1));
$bulk->insert(array('_id' => 2));
$bulk->insert(array('_id' => 2));
try {
$result = $manager->executeBulkWrite(NS, $bulk);
echo "FAILED\n";
} catch (MongoDB\Driver\Exception\BulkWriteException $e) {
printf("BulkWriteException: %s\n", $e->getMessage());
echo "\n===> WriteResult\n";
printWriteResult($e->getWriteResult());
}
echo "\n===> Collection\n";
$cursor = $manager->executeQuery(NS, new MongoDB\Driver\Query(array()));
var_dump(iterator_to_array($cursor));
?>
===DONE===
<?php exit(0); ?>
--EXPECTF--
BulkWriteException: Multiple write errors: "E11000 duplicate key error %s: phongo.manager_manager_executeBulkWrite_error_002%sdup key: { : 1 }", "E11000 duplicate key error %s: phongo.manager_manager_executeBulkWrite_error_002%sdup key: { : 2 }"
===> WriteResult
server: %s:%d
insertedCount: 2
matchedCount: 0
modifiedCount: 0
upsertedCount: 0
deletedCount: 0
object(MongoDB\Driver\WriteError)#%d (%d) {
["message"]=>
string(%d) "%s"
["code"]=>
int(11000)
["index"]=>
int(1)
["info"]=>
NULL
}
writeError[1].message: %s
writeError[1].code: 11000
object(MongoDB\Driver\WriteError)#%d (%d) {
["message"]=>
string(%d) "%s"
["code"]=>
int(11000)
["index"]=>
int(3)
["info"]=>
NULL
}
writeError[3].message: %s
writeError[3].code: 11000
===> Collection
array(2) {
[0]=>
object(stdClass)#%d (1) {
["_id"]=>
int(1)
}
[1]=>
object(stdClass)#%d (1) {
["_id"]=>
int(2)
}
}
===DONE===
diff --git a/mongodb-1.2.3/tests/manager/manager-executeBulkWrite_error-003.phpt b/mongodb-1.2.8/tests/manager/manager-executeBulkWrite_error-003.phpt
similarity index 96%
rename from mongodb-1.2.3/tests/manager/manager-executeBulkWrite_error-003.phpt
rename to mongodb-1.2.8/tests/manager/manager-executeBulkWrite_error-003.phpt
index 6ed33097..5d147246 100644
--- a/mongodb-1.2.3/tests/manager/manager-executeBulkWrite_error-003.phpt
+++ b/mongodb-1.2.8/tests/manager/manager-executeBulkWrite_error-003.phpt
@@ -1,63 +1,63 @@
--TEST--
MongoDB\Driver\Manager::executeBulkWrite() write concern error
--SKIPIF--
<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
-<?php NEEDS("REPLICASET"); CLEANUP(REPLICASET); ?>
+<?php NEEDS('REPLICASET'); CLEANUP(REPLICASET); ?>
--FILE--
<?php
require_once __DIR__ . "/../utils/basic.inc";
$manager = new MongoDB\Driver\Manager(REPLICASET);
$bulk = new MongoDB\Driver\BulkWrite();
$bulk->insert(array('_id' => 1, 'x' => 1));
try {
$manager->executeBulkWrite(NS, $bulk, new MongoDB\Driver\WriteConcern(30));
} catch (MongoDB\Driver\Exception\BulkWriteException $e) {
printf("BulkWriteException: %s\n", $e->getMessage());
echo "\n===> WriteResult\n";
printWriteResult($e->getWriteResult());
}
echo "\n===> Collection\n";
$cursor = $manager->executeQuery(NS, new MongoDB\Driver\Query(array()));
var_dump(iterator_to_array($cursor));
?>
===DONE===
<?php exit(0); ?>
--EXPECTF--
BulkWriteException: Not enough data-bearing nodes
===> WriteResult
server: %s:%d
insertedCount: 1
matchedCount: 0
modifiedCount: 0
upsertedCount: 0
deletedCount: 0
object(MongoDB\Driver\WriteConcernError)#%d (%d) {
["message"]=>
string(29) "Not enough data-bearing nodes"
["code"]=>
int(100)
["info"]=>
NULL
}
writeConcernError.message: Not enough data-bearing nodes
writeConcernError.code: 100
writeConcernError.info: NULL
===> Collection
array(1) {
[0]=>
object(stdClass)#%d (%d) {
["_id"]=>
int(1)
["x"]=>
int(1)
}
}
===DONE===
diff --git a/mongodb-1.2.3/tests/manager/manager-executeBulkWrite_error-004.phpt b/mongodb-1.2.8/tests/manager/manager-executeBulkWrite_error-004.phpt
similarity index 96%
rename from mongodb-1.2.3/tests/manager/manager-executeBulkWrite_error-004.phpt
rename to mongodb-1.2.8/tests/manager/manager-executeBulkWrite_error-004.phpt
index c02b84bb..216405fa 100644
--- a/mongodb-1.2.3/tests/manager/manager-executeBulkWrite_error-004.phpt
+++ b/mongodb-1.2.8/tests/manager/manager-executeBulkWrite_error-004.phpt
@@ -1,68 +1,68 @@
--TEST--
MongoDB\Driver\Manager::executeBulkWrite() delete write error
--SKIPIF--
<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
-<?php NEEDS("REPLICASET"); CLEANUP(REPLICASET); ?>
+<?php NEEDS('REPLICASET'); CLEANUP(REPLICASET); ?>
--FILE--
<?php
require_once __DIR__ . "/../utils/basic.inc";
$manager = new MongoDB\Driver\Manager(REPLICASET);
$bulk = new MongoDB\Driver\BulkWrite();
$bulk->insert(array('_id' => 1, 'x' => 1));
$manager->executeBulkWrite(NS, $bulk);
$bulk = new MongoDB\Driver\BulkWrite();
$bulk->delete(['$foo' => 1], ['limit' => 1]);
try {
$manager->executeBulkWrite(NS, $bulk);
} catch (MongoDB\Driver\Exception\BulkWriteException $e) {
printf("BulkWriteException: %s\n", $e->getMessage());
echo "\n===> WriteResult\n";
printWriteResult($e->getWriteResult());
}
echo "\n===> Collection\n";
$cursor = $manager->executeQuery(NS, new MongoDB\Driver\Query(array()));
var_dump(iterator_to_array($cursor));
?>
===DONE===
<?php exit(0); ?>
--EXPECTF--
BulkWriteException: unknown top level operator: $foo
===> WriteResult
server: %s:%d
insertedCount: 0
matchedCount: 0
modifiedCount: 0
upsertedCount: 0
deletedCount: 0
object(MongoDB\Driver\WriteError)#%d (%d) {
["message"]=>
string(32) "unknown top level operator: $foo"
["code"]=>
int(2)
["index"]=>
int(0)
["info"]=>
NULL
}
writeError[0].message: unknown top level operator: $foo
writeError[0].code: 2
===> Collection
array(1) {
[0]=>
object(stdClass)#%d (%d) {
["_id"]=>
int(1)
["x"]=>
int(1)
}
}
===DONE===
diff --git a/mongodb-1.2.3/tests/manager/manager-executeBulkWrite_error-006.phpt b/mongodb-1.2.8/tests/manager/manager-executeBulkWrite_error-006.phpt
similarity index 90%
rename from mongodb-1.2.3/tests/manager/manager-executeBulkWrite_error-006.phpt
rename to mongodb-1.2.8/tests/manager/manager-executeBulkWrite_error-006.phpt
index 579901e7..4db229a2 100644
--- a/mongodb-1.2.3/tests/manager/manager-executeBulkWrite_error-006.phpt
+++ b/mongodb-1.2.8/tests/manager/manager-executeBulkWrite_error-006.phpt
@@ -1,52 +1,53 @@
--TEST--
MongoDB\Driver\Manager::executeBulkWrite() update write error
--SKIPIF--
-<?php require __DIR__ . "/../utils/basic-skipif.inc"; CLEANUP(STANDALONE) ?>
+<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
+<?php NEEDS('STANDALONE'); CLEANUP(STANDALONE); ?>
--FILE--
<?php
require_once __DIR__ . "/../utils/basic.inc";
$manager = new MongoDB\Driver\Manager(STANDALONE);
$bulk = new MongoDB\Driver\BulkWrite();
$bulk->insert(array('x' => 1));
$manager->executeBulkWrite(NS, $bulk);
$bulk = new MongoDB\Driver\BulkWrite();
$bulk->update(['x' => 1], ['$foo' => 1]);
try {
$manager->executeBulkWrite(NS, $bulk);
} catch (MongoDB\Driver\Exception\BulkWriteException $e) {
printf("BulkWriteException: %s\n", $e->getMessage());
echo "\n===> WriteResult\n";
printWriteResult($e->getWriteResult());
}
?>
===DONE===
<?php exit(0); ?>
--EXPECTF--
BulkWriteException: Unknown modifier: $foo
===> WriteResult
server: %s:%d
insertedCount: 0
matchedCount: 0
modifiedCount: 0
upsertedCount: 0
deletedCount: 0
object(MongoDB\Driver\WriteError)#%d (%d) {
["message"]=>
string(22) "Unknown modifier: $foo"
["code"]=>
int(9)
["index"]=>
int(0)
["info"]=>
NULL
}
writeError[0].message: Unknown modifier: $foo
writeError[0].code: 9
===DONE===
diff --git a/mongodb-1.2.3/tests/manager/manager-executeBulkWrite_error-007.phpt b/mongodb-1.2.8/tests/manager/manager-executeBulkWrite_error-007.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/manager/manager-executeBulkWrite_error-007.phpt
rename to mongodb-1.2.8/tests/manager/manager-executeBulkWrite_error-007.phpt
diff --git a/mongodb-1.2.3/tests/manager/manager-executeCommand-001.phpt b/mongodb-1.2.8/tests/manager/manager-executeCommand-001.phpt
similarity index 92%
rename from mongodb-1.2.3/tests/manager/manager-executeCommand-001.phpt
rename to mongodb-1.2.8/tests/manager/manager-executeCommand-001.phpt
index 491a6d1f..f0f40e44 100644
--- a/mongodb-1.2.3/tests/manager/manager-executeCommand-001.phpt
+++ b/mongodb-1.2.8/tests/manager/manager-executeCommand-001.phpt
@@ -1,76 +1,77 @@
--TEST--
MongoDB\Driver\Manager::executeCommand()
--SKIPIF--
-<?php require __DIR__ . "/../utils/basic-skipif.inc"; CLEANUP(STANDALONE) ?>
+<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
+<?php NEEDS('STANDALONE'); CLEANUP(STANDALONE); ?>
--FILE--
<?php
require_once __DIR__ . "/../utils/basic.inc";
$manager = new MongoDB\Driver\Manager(STANDALONE);
$command = new MongoDB\Driver\Command(array('ping' => 1));
$result = $manager->executeCommand(DATABASE_NAME, $command);
var_dump($command);
var_dump($result instanceof MongoDB\Driver\Cursor);
var_dump($result);
echo "\nDumping response document:\n";
var_dump(current($result->toArray()));
$server = $result->getServer();
var_dump($server instanceof MongoDB\Driver\Server);
var_dump($server->getHost());
var_dump($server->getPort());
?>
===DONE===
<?php exit(0); ?>
--EXPECTF--
object(MongoDB\Driver\Command)#%d (%d) {
["command"]=>
object(stdClass)#%d (1) {
["ping"]=>
int(1)
}
}
bool(true)
object(MongoDB\Driver\Cursor)#%d (%d) {
["database"]=>
string(6) "phongo"
["collection"]=>
NULL
["query"]=>
NULL
["command"]=>
object(MongoDB\Driver\Command)#%d (%d) {
["command"]=>
object(stdClass)#%d (%d) {
["ping"]=>
int(1)
}
}
["readPreference"]=>
NULL
["isDead"]=>
bool(false)
["currentIndex"]=>
int(0)
["currentDocument"]=>
NULL
["server"]=>
object(MongoDB\Driver\Server)#%d (%d) {
%a
}
}
Dumping response document:
object(stdClass)#%d (%d) {
["ok"]=>
float(1)
}
bool(true)
string(%d) "%s"
int(%d)
===DONE===
diff --git a/mongodb-1.2.3/tests/manager/manager-executeCommand_error-001.phpt b/mongodb-1.2.8/tests/manager/manager-executeCommand_error-001.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/manager/manager-executeCommand_error-001.phpt
rename to mongodb-1.2.8/tests/manager/manager-executeCommand_error-001.phpt
diff --git a/mongodb-1.2.3/tests/manager/manager-executeQuery-001.phpt b/mongodb-1.2.8/tests/manager/manager-executeQuery-001.phpt
similarity index 96%
rename from mongodb-1.2.3/tests/manager/manager-executeQuery-001.phpt
rename to mongodb-1.2.8/tests/manager/manager-executeQuery-001.phpt
index 70c3ba8f..b7876eb1 100644
--- a/mongodb-1.2.3/tests/manager/manager-executeQuery-001.phpt
+++ b/mongodb-1.2.8/tests/manager/manager-executeQuery-001.phpt
@@ -1,88 +1,88 @@
--TEST--
MongoDB\Driver\Manager::executeQuery() one document (OP_QUERY)
--SKIPIF--
<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
-<?php NEEDS("STANDALONE_30"); CLEANUP(STANDALONE_30); ?>
+<?php NEEDS('STANDALONE_30'); CLEANUP(STANDALONE_30); ?>
--FILE--
<?php
require_once __DIR__ . "/../utils/basic.inc";
$manager = new MongoDB\Driver\Manager(STANDALONE_30);
// load fixtures for test
$bulk = new MongoDB\Driver\BulkWrite();
$bulk->insert(array('_id' => 1, 'x' => 2, 'y' => 3));
$bulk->insert(array('_id' => 2, 'x' => 3, 'y' => 4));
$bulk->insert(array('_id' => 3, 'x' => 4, 'y' => 5));
$manager->executeBulkWrite(NS, $bulk);
$query = new MongoDB\Driver\Query(array('x' => 3), array('projection' => array('y' => 1)));
$qr = $manager->executeQuery(NS, $query);
var_dump($qr instanceof MongoDB\Driver\Cursor);
var_dump($qr);
$server = $qr->getServer();
var_dump($server instanceof MongoDB\Driver\Server);
var_dump($server->getHost());
var_dump($server->getPort());
var_dump(iterator_to_array($qr));
?>
===DONE===
<?php exit(0); ?>
--EXPECTF--
bool(true)
object(MongoDB\Driver\Cursor)#%d (%d) {
["database"]=>
string(6) "phongo"
["collection"]=>
string(32) "manager_manager_executeQuery_001"
["query"]=>
object(MongoDB\Driver\Query)#%d (%d) {
["filter"]=>
object(stdClass)#%d (%d) {
["x"]=>
int(3)
}
["options"]=>
object(stdClass)#%d (%d) {
["projection"]=>
object(stdClass)#%d (%d) {
["y"]=>
int(1)
}
}
["readConcern"]=>
NULL
}
["command"]=>
NULL
["readPreference"]=>
NULL
["isDead"]=>
bool(false)
["currentIndex"]=>
int(0)
["currentDocument"]=>
NULL
["server"]=>
object(MongoDB\Driver\Server)#%d (%d) {
%a
}
}
bool(true)
string(%d) "%s"
int(%d)
array(1) {
[0]=>
object(stdClass)#%d (2) {
["_id"]=>
int(2)
["y"]=>
int(4)
}
}
===DONE===
diff --git a/mongodb-1.2.3/tests/manager/manager-executeQuery-002.phpt b/mongodb-1.2.8/tests/manager/manager-executeQuery-002.phpt
similarity index 94%
rename from mongodb-1.2.3/tests/manager/manager-executeQuery-002.phpt
rename to mongodb-1.2.8/tests/manager/manager-executeQuery-002.phpt
index d9ae2bbf..433e71ce 100644
--- a/mongodb-1.2.3/tests/manager/manager-executeQuery-002.phpt
+++ b/mongodb-1.2.8/tests/manager/manager-executeQuery-002.phpt
@@ -1,87 +1,88 @@
--TEST--
MongoDB\Driver\Manager::executeQuery() one document (find command)
--SKIPIF--
-<?php require __DIR__ . "/../utils/basic-skipif.inc"; CLEANUP(STANDALONE) ?>
+<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
+<?php NEEDS('STANDALONE'); CLEANUP(STANDALONE); ?>
--FILE--
<?php
require_once __DIR__ . "/../utils/basic.inc";
$manager = new MongoDB\Driver\Manager(STANDALONE);
// load fixtures for test
$bulk = new MongoDB\Driver\BulkWrite();
$bulk->insert(array('_id' => 1, 'x' => 2, 'y' => 3));
$bulk->insert(array('_id' => 2, 'x' => 3, 'y' => 4));
$bulk->insert(array('_id' => 3, 'x' => 4, 'y' => 5));
$manager->executeBulkWrite(NS, $bulk);
$query = new MongoDB\Driver\Query(array('x' => 3), array('projection' => array('y' => 1)));
$qr = $manager->executeQuery(NS, $query);
var_dump($qr instanceof MongoDB\Driver\Cursor);
var_dump($qr);
$server = $qr->getServer();
var_dump($server instanceof MongoDB\Driver\Server);
var_dump($server->getHost());
var_dump($server->getPort());
var_dump(iterator_to_array($qr));
?>
===DONE===
<?php exit(0); ?>
--EXPECTF--
bool(true)
object(MongoDB\Driver\Cursor)#%d (%d) {
["database"]=>
string(6) "phongo"
["collection"]=>
string(32) "manager_manager_executeQuery_002"
["query"]=>
object(MongoDB\Driver\Query)#%d (%d) {
["filter"]=>
object(stdClass)#%d (%d) {
["x"]=>
int(3)
}
["options"]=>
object(stdClass)#%d (%d) {
["projection"]=>
object(stdClass)#%d (%d) {
["y"]=>
int(1)
}
}
["readConcern"]=>
NULL
}
["command"]=>
NULL
["readPreference"]=>
NULL
["isDead"]=>
bool(false)
["currentIndex"]=>
int(0)
["currentDocument"]=>
NULL
["server"]=>
object(MongoDB\Driver\Server)#%d (%d) {
%a
}
}
bool(true)
string(%d) "%s"
int(%d)
array(1) {
[0]=>
object(stdClass)#%d (2) {
["_id"]=>
int(2)
["y"]=>
int(4)
}
}
===DONE===
diff --git a/mongodb-1.2.3/tests/manager/manager-executeQuery-005.phpt b/mongodb-1.2.8/tests/manager/manager-executeQuery-005.phpt
similarity index 93%
rename from mongodb-1.2.3/tests/manager/manager-executeQuery-005.phpt
rename to mongodb-1.2.8/tests/manager/manager-executeQuery-005.phpt
index ed2b60b1..e8546427 100644
--- a/mongodb-1.2.3/tests/manager/manager-executeQuery-005.phpt
+++ b/mongodb-1.2.8/tests/manager/manager-executeQuery-005.phpt
@@ -1,86 +1,87 @@
--TEST--
MongoDB\Driver\Server::executeQuery() with filter and projection
--SKIPIF--
-<?php require __DIR__ . "/../utils/basic-skipif.inc"; CLEANUP(STANDALONE) ?>
+<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
+<?php NEEDS('STANDALONE'); CLEANUP(STANDALONE); ?>
--FILE--
<?php
require_once __DIR__ . "/../utils/basic.inc";
class MyArrayObject extends ArrayObject implements MongoDB\BSON\Unserializable {
function bsonUnserialize(array $data) {
parent::__construct($data);
}
}
$manager = new MongoDB\Driver\Manager(STANDALONE);
$bulk = new \MongoDB\Driver\BulkWrite();
$bulk->insert(array('_id' => 1, array('x' => 2, 'y' => 3)));
$bulk->insert(array('_id' => 2, array('x' => 3, 'y' => 4)));
$bulk->insert(array('_id' => 3, array('x' => 4, 'y' => 5)));
$manager->executeBulkWrite(NS, $bulk);
$query = new MongoDB\Driver\Query(array());
$qr = $manager->executeQuery(NS, $query);
$qr->setTypeMap(array("root"=> "MyArrayObject", "document"=> "MyArrayObject", "array" => "MyArrayObject"));
foreach($qr as $obj) {
var_dump($obj);
}
?>
===DONE===
<?php exit(0); ?>
--EXPECTF--
object(MyArrayObject)#%d (1) {
[%s]=>
array(2) {
["_id"]=>
int(1)
[0]=>
object(MyArrayObject)#%d (1) {
[%s]=>
array(2) {
["x"]=>
int(2)
["y"]=>
int(3)
}
}
}
}
object(MyArrayObject)#%d (1) {
[%s]=>
array(2) {
["_id"]=>
int(2)
[0]=>
object(MyArrayObject)#%d (1) {
[%s]=>
array(2) {
["x"]=>
int(3)
["y"]=>
int(4)
}
}
}
}
object(MyArrayObject)#%d (1) {
[%s]=>
array(2) {
["_id"]=>
int(3)
[0]=>
object(MyArrayObject)#%d (1) {
[%s]=>
array(2) {
["x"]=>
int(4)
["y"]=>
int(5)
}
}
}
}
===DONE===
diff --git a/mongodb-1.2.3/tests/manager/manager-executeQuery_error-001.phpt b/mongodb-1.2.8/tests/manager/manager-executeQuery_error-001.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/manager/manager-executeQuery_error-001.phpt
rename to mongodb-1.2.8/tests/manager/manager-executeQuery_error-001.phpt
diff --git a/mongodb-1.2.3/tests/manager/manager-getreadconcern-001.phpt b/mongodb-1.2.8/tests/manager/manager-getreadconcern-001.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/manager/manager-getreadconcern-001.phpt
rename to mongodb-1.2.8/tests/manager/manager-getreadconcern-001.phpt
diff --git a/mongodb-1.2.3/tests/manager/manager-getreadpreference-001.phpt b/mongodb-1.2.8/tests/manager/manager-getreadpreference-001.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/manager/manager-getreadpreference-001.phpt
rename to mongodb-1.2.8/tests/manager/manager-getreadpreference-001.phpt
diff --git a/mongodb-1.2.3/tests/manager/manager-getservers-001.phpt b/mongodb-1.2.8/tests/manager/manager-getservers-001.phpt
similarity index 90%
rename from mongodb-1.2.3/tests/manager/manager-getservers-001.phpt
rename to mongodb-1.2.8/tests/manager/manager-getservers-001.phpt
index da32d05a..b60740d4 100644
--- a/mongodb-1.2.3/tests/manager/manager-getservers-001.phpt
+++ b/mongodb-1.2.8/tests/manager/manager-getservers-001.phpt
@@ -1,43 +1,44 @@
--TEST--
MongoDB\Driver\Manager::getServers() (standalone)
--SKIPIF--
-<?php require __DIR__ . "/../utils/basic-skipif.inc"; CLEANUP(STANDALONE); ?>
+<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
+<?php NEEDS('STANDALONE'); CLEANUP(STANDALONE); ?>
--FILE--
<?php
require_once __DIR__ . "/../utils/basic.inc";
function assertServerType($type) {
if ($type === MongoDB\Driver\Server::TYPE_STANDALONE) {
printf("Found standalone server type: %d\n", $type);
} else {
printf("Unexpected server type: %d\n", $type);
}
}
$manager = new MongoDB\Driver\Manager(STANDALONE);
$servers = $manager->getServers();
printf("Known servers: %d\n", count($servers));
echo "Pinging\n";
$command = new MongoDB\Driver\Command(array('ping' => 1));
$manager->executeCommand(DATABASE_NAME, $command);
$servers = $manager->getServers();
printf("Known servers: %d\n", count($servers));
foreach ($servers as $server) {
printf("Found server: %s:%d\n", $server->getHost(), $server->getPort());
assertServerType($server->getType());
}
?>
===DONE===
<?php exit(0); ?>
--EXPECTF--
Known servers: 0
Pinging
Known servers: 1
Found server: %s:%d
Found standalone server type: 1
===DONE===
diff --git a/mongodb-1.2.3/tests/manager/manager-getservers-002.phpt b/mongodb-1.2.8/tests/manager/manager-getservers-002.phpt
similarity index 96%
rename from mongodb-1.2.3/tests/manager/manager-getservers-002.phpt
rename to mongodb-1.2.8/tests/manager/manager-getservers-002.phpt
index ad780276..c466e267 100644
--- a/mongodb-1.2.3/tests/manager/manager-getservers-002.phpt
+++ b/mongodb-1.2.8/tests/manager/manager-getservers-002.phpt
@@ -1,54 +1,54 @@
--TEST--
MongoDB\Driver\Manager::getServers() (replica set)
--SKIPIF--
<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
-<?php NEEDS("REPLICASET"); CLEANUP(REPLICASET); ?>
+<?php NEEDS('REPLICASET'); CLEANUP(REPLICASET); ?>
--FILE--
<?php
require_once __DIR__ . "/../utils/basic.inc";
function assertServerType($type) {
$rsTypes = array(
MongoDB\Driver\Server::TYPE_RS_PRIMARY,
MongoDB\Driver\Server::TYPE_RS_SECONDARY,
MongoDB\Driver\Server::TYPE_RS_ARBITER,
);
if (in_array($type, $rsTypes, true)) {
printf("Found replica set server type: %d\n", $type);
} else {
printf("Unexpected server type: %d\n", $type);
}
}
$manager = new MongoDB\Driver\Manager(REPLICASET);
$servers = $manager->getServers();
printf("Known servers: %d\n", count($servers));
echo "Pinging\n";
$command = new MongoDB\Driver\Command(array('ping' => 1));
$manager->executeCommand(DATABASE_NAME, $command);
$servers = $manager->getServers();
printf("Known servers: %d\n", count($servers));
foreach ($servers as $server) {
printf("Found server: %s:%d\n", $server->getHost(), $server->getPort());
assertServerType($server->getType());
}
?>
===DONE===
<?php exit(0); ?>
--EXPECTF--
Known servers: 0
Pinging
Known servers: 3
Found server: %s:%d
Found replica set server type: %r(4|5|6)%r
Found server: %s:%d
Found replica set server type: %r(4|5|6)%r
Found server: %s:%d
Found replica set server type: %r(4|5|6)%r
===DONE===
diff --git a/mongodb-1.2.3/tests/manager/manager-getwriteconcern-001.phpt b/mongodb-1.2.8/tests/manager/manager-getwriteconcern-001.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/manager/manager-getwriteconcern-001.phpt
rename to mongodb-1.2.8/tests/manager/manager-getwriteconcern-001.phpt
diff --git a/mongodb-1.2.3/tests/manager/manager-invalidnamespace.phpt b/mongodb-1.2.8/tests/manager/manager-invalidnamespace.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/manager/manager-invalidnamespace.phpt
rename to mongodb-1.2.8/tests/manager/manager-invalidnamespace.phpt
diff --git a/mongodb-1.2.3/tests/manager/manager-selectserver-001.phpt b/mongodb-1.2.8/tests/manager/manager-selectserver-001.phpt
similarity index 94%
rename from mongodb-1.2.3/tests/manager/manager-selectserver-001.phpt
rename to mongodb-1.2.8/tests/manager/manager-selectserver-001.phpt
index 9843e379..1b3f77b3 100644
--- a/mongodb-1.2.3/tests/manager/manager-selectserver-001.phpt
+++ b/mongodb-1.2.8/tests/manager/manager-selectserver-001.phpt
@@ -1,70 +1,71 @@
--TEST--
MongoDB\Driver\Manager::selectServer() select a server from SDAM based on ReadPreference
--SKIPIF--
-<?php require __DIR__ . "/../utils/basic-skipif.inc"; CLEANUP(STANDALONE); ?>
+<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
+<?php NEEDS('STANDALONE'); CLEANUP(STANDALONE); ?>
--FILE--
<?php
require_once __DIR__ . "/../utils/basic.inc";
$rp = new MongoDB\Driver\ReadPreference(MongoDB\Driver\ReadPreference::RP_PRIMARY);
$manager = new MongoDB\Driver\Manager(STANDALONE);
$server = $manager->selectServer($rp);
$rp2 = new MongoDB\Driver\ReadPreference(MongoDB\Driver\ReadPreference::RP_PRIMARY);
$server2 = $manager->selectServer($rp2);
// load fixtures for test
$bulk = new \MongoDB\Driver\BulkWrite();
$bulk->insert(array('_id' => 1, 'x' => 2, 'y' => 3));
$bulk->insert(array('_id' => 2, 'x' => 3, 'y' => 4));
$bulk->insert(array('_id' => 3, 'x' => 4, 'y' => 5));
$server->executeBulkWrite(NS, $bulk);
$query = new MongoDB\Driver\Query(array('x' => 3), array('projection' => array('y' => 1)));
$cursor = $server->executeQuery(NS, $query);
var_dump($cursor instanceof MongoDB\Driver\Cursor);
var_dump($server == $cursor->getServer());
var_dump(iterator_to_array($cursor));
$query = new MongoDB\Driver\Query(array('x' => 3), array('projection' => array('y' => 1)));
$cursor = $server2->executeQuery(NS, $query);
var_dump($cursor instanceof MongoDB\Driver\Cursor);
var_dump($server2 == $cursor->getServer());
var_dump(iterator_to_array($cursor));
$bulk = new \MongoDB\Driver\BulkWrite();
$bulk->insert(array('_id' => 1, 'x' => 2, 'y' => 3));
$bulk->insert(array('_id' => 2, 'x' => 3, 'y' => 4));
$bulk->insert(array('_id' => 3, 'x' => 4, 'y' => 5));
throws(function() use($server2, $bulk) {
$server2->executeBulkWrite(NS, $bulk);
}, "MongoDB\Driver\Exception\BulkWriteException");
?>
===DONE===
<?php exit(0); ?>
--EXPECTF--
bool(true)
bool(true)
array(1) {
[0]=>
object(stdClass)#%d (2) {
["_id"]=>
int(2)
["y"]=>
int(4)
}
}
bool(true)
bool(true)
array(1) {
[0]=>
object(stdClass)#%d (2) {
["_id"]=>
int(2)
["y"]=>
int(4)
}
}
OK: Got MongoDB\Driver\Exception\BulkWriteException
===DONE===
diff --git a/mongodb-1.2.3/tests/manager/manager-selectserver_error-001.phpt b/mongodb-1.2.8/tests/manager/manager-selectserver_error-001.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/manager/manager-selectserver_error-001.phpt
rename to mongodb-1.2.8/tests/manager/manager-selectserver_error-001.phpt
diff --git a/mongodb-1.2.3/tests/manager/manager-set-uri-options-001.phpt b/mongodb-1.2.8/tests/manager/manager-set-uri-options-001.phpt
similarity index 90%
rename from mongodb-1.2.3/tests/manager/manager-set-uri-options-001.phpt
rename to mongodb-1.2.8/tests/manager/manager-set-uri-options-001.phpt
index 81abb591..b7845e64 100644
--- a/mongodb-1.2.3/tests/manager/manager-set-uri-options-001.phpt
+++ b/mongodb-1.2.8/tests/manager/manager-set-uri-options-001.phpt
@@ -1,45 +1,45 @@
--TEST--
MongoDB\Driver\Manager: Logging into MongoDB using credentials from $options
--SKIPIF--
-<?php require __DIR__ . "/../utils/basic-skipif.inc"; NEEDS("STANDALONE_AUTH"); ?>
-<?php CLEANUP(STANDALONE_AUTH) ?>
+<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
+<?php NEEDS('STANDALONE_AUTH'); CLEANUP(STANDALONE_AUTH); ?>
--FILE--
<?php
require_once __DIR__ . "/../utils/basic.inc";
$url = parse_url(STANDALONE_AUTH);
parse_str($url["query"], $args);
$dsn = sprintf("mongodb://%s:%d/", $url["host"], $url["port"]);
$options = array(
"username" => $url["user"],
"password" => $url["pass"],
) + $args;
$manager = new MongoDB\Driver\Manager($dsn, $options);
$bulk = new MongoDB\Driver\BulkWrite;
$bulk->insert(array("my" => "value"));
$inserted = $manager->executeBulkWrite(NS, $bulk)->getInsertedCount();
printf("Inserted: %d\n", $inserted);
$options["username"] = "not-found-user";
$manager = new MongoDB\Driver\Manager($dsn, $options);
$bulk = new MongoDB\Driver\BulkWrite;
$bulk->insert(array("my" => "value"));
throws(function() use ($manager, $bulk) {
$inserted = $manager->executeBulkWrite(NS, $bulk)->getInsertedCount();
printf("Incorrectly inserted: %d\n", $inserted);
}, "MongoDB\Driver\Exception\AuthenticationException");
?>
===DONE===
<?php exit(0); ?>
--EXPECTF--
Inserted: 1
OK: Got MongoDB\Driver\Exception\AuthenticationException
===DONE===
diff --git a/mongodb-1.2.3/tests/manager/manager-set-uri-options-002.phpt b/mongodb-1.2.8/tests/manager/manager-set-uri-options-002.phpt
similarity index 93%
rename from mongodb-1.2.3/tests/manager/manager-set-uri-options-002.phpt
rename to mongodb-1.2.8/tests/manager/manager-set-uri-options-002.phpt
index aceb751c..0be8bc9a 100644
--- a/mongodb-1.2.3/tests/manager/manager-set-uri-options-002.phpt
+++ b/mongodb-1.2.8/tests/manager/manager-set-uri-options-002.phpt
@@ -1,49 +1,50 @@
--TEST--
MongoDB\Driver\Manager: Logging into MongoDB using credentials from $options
--SKIPIF--
-<?php require __DIR__ . "/../utils/basic-skipif.inc"; NEEDS("STANDALONE_SSL"); ?>
+<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
+<?php NEEDS('STANDALONE_SSL'); ?>
--FILE--
<?php
require_once __DIR__ . "/../utils/basic.inc";
$opts = array(
"ssl" => array(
"verify_peer" => false,
"verify_peer_name" => false,
"allow_self_signed" => true,
),
);
$context = stream_context_create($opts);
$options = array(
"ssl" => false,
"serverselectiontimeoutms" => 100,
);
/* The server requires SSL */
$manager = new MongoDB\Driver\Manager(STANDALONE_SSL, $options, array("context" => $context));
$bulk = new MongoDB\Driver\BulkWrite;
$bulk->insert(array("my" => "value"));
throws(function() use ($manager, $bulk) {
$inserted = $manager->executeBulkWrite(NS, $bulk)->getInsertedCount();
printf("Inserted incorrectly: %d\n", $inserted);
}, "Exception");
$options = array(
"ssl" => true,
);
$manager = new MongoDB\Driver\Manager(STANDALONE_SSL, $options, array("context" => $context));
$bulk = new MongoDB\Driver\BulkWrite;
$bulk->insert(array("my" => "value"));
$inserted = $manager->executeBulkWrite(NS, $bulk)->getInsertedCount();
printf("Inserted: %d\n", $inserted);
?>
===DONE===
<?php exit(0); ?>
--EXPECTF--
OK: Got Exception
Inserted: 1
===DONE===
diff --git a/mongodb-1.2.3/tests/manager/manager-var-dump-001.phpt b/mongodb-1.2.8/tests/manager/manager-var-dump-001.phpt
similarity index 93%
rename from mongodb-1.2.3/tests/manager/manager-var-dump-001.phpt
rename to mongodb-1.2.8/tests/manager/manager-var-dump-001.phpt
index 854e3d2b..1a8c238b 100644
--- a/mongodb-1.2.3/tests/manager/manager-var-dump-001.phpt
+++ b/mongodb-1.2.8/tests/manager/manager-var-dump-001.phpt
@@ -1,78 +1,79 @@
--TEST--
MongoDB\Driver\Manager: Constructing invalid manager
--SKIPIF--
-<?php require __DIR__ . "/../utils/basic-skipif.inc"; CLEANUP(STANDALONE) ?>
+<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
+<?php NEEDS('STANDALONE'); CLEANUP(STANDALONE); ?>
--FILE--
<?php
require_once __DIR__ . "/../utils/basic.inc";
$manager = new MongoDB\Driver\Manager(STANDALONE);
var_dump($manager);
$bulk = new MongoDB\Driver\BulkWrite;
$bulk->insert(array("my" => "value"));
$retval = $manager->executeBulkWrite(NS, $bulk);
var_dump($manager);
?>
===DONE===
<?php exit(0); ?>
--EXPECTF--
object(MongoDB\Driver\Manager)#%d (%d) {
["uri"]=>
string(%d) "mongodb://%s"
["cluster"]=>
array(0) {
}
}
object(MongoDB\Driver\Manager)#%d (%d) {
["uri"]=>
string(%d) "mongodb://%s"
["cluster"]=>
array(1) {
[0]=>
array(10) {
["host"]=>
string(%d) "%s"
["port"]=>
int(%d)
["type"]=>
int(1)
["is_primary"]=>
bool(false)
["is_secondary"]=>
bool(false)
["is_arbiter"]=>
bool(false)
["is_hidden"]=>
bool(false)
["is_passive"]=>
bool(false)
["last_is_master"]=>
array(%d) {
["ismaster"]=>
bool(true)
["maxBsonObjectSize"]=>
int(16777216)
["maxMessageSizeBytes"]=>
int(48000000)
["maxWriteBatchSize"]=>
int(1000)
["localTime"]=>
object(%s\UTCDateTime)#%d (%d) {
["milliseconds"]=>
%r(int\(\d+\)|string\(\d+\) "\d+")%r
}
["maxWireVersion"]=>
int(%d)
["minWireVersion"]=>
int(0)
%a
}
["round_trip_time"]=>
int(%d)
}
}
}
===DONE===
diff --git a/mongodb-1.2.3/tests/manager/manager-wakeup.phpt b/mongodb-1.2.8/tests/manager/manager-wakeup.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/manager/manager-wakeup.phpt
rename to mongodb-1.2.8/tests/manager/manager-wakeup.phpt
diff --git a/mongodb-1.2.3/tests/manager/manager_error-001.phpt b/mongodb-1.2.8/tests/manager/manager_error-001.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/manager/manager_error-001.phpt
rename to mongodb-1.2.8/tests/manager/manager_error-001.phpt
diff --git a/mongodb-1.2.3/tests/readPreference/bug0146-001.phpt b/mongodb-1.2.8/tests/readPreference/bug0146-001.phpt
similarity index 97%
rename from mongodb-1.2.3/tests/readPreference/bug0146-001.phpt
rename to mongodb-1.2.8/tests/readPreference/bug0146-001.phpt
index 67ffbfa4..5dc42210 100644
--- a/mongodb-1.2.3/tests/readPreference/bug0146-001.phpt
+++ b/mongodb-1.2.8/tests/readPreference/bug0146-001.phpt
@@ -1,213 +1,214 @@
--TEST--
PHPC-146: ReadPreference primaryPreferred and secondary swapped (OP_QUERY)
--SKIPIF--
-<?php require __DIR__ . "/../utils/basic-skipif.inc"; NEEDS("STANDALONE_30"); ?>
+<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
+<?php NEEDS('STANDALONE_30'); ?>
--FILE--
<?php
require_once __DIR__ . "/../utils/basic.inc";
$manager = new MongoDB\Driver\Manager(STANDALONE_30);
$bulk = new MongoDB\Driver\BulkWrite();
$bulk->insert(array('my' => 'document'));
$manager->executeBulkWrite(NS, $bulk);
$rps = array(
MongoDB\Driver\ReadPreference::RP_PRIMARY,
MongoDB\Driver\ReadPreference::RP_PRIMARY_PREFERRED,
MongoDB\Driver\ReadPreference::RP_SECONDARY,
MongoDB\Driver\ReadPreference::RP_SECONDARY_PREFERRED,
MongoDB\Driver\ReadPreference::RP_NEAREST,
);
foreach($rps as $r) {
$rp = new MongoDB\Driver\ReadPreference($r);
$cursor = $manager->executeQuery(NS, new MongoDB\Driver\Query(array("my" => "query")), $rp);
var_dump($cursor);
}
?>
===DONE===
<?php exit(0); ?>
--EXPECTF--
object(MongoDB\Driver\Cursor)#%d (%d) {
["database"]=>
string(6) "phongo"
["collection"]=>
string(26) "readPreference_bug0146_001"
["query"]=>
object(MongoDB\Driver\Query)#%d (%d) {
["filter"]=>
object(stdClass)#%d (%d) {
["my"]=>
string(5) "query"
}
["options"]=>
object(stdClass)#%d (%d) {
}
["readConcern"]=>
NULL
}
["command"]=>
NULL
["readPreference"]=>
object(MongoDB\Driver\ReadPreference)#%d (%d) {
["mode"]=>
string(7) "primary"
}
["isDead"]=>
bool(true)
["currentIndex"]=>
int(0)
["currentDocument"]=>
NULL
["server"]=>
object(MongoDB\Driver\Server)#%d (%d) {
%a
}
}
object(MongoDB\Driver\Cursor)#%d (%d) {
["database"]=>
string(6) "phongo"
["collection"]=>
string(26) "readPreference_bug0146_001"
["query"]=>
object(MongoDB\Driver\Query)#%d (%d) {
["filter"]=>
object(stdClass)#%d (%d) {
["my"]=>
string(5) "query"
}
["options"]=>
object(stdClass)#%d (%d) {
}
["readConcern"]=>
NULL
}
["command"]=>
NULL
["readPreference"]=>
object(MongoDB\Driver\ReadPreference)#%d (%d) {
["mode"]=>
string(16) "primaryPreferred"
}
["isDead"]=>
bool(true)
["currentIndex"]=>
int(0)
["currentDocument"]=>
NULL
["server"]=>
object(MongoDB\Driver\Server)#%d (%d) {
%a
}
}
object(MongoDB\Driver\Cursor)#%d (%d) {
["database"]=>
string(6) "phongo"
["collection"]=>
string(26) "readPreference_bug0146_001"
["query"]=>
object(MongoDB\Driver\Query)#%d (%d) {
["filter"]=>
object(stdClass)#%d (%d) {
["my"]=>
string(5) "query"
}
["options"]=>
object(stdClass)#%d (%d) {
}
["readConcern"]=>
NULL
}
["command"]=>
NULL
["readPreference"]=>
object(MongoDB\Driver\ReadPreference)#%d (%d) {
["mode"]=>
string(9) "secondary"
}
["isDead"]=>
bool(true)
["currentIndex"]=>
int(0)
["currentDocument"]=>
NULL
["server"]=>
object(MongoDB\Driver\Server)#%d (%d) {
%a
}
}
object(MongoDB\Driver\Cursor)#%d (%d) {
["database"]=>
string(6) "phongo"
["collection"]=>
string(26) "readPreference_bug0146_001"
["query"]=>
object(MongoDB\Driver\Query)#%d (%d) {
["filter"]=>
object(stdClass)#%d (%d) {
["my"]=>
string(5) "query"
}
["options"]=>
object(stdClass)#%d (%d) {
}
["readConcern"]=>
NULL
}
["command"]=>
NULL
["readPreference"]=>
object(MongoDB\Driver\ReadPreference)#%d (%d) {
["mode"]=>
string(18) "secondaryPreferred"
}
["isDead"]=>
bool(true)
["currentIndex"]=>
int(0)
["currentDocument"]=>
NULL
["server"]=>
object(MongoDB\Driver\Server)#%d (%d) {
%a
}
}
object(MongoDB\Driver\Cursor)#%d (%d) {
["database"]=>
string(6) "phongo"
["collection"]=>
string(26) "readPreference_bug0146_001"
["query"]=>
object(MongoDB\Driver\Query)#%d (%d) {
["filter"]=>
object(stdClass)#%d (%d) {
["my"]=>
string(5) "query"
}
["options"]=>
object(stdClass)#%d (%d) {
}
["readConcern"]=>
NULL
}
["command"]=>
NULL
["readPreference"]=>
object(MongoDB\Driver\ReadPreference)#%d (%d) {
["mode"]=>
string(7) "nearest"
}
["isDead"]=>
bool(true)
["currentIndex"]=>
int(0)
["currentDocument"]=>
NULL
["server"]=>
object(MongoDB\Driver\Server)#%d (%d) {
%a
}
}
===DONE===
diff --git a/mongodb-1.2.3/tests/readPreference/bug0146-002.phpt b/mongodb-1.2.8/tests/readPreference/bug0146-002.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/readPreference/bug0146-002.phpt
rename to mongodb-1.2.8/tests/readPreference/bug0146-002.phpt
diff --git a/mongodb-1.2.3/tests/readPreference/bug0851-001.phpt b/mongodb-1.2.8/tests/readPreference/bug0851-001.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/readPreference/bug0851-001.phpt
rename to mongodb-1.2.8/tests/readPreference/bug0851-001.phpt
diff --git a/mongodb-1.2.3/tests/readPreference/readpreference-bsonserialize-001.phpt b/mongodb-1.2.8/tests/readPreference/readpreference-bsonserialize-001.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/readPreference/readpreference-bsonserialize-001.phpt
rename to mongodb-1.2.8/tests/readPreference/readpreference-bsonserialize-001.phpt
diff --git a/mongodb-1.2.3/tests/readPreference/readpreference-bsonserialize-002.phpt b/mongodb-1.2.8/tests/readPreference/readpreference-bsonserialize-002.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/readPreference/readpreference-bsonserialize-002.phpt
rename to mongodb-1.2.8/tests/readPreference/readpreference-bsonserialize-002.phpt
diff --git a/mongodb-1.2.3/tests/readPreference/readpreference-ctor-001.phpt b/mongodb-1.2.8/tests/readPreference/readpreference-ctor-001.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/readPreference/readpreference-ctor-001.phpt
rename to mongodb-1.2.8/tests/readPreference/readpreference-ctor-001.phpt
diff --git a/mongodb-1.2.3/tests/readPreference/readpreference-ctor_error-001.phpt b/mongodb-1.2.8/tests/readPreference/readpreference-ctor_error-001.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/readPreference/readpreference-ctor_error-001.phpt
rename to mongodb-1.2.8/tests/readPreference/readpreference-ctor_error-001.phpt
diff --git a/mongodb-1.2.3/tests/readPreference/readpreference-ctor_error-002.phpt b/mongodb-1.2.8/tests/readPreference/readpreference-ctor_error-002.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/readPreference/readpreference-ctor_error-002.phpt
rename to mongodb-1.2.8/tests/readPreference/readpreference-ctor_error-002.phpt
diff --git a/mongodb-1.2.3/tests/readPreference/readpreference-ctor_error-003.phpt b/mongodb-1.2.8/tests/readPreference/readpreference-ctor_error-003.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/readPreference/readpreference-ctor_error-003.phpt
rename to mongodb-1.2.8/tests/readPreference/readpreference-ctor_error-003.phpt
diff --git a/mongodb-1.2.3/tests/readPreference/readpreference-ctor_error-004.phpt b/mongodb-1.2.8/tests/readPreference/readpreference-ctor_error-004.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/readPreference/readpreference-ctor_error-004.phpt
rename to mongodb-1.2.8/tests/readPreference/readpreference-ctor_error-004.phpt
diff --git a/mongodb-1.2.3/tests/readPreference/readpreference-debug-001.phpt b/mongodb-1.2.8/tests/readPreference/readpreference-debug-001.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/readPreference/readpreference-debug-001.phpt
rename to mongodb-1.2.8/tests/readPreference/readpreference-debug-001.phpt
diff --git a/mongodb-1.2.3/tests/readPreference/readpreference-getMaxStalenessMS-001.phpt b/mongodb-1.2.8/tests/readPreference/readpreference-getMaxStalenessMS-001.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/readPreference/readpreference-getMaxStalenessMS-001.phpt
rename to mongodb-1.2.8/tests/readPreference/readpreference-getMaxStalenessMS-001.phpt
diff --git a/mongodb-1.2.3/tests/readPreference/readpreference-getMode-001.phpt b/mongodb-1.2.8/tests/readPreference/readpreference-getMode-001.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/readPreference/readpreference-getMode-001.phpt
rename to mongodb-1.2.8/tests/readPreference/readpreference-getMode-001.phpt
diff --git a/mongodb-1.2.3/tests/readPreference/readpreference-getTagSets-001.phpt b/mongodb-1.2.8/tests/readPreference/readpreference-getTagSets-001.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/readPreference/readpreference-getTagSets-001.phpt
rename to mongodb-1.2.8/tests/readPreference/readpreference-getTagSets-001.phpt
diff --git a/mongodb-1.2.3/tests/readPreference/readpreference_error-001.phpt b/mongodb-1.2.8/tests/readPreference/readpreference_error-001.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/readPreference/readpreference_error-001.phpt
rename to mongodb-1.2.8/tests/readPreference/readpreference_error-001.phpt
diff --git a/mongodb-1.2.3/tests/server/bug0671-002.phpt b/mongodb-1.2.8/tests/server/bug0671-002.phpt
similarity index 84%
rename from mongodb-1.2.3/tests/server/bug0671-002.phpt
rename to mongodb-1.2.8/tests/server/bug0671-002.phpt
index b621ca49..3b32bc5a 100644
--- a/mongodb-1.2.3/tests/server/bug0671-002.phpt
+++ b/mongodb-1.2.8/tests/server/bug0671-002.phpt
@@ -1,25 +1,26 @@
--TEST--
PHPC-671: Segfault if Manager is already freed when using selected Server
--SKIPIF--
-<?php require __DIR__ . "/../utils/basic-skipif.inc"; CLEANUP(STANDALONE) ?>
+<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
+<?php NEEDS('STANDALONE'); CLEANUP(STANDALONE); ?>
--FILE--
<?php
require_once __DIR__ . "/../utils/basic.inc";
$manager = new MongoDB\Driver\Manager(STANDALONE);
$server = $manager->selectServer(new MongoDB\Driver\ReadPreference(MongoDB\Driver\ReadPreference::RP_PRIMARY));
unset($manager);
$cursor = $server->executeCommand(DATABASE_NAME, new MongoDB\Driver\Command(['ping' => 1]));
var_dump($cursor->toArray()[0]);
?>
===DONE===
<?php exit(0); ?>
--EXPECTF--
object(stdClass)#%d (%d) {
["ok"]=>
float(1)
}
===DONE===
diff --git a/mongodb-1.2.3/tests/server/server-constants.phpt b/mongodb-1.2.8/tests/server/server-constants.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/server/server-constants.phpt
rename to mongodb-1.2.8/tests/server/server-constants.phpt
diff --git a/mongodb-1.2.3/tests/server/server-construct-001.phpt b/mongodb-1.2.8/tests/server/server-construct-001.phpt
similarity index 82%
rename from mongodb-1.2.3/tests/server/server-construct-001.phpt
rename to mongodb-1.2.8/tests/server/server-construct-001.phpt
index 5b5a1321..08173069 100644
--- a/mongodb-1.2.3/tests/server/server-construct-001.phpt
+++ b/mongodb-1.2.8/tests/server/server-construct-001.phpt
@@ -1,24 +1,25 @@
--TEST--
MongoDB\Driver\Server::__construct()
--SKIPIF--
-<?php require __DIR__ . "/../utils/basic-skipif.inc"; CLEANUP(STANDALONE) ?>
+<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
+<?php NEEDS('STANDALONE'); CLEANUP(STANDALONE); ?>
--FILE--
<?php
require_once __DIR__ . "/../utils/basic.inc";
$parsed = parse_url(STANDALONE);
$manager = new MongoDB\Driver\Manager(STANDALONE);
$bulk = new \MongoDB\Driver\BulkWrite();
$bulk->insert(array('foo' => 'bar'));
$server = $manager->executeBulkWrite(NS, $bulk)->getServer();
var_dump($server->getHost() == $parsed["host"]);
var_dump($server->getPort() == $parsed["port"]);
?>
===DONE===
<?php exit(0); ?>
--EXPECTF--
bool(true)
bool(true)
===DONE===
diff --git a/mongodb-1.2.3/tests/server/server-debug.phpt b/mongodb-1.2.8/tests/server/server-debug.phpt
similarity index 90%
rename from mongodb-1.2.3/tests/server/server-debug.phpt
rename to mongodb-1.2.8/tests/server/server-debug.phpt
index c9040138..ae1ea56c 100644
--- a/mongodb-1.2.3/tests/server/server-debug.phpt
+++ b/mongodb-1.2.8/tests/server/server-debug.phpt
@@ -1,60 +1,61 @@
--TEST--
MongoDB\Driver\Server debugInfo
--SKIPIF--
-<?php require __DIR__ . "/../utils/basic-skipif.inc"; CLEANUP(STANDALONE) ?>
+<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
+<?php NEEDS('STANDALONE'); CLEANUP(STANDALONE); ?>
--FILE--
<?php
require_once __DIR__ . "/../utils/basic.inc";
$manager = new MongoDB\Driver\Manager(STANDALONE);
$server = $manager->executeQuery(NS, new MongoDB\Driver\Query(array()))->getServer();
var_dump($server);
?>
===DONE===
<?php exit(0); ?>
--EXPECTF--
object(MongoDB\Driver\Server)#%d (%d) {
["host"]=>
string(%d) "%s"
["port"]=>
int(%d)
["type"]=>
int(1)
["is_primary"]=>
bool(false)
["is_secondary"]=>
bool(false)
["is_arbiter"]=>
bool(false)
["is_hidden"]=>
bool(false)
["is_passive"]=>
bool(false)
["last_is_master"]=>
array(%d) {
["ismaster"]=>
bool(true)
["maxBsonObjectSize"]=>
int(16777216)
["maxMessageSizeBytes"]=>
int(48000000)
["maxWriteBatchSize"]=>
int(1000)
["localTime"]=>
object(%s\UTCDateTime)#%d (%d) {
["milliseconds"]=>
%r(int\(\d+\)|string\(\d+\) "\d+")%r
}
["maxWireVersion"]=>
int(%d)
["minWireVersion"]=>
int(0)
%a
float(1)
}
["round_trip_time"]=>
int(%d)
}
===DONE===
diff --git a/mongodb-1.2.3/tests/server/server-errors.phpt b/mongodb-1.2.8/tests/server/server-errors.phpt
similarity index 94%
rename from mongodb-1.2.3/tests/server/server-errors.phpt
rename to mongodb-1.2.8/tests/server/server-errors.phpt
index c25b3108..af02d3c5 100644
--- a/mongodb-1.2.3/tests/server/server-errors.phpt
+++ b/mongodb-1.2.8/tests/server/server-errors.phpt
@@ -1,60 +1,61 @@
--TEST--
MongoDB\Driver\Server::executeQuery() with sort and empty filter
--SKIPIF--
-<?php require __DIR__ . "/../utils/basic-skipif.inc"; CLEANUP(STANDALONE) ?>
+<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
+<?php NEEDS('STANDALONE'); CLEANUP(STANDALONE); ?>
--FILE--
<?php
require_once __DIR__ . "/../utils/basic.inc";
$manager = new MongoDB\Driver\Manager(STANDALONE);
$server = $manager->executeQuery(NS, new MongoDB\Driver\Query(array()))->getServer();
var_dump($server->getHost(true));
var_dump($server->getTags(true));
var_dump($server->getInfo(true));
var_dump($server->getLatency(true));
var_dump($server->getPort(true));
var_dump($server->getType(true));
var_dump($server->isPrimary(true));
var_dump($server->isSecondary(true));
var_dump($server->isArbiter(true));
var_dump($server->isHidden(true));
var_dump($server->isPassive(true));
?>
===DONE===
<?php exit(0); ?>
--EXPECTF--
Warning: MongoDB\Driver\Server::getHost() expects exactly 0 parameters, 1 given in %s on line %d
NULL
Warning: MongoDB\Driver\Server::getTags() expects exactly 0 parameters, 1 given in %s on line %d
NULL
Warning: MongoDB\Driver\Server::getInfo() expects exactly 0 parameters, 1 given in %s on line %d
NULL
Warning: MongoDB\Driver\Server::getLatency() expects exactly 0 parameters, 1 given in %s on line %d
NULL
Warning: MongoDB\Driver\Server::getPort() expects exactly 0 parameters, 1 given in %s on line %d
NULL
Warning: MongoDB\Driver\Server::getType() expects exactly 0 parameters, 1 given in %s on line %d
NULL
Warning: MongoDB\Driver\Server::isPrimary() expects exactly 0 parameters, 1 given in %s on line %d
NULL
Warning: MongoDB\Driver\Server::isSecondary() expects exactly 0 parameters, 1 given in %s on line %d
NULL
Warning: MongoDB\Driver\Server::isArbiter() expects exactly 0 parameters, 1 given in %s on line %d
NULL
Warning: MongoDB\Driver\Server::isHidden() expects exactly 0 parameters, 1 given in %s on line %d
NULL
Warning: MongoDB\Driver\Server::isPassive() expects exactly 0 parameters, 1 given in %s on line %d
NULL
===DONE===
diff --git a/mongodb-1.2.3/tests/server/server-executeBulkWrite-001.phpt b/mongodb-1.2.8/tests/server/server-executeBulkWrite-001.phpt
similarity index 94%
rename from mongodb-1.2.3/tests/server/server-executeBulkWrite-001.phpt
rename to mongodb-1.2.8/tests/server/server-executeBulkWrite-001.phpt
index 6fce9aa7..a124bb53 100644
--- a/mongodb-1.2.3/tests/server/server-executeBulkWrite-001.phpt
+++ b/mongodb-1.2.8/tests/server/server-executeBulkWrite-001.phpt
@@ -1,93 +1,94 @@
--TEST--
MongoDB\Driver\Server::executeBulkWrite()
--SKIPIF--
-<?php require __DIR__ . "/../utils/basic-skipif.inc"; CLEANUP(STANDALONE) ?>
+<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
+<?php NEEDS('STANDALONE'); CLEANUP(STANDALONE); ?>
--FILE--
<?php
require_once __DIR__ . "/../utils/basic.inc";
$manager = new MongoDB\Driver\Manager(STANDALONE);
$server = $manager->executeQuery(NS, new MongoDB\Driver\Query(array()))->getServer();
$bulk = new MongoDB\Driver\BulkWrite();
$bulk->insert(array('_id' => 1, 'x' => 1));
$bulk->insert(array('_id' => 2, 'x' => 2));
$bulk->update(array('x' => 2), array('$set' => array('x' => 1)), array("limit" => 1, "upsert" => false));
$bulk->update(array('_id' => 3), array('$set' => array('x' => 3)), array("limit" => 1, "upsert" => true));
$bulk->delete(array('x' => 1), array("limit" => 1));
$result = $server->executeBulkWrite(NS, $bulk);
printf("WriteResult.server is the same: %s\n", $server == $result->getServer() ? 'yes' : 'no');
echo "\n===> WriteResult\n";
printWriteResult($result);
var_dump($result);
echo "\n===> Collection\n";
$cursor = $server->executeQuery(NS, new MongoDB\Driver\Query(array()));
var_dump(iterator_to_array($cursor));
?>
===DONE===
<?php exit(0); ?>
--EXPECTF--
WriteResult.server is the same: yes
===> WriteResult
server: %s:%d
insertedCount: 2
matchedCount: 1
modifiedCount: 1
upsertedCount: 1
deletedCount: 1
upsertedId[3]: int(3)
object(MongoDB\Driver\WriteResult)#%d (%d) {
["nInserted"]=>
int(2)
["nMatched"]=>
int(1)
["nModified"]=>
int(1)
["nRemoved"]=>
int(1)
["nUpserted"]=>
int(1)
["upsertedIds"]=>
array(1) {
[0]=>
array(%d) {
["index"]=>
int(3)
["_id"]=>
int(3)
}
}
["writeErrors"]=>
array(0) {
}
["writeConcernError"]=>
NULL
["writeConcern"]=>
object(MongoDB\Driver\WriteConcern)#%d (%d) {
}
}
===> Collection
array(2) {
[0]=>
object(stdClass)#%d (%d) {
["_id"]=>
int(2)
["x"]=>
int(1)
}
[1]=>
object(stdClass)#%d (%d) {
["_id"]=>
int(3)
["x"]=>
int(3)
}
}
===DONE===
diff --git a/mongodb-1.2.3/tests/server/server-executeBulkWrite-002.phpt b/mongodb-1.2.8/tests/server/server-executeBulkWrite-002.phpt
similarity index 87%
rename from mongodb-1.2.3/tests/server/server-executeBulkWrite-002.phpt
rename to mongodb-1.2.8/tests/server/server-executeBulkWrite-002.phpt
index b24ceeb3..35a11130 100644
--- a/mongodb-1.2.3/tests/server/server-executeBulkWrite-002.phpt
+++ b/mongodb-1.2.8/tests/server/server-executeBulkWrite-002.phpt
@@ -1,31 +1,32 @@
--TEST--
MongoDB\Driver\Server::executeBulkWrite() with write concern (standalone)
--SKIPIF--
-<?php require __DIR__ . "/../utils/basic-skipif.inc"; CLEANUP(STANDALONE) ?>
+<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
+<?php NEEDS('STANDALONE'); CLEANUP(STANDALONE); ?>
--FILE--
<?php
require_once __DIR__ . "/../utils/basic.inc";
$manager = new MongoDB\Driver\Manager(STANDALONE);
$primary = $manager->selectServer(new MongoDB\Driver\ReadPreference(MongoDB\Driver\ReadPreference::RP_PRIMARY));
$writeConcerns = array(0, 1);
foreach ($writeConcerns as $writeConcern) {
$bulk = new MongoDB\Driver\BulkWrite();
$bulk->insert(array('wc' => $writeConcern));
$result = $primary->executeBulkWrite(NS, $bulk, new MongoDB\Driver\WriteConcern($writeConcern));
var_dump($result->isAcknowledged());
var_dump($result->getInsertedCount());
}
?>
===DONE===
<?php exit(0); ?>
--EXPECT--
bool(false)
NULL
bool(true)
int(1)
===DONE===
diff --git a/mongodb-1.2.3/tests/server/server-executeBulkWrite-003.phpt b/mongodb-1.2.8/tests/server/server-executeBulkWrite-003.phpt
similarity index 94%
rename from mongodb-1.2.3/tests/server/server-executeBulkWrite-003.phpt
rename to mongodb-1.2.8/tests/server/server-executeBulkWrite-003.phpt
index 033a8474..94cf4742 100644
--- a/mongodb-1.2.3/tests/server/server-executeBulkWrite-003.phpt
+++ b/mongodb-1.2.8/tests/server/server-executeBulkWrite-003.phpt
@@ -1,36 +1,36 @@
--TEST--
MongoDB\Driver\Server::executeBulkWrite() with write concern (replica set primary)
--SKIPIF--
<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
-<?php NEEDS("REPLICASET"); CLEANUP(REPLICASET); ?>
+<?php NEEDS('REPLICASET'); CLEANUP(REPLICASET); ?>
--FILE--
<?php
require_once __DIR__ . "/../utils/basic.inc";
$manager = new MongoDB\Driver\Manager(REPLICASET);
$server = $manager->selectServer(new MongoDB\Driver\ReadPreference(MongoDB\Driver\ReadPreference::RP_PRIMARY));
$writeConcerns = array(0, 1, 2, MongoDB\Driver\WriteConcern::MAJORITY);
foreach ($writeConcerns as $wc) {
$bulk = new MongoDB\Driver\BulkWrite();
$bulk->insert(array('wc' => $wc));
$result = $server->executeBulkWrite(NS, $bulk, new MongoDB\Driver\WriteConcern($wc));
var_dump($result->isAcknowledged());
var_dump($result->getInsertedCount());
}
?>
===DONE===
<?php exit(0); ?>
--EXPECT--
bool(false)
NULL
bool(true)
int(1)
bool(true)
int(1)
bool(true)
int(1)
===DONE===
diff --git a/mongodb-1.2.3/tests/server/server-executeBulkWrite-004.phpt b/mongodb-1.2.8/tests/server/server-executeBulkWrite-004.phpt
similarity index 96%
rename from mongodb-1.2.3/tests/server/server-executeBulkWrite-004.phpt
rename to mongodb-1.2.8/tests/server/server-executeBulkWrite-004.phpt
index 52dc4136..1537e1be 100644
--- a/mongodb-1.2.3/tests/server/server-executeBulkWrite-004.phpt
+++ b/mongodb-1.2.8/tests/server/server-executeBulkWrite-004.phpt
@@ -1,43 +1,43 @@
--TEST--
MongoDB\Driver\Server::executeBulkWrite() with write concern (replica set secondary)
--SKIPIF--
<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
-<?php NEEDS("REPLICASET"); CLEANUP(REPLICASET); ?>
+<?php NEEDS('REPLICASET'); CLEANUP(REPLICASET); ?>
--FILE--
<?php
require_once __DIR__ . "/../utils/basic.inc";
$manager = new MongoDB\Driver\Manager(REPLICASET);
$server = $manager->selectServer(new MongoDB\Driver\ReadPreference(MongoDB\Driver\ReadPreference::RP_SECONDARY));
$bulk = new MongoDB\Driver\BulkWrite();
$bulk->insert(array('wc' => 0));
$result = $server->executeBulkWrite(NS, $bulk, new MongoDB\Driver\WriteConcern(0));
var_dump($result->isAcknowledged());
var_dump($result->getInsertedCount());
$writeConcerns = array(1, 2, MongoDB\Driver\WriteConcern::MAJORITY);
foreach ($writeConcerns as $wc) {
$bulk = new MongoDB\Driver\BulkWrite();
$bulk->insert(array('wc' => $wc));
echo throws(function() use ($server, $bulk, $wc) {
$server->executeBulkWrite(NS, $bulk, new MongoDB\Driver\WriteConcern($wc));
}, "MongoDB\Driver\Exception\RuntimeException"), "\n";
}
?>
===DONE===
<?php exit(0); ?>
--EXPECT--
bool(false)
NULL
OK: Got MongoDB\Driver\Exception\RuntimeException
not master
OK: Got MongoDB\Driver\Exception\RuntimeException
not master
OK: Got MongoDB\Driver\Exception\RuntimeException
not master
===DONE===
diff --git a/mongodb-1.2.3/tests/server/server-executeBulkWrite-005.phpt b/mongodb-1.2.8/tests/server/server-executeBulkWrite-005.phpt
similarity index 95%
rename from mongodb-1.2.3/tests/server/server-executeBulkWrite-005.phpt
rename to mongodb-1.2.8/tests/server/server-executeBulkWrite-005.phpt
index 4c1915d4..458006fb 100644
--- a/mongodb-1.2.3/tests/server/server-executeBulkWrite-005.phpt
+++ b/mongodb-1.2.8/tests/server/server-executeBulkWrite-005.phpt
@@ -1,37 +1,37 @@
--TEST--
MongoDB\Driver\Server::executeBulkWrite() with write concern (replica set secondary, local DB)
--SKIPIF--
<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
-<?php NEEDS("REPLICASET"); CLEANUP(REPLICASET); ?>
+<?php NEEDS('REPLICASET'); CLEANUP(REPLICASET); ?>
--FILE--
<?php
require_once __DIR__ . "/../utils/basic.inc";
$manager = new MongoDB\Driver\Manager(REPLICASET);
$server = $manager->selectServer(new MongoDB\Driver\ReadPreference(MongoDB\Driver\ReadPreference::RP_SECONDARY));
/* The server ignores write concerns with w>2 for writes to the local database,
* so we won't test behavior for w=2 and w=majority. */
$writeConcerns = array(0, 1);
foreach ($writeConcerns as $wc) {
$bulk = new MongoDB\Driver\BulkWrite();
$bulk->insert(array('wc' => $wc));
$result = $server->executeBulkWrite('local.' . COLLECTION_NAME, $bulk, new MongoDB\Driver\WriteConcern($wc));
var_dump($result->isAcknowledged());
var_dump($result->getInsertedCount());
}
$command = new MongoDB\Driver\Command(array('drop' => COLLECTION_NAME));
$server->executeCommand('local', $command);
?>
===DONE===
<?php exit(0); ?>
--EXPECT--
bool(false)
NULL
bool(true)
int(1)
===DONE===
diff --git a/mongodb-1.2.3/tests/server/server-executeCommand-001.phpt b/mongodb-1.2.8/tests/server/server-executeCommand-001.phpt
similarity index 91%
rename from mongodb-1.2.3/tests/server/server-executeCommand-001.phpt
rename to mongodb-1.2.8/tests/server/server-executeCommand-001.phpt
index 9a273aca..f114f65d 100644
--- a/mongodb-1.2.3/tests/server/server-executeCommand-001.phpt
+++ b/mongodb-1.2.8/tests/server/server-executeCommand-001.phpt
@@ -1,63 +1,64 @@
--TEST--
MongoDB\Driver\Server::executeCommand()
--SKIPIF--
-<?php require __DIR__ . "/../utils/basic-skipif.inc"; CLEANUP(STANDALONE) ?>
+<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
+<?php NEEDS('STANDALONE'); CLEANUP(STANDALONE); ?>
--FILE--
<?php
require_once __DIR__ . "/../utils/basic.inc";
$manager = new MongoDB\Driver\Manager(STANDALONE);
$server = $manager->executeQuery(NS, new MongoDB\Driver\Query(array()))->getServer();
$command = new MongoDB\Driver\Command(array('ping' => 1));
$result = $server->executeCommand(DATABASE_NAME, $command);
var_dump($result instanceof MongoDB\Driver\Cursor);
var_dump($result);
echo "\nDumping response document:\n";
var_dump(current($result->toArray()));
var_dump($server == $result->getServer());
?>
===DONE===
<?php exit(0); ?>
--EXPECTF--
bool(true)
object(MongoDB\Driver\Cursor)#%d (%d) {
["database"]=>
string(6) "phongo"
["collection"]=>
NULL
["query"]=>
NULL
["command"]=>
object(MongoDB\Driver\Command)#%d (%d) {
["command"]=>
object(stdClass)#%d (%d) {
["ping"]=>
int(1)
}
}
["readPreference"]=>
NULL
["isDead"]=>
bool(false)
["currentIndex"]=>
int(0)
["currentDocument"]=>
NULL
["server"]=>
object(MongoDB\Driver\Server)#%d (%d) {
%a
}
}
Dumping response document:
object(stdClass)#%d (1) {
["ok"]=>
float(1)
}
bool(true)
===DONE===
diff --git a/mongodb-1.2.3/tests/server/server-executeCommand-002.phpt b/mongodb-1.2.8/tests/server/server-executeCommand-002.phpt
similarity index 92%
rename from mongodb-1.2.3/tests/server/server-executeCommand-002.phpt
rename to mongodb-1.2.8/tests/server/server-executeCommand-002.phpt
index e4d290fe..9fdec58c 100644
--- a/mongodb-1.2.3/tests/server/server-executeCommand-002.phpt
+++ b/mongodb-1.2.8/tests/server/server-executeCommand-002.phpt
@@ -1,68 +1,69 @@
--TEST--
MongoDB\Driver\Server::executeCommand() takes a read preference
--SKIPIF--
-<?php require __DIR__ . "/../utils/basic-skipif.inc"; NEEDS("REPLICASET"); ?>
+<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
+<?php NEEDS('REPLICASET'); CLEANUP(REPLICASET, DATABASE_NAME, 'system.profile'); ?>
--FILE--
<?php
require_once __DIR__ . "/../utils/basic.inc";
$manager = new MongoDB\Driver\Manager(REPLICASET);
$rp = new MongoDB\Driver\ReadPreference(MongoDB\Driver\ReadPreference::RP_SECONDARY);
$secondary = $manager->selectServer($rp);
$command = new MongoDB\Driver\Command(array('profile' => 2));
$cursor = $secondary->executeCommand(DATABASE_NAME, $command);
$result = current($cursor->toArray());
printf("Set profile level to 2 successfully: %s\n", (empty($result->ok) ? 'no' : 'yes'));
$command = new MongoDB\Driver\Command(array(
'aggregate' => COLLECTION_NAME,
'pipeline' => array(array('$match' => array('x' => 1))),
));
$secondary->executeCommand(DATABASE_NAME, $command, $rp);
$query = new MongoDB\Driver\Query(
array(
'op' => 'command',
'ns' => DATABASE_NAME . '.' . COLLECTION_NAME,
),
array(
'sort' => array('ts' => -1),
'limit' => 1,
)
);
$cursor = $secondary->executeQuery(DATABASE_NAME . '.system.profile', $query, $rp);
$profileEntry = current($cursor->toArray());
var_dump($profileEntry->command);
$command = new MongoDB\Driver\Command(array('profile' => 0));
$cursor = $secondary->executeCommand(DATABASE_NAME, $command);
$result = current($cursor->toArray());
printf("Set profile level to 0 successfully: %s\n", (empty($result->ok) ? 'no' : 'yes'));
?>
===DONE===
<?php exit(0); ?>
--EXPECTF--
Set profile level to 2 successfully: yes
object(stdClass)#%d (%d) {
["aggregate"]=>
string(32) "server_server_executeCommand_002"
["pipeline"]=>
array(1) {
[0]=>
object(stdClass)#%d (%d) {
["$match"]=>
object(stdClass)#%d (%d) {
["x"]=>
int(1)
}
}
}
}
Set profile level to 0 successfully: yes
===DONE===
diff --git a/mongodb-1.2.3/tests/server/server-executeCommand-003.phpt b/mongodb-1.2.8/tests/server/server-executeCommand-003.phpt
similarity index 91%
rename from mongodb-1.2.3/tests/server/server-executeCommand-003.phpt
rename to mongodb-1.2.8/tests/server/server-executeCommand-003.phpt
index 3c69ac72..00c4692e 100644
--- a/mongodb-1.2.3/tests/server/server-executeCommand-003.phpt
+++ b/mongodb-1.2.8/tests/server/server-executeCommand-003.phpt
@@ -1,33 +1,34 @@
--TEST--
MongoDB\Driver\Server::executeCommand() with conflicting read preference for secondary
--SKIPIF--
-<?php require __DIR__ . "/../utils/basic-skipif.inc"; NEEDS("REPLICASET"); ?>
+<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
+<?php NEEDS('REPLICASET'); ?>
--FILE--
<?php
require_once __DIR__ . "/../utils/basic.inc";
$manager = new MongoDB\Driver\Manager(REPLICASET);
$secondaryRp = new MongoDB\Driver\ReadPreference(MongoDB\Driver\ReadPreference::RP_SECONDARY);
$secondary = $manager->selectServer($secondaryRp);
/* Note: this is testing that the read preference (even a conflicting one) has
* no effect when directly querying a server, since the slaveOk flag is always
* set for hinted commands. */
$primaryRp = new MongoDB\Driver\ReadPreference(MongoDB\Driver\ReadPreference::RP_PRIMARY);
$cursor = $secondary->executeCommand(DATABASE_NAME, new MongoDB\Driver\Command(array('ping' => 1)), $primaryRp);
var_dump($cursor->toArray());
?>
===DONE===
<?php exit(0); ?>
--EXPECTF--
array(1) {
[0]=>
object(stdClass)#%d (%d) {
["ok"]=>
float(1)
}
}
===DONE===
diff --git a/mongodb-1.2.3/tests/server/server-executeQuery-001.phpt b/mongodb-1.2.8/tests/server/server-executeQuery-001.phpt
similarity index 90%
rename from mongodb-1.2.3/tests/server/server-executeQuery-001.phpt
rename to mongodb-1.2.8/tests/server/server-executeQuery-001.phpt
index 28bfa833..658c8ac1 100644
--- a/mongodb-1.2.3/tests/server/server-executeQuery-001.phpt
+++ b/mongodb-1.2.8/tests/server/server-executeQuery-001.phpt
@@ -1,41 +1,42 @@
--TEST--
MongoDB\Driver\Server::executeQuery() with filter and projection
--SKIPIF--
-<?php require __DIR__ . "/../utils/basic-skipif.inc"; CLEANUP(STANDALONE); CLEANUP(STANDALONE); ?>
+<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
+<?php NEEDS('STANDALONE'); CLEANUP(STANDALONE); ?>
--FILE--
<?php
require_once __DIR__ . "/../utils/basic.inc";
$manager = new MongoDB\Driver\Manager(STANDALONE);
$server = $manager->executeQuery(NS, new MongoDB\Driver\Query(array()))->getServer();
// load fixtures for test
$bulk = new \MongoDB\Driver\BulkWrite();
$bulk->insert(array('_id' => 1, 'x' => 2, 'y' => 3));
$bulk->insert(array('_id' => 2, 'x' => 3, 'y' => 4));
$bulk->insert(array('_id' => 3, 'x' => 4, 'y' => 5));
$server->executeBulkWrite(NS, $bulk);
$query = new MongoDB\Driver\Query(array('x' => 3), array('projection' => array('y' => 1)));
$cursor = $server->executeQuery(NS, $query);
var_dump($cursor instanceof MongoDB\Driver\Cursor);
var_dump($server == $cursor->getServer());
var_dump(iterator_to_array($cursor));
?>
===DONE===
<?php exit(0); ?>
--EXPECTF--
bool(true)
bool(true)
array(1) {
[0]=>
object(stdClass)#%d (2) {
["_id"]=>
int(2)
["y"]=>
int(4)
}
}
===DONE===
diff --git a/mongodb-1.2.3/tests/server/server-executeQuery-002.phpt b/mongodb-1.2.8/tests/server/server-executeQuery-002.phpt
similarity index 91%
rename from mongodb-1.2.3/tests/server/server-executeQuery-002.phpt
rename to mongodb-1.2.8/tests/server/server-executeQuery-002.phpt
index 8a219e2d..9942089b 100644
--- a/mongodb-1.2.3/tests/server/server-executeQuery-002.phpt
+++ b/mongodb-1.2.8/tests/server/server-executeQuery-002.phpt
@@ -1,61 +1,62 @@
--TEST--
MongoDB\Driver\Server::executeQuery() with sort and empty filter
--SKIPIF--
-<?php require __DIR__ . "/../utils/basic-skipif.inc"; CLEANUP(STANDALONE) ?>
+<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
+<?php NEEDS('STANDALONE'); CLEANUP(STANDALONE); ?>
--FILE--
<?php
require_once __DIR__ . "/../utils/basic.inc";
$manager = new MongoDB\Driver\Manager(STANDALONE);
$server = $manager->executeQuery(NS, new MongoDB\Driver\Query(array()))->getServer();
// load fixtures for test
$bulk = new \MongoDB\Driver\BulkWrite();
$bulk->insert(array('_id' => 1, 'x' => 2, 'y' => 3));
$bulk->insert(array('_id' => 2, 'x' => 3, 'y' => 4));
$bulk->insert(array('_id' => 3, 'x' => 4, 'y' => 5));
$server->executeBulkWrite(NS, $bulk);
$query = new MongoDB\Driver\Query(array(), array('sort' => array('_id' => -1)));
$cursor = $server->executeQuery(NS, $query);
var_dump($cursor instanceof MongoDB\Driver\Cursor);
var_dump($server == $cursor->getServer());
var_dump(iterator_to_array($cursor));
?>
===DONE===
<?php exit(0); ?>
--EXPECTF--
bool(true)
bool(true)
array(3) {
[0]=>
object(stdClass)#%d (3) {
["_id"]=>
int(3)
["x"]=>
int(4)
["y"]=>
int(5)
}
[1]=>
object(stdClass)#%d (3) {
["_id"]=>
int(2)
["x"]=>
int(3)
["y"]=>
int(4)
}
[2]=>
object(stdClass)#%d (3) {
["_id"]=>
int(1)
["x"]=>
int(2)
["y"]=>
int(3)
}
}
===DONE===
diff --git a/mongodb-1.2.3/tests/server/server-executeQuery-003.phpt b/mongodb-1.2.8/tests/server/server-executeQuery-003.phpt
similarity index 92%
rename from mongodb-1.2.3/tests/server/server-executeQuery-003.phpt
rename to mongodb-1.2.8/tests/server/server-executeQuery-003.phpt
index 60da64c9..279b9de0 100644
--- a/mongodb-1.2.3/tests/server/server-executeQuery-003.phpt
+++ b/mongodb-1.2.8/tests/server/server-executeQuery-003.phpt
@@ -1,61 +1,62 @@
--TEST--
MongoDB\Driver\Server::executeQuery() with modifiers and empty filter
--SKIPIF--
-<?php require __DIR__ . "/../utils/basic-skipif.inc"; CLEANUP(STANDALONE) ?>
+<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
+<?php NEEDS('STANDALONE'); CLEANUP(STANDALONE); ?>
--FILE--
<?php
require_once __DIR__ . "/../utils/basic.inc";
$manager = new MongoDB\Driver\Manager(STANDALONE);
$server = $manager->executeQuery(NS, new MongoDB\Driver\Query(array()))->getServer();
// load fixtures for test
$bulk = new \MongoDB\Driver\BulkWrite();
$bulk->insert(array('_id' => 1, 'x' => 2, 'y' => 3));
$bulk->insert(array('_id' => 2, 'x' => 3, 'y' => 4));
$bulk->insert(array('_id' => 3, 'x' => 4, 'y' => 5));
$server->executeBulkWrite(NS, $bulk);
$query = new MongoDB\Driver\Query(array(), array('modifiers' => array('$comment' => 'foo')));
$cursor = $server->executeQuery(NS, $query);
var_dump($cursor instanceof MongoDB\Driver\Cursor);
var_dump($server == $cursor->getServer());
var_dump(iterator_to_array($cursor));
?>
===DONE===
<?php exit(0); ?>
--EXPECTF--
bool(true)
bool(true)
array(3) {
[0]=>
object(stdClass)#%d (3) {
["_id"]=>
int(1)
["x"]=>
int(2)
["y"]=>
int(3)
}
[1]=>
object(stdClass)#%d (3) {
["_id"]=>
int(2)
["x"]=>
int(3)
["y"]=>
int(4)
}
[2]=>
object(stdClass)#%d (3) {
["_id"]=>
int(3)
["x"]=>
int(4)
["y"]=>
int(5)
}
}
===DONE===
diff --git a/mongodb-1.2.3/tests/server/server-executeQuery-004.phpt b/mongodb-1.2.8/tests/server/server-executeQuery-004.phpt
similarity index 85%
rename from mongodb-1.2.3/tests/server/server-executeQuery-004.phpt
rename to mongodb-1.2.8/tests/server/server-executeQuery-004.phpt
index 397240f1..c149ad98 100644
--- a/mongodb-1.2.3/tests/server/server-executeQuery-004.phpt
+++ b/mongodb-1.2.8/tests/server/server-executeQuery-004.phpt
@@ -1,27 +1,28 @@
--TEST--
MongoDB\Driver\Server::executeQuery() finds no matching documents
--SKIPIF--
-<?php require __DIR__ . "/../utils/basic-skipif.inc"; CLEANUP(STANDALONE) ?>
+<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
+<?php NEEDS('STANDALONE'); CLEANUP(STANDALONE); ?>
--FILE--
<?php
require_once __DIR__ . "/../utils/basic.inc";
$manager = new MongoDB\Driver\Manager(STANDALONE);
$server = $manager->executeQuery(NS, new MongoDB\Driver\Query(array()))->getServer();
$bulk = new \MongoDB\Driver\BulkWrite();
$bulk->insert(array('_id' => 1, 'x' => 1));
$bulk->insert(array('_id' => 2, 'x' => 1));
$server->executeBulkWrite(NS, $bulk);
$cursor = $server->executeQuery(NS, new MongoDB\Driver\Query(array("x" => 2)));
var_dump(iterator_to_array($cursor));
?>
===DONE===
<?php exit(0); ?>
--EXPECT--
array(0) {
}
===DONE===
diff --git a/mongodb-1.2.3/tests/server/server-executeQuery-005.phpt b/mongodb-1.2.8/tests/server/server-executeQuery-005.phpt
similarity index 91%
rename from mongodb-1.2.3/tests/server/server-executeQuery-005.phpt
rename to mongodb-1.2.8/tests/server/server-executeQuery-005.phpt
index 4ae8d6a1..13fdd7ce 100644
--- a/mongodb-1.2.3/tests/server/server-executeQuery-005.phpt
+++ b/mongodb-1.2.8/tests/server/server-executeQuery-005.phpt
@@ -1,57 +1,58 @@
--TEST--
MongoDB\Driver\Server::executeQuery() takes a read preference (OP_QUERY)
--SKIPIF--
-<?php require __DIR__ . "/../utils/basic-skipif.inc"; NEEDS("REPLICASET_30"); ?>
+<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
+<?php NEEDS('REPLICASET_30'); CLEANUP(REPLICASET_30, DATABASE_NAME, 'system.profile'); ?>
--FILE--
<?php
require_once __DIR__ . "/../utils/basic.inc";
$manager = new MongoDB\Driver\Manager(REPLICASET_30);
$rp = new MongoDB\Driver\ReadPreference(MongoDB\Driver\ReadPreference::RP_SECONDARY);
$secondary = $manager->selectServer($rp);
$command = new MongoDB\Driver\Command(array('profile' => 2));
$cursor = $secondary->executeCommand(DATABASE_NAME, $command);
$result = current($cursor->toArray());
printf("Set profile level to 2 successfully: %s\n", (empty($result->ok) ? 'no' : 'yes'));
if (empty($result->ok)) {
exit("Could not set profile level\n");
}
$secondary->executeQuery(NS, new MongoDB\Driver\Query(array("x" => 1)), $rp);
$query = new MongoDB\Driver\Query(
array(
'op' => 'query',
'ns' => NS,
),
array(
'sort' => array('ts' => -1),
'limit' => 1,
)
);
$cursor = $secondary->executeQuery(DATABASE_NAME . '.system.profile', $query, $rp);
$profileEntry = current($cursor->toArray());
var_dump($profileEntry->query);
$command = new MongoDB\Driver\Command(array('profile' => 0));
$cursor = $secondary->executeCommand(DATABASE_NAME, $command);
$result = current($cursor->toArray());
printf("Set profile level to 0 successfully: %s\n", (empty($result->ok) ? 'no' : 'yes'));
?>
===DONE===
<?php exit(0); ?>
--EXPECTF--
Set profile level to 2 successfully: yes
object(stdClass)#%d (%d) {
["x"]=>
int(1)
}
Set profile level to 0 successfully: yes
===DONE===
diff --git a/mongodb-1.2.3/tests/server/server-executeQuery-006.phpt b/mongodb-1.2.8/tests/server/server-executeQuery-006.phpt
similarity index 91%
rename from mongodb-1.2.3/tests/server/server-executeQuery-006.phpt
rename to mongodb-1.2.8/tests/server/server-executeQuery-006.phpt
index 6a1671ac..9889bfc5 100644
--- a/mongodb-1.2.3/tests/server/server-executeQuery-006.phpt
+++ b/mongodb-1.2.8/tests/server/server-executeQuery-006.phpt
@@ -1,62 +1,63 @@
--TEST--
MongoDB\Driver\Server::executeQuery() takes a read preference (find command)
--SKIPIF--
-<?php require __DIR__ . "/../utils/basic-skipif.inc"; NEEDS("REPLICASET"); ?>
+<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
+<?php NEEDS('REPLICASET'); CLEANUP(REPLICASET, DATABASE_NAME, 'system.profile'); ?>
--FILE--
<?php
require_once __DIR__ . "/../utils/basic.inc";
$manager = new MongoDB\Driver\Manager(REPLICASET);
$rp = new MongoDB\Driver\ReadPreference(MongoDB\Driver\ReadPreference::RP_SECONDARY);
$secondary = $manager->selectServer($rp);
$command = new MongoDB\Driver\Command(array('profile' => 2));
$cursor = $secondary->executeCommand(DATABASE_NAME, $command);
$result = current($cursor->toArray());
printf("Set profile level to 2 successfully: %s\n", (empty($result->ok) ? 'no' : 'yes'));
if (empty($result->ok)) {
exit("Could not set profile level\n");
}
$secondary->executeQuery(NS, new MongoDB\Driver\Query(array("x" => 1)), $rp);
$query = new MongoDB\Driver\Query(
array(
'op' => 'query',
'ns' => NS,
),
array(
'sort' => array('ts' => -1),
'limit' => 1,
)
);
$cursor = $secondary->executeQuery(DATABASE_NAME . '.system.profile', $query, $rp);
$profileEntry = current($cursor->toArray());
var_dump($profileEntry->query);
$command = new MongoDB\Driver\Command(array('profile' => 0));
$cursor = $secondary->executeCommand(DATABASE_NAME, $command);
$result = current($cursor->toArray());
printf("Set profile level to 0 successfully: %s\n", (empty($result->ok) ? 'no' : 'yes'));
?>
===DONE===
<?php exit(0); ?>
--EXPECTF--
Set profile level to 2 successfully: yes
object(stdClass)#%d (%d) {
["find"]=>
string(%d) "%s"
["filter"]=>
object(stdClass)#%d (1) {
["x"]=>
int(1)
}
}
Set profile level to 0 successfully: yes
===DONE===
diff --git a/mongodb-1.2.3/tests/server/server-executeQuery-007.phpt b/mongodb-1.2.8/tests/server/server-executeQuery-007.phpt
similarity index 91%
rename from mongodb-1.2.3/tests/server/server-executeQuery-007.phpt
rename to mongodb-1.2.8/tests/server/server-executeQuery-007.phpt
index cb1a3eb8..44a3e5f5 100644
--- a/mongodb-1.2.3/tests/server/server-executeQuery-007.phpt
+++ b/mongodb-1.2.8/tests/server/server-executeQuery-007.phpt
@@ -1,52 +1,53 @@
--TEST--
MongoDB\Driver\Server::executeQuery() with negative limit returns a single batch
--SKIPIF--
-<?php require __DIR__ . "/../utils/basic-skipif.inc"; CLEANUP(STANDALONE) ?>
+<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
+<?php NEEDS('STANDALONE'); CLEANUP(STANDALONE); ?>
--FILE--
<?php
require_once __DIR__ . "/../utils/basic.inc";
$manager = new MongoDB\Driver\Manager(STANDALONE);
$server = $manager->executeQuery(NS, new MongoDB\Driver\Query(array()))->getServer();
// load fixtures for test
$bulk = new \MongoDB\Driver\BulkWrite();
$bulk->insert(['_id' => 1, 'x' => 2, 'y' => 3]);
$bulk->insert(['_id' => 2, 'x' => 3, 'y' => 4]);
$bulk->insert(['_id' => 3, 'x' => 4, 'y' => 5]);
$server->executeBulkWrite(NS, $bulk);
$query = new MongoDB\Driver\Query([], ['limit' => -2]);
$cursor = $server->executeQuery(NS, $query);
var_dump($cursor instanceof MongoDB\Driver\Cursor);
var_dump($server == $cursor->getServer());
var_dump(iterator_to_array($cursor));
?>
===DONE===
<?php exit(0); ?>
--EXPECTF--
bool(true)
bool(true)
array(2) {
[0]=>
object(stdClass)#%d (3) {
["_id"]=>
int(1)
["x"]=>
int(2)
["y"]=>
int(3)
}
[1]=>
object(stdClass)#%d (3) {
["_id"]=>
int(2)
["x"]=>
int(3)
["y"]=>
int(4)
}
}
===DONE===
diff --git a/mongodb-1.2.3/tests/server/server-executeQuery-008.phpt b/mongodb-1.2.8/tests/server/server-executeQuery-008.phpt
similarity index 91%
rename from mongodb-1.2.3/tests/server/server-executeQuery-008.phpt
rename to mongodb-1.2.8/tests/server/server-executeQuery-008.phpt
index 7c5e9751..117948f9 100644
--- a/mongodb-1.2.3/tests/server/server-executeQuery-008.phpt
+++ b/mongodb-1.2.8/tests/server/server-executeQuery-008.phpt
@@ -1,41 +1,42 @@
--TEST--
MongoDB\Driver\Server::executeQuery() with conflicting read preference for secondary
--SKIPIF--
-<?php require __DIR__ . "/../utils/basic-skipif.inc"; NEEDS("REPLICASET"); CLEANUP(REPLICASET); ?>
+<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
+<?php NEEDS('REPLICASET'); CLEANUP(REPLICASET); ?>
--FILE--
<?php
require_once __DIR__ . "/../utils/basic.inc";
$manager = new MongoDB\Driver\Manager(REPLICASET);
$primaryRp = new MongoDB\Driver\ReadPreference(MongoDB\Driver\ReadPreference::RP_PRIMARY);
$primary = $manager->selectServer($primaryRp);
$bulk = new \MongoDB\Driver\BulkWrite;
$bulk->insert(['_id' => 1, 'x' => 1]);
$primary->executeBulkWrite(NS, $bulk, new MongoDB\Driver\WriteConcern(MongoDB\Driver\WriteConcern::MAJORITY));
$secondaryRp = new MongoDB\Driver\ReadPreference(MongoDB\Driver\ReadPreference::RP_SECONDARY);
$secondary = $manager->selectServer($secondaryRp);
/* Note: this is testing that the read preference (even a conflicting one) has
* no effect when directly querying a server, since the slaveOk flag is always
* set for hinted queries. */
$cursor = $secondary->executeQuery(NS, new MongoDB\Driver\Query(['x' => 1]), $primaryRp);
var_dump($cursor->toArray());
?>
===DONE===
<?php exit(0); ?>(
--EXPECTF--
array(1) {
[0]=>
object(stdClass)#%d (%d) {
["_id"]=>
int(1)
["x"]=>
int(1)
}
}
===DONE===
diff --git a/mongodb-1.2.3/tests/server/server_error-001.phpt b/mongodb-1.2.8/tests/server/server_error-001.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/server/server_error-001.phpt
rename to mongodb-1.2.8/tests/server/server_error-001.phpt
diff --git a/mongodb-1.2.3/tests/standalone/bug0159.phpt b/mongodb-1.2.8/tests/standalone/bug0159.phpt
similarity index 80%
rename from mongodb-1.2.3/tests/standalone/bug0159.phpt
rename to mongodb-1.2.8/tests/standalone/bug0159.phpt
index 28917838..7c8eda35 100644
--- a/mongodb-1.2.3/tests/standalone/bug0159.phpt
+++ b/mongodb-1.2.8/tests/standalone/bug0159.phpt
@@ -1,20 +1,21 @@
--TEST--
PHPC-159: Memleak on failed path resolving
--SKIPIF--
-<?php require __DIR__ . "/../utils/basic-skipif.inc"; CLEANUP(STANDALONE) ?>
+<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
+<?php NEEDS('STANDALONE'); CLEANUP(STANDALONE); ?>
--FILE--
<?php
require_once __DIR__ . "/../utils/basic.inc";
$uri = parse_url(STANDALONE);
$manager = new MongoDB\Driver\Manager("mongodb:///tmp/mongodb-27018.sock,{$uri["host"]}:{$uri["port"]}/?serverselectiontimeoutms=10");
try {
$manager->executeQuery("foo.bar", new MongoDB\Driver\Query(array()));
} catch(Exception $e) {}
?>
===DONE===
<?php exit(0); ?>
--EXPECT--
===DONE===
diff --git a/mongodb-1.2.3/tests/standalone/bug0166.phpt b/mongodb-1.2.8/tests/standalone/bug0166.phpt
similarity index 86%
rename from mongodb-1.2.3/tests/standalone/bug0166.phpt
rename to mongodb-1.2.8/tests/standalone/bug0166.phpt
index 07714c2f..6b2562da 100644
--- a/mongodb-1.2.3/tests/standalone/bug0166.phpt
+++ b/mongodb-1.2.8/tests/standalone/bug0166.phpt
@@ -1,30 +1,31 @@
--TEST--
Disable serialization of objects
--SKIPIF--
-<?php require __DIR__ . "/../utils/basic-skipif.inc"; CLEANUP(STANDALONE)?>
+<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
+<?php NEEDS('STANDALONE'); CLEANUP(STANDALONE); ?>
--FILE--
<?php
require_once __DIR__ . "/../utils/basic.inc";
$str = 'O:22:"MongoDB\Driver\Manager":0:{}';
try {
/* We throw exception in 5.3 - 5.6 triggers warning and returns false
* This is inconsistency is only with manipulated serialization strings, or using them across versions
* which isn't support by PHP in the getgo anyway */
$v = @unserialize($str);
var_dump($v);
} catch(Exception $e) {
var_dump(false);
}
$manager = new MongoDB\Driver\Manager(STANDALONE);
throws(function() use ($manager) {
serialize($manager);
}, "Exception");
?>
===DONE===
<?php exit(0); ?>
--EXPECT--
bool(false)
OK: Got Exception
===DONE===
diff --git a/mongodb-1.2.3/tests/standalone/bug0231.phpt b/mongodb-1.2.8/tests/standalone/bug0231.phpt
similarity index 86%
rename from mongodb-1.2.3/tests/standalone/bug0231.phpt
rename to mongodb-1.2.8/tests/standalone/bug0231.phpt
index 0b7c74dc..106482cc 100644
--- a/mongodb-1.2.3/tests/standalone/bug0231.phpt
+++ b/mongodb-1.2.8/tests/standalone/bug0231.phpt
@@ -1,31 +1,32 @@
--TEST--
Multiple managers sharing streams: Using stream after closing manager
--SKIPIF--
-<?php require __DIR__ . "/../utils/basic-skipif.inc"; CLEANUP(STANDALONE)?>
+<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
+<?php NEEDS('STANDALONE'); CLEANUP(STANDALONE); ?>
--FILE--
<?php
require_once __DIR__ . "/../utils/basic.inc";
$manager = new MongoDB\Driver\Manager(STANDALONE);
$manager2 = new MongoDB\Driver\Manager(STANDALONE);
$listdatabases = new MongoDB\Driver\Command(array("listDatabases" => 1));
$retval = $manager->executeCommand("admin", $listdatabases);
$retval = $manager2->executeCommand("admin", $listdatabases);
foreach($retval as $database) {
}
$manager = null;
$retval = $manager2->executeCommand("admin", $listdatabases);
foreach($retval as $database) {
}
echo "All Good!\n";
?>
===DONE===
<?php exit(0); ?>
--EXPECT--
All Good!
===DONE===
diff --git a/mongodb-1.2.3/tests/standalone/bug0357.phpt b/mongodb-1.2.8/tests/standalone/bug0357.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/standalone/bug0357.phpt
rename to mongodb-1.2.8/tests/standalone/bug0357.phpt
diff --git a/mongodb-1.2.3/tests/standalone/bug0545.phpt b/mongodb-1.2.8/tests/standalone/bug0545.phpt
similarity index 96%
rename from mongodb-1.2.3/tests/standalone/bug0545.phpt
rename to mongodb-1.2.8/tests/standalone/bug0545.phpt
index 550bb3d6..eb6156fc 100644
--- a/mongodb-1.2.3/tests/standalone/bug0545.phpt
+++ b/mongodb-1.2.8/tests/standalone/bug0545.phpt
@@ -1,130 +1,131 @@
--TEST--
PHPC-545: Update does not serialize embedded Persistable's __pclass field
--SKIPIF--
<?php if (defined("HHVM_VERSION_ID")) exit("skip HHVM encodes __pclass last"); ?>
-<?php require __DIR__ . "/../utils/basic-skipif.inc"; CLEANUP(STANDALONE)?>
+<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
+<?php NEEDS('STANDALONE'); CLEANUP(STANDALONE); ?>
--FILE--
<?php
require_once __DIR__ . "/../utils/basic.inc";
class Book implements MongoDB\BSON\Persistable
{
public function bsonSerialize()
{
$data = get_object_vars($this);
return $data;
}
public function bsonUnserialize(array $data)
{
foreach ($data as $name => $value) {
$this->{$name} = $value;
}
}
}
class Page implements MongoDB\BSON\Persistable
{
public function bsonSerialize()
{
$data = get_object_vars($this);
return $data;
}
public function bsonUnserialize(array $data)
{
foreach ($data as $name => $value) {
$this->{$name} = $value;
}
}
}
// Aux
$manager = new MongoDB\Driver\Manager(STANDALONE);
$wc = new MongoDB\Driver\WriteConcern(MongoDB\Driver\WriteConcern::MAJORITY);
// Create
$book = new Book();
$book->title = 'Unnameable';
$book->pages = [];
$page1 = new Page();
$page1->content = 'Lorem ipsum';
$book->pages[] = $page1;
$bulk = new MongoDB\Driver\BulkWrite;
$bulk->insert($book);
$result = $manager->executeBulkWrite(NS, $bulk, $wc);
printf("Inserted %d document(s)\n", $result->getInsertedCount());
// Read
$query = new MongoDB\Driver\Query(['title' => $book->title]);
$cursor = $manager->executeQuery(NS, $query);
$bookAfterInsert = $cursor->toArray()[0];
// Update
$bookAfterInsert->description = 'An interesting document';
$page2 = new Page();
$page2->content = 'Dolor sit amet';
$bookAfterInsert->pages[] = $page2;
$bulk = new MongoDB\Driver\BulkWrite;
$bulk->update(['title' => $bookAfterInsert->title], $bookAfterInsert);
$result = $manager->executeBulkWrite(NS, $bulk, $wc);
printf("Modified %d document(s)\n", $result->getModifiedCount());
// Read (again)
$query = new MongoDB\Driver\Query(['title' => $bookAfterInsert->title]);
$cursor = $manager->executeQuery(NS, $query);
$bookAfterUpdate = $cursor->toArray()[0];
var_dump($bookAfterUpdate);
?>
===DONE===
<?php exit(0); ?>
--EXPECTF--
Inserted 1 document(s)
Modified 1 document(s)
object(Book)#%d (%d) {
["_id"]=>
object(MongoDB\BSON\ObjectID)#%d (%d) {
["oid"]=>
string(24) "%s"
}
["__pclass"]=>
object(MongoDB\BSON\Binary)#%d (%d) {
["data"]=>
string(4) "Book"
["type"]=>
int(%d)
}
["title"]=>
string(10) "Unnameable"
["pages"]=>
array(2) {
[0]=>
object(Page)#%d (%d) {
["__pclass"]=>
object(MongoDB\BSON\Binary)#%d (%d) {
["data"]=>
string(4) "Page"
["type"]=>
int(%d)
}
["content"]=>
string(11) "Lorem ipsum"
}
[1]=>
object(Page)#%d (%d) {
["__pclass"]=>
object(MongoDB\BSON\Binary)#%d (%d) {
["data"]=>
string(4) "Page"
["type"]=>
int(%d)
}
["content"]=>
string(14) "Dolor sit amet"
}
}
["description"]=>
string(23) "An interesting document"
}
===DONE===
diff --git a/mongodb-1.2.3/tests/standalone/bug0655.phpt b/mongodb-1.2.8/tests/standalone/bug0655.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/standalone/bug0655.phpt
rename to mongodb-1.2.8/tests/standalone/bug0655.phpt
diff --git a/mongodb-1.2.3/tests/standalone/command-aggregate-001.phpt b/mongodb-1.2.8/tests/standalone/command-aggregate-001.phpt
similarity index 88%
rename from mongodb-1.2.3/tests/standalone/command-aggregate-001.phpt
rename to mongodb-1.2.8/tests/standalone/command-aggregate-001.phpt
index 96c62ac9..74cdc0d6 100644
--- a/mongodb-1.2.3/tests/standalone/command-aggregate-001.phpt
+++ b/mongodb-1.2.8/tests/standalone/command-aggregate-001.phpt
@@ -1,45 +1,46 @@
--TEST--
DRIVERS-289: Test iteration on live command cursor with empty first batch
--SKIPIF--
-<?php require __DIR__ . "/../utils/basic-skipif.inc"; CLEANUP(STANDALONE); ?>
+<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
+<?php NEEDS('STANDALONE'); CLEANUP(STANDALONE); ?>
--FILE--
<?php
require_once __DIR__ . "/../utils/basic.inc";
$manager = new MongoDB\Driver\Manager(STANDALONE);
$bulk = new MongoDB\Driver\BulkWrite;
$bulk->insert(['_id' => 1]);
$bulk->insert(['_id' => 2]);
$bulk->insert(['_id' => 3]);
$manager->executeBulkWrite(NS, $bulk);
$command = new MongoDB\Driver\Command([
'aggregate' => COLLECTION_NAME,
'pipeline' => [
[ '$match' => [ '_id' => [ '$gt' => 1 ]]],
],
'cursor' => ['batchSize' => 0],
]);
$cursor = $manager->executeCommand(DATABASE_NAME, $command);
var_dump($cursor->toArray());
?>
===DONE===
<?php exit(0); ?>
--EXPECTF--
array(2) {
[0]=>
object(stdClass)#%d (%d) {
["_id"]=>
int(2)
}
[1]=>
object(stdClass)#%d (%d) {
["_id"]=>
int(3)
}
}
===DONE===
diff --git a/mongodb-1.2.3/tests/standalone/connectiontimeoutexception-001.phpt b/mongodb-1.2.8/tests/standalone/connectiontimeoutexception-001.phpt
similarity index 82%
rename from mongodb-1.2.3/tests/standalone/connectiontimeoutexception-001.phpt
rename to mongodb-1.2.8/tests/standalone/connectiontimeoutexception-001.phpt
index 3e0cdb9a..649c8024 100644
--- a/mongodb-1.2.3/tests/standalone/connectiontimeoutexception-001.phpt
+++ b/mongodb-1.2.8/tests/standalone/connectiontimeoutexception-001.phpt
@@ -1,29 +1,29 @@
--TEST--
ConnectionTimeoutException: exceeding sockettimeoutms
--SKIPIF--
-<?php require __DIR__ . "/../utils/basic-skipif.inc"; CLEANUP(STANDALONE) ?>
-<?php TESTCOMMANDS(STANDALONE) ?>
+<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
+<?php NEEDS('STANDALONE'); CLEANUP(STANDALONE); TESTCOMMANDS(STANDALONE); ?>
--FILE--
<?php
require_once __DIR__ . "/" . "../utils/basic.inc";
$manager = new MongoDB\Driver\Manager(STANDALONE . "/?sockettimeoutms=9");
$cmd = array(
"sleep" => 1,
"w" => false,
"secs" => 2,
);
$command = new MongoDB\Driver\Command($cmd);
throws(function() use ($manager, $command) {
$result = $manager->executeCommand("admin", $command);
var_dump($result->toArray());
}, "MongoDB\Driver\Exception\\ConnectionTimeoutException");
?>
===DONE===
<?php exit(0); ?>
--EXPECT--
OK: Got MongoDB\Driver\Exception\ConnectionTimeoutException
===DONE===
diff --git a/mongodb-1.2.3/tests/standalone/executiontimeoutexception-001.phpt b/mongodb-1.2.8/tests/standalone/executiontimeoutexception-001.phpt
similarity index 84%
rename from mongodb-1.2.3/tests/standalone/executiontimeoutexception-001.phpt
rename to mongodb-1.2.8/tests/standalone/executiontimeoutexception-001.phpt
index 69da41af..9214f718 100644
--- a/mongodb-1.2.3/tests/standalone/executiontimeoutexception-001.phpt
+++ b/mongodb-1.2.8/tests/standalone/executiontimeoutexception-001.phpt
@@ -1,30 +1,30 @@
--TEST--
ExecutionTimeoutException: exceeding $maxTimeMS (queries)
--SKIPIF--
-<?php require __DIR__ . "/../utils/basic-skipif.inc"; CLEANUP(STANDALONE) ?>
-<?php TESTCOMMANDS(STANDALONE) ?>
+<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
+<?php NEEDS('STANDALONE'); CLEANUP(STANDALONE); TESTCOMMANDS(STANDALONE); ?>
--FILE--
<?php
require_once __DIR__ . "/../utils/basic.inc";
$manager = new MongoDB\Driver\Manager(STANDALONE);
$query = new MongoDB\Driver\Query(array("company" => "Smith, Carter and Buckridge"), array(
'projection' => array('_id' => 0, 'username' => 1),
'sort' => array('phoneNumber' => 1),
'modifiers' => array(
'$maxTimeMS' => 1,
),
));
failMaxTimeMS($manager);
throws(function() use ($manager, $query) {
$result = $manager->executeQuery(NS, $query);
}, "MongoDB\Driver\Exception\ExecutionTimeoutException");
?>
===DONE===
<?php exit(0); ?>
--EXPECT--
OK: Got MongoDB\Driver\Exception\ExecutionTimeoutException
===DONE===
diff --git a/mongodb-1.2.3/tests/standalone/executiontimeoutexception-002.phpt b/mongodb-1.2.8/tests/standalone/executiontimeoutexception-002.phpt
similarity index 82%
rename from mongodb-1.2.3/tests/standalone/executiontimeoutexception-002.phpt
rename to mongodb-1.2.8/tests/standalone/executiontimeoutexception-002.phpt
index e4a99ad0..4b34f0fa 100644
--- a/mongodb-1.2.3/tests/standalone/executiontimeoutexception-002.phpt
+++ b/mongodb-1.2.8/tests/standalone/executiontimeoutexception-002.phpt
@@ -1,29 +1,29 @@
--TEST--
ExecutionTimeoutException: exceeding maxTimeMS (commands)
--SKIPIF--
-<?php require __DIR__ . "/../utils/basic-skipif.inc"; CLEANUP(STANDALONE) ?>
-<?php TESTCOMMANDS(STANDALONE) ?>
+<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
+<?php NEEDS('STANDALONE'); CLEANUP(STANDALONE); TESTCOMMANDS(STANDALONE); ?>
--FILE--
<?php
require_once __DIR__ . "/../utils/basic.inc";
$manager = new MongoDB\Driver\Manager(STANDALONE);
$cmd = array(
"count" => "collection",
"query" => array("a" => 1),
"maxTimeMS" => 100,
);
$command = new MongoDB\Driver\Command($cmd);
failMaxTimeMS($manager);
throws(function() use ($manager, $command) {
$result = $manager->executeCommand(DATABASE_NAME, $command);
}, "MongoDB\Driver\Exception\ExecutionTimeoutException");
?>
===DONE===
<?php exit(0); ?>
--EXPECT--
OK: Got MongoDB\Driver\Exception\ExecutionTimeoutException
===DONE===
diff --git a/mongodb-1.2.3/tests/standalone/manager-as-singleton.phpt b/mongodb-1.2.8/tests/standalone/manager-as-singleton.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/standalone/manager-as-singleton.phpt
rename to mongodb-1.2.8/tests/standalone/manager-as-singleton.phpt
diff --git a/mongodb-1.2.3/tests/standalone/query-errors.phpt b/mongodb-1.2.8/tests/standalone/query-errors.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/standalone/query-errors.phpt
rename to mongodb-1.2.8/tests/standalone/query-errors.phpt
diff --git a/mongodb-1.2.3/tests/standalone/update-multi-001.phpt b/mongodb-1.2.8/tests/standalone/update-multi-001.phpt
similarity index 97%
rename from mongodb-1.2.3/tests/standalone/update-multi-001.phpt
rename to mongodb-1.2.8/tests/standalone/update-multi-001.phpt
index 7f2fe8f0..2041c865 100644
--- a/mongodb-1.2.3/tests/standalone/update-multi-001.phpt
+++ b/mongodb-1.2.8/tests/standalone/update-multi-001.phpt
@@ -1,267 +1,268 @@
--TEST--
PHPC-243: Manager::executeUpdate() & Bulk->update() w/o multi
--SKIPIF--
-<?php require __DIR__ . "/../utils/basic-skipif.inc"; CLEANUP(STANDALONE) ?>
+<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
+<?php NEEDS('STANDALONE'); CLEANUP(STANDALONE); ?>
--FILE--
<?php
require_once __DIR__ . "/../utils/basic.inc";
$manager = new MongoDB\Driver\Manager(STANDALONE);
// load fixtures for test
$bulk = new \MongoDB\Driver\BulkWrite;
$bulk->insert(array('_id' => 1, 'x' => 1));
$bulk->insert(array('_id' => 2, 'x' => 2));
$bulk->insert(array('_id' => 3, 'x' => 2));
$bulk->insert(array('_id' => 4, 'x' => 2));
$bulk->insert(array('_id' => 5, 'x' => 1));
$bulk->insert(array('_id' => 6, 'x' => 1));
$manager->executeBulkWrite(NS, $bulk);
$bulk = new \MongoDB\Driver\BulkWrite;
$bulk->update(
array('x' => 1),
array('$set' => array('x' => 3)),
array('multi' => false, 'upsert' => false)
);
$result = $manager->executeBulkWrite(NS, $bulk);
printf("Changed %d out of expected 1 (_id=1)\n", $result->getModifiedCount());
$bulk = new \MongoDB\Driver\BulkWrite;
$bulk->update(
array('x' => 1),
array('$set' => array('x' => 2)),
array('multi' => true, 'upsert' => false)
);
$result = $manager->executeBulkWrite(NS, $bulk);
$cursor = $manager->executeQuery(NS, new MongoDB\Driver\Query(array()));
var_dump(iterator_to_array($cursor));
printf("Changed %d out of expected 2, (_id=5, _id=6)\n", $result->getModifiedCount());
$bulk = new MongoDB\Driver\BulkWrite;
$bulk->update(
array('x' => 2),
array('$set' => array('x' => 4)),
array('multi' => false, 'upsert' => false)
);
$result = $manager->executeBulkWrite(NS, $bulk);
$cursor = $manager->executeQuery(NS, new MongoDB\Driver\Query(array()));
var_dump(iterator_to_array($cursor));
printf("Changed %d out of expected 1, (_id=2)\n", $result->getModifiedCount());
$bulk = new MongoDB\Driver\BulkWrite;
$bulk->update(
array('x' => 2),
array('$set' => array('x' => 41)),
array('multi' => false, 'upsert' => false)
);
$result = $manager->executeBulkWrite(NS, $bulk);
$cursor = $manager->executeQuery(NS, new MongoDB\Driver\Query(array()));
var_dump(iterator_to_array($cursor));
printf("Changed %d out of expected 1 (id_=3)\n", $result->getModifiedCount());
$bulk = new MongoDB\Driver\BulkWrite;
$bulk->update(
array('x' => 2),
array('$set' => array('x' => 42)),
array('multi' => true, 'upsert' => false)
);
$result = $manager->executeBulkWrite(NS, $bulk);
$cursor = $manager->executeQuery(NS, new MongoDB\Driver\Query(array()));
var_dump(iterator_to_array($cursor));
printf("Changed %d out of expected 3 (_id=4, _id=5, _id=6)\n", $result->getModifiedCount());
?>
===DONE===
<?php exit(0); ?>
--EXPECTF--
Changed 1 out of expected 1 (_id=1)
array(6) {
[0]=>
object(stdClass)#%d (2) {
["_id"]=>
int(1)
["x"]=>
int(3)
}
[1]=>
object(stdClass)#%d (2) {
["_id"]=>
int(2)
["x"]=>
int(2)
}
[2]=>
object(stdClass)#%d (2) {
["_id"]=>
int(3)
["x"]=>
int(2)
}
[3]=>
object(stdClass)#%d (2) {
["_id"]=>
int(4)
["x"]=>
int(2)
}
[4]=>
object(stdClass)#%d (2) {
["_id"]=>
int(5)
["x"]=>
int(2)
}
[5]=>
object(stdClass)#%d (2) {
["_id"]=>
int(6)
["x"]=>
int(2)
}
}
Changed 2 out of expected 2, (_id=5, _id=6)
array(6) {
[0]=>
object(stdClass)#%d (2) {
["_id"]=>
int(1)
["x"]=>
int(3)
}
[1]=>
object(stdClass)#%d (2) {
["_id"]=>
int(2)
["x"]=>
int(4)
}
[2]=>
object(stdClass)#%d (2) {
["_id"]=>
int(3)
["x"]=>
int(2)
}
[3]=>
object(stdClass)#%d (2) {
["_id"]=>
int(4)
["x"]=>
int(2)
}
[4]=>
object(stdClass)#%d (2) {
["_id"]=>
int(5)
["x"]=>
int(2)
}
[5]=>
object(stdClass)#%d (2) {
["_id"]=>
int(6)
["x"]=>
int(2)
}
}
Changed 1 out of expected 1, (_id=2)
array(6) {
[0]=>
object(stdClass)#%d (2) {
["_id"]=>
int(1)
["x"]=>
int(3)
}
[1]=>
object(stdClass)#%d (2) {
["_id"]=>
int(2)
["x"]=>
int(4)
}
[2]=>
object(stdClass)#%d (2) {
["_id"]=>
int(3)
["x"]=>
int(41)
}
[3]=>
object(stdClass)#%d (2) {
["_id"]=>
int(4)
["x"]=>
int(2)
}
[4]=>
object(stdClass)#%d (2) {
["_id"]=>
int(5)
["x"]=>
int(2)
}
[5]=>
object(stdClass)#%d (2) {
["_id"]=>
int(6)
["x"]=>
int(2)
}
}
Changed 1 out of expected 1 (id_=3)
array(6) {
[0]=>
object(stdClass)#%d (2) {
["_id"]=>
int(1)
["x"]=>
int(3)
}
[1]=>
object(stdClass)#%d (2) {
["_id"]=>
int(2)
["x"]=>
int(4)
}
[2]=>
object(stdClass)#%d (2) {
["_id"]=>
int(3)
["x"]=>
int(41)
}
[3]=>
object(stdClass)#%d (2) {
["_id"]=>
int(4)
["x"]=>
int(42)
}
[4]=>
object(stdClass)#%d (2) {
["_id"]=>
int(5)
["x"]=>
int(42)
}
[5]=>
object(stdClass)#%d (2) {
["_id"]=>
int(6)
["x"]=>
int(42)
}
}
Changed 3 out of expected 3 (_id=4, _id=5, _id=6)
===DONE===
diff --git a/mongodb-1.2.3/tests/standalone/write-error-001.phpt b/mongodb-1.2.8/tests/standalone/write-error-001.phpt
similarity index 87%
rename from mongodb-1.2.3/tests/standalone/write-error-001.phpt
rename to mongodb-1.2.8/tests/standalone/write-error-001.phpt
index de40932d..754826f3 100644
--- a/mongodb-1.2.3/tests/standalone/write-error-001.phpt
+++ b/mongodb-1.2.8/tests/standalone/write-error-001.phpt
@@ -1,28 +1,29 @@
--TEST--
MongoDB\Driver\Manager::executeInsert()
--SKIPIF--
-<?php require __DIR__ . "/../utils/basic-skipif.inc"; CLEANUP(STANDALONE) ?>
+<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
+<?php NEEDS('STANDALONE'); CLEANUP(STANDALONE); ?>
--FILE--
<?php
require_once __DIR__ . "/../utils/basic.inc";
$manager = new MongoDB\Driver\Manager(STANDALONE);
$hannes = array("name" => "Hannes", "country" => "USA", "gender" => "male");
$bulk = new \MongoDB\Driver\BulkWrite(['ordered' => true]);
$hannes_id = $bulk->insert($hannes);
$w = 2;
$wtimeout = 1000;
$writeConcern = new \MongoDB\Driver\WriteConcern($w, $wtimeout);
throws(function() use($bulk, $writeConcern, $manager) {
$result = $manager->executeBulkWrite(NS, $bulk, $writeConcern);
}, "MongoDB\Driver\Exception\ConnectionException");
?>
===DONE===
<?php exit(0); ?>
--EXPECTF--
OK: Got MongoDB\Driver\Exception\ConnectionException
===DONE===
diff --git a/mongodb-1.2.3/tests/standalone/writeresult-isacknowledged-001.phpt b/mongodb-1.2.8/tests/standalone/writeresult-isacknowledged-001.phpt
similarity index 89%
rename from mongodb-1.2.3/tests/standalone/writeresult-isacknowledged-001.phpt
rename to mongodb-1.2.8/tests/standalone/writeresult-isacknowledged-001.phpt
index ac680680..dca3ecb0 100644
--- a/mongodb-1.2.3/tests/standalone/writeresult-isacknowledged-001.phpt
+++ b/mongodb-1.2.8/tests/standalone/writeresult-isacknowledged-001.phpt
@@ -1,46 +1,47 @@
--TEST--
MongoDB\Driver\WriteResult::isAcknowledged() with default WriteConcern
--SKIPIF--
-<?php require __DIR__ . "/../utils/basic-skipif.inc"; CLEANUP(STANDALONE) ?>
+<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
+<?php NEEDS('STANDALONE'); CLEANUP(STANDALONE); ?>
--FILE--
<?php
require_once __DIR__ . "/../utils/basic.inc";
$manager = new MongoDB\Driver\Manager(STANDALONE);
$bulk = new \MongoDB\Driver\BulkWrite;
$bulk->insert(array('x' => 1));
$result = $manager->executeBulkWrite(NS, $bulk);
printf("WriteResult::isAcknowledged(): %s\n", $result->isAcknowledged() ? 'true' : 'false');
var_dump($result);
?>
===DONE===
<?php exit(0); ?>
--EXPECTF--
WriteResult::isAcknowledged(): true
object(MongoDB\Driver\WriteResult)#%d (%d) {
["nInserted"]=>
int(1)
["nMatched"]=>
int(0)
["nModified"]=>
int(0)
["nRemoved"]=>
int(0)
["nUpserted"]=>
int(0)
["upsertedIds"]=>
array(0) {
}
["writeErrors"]=>
array(0) {
}
["writeConcernError"]=>
NULL
["writeConcern"]=>
object(MongoDB\Driver\WriteConcern)#%d (%d) {
}
}
===DONE===
diff --git a/mongodb-1.2.3/tests/standalone/writeresult-isacknowledged-002.phpt b/mongodb-1.2.8/tests/standalone/writeresult-isacknowledged-002.phpt
similarity index 90%
rename from mongodb-1.2.3/tests/standalone/writeresult-isacknowledged-002.phpt
rename to mongodb-1.2.8/tests/standalone/writeresult-isacknowledged-002.phpt
index 2eefa401..07c12cca 100644
--- a/mongodb-1.2.3/tests/standalone/writeresult-isacknowledged-002.phpt
+++ b/mongodb-1.2.8/tests/standalone/writeresult-isacknowledged-002.phpt
@@ -1,50 +1,51 @@
--TEST--
MongoDB\Driver\WriteResult::isAcknowledged() with inherited WriteConcern
--SKIPIF--
-<?php require __DIR__ . "/../utils/basic-skipif.inc"; CLEANUP(STANDALONE) ?>
+<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
+<?php NEEDS('STANDALONE'); CLEANUP(STANDALONE); ?>
--FILE--
<?php
require_once __DIR__ . "/../utils/basic.inc";
/* We use w:0 here because libmongoc detects w:1 as the server's default and
*/
$manager = new MongoDB\Driver\Manager(STANDALONE . "/?w=0");
$bulk = new \MongoDB\Driver\BulkWrite;
$bulk->insert(array('x' => 1));
$result = $manager->executeBulkWrite(NS, $bulk);
printf("WriteResult::isAcknowledged(): %s\n", $result->isAcknowledged() ? 'true' : 'false');
var_dump($result);
?>
===DONE===
<?php exit(0); ?>
--EXPECTF--
WriteResult::isAcknowledged(): false
object(MongoDB\Driver\WriteResult)#%d (%d) {
["nInserted"]=>
int(0)
["nMatched"]=>
int(0)
["nModified"]=>
int(0)
["nRemoved"]=>
int(0)
["nUpserted"]=>
int(0)
["upsertedIds"]=>
array(0) {
}
["writeErrors"]=>
array(0) {
}
["writeConcernError"]=>
NULL
["writeConcern"]=>
object(MongoDB\Driver\WriteConcern)#%d (%d) {
["w"]=>
int(0)
}
}
===DONE===
diff --git a/mongodb-1.2.3/tests/standalone/writeresult-isacknowledged-003.phpt b/mongodb-1.2.8/tests/standalone/writeresult-isacknowledged-003.phpt
similarity index 89%
rename from mongodb-1.2.3/tests/standalone/writeresult-isacknowledged-003.phpt
rename to mongodb-1.2.8/tests/standalone/writeresult-isacknowledged-003.phpt
index e2d6fe57..1792cbd5 100644
--- a/mongodb-1.2.3/tests/standalone/writeresult-isacknowledged-003.phpt
+++ b/mongodb-1.2.8/tests/standalone/writeresult-isacknowledged-003.phpt
@@ -1,48 +1,49 @@
--TEST--
MongoDB\Driver\WriteResult::isAcknowledged() with custom WriteConcern
--SKIPIF--
-<?php require __DIR__ . "/../utils/basic-skipif.inc"; CLEANUP(STANDALONE) ?>
+<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
+<?php NEEDS('STANDALONE'); CLEANUP(STANDALONE); ?>
--FILE--
<?php
require_once __DIR__ . "/../utils/basic.inc";
$manager = new MongoDB\Driver\Manager(STANDALONE);
$bulk = new \MongoDB\Driver\BulkWrite;
$bulk->insert(array('x' => 2));
$result = $manager->executeBulkWrite(NS, $bulk, new MongoDB\Driver\WriteConcern(0));
printf("WriteResult::isAcknowledged(): %s\n", $result->isAcknowledged() ? 'true' : 'false');
var_dump($result);
?>
===DONE===
<?php exit(0); ?>
--EXPECTF--
WriteResult::isAcknowledged(): false
object(MongoDB\Driver\WriteResult)#%d (%d) {
["nInserted"]=>
NULL
["nMatched"]=>
NULL
["nModified"]=>
NULL
["nRemoved"]=>
NULL
["nUpserted"]=>
NULL
["upsertedIds"]=>
array(0) {
}
["writeErrors"]=>
array(0) {
}
["writeConcernError"]=>
NULL
["writeConcern"]=>
object(MongoDB\Driver\WriteConcern)#%d (%d) {
["w"]=>
int(0)
}
}
===DONE===
diff --git a/mongodb-1.2.3/tests/utils/PHONGO-FIXTURES.json.gz b/mongodb-1.2.8/tests/utils/PHONGO-FIXTURES.json.gz
similarity index 100%
rename from mongodb-1.2.3/tests/utils/PHONGO-FIXTURES.json.gz
rename to mongodb-1.2.8/tests/utils/PHONGO-FIXTURES.json.gz
diff --git a/mongodb-1.2.3/tests/utils/basic-skipif.inc b/mongodb-1.2.8/tests/utils/basic-skipif.inc
similarity index 100%
rename from mongodb-1.2.3/tests/utils/basic-skipif.inc
rename to mongodb-1.2.8/tests/utils/basic-skipif.inc
diff --git a/mongodb-1.2.3/tests/utils/basic.inc b/mongodb-1.2.8/tests/utils/basic.inc
similarity index 97%
rename from mongodb-1.2.3/tests/utils/basic.inc
rename to mongodb-1.2.8/tests/utils/basic.inc
index 23f0cc88..1292fc65 100644
--- a/mongodb-1.2.3/tests/utils/basic.inc
+++ b/mongodb-1.2.8/tests/utils/basic.inc
@@ -1,38 +1,39 @@
<?php
require __DIR__ . "/" . "tools.php";
if (($FILENAME = getenv("PHONGO_SERVERS")) === false) {
$FILENAME = sys_get_temp_dir() . "/PHONGO-SERVERS.json";
}
$json = file_get_contents($FILENAME);
$config = json_decode($json, true);
if (!$config) {
exit("skip Couldn't json_decode(file_get_contents($FILENAME));");
}
$servers = array(
"STANDALONE" => "",
"STANDALONE_24" => "",
"STANDALONE_26" => "",
"STANDALONE_30" => "",
"STANDALONE_SSL" => "",
"STANDALONE_AUTH" => "",
"STANDALONE_X509" => "",
"STANDALONE_PLAIN" => "",
"REPLICASET" => "",
+ "REPLICASET_30" => "",
);
$servers = array_merge($servers, $config);
def($servers);
$consts = array(
"DATABASE_NAME" => "phongo",
"COLLECTION_NAME" => makeCollectionNameFromFilename($_SERVER["SCRIPT_FILENAME"]),
);
def($consts);
// These use values from constants defined above
$consts = array(
"NS" => DATABASE_NAME . "." . COLLECTION_NAME,
);
def($consts);
diff --git a/mongodb-1.2.3/tests/utils/classes.inc b/mongodb-1.2.8/tests/utils/classes.inc
similarity index 100%
rename from mongodb-1.2.3/tests/utils/classes.inc
rename to mongodb-1.2.8/tests/utils/classes.inc
diff --git a/mongodb-1.2.3/tests/utils/tools.php b/mongodb-1.2.8/tests/utils/tools.php
similarity index 100%
rename from mongodb-1.2.3/tests/utils/tools.php
rename to mongodb-1.2.8/tests/utils/tools.php
diff --git a/mongodb-1.2.3/tests/writeConcern/writeconcern-bsonserialize-001.phpt b/mongodb-1.2.8/tests/writeConcern/writeconcern-bsonserialize-001.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/writeConcern/writeconcern-bsonserialize-001.phpt
rename to mongodb-1.2.8/tests/writeConcern/writeconcern-bsonserialize-001.phpt
diff --git a/mongodb-1.2.3/tests/writeConcern/writeconcern-bsonserialize-002.phpt b/mongodb-1.2.8/tests/writeConcern/writeconcern-bsonserialize-002.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/writeConcern/writeconcern-bsonserialize-002.phpt
rename to mongodb-1.2.8/tests/writeConcern/writeconcern-bsonserialize-002.phpt
diff --git a/mongodb-1.2.3/tests/writeConcern/writeconcern-constants.phpt b/mongodb-1.2.8/tests/writeConcern/writeconcern-constants.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/writeConcern/writeconcern-constants.phpt
rename to mongodb-1.2.8/tests/writeConcern/writeconcern-constants.phpt
diff --git a/mongodb-1.2.3/tests/writeConcern/writeconcern-ctor-001.phpt b/mongodb-1.2.8/tests/writeConcern/writeconcern-ctor-001.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/writeConcern/writeconcern-ctor-001.phpt
rename to mongodb-1.2.8/tests/writeConcern/writeconcern-ctor-001.phpt
diff --git a/mongodb-1.2.3/tests/writeConcern/writeconcern-ctor_error-001.phpt b/mongodb-1.2.8/tests/writeConcern/writeconcern-ctor_error-001.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/writeConcern/writeconcern-ctor_error-001.phpt
rename to mongodb-1.2.8/tests/writeConcern/writeconcern-ctor_error-001.phpt
diff --git a/mongodb-1.2.3/tests/writeConcern/writeconcern-ctor_error-002.phpt b/mongodb-1.2.8/tests/writeConcern/writeconcern-ctor_error-002.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/writeConcern/writeconcern-ctor_error-002.phpt
rename to mongodb-1.2.8/tests/writeConcern/writeconcern-ctor_error-002.phpt
diff --git a/mongodb-1.2.3/tests/writeConcern/writeconcern-ctor_error-003.phpt b/mongodb-1.2.8/tests/writeConcern/writeconcern-ctor_error-003.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/writeConcern/writeconcern-ctor_error-003.phpt
rename to mongodb-1.2.8/tests/writeConcern/writeconcern-ctor_error-003.phpt
diff --git a/mongodb-1.2.3/tests/writeConcern/writeconcern-ctor_error-004.phpt b/mongodb-1.2.8/tests/writeConcern/writeconcern-ctor_error-004.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/writeConcern/writeconcern-ctor_error-004.phpt
rename to mongodb-1.2.8/tests/writeConcern/writeconcern-ctor_error-004.phpt
diff --git a/mongodb-1.2.3/tests/writeConcern/writeconcern-ctor_error-005.phpt b/mongodb-1.2.8/tests/writeConcern/writeconcern-ctor_error-005.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/writeConcern/writeconcern-ctor_error-005.phpt
rename to mongodb-1.2.8/tests/writeConcern/writeconcern-ctor_error-005.phpt
diff --git a/mongodb-1.2.3/tests/writeConcern/writeconcern-debug-001.phpt b/mongodb-1.2.8/tests/writeConcern/writeconcern-debug-001.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/writeConcern/writeconcern-debug-001.phpt
rename to mongodb-1.2.8/tests/writeConcern/writeconcern-debug-001.phpt
diff --git a/mongodb-1.2.3/tests/writeConcern/writeconcern-debug-002.phpt b/mongodb-1.2.8/tests/writeConcern/writeconcern-debug-002.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/writeConcern/writeconcern-debug-002.phpt
rename to mongodb-1.2.8/tests/writeConcern/writeconcern-debug-002.phpt
diff --git a/mongodb-1.2.3/tests/writeConcern/writeconcern-debug-003.phpt b/mongodb-1.2.8/tests/writeConcern/writeconcern-debug-003.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/writeConcern/writeconcern-debug-003.phpt
rename to mongodb-1.2.8/tests/writeConcern/writeconcern-debug-003.phpt
diff --git a/mongodb-1.2.3/tests/writeConcern/writeconcern-getjournal-001.phpt b/mongodb-1.2.8/tests/writeConcern/writeconcern-getjournal-001.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/writeConcern/writeconcern-getjournal-001.phpt
rename to mongodb-1.2.8/tests/writeConcern/writeconcern-getjournal-001.phpt
diff --git a/mongodb-1.2.3/tests/writeConcern/writeconcern-getw-001.phpt b/mongodb-1.2.8/tests/writeConcern/writeconcern-getw-001.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/writeConcern/writeconcern-getw-001.phpt
rename to mongodb-1.2.8/tests/writeConcern/writeconcern-getw-001.phpt
diff --git a/mongodb-1.2.3/tests/writeConcern/writeconcern-getwtimeout-001.phpt b/mongodb-1.2.8/tests/writeConcern/writeconcern-getwtimeout-001.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/writeConcern/writeconcern-getwtimeout-001.phpt
rename to mongodb-1.2.8/tests/writeConcern/writeconcern-getwtimeout-001.phpt
diff --git a/mongodb-1.2.3/tests/writeConcern/writeconcern_error-001.phpt b/mongodb-1.2.8/tests/writeConcern/writeconcern_error-001.phpt
similarity index 100%
rename from mongodb-1.2.3/tests/writeConcern/writeconcern_error-001.phpt
rename to mongodb-1.2.8/tests/writeConcern/writeconcern_error-001.phpt
diff --git a/package.xml b/package.xml
index 9935abc1..ffd2a07c 100644
--- a/package.xml
+++ b/package.xml
@@ -1,889 +1,872 @@
<?xml version="1.0" encoding="UTF-8"?>
<package packagerversion="1.10.1" version="2.1" xmlns="http://pear.php.net/dtd/package-2.1" xmlns:tasks="http://pear.php.net/dtd/tasks-1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://pear.php.net/dtd/tasks-1.0 http://pear.php.net/dtd/tasks-1.0.xsd http://pear.php.net/dtd/package-2.1 http://pear.php.net/dtd/package-2.1.xsd">
<name>mongodb</name>
<channel>pecl.php.net</channel>
<summary>MongoDB driver for PHP</summary>
<description>The purpose of this driver is to provide exceptionally thin glue between MongoDB
and PHP, implementing only fundemental and performance-critical components
necessary to build a fully-functional MongoDB driver.</description>
<lead>
<name>Hannes Magnusson</name>
<user>bjori</user>
<email>bjori@php.net</email>
<active>yes</active>
</lead>
<lead>
<name>Jeremy Mikola</name>
<user>jmikola</user>
<email>jmikola@php.net</email>
<active>yes</active>
</lead>
<lead>
<name>Derick Rethans</name>
<user>derick</user>
<email>derick@php.net</email>
<active>yes</active>
</lead>
- <date>2017-01-17</date>
- <time>18:35:13</time>
+ <date>2017-03-20</date>
+ <time>17:37:20</time>
<version>
- <release>1.2.3</release>
- <api>1.2.3</api>
+ <release>1.2.8</release>
+ <api>1.2.8</api>
</version>
<stability>
<release>stable</release>
<api>stable</api>
</stability>
<license uri="http://www.apache.org/licenses/LICENSE-2.0">Apache License</license>
<notes>
-** Bug
- * [PHPC-855] - Assertion failure in stream_not_found() after failed getmore operation
- * [PHPC-856] - Build errors using bundled libbson and system libmongoc
- * [PHPC-872] - Do not use system crypto policy for OpenSSL on Windows
- * [PHPC-878] - php_json_serializable_ce missing in PHP versions before 5.5.10 and 5.4.26
- * [PHPC-879] - php_date_get_immutable_ce missing in PHP versions before 5.6.8 and 5.5.24
- * [PHPC-881] - Windows CA stores should be opened with read-only flag
- * [PHPC-883] - BSON array keys should be disregarded during visitation
- * [PHPC-884] - Public property with zero-length name ignored during BSON encoding
- * [PHPC-885] - Alphabetize Regex flags when instantiating from BSON
- * [PHPC-886] - Always recalculate field name length when encoding BSON
- * [PHPC-891] - BSON encoding should throw if PHP keys contain null bytes
-
** Improvement
- * [PHPC-635] - WriteResult debug handler should return objects
- * [PHPC-873] - Do not allow mixing bundled and system libbson and libmongoc libraries
-
-** Task
- * [PHPC-633] - Add lines to phpinfo() output regarding support for SSL and SASL
- * [PHPC-714] - Implement BSON corpus test suite
- * [PHPC-890] - Add license header to source files
+ * [PHPC-936] - Define PHP_MONGODB_VERSION constant for Pickle compatibility
</notes>
<contents>
<dir name="/">
<file md5sum="b301ead064e031b76fa08488a1055594" name="scripts/centos/ldap/Domain.ldif" role="test" />
<file md5sum="4daa783214593b6d7deb42f35c6e027c" name="scripts/centos/ldap/Users.ldif" role="test" />
<file md5sum="001e9cfe2c64b4afe413c12da3a75103" name="scripts/centos/ldap/basics.ldif" role="test" />
<file md5sum="624db776065d2ce0e76c3dd252c86c27" name="scripts/centos/ldap/install.sh" role="test" />
<file md5sum="3373471c13615482fcb5abd156a99013" name="scripts/centos/ldap/mongod.ldif" role="test" />
<file md5sum="79641e9055dc9a4c810cdc580d420ccf" name="scripts/centos/ldap/pw.ldif" role="test" />
<file md5sum="7069ce3fbf9612eb20df4de56e2915e7" name="scripts/centos/ldap/saslauthd.conf" role="test" />
<file md5sum="c2d1c7b3b12d970c295ebceda4bd429f" name="scripts/centos/ldap/users" role="test" />
<file md5sum="9add0018a9ebebb32e6f9d689d53ce14" name="scripts/centos/essentials.sh" role="test" />
<file md5sum="43a925c212fc965e90d89951d04945c1" name="scripts/freebsd/essentials.sh" role="test" />
<file md5sum="18b03fd810bde00c7493002a94e24865" name="scripts/freebsd/phongo.sh" role="test" />
<file md5sum="0e6d3baeb0ffedee6a4d5500a725331b" name="scripts/presets/replicaset-30.json" role="test" />
<file md5sum="b5c14f08571fcfe2aa5641a7a18d4c3f" name="scripts/presets/replicaset.json" role="test" />
<file md5sum="d850cacbf5527fd7b4a46958e66ed5c9" name="scripts/presets/standalone-24.json" role="test" />
<file md5sum="d9b0cfc2035c3d5c0baae6959a90c36e" name="scripts/presets/standalone-26.json" role="test" />
<file md5sum="60c5e499c429eb07e1f96b37baa42adf" name="scripts/presets/standalone-30.json" role="test" />
<file md5sum="b8cc887e5bccc9bc1f715d041d2d657b" name="scripts/presets/standalone-auth.json" role="test" />
<file md5sum="2bc383470aa5dfc60185ef19a8a80276" name="scripts/presets/standalone-plain.json" role="test" />
<file md5sum="82e65a04030826c41d713787833fb52a" name="scripts/presets/standalone-ssl.json" role="test" />
<file md5sum="c5acd3fbc060927121ff626f3b730cfa" name="scripts/presets/standalone-x509.json" role="test" />
<file md5sum="17927182a5fb8fb9d1ad8c8571c32b29" name="scripts/presets/standalone.json" role="test" />
<file md5sum="06b59105c25447470ca9f7c589b80b46" name="scripts/ssl/ca.pem" role="test" />
<file md5sum="6bdc883fdbe5a1c736518e5ec5f67964" name="scripts/ssl/client.pem" role="test" />
<file md5sum="94a4db9c47b58aa3d00b70b4bd178601" name="scripts/ssl/crl.pem" role="test" />
<file md5sum="bfccd366ca201a01f8f5bea8c900abc9" name="scripts/ssl/server.pem" role="test" />
<file md5sum="cb636b47cf37dace58be73272a74efc3" name="scripts/ubuntu/ldap/install.sh" role="test" />
<file md5sum="c4c1a6c234d983da8fe0382bcb8c1420" name="scripts/ubuntu/ldap/saslauthd.conf" role="test" />
<file md5sum="b199baa1ee52bc252773485de56b10f6" name="scripts/ubuntu/essentials.sh" role="test" />
<file md5sum="b4a9eb39b992590f39b56e4fdbabe757" name="scripts/ubuntu/mongo-orchestration.sh" role="test" />
<file md5sum="903c38a7e9d59fec770c1138de85d7be" name="scripts/ubuntu/phongo.sh" role="test" />
<file md5sum="a51616233fb311f458391b668e0254e9" name="scripts/vmware/kernel.sh" role="test" />
<file md5sum="c88d285816124a410618f8dc72d00d89" name="scripts/convert-bson-corpus-tests.php" role="test" />
<file md5sum="28868809c797d2b57b0f21bfc66b4862" name="scripts/convert-mo-tests.php" role="test" />
<file md5sum="35671ea9b24b02610710ef676bc539a2" name="scripts/list-servers.php" role="test" />
<file md5sum="43b39f67f12cacf6f21de522b51a2900" name="scripts/start-servers.php" role="test" />
- <file md5sum="887dbc852b03cb3b3409b0534fb84f38" name="src/BSON/Binary.c" role="src" />
- <file md5sum="ef142d5d1ae5dd5b25f0c17f7dc4564b" name="src/BSON/Decimal128.c" role="src" />
- <file md5sum="04fc72ae14ea89601936d0e4029ba36c" name="src/BSON/Javascript.c" role="src" />
+ <file md5sum="7ee037a37ff8fe691a07b89459960b95" name="src/BSON/Binary.c" role="src" />
+ <file md5sum="d5f7bbc4ed8d6ff9a123956ed722c801" name="src/BSON/Decimal128.c" role="src" />
+ <file md5sum="34ae58409f792fcb8fa74ad043a11a36" name="src/BSON/Javascript.c" role="src" />
<file md5sum="c2582986fe8b88541b763a826f70d2be" name="src/BSON/MaxKey.c" role="src" />
<file md5sum="29cd37a40764ffdfc9b7b7745f819749" name="src/BSON/MinKey.c" role="src" />
- <file md5sum="7ecb5c1d1701670d8a3e38cf80f5647d" name="src/BSON/ObjectID.c" role="src" />
+ <file md5sum="fe810bb9961836a3b856a50175548001" name="src/BSON/ObjectID.c" role="src" />
<file md5sum="29be27feba0c4fd22926b3fb230f32af" name="src/BSON/Persistable.c" role="src" />
- <file md5sum="d90c70ae77ff4b4c8f1add5f9899ab8d" name="src/BSON/Regex.c" role="src" />
+ <file md5sum="fb344e7916685401333d4acaf17e96e8" name="src/BSON/Regex.c" role="src" />
<file md5sum="ffe11cd5ab7a3ab3867762e3821bd5fa" name="src/BSON/Serializable.c" role="src" />
- <file md5sum="6491f8fef9cf7483baedab1196fb4a7e" name="src/BSON/Timestamp.c" role="src" />
+ <file md5sum="257045036aa90cec7df774628147130e" name="src/BSON/Timestamp.c" role="src" />
<file md5sum="254160369cadac36e99cae9eaced58da" name="src/BSON/Type.c" role="src" />
- <file md5sum="a08118d8ca4784695b109ccbc9bd7127" name="src/BSON/UTCDateTime.c" role="src" />
+ <file md5sum="969dc2743ffc80cf16cda6e868552dfc" name="src/BSON/UTCDateTime.c" role="src" />
<file md5sum="edf08eba86d062a6edf1450353ce9dfa" name="src/BSON/Unserializable.c" role="src" />
<file md5sum="593902253871c923e3aa9e4b5c280c1b" name="src/MongoDB/Exception/AuthenticationException.c" role="src" />
<file md5sum="37613d8c56e6eb3f1f49f2eb18ac70fd" name="src/MongoDB/Exception/BulkWriteException.c" role="src" />
<file md5sum="2b5d73974422a0348c27243caf4b069c" name="src/MongoDB/Exception/ConnectionException.c" role="src" />
<file md5sum="f8201ee15a471e28f73bbe0cd32893fb" name="src/MongoDB/Exception/ConnectionTimeoutException.c" role="src" />
<file md5sum="2fe7eb153dd9afe4055b07ad14045096" name="src/MongoDB/Exception/Exception.c" role="src" />
<file md5sum="da4efc2cf46801eadd28b27f152f9c76" name="src/MongoDB/Exception/ExecutionTimeoutException.c" role="src" />
<file md5sum="15194367fe2e61a77ba09272a9025ce4" name="src/MongoDB/Exception/InvalidArgumentException.c" role="src" />
<file md5sum="b7752dc99773bbb2cd1a566ab77b6ab1" name="src/MongoDB/Exception/LogicException.c" role="src" />
<file md5sum="645ac5c512ea9625f76143e0799c4a41" name="src/MongoDB/Exception/RuntimeException.c" role="src" />
<file md5sum="1b79b54ac2266c02ebc70092d59340a4" name="src/MongoDB/Exception/SSLConnectionException.c" role="src" />
<file md5sum="b42547a62ddcfeaf3a0680778bd3dd92" name="src/MongoDB/Exception/UnexpectedValueException.c" role="src" />
<file md5sum="5146c8a838074bb66cdac1a60bf1e3f4" name="src/MongoDB/Exception/WriteException.c" role="src" />
<file md5sum="d8722e3b0b0fb0451c1ee7af3983106c" name="src/MongoDB/BulkWrite.c" role="src" />
<file md5sum="3aebdb02c66141bc300ca990d23b453b" name="src/MongoDB/Command.c" role="src" />
- <file md5sum="d21618f3ede6031977fa85a715657f8e" name="src/MongoDB/Cursor.c" role="src" />
+ <file md5sum="2e816e4d84ff52fbb2a3958e70b17d32" name="src/MongoDB/Cursor.c" role="src" />
<file md5sum="ca3952c22871de02a15b3ab8b6b5e7a4" name="src/MongoDB/CursorId.c" role="src" />
<file md5sum="8bd35939d3c3febbc7c2fe9dd958b954" name="src/MongoDB/Manager.c" role="src" />
<file md5sum="ece20c625f4f83ade4bd6b05968ebcd2" name="src/MongoDB/Query.c" role="src" />
<file md5sum="3ea60178579f3098045344f01fa4294c" name="src/MongoDB/ReadConcern.c" role="src" />
<file md5sum="8ec2039aba9590a65cb9f54fb0d2b6fb" name="src/MongoDB/ReadPreference.c" role="src" />
<file md5sum="211dae5aad495d8ed2e5057744b0c669" name="src/MongoDB/Server.c" role="src" />
<file md5sum="d624cf9741e0d68de027064c50c45ae0" name="src/MongoDB/WriteConcern.c" role="src" />
<file md5sum="87552471709877ae481ff4af1885314a" name="src/MongoDB/WriteConcernError.c" role="src" />
<file md5sum="ac45b95e6e41701484730581640a7737" name="src/MongoDB/WriteError.c" role="src" />
<file md5sum="546d7d2b12467854a35838083c9499ea" name="src/MongoDB/WriteResult.c" role="src" />
<file md5sum="3eb4bc184583d52ef59d9909fa96c3ae" name="src/contrib/php_array_api.h" role="src" />
<file md5sum="1066d5c9a05b1b1cb8f4de5a7e291574" name="src/libbson/build/autotools/m4/ac_check_typedef.m4" role="src" />
<file md5sum="e40a5f02f4d82a68b3df43d99dd92ed6" name="src/libbson/build/autotools/m4/ac_compile_check_sizeof.m4" role="src" />
<file md5sum="b96bb8fad4ea5d66c6b3af718186e2e0" name="src/libbson/build/autotools/m4/ac_create_stdint_h.m4" role="src" />
<file md5sum="7b5ee49855c90a9da6a0b1f1f0b8ef8f" name="src/libbson/build/autotools/m4/as-compiler-flag.m4" role="src" />
<file md5sum="8d942f69b5f3c15ecae4b75bb7e80614" name="src/libbson/build/autotools/m4/ax_check_compile_flag.m4" role="src" />
<file md5sum="05bd24609268702a36d50d5edd3661ac" name="src/libbson/build/autotools/m4/ax_check_link_flag.m4" role="src" />
<file md5sum="b5114dfcf027b0f9a47b6e6841015be6" name="src/libbson/build/autotools/m4/ax_pthread.m4" role="src" />
<file md5sum="ad8d52d54e0f97c0e4e385376ea73bc0" name="src/libbson/build/autotools/m4/pkg.m4" role="src" />
<file md5sum="ff788a8b5eea35b1cc226bb2686c3537" name="src/libbson/build/autotools/m4/silent.m4" role="src" />
<file md5sum="c78c5e9b49b67a725e831823492642da" name="src/libbson/build/autotools/CheckAtomics.m4" role="src" />
<file md5sum="33c0e73d71ead46ce5a11eda4ce160b6" name="src/libbson/build/autotools/CheckCompiler.m4" role="src" />
<file md5sum="7321a188b1b870fb49f5a003ef426f7a" name="src/libbson/build/autotools/CheckHeaders.m4" role="src" />
<file md5sum="81b2b641c597d18daa4066ed7c37d7b7" name="src/libbson/build/autotools/CheckHost.m4" role="src" />
<file md5sum="5147ee8369f1744715365976b38777fc" name="src/libbson/build/autotools/CheckProgs.m4" role="src" />
<file md5sum="fa4a5cc1c9475999c468488eb19e4ffe" name="src/libbson/build/autotools/CheckTarget.m4" role="src" />
<file md5sum="760f59b300da59088cde1fec10892516" name="src/libbson/build/autotools/Coverage.m4" role="src" />
<file md5sum="46768d326c5f994af7e1ffbb0db32a4e" name="src/libbson/build/autotools/Endian.m4" role="src" />
<file md5sum="5d8b05763742a46fa526b042bd8d1ba1" name="src/libbson/build/autotools/FindDependencies.m4" role="src" />
<file md5sum="e0e854d844eca0badff9c88943c37c26" name="src/libbson/build/autotools/MaintainerFlags.m4" role="src" />
<file md5sum="6a2e174f53c50c3bddfb31444cf24174" name="src/libbson/build/autotools/Optimizations.m4" role="src" />
<file md5sum="98c586cc0577a30efcf22b03eca1e35e" name="src/libbson/build/autotools/PrintBuildConfiguration.m4" role="src" />
<file md5sum="fba3745f469f5fe94c400ad018a8fb57" name="src/libbson/build/autotools/ReadCommandLineArguments.m4" role="src" />
<file md5sum="04ab110ebc0f75c1558392e1748770cf" name="src/libbson/build/autotools/SetupAutomake.m4" role="src" />
<file md5sum="f229599b4333a2cdf5be29136cc6f2e2" name="src/libbson/build/autotools/SetupLibtool.m4" role="src" />
<file md5sum="2e50f9a74b7624536d967c01897fd22e" name="src/libbson/build/autotools/Versions.m4" role="src" />
<file md5sum="60d5834d66c34c59c0a12a7eecbf84ab" name="src/libbson/src/bson/b64_ntop.h" role="src" />
<file md5sum="70cebe2a7a17de7d489317b7a1db7c73" name="src/libbson/src/bson/b64_pton.h" role="src" />
<file md5sum="b65b92b902052d02281a5c8772911f3a" name="src/libbson/src/bson/bcon.c" role="src" />
<file md5sum="16188df02b9c53ee8e084fbeabaa707e" name="src/libbson/src/bson/bcon.h" role="src" />
<file md5sum="2fdfba5acf3beb2fbdabaafe44d7fde7" name="src/libbson/src/bson/bson-atomic.c" role="src" />
<file md5sum="4ed90c95f202a914604bf106e757d1d0" name="src/libbson/src/bson/bson-atomic.h" role="src" />
<file md5sum="717ca038872a5c6611358a548e72dec5" name="src/libbson/src/bson/bson-clock.c" role="src" />
<file md5sum="691d6cf644ac2d58e8af36986413c4da" name="src/libbson/src/bson/bson-clock.h" role="src" />
<file md5sum="db543766d2c6eb499fd156a06620e2ed" name="src/libbson/src/bson/bson-compat.h" role="src" />
<file md5sum="2dbddf33a12a0530bbc16b8da96609fc" name="src/libbson/src/bson/bson-config.h" role="src" />
<file md5sum="f8a850d89808d7eb510bd01ac4afc67f" name="src/libbson/src/bson/bson-config.h.in" role="src" />
<file md5sum="11177a64ea0d8136b73312d0e9313dae" name="src/libbson/src/bson/bson-context-private.h" role="src" />
<file md5sum="7e41e815cd22805185e92e4b96460398" name="src/libbson/src/bson/bson-context.c" role="src" />
<file md5sum="da04f8ca2154e1d981e9bfcf495fbf10" name="src/libbson/src/bson/bson-context.h" role="src" />
<file md5sum="5da3ce74efc6b11b3c0162f22565892f" name="src/libbson/src/bson/bson-decimal128.c" role="src" />
<file md5sum="1fb1f9a67c33d160a49028ae6ce670d3" name="src/libbson/src/bson/bson-decimal128.h" role="src" />
<file md5sum="a8d2b6f9a285e267c372ec7e3def2258" name="src/libbson/src/bson/bson-endian.h" role="src" />
<file md5sum="10013b2ccaa0104a646d5f7bdf5e817d" name="src/libbson/src/bson/bson-error.c" role="src" />
<file md5sum="7f1cd62347eb8689c5d44f74339eef44" name="src/libbson/src/bson/bson-error.h" role="src" />
<file md5sum="be7c0192246dad6a30b0f3835380c343" name="src/libbson/src/bson/bson-iso8601-private.h" role="src" />
<file md5sum="bcbaf2a59bc63350978d2be3401118bb" name="src/libbson/src/bson/bson-iso8601.c" role="src" />
<file md5sum="dd58c4fad45f1fdf5e47ea8ef76da28f" name="src/libbson/src/bson/bson-iter.c" role="src" />
<file md5sum="3b60b85112afed36d7c6d6009186220b" name="src/libbson/src/bson/bson-iter.h" role="src" />
<file md5sum="13b36f988eaf632f7ed4fe7ecd3e1092" name="src/libbson/src/bson/bson-json.c" role="src" />
<file md5sum="46c5d1f93f18828b30204a53bc854213" name="src/libbson/src/bson/bson-json.h" role="src" />
<file md5sum="30bfe359c194f01ffbf1afe053c4f16c" name="src/libbson/src/bson/bson-keys.c" role="src" />
<file md5sum="8851e34c640dd841e417126a0fad24e7" name="src/libbson/src/bson/bson-keys.h" role="src" />
<file md5sum="a56682511d0ae04d6f9b5b54c6553a62" name="src/libbson/src/bson/bson-macros.h" role="src" />
<file md5sum="016da785f4bd6ed2654a1dd6e7e20711" name="src/libbson/src/bson/bson-md5.c" role="src" />
<file md5sum="d9fe5fc0e7ed5c220f44fee8144b3dfd" name="src/libbson/src/bson/bson-md5.h" role="src" />
<file md5sum="7ae6e31017ccc52a43a611f5f54703d1" name="src/libbson/src/bson/bson-memory.c" role="src" />
<file md5sum="4733c13bb3bc962ba54a8083befcd46e" name="src/libbson/src/bson/bson-memory.h" role="src" />
<file md5sum="202b1f52365ef9e6a6302cd6d705c15b" name="src/libbson/src/bson/bson-oid.c" role="src" />
<file md5sum="61e7243d7a21a5a42931d75a5671be88" name="src/libbson/src/bson/bson-oid.h" role="src" />
<file md5sum="fafa4d77b189d7eadf89c3a3e46d1f7d" name="src/libbson/src/bson/bson-private.h" role="src" />
<file md5sum="7bb1abda28771803d3aeda67f2281227" name="src/libbson/src/bson/bson-reader.c" role="src" />
<file md5sum="0f6028ee1998c26ff78494d798b64555" name="src/libbson/src/bson/bson-reader.h" role="src" />
<file md5sum="d4277ba8b3bc0f7753931062eb0cd5eb" name="src/libbson/src/bson/bson-stdint-win32.h" role="src" />
<file md5sum="aca225176c92ed018d3c240802570121" name="src/libbson/src/bson/bson-stdint.h" role="src" />
<file md5sum="3f4ab58c8dcf69dd36c8a294afed0ee5" name="src/libbson/src/bson/bson-string.c" role="src" />
<file md5sum="c9fe72eb5bece52473425623ff433410" name="src/libbson/src/bson/bson-string.h" role="src" />
<file md5sum="2a16019c51864483f27676c83e12b293" name="src/libbson/src/bson/bson-thread-private.h" role="src" />
<file md5sum="bbe5863f79868d0a153f9eb591f09f20" name="src/libbson/src/bson/bson-timegm-private.h" role="src" />
<file md5sum="346c4904b781e818f8b051e843a33bb1" name="src/libbson/src/bson/bson-timegm.c" role="src" />
<file md5sum="bfce2ccd7df4ee0f9af4c4e7603f8d34" name="src/libbson/src/bson/bson-types.h" role="src" />
<file md5sum="2569921096086498f3b7e84dd37aea1b" name="src/libbson/src/bson/bson-utf8.c" role="src" />
<file md5sum="f9ff0cc5a8d3222e68520776b67e0cae" name="src/libbson/src/bson/bson-utf8.h" role="src" />
<file md5sum="56e722161bfffd9e3061d5220a3cc38a" name="src/libbson/src/bson/bson-value.c" role="src" />
<file md5sum="d84715f50622e23a70356fe77e218a8b" name="src/libbson/src/bson/bson-value.h" role="src" />
<file md5sum="f80a6f4a82a8c86f63eaccc1c8d147ee" name="src/libbson/src/bson/bson-version-functions.c" role="src" />
<file md5sum="21e2e2b57227d3ae0f13d57db7c211db" name="src/libbson/src/bson/bson-version-functions.h" role="src" />
- <file md5sum="0787cba6c988e4760769e0186d8b4121" name="src/libbson/src/bson/bson-version.h" role="src" />
+ <file md5sum="85dd59a81e1c8c9dace3f4e8af91376b" name="src/libbson/src/bson/bson-version.h" role="src" />
<file md5sum="9036341d3488d5aec2b028fae66c8c6f" name="src/libbson/src/bson/bson-version.h.in" role="src" />
<file md5sum="8108f0a5dd05650f53c3c2eca95d587c" name="src/libbson/src/bson/bson-writer.c" role="src" />
<file md5sum="3f42b83215982f5a37fb4e90a23da49a" name="src/libbson/src/bson/bson-writer.h" role="src" />
<file md5sum="9a3aea149ec8740816be515f45edc324" name="src/libbson/src/bson/bson.c" role="src" />
<file md5sum="f04c28071d9ee3f56246fc07339336b6" name="src/libbson/src/bson/bson.h" role="src" />
<file md5sum="cf5990b5d3ad3eafa329f4e6884582c5" name="src/libbson/src/yajl/yajl.c" role="src" />
<file md5sum="1c55df90c4d949c316e6e6e7498ec15c" name="src/libbson/src/yajl/yajl_alloc.c" role="src" />
<file md5sum="f3f9167846f7260138bd38021f9bb189" name="src/libbson/src/yajl/yajl_alloc.h" role="src" />
<file md5sum="289df9f01dc8865130659219e517a4b4" name="src/libbson/src/yajl/yajl_buf.c" role="src" />
<file md5sum="505cbe3ad7cbbb5579cecc86c8f93087" name="src/libbson/src/yajl/yajl_buf.h" role="src" />
<file md5sum="0963d85f30e3afa40fb4ae813ab046c1" name="src/libbson/src/yajl/yajl_bytestack.h" role="src" />
<file md5sum="ba824372c3ea0f9824d0b69315a0dec8" name="src/libbson/src/yajl/yajl_common.h" role="src" />
<file md5sum="b60b45eb35dd40f2b3825233fa9661bc" name="src/libbson/src/yajl/yajl_encode.c" role="src" />
<file md5sum="5644d79572411e06f808ee0c9e76a41b" name="src/libbson/src/yajl/yajl_encode.h" role="src" />
<file md5sum="a4590297b6777e24dbb4910250ff9f87" name="src/libbson/src/yajl/yajl_gen.c" role="src" />
<file md5sum="e57e21bda1283a3a6a178845096b5d9c" name="src/libbson/src/yajl/yajl_gen.h" role="src" />
<file md5sum="c3eeaa1d5383a98f7d05b32ee6111d86" name="src/libbson/src/yajl/yajl_lex.c" role="src" />
<file md5sum="dcada0f60f8121bf68b73d56f32273b6" name="src/libbson/src/yajl/yajl_lex.h" role="src" />
<file md5sum="ebd7e4faccaa0f454945be170f447eef" name="src/libbson/src/yajl/yajl_parse.h" role="src" />
<file md5sum="a975a6d331f72f5c481c828cbf549788" name="src/libbson/src/yajl/yajl_parser.c" role="src" />
<file md5sum="927906b0423c3d1412188b6686821f2e" name="src/libbson/src/yajl/yajl_parser.h" role="src" />
<file md5sum="c191e94c04f9b26f4fdf6f6563ad1fd7" name="src/libbson/src/yajl/yajl_tree.c" role="src" />
<file md5sum="69650cd70a46ddf7541401203b22f00d" name="src/libbson/src/yajl/yajl_tree.h" role="src" />
<file md5sum="8d8be470862bf4c55ee6344530e8eb38" name="src/libbson/src/yajl/yajl_version.c" role="src" />
<file md5sum="4194a43380dfaef3ca94cb2ba30da1f2" name="src/libbson/src/yajl/yajl_version.h" role="src" />
- <file md5sum="3c1de4a43daa0fe17b5080559cff640e" name="src/libbson/VERSION_CURRENT" role="src" />
- <file md5sum="3c1de4a43daa0fe17b5080559cff640e" name="src/libbson/VERSION_RELEASED" role="src" />
+ <file md5sum="51a3950c50505d7f5d8217ed8913f870" name="src/libbson/VERSION_CURRENT" role="src" />
+ <file md5sum="51a3950c50505d7f5d8217ed8913f870" name="src/libbson/VERSION_RELEASED" role="src" />
<file md5sum="1066d5c9a05b1b1cb8f4de5a7e291574" name="src/libmongoc/build/autotools/m4/ac_check_typedef.m4" role="src" />
<file md5sum="e40a5f02f4d82a68b3df43d99dd92ed6" name="src/libmongoc/build/autotools/m4/ac_compile_check_sizeof.m4" role="src" />
<file md5sum="b96bb8fad4ea5d66c6b3af718186e2e0" name="src/libmongoc/build/autotools/m4/ac_create_stdint_h.m4" role="src" />
<file md5sum="7b5ee49855c90a9da6a0b1f1f0b8ef8f" name="src/libmongoc/build/autotools/m4/as-compiler-flag.m4" role="src" />
<file md5sum="8d942f69b5f3c15ecae4b75bb7e80614" name="src/libmongoc/build/autotools/m4/ax_check_compile_flag.m4" role="src" />
<file md5sum="05bd24609268702a36d50d5edd3661ac" name="src/libmongoc/build/autotools/m4/ax_check_link_flag.m4" role="src" />
<file md5sum="5535e823ec44002b522873b9c0e2e0bf" name="src/libmongoc/build/autotools/m4/ax_pthread.m4" role="src" />
<file md5sum="ad8d52d54e0f97c0e4e385376ea73bc0" name="src/libmongoc/build/autotools/m4/pkg.m4" role="src" />
<file md5sum="ff788a8b5eea35b1cc226bb2686c3537" name="src/libmongoc/build/autotools/m4/silent.m4" role="src" />
<file md5sum="7c20548ba18d4b99f89203d853809bfc" name="src/libmongoc/build/autotools/AutomaticInitAndCleanup.m4" role="src" />
<file md5sum="33c0e73d71ead46ce5a11eda4ce160b6" name="src/libmongoc/build/autotools/CheckCompiler.m4" role="src" />
<file md5sum="13179edcad78c81881686dacb0135cca" name="src/libmongoc/build/autotools/CheckHost.m4" role="src" />
<file md5sum="391a0c966f553057255b9e8d6fcd9984" name="src/libmongoc/build/autotools/CheckProgs.m4" role="src" />
<file md5sum="e470d1fcc1e8a702ddb655c231832abb" name="src/libmongoc/build/autotools/CheckSSL.m4" role="src" />
<file md5sum="2fafccbb4655f9880e2e03c16c67b9fb" name="src/libmongoc/build/autotools/CheckSasl.m4" role="src" />
<file md5sum="fa4a5cc1c9475999c468488eb19e4ffe" name="src/libmongoc/build/autotools/CheckTarget.m4" role="src" />
<file md5sum="760f59b300da59088cde1fec10892516" name="src/libmongoc/build/autotools/Coverage.m4" role="src" />
<file md5sum="e8fb530e79b3212551151dd9fef1e92a" name="src/libmongoc/build/autotools/FindDependencies.m4" role="src" />
<file md5sum="a8977370dbf28d606e4a6628bba94fca" name="src/libmongoc/build/autotools/Libbson.m4" role="src" />
<file md5sum="931e4995c218c0efaa18d0616660dfa9" name="src/libmongoc/build/autotools/MaintainerFlags.m4" role="src" />
<file md5sum="4628165f19e500c1f48dc94ee6442f87" name="src/libmongoc/build/autotools/Optimizations.m4" role="src" />
<file md5sum="47a3d8bf65c9f7924a8b0ef405967d51" name="src/libmongoc/build/autotools/PlatformFlags.m4" role="src" />
<file md5sum="f7b421657adb24865e6d6ba313153957" name="src/libmongoc/build/autotools/PrintBuildConfiguration.m4" role="src" />
<file md5sum="7e1db4b15bdad23146b1aeee2091d242" name="src/libmongoc/build/autotools/ReadCommandLineArguments.m4" role="src" />
<file md5sum="572566950ac77d916d6bf73fde7b8395" name="src/libmongoc/build/autotools/SetupAutomake.m4" role="src" />
<file md5sum="f229599b4333a2cdf5be29136cc6f2e2" name="src/libmongoc/build/autotools/SetupLibtool.m4" role="src" />
<file md5sum="82639d82b348fc309980a1d14e96b462" name="src/libmongoc/build/autotools/Versions.m4" role="src" />
<file md5sum="76e2c1a2aa19f5fab3661c992ac603fa" name="src/libmongoc/build/autotools/WeakSymbols.m4" role="src" />
<file md5sum="a787cefb077fc241a01533a5b39a6a25" name="src/libmongoc/src/mongoc/mongoc-apm-private.h" role="src" />
<file md5sum="24dc2a9a3bffc9af459d14339bacfa42" name="src/libmongoc/src/mongoc/mongoc-apm.c" role="src" />
<file md5sum="4c05f3506cf7a5207f27a6407cf78973" name="src/libmongoc/src/mongoc/mongoc-apm.h" role="src" />
<file md5sum="678bad25aa96f5eebb6cdf3d07dc8ee4" name="src/libmongoc/src/mongoc/mongoc-array-private.h" role="src" />
<file md5sum="62bb69dffa4d2756c43bb06276cc6cc9" name="src/libmongoc/src/mongoc/mongoc-array.c" role="src" />
<file md5sum="12eeffbb60680bfaa3a7f32d8c2fd564" name="src/libmongoc/src/mongoc/mongoc-async-cmd-private.h" role="src" />
<file md5sum="c77183a0d182351ae77693be12a227a6" name="src/libmongoc/src/mongoc/mongoc-async-cmd.c" role="src" />
<file md5sum="ce14f4f2c326f8b8c6e06d23b7fbe9b5" name="src/libmongoc/src/mongoc/mongoc-async-private.h" role="src" />
<file md5sum="f738d00bd8aff7e7677311fac19d68ff" name="src/libmongoc/src/mongoc/mongoc-async.c" role="src" />
<file md5sum="afa9361dbc1b31a740ad31a1895ca767" name="src/libmongoc/src/mongoc/mongoc-b64-private.h" role="src" />
<file md5sum="d34fb5802a99635fa90705f98d1a3b1d" name="src/libmongoc/src/mongoc/mongoc-b64.c" role="src" />
<file md5sum="1b68493a7c819ecd6db4cb5616c381b3" name="src/libmongoc/src/mongoc/mongoc-buffer-private.h" role="src" />
<file md5sum="40668c7a150f312cf9ddfd4388f73037" name="src/libmongoc/src/mongoc/mongoc-buffer.c" role="src" />
<file md5sum="fa9f8928b3533f50f8a0425c2ce2baef" name="src/libmongoc/src/mongoc/mongoc-bulk-operation-private.h" role="src" />
<file md5sum="30fa015e6d6edc7b59241c258a457118" name="src/libmongoc/src/mongoc/mongoc-bulk-operation.c" role="src" />
<file md5sum="dd3e094267f189dbf6c60638cc582320" name="src/libmongoc/src/mongoc/mongoc-bulk-operation.h" role="src" />
<file md5sum="aaa351e309b5fba1c68046d0f9689ef7" name="src/libmongoc/src/mongoc/mongoc-client-pool-private.h" role="src" />
<file md5sum="30288bba4d5b6ac6ce08eaaa139b10b1" name="src/libmongoc/src/mongoc/mongoc-client-pool.c" role="src" />
<file md5sum="5bcb77aa865a4e6fad4368faf6d8caa4" name="src/libmongoc/src/mongoc/mongoc-client-pool.h" role="src" />
<file md5sum="944dd87e31f5092cec98d32cd87da536" name="src/libmongoc/src/mongoc/mongoc-client-private.h" role="src" />
<file md5sum="36322dcce1e3aec362fa2fe40288f130" name="src/libmongoc/src/mongoc/mongoc-client.c" role="src" />
<file md5sum="ae403158ad38aefa4f58fa012bf5a90c" name="src/libmongoc/src/mongoc/mongoc-client.h" role="src" />
<file md5sum="b0f2d20d2de5917ac689161a5c35b0c3" name="src/libmongoc/src/mongoc/mongoc-cluster-private.h" role="src" />
<file md5sum="d17e5ec096952f8b12c76b3108a59391" name="src/libmongoc/src/mongoc/mongoc-cluster.c" role="src" />
<file md5sum="7c667f78176a61824f6330c0ca9d4620" name="src/libmongoc/src/mongoc/mongoc-collection-private.h" role="src" />
- <file md5sum="ac26b48fa4660b1f7e317d31c0b3b22a" name="src/libmongoc/src/mongoc/mongoc-collection.c" role="src" />
+ <file md5sum="bdfb6cdaa20ea439f77c0c920c821f0b" name="src/libmongoc/src/mongoc/mongoc-collection.c" role="src" />
<file md5sum="83a3a6e6533aa51809743fd5e360c999" name="src/libmongoc/src/mongoc/mongoc-collection.h" role="src" />
<file md5sum="31c95580f97cd0f7ad8dd23599f9ba2b" name="src/libmongoc/src/mongoc/mongoc-config.h" role="src" />
<file md5sum="2e2095a3b3644ba62adad9b54ddd6654" name="src/libmongoc/src/mongoc/mongoc-config.h.in" role="src" />
<file md5sum="c745e1b8d7d0b771c27c66e4847849f1" name="src/libmongoc/src/mongoc/mongoc-counters-private.h" role="src" />
<file md5sum="d4cc28ff33d6328db4a63dd36781467b" name="src/libmongoc/src/mongoc/mongoc-counters.c" role="src" />
<file md5sum="4bf259bbc90203a8a52270f2c9c473f7" name="src/libmongoc/src/mongoc/mongoc-counters.defs" role="src" />
<file md5sum="4af14a18a7ee70fb91b99dd08fc609f5" name="src/libmongoc/src/mongoc/mongoc-crypto-cng-private.h" role="src" />
<file md5sum="9682465713bdb3be7dc3ed289eb79972" name="src/libmongoc/src/mongoc/mongoc-crypto-cng.c" role="src" />
<file md5sum="f679d6de1eae611fac673f72c60d5bc4" name="src/libmongoc/src/mongoc/mongoc-crypto-cng.h" role="src" />
<file md5sum="848358cc4cc10dbf10aacef0e6c52990" name="src/libmongoc/src/mongoc/mongoc-crypto-common-crypto-private.h" role="src" />
<file md5sum="06b47d2ce98c56ed7dd1cc2618447eae" name="src/libmongoc/src/mongoc/mongoc-crypto-common-crypto.c" role="src" />
<file md5sum="545bd52f1f869c6a0a86c99e1c97562b" name="src/libmongoc/src/mongoc/mongoc-crypto-openssl-private.h" role="src" />
<file md5sum="85d8089915a6d187b90f1fa24e903bbd" name="src/libmongoc/src/mongoc/mongoc-crypto-openssl.c" role="src" />
<file md5sum="e6a4a250d28568351422a8a7934f61da" name="src/libmongoc/src/mongoc/mongoc-crypto-private.h" role="src" />
<file md5sum="b60c8edc574b0dd442a397214841ff06" name="src/libmongoc/src/mongoc/mongoc-crypto.c" role="src" />
<file md5sum="502eb9b02a39699ac25a428f99ff7101" name="src/libmongoc/src/mongoc/mongoc-cursor-array-private.h" role="src" />
<file md5sum="27fe24f0b50750b6a4fb9d9190944c14" name="src/libmongoc/src/mongoc/mongoc-cursor-array.c" role="src" />
<file md5sum="740d338cdf984a279869bce836ec1ff3" name="src/libmongoc/src/mongoc/mongoc-cursor-cursorid-private.h" role="src" />
<file md5sum="981fd5afa1c233f2900aa9ead1dcc972" name="src/libmongoc/src/mongoc/mongoc-cursor-cursorid.c" role="src" />
<file md5sum="152fbfed717ca796c27aca9da9e46dce" name="src/libmongoc/src/mongoc/mongoc-cursor-private.h" role="src" />
<file md5sum="f85d601cc7248324d7eb36e05802dbc8" name="src/libmongoc/src/mongoc/mongoc-cursor-transform-private.h" role="src" />
<file md5sum="ceeb2a5e474f012330139ab2e53168c8" name="src/libmongoc/src/mongoc/mongoc-cursor-transform.c" role="src" />
- <file md5sum="c988bdd1123e48621329c45f3d6ddb66" name="src/libmongoc/src/mongoc/mongoc-cursor.c" role="src" />
+ <file md5sum="f4ef343d775befdbd3e97730ed2ec502" name="src/libmongoc/src/mongoc/mongoc-cursor.c" role="src" />
<file md5sum="91e8ad7bdbc61aab4cf6b2de57a71e7b" name="src/libmongoc/src/mongoc/mongoc-cursor.h" role="src" />
<file md5sum="5d13effee2564a59e0e42eb807f4773d" name="src/libmongoc/src/mongoc/mongoc-database-private.h" role="src" />
<file md5sum="d553297680d1b8d17cca9123500da8d8" name="src/libmongoc/src/mongoc/mongoc-database.c" role="src" />
<file md5sum="a7fd7142bf92f78552c7eeddd424220b" name="src/libmongoc/src/mongoc/mongoc-database.h" role="src" />
<file md5sum="0e73e2d9ee30ab20d5e462a5186e6524" name="src/libmongoc/src/mongoc/mongoc-errno-private.h" role="src" />
<file md5sum="e09f6df1547214b23f06f2198e9a7322" name="src/libmongoc/src/mongoc/mongoc-error.h" role="src" />
<file md5sum="3c86af8181b63ca6245a3d6a6fd670ee" name="src/libmongoc/src/mongoc/mongoc-find-and-modify-private.h" role="src" />
<file md5sum="ff818e28c67218b48615460ac9ddb12a" name="src/libmongoc/src/mongoc/mongoc-find-and-modify.c" role="src" />
<file md5sum="1b8d29183b4020d3023d07666c3c1cf3" name="src/libmongoc/src/mongoc/mongoc-find-and-modify.h" role="src" />
<file md5sum="a451f9575924b096df541a3159876a7e" name="src/libmongoc/src/mongoc/mongoc-flags.h" role="src" />
<file md5sum="fd3276101d79b9f0025dcb53033eb606" name="src/libmongoc/src/mongoc/mongoc-gridfs-file-list-private.h" role="src" />
<file md5sum="4fb06d89ef4336d2d8b94b003f4b58cc" name="src/libmongoc/src/mongoc/mongoc-gridfs-file-list.c" role="src" />
<file md5sum="bb0db47fd35b1a260ca66526c2ad3bc4" name="src/libmongoc/src/mongoc/mongoc-gridfs-file-list.h" role="src" />
<file md5sum="2f4044550b8f021f836e05939f843056" name="src/libmongoc/src/mongoc/mongoc-gridfs-file-page-private.h" role="src" />
<file md5sum="c54fb019dbfbcb06a5474460366ca921" name="src/libmongoc/src/mongoc/mongoc-gridfs-file-page.c" role="src" />
<file md5sum="bd1c523d758a24e137e3ab9073e22664" name="src/libmongoc/src/mongoc/mongoc-gridfs-file-page.h" role="src" />
<file md5sum="4668d0d14fe78a00ee9c89fc5d5c53a4" name="src/libmongoc/src/mongoc/mongoc-gridfs-file-private.h" role="src" />
<file md5sum="a720eacd0d197618258a9d213d2e68aa" name="src/libmongoc/src/mongoc/mongoc-gridfs-file.c" role="src" />
<file md5sum="44a00daafb861d9ab874fc1842df2aea" name="src/libmongoc/src/mongoc/mongoc-gridfs-file.h" role="src" />
<file md5sum="30aaef098b877725258df96fb675af1b" name="src/libmongoc/src/mongoc/mongoc-gridfs-private.h" role="src" />
<file md5sum="db8c88fdff82ed9a38212f4fcf7a463b" name="src/libmongoc/src/mongoc/mongoc-gridfs.c" role="src" />
<file md5sum="acc4752c97ceb7ed8e68922ed0576b1f" name="src/libmongoc/src/mongoc/mongoc-gridfs.h" role="src" />
<file md5sum="217f5eb7438c032c116d189896eb4765" name="src/libmongoc/src/mongoc/mongoc-handshake-compiler-private.h" role="src" />
<file md5sum="f91db339db8e09e79ef114fccb25eddb" name="src/libmongoc/src/mongoc/mongoc-handshake-os-private.h" role="src" />
<file md5sum="a2ae5ec10d61769c9355749e5c8434b7" name="src/libmongoc/src/mongoc/mongoc-handshake-private.h" role="src" />
<file md5sum="bd709567defdf300a819e427521dba47" name="src/libmongoc/src/mongoc/mongoc-handshake.c" role="src" />
<file md5sum="4d2b08fb4e093499ef6804ac4638f85d" name="src/libmongoc/src/mongoc/mongoc-handshake.h" role="src" />
<file md5sum="d36969e1ad509faff84d0bf517c62df7" name="src/libmongoc/src/mongoc/mongoc-host-list-private.h" role="src" />
<file md5sum="5ad5435d0cdb0637089e0825fb41a58c" name="src/libmongoc/src/mongoc/mongoc-host-list.c" role="src" />
<file md5sum="4294099976ce13b16ccd9f1e054ecd4e" name="src/libmongoc/src/mongoc/mongoc-host-list.h" role="src" />
<file md5sum="ecda6300117ef0a8cbe4090d7feb7138" name="src/libmongoc/src/mongoc/mongoc-index.c" role="src" />
<file md5sum="ed91c07020e9beaaccc26736eaf3d4fb" name="src/libmongoc/src/mongoc/mongoc-index.h" role="src" />
<file md5sum="de8ff0f45d4f78384d8fd6da79502270" name="src/libmongoc/src/mongoc/mongoc-init.c" role="src" />
<file md5sum="8c35a4641b5255a3a557cc94747a2ad8" name="src/libmongoc/src/mongoc/mongoc-init.h" role="src" />
<file md5sum="952d463b654e44a66123cd8883b59748" name="src/libmongoc/src/mongoc/mongoc-iovec.h" role="src" />
<file md5sum="0d8a19472951fee25bb225c48e0ef278" name="src/libmongoc/src/mongoc/mongoc-libressl-private.h" role="src" />
<file md5sum="53b9006e385c5bd5944c55473e835980" name="src/libmongoc/src/mongoc/mongoc-libressl.c" role="src" />
<file md5sum="ec1fd08bd3131f01a87b90ca82815d2c" name="src/libmongoc/src/mongoc/mongoc-linux-distro-scanner-private.h" role="src" />
<file md5sum="aa1726a754911daec89239a8133bad96" name="src/libmongoc/src/mongoc/mongoc-linux-distro-scanner.c" role="src" />
<file md5sum="1e710c6899e1d3a8b33b7d4015457d6d" name="src/libmongoc/src/mongoc/mongoc-list-private.h" role="src" />
<file md5sum="01f733a69d79f45e7a8b7a01fd9b61e1" name="src/libmongoc/src/mongoc/mongoc-list.c" role="src" />
<file md5sum="6ee6a1f8f01ce9235c75829ce5344edf" name="src/libmongoc/src/mongoc/mongoc-log-private.h" role="src" />
<file md5sum="e77f497753878bbbe838b2946268aa09" name="src/libmongoc/src/mongoc/mongoc-log.c" role="src" />
<file md5sum="a996633e6736c225b27f85b08ffcab6f" name="src/libmongoc/src/mongoc/mongoc-log.h" role="src" />
<file md5sum="20b88053159e284784ec570135cf09bb" name="src/libmongoc/src/mongoc/mongoc-matcher-op-private.h" role="src" />
<file md5sum="d134ab092926a9e19b4dd14f85122681" name="src/libmongoc/src/mongoc/mongoc-matcher-op.c" role="src" />
<file md5sum="8d8be12dd5774d31fe7c025af0d1483b" name="src/libmongoc/src/mongoc/mongoc-matcher-private.h" role="src" />
<file md5sum="34d9b266424c63145eb1b9fa4f8e4d49" name="src/libmongoc/src/mongoc/mongoc-matcher.c" role="src" />
<file md5sum="c31a032fe8246b8939ea4c7443752f98" name="src/libmongoc/src/mongoc/mongoc-matcher.h" role="src" />
<file md5sum="21a4bf0cbe4dbbb3e87e64a16da392e1" name="src/libmongoc/src/mongoc/mongoc-memcmp-private.h" role="src" />
<file md5sum="7a2c50776b0cb3d84b1463d5da8f9571" name="src/libmongoc/src/mongoc/mongoc-memcmp.c" role="src" />
<file md5sum="a85087cd67361993a945ecddce1b8ff3" name="src/libmongoc/src/mongoc/mongoc-opcode-private.h" role="src" />
<file md5sum="2fd75713af0b61664ca7947837b00282" name="src/libmongoc/src/mongoc/mongoc-opcode.c" role="src" />
<file md5sum="cb8c7ee22278ab7c4e17223deb233dcf" name="src/libmongoc/src/mongoc/mongoc-opcode.h" role="src" />
<file md5sum="7eb9ca07802f57c8541489ba45dbf217" name="src/libmongoc/src/mongoc/mongoc-openssl-private.h" role="src" />
<file md5sum="34963158b37362b1a0be5a1212f364d2" name="src/libmongoc/src/mongoc/mongoc-openssl.c" role="src" />
<file md5sum="5f4c9d0b52b32913ee15c291dd367100" name="src/libmongoc/src/mongoc/mongoc-queue-private.h" role="src" />
<file md5sum="31ed0c79e107f70616f28392469b1168" name="src/libmongoc/src/mongoc/mongoc-queue.c" role="src" />
<file md5sum="55141f0a5e1ad7046292d02e8966155b" name="src/libmongoc/src/mongoc/mongoc-rand-cng.c" role="src" />
<file md5sum="15adb6f2d7ecf6205518b68b2d97098f" name="src/libmongoc/src/mongoc/mongoc-rand-common-crypto.c" role="src" />
<file md5sum="fc75c9e587209921d216f515836c63bc" name="src/libmongoc/src/mongoc/mongoc-rand-openssl.c" role="src" />
<file md5sum="de8b26a00d4df1912e7f2aa9cd1bda64" name="src/libmongoc/src/mongoc/mongoc-rand-private.h" role="src" />
<file md5sum="9eb403d113f5a74fde117fc4d1edd35b" name="src/libmongoc/src/mongoc/mongoc-rand.h" role="src" />
<file md5sum="079f4d48a7d339a15d35442a77f0f8dd" name="src/libmongoc/src/mongoc/mongoc-read-concern-private.h" role="src" />
<file md5sum="7904d7dd43c6b815a7430e4ffa600e34" name="src/libmongoc/src/mongoc/mongoc-read-concern.c" role="src" />
<file md5sum="a363e4c8fa75df178e26ff5f5262834e" name="src/libmongoc/src/mongoc/mongoc-read-concern.h" role="src" />
<file md5sum="fb2c9d24ab2eb07a43cf68e8b5295814" name="src/libmongoc/src/mongoc/mongoc-read-prefs-private.h" role="src" />
<file md5sum="6e650d11a098a9bcd98614c50d17de20" name="src/libmongoc/src/mongoc/mongoc-read-prefs.c" role="src" />
<file md5sum="8fbd2617e9e59de4ab6cb53b3dac3832" name="src/libmongoc/src/mongoc/mongoc-read-prefs.h" role="src" />
<file md5sum="87c50be4e602261c55c9ef8c412bd3c4" name="src/libmongoc/src/mongoc/mongoc-rpc-private.h" role="src" />
<file md5sum="e5faa926b7342f8e16d07e4654efeadf" name="src/libmongoc/src/mongoc/mongoc-rpc.c" role="src" />
<file md5sum="f176910469cd2fb429ae480e19421bdb" name="src/libmongoc/src/mongoc/mongoc-sasl-private.h" role="src" />
<file md5sum="5836532c914c2d2bca30edcc85da5490" name="src/libmongoc/src/mongoc/mongoc-sasl.c" role="src" />
<file md5sum="3da5e545685332afb979bb69cc3de12c" name="src/libmongoc/src/mongoc/mongoc-scram-private.h" role="src" />
<file md5sum="38761732c7acd966f03bfd1c70c1c22a" name="src/libmongoc/src/mongoc/mongoc-scram.c" role="src" />
<file md5sum="71f092f0a49e4aae6cd44c2e320bd036" name="src/libmongoc/src/mongoc/mongoc-secure-channel-private.h" role="src" />
<file md5sum="fbfe9202223aa74abaeb2918966de14b" name="src/libmongoc/src/mongoc/mongoc-secure-channel.c" role="src" />
<file md5sum="8e05346fd79064cd0d27bb2148bdd88f" name="src/libmongoc/src/mongoc/mongoc-secure-transport-private.h" role="src" />
<file md5sum="261c83c1c0b960b747cf81d97a353473" name="src/libmongoc/src/mongoc/mongoc-secure-transport.c" role="src" />
<file md5sum="20099618f34ab2a4b4e6f3a8fac54e7a" name="src/libmongoc/src/mongoc/mongoc-server-description-private.h" role="src" />
<file md5sum="f394c6ab11b2f42a3451d4bdd82bb806" name="src/libmongoc/src/mongoc/mongoc-server-description.c" role="src" />
<file md5sum="8936d92cd7ed5269ff3805c968345595" name="src/libmongoc/src/mongoc/mongoc-server-description.h" role="src" />
<file md5sum="3427b6366f79fd488100a38080c248b3" name="src/libmongoc/src/mongoc/mongoc-server-stream-private.h" role="src" />
<file md5sum="ca1028b581086f6ecfe8f7d17c0d99de" name="src/libmongoc/src/mongoc/mongoc-server-stream.c" role="src" />
<file md5sum="0f6adaf9b219f92bc3a09b78dd7fe1c4" name="src/libmongoc/src/mongoc/mongoc-set-private.h" role="src" />
<file md5sum="3619b39acef7d8142724c66d27e587ef" name="src/libmongoc/src/mongoc/mongoc-set.c" role="src" />
<file md5sum="83783d033809df281750fb753a46a19c" name="src/libmongoc/src/mongoc/mongoc-socket-private.h" role="src" />
<file md5sum="c8c3a0a4b3f527307f51789b1ae54930" name="src/libmongoc/src/mongoc/mongoc-socket.c" role="src" />
<file md5sum="c77bb3eae9c3c2d0894c47313deb614a" name="src/libmongoc/src/mongoc/mongoc-socket.h" role="src" />
<file md5sum="7d6768da46dbdaaef7af254d0ad1f985" name="src/libmongoc/src/mongoc/mongoc-ssl-private.h" role="src" />
<file md5sum="24cef4c93c99bfd97a6bb8180ab2a487" name="src/libmongoc/src/mongoc/mongoc-ssl.c" role="src" />
<file md5sum="8e76343ddc7a19cffaf09f7dbf3a5ccf" name="src/libmongoc/src/mongoc/mongoc-ssl.h" role="src" />
<file md5sum="085fdcaa41a0a564e5af6a89ae48da8e" name="src/libmongoc/src/mongoc/mongoc-stream-buffered.c" role="src" />
<file md5sum="8d602dda16b9c6bd1a02be9f774bb435" name="src/libmongoc/src/mongoc/mongoc-stream-buffered.h" role="src" />
<file md5sum="80f8140eebea9142484c86185d37bca9" name="src/libmongoc/src/mongoc/mongoc-stream-file.c" role="src" />
<file md5sum="c38bf3a4be19ebb410f7d4ea8f2c4c53" name="src/libmongoc/src/mongoc/mongoc-stream-file.h" role="src" />
<file md5sum="1c8ed484da4393ad70b72aa10f5024ab" name="src/libmongoc/src/mongoc/mongoc-stream-gridfs.c" role="src" />
<file md5sum="a69948b7569311d471fe59ac388d515e" name="src/libmongoc/src/mongoc/mongoc-stream-gridfs.h" role="src" />
<file md5sum="926738c7ff4ace00bd81298b17b711a0" name="src/libmongoc/src/mongoc/mongoc-stream-private.h" role="src" />
<file md5sum="7ba65eb5a4f00e56ff244a1193ee0b72" name="src/libmongoc/src/mongoc/mongoc-stream-socket.c" role="src" />
<file md5sum="4aed0f25e2bae597f3146bda017cbd5b" name="src/libmongoc/src/mongoc/mongoc-stream-socket.h" role="src" />
<file md5sum="ea30cbec0bd8aeb1c407b726dda38d89" name="src/libmongoc/src/mongoc/mongoc-stream-tls-libressl-private.h" role="src" />
<file md5sum="cd279517e75fc48c2fbac7d18e0f7586" name="src/libmongoc/src/mongoc/mongoc-stream-tls-libressl.c" role="src" />
<file md5sum="a9fd9c26ddd05a7b2b6c43d216ea4125" name="src/libmongoc/src/mongoc/mongoc-stream-tls-libressl.h" role="src" />
<file md5sum="2478098192a13c2ea02af155ed6e1dc3" name="src/libmongoc/src/mongoc/mongoc-stream-tls-openssl-bio-private.h" role="src" />
<file md5sum="56e1cb6a9e91de4f74858b6480a14f26" name="src/libmongoc/src/mongoc/mongoc-stream-tls-openssl-bio.c" role="src" />
<file md5sum="3df4aab4defbcd5c653c32568a4900b6" name="src/libmongoc/src/mongoc/mongoc-stream-tls-openssl-private.h" role="src" />
<file md5sum="34cb27d3c7a87c0c761a8673076126e4" name="src/libmongoc/src/mongoc/mongoc-stream-tls-openssl.c" role="src" />
<file md5sum="f0301339d8cf346a2c52255cab86ebea" name="src/libmongoc/src/mongoc/mongoc-stream-tls-openssl.h" role="src" />
<file md5sum="d1a7a583a2a25e67dd0010427b9c44f5" name="src/libmongoc/src/mongoc/mongoc-stream-tls-private.h" role="src" />
<file md5sum="4b7015782edbcd4993644c9e4f9cb9b0" name="src/libmongoc/src/mongoc/mongoc-stream-tls-secure-channel-private.h" role="src" />
<file md5sum="a5811778b255c0cc0eff00c25f2a84df" name="src/libmongoc/src/mongoc/mongoc-stream-tls-secure-channel.c" role="src" />
<file md5sum="252f9046d679a4a778be70b69a2a2108" name="src/libmongoc/src/mongoc/mongoc-stream-tls-secure-channel.h" role="src" />
<file md5sum="b1d8acdd7a08545e8f5826047009a66d" name="src/libmongoc/src/mongoc/mongoc-stream-tls-secure-transport-private.h" role="src" />
<file md5sum="565a0b79e1f326834befd6af67f3708e" name="src/libmongoc/src/mongoc/mongoc-stream-tls-secure-transport.c" role="src" />
<file md5sum="b78f3c34df84101c8cd93cf3e2927820" name="src/libmongoc/src/mongoc/mongoc-stream-tls-secure-transport.h" role="src" />
<file md5sum="9504a0efc2a1fb519f792f0897019335" name="src/libmongoc/src/mongoc/mongoc-stream-tls.c" role="src" />
<file md5sum="2587184c3af3c590670487df1bdecbd6" name="src/libmongoc/src/mongoc/mongoc-stream-tls.h" role="src" />
<file md5sum="93efba9b58e145f74bac120b7f2c3062" name="src/libmongoc/src/mongoc/mongoc-stream.c" role="src" />
<file md5sum="229563bf6e138f72d1e37050d52dac1d" name="src/libmongoc/src/mongoc/mongoc-stream.h" role="src" />
<file md5sum="fdc4f3f3e45081c2129ea955b407a157" name="src/libmongoc/src/mongoc/mongoc-thread-private.h" role="src" />
<file md5sum="300072d1463efd55a01116410c42d0af" name="src/libmongoc/src/mongoc/mongoc-topology-description-apm-private.h" role="src" />
<file md5sum="0c202faa89643a2f606ac603ec881ca8" name="src/libmongoc/src/mongoc/mongoc-topology-description-apm.c" role="src" />
<file md5sum="90eb65d651e8a5b9b7ce1e1ed3d2e548" name="src/libmongoc/src/mongoc/mongoc-topology-description-private.h" role="src" />
<file md5sum="7381e20864ec60096c66a29a696dce9e" name="src/libmongoc/src/mongoc/mongoc-topology-description.c" role="src" />
<file md5sum="e1cee6ddceeb715f214d946e082164f3" name="src/libmongoc/src/mongoc/mongoc-topology-description.h" role="src" />
- <file md5sum="74da5dce7da9ede81951bb931b3581bf" name="src/libmongoc/src/mongoc/mongoc-topology-private.h" role="src" />
+ <file md5sum="12cd34a3870827cdbee925318d4ce295" name="src/libmongoc/src/mongoc/mongoc-topology-private.h" role="src" />
<file md5sum="fc8061084508bad1b6970a070a87ee43" name="src/libmongoc/src/mongoc/mongoc-topology-scanner-private.h" role="src" />
<file md5sum="94cc722bc3839a6c5a800b67a2647e3b" name="src/libmongoc/src/mongoc/mongoc-topology-scanner.c" role="src" />
- <file md5sum="54b178adfe38970d6ef5e348576b8d7b" name="src/libmongoc/src/mongoc/mongoc-topology.c" role="src" />
+ <file md5sum="7c6d27d8a1b7768f75e47deeb1ce7bd6" name="src/libmongoc/src/mongoc/mongoc-topology.c" role="src" />
<file md5sum="f8fe41c378f1b6a9c22e3a0c9195909a" name="src/libmongoc/src/mongoc/mongoc-trace-private.h" role="src" />
- <file md5sum="afab4d17751dc2f765a68a9072af42d1" name="src/libmongoc/src/mongoc/mongoc-uri-private.h" role="src" />
- <file md5sum="ca0c01f80171fb1ec053debaf68b895a" name="src/libmongoc/src/mongoc/mongoc-uri.c" role="src" />
+ <file md5sum="496fec8dce7e21ea1385ad8edd9d0a0b" name="src/libmongoc/src/mongoc/mongoc-uri-private.h" role="src" />
+ <file md5sum="b3123d8c1807f8ba3eface4b1863c366" name="src/libmongoc/src/mongoc/mongoc-uri.c" role="src" />
<file md5sum="e1da8153d86816dcc67b4c9ec717c1a8" name="src/libmongoc/src/mongoc/mongoc-uri.h" role="src" />
<file md5sum="b4afcd0f02c5a33facb7ae16d974cb43" name="src/libmongoc/src/mongoc/mongoc-util-private.h" role="src" />
<file md5sum="5de983ab6c54d112986bbb74310fd2eb" name="src/libmongoc/src/mongoc/mongoc-util.c" role="src" />
<file md5sum="e699d508bdb2d3f5220bbc5bf413bae1" name="src/libmongoc/src/mongoc/mongoc-version-functions.c" role="src" />
<file md5sum="5d956716b694ce5904e0579d3ddc6853" name="src/libmongoc/src/mongoc/mongoc-version-functions.h" role="src" />
- <file md5sum="7612e5a24601ccdb5b41ddec4ada6896" name="src/libmongoc/src/mongoc/mongoc-version.h" role="src" />
+ <file md5sum="b2724d87711c6b080c0557948fcd8343" name="src/libmongoc/src/mongoc/mongoc-version.h" role="src" />
<file md5sum="2f63b4b1f86910aab6a6e7423af3f7a8" name="src/libmongoc/src/mongoc/mongoc-version.h.in" role="src" />
<file md5sum="c9284d7eff1dc27e4ff12f1bb08ca41c" name="src/libmongoc/src/mongoc/mongoc-write-command-private.h" role="src" />
<file md5sum="19512859e18a1dcbd60cd7e3ef444114" name="src/libmongoc/src/mongoc/mongoc-write-command.c" role="src" />
<file md5sum="9952c2b94437b195a5492e62541f6b80" name="src/libmongoc/src/mongoc/mongoc-write-concern-private.h" role="src" />
<file md5sum="57d761c14450d05a79c2c8c2792d74a3" name="src/libmongoc/src/mongoc/mongoc-write-concern.c" role="src" />
<file md5sum="9760b823d8859ad8cc9ac58ed2ac2604" name="src/libmongoc/src/mongoc/mongoc-write-concern.h" role="src" />
<file md5sum="203393fddc4207289be0533ab037e906" name="src/libmongoc/src/mongoc/mongoc.h" role="src" />
<file md5sum="ed1890accd7d9a1426fdac121ed42ad4" name="src/libmongoc/src/mongoc/op-delete.def" role="src" />
<file md5sum="9af88adf2ef432761bbe81db2f9bdce7" name="src/libmongoc/src/mongoc/op-get-more.def" role="src" />
<file md5sum="242fff22640f143ae262e363e8552a7e" name="src/libmongoc/src/mongoc/op-header.def" role="src" />
<file md5sum="2efe34631dd0d540d0f1d2fdb2d57813" name="src/libmongoc/src/mongoc/op-insert.def" role="src" />
<file md5sum="79ab986cb49a47e7c9bccdc4005a9697" name="src/libmongoc/src/mongoc/op-kill-cursors.def" role="src" />
<file md5sum="25dd34248b0000465c7e2ac769fc509a" name="src/libmongoc/src/mongoc/op-msg.def" role="src" />
<file md5sum="a986d22cb495d652dc6059d722bb3266" name="src/libmongoc/src/mongoc/op-query.def" role="src" />
<file md5sum="f82bc931404ce00b318675126572d667" name="src/libmongoc/src/mongoc/op-reply-header.def" role="src" />
<file md5sum="dd22bb15cb70d35fe25192f0f304871b" name="src/libmongoc/src/mongoc/op-reply.def" role="src" />
<file md5sum="03c6179a4fe8b51c606b03a763529d55" name="src/libmongoc/src/mongoc/op-update.def" role="src" />
<file md5sum="94cc18fabf34abc9acbff2ec6c5293f6" name="src/libmongoc/src/mongoc/utlist.h" role="src" />
- <file md5sum="3c1de4a43daa0fe17b5080559cff640e" name="src/libmongoc/VERSION_CURRENT" role="src" />
- <file md5sum="3c1de4a43daa0fe17b5080559cff640e" name="src/libmongoc/VERSION_RELEASED" role="src" />
- <file md5sum="878b2a5135d91fb93fa624af126a8a30" name="src/bson.c" role="src" />
+ <file md5sum="51a3950c50505d7f5d8217ed8913f870" name="src/libmongoc/VERSION_CURRENT" role="src" />
+ <file md5sum="51a3950c50505d7f5d8217ed8913f870" name="src/libmongoc/VERSION_RELEASED" role="src" />
+ <file md5sum="f3afa3f0c48c3fe7bfcb6dfdccb7e862" name="src/bson.c" role="src" />
<file md5sum="6353eaae171cb9a5c8a02f2ae08c879b" name="tests/bson/bson-binary-001.phpt" role="test" />
<file md5sum="c0bcda775b56796c4a958cd4cd74d920" name="tests/bson/bson-binary-compare-001.phpt" role="test" />
<file md5sum="0a87dad6d922760e623021996727d79c" name="tests/bson/bson-binary-compare-002.phpt" role="test" />
<file md5sum="a89324b72c9dbfffca5008d9563565c8" name="tests/bson/bson-binary-jsonserialize-001.phpt" role="test" />
<file md5sum="ba515183a779c4ce6740ba3fb1e46f77" name="tests/bson/bson-binary-jsonserialize-002.phpt" role="test" />
<file md5sum="94deed355325f66c567309e6074cfe7a" name="tests/bson/bson-binary-serialization-001.phpt" role="test" />
<file md5sum="f487c59192b7df686475bfe0be84c3e6" name="tests/bson/bson-binary-serialization_error-001.phpt" role="test" />
<file md5sum="2ebc7a07dd945df1922ca274d04478a8" name="tests/bson/bson-binary-serialization_error-002.phpt" role="test" />
<file md5sum="4a4275ac852b7457302ddcb2fdce7544" name="tests/bson/bson-binary-set_state-001.phpt" role="test" />
<file md5sum="bfee0375bac0c0e1a26a34dda9814eb0" name="tests/bson/bson-binary-set_state_error-001.phpt" role="test" />
<file md5sum="b88eb23a9a107c5300863e1dc5a780b0" name="tests/bson/bson-binary-set_state_error-002.phpt" role="test" />
<file md5sum="6d2a98d4a0877eaa48cf6715e9eaf845" name="tests/bson/bson-binary-tostring-001.phpt" role="test" />
<file md5sum="987e2a7b238833b93ddf1b3b0d879fd8" name="tests/bson/bson-binary_error-001.phpt" role="test" />
<file md5sum="a9d13886ed7bad49396fe58fb69728dc" name="tests/bson/bson-binary_error-002.phpt" role="test" />
<file md5sum="6f080af40f1a71d0f9dc97118cc65956" name="tests/bson/bson-binary_error-003.phpt" role="test" />
<file md5sum="1b07dc40c0327eaa948a01415e80156e" name="tests/bson/bson-decimal128-001.phpt" role="test" />
<file md5sum="aa1a54f32962e51878159b0b3f25a83a" name="tests/bson/bson-decimal128-002.phpt" role="test" />
<file md5sum="b17b174c54b38e37a407f8fb35aff65e" name="tests/bson/bson-decimal128-003.phpt" role="test" />
<file md5sum="b6d96feed66dfb73e8220e48e58337a1" name="tests/bson/bson-decimal128-004.phpt" role="test" />
<file md5sum="b82e77c47a326ab042f1e35ec4725e51" name="tests/bson/bson-decimal128-jsonserialize-001.phpt" role="test" />
<file md5sum="afbe9023c707b866dcc078d3b126ba0a" name="tests/bson/bson-decimal128-jsonserialize-002.phpt" role="test" />
<file md5sum="4c603508bb6b9838066286014832c97f" name="tests/bson/bson-decimal128-serialization-001.phpt" role="test" />
<file md5sum="18bcb6a21e50d2bbdfc8f05dd81ea095" name="tests/bson/bson-decimal128-serialization_error-001.phpt" role="test" />
<file md5sum="105c568368afe25b76a7f4d2cbc8ab32" name="tests/bson/bson-decimal128-serialization_error-002.phpt" role="test" />
<file md5sum="3a8bcad13be933556fd0967a643293ac" name="tests/bson/bson-decimal128-set_state-001.phpt" role="test" />
<file md5sum="db934fbaaeca32c3461ca5a0e3924b3c" name="tests/bson/bson-decimal128-set_state_error-001.phpt" role="test" />
<file md5sum="cc39b9bf030108cc2e36cec032c3e021" name="tests/bson/bson-decimal128-set_state_error-002.phpt" role="test" />
<file md5sum="e938c12d1f2fcf8db10aa35a1835d938" name="tests/bson/bson-decimal128_error-001.phpt" role="test" />
<file md5sum="c551b87ae2e2987ba8e5518c73aed1f6" name="tests/bson/bson-decimal128_error-002.phpt" role="test" />
- <file md5sum="dfd51ec3a9175dbc114516174d56f999" name="tests/bson/bson-decode-001.phpt" role="test" />
+ <file md5sum="d9e66d3693c33a70a8f302b285d6a017" name="tests/bson/bson-decode-001.phpt" role="test" />
<file md5sum="72c9ae0b2a63b4734b4242634b26d838" name="tests/bson/bson-decode-002.phpt" role="test" />
- <file md5sum="d28cf3697b4c11c16aaff19cc8dd30fa" name="tests/bson/bson-encode-001.phpt" role="test" />
+ <file md5sum="c537992ae377109995cc650def0fbe31" name="tests/bson/bson-encode-001.phpt" role="test" />
<file md5sum="7d63ae8f6ffe1c3723de519a28c518a8" name="tests/bson/bson-encode-002.phpt" role="test" />
<file md5sum="29348a9f31df1efbf7ebbce60934f443" name="tests/bson/bson-encode-003.phpt" role="test" />
<file md5sum="19012fed927912e4b9144a3fd4458c57" name="tests/bson/bson-encode-004.phpt" role="test" />
<file md5sum="9b2c1fb3ece5c67bf2593e78ebd4481d" name="tests/bson/bson-encode-005.phpt" role="test" />
<file md5sum="9f2c849e9e4d87c63fee4591fc4c3e3f" name="tests/bson/bson-fromJSON-001.phpt" role="test" />
<file md5sum="08a8c4233a4a4d3d5216bbc289189e79" name="tests/bson/bson-fromJSON-002.phpt" role="test" />
- <file md5sum="43cb661e51a31350bb562e0756925fc4" name="tests/bson/bson-fromJSON_error-001.phpt" role="test" />
+ <file md5sum="729e16c01e1318e6a3e74c1a28139e5e" name="tests/bson/bson-fromJSON_error-001.phpt" role="test" />
<file md5sum="d1be9224941f85b73491880c045f9c91" name="tests/bson/bson-fromPHP-001.phpt" role="test" />
<file md5sum="d06d3e149b4049b069ac97446292e54a" name="tests/bson/bson-fromPHP-002.phpt" role="test" />
<file md5sum="f63c536993d1f5c321194a1509a76b49" name="tests/bson/bson-fromPHP-003.phpt" role="test" />
<file md5sum="f90282eccdcec6a9e75c2bff3feefe52" name="tests/bson/bson-fromPHP-004.phpt" role="test" />
<file md5sum="cdee70ad41d06ebf5433f0c123d8b473" name="tests/bson/bson-fromPHP-005.phpt" role="test" />
<file md5sum="5c39bcee09ea347402f4487991e66eb2" name="tests/bson/bson-fromPHP-006.phpt" role="test" />
<file md5sum="b0eecb69117e5a61228f9779b400b3fe" name="tests/bson/bson-fromPHP_error-001.phpt" role="test" />
<file md5sum="e100a45e0dfc4a8efda78b72f6a2a9a4" name="tests/bson/bson-fromPHP_error-002.phpt" role="test" />
<file md5sum="d523ccc510646a112529afd40982a3f7" name="tests/bson/bson-fromPHP_error-003.phpt" role="test" />
- <file md5sum="9bd6b7e322f81c800abd6366d52e0cce" name="tests/bson/bson-generate-document-id.phpt" role="test" />
+ <file md5sum="6dffec094c838da3827dd199b7f3c844" name="tests/bson/bson-generate-document-id.phpt" role="test" />
<file md5sum="79fbd01e931e001c3738f67312083a88" name="tests/bson/bson-javascript-001.phpt" role="test" />
<file md5sum="10d535296d0c4ccefaf5b6f63198d8b7" name="tests/bson/bson-javascript-002.phpt" role="test" />
<file md5sum="b4918a171d542e0572cc9c76bdcd641c" name="tests/bson/bson-javascript-compare-001.phpt" role="test" />
<file md5sum="bf56d62d17206b8161535e357b300a0c" name="tests/bson/bson-javascript-compare-002.phpt" role="test" />
<file md5sum="3567bceb79c30dfd50838a0267a69c62" name="tests/bson/bson-javascript-getCode-001.phpt" role="test" />
<file md5sum="a4dd04e36142969b8f2cd1f855c6dd65" name="tests/bson/bson-javascript-getScope-001.phpt" role="test" />
<file md5sum="b56136e8638788b0e72210ae82293c4a" name="tests/bson/bson-javascript-jsonserialize-001.phpt" role="test" />
<file md5sum="08155bf6625a0317d0daebba81670fcc" name="tests/bson/bson-javascript-jsonserialize-002.phpt" role="test" />
- <file md5sum="cded1c2f5a177637a42216f0d5064f41" name="tests/bson/bson-javascript-jsonserialize-003.phpt" role="test" />
- <file md5sum="7d539fbdf45f6a3f3fd92a5b1e38e76e" name="tests/bson/bson-javascript-jsonserialize-004.phpt" role="test" />
+ <file md5sum="372c89c382a5712ffe91412b77ab3b1a" name="tests/bson/bson-javascript-jsonserialize-003.phpt" role="test" />
+ <file md5sum="316cc14c7c1a6df4ff0c4c50b3ce0023" name="tests/bson/bson-javascript-jsonserialize-004.phpt" role="test" />
<file md5sum="262b1747ea8f5f31b5410ce70152d917" name="tests/bson/bson-javascript-serialization-001.phpt" role="test" />
<file md5sum="3b734b3672e2fb7c22d631e30a668572" name="tests/bson/bson-javascript-serialization_error-001.phpt" role="test" />
<file md5sum="aad55f29fc2f8cb29fbe24be4f8e3f45" name="tests/bson/bson-javascript-serialization_error-002.phpt" role="test" />
<file md5sum="71105272974df96fcc305b2c19b3055f" name="tests/bson/bson-javascript-serialization_error-003.phpt" role="test" />
<file md5sum="083ea527f154bff2cb0af954007b31e4" name="tests/bson/bson-javascript-set_state-001.phpt" role="test" />
<file md5sum="b1ca12563c821779cb762995b0eb72c1" name="tests/bson/bson-javascript-set_state_error-001.phpt" role="test" />
<file md5sum="abb0c3c2cb58a5b2ee28849a5fdebcc8" name="tests/bson/bson-javascript-set_state_error-002.phpt" role="test" />
<file md5sum="23f1dcb1ec478e1ccad03999c2f7a023" name="tests/bson/bson-javascript-set_state_error-003.phpt" role="test" />
<file md5sum="e390000e3a7aba05c408d022ef9903d7" name="tests/bson/bson-javascript-tostring-001.phpt" role="test" />
<file md5sum="761570180559c8089add628f2d25cc8b" name="tests/bson/bson-javascript_error-001.phpt" role="test" />
<file md5sum="3c848a8651ccfeddeb8a6c2d60a986f3" name="tests/bson/bson-javascript_error-002.phpt" role="test" />
<file md5sum="02fba91408fc0f350a204bc8b1d3f04c" name="tests/bson/bson-javascript_error-003.phpt" role="test" />
<file md5sum="dde147455cd932bf6424aba82fe61718" name="tests/bson/bson-maxkey-001.phpt" role="test" />
<file md5sum="2bf1fbd91c808c2d90db9a92c3af9678" name="tests/bson/bson-maxkey-compare-001.phpt" role="test" />
<file md5sum="4314312c271b5c33f53a4d3887a683b0" name="tests/bson/bson-maxkey-jsonserialize-001.phpt" role="test" />
<file md5sum="a57e651d344bd32f6ac3f820a222bfa2" name="tests/bson/bson-maxkey-jsonserialize-002.phpt" role="test" />
<file md5sum="6e74674e084b8fb81f31e9863a87079d" name="tests/bson/bson-maxkey-serialization-001.phpt" role="test" />
<file md5sum="ea86c16672ce4ca92a750eb7de2837e5" name="tests/bson/bson-maxkey-set_state-001.phpt" role="test" />
<file md5sum="101130436ace2c1418413a1cdd3cc5a5" name="tests/bson/bson-maxkey_error-001.phpt" role="test" />
<file md5sum="63f2fe0e4f73d250deb31ef4861ce5bf" name="tests/bson/bson-minkey-001.phpt" role="test" />
<file md5sum="cab9d17b350f7ff0fb3930aa298f626a" name="tests/bson/bson-minkey-compare-001.phpt" role="test" />
<file md5sum="6b2c6c29ac2dbc4f91392779b99d562c" name="tests/bson/bson-minkey-jsonserialize-001.phpt" role="test" />
<file md5sum="ee6731f161e2de2523764a03c4693783" name="tests/bson/bson-minkey-jsonserialize-002.phpt" role="test" />
<file md5sum="37fe1c3d8e22afe72cdbb2b6c445eba4" name="tests/bson/bson-minkey-serialization-001.phpt" role="test" />
<file md5sum="74201982485a724a0822cc2f2093cb75" name="tests/bson/bson-minkey-set_state-001.phpt" role="test" />
<file md5sum="910f6541ade6c03374170c097907a8b2" name="tests/bson/bson-minkey_error-001.phpt" role="test" />
<file md5sum="e05511f6beae33dc190337799253a21f" name="tests/bson/bson-objectid-001.phpt" role="test" />
<file md5sum="64af3490dcf00f58afa82dab8cc1cc30" name="tests/bson/bson-objectid-002.phpt" role="test" />
<file md5sum="0d685f0d13a0a272c06ca87243a3210e" name="tests/bson/bson-objectid-003.phpt" role="test" />
<file md5sum="50b30efcd7e631ed86a1b5dc59530b9d" name="tests/bson/bson-objectid-004.phpt" role="test" />
<file md5sum="34775b2ca900140f2a6cd930821d8320" name="tests/bson/bson-objectid-compare-001.phpt" role="test" />
<file md5sum="07b78725a1cc01cfc7bf8a52f655d29a" name="tests/bson/bson-objectid-compare-002.phpt" role="test" />
<file md5sum="7384bff757b6489b84e331e5849277bf" name="tests/bson/bson-objectid-getTimestamp-001.phpt" role="test" />
<file md5sum="08087ee9dcb917059b359552a34de4e7" name="tests/bson/bson-objectid-jsonserialize-001.phpt" role="test" />
<file md5sum="c3b6fcfd69df957a8da620287dc359dd" name="tests/bson/bson-objectid-jsonserialize-002.phpt" role="test" />
<file md5sum="9ea8fa379263fdcd549e564f801014c3" name="tests/bson/bson-objectid-serialization-001.phpt" role="test" />
<file md5sum="971319b6aa9f8ee54ad8132e95fc8808" name="tests/bson/bson-objectid-serialization_error-001.phpt" role="test" />
<file md5sum="2c848f4a091368f83cbdb3f302d3a3f6" name="tests/bson/bson-objectid-serialization_error-002.phpt" role="test" />
<file md5sum="235e171e10f2e6350fea2d50f9a962f2" name="tests/bson/bson-objectid-set_state-001.phpt" role="test" />
<file md5sum="32daf05f6af1ef635dfeeaaf777cc74e" name="tests/bson/bson-objectid-set_state_error-001.phpt" role="test" />
<file md5sum="debccfc66cee957a4a432ebfbea268fc" name="tests/bson/bson-objectid-set_state_error-002.phpt" role="test" />
<file md5sum="fcbfb4e68b4b75333dfab1dd40fec51f" name="tests/bson/bson-objectid_error-001.phpt" role="test" />
<file md5sum="d20fc18fea587f7cf549fff4ddafe04c" name="tests/bson/bson-objectid_error-002.phpt" role="test" />
<file md5sum="b608cd4596a70f8be012d692d9affee2" name="tests/bson/bson-objectid_error-003.phpt" role="test" />
<file md5sum="cce7349f4677c853d066fca74eacc26d" name="tests/bson/bson-regex-001.phpt" role="test" />
<file md5sum="c6d502bd80b12b49bb86ca15cd80cb5d" name="tests/bson/bson-regex-002.phpt" role="test" />
<file md5sum="f88490a6be39ed8be80c80a65150a0cf" name="tests/bson/bson-regex-003.phpt" role="test" />
<file md5sum="511347e513bdf3bc2ae37aa34b146c01" name="tests/bson/bson-regex-004.phpt" role="test" />
<file md5sum="c5aeef20912e9660c5b9b9916e6061ed" name="tests/bson/bson-regex-005.phpt" role="test" />
<file md5sum="56bfc8e30f3eab954310dd0d02b9379b" name="tests/bson/bson-regex-compare-001.phpt" role="test" />
<file md5sum="fa19dcc92485cd60cb3b11563b1ee196" name="tests/bson/bson-regex-compare-002.phpt" role="test" />
<file md5sum="6fa2a0677b01b0c63ac9e75d7189de73" name="tests/bson/bson-regex-jsonserialize-001.phpt" role="test" />
<file md5sum="b74df13ee5230ede71e1c6dab4439d2f" name="tests/bson/bson-regex-jsonserialize-002.phpt" role="test" />
<file md5sum="f2443282d9f3e636c68051904febb3e7" name="tests/bson/bson-regex-jsonserialize-003.phpt" role="test" />
<file md5sum="3e8cea9be0207736f5f1a57b7f3f985a" name="tests/bson/bson-regex-jsonserialize-004.phpt" role="test" />
<file md5sum="66647e53b95c6eafb52d98e2d9196c7f" name="tests/bson/bson-regex-serialization-001.phpt" role="test" />
<file md5sum="f5eca804b8710b015d2f90c8d8c71368" name="tests/bson/bson-regex-serialization-002.phpt" role="test" />
<file md5sum="e42ec5b985814f1dd3c3ce3acbcbc00f" name="tests/bson/bson-regex-serialization-003.phpt" role="test" />
<file md5sum="07c7662c6b8dcc5723693077eae6c9fd" name="tests/bson/bson-regex-serialization_error-001.phpt" role="test" />
<file md5sum="733b4696d0d9e1b0da751510a761acc5" name="tests/bson/bson-regex-serialization_error-002.phpt" role="test" />
<file md5sum="1761af9218ff1583f51133d4f0cdcb19" name="tests/bson/bson-regex-set_state-001.phpt" role="test" />
<file md5sum="ab56bd68ecf9ea5717facbaa141db1b5" name="tests/bson/bson-regex-set_state-002.phpt" role="test" />
<file md5sum="22816419e87ffa591bfb03a921ea750c" name="tests/bson/bson-regex-set_state_error-001.phpt" role="test" />
<file md5sum="377e4b051a65dd08a16966cbd92f413c" name="tests/bson/bson-regex-set_state_error-002.phpt" role="test" />
<file md5sum="9324eaf63f62194dd69656d40bcb6d4d" name="tests/bson/bson-regex_error-001.phpt" role="test" />
<file md5sum="3422fde80d9b7e49dc5d430a10fa9862" name="tests/bson/bson-regex_error-002.phpt" role="test" />
<file md5sum="cdfaa1039a4cd0da222c476c1b6760ac" name="tests/bson/bson-regex_error-003.phpt" role="test" />
<file md5sum="d69349bcb7ea29d6985be366437e013c" name="tests/bson/bson-timestamp-001.phpt" role="test" />
<file md5sum="94cee14f3d06ab8085f06c241a976589" name="tests/bson/bson-timestamp-002.phpt" role="test" />
<file md5sum="a0763909d65abab501df3471d9cf0009" name="tests/bson/bson-timestamp-003.phpt" role="test" />
<file md5sum="3932a3692389d969ee55de22034324b1" name="tests/bson/bson-timestamp-004.phpt" role="test" />
<file md5sum="db926cded84f832c39e527d5fcdadcbb" name="tests/bson/bson-timestamp-005.phpt" role="test" />
<file md5sum="c3521c6cbf542f9d719c8b179ac8d2c8" name="tests/bson/bson-timestamp-compare-001.phpt" role="test" />
<file md5sum="4ff5e264bb118d99302fb918e2b54ea4" name="tests/bson/bson-timestamp-jsonserialize-001.phpt" role="test" />
<file md5sum="b3c0547739e7996b33b49eddf15ca4bf" name="tests/bson/bson-timestamp-jsonserialize-002.phpt" role="test" />
<file md5sum="5bfc985572b0eae61c2e3e7afe46588b" name="tests/bson/bson-timestamp-serialization-001.phpt" role="test" />
<file md5sum="89ee88f82bd68012d2ab0d7cec057add" name="tests/bson/bson-timestamp-serialization-002.phpt" role="test" />
<file md5sum="29db1408dde1310afa8066e7233c3db6" name="tests/bson/bson-timestamp-serialization_error-001.phpt" role="test" />
<file md5sum="546931ee801ed3c60e649573cddf813f" name="tests/bson/bson-timestamp-serialization_error-002.phpt" role="test" />
<file md5sum="3623cb6f0ef62c302ced4b3acf1f1b3f" name="tests/bson/bson-timestamp-serialization_error-003.phpt" role="test" />
<file md5sum="f7d7dd2398c27c27def6cb8dab685315" name="tests/bson/bson-timestamp-serialization_error-004.phpt" role="test" />
<file md5sum="7a13dad169f79e7cda4ab3c7a8e2dc1f" name="tests/bson/bson-timestamp-set_state-001.phpt" role="test" />
<file md5sum="2137458362aca8c1a3d8f6224c438d9e" name="tests/bson/bson-timestamp-set_state-002.phpt" role="test" />
<file md5sum="effc86aba9ebac7be6f37ace2f24fc66" name="tests/bson/bson-timestamp-set_state_error-001.phpt" role="test" />
<file md5sum="4bd04c958a1ed842374aec323736bb00" name="tests/bson/bson-timestamp-set_state_error-002.phpt" role="test" />
<file md5sum="9a74bed31b0456757323dd297e0cf7d6" name="tests/bson/bson-timestamp-set_state_error-003.phpt" role="test" />
<file md5sum="e8957247a4043fc91f223da4ed9ec84e" name="tests/bson/bson-timestamp-set_state_error-004.phpt" role="test" />
<file md5sum="4bb0b3f0ca5e48b4971f7e02a318260e" name="tests/bson/bson-timestamp_error-001.phpt" role="test" />
<file md5sum="82668bc9b4f77d46a5e32b9117fb355e" name="tests/bson/bson-timestamp_error-002.phpt" role="test" />
<file md5sum="9a0deb7c8c173de898ebee345d7b67f1" name="tests/bson/bson-timestamp_error-003.phpt" role="test" />
<file md5sum="490199683c8657f10b662d5987abf546" name="tests/bson/bson-timestamp_error-004.phpt" role="test" />
<file md5sum="e10ea28f50dcdf86978919777ed5c74e" name="tests/bson/bson-timestamp_error-005.phpt" role="test" />
<file md5sum="7bec85a32de6b6437d0d5aa0deed8e9e" name="tests/bson/bson-timestamp_error-006.phpt" role="test" />
<file md5sum="15601e2ff3cbfe1bde4e52721b8dbb26" name="tests/bson/bson-toJSON-001.phpt" role="test" />
<file md5sum="c4a10257bddb9aab679d4184d699b86b" name="tests/bson/bson-toJSON-002.phpt" role="test" />
<file md5sum="8e55b98c744f775d8b392bf52212c3d5" name="tests/bson/bson-toJSON_error-001.phpt" role="test" />
<file md5sum="0f0509269783ea5b1d879ec83d348d9d" name="tests/bson/bson-toJSON_error-002.phpt" role="test" />
<file md5sum="3ba2dc924ffb36bef6866daf2fc88a69" name="tests/bson/bson-toJSON_error-003.phpt" role="test" />
<file md5sum="852eed0a106c82c454a8b567e01018bc" name="tests/bson/bson-toPHP-001.phpt" role="test" />
<file md5sum="da19822beca89a36c70c103bc88a8aaa" name="tests/bson/bson-toPHP-002.phpt" role="test" />
<file md5sum="5ca8927796e91b33fd96e3799ddd5269" name="tests/bson/bson-toPHP-003.phpt" role="test" />
<file md5sum="eb9bd2bbfaafa4151e02148e1348e264" name="tests/bson/bson-toPHP-004.phpt" role="test" />
<file md5sum="ec5d6bcf2358789dceba452190d4d6fd" name="tests/bson/bson-toPHP_error-001.phpt" role="test" />
<file md5sum="1f4bc38f615c85a5a0ac8dce9c0910e1" name="tests/bson/bson-toPHP_error-002.phpt" role="test" />
<file md5sum="e4204cc33475f1a76d9670b9de1f2d50" name="tests/bson/bson-toPHP_error-003.phpt" role="test" />
<file md5sum="80d461b9ff6c1b4f0a11373b46c6d4a1" name="tests/bson/bson-toPHP_error-004.phpt" role="test" />
<file md5sum="98f5ce0002f56d572e174a6e104f5f24" name="tests/bson/bson-unknown-001.phpt" role="test" />
- <file md5sum="617d694236d9a27353301c190322e83d" name="tests/bson/bson-utcdatetime-001.phpt" role="test" />
+ <file md5sum="69af476f25550c6145379b2c8d04e5a4" name="tests/bson/bson-utcdatetime-001.phpt" role="test" />
<file md5sum="de22f1e3d63048ab3db3b3514ce45bf2" name="tests/bson/bson-utcdatetime-002.phpt" role="test" />
<file md5sum="cb6b0009b8dfc770c489cd76f168f875" name="tests/bson/bson-utcdatetime-003.phpt" role="test" />
<file md5sum="de4188f960c7fd6debed280d2ce4da02" name="tests/bson/bson-utcdatetime-004.phpt" role="test" />
<file md5sum="ebcbd881098aeef861090012f341282d" name="tests/bson/bson-utcdatetime-005.phpt" role="test" />
<file md5sum="23c9998df5fe51d519abe50c27c99b32" name="tests/bson/bson-utcdatetime-006.phpt" role="test" />
<file md5sum="322715ac6f412974a9dacb1dc7a1ebc9" name="tests/bson/bson-utcdatetime-007.phpt" role="test" />
<file md5sum="b5a1e792ed87b977fa21874a12594c2c" name="tests/bson/bson-utcdatetime-compare-001.phpt" role="test" />
<file md5sum="85034e1045eb4632d9625d8c40e3b7ff" name="tests/bson/bson-utcdatetime-int-size-001.phpt" role="test" />
<file md5sum="8fbbdc845aa7cab18a7f98661c4d828d" name="tests/bson/bson-utcdatetime-int-size-002.phpt" role="test" />
<file md5sum="a93b633b97ec16f0b7707205f4709d12" name="tests/bson/bson-utcdatetime-jsonserialize-001.phpt" role="test" />
<file md5sum="1ac1ca2d4db3d5f77ccc59a3a48076c9" name="tests/bson/bson-utcdatetime-jsonserialize-002.phpt" role="test" />
<file md5sum="2bc0c3ddf3167bc788ced0582a2cd157" name="tests/bson/bson-utcdatetime-serialization-001.phpt" role="test" />
<file md5sum="3a575abb63e282591e1f150ca5ebb61a" name="tests/bson/bson-utcdatetime-serialization-002.phpt" role="test" />
<file md5sum="ac49747cfa5295c81d6e0271f827d59c" name="tests/bson/bson-utcdatetime-serialization_error-001.phpt" role="test" />
<file md5sum="a90aec321df162e83202ebabbc4248f1" name="tests/bson/bson-utcdatetime-serialization_error-002.phpt" role="test" />
<file md5sum="5f4ac622d87e508604308b21ae43f835" name="tests/bson/bson-utcdatetime-set_state-001.phpt" role="test" />
<file md5sum="cdbb4d6a6cd72816568163b8f54a0b9f" name="tests/bson/bson-utcdatetime-set_state-002.phpt" role="test" />
<file md5sum="8292f7be7a23f1afe04101f2e57f95b6" name="tests/bson/bson-utcdatetime-set_state_error-001.phpt" role="test" />
<file md5sum="d18b948a39fdb4a68f97209c48b2a846" name="tests/bson/bson-utcdatetime-set_state_error-002.phpt" role="test" />
<file md5sum="b9db4fcb289634af9d1f48a06e2b8aa0" name="tests/bson/bson-utcdatetime-todatetime-001.phpt" role="test" />
<file md5sum="8a6c7f3a7120a6135e4d8153da1fe675" name="tests/bson/bson-utcdatetime-todatetime-002.phpt" role="test" />
<file md5sum="8a10baf7be306b9d5a8e5af7dd747109" name="tests/bson/bson-utcdatetime-tostring-001.phpt" role="test" />
<file md5sum="01ff429024e70923880b7000d904f95f" name="tests/bson/bson-utcdatetime_error-001.phpt" role="test" />
<file md5sum="77b84eee9de2aa927194d1e7699de1a4" name="tests/bson/bson-utcdatetime_error-002.phpt" role="test" />
<file md5sum="b9c3f3108a0ecf7fe4f58f0c6cbc0d68" name="tests/bson/bson-utcdatetime_error-003.phpt" role="test" />
<file md5sum="78fcd6b89faca28382a3a0c90bfea9a8" name="tests/bson/bson-utcdatetime_error-004.phpt" role="test" />
<file md5sum="74978df74e164c08a7e98b2b00a850a6" name="tests/bson/bug0274.phpt" role="test" />
<file md5sum="7a78fa8d17a5f963f3eedd81a3d8e1e4" name="tests/bson/bug0313.phpt" role="test" />
<file md5sum="852106030dd7b947c767ad15ef30619c" name="tests/bson/bug0325.phpt" role="test" />
<file md5sum="5f838703ed88cbe9bfb826f6d606db67" name="tests/bson/bug0334-001.phpt" role="test" />
<file md5sum="decfd02f9f77ba7f2b7698bc2e9b1993" name="tests/bson/bug0334-002.phpt" role="test" />
<file md5sum="6e38b80bd375658cd5c9f2716c32f4c1" name="tests/bson/bug0341.phpt" role="test" />
<file md5sum="b04e028418b271bda22c519f98c61794" name="tests/bson/bug0347.phpt" role="test" />
<file md5sum="2888441736b763719632b0c3ab4d4288" name="tests/bson/bug0528.phpt" role="test" />
<file md5sum="79416a567108b8bcaf11f694a0a3f5b6" name="tests/bson/bug0531.phpt" role="test" />
<file md5sum="98df395abbaf09fe313a1ccc6d5ed0a2" name="tests/bson/bug0544.phpt" role="test" />
<file md5sum="7f0758a33e5dbd19f4f2ae41da989a2b" name="tests/bson/bug0592.phpt" role="test" />
<file md5sum="9ae13505ec2538389a8c79463ece8d1c" name="tests/bson/bug0623.phpt" role="test" />
<file md5sum="97ac756930ab930572a010dd30d574da" name="tests/bson/bug0631.phpt" role="test" />
<file md5sum="a43aaa4d0a4482370ff43c06aa082ccf" name="tests/bson/bug0672.phpt" role="test" />
- <file md5sum="0b1e4c8e1683f2303f5cd22dd1f4eaeb" name="tests/bson/typemap-001.phpt" role="test" />
- <file md5sum="ce3d7582821fe38452b684b7438ce67c" name="tests/bson/typemap-002.phpt" role="test" />
+ <file md5sum="e118c2e5c605dfa459730a08ac700f51" name="tests/bson/bug0894-001.phpt" role="test" />
+ <file md5sum="5008b223eb1545f5ae7d3d83d929f853" name="tests/bson/bug0923-001.phpt" role="test" />
+ <file md5sum="ec260ee6e229062d86c0bd19b0b142f4" name="tests/bson/bug0923-002.phpt" role="test" />
+ <file md5sum="cecd7f192c9b387ecbb3836d72a334a9" name="tests/bson/typemap-001.phpt" role="test" />
+ <file md5sum="e1df0f7a16afe08490ee5fdd30a81f03" name="tests/bson/typemap-002.phpt" role="test" />
<file md5sum="4b1d59d2f1959529457cc64e7688633b" name="tests/bulk/bug0667.phpt" role="test" />
<file md5sum="594f059e47dfc936e4b2ef8fcb666254" name="tests/bulk/bulkwrite-count-001.phpt" role="test" />
<file md5sum="bde05e9fc07536b691f4cdbde9a929f1" name="tests/bulk/bulkwrite-countable-001.phpt" role="test" />
<file md5sum="4e806cdbc153b4ea7402a089dba6411b" name="tests/bulk/bulkwrite-debug-001.phpt" role="test" />
- <file md5sum="dd4236bbed8aed59336a25d8532ddd17" name="tests/bulk/bulkwrite-delete-001.phpt" role="test" />
+ <file md5sum="e04091ccae5c03cbe9a854e7ca5298fc" name="tests/bulk/bulkwrite-delete-001.phpt" role="test" />
<file md5sum="8d10054bd97c19c978126c9dbe7992f0" name="tests/bulk/bulkwrite-delete_error-001.phpt" role="test" />
- <file md5sum="db18adde47a3b0ffbb1063e0e216b428" name="tests/bulk/bulkwrite-insert-001.phpt" role="test" />
- <file md5sum="88502eef0238ef643ef36d4ea1781dba" name="tests/bulk/bulkwrite-update-001.phpt" role="test" />
+ <file md5sum="57e008c2906d1bc5acedaecc824aa04a" name="tests/bulk/bulkwrite-insert-001.phpt" role="test" />
+ <file md5sum="b44d4ca6e0420c984df998309e9dd48f" name="tests/bulk/bulkwrite-update-001.phpt" role="test" />
<file md5sum="ccf78226caff53fb79aaaf235fa84291" name="tests/bulk/bulkwrite-update_error-001.phpt" role="test" />
<file md5sum="c117f84081a29441f2df90bf68b36308" name="tests/bulk/bulkwrite_error-001.phpt" role="test" />
- <file md5sum="05732249b0831f6eebef674fa84b90e8" name="tests/bulk/bulkwrite_error-002.phpt" role="test" />
- <file md5sum="9ce371b37b60f0c0af62d3f8bf2ae9f3" name="tests/bulk/write-0001.phpt" role="test" />
- <file md5sum="4be3531dda4cee6ef53264db72b23775" name="tests/bulk/write-0002.phpt" role="test" />
- <file md5sum="1b98fa03a2968f7f9593e9fc98a0b9e8" name="tests/connect/bug0720.phpt" role="test" />
- <file md5sum="02e74cf0ff0e2240901dfe918d6cbeab" name="tests/connect/replicaset-seedlist-001.phpt" role="test" />
- <file md5sum="60392dab08a5778d885aac6984bc4a5a" name="tests/connect/replicaset-seedlist-002.phpt" role="test" />
- <file md5sum="5782cb975ced7a0d028d9f8c36cfffc4" name="tests/connect/standalone-auth-0001.phpt" role="test" />
- <file md5sum="13b4c81631c4fe5b2826b3943b65d481" name="tests/connect/standalone-auth-0002.phpt" role="test" />
- <file md5sum="d31ed516811f559e1f9ecd9a557fd0be" name="tests/connect/standalone-plain-0001.phpt" role="test" />
- <file md5sum="e8f9688845ac3a1b8f5da6b3d056f2f1" name="tests/connect/standalone-plain-0002.phpt" role="test" />
- <file md5sum="dd86ee89cb49285d1f5967e79eed600a" name="tests/connect/standalone-ssl-no_verify-001.phpt" role="test" />
- <file md5sum="63f722cee580bd0932fef6c81ea21dd9" name="tests/connect/standalone-ssl-no_verify-002.phpt" role="test" />
- <file md5sum="cde2541db3184ef59b6a2e5330fd1989" name="tests/connect/standalone-ssl-verify_cert-001.phpt" role="test" />
- <file md5sum="52fdef71b0fd15dc0560183f7412b169" name="tests/connect/standalone-ssl-verify_cert-002.phpt" role="test" />
- <file md5sum="e4ca4afe06e73d9679a8a11f1ba4af91" name="tests/connect/standalone-ssl-verify_cert-error-001.phpt" role="test" />
- <file md5sum="947ea5a9b7ac50fdb151a1cbf628eb1b" name="tests/connect/standalone-ssl-verify_cert-error-002.phpt" role="test" />
- <file md5sum="5dcc1590012f20f18e735957a7e40caf" name="tests/connect/standalone-x509-auth-001.phpt" role="test" />
- <file md5sum="eb801ba6249285efc4a29475ff1ddf57" name="tests/connect/standalone-x509-auth-002.phpt" role="test" />
- <file md5sum="5a15b109a74060fca2df7c95fa133f18" name="tests/connect/standalone-x509-error-0001.phpt" role="test" />
- <file md5sum="a1d349b948973185e98f5e1e1e13da92" name="tests/connect/standalone-x509-extract_username-001.phpt" role="test" />
- <file md5sum="e58fcfda945a41736dbc53d99e776fd6" name="tests/connect/standalone-x509-extract_username-002.phpt" role="test" />
- <file md5sum="dea3f769b6ea7a7cb6f4ff15ed072059" name="tests/functional/cursor-001.phpt" role="test" />
- <file md5sum="400f298def6404282647635c85dea40b" name="tests/functional/cursorid-001.phpt" role="test" />
- <file md5sum="8f1118a46eb22e44df5c91b3bb4ce07c" name="tests/functional/phpinfo-1.phpt" role="test" />
- <file md5sum="51ce24e2e7ca333085958d84697c8cd8" name="tests/functional/phpinfo-2.phpt" role="test" />
- <file md5sum="2a66545653e7035f281c701a4a5bfa1f" name="tests/functional/query-sort-001.phpt" role="test" />
- <file md5sum="ee0ff92d6d48e5c624e7043cc4728a0c" name="tests/functional/query-sort-002.phpt" role="test" />
- <file md5sum="fc136cdf12d07f1cf0975f9f37d90a22" name="tests/functional/query-sort-003.phpt" role="test" />
- <file md5sum="7e15c4055e376ee0563c97a81fed1365" name="tests/functional/query-sort-004.phpt" role="test" />
- <file md5sum="432630f2f57ce8bedb31b46b72c36364" name="tests/manager/bug0572.phpt" role="test" />
+ <file md5sum="210570f9da7507f8a0f1442630cef92e" name="tests/bulk/bulkwrite_error-002.phpt" role="test" />
+ <file md5sum="0320b5f835e9a84756d4a8d03714ff42" name="tests/bulk/write-0001.phpt" role="test" />
+ <file md5sum="96088d71d5345e7b89c8b06c792e1c90" name="tests/bulk/write-0002.phpt" role="test" />
+ <file md5sum="9c802f00ea9a022fda2e20d572b44d29" name="tests/connect/bug0720.phpt" role="test" />
+ <file md5sum="f80cc6758cd4414419b49e5bf43ab2f9" name="tests/connect/replicaset-seedlist-001.phpt" role="test" />
+ <file md5sum="eedc45e1dc4655125e4f087e1bb91ce6" name="tests/connect/replicaset-seedlist-002.phpt" role="test" />
+ <file md5sum="b09058c57676c7542aab5b5b810867fb" name="tests/connect/standalone-auth-0001.phpt" role="test" />
+ <file md5sum="3540fabe2e511ce71e08a02775fc3ef8" name="tests/connect/standalone-auth-0002.phpt" role="test" />
+ <file md5sum="6fc6435daef470c8a00884c020fbd3c0" name="tests/connect/standalone-plain-0001.phpt" role="test" />
+ <file md5sum="55f5a7f950aaa52986cd0c01240f9237" name="tests/connect/standalone-plain-0002.phpt" role="test" />
+ <file md5sum="9e990b5984673fb768edbec7c6fe1d95" name="tests/connect/standalone-ssl-no_verify-001.phpt" role="test" />
+ <file md5sum="5a5f4073766bf96c9149bb2d06382613" name="tests/connect/standalone-ssl-no_verify-002.phpt" role="test" />
+ <file md5sum="b68d37fd29d53a3b9f0b8d1de7a5ff04" name="tests/connect/standalone-ssl-verify_cert-001.phpt" role="test" />
+ <file md5sum="ce4fabb76e9b029ff3a406397ab77435" name="tests/connect/standalone-ssl-verify_cert-002.phpt" role="test" />
+ <file md5sum="e8806199d04d9b14f9b708f4d8ea067e" name="tests/connect/standalone-ssl-verify_cert-error-001.phpt" role="test" />
+ <file md5sum="ad804b5d37887a93d33f91d3bb844d92" name="tests/connect/standalone-ssl-verify_cert-error-002.phpt" role="test" />
+ <file md5sum="3c6f82dd4e6d3c5cdbc35db642ae7a7d" name="tests/connect/standalone-x509-auth-001.phpt" role="test" />
+ <file md5sum="6ace64368ba6ff181da7f996e7b29684" name="tests/connect/standalone-x509-auth-002.phpt" role="test" />
+ <file md5sum="55c8b18460245d6770a6264130332103" name="tests/connect/standalone-x509-error-0001.phpt" role="test" />
+ <file md5sum="e990fefc9c1882085d340b9cad544604" name="tests/connect/standalone-x509-extract_username-001.phpt" role="test" />
+ <file md5sum="9a5bae0873bdfb7bc4b0cc1a5a6c8d6f" name="tests/connect/standalone-x509-extract_username-002.phpt" role="test" />
+ <file md5sum="61a4d94cd1a2cba22af558739fd99920" name="tests/functional/cursor-001.phpt" role="test" />
+ <file md5sum="3c9dd45aa143cfadbdeade17987bc89a" name="tests/functional/cursorid-001.phpt" role="test" />
+ <file md5sum="00e5e9aa4990021e69b190a2519f91fd" name="tests/functional/phpinfo-1.phpt" role="test" />
+ <file md5sum="284065fce38985ffa6a7b4cdb8ed834a" name="tests/functional/phpinfo-2.phpt" role="test" />
+ <file md5sum="6e5d4df60590351975ff8c1c97995d94" name="tests/functional/query-sort-001.phpt" role="test" />
+ <file md5sum="1472bff8e60acf52d238aac8d39ca2ff" name="tests/functional/query-sort-002.phpt" role="test" />
+ <file md5sum="f87ce409844841c8ff3e2eaea9446241" name="tests/functional/query-sort-003.phpt" role="test" />
+ <file md5sum="c6b0add9164be333621f04dfd7d226c6" name="tests/functional/query-sort-004.phpt" role="test" />
+ <file md5sum="0e92c8b24b958eb681e48cae1bb0162c" name="tests/manager/bug0572.phpt" role="test" />
<file md5sum="f0346e6cd2ba9520eef5021167879c4e" name="tests/manager/bug0851-001.phpt" role="test" />
<file md5sum="9a7cb75f5eb30349c7dd731ef0977940" name="tests/manager/bug0851-002.phpt" role="test" />
+ <file md5sum="9b7b81b9372e04f59efa089eb9919f91" name="tests/manager/bug0912-001.phpt" role="test" />
+ <file md5sum="1e678a1402e1230e2ccbf30cc7274c40" name="tests/manager/bug0913-001.phpt" role="test" />
<file md5sum="d582d6ff744cdbf6f65a37e63faac924" name="tests/manager/manager-ctor-001.phpt" role="test" />
- <file md5sum="2739447256d9292f60da18e978a19919" name="tests/manager/manager-ctor-002.phpt" role="test" />
+ <file md5sum="a27445a8c78d892a18f123d2c39a627d" name="tests/manager/manager-ctor-002.phpt" role="test" />
<file md5sum="90824d052d5f693a3e4e84b28b4a9b06" name="tests/manager/manager-ctor-003.phpt" role="test" />
- <file md5sum="389882a75a62940fd3a6ac58f8f52474" name="tests/manager/manager-ctor-appname-001.phpt" role="test" />
+ <file md5sum="b5efa282f800cf3a1b3d09d86bf06906" name="tests/manager/manager-ctor-appname-001.phpt" role="test" />
<file md5sum="61b8d5978585fc2a3f031c4f37d2d611" name="tests/manager/manager-ctor-appname_error-001.phpt" role="test" />
<file md5sum="79e97d46bf35dde168a2b2c8b304d259" name="tests/manager/manager-ctor-read_preference-001.phpt" role="test" />
<file md5sum="a68f0249fa21dc829486e9b349d5835a" name="tests/manager/manager-ctor-read_preference-002.phpt" role="test" />
<file md5sum="932219438679606effcdf683c457362c" name="tests/manager/manager-ctor-read_preference-003.phpt" role="test" />
+ <file md5sum="59dfaf4553ac1a2fdb011c19c0de95c5" name="tests/manager/manager-ctor-read_preference-004.phpt" role="test" />
<file md5sum="f70c276950a04090264263d204cde1eb" name="tests/manager/manager-ctor-read_preference-error-001.phpt" role="test" />
<file md5sum="b71800ec70f4c001a0de1c83ceb9f5ed" name="tests/manager/manager-ctor-read_preference-error-002.phpt" role="test" />
<file md5sum="cacc9c381ba34b04b8837e6d1e10726c" name="tests/manager/manager-ctor-write_concern-error-001.phpt" role="test" />
<file md5sum="49ffdcbe69686e38b35bd6d9cdbd8b67" name="tests/manager/manager-ctor_error-001.phpt" role="test" />
<file md5sum="2f9426716a3fd04f9cd174c3809caf65" name="tests/manager/manager-ctor_error-002.phpt" role="test" />
- <file md5sum="aa1f31f185b65f8015898e09e1b0f214" name="tests/manager/manager-debug-001.phpt" role="test" />
- <file md5sum="c66217888e6d08257f72e28151141b9e" name="tests/manager/manager-debug-002.phpt" role="test" />
- <file md5sum="0f8db6f664bc5cd5169365314e029598" name="tests/manager/manager-destruct-001.phpt" role="test" />
- <file md5sum="eb865c94e36cb45d30deaa1fef6f6b61" name="tests/manager/manager-executeBulkWrite-001.phpt" role="test" />
- <file md5sum="8699029df0d1c55416ff2e9b84f29de7" name="tests/manager/manager-executeBulkWrite-002.phpt" role="test" />
- <file md5sum="e026dd6019cc223d720831cc2477f9ad" name="tests/manager/manager-executeBulkWrite-003.phpt" role="test" />
- <file md5sum="5573209b66cbce19a2261b154a8965fc" name="tests/manager/manager-executeBulkWrite-004.phpt" role="test" />
- <file md5sum="369baa6800666052fcd234bca4d6d212" name="tests/manager/manager-executeBulkWrite-005.phpt" role="test" />
- <file md5sum="0ae8e3f91a0281b349ccbbf5a6d38645" name="tests/manager/manager-executeBulkWrite-006.phpt" role="test" />
- <file md5sum="27b857c44e4cb8038de7783fefb75dbe" name="tests/manager/manager-executeBulkWrite-007.phpt" role="test" />
- <file md5sum="94c563468ea9ca945cccfd489a8a569e" name="tests/manager/manager-executeBulkWrite-008.phpt" role="test" />
- <file md5sum="d9b09740e5c0dfc266a730d9a15dfc5b" name="tests/manager/manager-executeBulkWrite-009.phpt" role="test" />
- <file md5sum="f110b2740f1e1f63b4d922af824098b7" name="tests/manager/manager-executeBulkWrite-010.phpt" role="test" />
- <file md5sum="ab6d6d06179fd4da9a9b95d512dd723e" name="tests/manager/manager-executeBulkWrite-011.phpt" role="test" />
- <file md5sum="a29b35dc6a803499d584e7d6efe620aa" name="tests/manager/manager-executeBulkWrite_error-001.phpt" role="test" />
- <file md5sum="72422952716c0fc6c6ee34c028ab746b" name="tests/manager/manager-executeBulkWrite_error-002.phpt" role="test" />
- <file md5sum="a99efdb13d47c79a465dc890ace6b2e9" name="tests/manager/manager-executeBulkWrite_error-003.phpt" role="test" />
- <file md5sum="79bebde9c592b8eaeffe0d3db98fc4b2" name="tests/manager/manager-executeBulkWrite_error-004.phpt" role="test" />
- <file md5sum="f436f057342ae3112e8295ddbf8b1fc8" name="tests/manager/manager-executeBulkWrite_error-005.phpt" role="test" />
- <file md5sum="98ae436fcabb824568b72b17cf9280d1" name="tests/manager/manager-executeBulkWrite_error-006.phpt" role="test" />
+ <file md5sum="ebdd7475f10c93b49ee2d3ca505bf50b" name="tests/manager/manager-debug-001.phpt" role="test" />
+ <file md5sum="6f82cb6c9546ace927299251c2e341a9" name="tests/manager/manager-debug-002.phpt" role="test" />
+ <file md5sum="e791d3155d0c6af7fbb8b38da5cda729" name="tests/manager/manager-destruct-001.phpt" role="test" />
+ <file md5sum="502e3288a762c61c59c5718c3ea63a6f" name="tests/manager/manager-executeBulkWrite-001.phpt" role="test" />
+ <file md5sum="7344d272e40e55ee501d76f3a10c0dc6" name="tests/manager/manager-executeBulkWrite-002.phpt" role="test" />
+ <file md5sum="327b7ea25fb9259aaf9d37b7c9f95687" name="tests/manager/manager-executeBulkWrite-003.phpt" role="test" />
+ <file md5sum="2c96f45f9a46375035c49d5ad884cbae" name="tests/manager/manager-executeBulkWrite-004.phpt" role="test" />
+ <file md5sum="afe52472d9b36dd52fc8b235fcc2e26b" name="tests/manager/manager-executeBulkWrite-005.phpt" role="test" />
+ <file md5sum="f66ce3abbb6715c0a2001fbf33277a1b" name="tests/manager/manager-executeBulkWrite-006.phpt" role="test" />
+ <file md5sum="65f2114c9e750d8256c026c854d4b6a1" name="tests/manager/manager-executeBulkWrite-007.phpt" role="test" />
+ <file md5sum="3db0f084d4b11f67411dd755392e652e" name="tests/manager/manager-executeBulkWrite-008.phpt" role="test" />
+ <file md5sum="db83342d1cea8b21d113a18a66c57a63" name="tests/manager/manager-executeBulkWrite-009.phpt" role="test" />
+ <file md5sum="cc95bd471144e0dee220d3203c66c6e3" name="tests/manager/manager-executeBulkWrite-010.phpt" role="test" />
+ <file md5sum="1f846a1f20ab7a40d3e4bc9ecb54112d" name="tests/manager/manager-executeBulkWrite-011.phpt" role="test" />
+ <file md5sum="825e9363312c2a8d3f953da43770e2b2" name="tests/manager/manager-executeBulkWrite_error-001.phpt" role="test" />
+ <file md5sum="b351ac5fb6628150bee7c17218f9cc40" name="tests/manager/manager-executeBulkWrite_error-002.phpt" role="test" />
+ <file md5sum="48ab21bcda4cb861aeadf15b5975ff58" name="tests/manager/manager-executeBulkWrite_error-003.phpt" role="test" />
+ <file md5sum="dc973d0e87e9e22f2743dc8d5a4c46ca" name="tests/manager/manager-executeBulkWrite_error-004.phpt" role="test" />
+ <file md5sum="d50c616cea538d13bcf9b20947e00c82" name="tests/manager/manager-executeBulkWrite_error-006.phpt" role="test" />
<file md5sum="d36794d4026aef731f405bdcba806ca9" name="tests/manager/manager-executeBulkWrite_error-007.phpt" role="test" />
- <file md5sum="c22a8a88d9f1a7d4419a4369dfd7ae40" name="tests/manager/manager-executeCommand-001.phpt" role="test" />
+ <file md5sum="020190b7055d6b3a9545065a4f39d057" name="tests/manager/manager-executeCommand-001.phpt" role="test" />
<file md5sum="b4e242aa64446022796549bf18ef7fbd" name="tests/manager/manager-executeCommand_error-001.phpt" role="test" />
- <file md5sum="ec0c4bb5549febbc8fd55ea7a29e2be6" name="tests/manager/manager-executeQuery-001.phpt" role="test" />
- <file md5sum="2fdf9af56c29de3c29281622dfc6268a" name="tests/manager/manager-executeQuery-002.phpt" role="test" />
- <file md5sum="46144d8bd74889415cbcb19e801dba38" name="tests/manager/manager-executeQuery-005.phpt" role="test" />
+ <file md5sum="2830e42312975c21857d53464b9c6d4c" name="tests/manager/manager-executeQuery-001.phpt" role="test" />
+ <file md5sum="5f177fb67bbc291e318926b102346788" name="tests/manager/manager-executeQuery-002.phpt" role="test" />
+ <file md5sum="bfcc9743039bbc30957f8cf69082f2dd" name="tests/manager/manager-executeQuery-005.phpt" role="test" />
<file md5sum="828d1da5bfd8accddc3df45da5b337bd" name="tests/manager/manager-executeQuery_error-001.phpt" role="test" />
- <file md5sum="59fc1f8755cee6001ff7e7cf4ec7b545" name="tests/manager/manager-executequery-without-assignment.phpt" role="test" />
<file md5sum="3fdf3959137e40815625c7af1f9bcf9c" name="tests/manager/manager-getreadconcern-001.phpt" role="test" />
<file md5sum="5b8120ba62afb13a67636fefb6ac9046" name="tests/manager/manager-getreadpreference-001.phpt" role="test" />
- <file md5sum="984a06de0d8857e1df125babdfac1fef" name="tests/manager/manager-getservers-001.phpt" role="test" />
- <file md5sum="99314dc63ca0a4abc49e5a56dc2c6025" name="tests/manager/manager-getservers-002.phpt" role="test" />
+ <file md5sum="cc6a826770fe32f66d71f6c95aca3d9f" name="tests/manager/manager-getservers-001.phpt" role="test" />
+ <file md5sum="191acc2f6b43eaba1a1971bcc996491a" name="tests/manager/manager-getservers-002.phpt" role="test" />
<file md5sum="ed0f1d54919b563cf773fed548bc9791" name="tests/manager/manager-getwriteconcern-001.phpt" role="test" />
<file md5sum="f55b83dec74f5c379cf719423abdd703" name="tests/manager/manager-invalidnamespace.phpt" role="test" />
- <file md5sum="d6958dfe7978d07cb51fc4d81c86b1e9" name="tests/manager/manager-selectserver-001.phpt" role="test" />
+ <file md5sum="eabe12d6f73dab29c77417060427c2f3" name="tests/manager/manager-selectserver-001.phpt" role="test" />
<file md5sum="400fbbbfd04b2967e09398c479736aaa" name="tests/manager/manager-selectserver_error-001.phpt" role="test" />
- <file md5sum="1b44b8daec032ca66d24b26f3a43f1ee" name="tests/manager/manager-set-uri-options-001.phpt" role="test" />
- <file md5sum="31098091db5117a73880a689d1b22a69" name="tests/manager/manager-set-uri-options-002.phpt" role="test" />
- <file md5sum="b80336a6a3ae99bd9709e074643e847d" name="tests/manager/manager-var-dump-001.phpt" role="test" />
+ <file md5sum="e420f678f1caf714265dcc79ab5e5a0c" name="tests/manager/manager-set-uri-options-001.phpt" role="test" />
+ <file md5sum="a9f200ce067bf02422fb71a091cda8c2" name="tests/manager/manager-set-uri-options-002.phpt" role="test" />
+ <file md5sum="3157fde1003b34bbb1648c33bcc63248" name="tests/manager/manager-var-dump-001.phpt" role="test" />
<file md5sum="8c5241469e089d92c2bea067680504ee" name="tests/manager/manager-wakeup.phpt" role="test" />
<file md5sum="d9723d6bfe30a7e2691ecea5b69c2c13" name="tests/manager/manager_error-001.phpt" role="test" />
- <file md5sum="e66dbf501d5db01771784dd2d668eaa3" name="tests/readPreference/bug0146-001.phpt" role="test" />
+ <file md5sum="b83cf03af044e79dc7b1531832e12b14" name="tests/readPreference/bug0146-001.phpt" role="test" />
<file md5sum="87512936e327f5a49030c5ede4feed50" name="tests/readPreference/bug0146-002.phpt" role="test" />
<file md5sum="5bbbd73884d0d64989109201e7e1bf3f" name="tests/readPreference/bug0851-001.phpt" role="test" />
<file md5sum="6677621b6743e8d5d17b3cf0d45283d3" name="tests/readPreference/readpreference-bsonserialize-001.phpt" role="test" />
<file md5sum="ff0ce5637f8b68e7cf7c1aa65bedf89f" name="tests/readPreference/readpreference-bsonserialize-002.phpt" role="test" />
<file md5sum="f08d9809213c98acdf84fd9e656910e0" name="tests/readPreference/readpreference-ctor-001.phpt" role="test" />
<file md5sum="475a0c5eff5f7f7a211614819b886648" name="tests/readPreference/readpreference-ctor_error-001.phpt" role="test" />
<file md5sum="6a085382474901130b28e84b81029fa1" name="tests/readPreference/readpreference-ctor_error-002.phpt" role="test" />
<file md5sum="f8160df818dce1770a4bc53f6355d289" name="tests/readPreference/readpreference-ctor_error-003.phpt" role="test" />
<file md5sum="2ecac9178a92b919e2a3d744386b308d" name="tests/readPreference/readpreference-ctor_error-004.phpt" role="test" />
<file md5sum="4708202d52455d5454a03b70d029b97f" name="tests/readPreference/readpreference-debug-001.phpt" role="test" />
<file md5sum="4a4e16d677e9a242b8e2429def65e565" name="tests/readPreference/readpreference-getMaxStalenessMS-001.phpt" role="test" />
<file md5sum="2300bc05051a0d0dc183ebe1d699190a" name="tests/readPreference/readpreference-getMode-001.phpt" role="test" />
<file md5sum="2a58ca560ca933e763397fdecd6e1c22" name="tests/readPreference/readpreference-getTagSets-001.phpt" role="test" />
<file md5sum="56df736cc8af42557ae036e2eef910a8" name="tests/readPreference/readpreference_error-001.phpt" role="test" />
- <file md5sum="0594c08003096c1cc1f021e4b3ea6d42" name="tests/server/bug0671-002.phpt" role="test" />
+ <file md5sum="6e83981a37e2c04bf2f61ad3f94af12e" name="tests/server/bug0671-002.phpt" role="test" />
<file md5sum="75a4ec8e23ef050d7057e855fff2f5f6" name="tests/server/server-constants.phpt" role="test" />
- <file md5sum="4661126e8b4887192c5b4cbb3687021e" name="tests/server/server-construct-001.phpt" role="test" />
- <file md5sum="fd04e2f479e0402db99873843e712946" name="tests/server/server-debug.phpt" role="test" />
- <file md5sum="d38a111b8fe29155d2e5d25072907dda" name="tests/server/server-errors.phpt" role="test" />
- <file md5sum="d5b293043d39a1662c52e856e9fcecc9" name="tests/server/server-executeBulkWrite-001.phpt" role="test" />
- <file md5sum="ee5b42ab7d6083974fed746181fc58f6" name="tests/server/server-executeBulkWrite-002.phpt" role="test" />
- <file md5sum="c926b3f9cbe07f825e3fa3d40080cb99" name="tests/server/server-executeBulkWrite-003.phpt" role="test" />
- <file md5sum="67bb9028e8ba0e368e94f8068b67bd3c" name="tests/server/server-executeBulkWrite-004.phpt" role="test" />
- <file md5sum="97fd2acd97fd481c0b87d9c70496b960" name="tests/server/server-executeBulkWrite-005.phpt" role="test" />
- <file md5sum="be775815974efde6bd33e41152ac1e19" name="tests/server/server-executeCommand-001.phpt" role="test" />
- <file md5sum="5fc4aeaa34980a55ddc0ea073061a9e5" name="tests/server/server-executeCommand-002.phpt" role="test" />
- <file md5sum="b431241f84a378e55b470adf3746ee5e" name="tests/server/server-executeCommand-003.phpt" role="test" />
- <file md5sum="f2e023f40ea3af5b1fd4b555948e7143" name="tests/server/server-executeQuery-001.phpt" role="test" />
- <file md5sum="4fb14745659a9389c1a483d7edf2b93c" name="tests/server/server-executeQuery-002.phpt" role="test" />
- <file md5sum="e5cb7df3413213e2d2cfb2d3e0339d37" name="tests/server/server-executeQuery-003.phpt" role="test" />
- <file md5sum="044898026d584ad685adefecf4910147" name="tests/server/server-executeQuery-004.phpt" role="test" />
- <file md5sum="55fe736212d4486e6239085b641b34fb" name="tests/server/server-executeQuery-005.phpt" role="test" />
- <file md5sum="986bca1a493fdaa71f346eb168f8266e" name="tests/server/server-executeQuery-006.phpt" role="test" />
- <file md5sum="de82332ab4df59fa7dd07b9a8be1039f" name="tests/server/server-executeQuery-007.phpt" role="test" />
- <file md5sum="4d4169021903d938627d87aabb8a7e38" name="tests/server/server-executeQuery-008.phpt" role="test" />
+ <file md5sum="3ab793258b26d778e2b7e306dbdf2947" name="tests/server/server-construct-001.phpt" role="test" />
+ <file md5sum="8297af536b148b8c171971a8778ecb14" name="tests/server/server-debug.phpt" role="test" />
+ <file md5sum="d814cc3637b676a293ddc5606420fa1d" name="tests/server/server-errors.phpt" role="test" />
+ <file md5sum="d35aa52f3190d27db25128ba00328a84" name="tests/server/server-executeBulkWrite-001.phpt" role="test" />
+ <file md5sum="ea0086480a8cbaae15a1751fdce48617" name="tests/server/server-executeBulkWrite-002.phpt" role="test" />
+ <file md5sum="53780e03f672d499183545c1e20a0daa" name="tests/server/server-executeBulkWrite-003.phpt" role="test" />
+ <file md5sum="9b4e23b508dd5b503c877580f925a26b" name="tests/server/server-executeBulkWrite-004.phpt" role="test" />
+ <file md5sum="a436b448ea05806fa07ff06ba29db547" name="tests/server/server-executeBulkWrite-005.phpt" role="test" />
+ <file md5sum="b26b52aaae1b5ce0dad185a22e2f1296" name="tests/server/server-executeCommand-001.phpt" role="test" />
+ <file md5sum="cac9aa5902387fd7c9056fe22db0ff3b" name="tests/server/server-executeCommand-002.phpt" role="test" />
+ <file md5sum="77366626f284d5f6c28b4ad75f872f69" name="tests/server/server-executeCommand-003.phpt" role="test" />
+ <file md5sum="1e1399a4558a7d195709a0beeda4fffc" name="tests/server/server-executeQuery-001.phpt" role="test" />
+ <file md5sum="9b5213961e50487ab850c9edfa1212cf" name="tests/server/server-executeQuery-002.phpt" role="test" />
+ <file md5sum="31ec575f8ac5b522ee859130e1aa18f4" name="tests/server/server-executeQuery-003.phpt" role="test" />
+ <file md5sum="db8fd646ecd3b9a424a6bef9cd4b246f" name="tests/server/server-executeQuery-004.phpt" role="test" />
+ <file md5sum="1d6574f124e04e3863ddb75a9f03a771" name="tests/server/server-executeQuery-005.phpt" role="test" />
+ <file md5sum="9a69b4c9008b318c02d4e48de25997aa" name="tests/server/server-executeQuery-006.phpt" role="test" />
+ <file md5sum="69e1d381848a7f6d3b7629a27f3dcaae" name="tests/server/server-executeQuery-007.phpt" role="test" />
+ <file md5sum="a3f5bd0996eb71e293b345af26e18fc6" name="tests/server/server-executeQuery-008.phpt" role="test" />
<file md5sum="9aefd9967eed1cb334069bc28d435b71" name="tests/server/server_error-001.phpt" role="test" />
- <file md5sum="ef31e8b9f59a396d435badf3c9a653c3" name="tests/standalone/bug0159.phpt" role="test" />
- <file md5sum="3ff56796c1e87ea6a07ae574ea64aaf4" name="tests/standalone/bug0166.phpt" role="test" />
- <file md5sum="87bb7dffe9a182e72322a74ffcbf7cb6" name="tests/standalone/bug0231.phpt" role="test" />
+ <file md5sum="8b426f629f71881cd1f2572deceb79d0" name="tests/standalone/bug0159.phpt" role="test" />
+ <file md5sum="af985ddcede3e694fe26dd02a7b08f96" name="tests/standalone/bug0166.phpt" role="test" />
+ <file md5sum="5903bd001a11ca4052af551f99a13282" name="tests/standalone/bug0231.phpt" role="test" />
<file md5sum="508f7f23c5b80875cf8893f11fd636b0" name="tests/standalone/bug0357.phpt" role="test" />
- <file md5sum="5cac284a2bc03ef77ec8bea7de101bf1" name="tests/standalone/bug0487-001.phpt" role="test" />
- <file md5sum="555b19d37a2508138993c23e671ad65d" name="tests/standalone/bug0487-002.phpt" role="test" />
- <file md5sum="907e0dfcdf61c30b9559a3a17bd2bfd7" name="tests/standalone/bug0545.phpt" role="test" />
+ <file md5sum="cbfb709195c3ca88a40b029a34ef6b9a" name="tests/standalone/bug0545.phpt" role="test" />
<file md5sum="08af799afac3ebe4478c44523f19af60" name="tests/standalone/bug0655.phpt" role="test" />
- <file md5sum="1eb1f1920cfbd77245d08b7da1c7e8a1" name="tests/standalone/command-aggregate-001.phpt" role="test" />
- <file md5sum="727192fdd6f1dc71751a2831b0603583" name="tests/standalone/connectiontimeoutexception-001.phpt" role="test" />
- <file md5sum="d1b6e3057856667e03b515c117cc6e01" name="tests/standalone/executiontimeoutexception-001.phpt" role="test" />
- <file md5sum="18a8835a80982d575d574ef50c40a383" name="tests/standalone/executiontimeoutexception-002.phpt" role="test" />
+ <file md5sum="b59208bcbc4702a23f40b4ae99cdcbd8" name="tests/standalone/command-aggregate-001.phpt" role="test" />
+ <file md5sum="20df46b18b099e15b2637ab7ec6ac232" name="tests/standalone/connectiontimeoutexception-001.phpt" role="test" />
+ <file md5sum="f948319b24f2599ca7e4c9da3bcf8974" name="tests/standalone/executiontimeoutexception-001.phpt" role="test" />
+ <file md5sum="4141be498e7c13e724f2dd3baa099620" name="tests/standalone/executiontimeoutexception-002.phpt" role="test" />
<file md5sum="6708621c6c2c09bc2f261dc92c965bf9" name="tests/standalone/manager-as-singleton.phpt" role="test" />
<file md5sum="6bc5f1fba6c3ad151704fd8500d50183" name="tests/standalone/query-errors.phpt" role="test" />
- <file md5sum="e199482514ae20307a7bd8125fefbf75" name="tests/standalone/update-multi-001.phpt" role="test" />
- <file md5sum="18fb1fcde459435fd68d2f240b0c650c" name="tests/standalone/write-error-001.phpt" role="test" />
- <file md5sum="3e1c19ae95c83036dc56add94ea0cd11" name="tests/standalone/writeresult-isacknowledged-001.phpt" role="test" />
- <file md5sum="262c02b8d69ae66dc7ad5fe32cd4d84b" name="tests/standalone/writeresult-isacknowledged-002.phpt" role="test" />
- <file md5sum="c858779a4125f12dac83f28dfa1e0bc9" name="tests/standalone/writeresult-isacknowledged-003.phpt" role="test" />
+ <file md5sum="c52cd4b33ae4c254a12a383a56deb323" name="tests/standalone/update-multi-001.phpt" role="test" />
+ <file md5sum="d15611b314dcde7d6cd5069545524b0a" name="tests/standalone/write-error-001.phpt" role="test" />
+ <file md5sum="383c7d82bd2ceee77ee90a7620dcabbb" name="tests/standalone/writeresult-isacknowledged-001.phpt" role="test" />
+ <file md5sum="aac042fb1b20aae6154fd6ca92f2157c" name="tests/standalone/writeresult-isacknowledged-002.phpt" role="test" />
+ <file md5sum="4404cc45687afb99790d9bd032e0ca34" name="tests/standalone/writeresult-isacknowledged-003.phpt" role="test" />
<file md5sum="59adebd29ef983f00c4d55cfc4b2d10d" name="tests/utils/PHONGO-FIXTURES.json.gz" role="test" />
<file md5sum="8eb155fe0ba18304305ec5e7095ac938" name="tests/utils/basic-skipif.inc" role="test" />
- <file md5sum="d087be211838b3c030edde5946a48edf" name="tests/utils/basic.inc" role="test" />
+ <file md5sum="c571c88edecbca6abf8b386960e02e56" name="tests/utils/basic.inc" role="test" />
<file md5sum="d45f34ff6fd0f526099f3131d5d17b11" name="tests/utils/classes.inc" role="test" />
<file md5sum="b017f852d0cfb8118f46a289da3ff3b1" name="tests/utils/tools.php" role="test" />
<file md5sum="daabc03629dbb55aa9dd13c8e61c5697" name="tests/writeConcern/writeconcern-bsonserialize-001.phpt" role="test" />
<file md5sum="340ab895d2d78ec8703db01eeed96e45" name="tests/writeConcern/writeconcern-bsonserialize-002.phpt" role="test" />
<file md5sum="364b6092a91f4bf8761fc554aa8062cb" name="tests/writeConcern/writeconcern-constants.phpt" role="test" />
<file md5sum="4b14f66f2d087ed69223a978e6551dfd" name="tests/writeConcern/writeconcern-ctor-001.phpt" role="test" />
<file md5sum="9d8a5d5fbb5180c1e1a73b4885f256fd" name="tests/writeConcern/writeconcern-ctor_error-001.phpt" role="test" />
<file md5sum="46a1f16b20000db3726900b4f80945eb" name="tests/writeConcern/writeconcern-ctor_error-002.phpt" role="test" />
<file md5sum="56e3baaa054aadf32901781a09d330e1" name="tests/writeConcern/writeconcern-ctor_error-003.phpt" role="test" />
<file md5sum="9ca99acf66a4972b548678347236c25f" name="tests/writeConcern/writeconcern-ctor_error-004.phpt" role="test" />
<file md5sum="39969dc8700891be79d6ef6ca630f867" name="tests/writeConcern/writeconcern-ctor_error-005.phpt" role="test" />
<file md5sum="6514bd694b43ee6f3c2313c741740dc6" name="tests/writeConcern/writeconcern-debug-001.phpt" role="test" />
<file md5sum="0b650ccbc1a3fa831dd666e4b00c5c1a" name="tests/writeConcern/writeconcern-debug-002.phpt" role="test" />
<file md5sum="536335a91a175bce9f9a5c03991298ca" name="tests/writeConcern/writeconcern-debug-003.phpt" role="test" />
<file md5sum="afc708c9f9d830d1c3b7cf60333f1fce" name="tests/writeConcern/writeconcern-getjournal-001.phpt" role="test" />
<file md5sum="d4c305c451a28b591db0160e9f851ee5" name="tests/writeConcern/writeconcern-getw-001.phpt" role="test" />
<file md5sum="ddb88acb62b9b89316f92e3bb6076a48" name="tests/writeConcern/writeconcern-getwtimeout-001.phpt" role="test" />
<file md5sum="14ec52ea19befdf082e3ee270fa7d8ea" name="tests/writeConcern/writeconcern_error-001.phpt" role="test" />
<file md5sum="08a5fb008b50bb39301edc6130dc7a08" name="CREDITS" role="doc" />
<file md5sum="b1e01b26bacfc2232046c90a330332b3" name="LICENSE" role="doc" />
<file md5sum="9f3c76084ff72fb4668807b8d058c4ce" name="Makefile.frag" role="src" />
<file md5sum="64d70e2c61c2c5f7652d90de6bc9661f" name="README.md" role="doc" />
<file md5sum="422ba17467e9aa074a0856a15519f543" name="Vagrantfile" role="test" />
- <file md5sum="0ce1abd94a85d538412254ba97afd98d" name="config.m4" role="src" />
- <file md5sum="7e531bb1552bfd1edde6a1a344de6430" name="config.w32" role="src" />
+ <file md5sum="a7b9fb495b489a6c02d8738b37c81bad" name="config.m4" role="src" />
+ <file md5sum="33d238c106f7565bb59d351cd433bc21" name="config.w32" role="src" />
<file md5sum="7cee65a3fcc059894e7badf41fcc6c93" name="phongo_compat.c" role="src" />
- <file md5sum="387857e14552f23f3369bf3a91f61d25" name="phongo_compat.h" role="src" />
+ <file md5sum="34f5e9361b63a86715cf54f37adfaac9" name="phongo_compat.h" role="src" />
<file md5sum="9b6887cd796fd3878e6a429eefb61279" name="php_bson.h" role="src" />
- <file md5sum="0ac8e768ac2c2be8fb9101b4cd86fccb" name="php_phongo.c" role="src" />
- <file md5sum="73ba2d254ca901ce4495d9b0a4a058d3" name="php_phongo.h" role="src" />
+ <file md5sum="066c8055458c606269498da4f29dcca2" name="php_phongo.c" role="src" />
+ <file md5sum="e95d1fc36b20c5ab7854c340f7485141" name="php_phongo.h" role="src" />
<file md5sum="66c6e8411837287d43672047e21d45ef" name="php_phongo_classes.h" role="src" />
<file md5sum="f87716f23ef7441e1dfcc124a6d7f74f" name="php_phongo_structs.h" role="src" />
</dir>
</contents>
<dependencies>
<required>
<php>
<min>5.4.0</min>
<max>7.99.99</max>
</php>
<pearinstaller>
<min>1.4.8</min>
</pearinstaller>
</required>
</dependencies>
<providesextension>mongodb</providesextension>
<extsrcrelease />
</package>

File Metadata

Mime Type
text/x-diff
Expires
Sat, May 16, 7:35 AM (20 h, 27 m)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
55/c7/5aa5c9d316fb8786204c3dd6103a
Default Alt Text
(1 MB)

Event Timeline