Page MenuHomePhabricator (Chris)

No OneTemporary

Size
4 MB
Referenced Files
None
Subscribers
None
This file is larger than 256 KB, so syntax highlighting was skipped.
diff --git a/mongodb-1.8.1/CONTRIBUTING.md b/mongodb-1.8.1/CONTRIBUTING.md
deleted file mode 100644
index cb19cc31..00000000
--- a/mongodb-1.8.1/CONTRIBUTING.md
+++ /dev/null
@@ -1,524 +0,0 @@
-# Contributing to the PHP Driver for MongoDB
-
-## Building from Source
-
-Developers who would like to contribute to the driver will need to build it from
-source. The repository may be initialized with:
-
-```
-$ git clone https://github.com/mongodb/mongo-php-driver.git
-$ cd mongo-php-driver
-$ git submodule update --init
-```
-
-The following script may be used to build the driver:
-
-```
-#!/bin/sh
-
-phpize > /dev/null && \
-./configure --enable-mongodb-developer-flags > /dev/null && \
-make clean > /dev/null && make all > /dev/null && make install
-```
-
-## Testing
-
-The extension's test use the PHPT format from PHP internals. This format is
-documented in the following links:
-
- * [Introduction to PHPT Files](https://qa.php.net/write-test.php)
- * [PHPT - Test File Layout](https://qa.php.net/phpt_details.php)
-
-Generally, most tests will be based on the following template:
-
-```
---TEST--
-Description of API or JIRA issue being tested
---SKIPIF--
-<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
-<?php /* One or more skip functions */ ?>
---FILE--
-<?php
-require_once __DIR__ . "/../utils/basic.inc";
-
-// Test code
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-===DONE===
-```
-
-The `basic-skipif.inc` and `basic.inc` files contain utility functions for the
-`SKIPIF` and `FILE` sections, respectively. If those functions are not needed
-(e.g. skip logic only depends on checking the `PHP_INT_SIZE` constant), the test
-should not include the file. When it doubt, keep it simple.
-
-### Best Practices for `SKIPIF`
-
-The [`skipif.php`](tests/utils/skipif.php) file defines various helper functions
-for use within a test's [`SKIPIF`](https://qa.php.net/phpt_details.php#skipif_section)
-section. When multiple functions are used in a single `SKIPIF` section, they
-should be logically ordered:
-
- * Any PHP environment requirements should be checked first. For example, if a
- test requires a 64-bit architecture, start by checking `PHP_INT_SIZE` before
- anything else.
- * Any extension build requirements (e.g. `skip_if_not_libmongoc_crypto()`) or
- test environment requirements (e.g. `skip_if_auth()`) should then be checked.
- These functions only examine local information, such as `phpinfo()` output or
- the structure of the `URI` constant, and do not interact with a remote
- MongoDB server.
- * Any remote server requirements should then be checked. A general integration
- test that requires any type of remote server to be accessible might use
- `skip_if_not_live()` while a test requiring a replica set would prefer
- `skip_if_not_replica_set()`.
- * After requiring a remote server to be accessible (optionally with a specific
- type), you can enforce requirements about that server. This includes checking
- its server version, storage engine, availability of test commands, etc.
- * Finally, use `skip_if_not_clean()` if needed to ensure that the collection(s)
- under test are dropped before the test runs.
-
-As a rule of thumb, your `SKIPIF` logic should be written to allow the test to
-run in as many environments as possible. To paraphrase the
-[robustness principal](https://en.wikipedia.org/wiki/Robustness_principle):
-
-> Be conservative in what/how you test, and liberal in what environment you require
-
-Consider that a well-crafted `EXPECTF` section may allow a `SKIPIF` section to
-be less restrictive.
-
-### Local Mongo Orchestration (and Travis CI)
-
-The test suite depends on [Mongo Orchestration](https://github.com/10gen/mongo-orchestration).
-Mongo Orchestration is an HTTP server that provides a REST API for maintaining
-MongoDB configurations. These configurations are located in ``scripts/presets``
-and for Travis CI in ``scripts/presets/travis``. The presets for Travis CI can
-also be spun-up locally, and that is the preferred testing method. An older way
-using a specific VM is also still available (see further down).
-
-Mongo Orchestration expects that the ``mongod`` (and ``mongos``) binaries are
-available in the ``PATH``.
-
-Once installed, Mongo Orchestration can be started with
-
-```
-~/.local/bin/mongo-orchestration start --no-fork --enable-majority-read-concern
-```
-
-The Travis CI setup uses
-[deployments](https://github.com/mongodb/mongo-php-driver/blob/master/.travis.scripts/setup_mo.sh)
-to test different topologies. Currently, it supports ``STANDALONE``,
-``STANDALONE_OLD`` (for MongoDB versions before 3.6), ``STANDALONE_SSL``,
-``REPLICASET`` and ``SHARDED_CLUSTER``.
-
-The test suite uses the ``MONGODB_URI`` environment variable as connection
-string to run all tests. In order to make the URI available to the test suite,
-you can run the following for a "deployment" in the *root* of the MongoDB
-Driver GIT checkout:
-
-```
-export TRAVIS_BUILD_DIR=`pwd`
-DEPLOYMENT=STANDALONE_AUTH .travis.scripts/setup_mo.sh
-export MONGODB_URI=`cat /tmp/uri.txt`
-```
-
-With this set-up, the tests can be run with `make test`.
-
-### VM-based Mongo Orchestration (legacy set-up)
-
-Alternative to the Travis CI set-up, our test suite also includes scripts to configure test environments
-with [Vagrant](https://www.vagrantup.com/) and
-[Mongo Orchestration](https://github.com/10gen/mongo-orchestration).
-The deployments started in this Vagrant image have hard coded URLs to be used
-with the ``MONGODB_URI`` environment variable:
-
-Deployment | URI
---------------------------- | ---
-Standalone (MongoDB 4.0) | `mongodb://192.168.112.10:2000`
-Standalone (MongoDB 3.0) | `mongodb://192.168.112.10:2700`
-Standalone with SSL | `mongodb://192.168.112.10:2100`
-Standalone with Auth | `mongodb://root:toor@192.168.112.10:2200/?authSource=admin`
-Standalone with X509 Auth | `mongodb://C=US,ST=New York,L=New York City,O=MongoDB,OU=KernelUser,CN=client@192.168.112.10:2300/?authSource=$external&authMechanism=MONGODB-X509`
-Standalone with Plain Auth | `mongodb://root:toor@192.168.112.10:2400/?authSource=admin`
-Replicaset (MongoDB 4.0) | `mongodb://192.168.112.10:3000,192.168.112.10:3001,192.168.112.10:3002/?replicaSet=REPLICASET`
-Replicaset (MongoDB 3.0) | `mongodb://192.168.112.10:3100,192.168.112.10:3101,192.168.112.10:3102/?replicaSet=REPLICASET_30`
-Replicaset (MongoDB 3.6) | `mongodb://192.168.112.10:3200,192.168.112.10:3201,192.168.112.10:3202/?replicaSet=REPLICASET_36`
-
-The Vagrant images can be started by using:
-
-```
-$ make vm # Starts the test VMs with Vagrant
-$ make test-bootstrap # Starts the mongod servers within the test VM
-```
-
-After this set-up is completed, you need to export the `MONGODB_URI`
-environment variables with one of the values from the table above. The `test`
-make target may be used to execute the test suite:
-
-```
-$ make test # Executes the test suite against the VMs
-```
-
-To find out which VM servers are running at a later point in time, you can run
-`make test-bootstrap` to obtain a list of deployments and their URIs.
-
-#### Restarting Mongo Orchestration
-
-If something goes awry in the test VM, you can reload it by running:
-
-```
-make test-bootstrap
-```
-
-## Updating libmongoc, libbson, and libmongocrypt
-
-The PHP driver can use either system libraries or bundled versions of
-libmongoc, libbson, and libmongocrypt. If a new version of either library is
-available, the submodule and build configuration will need to be updated to
-reflect the new sources and/or package version.
-
-### Updating libmongoc and libbson
-
-#### Update libmongoc to the latest version
-
-```
-$ cd src/libmongoc
-$ git fetch
-$ git checkout 1.15.0
-```
-
-#### Ensure libmongoc version information is correct
-
-The build process for Autotools and Windows rely on
-`src/LIBMONGOC_VERSION_CURRENT` to infer version information for libmongoc and
-libbson. This file can be regenerated using the following Makefile target:
-
-```
-$ make libmongoc-version-current
-```
-
-Alternatively, the `build/calc_release_version.py` script in libmongoc can be
-executed directly.
-
-#### Update sources in build configurations
-
-The Autotools and Windows build configurations (`config.m4` and `config.w32`,
-respectively) define several variables (e.g. `PHP_MONGODB_MONGOC_SOURCES`) that
-collectively enumerate all of the the sources within the libmongoc submodule to
-include in a bundled build.
-
-These variables should each have a shell command in a preceding comment, which
-should be run to regenerate that particular list of source files. In the event
-that either libmongoc or libbson introduce a new source directory, that will
-need to be manually added (follow prior art).
-
-#### Update package dependencies
-
-The Autotools configuration additionally includes some `pkg-config` commands for
-using libmongoc and libbson as system libraries (in lieu of a bundled build).
-When bumping the libmongoc version, be sure to update the version check _and_
-error message in the `pkg-config` blocks for both libmongoc and libbson.
-
-For example, the following lines might be updated for libmongoc:
-
-```
-if $PKG_CONFIG libmongoc-1.0 --atleast-version 1.15.0; then
-
-...
-
-AC_MSG_ERROR(system libmongoc must be upgraded to version >= 1.15.0)
-```
-
-#### Update tested versions in evergreen configuration
-
-Evergreen tests against multiple versions of libmongoc. When updating to a newer
-libmongoc version, make sure to update the `libmongoc-version` build axis in
-`.evergreen/config.yml`. In general, we test against two additional versions of
-libmongoc:
-- The upcoming patch release of the current libmongoc minor version (e.g. the
- `r1.x` branch)
-- The upcoming minor release of libmongoc (e.g. the `master` branch)
-
-#### Update sources in PECL package generation script
-
-If either libmongoc or libbson introduce a new source directory, that may also
-require updating the glob patterns in the `bin/prep-release.php` script to
-ensure new source files will be included in any generated PECL package.
-
-#### Test and commit your changes
-
-Verify that the upgrade was successful by ensuring that the driver can compile
-using both the bundled sources and system libraries for libmongoc and libbson,
-and by ensuring that the test suite passes. Once done, commit the changes to all
-of the above files/paths. For example:
-
-```
-$ git commit -m "Bump libmongoc to 1.15.0" config.m4 config.w32 src/libmongoc src/LIBMONGOC_VERSION_CURRENT
-```
-
-### Updating libmongocrypt
-
-To update libmongocrypt, the steps are similar to the above:
-
-```
-$ cd src/libmongocrypt
-$ git fetch
-$ git checkout 1.0.1
-$ make libmongocrypt-version-current
-```
-
-Package dependencies in `config.m4` must also be updated, as do the sources in
-the PECL generation script.
-
-## Releasing
-
-The follow steps outline the release process for a maintenance branch (e.g.
-releasing the `vX.Y` branch as X.Y.Z).
-
-### Ensure PHP version compatibility
-
-Ensure that the extension compiles on PHP 5.6 through the latest PHP 7.x
-release. Be sure to test both ZTS and non-ZTS builds for PHP 5.x.
-
-### Ensure Windows compatibility
-
-PECL will create Windows DLLs for new releases; however, you must ensure that
-the extension successfully builds on Windows before releasing. Note that PHP 5.6
-requires VS2012, while PHP 7.x requires VS2015.
-
-Given the following assumptions:
-
- * Build directory is `C:\php-sdk\`
- * Compiling for PHP 5.6 (VS2012 x86 Native Tools Command Prompt is running)
- * Extension branch checked out in `C:\php-sdk\phpdev\vc11\x86\pecl\mongodb`
-
-The build process will resemble:
-
-```
-cd c:\php-sdk\
-bin\phpsdk_setvars.bat
-
-cd C:\php-sdk\phpdev\vc11\x86\php-5.6.12-src
-nmake clean
-buildconf --force
-configure --disable-all --with-openssl --enable-cli --enable-json --enable-mongodb=shared --with-mongodb-sasl=yes --with-mongodb-client-side-encryption=yes
-nmake
-```
-
-If the extension was successfully compiled, a `php_mongodb.dll` file should be
-generated in the build directory (e.g. `Release_TS`). You should then verify
-that the extension loads and executes properly:
-
-```
-cd Release_TS
-php.exe -d extension=./php_mongodb.dll -m
-php.exe -d extension=./php_mongodb.dll -r "var_dump(new MongoDB\Driver\Manager);"
-```
-
-See the [internals wiki](https://wiki.php.net/internals/windows/stepbystepbuild)
-for more information.
-
-### Transition JIRA issues and version
-
-All issues associated with the release version should be in the "Closed" state
-and have a resolution of "Fixed". Issues with other resolutions (e.g.
-"Duplicate", "Works as Designed") should be removed from the release version so
-that they do not appear in the release notes.
-
-Check the corresponding ".x" fix version to see if it contains any issues that
-are resolved as "Fixed" and should be included in this release version.
-
-Update the version's release date and status from the
-[Manage Versions](https://jira.mongodb.org/plugins/servlet/project-config/PHPC/versions)
-page.
-
-### Update version info
-
-The PHP driver uses [semantic versioning](http://semver.org/). Do not break
-backwards compatibility in a non-major release or your users will kill you.
-
-Before proceeding, ensure that the `master` branch is up-to-date with all code
-changes in this maintenance branch. This is important because we will later
-merge the ensuing release commits up to master with `--strategy=ours`, which
-will ignore changes from the merged commits.
-
-Update the version and stability constants in `phongo_version.h`. This should
-entail removing the version's "-dev" suffix, changing the stability to
-"stable", and increasing the last digit for `PHP_MONGO_VERSION_DESC`:
-
-```
-#define PHP_MONGODB_VERSION "1.1.8-dev"
-#define PHP_MONGODB_STABILITY "devel"
-#define PHP_MONGODB_VERSION_DESC 1,1,8,0
-```
-
-The above would be changed to:
-
-```
-#define PHP_MONGODB_VERSION "1.1.8"
-#define PHP_MONGODB_STABILITY "stable"
-#define PHP_MONGODB_VERSION_DESC 1,1,8,1
-```
-
-The Makefile targets for creating the PECL package depend on these constants, so
-you must rebuild the extension after updating `phongo_version.h`.
-
-> **Note:** If this is an alpha or beta release, the version string should
-> include the X.Y.Z version followed by the stability and an increment. For
-> instance, the first beta release in the 1.4.0 series would be "1.4.0beta1".
-> Alpha and beta releases use "alpha" and "beta" stability strings,
-> respectively. Release candidates (e.g. "1.4.0RC1") also use "beta" stability.
-> See [Documenting release stability and API stability](https://pear.php.net/manual/en/guide.developers.package2.stability.php)
-> for more information. For each change to the suffixes of
-> `PHP_MONGODB_VERSION`, increment the last digit of
-> `PHP_MONGODB_VERSION_DESC`.
-
-### Build PECL package
-
-Create the PECL package description file with `make package.xml`. This creates
-a `package.xml` file from a template. Version, author, and file information will
-be filled in, but release notes must be copied manually from JIRA.
-
-After copying release notes, use `make package` to create the package file (e.g.
-`mongodb-X.Y.Z.tgz`) and ensure that it can be successfully installed:
-
-```
-$ pecl install -f mongodb-X.Y.Z.tgz
-```
-
-### Commit version update and release notes
-
-Commit the modified `phongo_version.h` file as "Package X.Y.Z"
-
-```
-$ git add phongo_version.h
-$ git commit -m "Package X.Y.Z"
-```
-
-### Tag release
-
-The previous commit will be the target for our release tag:
-
-```
-$ git tag -a -m "Release X.Y.Z" X.Y.Z
-```
-
-### Update version info back to dev
-
-After tagging, the version and stability constants in `phongo_version.h` should be
-updated back to development status.
-
-```
-#define PHP_MONGODB_VERSION "1.1.8"
-#define PHP_MONGODB_STABILITY "stable"
-#define PHP_MONGODB_VERSION_DESC 1,1,8,1
-```
-
-The above would be changed to:
-
-```
-#define PHP_MONGODB_VERSION "1.1.9-dev"
-#define PHP_MONGODB_STABILITY "devel"
-#define PHP_MONGODB_VERSION_DESC 1,1,9,0
-```
-
-Commit this change:
-
-```
-$ git commit -m "Back to -dev" phongo_version.h
-```
-
-> **Note:** If this is an alpha, beta, or RC release, the version string should
-> increment the stability sequence instead of the patch version. For example,
-> if the constants were originally "1.4.0-dev" and "devel" and then changed to
-> "1.4.0beta1" and "beta" for the first beta release, this step would see them
-> ultimately changed to "1.4.0beta2-dev" and "devel".
-
-### Push commits and tags
-
-```
-$ git push
-$ git push --tags
-```
-
-### Release PECL package
-
-The PECL package may be published via the
-[Release Upload](https://pecl.php.net/release-upload.php) form. You will have
-one chance to confirm the package information after uploading.
-
-### Merge the maintenance branch up to master
-
-```
-$ git checkout master
-$ git merge vX.Y --strategy=ours
-$ git push
-```
-
-The `--strategy=ours` option ensures that all changes from the merged commits
-will be ignored.
-
-### Publish release notes
-
-The following template should be used for creating GitHub release notes via
-[this form](https://github.com/mongodb/mongo-php-driver/releases/new). The PECL
-package may also be attached to the release notes.
-
-```
-The PHP team is happy to announce that version X.Y.Z of the [mongodb](http://pecl.php.net/package/mongodb) PHP extension is now available on PECL.
-
-**Release Highlights**
-
-<one or more paragraphs describing important changes in this release>
-
-A complete list of resolved issues in this release may be found at:
-$JIRA_URL
-
-**Documentation**
-
-Documentation is available on PHP.net:
-http://php.net/set.mongodb
-
-**Feedback**
-
-We would appreciate any feedback you might have on the project:
-https://jira.mongodb.org/secure/CreateIssue.jspa?pid=12484&issuetype=6
-
-**Installation**
-
-You can either download and install the source manually, or you can install the extension with:
-
- pecl install mongodb
-
-or update with:
-
- pecl upgrade mongodb
-
-Windows binaries are available on PECL:
-http://pecl.php.net/package/mongodb
-```
-
-> **Note:** If this is an alpha or beta release, the installation examples
-> should append the stability to the package name (e.g. "mongodb-beta").
-
-The URL for the list of resolved JIRA issues will need to be updated with each
-release. You may obtain the list from
-[this form](https://jira.mongodb.org/secure/ReleaseNote.jspa?projectId=12484).
-
-If commits from community contributors were included in this release, append the
-following section:
-
-```
-**Thanks**
-
-Thanks for our community contributors for X.Y.Z:
-
- * [$CONTRIBUTOR_NAME](https://github.com/$GITHUB_USERNAME)
-```
-
-Release announcements should also be sent to the [MongoDB Product & Driver Announcements](https://community.mongodb.com/tags/c/community/release-notes/35/php-driver).
-
-Consider announcing each release on Twitter. Significant releases should also be
-announced via [@MongoDB](http://twitter.com/mongodb) as well.
diff --git a/mongodb-1.8.1/config.m4 b/mongodb-1.8.1/config.m4
deleted file mode 100644
index 3ebd922b..00000000
--- a/mongodb-1.8.1/config.m4
+++ /dev/null
@@ -1,518 +0,0 @@
-dnl config.m4 for extension mongodb
-PHP_ARG_ENABLE([mongodb],
- [whether to enable MongoDB support],
- [AS_HELP_STRING([--enable-mongodb],
- [Enable MongoDB support])])
-
-if test "$PHP_MONGODB" != "no"; then
- dnl Check PHP version is compatible with this extension
- AC_MSG_CHECKING([PHP version])
-
- PHP_MONGODB_PHP_VERSION=$PHP_VERSION
- PHP_MONGODB_PHP_VERSION_ID=$PHP_VERSION_ID
-
- if test -z "$PHP_MONGODB_PHP_VERSION"; then
- if test -z "$PHP_CONFIG"; then
- AC_MSG_ERROR([php-config not found])
- fi
- PHP_MONGODB_PHP_VERSION=`${PHP_CONFIG} --version`
- PHP_MONGODB_PHP_VERSION_ID=`echo "${PHP_MONGODB_PHP_VERSION}" | $AWK 'BEGIN { FS = "."; } { printf "%d", ([$]1 * 100 + [$]2) * 100 + [$]3;}'`
- fi
-
- AC_MSG_RESULT($PHP_MONGODB_PHP_VERSION)
- if test "$PHP_MONGODB_PHP_VERSION_ID" -lt "70000"; then
- AC_MSG_ERROR([not supported. Need a PHP version >= 7.0.0 (found $PHP_MONGODB_PHP_VERSION)])
- fi
-
- PHP_ARG_ENABLE([mongodb-developer-flags],
- [whether to enable developer build flags],
- [AS_HELP_STRING([--enable-mongodb-developer-flags],
- [MongoDB: Enable developer flags [default=no]])],
- [no],
- [no])
-
- if test "$PHP_MONGODB_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(-Wpointer-bool-conversion, _MAINTAINER_CFLAGS="$_MAINTAINER_CFLAGS -Wpointer-bool-conversion")
- 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(-Wmaybe-uninitialized, _MAINTAINER_CFLAGS="$_MAINTAINER_CFLAGS -Wmaybe-uninitialized")
- PHP_CHECK_GCC_ARG(-Wimplicit-fallthrough, _MAINTAINER_CFLAGS="$_MAINTAINER_CFLAGS -Wimplicit-fallthrough")
- 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")
-
- MAINTAINER_CFLAGS="$_MAINTAINER_CFLAGS"
- STD_CFLAGS="-g -O0 -Wall"
- fi
-
-
- PHP_ARG_ENABLE([mongodb-coverage],
- [whether to enable code coverage],
- [AS_HELP_STRING([--enable-mongodb-coverage],
- [MongoDB: Enable developer code coverage information [default=no]])],
- [no],
- [no])
-
- if test "$PHP_MONGODB_COVERAGE" = "yes"; then
- if test "$ext_shared" != "yes"; then
- AC_MSG_ERROR(code coverage is not supported for static builds)
- fi
-
- COVERAGE_CFLAGS="--coverage -g"
- COVERAGE_LDFLAGS="--coverage"
-
- MONGODB_SHARED_LIBADD="$MONGODB_SHARED_LIBADD $COVERAGE_LDFLAGS"
- fi
-
- PHP_MONGODB_CFLAGS="$STD_CFLAGS $MAINTAINER_CFLAGS $COVERAGE_CFLAGS"
-
- PHP_MONGODB_SOURCES="\
- php_phongo.c \
- phongo_compat.c \
- src/bson.c \
- src/bson-encode.c \
- src/BSON/Binary.c \
- src/BSON/BinaryInterface.c \
- src/BSON/DBPointer.c \
- src/BSON/Decimal128.c \
- src/BSON/Decimal128Interface.c \
- src/BSON/Int64.c \
- src/BSON/Javascript.c \
- src/BSON/JavascriptInterface.c \
- src/BSON/MaxKey.c \
- src/BSON/MaxKeyInterface.c \
- src/BSON/MinKey.c \
- src/BSON/MinKeyInterface.c \
- src/BSON/ObjectId.c \
- src/BSON/ObjectIdInterface.c \
- src/BSON/Persistable.c \
- src/BSON/Regex.c \
- src/BSON/RegexInterface.c \
- src/BSON/Serializable.c \
- src/BSON/Symbol.c \
- src/BSON/Timestamp.c \
- src/BSON/TimestampInterface.c \
- src/BSON/Type.c \
- src/BSON/Undefined.c \
- src/BSON/Unserializable.c \
- src/BSON/UTCDateTime.c \
- src/BSON/UTCDateTimeInterface.c \
- src/BSON/functions.c \
- src/MongoDB/BulkWrite.c \
- src/MongoDB/ClientEncryption.c \
- src/MongoDB/Command.c \
- src/MongoDB/Cursor.c \
- src/MongoDB/CursorId.c \
- src/MongoDB/CursorInterface.c \
- src/MongoDB/Manager.c \
- src/MongoDB/Query.c \
- src/MongoDB/ReadConcern.c \
- src/MongoDB/ReadPreference.c \
- src/MongoDB/Server.c \
- src/MongoDB/Session.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/CommandException.c \
- src/MongoDB/Exception/ConnectionException.c \
- src/MongoDB/Exception/ConnectionTimeoutException.c \
- src/MongoDB/Exception/EncryptionException.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/ServerException.c \
- src/MongoDB/Exception/SSLConnectionException.c \
- src/MongoDB/Exception/UnexpectedValueException.c \
- src/MongoDB/Exception/WriteException.c \
- src/MongoDB/Monitoring/CommandFailedEvent.c \
- src/MongoDB/Monitoring/CommandStartedEvent.c \
- src/MongoDB/Monitoring/CommandSubscriber.c \
- src/MongoDB/Monitoring/CommandSucceededEvent.c \
- src/MongoDB/Monitoring/Subscriber.c \
- src/MongoDB/Monitoring/functions.c \
- "
-
- PHP_ARG_WITH([mongodb-system-libs],
- [whether to compile against system libraries instead of bundled],
- [AS_HELP_STRING([--with-mongodb-system-libs=@<:@yes/no@:>@],
- [MongoDB: Use system libraries for libbson, libmongoc, and libmongocrypt [default=no]])],
- [no],
- [no])
- PHP_ARG_WITH([libbson],
- [whether to use system libbson],
- [AS_HELP_STRING([--with-libbson=@<:@yes/no@:>@],
- [MongoDB: Use system libbson [default=no]])],
- [no],
- [no])
- PHP_ARG_WITH([libmongoc],
- [whether to use system libmongoc],
- [AS_HELP_STRING([--with-libmongoc=@<:@yes/no@:>@],
- [MongoDB: Use system libmongoc [default=no]])],
- [no],
- [no])
- PHP_ARG_WITH([mongodb-client-side-encryption],
- [whether to enable client-side encryption],
- [AS_HELP_STRING([--with-mongodb-client-side-encryption=@<:@auto/yes/no@:>@],
- [MongoDB: Enable client-side encryption [default=auto]])],
- [auto],
- [no])
-
- if test "$PHP_LIBBSON" != "no"; then
- AC_MSG_WARN(Using --with-libbson is deprecated and will be removed in a future version. Please use --with-system-libs instead)
-
- if test "$PHP_LIBMONGOC" = "no"; then
- AC_MSG_ERROR(Cannot use system libbson and bundled libmongoc)
- fi
-
- PHP_MONGODB_SYSTEM_LIBS="yes"
- fi
-
- if test "$PHP_LIBMONGOC" != "no"; then
- AC_MSG_WARN(Using --with-libmongoc is deprecated and will be removed in a future version. Please use --with-system-libs instead)
-
- if test "$PHP_LIBBSON" = "no"; then
- AC_MSG_ERROR(Cannot use system libmongoc and bundled libbson)
- fi
-
- PHP_MONGODB_SYSTEM_LIBS="yes"
- fi
-
- if test "$PHP_MONGODB_SYSTEM_LIBS" != "no"; then
- 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.17.0; then
- PHP_MONGODB_BSON_CFLAGS=`$PKG_CONFIG libbson-1.0 --cflags`
- PHP_MONGODB_BSON_LIBS=`$PKG_CONFIG libbson-1.0 --libs`
- PHP_MONGODB_BSON_VERSION=`$PKG_CONFIG libbson-1.0 --modversion`
- AC_MSG_RESULT(version $PHP_MONGODB_BSON_VERSION found)
- else
- AC_MSG_ERROR(system libbson must be upgraded to version >= 1.17.0)
- fi
- else
- AC_MSG_ERROR(pkgconfig and libbson must be installed)
- fi
- PHP_MONGODB_CFLAGS="$PHP_MONGODB_CFLAGS $PHP_MONGODB_BSON_CFLAGS"
- PHP_EVAL_LIBLINE($PHP_MONGODB_BSON_LIBS, MONGODB_SHARED_LIBADD)
- AC_DEFINE(HAVE_SYSTEM_LIBBSON, 1, [Use system libbson])
-
- 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.17.0; then
- PHP_MONGODB_MONGOC_CFLAGS=`$PKG_CONFIG libmongoc-1.0 --cflags`
- PHP_MONGODB_MONGOC_LIBS=`$PKG_CONFIG libmongoc-1.0 --libs`
- PHP_MONGODB_MONGOC_VERSION=`$PKG_CONFIG libmongoc-1.0 --modversion`
- AC_MSG_RESULT(version $PHP_MONGODB_MONGOC_VERSION found)
- else
- AC_MSG_ERROR(system libmongoc must be upgraded to version >= 1.17.0)
- fi
- else
- AC_MSG_ERROR(pkgconfig and libmongoc must be installed)
- fi
- PHP_MONGODB_CFLAGS="$PHP_MONGODB_CFLAGS $PHP_MONGODB_MONGOC_CFLAGS"
- PHP_EVAL_LIBLINE($PHP_MONGODB_MONGOC_LIBS, MONGODB_SHARED_LIBADD)
- AC_DEFINE(HAVE_SYSTEM_LIBMONGOC, 1, [Use system libmongoc])
-
- if test "$PHP_MONGODB_CLIENT_SIDE_ENCRYPTION" != "no"; then
- AC_MSG_CHECKING(for libmongocrypt)
-
- if test -x "$PKG_CONFIG" && $PKG_CONFIG --exists libmongocrypt; then
- if $PKG_CONFIG libmongocrypt --atleast-version 1.0.4; then
- PHP_MONGODB_MONGOCRYPT_CFLAGS=`$PKG_CONFIG libmongocrypt --cflags`
- PHP_MONGODB_MONGOCRYPT_LIBS=`$PKG_CONFIG libmongocrypt --libs`
- PHP_MONGODB_MONGOCRYPT_VERSION=`$PKG_CONFIG libmongocrypt --modversion`
- AC_MSG_RESULT(version $PHP_MONGODB_MONGOCRYPT_VERSION found)
-
- PHP_MONGODB_CFLAGS="$PHP_MONGODB_CFLAGS $PHP_MONGODB_MONGOCRYPT_CFLAGS"
- PHP_EVAL_LIBLINE($PHP_MONGODB_MONGOCRYPT_LIBS, MONGODB_SHARED_LIBADD)
- AC_DEFINE(HAVE_SYSTEM_LIBMONGOCRYPT, 1, [Use system libmongocrypt])
- elif test "$PHP_MONGODB_CLIENT_SIDE_ENCRYPTION" = "yes"; then
- AC_MSG_ERROR(system libmongocrypt must be upgraded to version >= 1.0.4)
- else
- AC_MSG_RESULT(found an older version, compiling without client-side encryption)
- fi
- else
- if test "$PHP_MONGODB_CLIENT_SIDE_ENCRYPTION" = "yes"; then
- AC_MSG_ERROR(pkgconfig and libmongocrypt must be installed)
- else
- AC_MSG_RESULT(not found, compiling without client-side encryption)
- fi
- fi
- fi
- fi
-
- if test "$PHP_MONGODB_SYSTEM_LIBS" = "no"; then
- PHP_MONGODB_BUNDLED_CFLAGS="$STD_CFLAGS -DBSON_COMPILATION -DMONGOC_COMPILATION"
- dnl TODO: MONGOCRYPT-219 makes the -std argument obsolete
- PHP_MONGODB_LIBMONGOCRYPT_CFLAGS="-DKMS_MSG_STATIC -std=gnu99"
-
- dnl M4 doesn't know if we're building statically or as a shared module, so
- dnl attempt to include both paths while ignoring errors. If neither path
- dnl exists, report an error during configure (this is later than M4 parsing
- dnl during phpize but better than nothing).
- m4_pushdef([_include],[
- dnl TODO: Fix this for PECL install (PHPC-1218)
- dnl if test ! \( -f "$1" -o -f "ext/mongodb/$1" \); then
- dnl AC_MSG_ERROR([m4 could not include $1: No such file or directory])
- dnl fi
- m4_builtin([sinclude],[$1])
- m4_builtin([sinclude],[ext/mongodb/][$1])
- ])
-
- dnl Avoid using AC_CONFIG_MACRO_DIR, which might conflict with PHP
- _include([scripts/autotools/m4/as_var_copy.m4])
- _include([scripts/autotools/m4/ax_check_compile_flag.m4])
- _include([scripts/autotools/m4/ax_prototype.m4])
- _include([scripts/autotools/m4/ax_pthread.m4])
- _include([scripts/autotools/m4/php_mongodb.m4])
- _include([scripts/autotools/m4/pkg.m4])
-
- _include([scripts/autotools/CheckCompiler.m4])
- _include([scripts/autotools/CheckHost.m4])
-
- _include([scripts/autotools/libbson/CheckAtomics.m4])
- _include([scripts/autotools/libbson/CheckHeaders.m4])
- _include([scripts/autotools/libbson/Endian.m4])
- _include([scripts/autotools/libbson/FindDependencies.m4])
- _include([scripts/autotools/libbson/Versions.m4])
-
- _include([scripts/autotools/libmongoc/CheckCompression.m4])
- _include([scripts/autotools/libmongoc/CheckResolv.m4])
- _include([scripts/autotools/libmongoc/CheckSasl.m4])
- _include([scripts/autotools/libmongoc/CheckSSL.m4])
- _include([scripts/autotools/libmongoc/CheckICU.m4])
- _include([scripts/autotools/libmongoc/FindDependencies.m4])
- _include([scripts/autotools/libmongoc/PlatformFlags.m4])
- _include([scripts/autotools/libmongoc/Versions.m4])
- _include([scripts/autotools/libmongoc/WeakSymbols.m4])
-
- dnl This include modifies the value of $PHP_MONGODB_CLIENT_SIDE_ENCRYPTION to "yes"
- dnl or "no" depending on whether dependencies for libmongocrypt are fulfilled
- _include([scripts/autotools/libmongocrypt/CheckSSL.m4])
- _include([scripts/autotools/libmongocrypt/Version.m4])
-
- m4_popdef([_include])
-
- AC_SUBST(BSON_EXTRA_ALIGN, 0)
- AC_SUBST(BSON_OS, 1)
-
- AC_SUBST(MONGOC_NO_AUTOMATIC_GLOBALS, 1)
- AC_SUBST(MONGOC_ENABLE_MONGODB_AWS_AUTH, 0)
- AC_SUBST(MONGOC_ENABLE_RDTSCP, 0)
- AC_SUBST(MONGOC_ENABLE_SHM_COUNTERS, 0)
- AC_SUBST(MONGOC_TRACE, 1)
-
- dnl Assignments for metadata handshake. Leave CFLAGS/LDFLAGS empty as they
- dnl would likely cause platform info (PHP version) to be truncated. We can
- dnl consider restoring CFLAGS/LDFLAGS once CDRIVER-3134 is resolved.
- AC_SUBST(MONGOC_CC, [$CC])
- AC_SUBST(MONGOC_USER_SET_CFLAGS, [])
- AC_SUBST(MONGOC_USER_SET_LDFLAGS, [])
-
- if test "$PHP_MONGODB_CLIENT_SIDE_ENCRYPTION" = "yes"; then
- AC_SUBST(MONGOC_ENABLE_CLIENT_SIDE_ENCRYPTION, 1)
- else
- AC_SUBST(MONGOC_ENABLE_CLIENT_SIDE_ENCRYPTION, 0)
- fi
-
- dnl On MacOS, use gcut from the coreutils brew package instead of cut
- dnl Generated with: find src/libmongoc/src/common -name '*.c' -print0 | cut -sz -d / -f 5- | sort -dz | tr '\000' ' '
- PHP_MONGODB_COMMON_SOURCES="common-b64.c common-md5.c common-thread.c"
-
- dnl Generated with: find src/libmongoc/src/kms-message/src -maxdepth 1 -name '*.c' -print0 | cut -sz -d / -f 6- | sort -dz | tr '\000' ' '
- PHP_MONGODB_KMS_MESSAGE_SOURCES="hexlify.c kms_b64.c kms_caller_identity_request.c kms_crypto_apple.c kms_crypto_libcrypto.c kms_crypto_none.c kms_crypto_windows.c kms_decrypt_request.c kms_encrypt_request.c kms_kv_list.c kms_message.c kms_port.c kms_request.c kms_request_opt.c kms_request_str.c kms_response.c kms_response_parser.c sort.c"
-
- dnl Generated with: find src/libmongoc/src/libbson/src/bson -name '*.c' -print0 | cut -sz -d / -f 7- | sort -dz | 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"
-
- dnl Generated with: find src/libmongoc/src/libbson/src/jsonsl -name '*.c' -print0 | cut -sz -d / -f 7- | sort -dz | tr '\000' ' '
- PHP_MONGODB_JSONSL_SOURCES="jsonsl.c"
-
- dnl Generated with: find src/libmongoc/src/libmongoc/src/mongoc -name '*.c' -print0 | cut -sz -d / -f 7- | sort -dz | tr '\000' ' '
- PHP_MONGODB_MONGOC_SOURCES="mongoc-aggregate.c mongoc-apm.c mongoc-array.c mongoc-async.c mongoc-async-cmd.c mongoc-buffer.c mongoc-bulk-operation.c mongoc-change-stream.c mongoc-client.c mongoc-client-pool.c mongoc-client-session.c mongoc-client-side-encryption.c mongoc-cluster-aws.c mongoc-cluster.c mongoc-cluster-cyrus.c mongoc-cluster-sasl.c mongoc-cluster-sspi.c mongoc-cmd.c mongoc-collection.c mongoc-compression.c mongoc-counters.c mongoc-crypt.c mongoc-crypto.c mongoc-crypto-cng.c mongoc-crypto-common-crypto.c mongoc-crypto-openssl.c mongoc-cursor-array.c mongoc-cursor.c mongoc-cursor-change-stream.c mongoc-cursor-cmd.c mongoc-cursor-cmd-deprecated.c mongoc-cursor-find.c mongoc-cursor-find-cmd.c mongoc-cursor-find-opquery.c mongoc-cursor-legacy.c mongoc-cyrus.c mongoc-database.c mongoc-error.c mongoc-find-and-modify.c mongoc-gridfs-bucket.c mongoc-gridfs-bucket-file.c mongoc-gridfs.c mongoc-gridfs-file.c mongoc-gridfs-file-list.c mongoc-gridfs-file-page.c mongoc-handshake.c mongoc-host-list.c mongoc-http.c mongoc-index.c mongoc-init.c mongoc-interrupt.c mongoc-libressl.c mongoc-linux-distro-scanner.c mongoc-list.c mongoc-log.c mongoc-matcher.c mongoc-matcher-op.c mongoc-memcmp.c mongoc-ocsp-cache.c mongoc-openssl.c mongoc-opts.c mongoc-opts-helpers.c mongoc-queue.c mongoc-rand-cng.c mongoc-rand-common-crypto.c mongoc-rand-openssl.c mongoc-read-concern.c mongoc-read-prefs.c mongoc-rpc.c mongoc-sasl.c mongoc-scram.c mongoc-secure-channel.c mongoc-secure-transport.c mongoc-server-description.c mongoc-server-monitor.c mongoc-server-stream.c mongoc-set.c mongoc-socket.c mongoc-ssl.c mongoc-sspi.c mongoc-stream-buffered.c mongoc-stream.c mongoc-stream-file.c mongoc-stream-gridfs.c mongoc-stream-gridfs-download.c mongoc-stream-gridfs-upload.c mongoc-stream-socket.c mongoc-stream-tls.c mongoc-stream-tls-libressl.c mongoc-stream-tls-openssl-bio.c mongoc-stream-tls-openssl.c mongoc-stream-tls-secure-channel.c mongoc-stream-tls-secure-transport.c mongoc-topology-background-monitoring.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-command-legacy.c mongoc-write-concern.c"
-
- dnl Generated with: find src/libmongoc/src/zlib-1.2.11 -maxdepth 1 -name '*.c' -print0 | cut -sz -d / -f 5- | sort -dz | tr '\000' ' '
- PHP_MONGODB_ZLIB_SOURCES="adler32.c compress.c crc32.c deflate.c gzclose.c gzlib.c gzread.c gzwrite.c infback.c inffast.c inflate.c inftrees.c trees.c uncompr.c zutil.c"
-
- PHP_MONGODB_ADD_SOURCES([src/libmongoc/src/common/], $PHP_MONGODB_COMMON_SOURCES, $PHP_MONGODB_BUNDLED_CFLAGS)
- PHP_MONGODB_ADD_SOURCES([src/libmongoc/src/libbson/src/bson/], $PHP_MONGODB_BSON_SOURCES, $PHP_MONGODB_BUNDLED_CFLAGS)
- PHP_MONGODB_ADD_SOURCES([src/libmongoc/src/libbson/src/jsonsl/], $PHP_MONGODB_JSONSL_SOURCES, $PHP_MONGODB_BUNDLED_CFLAGS)
- PHP_MONGODB_ADD_SOURCES([src/libmongoc/src/libmongoc/src/mongoc/], $PHP_MONGODB_MONGOC_SOURCES, $PHP_MONGODB_BUNDLED_CFLAGS)
-
- PHP_MONGODB_ADD_INCLUDE([src/libmongoc/src/common/])
- PHP_MONGODB_ADD_INCLUDE([src/libmongoc/src/libbson/src/])
- PHP_MONGODB_ADD_INCLUDE([src/libmongoc/src/libbson/src/jsonsl/])
- PHP_MONGODB_ADD_INCLUDE([src/libmongoc/src/libmongoc/src/])
-
- PHP_MONGODB_ADD_BUILD_DIR([src/libmongoc/src/common/])
- PHP_MONGODB_ADD_BUILD_DIR([src/libmongoc/src/libbson/src/bson/])
- PHP_MONGODB_ADD_BUILD_DIR([src/libmongoc/src/libbson/src/jsonsl/])
- PHP_MONGODB_ADD_BUILD_DIR([src/libmongoc/src/libmongoc/src/mongoc/])
-
- dnl If compiling without libmongocrypt, use kms_message sources bundled with libmongoc.
- dnl If compiling with libmongocrypt, kms_message bundled with libmongocrypt is used as it is most likely newer.
- if test "$PHP_MONGODB_CLIENT_SIDE_ENCRYPTION" != "yes" && test "$PHP_MONGODB_SSL" != "no"; then
- AC_SUBST(MONGOC_ENABLE_MONGODB_AWS_AUTH, 1)
- PHP_MONGODB_ADD_SOURCES([src/libmongoc/src/kms-message/src/], $PHP_MONGODB_KMS_MESSAGE_SOURCES, $PHP_MONGODB_BUNDLED_CFLAGS)
- PHP_MONGODB_ADD_INCLUDE([src/libmongoc/src/kms-message/src/])
- PHP_MONGODB_ADD_BUILD_DIR([src/libmongoc/src/kms-message/src/])
- fi
-
- dnl TODO: Use $ext_srcdir if we can move this after PHP_NEW_EXTENSION
- ac_config_dir=PHP_EXT_SRCDIR(mongodb)
-
- AC_CONFIG_FILES([
- ${ac_config_dir}/src/libmongoc/src/libbson/src/bson/bson-config.h
- ${ac_config_dir}/src/libmongoc/src/libbson/src/bson/bson-version.h
- ${ac_config_dir}/src/libmongoc/src/libmongoc/src/mongoc/mongoc-config.h
- ${ac_config_dir}/src/libmongoc/src/libmongoc/src/mongoc/mongoc-version.h
- ])
-
- if test "x$bundled_zlib" = "xyes"; then
- PHP_MONGODB_ZLIB_CFLAGS="$PHP_MONGODB_BUNDLED_CFLAGS"
- AC_CHECK_HEADER([unistd.h], [PHP_MONGODB_ZLIB_CFLAGS="$PHP_MONGODB_ZLIB_CFLAGS -DHAVE_UNISTD_H=1"], [])
- PHP_MONGODB_ADD_SOURCES([src/libmongoc/src/zlib-1.2.11/], $PHP_MONGODB_ZLIB_SOURCES, $PHP_MONGODB_ZLIB_CFLAGS)
- PHP_MONGODB_ADD_INCLUDE([src/libmongoc/src/zlib-1.2.11/])
- PHP_MONGODB_ADD_BUILD_DIR([src/libmongoc/src/zlib-1.2.11/])
- AC_CONFIG_FILES([${ac_config_dir}/src/libmongoc/src/zlib-1.2.11/zconf.h])
- fi
-
- if test "$PHP_MONGODB_CLIENT_SIDE_ENCRYPTION" = "yes"; then
- dnl Since libmongocrypt adds kms-message, we can enable AWS auth in this case
- AC_SUBST(MONGOC_ENABLE_MONGODB_AWS_AUTH, 1)
- AC_SUBST(MONGOCRYPT_ENABLE_TRACE, 1)
-
- dnl Generated with: find src/libmongocrypt/src -maxdepth 1 -name '*.c' -print0 | cut -sz -d / -f 4- | sort -dz | tr '\000' ' '
- PHP_MONGODB_MONGOCRYPT_SOURCES="mongocrypt-binary.c mongocrypt-buffer.c mongocrypt.c mongocrypt-cache.c mongocrypt-cache-collinfo.c mongocrypt-cache-key.c mongocrypt-ciphertext.c mongocrypt-crypto.c mongocrypt-ctx.c mongocrypt-ctx-datakey.c mongocrypt-ctx-decrypt.c mongocrypt-ctx-encrypt.c mongocrypt-key-broker.c mongocrypt-key.c mongocrypt-kms-ctx.c mongocrypt-log.c mongocrypt-marking.c mongocrypt-opts.c mongocrypt-status.c mongocrypt-traverse-util.c"
-
- dnl Generated with: find src/libmongocrypt/src/crypto -name '*.c' -print0 | cut -sz -d / -f 5- | sort -dz | tr '\000' ' '
- PHP_MONGODB_MONGOCRYPT_CRYPTO_SOURCES="cng.c commoncrypto.c libcrypto.c none.c"
-
- dnl Generated with: find src/libmongocrypt/src/os_posix -name '*.c' -print0 | cut -sz -d / -f 5- | sort -dz | tr '\000' ' '
- PHP_MONGODB_MONGOCRYPT_OS_POSIX_SOURCES="os_mutex.c os_once.c"
-
- dnl Generated with: find src/libmongocrypt/src/os_win -name '*.c' -print0 | cut -sz -d / -f 5- | sort -dz | tr '\000' ' '
- PHP_MONGODB_MONGOCRYPT_OS_WIN_SOURCES="os_mutex.c os_once.c"
-
- dnl Generated with: find src/libmongocrypt/kms-message/src -maxdepth 1 -name '*.c' -print0 | cut -sz -d / -f 5- | sort -dz | tr '\000' ' '
- PHP_MONGODB_MONGOCRYPT_KMS_MESSAGE_SOURCES="hexlify.c kms_b64.c kms_caller_identity_request.c kms_crypto_apple.c kms_crypto_libcrypto.c kms_crypto_none.c kms_crypto_windows.c kms_decrypt_request.c kms_encrypt_request.c kms_kv_list.c kms_message.c kms_port.c kms_request.c kms_request_opt.c kms_request_str.c kms_response.c kms_response_parser.c sort.c"
-
- PHP_MONGODB_LIBMONGOCRYPT_CFLAGS="$PHP_MONGODB_BUNDLED_CFLAGS $PHP_MONGODB_LIBMONGOCRYPT_CFLAGS"
- PHP_MONGODB_ADD_SOURCES([src/libmongocrypt/src/], $PHP_MONGODB_MONGOCRYPT_SOURCES, $PHP_MONGODB_LIBMONGOCRYPT_CFLAGS)
- PHP_MONGODB_ADD_SOURCES([src/libmongocrypt/src/crypto/], $PHP_MONGODB_MONGOCRYPT_CRYPTO_SOURCES, $PHP_MONGODB_LIBMONGOCRYPT_CFLAGS)
- PHP_MONGODB_ADD_SOURCES([src/libmongocrypt/src/os_posix/], $PHP_MONGODB_MONGOCRYPT_OS_POSIX_SOURCES, $PHP_MONGODB_LIBMONGOCRYPT_CFLAGS)
- PHP_MONGODB_ADD_SOURCES([src/libmongocrypt/src/os_win/], $PHP_MONGODB_MONGOCRYPT_OS_WIN_SOURCES, $PHP_MONGODB_LIBMONGOCRYPT_CFLAGS)
- PHP_MONGODB_ADD_SOURCES([src/libmongocrypt/kms-message/src/], $PHP_MONGODB_MONGOCRYPT_KMS_MESSAGE_SOURCES, $PHP_MONGODB_LIBMONGOCRYPT_CFLAGS)
-
- PHP_MONGODB_ADD_INCLUDE([src/libmongocrypt/src/])
- PHP_MONGODB_ADD_INCLUDE([src/libmongocrypt/kms-message/src/])
- PHP_MONGODB_ADD_INCLUDE([src/libmongocrypt-compat/])
-
- PHP_MONGODB_ADD_BUILD_DIR([src/libmongocrypt/src/])
- PHP_MONGODB_ADD_BUILD_DIR([src/libmongocrypt/src/crypto/])
- PHP_MONGODB_ADD_BUILD_DIR([src/libmongocrypt/src/os_posix/])
- PHP_MONGODB_ADD_BUILD_DIR([src/libmongocrypt/src/os_win/])
- PHP_MONGODB_ADD_BUILD_DIR([src/libmongocrypt/kms-message/src/])
-
- AC_CONFIG_FILES([
- ${ac_config_dir}/src/libmongocrypt/src/mongocrypt-config.h
- ${ac_config_dir}/src/libmongocrypt/src/mongocrypt.h
- ])
- fi
- fi
-
- PHP_NEW_EXTENSION(mongodb, $PHP_MONGODB_SOURCES, $ext_shared,, $PHP_MONGODB_CFLAGS)
-
- PHP_SUBST(MONGODB_SHARED_LIBADD)
-
- 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(PHP_EXT_SRCDIR(mongodb)[/src/BSON/])
- PHP_ADD_INCLUDE(PHP_EXT_SRCDIR(mongodb)[/src/MongoDB/])
- PHP_ADD_INCLUDE(PHP_EXT_SRCDIR(mongodb)[/src/MongoDB/Exception/])
- PHP_ADD_INCLUDE(PHP_EXT_SRCDIR(mongodb)[/src/MongoDB/Monitoring/])
- PHP_ADD_INCLUDE(PHP_EXT_SRCDIR(mongodb)[/src/contrib/])
-
- PHP_ADD_BUILD_DIR(PHP_EXT_BUILDDIR(mongodb)[/src/BSON/])
- PHP_ADD_BUILD_DIR(PHP_EXT_BUILDDIR(mongodb)[/src/MongoDB/])
- PHP_ADD_BUILD_DIR(PHP_EXT_BUILDDIR(mongodb)[/src/MongoDB/Exception/])
- PHP_ADD_BUILD_DIR(PHP_EXT_BUILDDIR(mongodb)[/src/MongoDB/Monitoring/])
- PHP_ADD_BUILD_DIR(PHP_EXT_BUILDDIR(mongodb)[/src/contrib/])
-
- dnl Necessary to ensure that static builds include "-pthread" when linking
- if test "$ext_shared" != "yes"; then
- EXTRA_LDFLAGS_PROGRAM="$EXTRA_LDFLAGS_PROGRAM $EXTRA_LDFLAGS"
- fi
-
- dnl This must come after PHP_NEW_EXTENSION, otherwise the srcdir won't be set
- PHP_ADD_MAKEFILE_FRAGMENT
-
- dnl The libmongocrypt line intentionally uses the PHP_LIBBSON flag as that decides whether to build against bundled or system libraries.
- AC_CONFIG_COMMANDS_POST([
- if test "$enable_static" = "no"; then
- 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 libmongoc : $PHP_MONGODB_SYSTEM_LIBS
- System libbson : $PHP_MONGODB_SYSTEM_LIBS
- System libmongocrypt : $PHP_MONGODB_SYSTEM_LIBS
- LDFLAGS : $LDFLAGS
- EXTRA_LDFLAGS : $EXTRA_LDFLAGS
- MONGODB_SHARED_LIBADD : $MONGODB_SHARED_LIBADD
-
-Please submit bugreports at:
- https://jira.mongodb.org/browse/PHPC
-
-"
- fi
- ])
-fi
-
-dnl: vim: et sw=2
diff --git a/mongodb-1.8.1/config.w32 b/mongodb-1.8.1/config.w32
deleted file mode 100644
index 9b5c327c..00000000
--- a/mongodb-1.8.1/config.w32
+++ /dev/null
@@ -1,361 +0,0 @@
-// 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;
-}
-
-function create_folder_recursive(path)
-{
- if (FSO.FolderExists(path)) {
- return;
- }
-
- create_folder_recursive(FSO.GetParentFolderName(path));
- FSO.CreateFolder(path);
-}
-
-function MONGODB_ADD_SOURCES(dir, file_list)
-{
- // Ensure obj_dir and all parent directories exist
- create_folder_recursive(FSO.BuildPath(get_define('BUILD_DIR'), dir));
- ADD_SOURCES(configure_module_dirname + dir, file_list, "mongodb", dir);
-}
-
-ARG_ENABLE("mongodb", "MongoDB support", "no");
-ARG_WITH("mongodb-sasl", "MongoDB: Build against Cyrus-SASL", "yes");
-ARG_WITH("mongodb-client-side-encryption", "MongoDB: Enable client-side encryption", "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);
-
- var PHP_MONGODB_CFLAGS="\
- /D BSON_COMPILATION /D MONGOC_COMPILATION \
- /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/libmongoc/src/common \
- /I" + configure_module_dirname + "/src/libmongoc/src/libbson/src \
- /I" + configure_module_dirname + "/src/libmongoc/src/libbson/src/jsonsl \
- /I" + configure_module_dirname + "/src/libmongoc/src/libmongoc/src \
- ";
-
- // Condense whitespace in CFLAGS
- PHP_MONGODB_CFLAGS = PHP_MONGODB_CFLAGS.replace(/\s+/g, ' ');
-
- // On MacOS, use gcut from the coreutils brew package instead of cut
- // Generated with: find src/libmongoc/src/common -name '*.c' -print0 | cut -sz -d / -f 5- | sort -dz | tr '\000' ' '
- var PHP_MONGODB_COMMON_SOURCES="common-b64.c common-md5.c common-thread.c"
-
- // Generated with: find src/libmongoc/src/kms-message/src -maxdepth 1 -name '*.c' -print0 | cut -sz -d / -f 6- | sort -dz | tr '\000' ' '
- var PHP_MONGODB_KMS_MESSAGE_SOURCES="hexlify.c kms_b64.c kms_caller_identity_request.c kms_crypto_apple.c kms_crypto_libcrypto.c kms_crypto_none.c kms_crypto_windows.c kms_decrypt_request.c kms_encrypt_request.c kms_kv_list.c kms_message.c kms_port.c kms_request.c kms_request_opt.c kms_request_str.c kms_response.c kms_response_parser.c sort.c";
-
- // Generated with: find src/libmongoc/src/libbson/src/bson -name '*.c' -print0 | cut -sz -d / -f 7- | sort -dz | 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/libmongoc/src/libbson/src/jsonsl -name '*.c' -print0 | cut -sz -d / -f 7- | sort -dz | tr '\000' ' '
- var PHP_MONGODB_JSONSL_SOURCES="jsonsl.c";
-
- // Generated with: find src/libmongoc/src/libmongoc/src/mongoc -name '*.c' -print0 | cut -sz -d / -f 7- | sort -dz | tr '\000' ' '
- var PHP_MONGODB_MONGOC_SOURCES="mongoc-aggregate.c mongoc-apm.c mongoc-array.c mongoc-async.c mongoc-async-cmd.c mongoc-buffer.c mongoc-bulk-operation.c mongoc-change-stream.c mongoc-client.c mongoc-client-pool.c mongoc-client-session.c mongoc-client-side-encryption.c mongoc-cluster-aws.c mongoc-cluster.c mongoc-cluster-cyrus.c mongoc-cluster-sasl.c mongoc-cluster-sspi.c mongoc-cmd.c mongoc-collection.c mongoc-compression.c mongoc-counters.c mongoc-crypt.c mongoc-crypto.c mongoc-crypto-cng.c mongoc-crypto-common-crypto.c mongoc-crypto-openssl.c mongoc-cursor-array.c mongoc-cursor.c mongoc-cursor-change-stream.c mongoc-cursor-cmd.c mongoc-cursor-cmd-deprecated.c mongoc-cursor-find.c mongoc-cursor-find-cmd.c mongoc-cursor-find-opquery.c mongoc-cursor-legacy.c mongoc-cyrus.c mongoc-database.c mongoc-error.c mongoc-find-and-modify.c mongoc-gridfs-bucket.c mongoc-gridfs-bucket-file.c mongoc-gridfs.c mongoc-gridfs-file.c mongoc-gridfs-file-list.c mongoc-gridfs-file-page.c mongoc-handshake.c mongoc-host-list.c mongoc-http.c mongoc-index.c mongoc-init.c mongoc-interrupt.c mongoc-libressl.c mongoc-linux-distro-scanner.c mongoc-list.c mongoc-log.c mongoc-matcher.c mongoc-matcher-op.c mongoc-memcmp.c mongoc-ocsp-cache.c mongoc-openssl.c mongoc-opts.c mongoc-opts-helpers.c mongoc-queue.c mongoc-rand-cng.c mongoc-rand-common-crypto.c mongoc-rand-openssl.c mongoc-read-concern.c mongoc-read-prefs.c mongoc-rpc.c mongoc-sasl.c mongoc-scram.c mongoc-secure-channel.c mongoc-secure-transport.c mongoc-server-description.c mongoc-server-monitor.c mongoc-server-stream.c mongoc-set.c mongoc-socket.c mongoc-ssl.c mongoc-sspi.c mongoc-stream-buffered.c mongoc-stream.c mongoc-stream-file.c mongoc-stream-gridfs.c mongoc-stream-gridfs-download.c mongoc-stream-gridfs-upload.c mongoc-stream-socket.c mongoc-stream-tls.c mongoc-stream-tls-libressl.c mongoc-stream-tls-openssl-bio.c mongoc-stream-tls-openssl.c mongoc-stream-tls-secure-channel.c mongoc-stream-tls-secure-transport.c mongoc-topology-background-monitoring.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-command-legacy.c mongoc-write-concern.c";
-
- EXTENSION("mongodb", "php_phongo.c phongo_compat.c", null, PHP_MONGODB_CFLAGS);
- MONGODB_ADD_SOURCES("/src", "bson.c bson-encode.c");
- MONGODB_ADD_SOURCES("/src/BSON", "Binary.c BinaryInterface.c DBPointer.c Decimal128.c Decimal128Interface.c Int64.c Javascript.c JavascriptInterface.c MaxKey.c MaxKeyInterface.c MinKey.c MinKeyInterface.c ObjectId.c ObjectIdInterface.c Persistable.c Regex.c RegexInterface.c Serializable.c Symbol.c Timestamp.c TimestampInterface.c Type.c Undefined.c Unserializable.c UTCDateTime.c UTCDateTimeInterface.c functions.c");
- MONGODB_ADD_SOURCES("/src/MongoDB", "BulkWrite.c ClientEncryption.c Command.c Cursor.c CursorId.c CursorInterface.c Manager.c Query.c ReadConcern.c ReadPreference.c Server.c Session.c WriteConcern.c WriteConcernError.c WriteError.c WriteResult.c");
- MONGODB_ADD_SOURCES("/src/MongoDB/Exception", "AuthenticationException.c BulkWriteException.c CommandException.c ConnectionException.c ConnectionTimeoutException.c EncryptionException.c Exception.c ExecutionTimeoutException.c InvalidArgumentException.c LogicException.c RuntimeException.c ServerException.c SSLConnectionException.c UnexpectedValueException.c WriteException.c");
- MONGODB_ADD_SOURCES("/src/MongoDB/Monitoring", "CommandFailedEvent.c CommandStartedEvent.c CommandSubscriber.c CommandSucceededEvent.c Subscriber.c functions.c");
- MONGODB_ADD_SOURCES("/src/libmongoc/src/common", PHP_MONGODB_COMMON_SOURCES);
- MONGODB_ADD_SOURCES("/src/libmongoc/src/libbson/src/bson", PHP_MONGODB_BSON_SOURCES);
- MONGODB_ADD_SOURCES("/src/libmongoc/src/libbson/src/jsonsl", PHP_MONGODB_JSONSL_SOURCES);
- MONGODB_ADD_SOURCES("/src/libmongoc/src/libmongoc/src/mongoc", PHP_MONGODB_MONGOC_SOURCES);
-
- var bson_opts = {
- BSON_BYTE_ORDER: 1234,
- BSON_OS: 2,
- BSON_HAVE_STDBOOL_H: 0,
- BSON_HAVE_STRINGS_H: 0,
- BSON_HAVE_ATOMIC_32_ADD_AND_FETCH: 0,
- BSON_HAVE_ATOMIC_64_ADD_AND_FETCH: 0,
- BSON_PTHREAD_ONCE_INIT_NEEDS_BRACES: 0,
- BSON_HAVE_CLOCK_GETTIME: 0,
- BSON_HAVE_STRNLEN: 0,
- BSON_HAVE_SNPRINTF: 0,
- BSON_HAVE_STRLCPY: 0,
- BSON_HAVE_REALLOCF: 0,
- BSON_NEEDS_SET_OUTPUT_FORMAT: 0,
- BSON_HAVE_TIMESPEC: 0,
- BSON_EXTRA_ALIGN: 0,
- BSON_HAVE_SYSCALL_TID: 0,
- BSON_HAVE_DECIMAL128: 0,
- BSON_HAVE_GMTIME_R: 0,
- BSON_HAVE_RAND_R: 0
- };
-
- if (CHECK_FUNC_IN_HEADER("stdio.h", "_set_output_format")) {
- bson_opts.BSON_NEEDS_SET_OUTPUT_FORMAT = 1;
- }
-
- mongodb_generate_header(
- configure_module_dirname + "/src/libmongoc/src/libbson/src/bson/bson-config.h.in",
- configure_module_dirname + "/src/libmongoc/src/libbson/src/bson/bson-config.h",
- bson_opts
- );
-
- mongodb_generate_header(
- configure_module_dirname + "/src/libmongoc/src/libbson/src/bson/bson-version.h.in",
- configure_module_dirname + "/src/libmongoc/src/libbson/src/bson/bson-version.h",
- mongodb_parse_version_file(configure_module_dirname + "/src/LIBMONGOC_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_CLIENT_SIDE_ENCRYPTION: 0,
- MONGOC_ENABLE_COMPRESSION_SNAPPY: 0,
- MONGOC_ENABLE_COMPRESSION_ZLIB: 0,
- MONGOC_ENABLE_COMPRESSION_ZSTD: 0,
- MONGOC_ENABLE_COMPRESSION: 0,
- MONGOC_ENABLE_MONGODB_AWS_AUTH: 0,
- MONGOC_ENABLE_SASL: 0,
- MONGOC_ENABLE_SASL_CYRUS: 0,
- MONGOC_ENABLE_SASL_GSSAPI: 0,
- MONGOC_ENABLE_SASL_SSPI: 0,
- MONGOC_ENABLE_ICU: 0,
- MONGOC_ENABLE_RDTSCP: 0,
- MONGOC_ENABLE_SHM_COUNTERS: 0,
- MONGOC_HAVE_ASN1_STRING_GET0_DATA: 0,
- MONGOC_HAVE_SASL_CLIENT_DONE: 0,
- MONGOC_HAVE_SCHED_GETCPU: 0,
- MONGOC_HAVE_SOCKLEN: 1,
- MONGOC_HAVE_WEAK_SYMBOLS: 0,
- MONGOC_NO_AUTOMATIC_GLOBALS: 1,
- MONGOC_SOCKET_ARG2: "struct sockaddr",
- MONGOC_SOCKET_ARG3: "socklen_t",
- MONGOC_TRACE: 1,
- MONGOC_HAVE_DNSAPI: 0,
- MONGOC_HAVE_RES_NSEARCH: 0,
- MONGOC_HAVE_RES_NDESTROY: 0,
- MONGOC_HAVE_RES_NCLOSE: 0,
- MONGOC_HAVE_RES_SEARCH: 0,
- MONGOC_HAVE_SS_FAMILY: 0,
- 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;
- }
-
- var mongoc_ssl_found = false;
-
- /* PHP 7.1.2 introduced SETUP_OPENSSL(), which supports OpenSSL 1.1.x. Earlier
- * versions will use the legacy check for OpenSSL 1.0.x and lower. */
- if (typeof SETUP_OPENSSL === 'function') {
- openssl_type = SETUP_OPENSSL("mongodb", mongoc_ssl_path_to_check);
- mongoc_ssl_found = openssl_type > 0;
- if (openssl_type >= 2) {
- mongoc_opts.MONGOC_HAVE_ASN1_STRING_GET0_DATA = 1;
- }
- } else 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", mongoc_ssl_path_to_check) &&
- CHECK_HEADER_ADD_INCLUDE("openssl/ssl.h", "CFLAGS_MONGODB")) {
- mongoc_ssl_found = true;
- }
-
- if (mongoc_ssl_found) {
- 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;
- mongoc_opts.MONGOC_ENABLE_MONGODB_AWS_AUTH = 1;
-
- ADD_FLAG("CFLAGS_MONGODB", "/D KMS_MSG_STATIC=1 /D KMS_MESSAGE_ENABLE_CRYPTO=1 /D KMS_MESSAGE_ENABLE_CRYPTO_LIBCRYPTO=1");
- } else {
- WARNING("mongodb libopenssl support not enabled, libs not found");
- }
-
- // TODO: Support building with native GSSAPI (SSPI) on Windows
- 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;
- mongoc_opts.MONGOC_ENABLE_SASL_CYRUS = 1;
- if (CHECK_FUNC_IN_HEADER("sasl/sasl.h", "sasl_client_done")) {
- mongoc_opts.MONGOC_HAVE_SASL_CLIENT_DONE = 1;
- }
- } else if (PHP_MONGODB_SASL != "no") {
- WARNING("mongodb libsasl support not enabled, libs not found");
- }
-
- if (PHP_MONGODB_CLIENT_SIDE_ENCRYPTION != "no" && mongoc_ssl_found) {
- mongoc_opts.MONGOC_ENABLE_CLIENT_SIDE_ENCRYPTION = 1;
-
- ADD_FLAG("CFLAGS_MONGODB", "/I" + configure_module_dirname + "/src/libmongocrypt/src");
- ADD_FLAG("CFLAGS_MONGODB", "/I" + configure_module_dirname + "/src/libmongocrypt/kms-message/src");
- ADD_FLAG("CFLAGS_MONGODB", "/I" + configure_module_dirname + "/src/libmongocrypt-compat");
-
- var mongocrypt_opts = {
- MONGOCRYPT_ENABLE_TRACE: 1,
- MONGOCRYPT_ENABLE_CRYPTO: 1,
- MONGOCRYPT_ENABLE_CRYPTO_LIBCRYPTO: 1,
- // TODO: Support building with Secure Channel on Windows
- MONGOCRYPT_ENABLE_CRYPTO_CNG: 0,
- // Secure Transport does not apply to Windows
- MONGOCRYPT_ENABLE_CRYPTO_COMMON_CRYPTO: 0
- };
-
- // Generated with: find src/libmongocrypt/src -maxdepth 1 -name '*.c' -print0 | cut -sz -d / -f 4- | sort -dz | tr '\000' ' '
- var PHP_MONGODB_MONGOCRYPT_SOURCES="mongocrypt-binary.c mongocrypt-buffer.c mongocrypt.c mongocrypt-cache.c mongocrypt-cache-collinfo.c mongocrypt-cache-key.c mongocrypt-ciphertext.c mongocrypt-crypto.c mongocrypt-ctx.c mongocrypt-ctx-datakey.c mongocrypt-ctx-decrypt.c mongocrypt-ctx-encrypt.c mongocrypt-key-broker.c mongocrypt-key.c mongocrypt-kms-ctx.c mongocrypt-log.c mongocrypt-marking.c mongocrypt-opts.c mongocrypt-status.c mongocrypt-traverse-util.c";
-
- // Generated with: find src/libmongocrypt/src/crypto -name '*.c' -print0 | cut -sz -d / -f 5- | sort -dz | tr '\000' ' '
- var PHP_MONGODB_MONGOCRYPT_CRYPTO_SOURCES="cng.c commoncrypto.c libcrypto.c none.c";
-
- // Generated with: find src/libmongocrypt/src/os_posix -name '*.c' -print0 | cut -sz -d / -f 5- | sort -dz | tr '\000' ' '
- var PHP_MONGODB_MONGOCRYPT_OS_POSIX_SOURCES="os_mutex.c os_once.c";
-
- // Generated with: find src/libmongocrypt/src/os_win -name '*.c' -print0 | cut -sz -d / -f 5- | sort -dz | tr '\000' ' '
- var PHP_MONGODB_MONGOCRYPT_OS_WIN_SOURCES="os_mutex.c os_once.c";
-
- // Generated with: find src/libmongocrypt/kms-message/src -maxdepth 1 -name '*.c' -print0 | cut -sz -d / -f 5- | sort -dz | tr '\000' ' '
- var PHP_MONGODB_MONGOCRYPT_KMS_MESSAGE_SOURCES="hexlify.c kms_b64.c kms_caller_identity_request.c kms_crypto_apple.c kms_crypto_libcrypto.c kms_crypto_none.c kms_crypto_windows.c kms_decrypt_request.c kms_encrypt_request.c kms_kv_list.c kms_message.c kms_port.c kms_request.c kms_request_opt.c kms_request_str.c kms_response.c kms_response_parser.c sort.c";
-
- MONGODB_ADD_SOURCES("/src/libmongocrypt/src", PHP_MONGODB_MONGOCRYPT_SOURCES);
- MONGODB_ADD_SOURCES("/src/libmongocrypt/src/crypto", PHP_MONGODB_MONGOCRYPT_CRYPTO_SOURCES);
- MONGODB_ADD_SOURCES("/src/libmongocrypt/src/os_posix", PHP_MONGODB_MONGOCRYPT_OS_POSIX_SOURCES);
- MONGODB_ADD_SOURCES("/src/libmongocrypt/src/os_win", PHP_MONGODB_MONGOCRYPT_OS_WIN_SOURCES);
- MONGODB_ADD_SOURCES("/src/libmongocrypt/kms-message/src", PHP_MONGODB_MONGOCRYPT_KMS_MESSAGE_SOURCES);
-
- var mongocrypt_version = mongodb_parse_version_file(configure_module_dirname + "/src/LIBMONGOCRYPT_VERSION_CURRENT", "")
- mongocrypt_opts.MONGOCRYPT_BUILD_VERSION = mongocrypt_version.VERSION;
-
- mongodb_generate_header(
- configure_module_dirname + "/src/libmongocrypt/src/mongocrypt-config.h.in",
- configure_module_dirname + "/src/libmongocrypt/src/mongocrypt-config.h",
- mongocrypt_opts
- );
-
- mongodb_generate_header(
- configure_module_dirname + "/src/libmongocrypt/src/mongocrypt.h.in",
- configure_module_dirname + "/src/libmongocrypt/src/mongocrypt.h",
- mongocrypt_opts
- );
- } else if (PHP_MONGODB_CLIENT_SIDE_ENCRYPTION != "no") {
- // No SSL library found, we can't enable libmongocrypt
- WARNING("mongodb libmongocrypt support not enabled, crypto libs not found");
- }
-
- if (PHP_MONGODB_CLIENT_SIDE_ENCRYPTION == "no" && mongoc_ssl_found) {
- // Add kms-message sources bundled with libmongoc
- MONGODB_ADD_SOURCES("/src/libmongoc/src/kms-message/src", PHP_MONGODB_KMS_MESSAGE_SOURCES);
- ADD_FLAG("CFLAGS_MONGODB", "/I" + configure_module_dirname + "/src/libmongoc/src/kms-message/src");
- }
-
- if (CHECK_LIB("dnsapi.lib", "mongodb", PHP_MONGODB) &&
- CHECK_HEADER_ADD_INCLUDE("windns.h", "CFLAGS_MONGODB")) {
- mongoc_opts.MONGOC_HAVE_DNSAPI = 1;
- }
-
- if (CHECK_LIB("icuuc.lib", "mongodb", PHP_MONGODB) &&
- CHECK_HEADER_ADD_INCLUDE("unicode/utf.h", "CFLAGS_MONGODB")) {
- mongoc_opts.MONGODB_ENABLE_ICU = 1;
-
- ADD_FLAG("LIBS_MONGODB", "icudt.lib icuin.lib icuio.lib");
-
- /* Compat for ICU before 58.1.*/
- if (CHECK_LIB("icule.lib", "mongodb", PHP_MONGODB)) {
- ADD_FLAG("LIBS_MONGODB", "icule.lib");
- }
- if (CHECK_LIB("iculx.lib", "mongodb", PHP_MONGODB)) {
- ADD_FLAG("LIBS_MONGODB", "iculx.lib");
- }
-
- ADD_FLAG("CFLAGS_MONGODB", "/EHsc /D U_USING_ICU_NAMESPACE=1");
- }
-
- if (typeof COMPILER_NAME === 'string') {
- mongoc_opts.MONGOC_CC = COMPILER_NAME;
- } else if (typeof VC_VERSIONS === 'array' && typeof VC_VERSIONS[VCVERS] === 'string') {
- mongoc_opts.MONGOC_CC = VC_VERSIONS[VCVERS];
- } else if (typeof COMPILER_NAME_LONG === 'string') {
- mongoc_opts.MONGOC_CC = COMPILER_NAME_LONG;
- }
-
- /* 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/libmongoc/src/mongoc/mongoc-config.h.in",
- configure_module_dirname + "/src/libmongoc/src/libmongoc/src/mongoc/mongoc-config.h",
- mongoc_opts
- );
-
- mongodb_generate_header(
- configure_module_dirname + "/src/libmongoc/src/libmongoc/src/mongoc/mongoc-version.h.in",
- configure_module_dirname + "/src/libmongoc/src/libmongoc/src/mongoc/mongoc-version.h",
- mongodb_parse_version_file(configure_module_dirname + "/src/LIBMONGOC_VERSION_CURRENT", "MONGOC_")
- );
-}
-
diff --git a/mongodb-1.8.1/phongo_compat.c b/mongodb-1.8.1/phongo_compat.c
deleted file mode 100644
index 20925e59..00000000
--- a/mongodb-1.8.1/phongo_compat.c
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * 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.
- */
-
-/* Our Compatability header */
-#include "phongo_compat.h"
-
-void phongo_add_exception_prop(const char* prop, int prop_len, zval* value)
-{
- if (EG(exception)) {
- zval ex;
- ZVAL_OBJ(&ex, EG(exception));
- zend_update_property(Z_OBJCE(ex), &ex, prop, prop_len, value);
- }
-}
-
-#ifdef ZEND_HASH_GET_APPLY_COUNT /* PHP 7.2 or earlier recursion protection */
-zend_bool php_phongo_zend_hash_apply_protection_begin(HashTable* ht)
-{
- if (!ht) {
- return 1;
- }
- if (ZEND_HASH_GET_APPLY_COUNT(ht) > 0) {
- return 0;
- }
- if (ZEND_HASH_APPLY_PROTECTION(ht)) {
- ZEND_HASH_INC_APPLY_COUNT(ht);
- }
- return 1;
-}
-
-zend_bool php_phongo_zend_hash_apply_protection_end(HashTable* ht)
-{
- if (!ht) {
- return 1;
- }
- if (ZEND_HASH_GET_APPLY_COUNT(ht) == 0) {
- return 0;
- }
- if (ZEND_HASH_APPLY_PROTECTION(ht)) {
- ZEND_HASH_DEC_APPLY_COUNT(ht);
- }
- return 1;
-}
-#else /* PHP 7.3 or later */
-zend_bool php_phongo_zend_hash_apply_protection_begin(zend_array* ht)
-{
- if (GC_IS_RECURSIVE(ht)) {
- return 0;
- }
- if (!(GC_FLAGS(ht) & GC_IMMUTABLE)) {
- GC_PROTECT_RECURSION(ht);
- }
- return 1;
-}
-
-zend_bool php_phongo_zend_hash_apply_protection_end(zend_array* ht)
-{
- if (!GC_IS_RECURSIVE(ht)) {
- return 0;
- }
- if (!(GC_FLAGS(ht) & GC_IMMUTABLE)) {
- GC_UNPROTECT_RECURSION(ht);
- }
- return 1;
-}
-#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.8.1/phongo_compat.h b/mongodb-1.8.1/phongo_compat.h
deleted file mode 100644
index c97b0649..00000000
--- a/mongodb-1.8.1/phongo_compat.h
+++ /dev/null
@@ -1,152 +0,0 @@
-/*
- * 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>
-#include <Zend/zend_portability.h>
-
-#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 defined(__GNUC__)
-#define ARG_UNUSED __attribute__((unused))
-#else
-#define ARG_UNUSED
-#endif
-
-#if defined(__GNUC__)
-#define PHONGO_GNUC_CHECK_VERSION(major, minor) \
- ((__GNUC__ > (major)) || \
- ((__GNUC__ == (major)) && (__GNUC_MINOR__ >= (minor))))
-#else
-#define PHONGO_GNUC_CHECK_VERSION(major, minor) 0
-#endif
-
-#if PHONGO_GNUC_CHECK_VERSION(7, 0)
-#define PHONGO_BREAK_INTENTIONALLY_MISSING __attribute__((fallthrough));
-#else
-#define PHONGO_BREAK_INTENTIONALLY_MISSING
-#endif
-
-#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 PHONGO_ALLOC_OBJECT_T(_obj_t, _class_type) (_obj_t*) ecalloc(1, sizeof(_obj_t) + zend_object_properties_size(_class_type))
-#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 ZVAL_INT64_STRING(_zv, _value) \
- do { \
- char tmp[24]; \
- int tmp_len; \
- tmp_len = snprintf(tmp, sizeof(tmp), "%" PRId64, (_value)); \
- ZVAL_STRINGL((_zv), tmp, tmp_len); \
- } while (0)
-#define ADD_ASSOC_INT64_AS_STRING(_zv, _key, _value) \
- do { \
- zval z_int; \
- ZVAL_INT64_STRING(&z_int, (_value)); \
- ADD_ASSOC_ZVAL_EX((_zv), (_key), &z_int); \
- } while (0)
-#define ADD_NEXT_INDEX_STRINGL(_zv, _value, _len) add_next_index_stringl(_zv, _value, _len);
-#define PHONGO_RETVAL_SMART_STR(val) RETVAL_STRINGL(ZSTR_VAL((val).s), ZSTR_LEN((val).s));
-#define ZVAL_STATIC_INIT \
- { \
- { \
- 0 \
- } \
- }
-
-#if SIZEOF_ZEND_LONG == 8
-#define ADD_INDEX_INT64(_zv, _index, _value) add_index_long((_zv), (_index), (_value))
-#define ADD_NEXT_INDEX_INT64(_zv, _value) add_next_index_long((_zv), (_value))
-#define ADD_ASSOC_INT64(_zv, _key, _value) add_assoc_long((_zv), (_key), (_value))
-#define ZVAL_INT64(_zv, _value) ZVAL_LONG((_zv), (_value))
-#elif SIZEOF_ZEND_LONG == 4
-#define ADD_INDEX_INT64(_zv, _index, _value) \
- if ((_value) > INT32_MAX || (_value) < INT32_MIN) { \
- zval zchild; \
- php_phongo_bson_new_int64(&zchild, (_value)); \
- add_index_zval((_zv), (_index), &zchild); \
- } else { \
- add_index_long((_zv), (_index), (_value)); \
- }
-#define ADD_NEXT_INDEX_INT64(_zv, _value) \
- if ((_value) > INT32_MAX || (_value) < INT32_MIN) { \
- zval zchild; \
- php_phongo_bson_new_int64(&zchild, (_value)); \
- add_next_index_zval((_zv), &zchild); \
- } else { \
- add_next_index_long((_zv), (_value)); \
- }
-#define ADD_ASSOC_INT64(_zv, _key, _value) \
- if ((_value) > INT32_MAX || (_value) < INT32_MIN) { \
- zval zchild; \
- php_phongo_bson_new_int64(&zchild, (_value)); \
- add_assoc_zval((_zv), (_key), &zchild); \
- } else { \
- add_assoc_long((_zv), (_key), (_value)); \
- }
-#define ZVAL_INT64(_zv, _value) \
- if ((_value) > INT32_MAX || (_value) < INT32_MIN) { \
- php_phongo_bson_new_int64((_zv), (_value)); \
- } else { \
- ZVAL_LONG((_zv), (_value)); \
- }
-#else /* SIZEOF_ZEND_LONG != 8 && SIZEOF_ZEND_LONG != 4 */
-#error Unsupported architecture (integers are neither 32-bit nor 64-bit)
-#endif /* SIZEOF_ZEND_LONG */
-
-void phongo_add_exception_prop(const char* prop, int prop_len, zval* value);
-zend_bool php_phongo_zend_hash_apply_protection_begin(HashTable* ht);
-zend_bool php_phongo_zend_hash_apply_protection_end(HashTable* ht);
-
-#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.8.1/phongo_version.h b/mongodb-1.8.1/phongo_version.h
deleted file mode 100644
index cf1fa102..00000000
--- a/mongodb-1.8.1/phongo_version.h
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * Copyright 2014-2018 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_VERSION_H
-#define PHONGO_VERSION_H
-
-/* clang-format off */
-#define PHP_MONGODB_VERSION "1.8.1"
-#define PHP_MONGODB_STABILITY "stable"
-#define PHP_MONGODB_VERSION_DESC 1,8,1,1
-/* clang-format on */
-
-#endif /* PHONGO_VERSION_H */
diff --git a/mongodb-1.8.1/php_phongo.c b/mongodb-1.8.1/php_phongo.c
deleted file mode 100644
index 31d234c5..00000000
--- a/mongodb-1.8.1/php_phongo.c
+++ /dev/null
@@ -1,3936 +0,0 @@
-/*
- * 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.
- */
-
-/* External libs */
-#include "bson/bson.h"
-#include "mongoc/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>
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <Zend/zend_smart_str.h>
-
-#ifdef MONGOC_ENABLE_CLIENT_SIDE_ENCRYPTION
-#include <mongocrypt/mongocrypt.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"
-#include "src/BSON/functions.h"
-#include "src/MongoDB/Monitoring/functions.h"
-
-#undef MONGOC_LOG_DOMAIN
-#define MONGOC_LOG_DOMAIN "PHONGO"
-
-#define PHONGO_DEBUG_INI "mongodb.debug"
-#define PHONGO_DEBUG_INI_DEFAULT ""
-#define PHONGO_METADATA_SEPARATOR " / "
-#define PHONGO_METADATA_SEPARATOR_LEN (sizeof(PHONGO_METADATA_SEPARATOR) - 1)
-
-ZEND_DECLARE_MODULE_GLOBALS(mongodb)
-#if defined(ZTS) && defined(COMPILE_DL_MONGODB)
-ZEND_TSRMLS_CACHE_DEFINE();
-#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_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(mongoc_error_domain_t domain, mongoc_error_code_t code)
-{
- if (domain == MONGOC_ERROR_CLIENT) {
- if (code == MONGOC_ERROR_CLIENT_AUTHENTICATE) {
- return php_phongo_authenticationexception_ce;
- }
-
- if (code == MONGOC_ERROR_CLIENT_INVALID_ENCRYPTION_ARG) {
- return php_phongo_invalidargumentexception_ce;
- }
- }
-
- if (domain == MONGOC_ERROR_COMMAND && code == MONGOC_ERROR_COMMAND_INVALID_ARG) {
- return php_phongo_invalidargumentexception_ce;
- }
-
- if (domain == MONGOC_ERROR_SERVER) {
- if (code == PHONGO_SERVER_ERROR_EXCEEDED_TIME_LIMIT) {
- return php_phongo_executiontimeoutexception_ce;
- }
-
- return php_phongo_serverexception_ce;
- }
-
- if (domain == MONGOC_ERROR_SERVER_SELECTION && code == MONGOC_ERROR_SERVER_SELECTION_FAILURE) {
- return php_phongo_connectiontimeoutexception_ce;
- }
-
- if (domain == MONGOC_ERROR_STREAM) {
- if (code == MONGOC_ERROR_STREAM_SOCKET) {
- return php_phongo_connectiontimeoutexception_ce;
- }
-
- return php_phongo_connectionexception_ce;
- }
-
- if (domain == MONGOC_ERROR_WRITE_CONCERN) {
- return php_phongo_serverexception_ce;
- }
-
- if (domain == MONGOC_ERROR_PROTOCOL && code == MONGOC_ERROR_PROTOCOL_BAD_WIRE_VERSION) {
- return php_phongo_connectionexception_ce;
- }
-
- if (domain == MONGOC_ERROR_CLIENT_SIDE_ENCRYPTION) {
- return php_phongo_encryptionexception_ce;
- }
-
- return php_phongo_runtimeexception_ce;
-}
-void phongo_throw_exception(php_phongo_error_domain_t domain, 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);
- efree(message);
- va_end(args);
-}
-
-static int phongo_exception_append_error_labels(zval* labels, const bson_iter_t* iter)
-{
- bson_iter_t error_labels;
- uint32_t label_count = 0;
-
- if (!BSON_ITER_HOLDS_ARRAY(iter) || !bson_iter_recurse(iter, &error_labels)) {
- return label_count;
- }
-
- while (bson_iter_next(&error_labels)) {
- if (BSON_ITER_HOLDS_UTF8(&error_labels)) {
- const char* error_label;
- uint32_t error_label_len;
-
- error_label = bson_iter_utf8(&error_labels, &error_label_len);
- ADD_NEXT_INDEX_STRINGL(labels, error_label, error_label_len);
- label_count++;
- }
- }
-
- return label_count;
-}
-
-static void phongo_exception_add_error_labels(const bson_t* reply)
-{
- bson_iter_t iter, child;
- zval labels;
- uint32_t label_count = 0;
-
- if (!reply) {
- return;
- }
-
- array_init(&labels);
-
- if (bson_iter_init_find(&iter, reply, "errorLabels")) {
- label_count += phongo_exception_append_error_labels(&labels, &iter);
- }
-
- if (bson_iter_init_find(&iter, reply, "writeConcernError") && BSON_ITER_HOLDS_DOCUMENT(&iter) &&
- bson_iter_recurse(&iter, &child) && bson_iter_find(&child, "errorLabels")) {
- label_count += phongo_exception_append_error_labels(&labels, &child);
- }
-
- /* mongoc_write_result_t always reports writeConcernErrors in an array, so
- * we must iterate this to collect WCE labels for BulkWrite replies. */
- if (bson_iter_init_find(&iter, reply, "writeConcernErrors") && BSON_ITER_HOLDS_ARRAY(&iter) && bson_iter_recurse(&iter, &child)) {
- bson_iter_t wce;
-
- while (bson_iter_next(&child)) {
- if (BSON_ITER_HOLDS_DOCUMENT(&child) && bson_iter_recurse(&child, &wce) && bson_iter_find(&wce, "errorLabels")) {
- label_count += phongo_exception_append_error_labels(&labels, &wce);
- }
- }
- }
-
- if (label_count > 0) {
- phongo_add_exception_prop(ZEND_STRL("errorLabels"), &labels);
- }
-
- zval_ptr_dtor(&labels);
-}
-
-void phongo_throw_exception_from_bson_error_t_and_reply(bson_error_t* error, const bson_t* reply)
-{
- /* Server errors (other than ExceededTimeLimit) and write concern errors
- * may use CommandException and report the result document for the
- * failed command. For BC, ExceededTimeLimit errors will continue to use
- * ExcecutionTimeoutException and omit the result document. */
- if (reply && ((error->domain == MONGOC_ERROR_SERVER && error->code != PHONGO_SERVER_ERROR_EXCEEDED_TIME_LIMIT) || error->domain == MONGOC_ERROR_WRITE_CONCERN)) {
- zval zv;
-
- zend_throw_exception(php_phongo_commandexception_ce, error->message, error->code);
- if (php_phongo_bson_to_zval(bson_get_data(reply), reply->len, &zv)) {
- phongo_add_exception_prop(ZEND_STRL("resultDocument"), &zv);
- }
-
- zval_ptr_dtor(&zv);
- } else {
- zend_throw_exception(phongo_exception_from_mongoc_domain(error->domain, error->code), error->message, error->code);
- }
- phongo_exception_add_error_labels(reply);
-}
-
-void phongo_throw_exception_from_bson_error_t(bson_error_t* error)
-{
- phongo_throw_exception_from_bson_error_t_and_reply(error, NULL);
-}
-
-static void php_phongo_log(mongoc_log_level_t log_level, const char* log_domain, const char* message, void* user_data)
-{
- struct timeval tv;
- time_t t;
- zend_long tu;
- zend_string* dt;
-
- (void) user_data;
-
- gettimeofday(&tv, NULL);
- t = tv.tv_sec;
- tu = tv.tv_usec;
-
- dt = php_format_date((char*) ZEND_STRL("Y-m-d\\TH:i:s"), t, 0);
-
- fprintf(MONGODB_G(debug_fd), "[%s.%06" PHONGO_LONG_FORMAT "+00:00] %10s: %-8s> %s\n", ZSTR_VAL(dt), tu, log_domain, mongoc_log_level_str(log_level), message);
- fflush(MONGODB_G(debug_fd));
- efree(dt);
-}
-
-/* }}} */
-
-/* {{{ Init objects */
-static void phongo_cursor_init(zval* return_value, mongoc_client_t* client, mongoc_cursor_t* cursor, zval* readPreference, zval* session) /* {{{ */
-{
- 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 = client;
- intern->advanced = false;
- intern->got_iterator = false;
- intern->current = 0;
-
- if (readPreference) {
- ZVAL_ZVAL(&intern->read_preference, readPreference, 1, 0);
- }
-
- if (session) {
- ZVAL_ZVAL(&intern->session, session, 1, 0);
- }
-} /* }}} */
-
-static void phongo_cursor_init_for_command(zval* return_value, mongoc_client_t* client, mongoc_cursor_t* cursor, const char* db, zval* command, zval* readPreference, zval* session) /* {{{ */
-{
- php_phongo_cursor_t* intern;
-
- phongo_cursor_init(return_value, client, cursor, readPreference, session);
- intern = Z_CURSOR_OBJ_P(return_value);
-
- intern->database = estrdup(db);
-
- ZVAL_ZVAL(&intern->command, command, 1, 0);
-} /* }}} */
-
-static void phongo_cursor_init_for_query(zval* return_value, mongoc_client_t* client, mongoc_cursor_t* cursor, const char* namespace, zval* query, zval* readPreference, zval* session) /* {{{ */
-{
- php_phongo_cursor_t* intern;
-
- phongo_cursor_init(return_value, client, cursor, readPreference, session);
- intern = Z_CURSOR_OBJ_P(return_value);
-
- /* namespace has already been validated by phongo_execute_query() */
- phongo_split_namespace(namespace, &intern->database, &intern->collection);
-
- /* cursor has already been advanced by phongo_execute_query() calling
- * phongo_cursor_advance_and_check_for_error() */
- intern->advanced = true;
-
- ZVAL_ZVAL(&intern->query, query, 1, 0);
-} /* }}} */
-
-void phongo_server_init(zval* return_value, mongoc_client_t* client, uint32_t server_id) /* {{{ */
-{
- 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 = client;
-}
-/* }}} */
-
-void phongo_session_init(zval* return_value, mongoc_client_session_t* client_session) /* {{{ */
-{
- php_phongo_session_t* session;
-
- object_init_ex(return_value, php_phongo_session_ce);
-
- session = Z_SESSION_OBJ_P(return_value);
- session->client_session = client_session;
- session->client = mongoc_client_session_get_client(client_session);
-}
-/* }}} */
-
-void phongo_readconcern_init(zval* return_value, const mongoc_read_concern_t* read_concern) /* {{{ */
-{
- 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) /* {{{ */
-{
- 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) /* {{{ */
-{
- 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) /* {{{ */
-{
- 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);
- intern->code = 0;
-
- 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 (!php_phongo_bson_to_zval(data, len, &intern->info)) {
- zval_ptr_dtor(&intern->info);
- ZVAL_UNDEF(&intern->info);
-
- return false;
- }
- }
-
- return true;
-} /* }}} */
-
-zend_bool phongo_writeerror_init(zval* return_value, bson_t* bson) /* {{{ */
-{
- 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);
- intern->code = 0;
- intern->index = 0;
-
- 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 (!php_phongo_bson_to_zval(data, len, &intern->info)) {
- zval_ptr_dtor(&intern->info);
- ZVAL_UNDEF(&intern->info);
-
- return false;
- }
- }
-
- if (bson_iter_init_find(&iter, bson, "index") && BSON_ITER_HOLDS_INT32(&iter)) {
- intern->index = bson_iter_int32(&iter);
- }
-
- return true;
-} /* }}} */
-
-static php_phongo_writeresult_t* phongo_writeresult_init(zval* return_value, bson_t* reply, mongoc_client_t* client, uint32_t server_id) /* {{{ */
-{
- 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 = client;
-
- 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;
-} /* }}} */
-
-/* Parses the "readConcern" option for an execute method. If mongoc_opts is not
- * NULL, the option will be appended. On error, false is returned and an
- * exception is thrown. */
-static bool phongo_parse_read_concern(zval* options, bson_t* mongoc_opts) /* {{{ */
-{
- zval* option = NULL;
- mongoc_read_concern_t* read_concern;
-
- if (!options) {
- return true;
- }
-
- if (Z_TYPE_P(options) != IS_ARRAY) {
- phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Expected options to be array, %s given", PHONGO_ZVAL_CLASS_OR_TYPE_NAME_P(options));
- return false;
- }
-
- option = php_array_fetchc(options, "readConcern");
-
- if (!option) {
- return true;
- }
-
- if (Z_TYPE_P(option) != IS_OBJECT || !instanceof_function(Z_OBJCE_P(option), php_phongo_readconcern_ce)) {
- phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Expected \"readConcern\" option to be %s, %s given", ZSTR_VAL(php_phongo_readconcern_ce->name), PHONGO_ZVAL_CLASS_OR_TYPE_NAME_P(option));
- return false;
- }
-
- read_concern = Z_READCONCERN_OBJ_P(option)->read_concern;
-
- if (mongoc_opts && !mongoc_read_concern_append(read_concern, mongoc_opts)) {
- phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Error appending \"readConcern\" option");
- return false;
- }
-
- return true;
-} /* }}} */
-
-/* Parses the "readPreference" option for an execute method. If zreadPreference
- * is not NULL, it will be assigned to the option. On error, false is returned
- * and an exception is thrown. */
-bool phongo_parse_read_preference(zval* options, zval** zreadPreference) /* {{{ */
-{
- zval* option = NULL;
-
- if (!options) {
- return true;
- }
-
- if (Z_TYPE_P(options) != IS_ARRAY) {
- phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Expected options to be array, %s given", PHONGO_ZVAL_CLASS_OR_TYPE_NAME_P(options));
- return false;
- }
-
- option = php_array_fetchc(options, "readPreference");
-
- if (!option) {
- return true;
- }
-
- if (Z_TYPE_P(option) != IS_OBJECT || !instanceof_function(Z_OBJCE_P(option), php_phongo_readpreference_ce)) {
- phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Expected \"readPreference\" option to be %s, %s given", ZSTR_VAL(php_phongo_readpreference_ce->name), PHONGO_ZVAL_CLASS_OR_TYPE_NAME_P(option));
- return false;
- }
-
- if (zreadPreference) {
- *zreadPreference = option;
- }
-
- return true;
-} /* }}} */
-
-/* Parses the "session" option for an execute method. The client object should
- * correspond to the Manager executing the operation and will be used to ensure
- * that the session is correctly associated with that client. If mongoc_opts is
- * not NULL, the option will be appended. If zsession is not NULL, it will be
- * assigned to the option. On error, false is returned and an exception is
- * thrown. */
-bool phongo_parse_session(zval* options, mongoc_client_t* client, bson_t* mongoc_opts, zval** zsession) /* {{{ */
-{
- zval* option = NULL;
- const mongoc_client_session_t* client_session;
-
- if (!options) {
- return true;
- }
-
- if (Z_TYPE_P(options) != IS_ARRAY) {
- phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Expected options to be array, %s given", PHONGO_ZVAL_CLASS_OR_TYPE_NAME_P(options));
- return false;
- }
-
- option = php_array_fetchc(options, "session");
-
- if (!option) {
- return true;
- }
-
- if (Z_TYPE_P(option) != IS_OBJECT || !instanceof_function(Z_OBJCE_P(option), php_phongo_session_ce)) {
- phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Expected \"session\" option to be %s, %s given", ZSTR_VAL(php_phongo_session_ce->name), PHONGO_ZVAL_CLASS_OR_TYPE_NAME_P(option));
- return false;
- }
-
- client_session = Z_SESSION_OBJ_P(option)->client_session;
-
- if (client != mongoc_client_session_get_client(client_session)) {
- phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Cannot use Session started from a different Manager");
- return false;
- }
-
- if (mongoc_opts && !mongoc_client_session_append(client_session, mongoc_opts, NULL)) {
- phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Error appending \"session\" option");
- return false;
- }
-
- if (zsession) {
- *zsession = option;
- }
-
- return true;
-} /* }}} */
-
-/* Parses the "writeConcern" option for an execute method. If mongoc_opts is not
- * NULL, the option will be appended. If zwriteConcern is not NULL, it will be
- * assigned to the option. On error, false is returned and an exception is
- * thrown. */
-static bool phongo_parse_write_concern(zval* options, bson_t* mongoc_opts, zval** zwriteConcern) /* {{{ */
-{
- zval* option = NULL;
- mongoc_write_concern_t* write_concern;
-
- if (!options) {
- return true;
- }
-
- if (Z_TYPE_P(options) != IS_ARRAY) {
- phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Expected options to be array, %s given", PHONGO_ZVAL_CLASS_OR_TYPE_NAME_P(options));
- return false;
- }
-
- option = php_array_fetchc(options, "writeConcern");
-
- if (!option) {
- return true;
- }
-
- if (Z_TYPE_P(option) != IS_OBJECT || !instanceof_function(Z_OBJCE_P(option), php_phongo_writeconcern_ce)) {
- phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Expected \"writeConcern\" option to be %s, %s given", ZSTR_VAL(php_phongo_writeconcern_ce->name), PHONGO_ZVAL_CLASS_OR_TYPE_NAME_P(option));
- return false;
- }
-
- write_concern = Z_WRITECONCERN_OBJ_P(option)->write_concern;
-
- if (mongoc_opts && !mongoc_write_concern_append(write_concern, mongoc_opts)) {
- phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Error appending \"writeConcern\" option");
- return false;
- }
-
- if (zwriteConcern) {
- *zwriteConcern = option;
- }
-
- return true;
-}
-
-bool phongo_execute_bulk_write(mongoc_client_t* client, const char* namespace, php_phongo_bulkwrite_t* bulk_write, zval* options, uint32_t server_id, zval* return_value) /* {{{ */
-{
- bson_error_t error = { 0 };
- int success;
- bson_t reply = BSON_INITIALIZER;
- mongoc_bulk_operation_t* bulk = bulk_write->bulk;
- php_phongo_writeresult_t* writeresult;
- zval* zwriteConcern = NULL;
- zval* zsession = NULL;
- const mongoc_write_concern_t* write_concern = NULL;
-
- if (bulk_write->executed) {
- phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "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, "%s: %s", "Invalid namespace provided", namespace);
- return false;
- }
-
- if (!phongo_parse_session(options, client, NULL, &zsession)) {
- /* Exception should already have been thrown */
- return false;
- }
-
- if (!phongo_parse_write_concern(options, NULL, &zwriteConcern)) {
- /* Exception should already have been thrown */
- return false;
- }
-
- /* 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.
- * Additionally, we need to check if an unacknowledged write concern would
- * conflict with an explicit session. */
- write_concern = zwriteConcern ? Z_WRITECONCERN_OBJ_P(zwriteConcern)->write_concern : mongoc_client_get_write_concern(client);
-
- if (zsession && !mongoc_write_concern_is_acknowledged(write_concern)) {
- phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Cannot combine \"session\" option with an unacknowledged write concern");
- 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);
- mongoc_bulk_operation_set_hint(bulk, server_id);
-
- if (zsession) {
- mongoc_bulk_operation_set_client_session(bulk, Z_SESSION_OBJ_P(zsession)->client_session);
- }
-
- if (zwriteConcern) {
- mongoc_bulk_operation_set_write_concern(bulk, Z_WRITECONCERN_OBJ_P(zwriteConcern)->write_concern);
- }
-
- success = mongoc_bulk_operation_execute(bulk, &reply, &error);
- bulk_write->executed = true;
-
- writeresult = phongo_writeresult_init(return_value, &reply, client, mongoc_bulk_operation_get_hint(bulk));
- writeresult->write_concern = mongoc_write_concern_copy(write_concern);
-
- /* A BulkWriteException is always thrown if mongoc_bulk_operation_execute()
- * fails to ensure that the write result is accessible. If the error does
- * not originate from the server (e.g. socket error), throw the appropriate
- * exception first. It will be included in BulkWriteException's message and
- * will also be accessible via Exception::getPrevious(). */
- if (!success) {
- if (error.domain != MONGOC_ERROR_SERVER && error.domain != MONGOC_ERROR_WRITE_CONCERN) {
- phongo_throw_exception_from_bson_error_t_and_reply(&error, &reply);
- }
-
- /* Argument errors occur before command execution, so there is no need
- * to layer this InvalidArgumentException behind a BulkWriteException.
- * In practice, this will be a "Cannot do an empty bulk write" error. */
- if (error.domain == MONGOC_ERROR_COMMAND && error.code == MONGOC_ERROR_COMMAND_INVALID_ARG) {
- goto cleanup;
- }
-
- if (EG(exception)) {
- char* message;
-
- (void) spprintf(&message, 0, "Bulk write failed due to previous %s: %s", PHONGO_ZVAL_EXCEPTION_NAME(EG(exception)), error.message);
- zend_throw_exception(php_phongo_bulkwriteexception_ce, message, 0);
- efree(message);
- } else {
- zend_throw_exception(php_phongo_bulkwriteexception_ce, error.message, error.code);
- }
-
- /* Ensure error labels are added to the final BulkWriteException. If a
- * previous exception was also thrown, error labels will already have
- * been added by phongo_throw_exception_from_bson_error_t_and_reply. */
- phongo_exception_add_error_labels(&reply);
- phongo_add_exception_prop(ZEND_STRL("writeResult"), return_value);
- }
-
-cleanup:
- bson_destroy(&reply);
-
- return success;
-} /* }}} */
-
-/* Advance the cursor and return whether there is an error. On error, false is
- * returned and an exception is thrown. */
-bool phongo_cursor_advance_and_check_for_error(mongoc_cursor_t* cursor) /* {{{ */
-{
- const bson_t* doc = NULL;
-
- if (!mongoc_cursor_next(cursor, &doc)) {
- bson_error_t error = { 0 };
-
- /* Check for connection related exceptions */
- if (EG(exception)) {
- return false;
- }
-
- /* Could simply be no docs, which is not an error */
- if (mongoc_cursor_error_document(cursor, &error, &doc)) {
- phongo_throw_exception_from_bson_error_t_and_reply(&error, doc);
- return false;
- }
- }
-
- return true;
-} /* }}} */
-
-bool phongo_execute_query(mongoc_client_t* client, const char* namespace, zval* zquery, zval* options, uint32_t server_id, zval* return_value) /* {{{ */
-{
- const php_phongo_query_t* query;
- bson_t opts = BSON_INITIALIZER;
- mongoc_cursor_t* cursor;
- char* dbname;
- char* collname;
- mongoc_collection_t* collection;
- zval* zreadPreference = NULL;
- zval* zsession = NULL;
-
- if (!phongo_split_namespace(namespace, &dbname, &collname)) {
- phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "%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);
-
- bson_copy_to(query->opts, &opts);
-
- if (query->read_concern) {
- mongoc_collection_set_read_concern(collection, query->read_concern);
- }
-
- if (!phongo_parse_read_preference(options, &zreadPreference)) {
- /* Exception should already have been thrown */
- mongoc_collection_destroy(collection);
- bson_destroy(&opts);
- return false;
- }
-
- if (!phongo_parse_session(options, client, &opts, &zsession)) {
- /* Exception should already have been thrown */
- mongoc_collection_destroy(collection);
- bson_destroy(&opts);
- return false;
- }
-
- if (!BSON_APPEND_INT32(&opts, "serverId", server_id)) {
- phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Error appending \"serverId\" option");
- mongoc_collection_destroy(collection);
- bson_destroy(&opts);
- return false;
- }
-
- cursor = mongoc_collection_find_with_opts(collection, query->filter, &opts, phongo_read_preference_from_zval(zreadPreference));
- mongoc_collection_destroy(collection);
- bson_destroy(&opts);
-
- /* maxAwaitTimeMS must be set before the cursor is sent */
- if (query->max_await_time_ms) {
- mongoc_cursor_set_max_await_time_ms(cursor, query->max_await_time_ms);
- }
-
- if (!phongo_cursor_advance_and_check_for_error(cursor)) {
- mongoc_cursor_destroy(cursor);
- return false;
- }
-
- phongo_cursor_init_for_query(return_value, client, cursor, namespace, zquery, zreadPreference, zsession);
-
- return true;
-} /* }}} */
-
-static bson_t* create_wrapped_command_envelope(const char* db, bson_t* reply)
-{
- bson_t* tmp;
- size_t max_ns_len = strlen(db) + 5 + 1; /* db + ".$cmd" + '\0' */
- char* ns = emalloc(max_ns_len);
-
- snprintf(ns, max_ns_len, "%s.$cmd", db);
- tmp = BCON_NEW("cursor", "{", "id", BCON_INT64(0), "ns", BCON_UTF8(ns), "firstBatch", "[", BCON_DOCUMENT(reply), "]", "}");
- efree(ns);
-
- return tmp;
-}
-
-static zval* phongo_create_implicit_session(mongoc_client_t* client) /* {{{ */
-{
- mongoc_client_session_t* cs;
- zval* zsession;
-
- cs = mongoc_client_start_session(client, NULL, NULL);
-
- if (!cs) {
- return NULL;
- }
-
- zsession = ecalloc(sizeof(zval), 1);
-
- phongo_session_init(zsession, cs);
-
- return zsession;
-} /* }}} */
-
-bool phongo_execute_command(mongoc_client_t* client, php_phongo_command_type_t type, const char* db, zval* zcommand, zval* options, uint32_t server_id, zval* return_value) /* {{{ */
-{
- const php_phongo_command_t* command;
- bson_iter_t iter;
- bson_t reply;
- bson_error_t error = { 0 };
- bson_t opts = BSON_INITIALIZER;
- mongoc_cursor_t* cmd_cursor;
- zval* zreadPreference = NULL;
- zval* zsession = NULL;
- bool result = false;
- bool free_reply = false;
- bool free_zsession = false;
- bool is_unacknowledged_write_concern = false;
-
- command = Z_COMMAND_OBJ_P(zcommand);
-
- if ((type & PHONGO_OPTION_READ_CONCERN) && !phongo_parse_read_concern(options, &opts)) {
- /* Exception should already have been thrown */
- goto cleanup;
- }
-
- if ((type & PHONGO_OPTION_READ_PREFERENCE) && !phongo_parse_read_preference(options, &zreadPreference)) {
- /* Exception should already have been thrown */
- goto cleanup;
- }
-
- if (!phongo_parse_session(options, client, &opts, &zsession)) {
- /* Exception should already have been thrown */
- goto cleanup;
- }
-
- if (type & PHONGO_OPTION_WRITE_CONCERN) {
- zval* zwriteConcern = NULL;
-
- if (!phongo_parse_write_concern(options, &opts, &zwriteConcern)) {
- /* Exception should already have been thrown */
- goto cleanup;
- }
-
- /* Determine if the explicit or inherited write concern is
- * unacknowledged so that we can ensure it does not conflict with an
- * explicit or implicit session. */
- if (zwriteConcern) {
- is_unacknowledged_write_concern = !mongoc_write_concern_is_acknowledged(Z_WRITECONCERN_OBJ_P(zwriteConcern)->write_concern);
- } else if (type != PHONGO_COMMAND_RAW) {
- is_unacknowledged_write_concern = !mongoc_write_concern_is_acknowledged(mongoc_client_get_write_concern(client));
- }
- }
-
- if (zsession && is_unacknowledged_write_concern) {
- phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Cannot combine \"session\" option with an unacknowledged write concern");
- goto cleanup;
- }
-
- /* If an explicit session was not provided and the effective write concern
- * is not unacknowledged, attempt to create an implicit client session
- * (ignoring any errors). */
- if (!zsession && !is_unacknowledged_write_concern) {
- zsession = phongo_create_implicit_session(client);
-
- if (zsession) {
- free_zsession = true;
-
- if (!mongoc_client_session_append(Z_SESSION_OBJ_P(zsession)->client_session, &opts, NULL)) {
- phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Error appending implicit \"sessionId\" option");
- goto cleanup;
- }
- }
- }
-
- if (!BSON_APPEND_INT32(&opts, "serverId", server_id)) {
- phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Error appending \"serverId\" option");
- goto cleanup;
- }
-
- /* Although "opts" already always includes the serverId option, the read
- * preference is added to the command parts, which is relevant for mongos
- * command construction. */
- switch (type) {
- case PHONGO_COMMAND_RAW:
- result = mongoc_client_command_with_opts(client, db, command->bson, phongo_read_preference_from_zval(zreadPreference), &opts, &reply, &error);
- break;
- case PHONGO_COMMAND_READ:
- result = mongoc_client_read_command_with_opts(client, db, command->bson, phongo_read_preference_from_zval(zreadPreference), &opts, &reply, &error);
- break;
- case PHONGO_COMMAND_WRITE:
- result = mongoc_client_write_command_with_opts(client, db, command->bson, &opts, &reply, &error);
- break;
- case PHONGO_COMMAND_READ_WRITE:
- /* We can pass NULL as readPreference, as this argument was added historically, but has no function */
- result = mongoc_client_read_write_command_with_opts(client, db, command->bson, NULL, &opts, &reply, &error);
- break;
- default:
- /* Should never happen, but if it does: exception */
- phongo_throw_exception(PHONGO_ERROR_LOGIC, "Type '%d' should never have been passed to phongo_execute_command, please file a bug report", type);
- goto cleanup;
- }
-
- free_reply = true;
-
- if (!result) {
- phongo_throw_exception_from_bson_error_t_and_reply(&error, &reply);
- goto cleanup;
- }
-
- /* According to mongoc_cursor_new_from_command_reply_with_opts(), the reply
- * bson_t is ultimately destroyed on both success and failure. */
- if (bson_iter_init_find(&iter, &reply, "cursor") && BSON_ITER_HOLDS_DOCUMENT(&iter)) {
- bson_t initial_reply = BSON_INITIALIZER;
- bson_t cursor_opts = BSON_INITIALIZER;
- bson_error_t error = { 0 };
-
- bson_copy_to(&reply, &initial_reply);
-
- bson_append_int32(&cursor_opts, "serverId", -1, server_id);
-
- if (command->max_await_time_ms) {
- bson_append_bool(&cursor_opts, "awaitData", -1, 1);
- bson_append_int64(&cursor_opts, "maxAwaitTimeMS", -1, command->max_await_time_ms);
- bson_append_bool(&cursor_opts, "tailable", -1, 1);
- }
-
- if (command->batch_size) {
- bson_append_int64(&cursor_opts, "batchSize", -1, command->batch_size);
- }
-
- if (zsession && !mongoc_client_session_append(Z_SESSION_OBJ_P(zsession)->client_session, &cursor_opts, &error)) {
- phongo_throw_exception_from_bson_error_t(&error);
- bson_destroy(&initial_reply);
- bson_destroy(&cursor_opts);
- result = false;
- goto cleanup;
- }
-
- cmd_cursor = mongoc_cursor_new_from_command_reply_with_opts(client, &initial_reply, &cursor_opts);
- bson_destroy(&cursor_opts);
- } else {
- bson_t cursor_opts = BSON_INITIALIZER;
- bson_t* wrapped_reply = create_wrapped_command_envelope(db, &reply);
-
- bson_append_int32(&cursor_opts, "serverId", -1, server_id);
- cmd_cursor = mongoc_cursor_new_from_command_reply_with_opts(client, wrapped_reply, &cursor_opts);
- bson_destroy(&cursor_opts);
- }
-
- phongo_cursor_init_for_command(return_value, client, cmd_cursor, db, zcommand, zreadPreference, zsession);
-
-cleanup:
- bson_destroy(&opts);
-
- if (free_reply) {
- bson_destroy(&reply);
- }
-
- if (free_zsession) {
- zval_ptr_dtor(zsession);
- efree(zsession);
- }
-
- return result;
-} /* }}} */
-/* }}} */
-
-/* {{{ mongoc types from from_zval */
-const mongoc_write_concern_t* phongo_write_concern_from_zval(zval* zwrite_concern) /* {{{ */
-{
- 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) /* {{{ */
-{
- 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) /* {{{ */
-{
- 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 */
-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;
-}
-
-bool 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_INIT_DEBUG_STATE(state);
- bson_iter_document(&iter, &len, &bytes);
- if (!php_phongo_bson_to_zval_ex(bytes, len, &state)) {
- zval_ptr_dtor(&state.zchild);
- return false;
- }
-
- ADD_ASSOC_ZVAL_EX(retval, "tags", &state.zchild);
- }
-
- {
- php_phongo_bson_state state;
-
- PHONGO_BSON_INIT_DEBUG_STATE(state);
-
- if (!php_phongo_bson_to_zval_ex(bson_get_data(is_master), is_master->len, &state)) {
- zval_ptr_dtor(&state.zchild);
- return false;
- }
-
- ADD_ASSOC_ZVAL_EX(retval, "last_is_master", &state.zchild);
- }
- ADD_ASSOC_LONG_EX(retval, "round_trip_time", (zend_long) mongoc_server_description_round_trip_time(sd));
-
- return true;
-} /* }}} */
-
-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);
- }
-} /* }}} */
-
-/* If options is not an array, insert it as a field in a newly allocated array.
- * This may be used to convert legacy options (e.g. ReadPreference option for
- * an executeQuery method) into an options array.
- *
- * A pointer to the array zval will always be returned. If allocated is set to
- * true, php_phongo_prep_legacy_option_free() should be used to free the array
- * zval later. */
-zval* php_phongo_prep_legacy_option(zval* options, const char* key, bool* allocated) /* {{{ */
-{
- *allocated = false;
-
- if (options && Z_TYPE_P(options) != IS_ARRAY) {
- zval* new_options = ecalloc(sizeof(zval), 1);
-
- array_init_size(new_options, 1);
- add_assoc_zval(new_options, key, options);
- Z_ADDREF_P(options);
- *allocated = true;
-
- return new_options;
- }
-
- return options;
-} /* }}} */
-
-void php_phongo_prep_legacy_option_free(zval* options) /* {{{ */
-{
- zval_ptr_dtor(options);
- efree(options);
-} /* }}} */
-
-/* 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) /* {{{ */
-{
- HashTable* ht_data;
- zval* tagSet;
-
- if (Z_TYPE_P(tagSets) != IS_ARRAY) {
- return;
- }
-
- ht_data = HASH_OF(tagSets);
-
- ZEND_HASH_FOREACH_VAL_IND(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();
-} /* }}} */
-
-/* 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_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 int64_t wtimeout = mongoc_write_concern_get_wtimeout_int64(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) {
-#if SIZEOF_ZEND_LONG == 4
- if (wtimeout > INT32_MAX || wtimeout < INT32_MIN) {
- ADD_ASSOC_INT64_AS_STRING(&retval, "wtimeout", wtimeout);
- } else {
- ADD_ASSOC_LONG_EX(retval, "wtimeout", wtimeout);
- }
-#else
- ADD_ASSOC_LONG_EX(retval, "wtimeout", wtimeout);
-#endif
- }
-} /* }}} */
-/* }}} */
-
-static mongoc_uri_t* php_phongo_make_uri(const char* uri_string) /* {{{ */
-{
- mongoc_uri_t* uri;
- bson_error_t error = { 0 };
-
- uri = mongoc_uri_new_with_error(uri_string, &error);
- MONGOC_DEBUG("Connection string: '%s'", uri_string);
-
- if (!uri) {
- phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Failed to parse MongoDB URI: '%s'. %s.", uri_string, error.message);
- return NULL;
- }
-
- return uri;
-} /* }}} */
-
-static const char* php_phongo_bson_type_to_string(bson_type_t type) /* {{{ */
-{
- switch (type) {
- case BSON_TYPE_EOD:
- return "EOD";
- case BSON_TYPE_DOUBLE:
- return "double";
- case BSON_TYPE_UTF8:
- return "string";
- case BSON_TYPE_DOCUMENT:
- return "document";
- case BSON_TYPE_ARRAY:
- return "array";
- case BSON_TYPE_BINARY:
- return "Binary";
- case BSON_TYPE_UNDEFINED:
- return "undefined";
- case BSON_TYPE_OID:
- return "ObjectId";
- case BSON_TYPE_BOOL:
- return "boolean";
- case BSON_TYPE_DATE_TIME:
- return "UTCDateTime";
- case BSON_TYPE_NULL:
- return "null";
- case BSON_TYPE_REGEX:
- return "Regex";
- case BSON_TYPE_DBPOINTER:
- return "DBPointer";
- case BSON_TYPE_CODE:
- return "Javascript";
- case BSON_TYPE_SYMBOL:
- return "symbol";
- case BSON_TYPE_CODEWSCOPE:
- return "Javascript with scope";
- case BSON_TYPE_INT32:
- return "32-bit integer";
- case BSON_TYPE_TIMESTAMP:
- return "Timestamp";
- case BSON_TYPE_INT64:
- return "64-bit integer";
- case BSON_TYPE_DECIMAL128:
- return "Decimal128";
- case BSON_TYPE_MAXKEY:
- return "MaxKey";
- case BSON_TYPE_MINKEY:
- return "MinKey";
- default:
- return "unknown";
- }
-} /* }}} */
-
-#define PHONGO_URI_INVALID_TYPE(iter, expected) \
- phongo_throw_exception( \
- PHONGO_ERROR_INVALID_ARGUMENT, \
- "Expected %s for \"%s\" URI option, %s given", \
- (expected), \
- bson_iter_key(&(iter)), \
- php_phongo_bson_type_to_string(bson_iter_type(&(iter))))
-
-static bool php_phongo_uri_finalize_auth(mongoc_uri_t* uri) /* {{{ */
-{
- const bson_t* credentials = mongoc_uri_get_credentials(uri);
- bson_iter_t iter;
- const char* source = NULL;
- const char* username = mongoc_uri_get_username(uri);
- bool require_auth = username != NULL;
-
- if (bson_iter_init_find_case(&iter, credentials, MONGOC_URI_AUTHSOURCE)) {
- source = bson_iter_utf8(&iter, NULL);
- require_auth = true;
- }
-
- /* authSource with GSSAPI or X509 should always be external */
- if (mongoc_uri_get_auth_mechanism(uri)) {
- if (!strcasecmp(mongoc_uri_get_auth_mechanism(uri), "GSSAPI") ||
- !strcasecmp(mongoc_uri_get_auth_mechanism(uri), "MONGODB-X509")) {
-
- if (source) {
- if (strcasecmp(source, "$external")) {
- phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Failed to parse URI options: GSSAPI and X509 require \"$external\" authSource.");
- return false;
- }
- } else {
- mongoc_uri_set_auth_source(uri, "$external");
- }
- }
-
- /* Mechanisms other than MONGODB-X509 and MONGODB-AWS require a username */
- if (strcasecmp(mongoc_uri_get_auth_mechanism(uri), "MONGODB-X509") &&
- strcasecmp(mongoc_uri_get_auth_mechanism(uri), "MONGODB-AWS")) {
- if (!mongoc_uri_get_username(uri) ||
- !strcmp(mongoc_uri_get_username(uri), "")) {
- phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Failed to parse URI options: '%s' authentication mechanism requires username.", mongoc_uri_get_auth_mechanism(uri));
- return false;
- }
- }
-
- /* MONGODB-X509 errors if a password is supplied. */
- if (!strcasecmp(mongoc_uri_get_auth_mechanism(uri), "MONGODB-X509")) {
- if (mongoc_uri_get_password(uri)) {
- phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Failed to parse URI options: X509 authentication mechanism does not accept a password.");
- return false;
- }
- }
- } else if (require_auth) {
- if (source && strcmp(source, "$external") != 0 && (!username || strcmp(username, "") == 0)) {
- phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Failed to parse URI options: Default authentication mechanism requires username.");
- return false;
- }
- }
-
- return true;
-} /* }}} */
-
-static bool php_phongo_uri_finalize_directconnection(mongoc_uri_t* uri) /* {{{ */
-{
- const mongoc_host_list_t* hosts;
-
- if (!mongoc_uri_get_option_as_bool(uri, MONGOC_URI_DIRECTCONNECTION, false)) {
- return true;
- }
-
- /* Per the URI options spec, directConnection conflicts with multiple hosts
- * and SRV URIs, which may resolve to multiple hosts. */
- if (!strncmp(mongoc_uri_get_string(uri), "mongodb+srv://", 14)) {
- phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Failed to parse URI options: SRV URI not allowed with directConnection option.");
- return false;
- }
-
- hosts = mongoc_uri_get_hosts(uri);
-
- if (hosts && hosts->next) {
- phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Failed to parse URI options: Multiple seeds not allowed with directConnection option.");
- return false;
- }
-
- return true;
-} /* }}} */
-
-static bool php_phongo_uri_finalize_tls(mongoc_uri_t* uri) /* {{{ */
-{
- const bson_t* options;
- bson_iter_t iter;
-
- if (!(options = mongoc_uri_get_options(uri))) {
- return true;
- }
-
- if (bson_iter_init_find_case(&iter, options, MONGOC_URI_TLSINSECURE) &&
- (bson_iter_init_find_case(&iter, options, MONGOC_URI_TLSALLOWINVALIDCERTIFICATES) ||
- bson_iter_init_find_case(&iter, options, MONGOC_URI_TLSALLOWINVALIDHOSTNAMES) ||
- bson_iter_init_find_case(&iter, options, MONGOC_URI_TLSDISABLEOCSPENDPOINTCHECK) ||
- bson_iter_init_find_case(&iter, options, MONGOC_URI_TLSDISABLECERTIFICATEREVOCATIONCHECK))) {
- phongo_throw_exception(
- PHONGO_ERROR_INVALID_ARGUMENT,
- "Failed to parse URI options: %s may not be combined with %s, %s, %s, or %s.",
- MONGOC_URI_TLSINSECURE,
- MONGOC_URI_TLSALLOWINVALIDCERTIFICATES,
- MONGOC_URI_TLSALLOWINVALIDHOSTNAMES,
- MONGOC_URI_TLSDISABLEOCSPENDPOINTCHECK,
- MONGOC_URI_TLSDISABLECERTIFICATEREVOCATIONCHECK);
- return false;
- }
-
- if (bson_iter_init_find_case(&iter, options, MONGOC_URI_TLSALLOWINVALIDCERTIFICATES) &&
- (bson_iter_init_find_case(&iter, options, MONGOC_URI_TLSDISABLEOCSPENDPOINTCHECK) ||
- bson_iter_init_find_case(&iter, options, MONGOC_URI_TLSDISABLECERTIFICATEREVOCATIONCHECK))) {
- phongo_throw_exception(
- PHONGO_ERROR_INVALID_ARGUMENT,
- "Failed to parse URI options: %s may not be combined with %s or %s.",
- MONGOC_URI_TLSALLOWINVALIDCERTIFICATES,
- MONGOC_URI_TLSDISABLEOCSPENDPOINTCHECK,
- MONGOC_URI_TLSDISABLECERTIFICATEREVOCATIONCHECK);
- return false;
- }
-
- return true;
-} /* }}} */
-
-static bool php_phongo_apply_options_to_uri(mongoc_uri_t* uri, bson_t* options) /* {{{ */
-{
- bson_iter_t iter;
-
- /* Return early if there are no options to apply */
- if (bson_empty0(options) || !bson_iter_init(&iter, options)) {
- return true;
- }
-
- while (bson_iter_next(&iter)) {
- const char* key = bson_iter_key(&iter);
-
- /* Skip read preference, read concern, and write concern options, as
- * those will be processed by other functions. */
- if (!strcasecmp(key, MONGOC_URI_JOURNAL) ||
- !strcasecmp(key, MONGOC_URI_MAXSTALENESSSECONDS) ||
- !strcasecmp(key, MONGOC_URI_READCONCERNLEVEL) ||
- !strcasecmp(key, MONGOC_URI_READPREFERENCE) ||
- !strcasecmp(key, MONGOC_URI_READPREFERENCETAGS) ||
- !strcasecmp(key, MONGOC_URI_SAFE) ||
- !strcasecmp(key, MONGOC_URI_SLAVEOK) ||
- !strcasecmp(key, MONGOC_URI_W) ||
- !strcasecmp(key, MONGOC_URI_WTIMEOUTMS)) {
-
- continue;
- }
-
- if (mongoc_uri_option_is_bool(key)) {
- /* The option's type is not validated because bson_iter_as_bool() is
- * used to cast the value to a boolean. Validation may be introduced
- * in PHPC-990. */
- if (!mongoc_uri_set_option_as_bool(uri, key, bson_iter_as_bool(&iter))) {
- phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Failed to parse \"%s\" URI option", key);
- return false;
- }
-
- continue;
- }
-
- if (mongoc_uri_option_is_int32(key)) {
- if (!BSON_ITER_HOLDS_INT32(&iter)) {
- PHONGO_URI_INVALID_TYPE(iter, "32-bit integer");
- return false;
- }
-
- if (!mongoc_uri_set_option_as_int32(uri, key, bson_iter_int32(&iter))) {
- phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Failed to parse \"%s\" URI option", key);
- return false;
- }
-
- continue;
- }
-
- if (mongoc_uri_option_is_utf8(key)) {
- if (!BSON_ITER_HOLDS_UTF8(&iter)) {
- PHONGO_URI_INVALID_TYPE(iter, "string");
- return false;
- }
-
- if (!strcasecmp(key, MONGOC_URI_REPLICASET) && !strcmp("", bson_iter_utf8(&iter, NULL))) {
- phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Value for URI option \"%s\" cannot be empty string.", key);
- return false;
- }
-
- if (!mongoc_uri_set_option_as_utf8(uri, key, bson_iter_utf8(&iter, NULL))) {
- /* Assignment uses mongoc_uri_set_appname() for the "appname"
- * option, which validates length in addition to UTF-8 encoding.
- * For BC, we report the invalid string to the user. */
- if (!strcasecmp(key, MONGOC_URI_APPNAME)) {
- phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Invalid appname value: '%s'", bson_iter_utf8(&iter, NULL));
- } else {
- phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Failed to parse \"%s\" URI option", key);
- }
- return false;
- }
-
- continue;
- }
-
- if (!strcasecmp(key, "username")) {
- if (!BSON_ITER_HOLDS_UTF8(&iter)) {
- PHONGO_URI_INVALID_TYPE(iter, "string");
- return false;
- }
-
- if (!mongoc_uri_set_username(uri, bson_iter_utf8(&iter, NULL))) {
- phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Failed to parse \"%s\" URI option", key);
- return false;
- }
-
- continue;
- }
-
- if (!strcasecmp(key, "password")) {
- if (!BSON_ITER_HOLDS_UTF8(&iter)) {
- PHONGO_URI_INVALID_TYPE(iter, "string");
- return false;
- }
-
- if (!mongoc_uri_set_password(uri, bson_iter_utf8(&iter, NULL))) {
- phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Failed to parse \"%s\" URI option", key);
- return false;
- }
-
- continue;
- }
-
- if (!strcasecmp(key, MONGOC_URI_AUTHMECHANISM)) {
- if (!BSON_ITER_HOLDS_UTF8(&iter)) {
- PHONGO_URI_INVALID_TYPE(iter, "string");
- return false;
- }
-
- if (!mongoc_uri_set_auth_mechanism(uri, bson_iter_utf8(&iter, NULL))) {
- phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Failed to parse \"%s\" URI option", key);
- return false;
- }
-
- continue;
- }
-
- if (!strcasecmp(key, MONGOC_URI_AUTHSOURCE)) {
- if (!BSON_ITER_HOLDS_UTF8(&iter)) {
- PHONGO_URI_INVALID_TYPE(iter, "string");
- return false;
- }
-
- if (!mongoc_uri_set_auth_source(uri, bson_iter_utf8(&iter, NULL))) {
- phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Failed to parse \"%s\" URI option", key);
- return false;
- }
-
- continue;
- }
-
- if (!strcasecmp(key, MONGOC_URI_AUTHMECHANISMPROPERTIES)) {
- bson_t properties;
- uint32_t len;
- const uint8_t* data;
-
- if (!BSON_ITER_HOLDS_DOCUMENT(&iter)) {
- PHONGO_URI_INVALID_TYPE(iter, "array or object");
- return false;
- }
-
- bson_iter_document(&iter, &len, &data);
-
- if (!bson_init_static(&properties, data, len)) {
- phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Could not initialize BSON structure for auth mechanism properties");
- return false;
- }
-
- if (!mongoc_uri_set_mechanism_properties(uri, &properties)) {
- phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Failed to parse \"%s\" URI option", key);
- return false;
- }
-
- continue;
- }
-
- if (!strcasecmp(key, MONGOC_URI_GSSAPISERVICENAME)) {
- bson_t unused, properties = BSON_INITIALIZER;
-
- if (mongoc_uri_get_mechanism_properties(uri, &unused)) {
- phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "authMechanismProperties SERVICE_NAME already set, ignoring \"%s\"", key);
- return false;
- }
-
- if (!BSON_ITER_HOLDS_UTF8(&iter)) {
- PHONGO_URI_INVALID_TYPE(iter, "string");
- return false;
- }
-
- bson_append_utf8(&properties, "SERVICE_NAME", -1, bson_iter_utf8(&iter, NULL), -1);
-
- if (!mongoc_uri_set_mechanism_properties(uri, &properties)) {
- phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Failed to parse \"%s\" URI option", key);
- bson_destroy(&properties);
- return false;
- }
-
- bson_destroy(&properties);
-
- continue;
- }
-
- if (!strcasecmp(key, MONGOC_URI_COMPRESSORS)) {
- if (!BSON_ITER_HOLDS_UTF8(&iter)) {
- PHONGO_URI_INVALID_TYPE(iter, "string");
- return false;
- }
-
- if (!mongoc_uri_set_compressors(uri, bson_iter_utf8(&iter, NULL))) {
- phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Failed to parse \"%s\" URI option", key);
- return false;
- }
-
- continue;
- }
- }
-
- /* Validate any interactions between URI options */
- if (!php_phongo_uri_finalize_auth(uri)) {
- /* Exception should already have been thrown */
- return false;
- }
-
- if (!php_phongo_uri_finalize_directconnection(uri)) {
- /* Exception should already have been thrown */
- return false;
- }
-
- return true;
-} /* }}} */
-
-static bool php_phongo_apply_rc_options_to_uri(mongoc_uri_t* uri, bson_t* options) /* {{{ */
-{
- 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, "mongoc_uri_t does not have a read concern");
-
- return false;
- }
-
- /* Return early if there are no options to apply */
- if (bson_empty0(options) || !bson_iter_init(&iter, options)) {
- return true;
- }
-
- new_rc = mongoc_read_concern_copy(old_rc);
-
- while (bson_iter_next(&iter)) {
- const char* key = bson_iter_key(&iter);
-
- if (!strcasecmp(key, MONGOC_URI_READCONCERNLEVEL)) {
- if (!BSON_ITER_HOLDS_UTF8(&iter)) {
- PHONGO_URI_INVALID_TYPE(iter, "string");
- mongoc_read_concern_destroy(new_rc);
-
- return false;
- }
-
- mongoc_read_concern_set_level(new_rc, bson_iter_utf8(&iter, NULL));
- }
- }
-
- 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) /* {{{ */
-{
- bson_iter_t iter;
- mongoc_read_prefs_t* new_rp;
- const mongoc_read_prefs_t* old_rp;
- bool ignore_slaveok = false;
-
- if (!(old_rp = mongoc_uri_get_read_prefs_t(uri))) {
- phongo_throw_exception(PHONGO_ERROR_MONGOC_FAILED, "mongoc_uri_t does not have a read preference");
-
- return false;
- }
-
- /* Return early if there are no options to apply */
- if (bson_empty0(options) || !bson_iter_init(&iter, options)) {
- return true;
- }
-
- new_rp = mongoc_read_prefs_copy(old_rp);
-
- while (bson_iter_next(&iter)) {
- const char* key = bson_iter_key(&iter);
-
- if (!ignore_slaveok && !strcasecmp(key, MONGOC_URI_SLAVEOK)) {
- if (!BSON_ITER_HOLDS_BOOL(&iter)) {
- PHONGO_URI_INVALID_TYPE(iter, "boolean");
- mongoc_read_prefs_destroy(new_rp);
-
- return false;
- }
-
- if (bson_iter_bool(&iter)) {
- mongoc_read_prefs_set_mode(new_rp, MONGOC_READ_SECONDARY_PREFERRED);
- }
- }
-
- if (!strcasecmp(key, MONGOC_URI_READPREFERENCE)) {
- const char* str;
-
- if (!BSON_ITER_HOLDS_UTF8(&iter)) {
- PHONGO_URI_INVALID_TYPE(iter, "string");
- mongoc_read_prefs_destroy(new_rp);
-
- return false;
- }
-
- 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, "Unsupported %s value: '%s'", bson_iter_key(&iter), str);
- mongoc_read_prefs_destroy(new_rp);
-
- return false;
- }
-
- ignore_slaveok = true;
- }
-
- if (!strcasecmp(key, MONGOC_URI_READPREFERENCETAGS)) {
- bson_t tags;
- uint32_t len;
- const uint8_t* data;
-
- if (!BSON_ITER_HOLDS_ARRAY(&iter)) {
- PHONGO_URI_INVALID_TYPE(iter, "array");
- mongoc_read_prefs_destroy(new_rp);
-
- return false;
- }
-
- bson_iter_array(&iter, &len, &data);
-
- if (!bson_init_static(&tags, data, len)) {
- phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "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, "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 (!strcasecmp(key, MONGOC_URI_MAXSTALENESSSECONDS)) {
- int64_t max_staleness_seconds;
-
- if (!BSON_ITER_HOLDS_INT(&iter)) {
- PHONGO_URI_INVALID_TYPE(iter, "integer");
- mongoc_read_prefs_destroy(new_rp);
-
- return false;
- }
-
- max_staleness_seconds = bson_iter_as_int64(&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, "Expected maxStalenessSeconds to be >= %d, %" PRId64 " given", MONGOC_SMALLEST_MAX_STALENESS_SECONDS, max_staleness_seconds);
- mongoc_read_prefs_destroy(new_rp);
-
- return false;
- }
-
- if (max_staleness_seconds > INT32_MAX) {
- phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Expected maxStalenessSeconds to be <= %d, %" PRId64 " given", INT32_MAX, max_staleness_seconds);
- mongoc_read_prefs_destroy(new_rp);
-
- return false;
- }
-
- if (mongoc_read_prefs_get_mode(new_rp) == MONGOC_READ_PRIMARY) {
- phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "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);
- }
- }
-
- 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, "Primary read preference mode conflicts with tags");
- mongoc_read_prefs_destroy(new_rp);
-
- return false;
- }
-
- /* Make sure maxStalenessSeconds is not combined with primary readPreference */
- if (mongoc_read_prefs_get_mode(new_rp) == MONGOC_READ_PRIMARY &&
- mongoc_read_prefs_get_max_staleness_seconds(new_rp) != MONGOC_NO_MAX_STALENESS) {
- phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Primary read preference mode conflicts with maxStalenessSeconds");
- mongoc_read_prefs_destroy(new_rp);
-
- return false;
- }
-
- /* This may be redundant in light of the previous checks (primary with tags
- * or maxStalenessSeconds), 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, "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) /* {{{ */
-{
- bson_iter_t iter;
- mongoc_write_concern_t* new_wc;
- const mongoc_write_concern_t* old_wc;
- bool ignore_safe = false;
-
- if (!(old_wc = mongoc_uri_get_write_concern(uri))) {
- phongo_throw_exception(PHONGO_ERROR_MONGOC_FAILED, "mongoc_uri_t does not have a write concern");
-
- return false;
- }
-
- /* Return early if there are no options to apply */
- if (bson_empty0(options) || !bson_iter_init(&iter, options)) {
- return true;
- }
-
- new_wc = mongoc_write_concern_copy(old_wc);
-
- while (bson_iter_next(&iter)) {
- const char* key = bson_iter_key(&iter);
-
- if (!ignore_safe && !strcasecmp(key, MONGOC_URI_SAFE)) {
- if (!BSON_ITER_HOLDS_BOOL(&iter)) {
- PHONGO_URI_INVALID_TYPE(iter, "boolean");
- mongoc_write_concern_destroy(new_wc);
-
- return false;
- }
-
- mongoc_write_concern_set_w(new_wc, bson_iter_bool(&iter) ? 1 : MONGOC_WRITE_CONCERN_W_UNACKNOWLEDGED);
- }
-
- if (!strcasecmp(key, MONGOC_URI_WTIMEOUTMS)) {
- int64_t wtimeout;
-
- if (!BSON_ITER_HOLDS_INT(&iter)) {
- PHONGO_URI_INVALID_TYPE(iter, "integer");
- mongoc_write_concern_destroy(new_wc);
-
- return false;
- }
-
- wtimeout = bson_iter_as_int64(&iter);
-
- if (wtimeout < 0) {
- phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Expected wtimeoutMS to be >= 0, %" PRId64 " given", wtimeout);
- mongoc_write_concern_destroy(new_wc);
-
- return false;
- }
-
- mongoc_write_concern_set_wtimeout_int64(new_wc, wtimeout);
- }
-
- if (!strcasecmp(key, MONGOC_URI_JOURNAL)) {
- if (!BSON_ITER_HOLDS_BOOL(&iter)) {
- PHONGO_URI_INVALID_TYPE(iter, "boolean");
- mongoc_write_concern_destroy(new_wc);
-
- return false;
- }
-
- mongoc_write_concern_set_journal(new_wc, bson_iter_bool(&iter));
- }
-
- if (!strcasecmp(key, MONGOC_URI_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, "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_w(new_wc, MONGOC_WRITE_CONCERN_W_MAJORITY);
- } else {
- mongoc_write_concern_set_wtag(new_wc, str);
- }
- } else {
- PHONGO_URI_INVALID_TYPE(iter, "32-bit integer or string");
- mongoc_write_concern_destroy(new_wc);
-
- return false;
- }
-
- ignore_safe = true;
- }
- }
-
- 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, "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, "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;
-} /* }}} */
-
-#ifdef MONGOC_ENABLE_SSL
-
-static void php_phongo_mongoc_ssl_opts_from_uri(mongoc_ssl_opt_t* ssl_opt, mongoc_uri_t* uri, bool* any_ssl_option_set)
-{
- bool insecure = mongoc_uri_get_option_as_bool(uri, MONGOC_URI_TLSINSECURE, false);
- const char* pem_file = mongoc_uri_get_option_as_utf8(uri, MONGOC_URI_TLSCERTIFICATEKEYFILE, NULL);
- const char* pem_pwd = mongoc_uri_get_option_as_utf8(uri, MONGOC_URI_TLSCERTIFICATEKEYFILEPASSWORD, NULL);
- const char* ca_file = mongoc_uri_get_option_as_utf8(uri, MONGOC_URI_TLSCAFILE, NULL);
-
- ssl_opt->pem_file = pem_file ? estrdup(pem_file) : NULL;
- ssl_opt->pem_pwd = pem_pwd ? estrdup(pem_pwd) : NULL;
- ssl_opt->ca_file = ca_file ? estrdup(ca_file) : NULL;
- ssl_opt->weak_cert_validation = mongoc_uri_get_option_as_bool(uri, MONGOC_URI_TLSALLOWINVALIDCERTIFICATES, insecure);
- ssl_opt->allow_invalid_hostname = mongoc_uri_get_option_as_bool(uri, MONGOC_URI_TLSALLOWINVALIDHOSTNAMES, insecure);
-
- /* Boolean options default to false, so we cannot consider them for
- * any_ssl_option_set. This isn't actually a problem as libmongoc will
- * already have assigned them when creating the client, enabling SSL, and
- * assigning SSL options. Therefore, we only need to check for non-defaults
- * (i.e. non-NULL strings, true booleans). */
- if (pem_file || pem_pwd || ca_file || ssl_opt->weak_cert_validation || ssl_opt->allow_invalid_hostname) {
- *any_ssl_option_set = true;
- }
-}
-
-static inline char* php_phongo_fetch_ssl_opt_string(zval* zoptions, const char* key)
-{
- int plen;
- zend_bool pfree;
- char* pval;
- char* value;
-
- pval = php_array_fetch_string(zoptions, key, &plen, &pfree);
- value = pfree ? pval : estrndup(pval, plen);
-
- return value;
-}
-
-static mongoc_ssl_opt_t* php_phongo_make_ssl_opt(mongoc_uri_t* uri, zval* zoptions)
-{
- mongoc_ssl_opt_t* ssl_opt;
- bool any_ssl_option_set = false;
-
- 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, "\"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, "\"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, "\"crl_file\" option is not supported by LibreSSL and Secure Transport");
- return NULL;
- }
-#endif
-
- ssl_opt = ecalloc(1, sizeof(mongoc_ssl_opt_t));
-
- /* If SSL options are set in the URL, we need to read them and set them on
- * the options struct so we can merge potential options from passed in
- * driverOptions (zoptions) */
- if (mongoc_uri_get_tls(uri)) {
- php_phongo_mongoc_ssl_opts_from_uri(ssl_opt, uri, &any_ssl_option_set);
- }
-
-#define PHONGO_SSL_OPTION_SWAP_STRING(o, n) \
- if ((o)) { \
- efree((char*) (o)); \
- } \
- (o) = php_phongo_fetch_ssl_opt_string(zoptions, n);
-
- /* Apply driver options that don't have a corresponding URI option. These
- * are set directly on the SSL options struct. */
- if (php_array_existsc(zoptions, "ca_dir")) {
- PHONGO_SSL_OPTION_SWAP_STRING(ssl_opt->ca_dir, "ca_dir");
- any_ssl_option_set = true;
- } else if (php_array_existsc(zoptions, "capath")) {
- PHONGO_SSL_OPTION_SWAP_STRING(ssl_opt->ca_dir, "capath");
- any_ssl_option_set = true;
-
- php_error_docref(NULL, E_DEPRECATED, "The \"capath\" context driver option is deprecated. Please use the \"ca_dir\" driver option instead.");
- }
-
- if (php_array_existsc(zoptions, "crl_file")) {
- PHONGO_SSL_OPTION_SWAP_STRING(ssl_opt->crl_file, "crl_file");
- any_ssl_option_set = true;
- }
-
-#undef PHONGO_SSL_OPTION_SWAP_STRING
-
- if (!any_ssl_option_set) {
- efree(ssl_opt);
- return NULL;
- }
-
- return ssl_opt;
-}
-
-static void php_phongo_free_ssl_opt(mongoc_ssl_opt_t* ssl_opt)
-{
- if (ssl_opt->pem_file) {
- efree((char*) ssl_opt->pem_file);
- }
-
- if (ssl_opt->pem_pwd) {
- efree((char*) ssl_opt->pem_pwd);
- }
-
- if (ssl_opt->ca_file) {
- efree((char*) ssl_opt->ca_file);
- }
-
- if (ssl_opt->ca_dir) {
- efree((char*) ssl_opt->ca_dir);
- }
-
- if (ssl_opt->crl_file) {
- efree((char*) ssl_opt->crl_file);
- }
-
- efree(ssl_opt);
-}
-
-static inline bool php_phongo_apply_driver_option_to_uri(mongoc_uri_t* uri, zval* zoptions, const char* driverOptionKey, const char* optionKey)
-{
- bool ret;
- char* value;
-
- value = php_phongo_fetch_ssl_opt_string(zoptions, driverOptionKey);
- ret = mongoc_uri_set_option_as_utf8(uri, optionKey, value);
- efree(value);
-
- return ret;
-}
-
-static bool php_phongo_apply_driver_options_to_uri(mongoc_uri_t* uri, zval* zoptions)
-{
- if (!zoptions) {
- return true;
- }
-
- /* Map TLS driver options to the canonical tls options in the URI. */
- if (php_array_existsc(zoptions, "allow_invalid_hostname")) {
- if (!mongoc_uri_set_option_as_bool(uri, MONGOC_URI_TLSALLOWINVALIDHOSTNAMES, php_array_fetchc_bool(zoptions, "allow_invalid_hostname"))) {
- phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Failed to parse \"%s\" driver option", "allow_invalid_hostname");
-
- return false;
- }
-
- php_error_docref(NULL, E_DEPRECATED, "The \"allow_invalid_hostname\" driver option is deprecated. Please use the \"tlsAllowInvalidHostnames\" URI option instead.");
- }
-
- if (php_array_existsc(zoptions, "weak_cert_validation")) {
- if (!mongoc_uri_set_option_as_bool(uri, MONGOC_URI_TLSALLOWINVALIDCERTIFICATES, php_array_fetchc_bool(zoptions, "weak_cert_validation"))) {
- phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Failed to parse \"%s\" driver option", "weak_cert_validation");
-
- return false;
- }
-
- php_error_docref(NULL, E_DEPRECATED, "The \"weak_cert_validation\" driver option is deprecated. Please use the \"tlsAllowInvalidCertificates\" URI option instead.");
- } else if (php_array_existsc(zoptions, "allow_self_signed")) {
- if (!mongoc_uri_set_option_as_bool(uri, MONGOC_URI_TLSALLOWINVALIDCERTIFICATES, php_array_fetchc_bool(zoptions, "allow_self_signed"))) {
- phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Failed to parse \"%s\" driver option", "allow_self_signed");
-
- return false;
- }
-
- php_error_docref(NULL, E_DEPRECATED, "The \"allow_self_signed\" context driver option is deprecated. Please use the \"tlsAllowInvalidCertificates\" URI option instead.");
- }
-
- if (php_array_existsc(zoptions, "pem_file")) {
- if (!php_phongo_apply_driver_option_to_uri(uri, zoptions, "pem_file", MONGOC_URI_TLSCERTIFICATEKEYFILE)) {
- phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Failed to parse \"%s\" driver option", "pem_file");
-
- return false;
- }
-
- php_error_docref(NULL, E_DEPRECATED, "The \"pem_file\" driver option is deprecated. Please use the \"tlsCertificateKeyFile\" URI option instead.");
- } else if (php_array_existsc(zoptions, "local_cert")) {
- if (!php_phongo_apply_driver_option_to_uri(uri, zoptions, "local_cert", MONGOC_URI_TLSCERTIFICATEKEYFILE)) {
- phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Failed to parse \"%s\" driver option", "local_cert");
-
- return false;
- }
-
- php_error_docref(NULL, E_DEPRECATED, "The \"local_cert\" context driver option is deprecated. Please use the \"tlsCertificateKeyFile\" URI option instead.");
- }
-
- if (php_array_existsc(zoptions, "pem_pwd")) {
- if (!php_phongo_apply_driver_option_to_uri(uri, zoptions, "pem_pwd", MONGOC_URI_TLSCERTIFICATEKEYFILEPASSWORD)) {
- phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Failed to parse \"%s\" driver option", "pem_pwd");
-
- return false;
- }
-
- php_error_docref(NULL, E_DEPRECATED, "The \"pem_pwd\" driver option is deprecated. Please use the \"tlsCertificateKeyFilePassword\" URI option instead.");
- } else if (php_array_existsc(zoptions, "passphrase")) {
- if (!php_phongo_apply_driver_option_to_uri(uri, zoptions, "passphrase", MONGOC_URI_TLSCERTIFICATEKEYFILEPASSWORD)) {
- phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Failed to parse \"%s\" driver option", "passphrase");
-
- return false;
- }
-
- php_error_docref(NULL, E_DEPRECATED, "The \"passphrase\" context driver option is deprecated. Please use the \"tlsCertificateKeyFilePassword\" URI option instead.");
- }
-
- if (php_array_existsc(zoptions, "ca_file")) {
- if (!php_phongo_apply_driver_option_to_uri(uri, zoptions, "ca_file", MONGOC_URI_TLSCAFILE)) {
- phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Failed to parse \"%s\" driver option", "ca_file");
-
- return false;
- }
-
- php_error_docref(NULL, E_DEPRECATED, "The \"ca_file\" driver option is deprecated. Please use the \"tlsCAFile\" URI option instead.");
- } else if (php_array_existsc(zoptions, "cafile")) {
- if (!php_phongo_apply_driver_option_to_uri(uri, zoptions, "cafile", MONGOC_URI_TLSCAFILE)) {
- phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Failed to parse \"%s\" driver option", "cafile");
-
- return false;
- }
-
- php_error_docref(NULL, E_DEPRECATED, "The \"cafile\" context driver option is deprecated. Please use the \"tlsCAFile\" URI option instead.");
- }
-
- return true;
-}
-#endif
-
-/* APM callbacks */
-static void php_phongo_dispatch_handlers(const char* name, zval* z_event)
-{
- zval* value;
-
- ZEND_HASH_FOREACH_VAL_IND(MONGODB_G(subscribers), value)
- {
- if (EG(exception)) {
- break;
- }
- /* We can't use the zend_call_method_with_1_params macro here, as it
- * does a sizeof() on the name argument, which does only work with
- * constant names, but not with parameterized ones as it does
- * "sizeof(char*)" in that case. */
- zend_call_method(value, NULL, NULL, name, strlen(name), NULL, 1, z_event, NULL);
- }
- ZEND_HASH_FOREACH_END();
-}
-
-static void php_phongo_command_started(const mongoc_apm_command_started_t* event)
-{
- php_phongo_commandstartedevent_t* p_event;
- zval z_event;
-
- /* Return early if there are no APM subscribers to notify */
- if (!MONGODB_G(subscribers) || zend_hash_num_elements(MONGODB_G(subscribers)) == 0) {
- return;
- }
-
- object_init_ex(&z_event, php_phongo_commandstartedevent_ce);
- p_event = Z_COMMANDSTARTEDEVENT_OBJ_P(&z_event);
-
- p_event->client = mongoc_apm_command_started_get_context(event);
- p_event->command_name = estrdup(mongoc_apm_command_started_get_command_name(event));
- p_event->server_id = mongoc_apm_command_started_get_server_id(event);
- p_event->operation_id = mongoc_apm_command_started_get_operation_id(event);
- p_event->request_id = mongoc_apm_command_started_get_request_id(event);
- p_event->command = bson_copy(mongoc_apm_command_started_get_command(event));
- p_event->database_name = estrdup(mongoc_apm_command_started_get_database_name(event));
-
- php_phongo_dispatch_handlers("commandStarted", &z_event);
- zval_ptr_dtor(&z_event);
-}
-
-static void php_phongo_command_succeeded(const mongoc_apm_command_succeeded_t* event)
-{
- php_phongo_commandsucceededevent_t* p_event;
- zval z_event;
-
- /* Return early if there are no APM subscribers to notify */
- if (!MONGODB_G(subscribers) || zend_hash_num_elements(MONGODB_G(subscribers)) == 0) {
- return;
- }
-
- object_init_ex(&z_event, php_phongo_commandsucceededevent_ce);
- p_event = Z_COMMANDSUCCEEDEDEVENT_OBJ_P(&z_event);
-
- p_event->client = mongoc_apm_command_succeeded_get_context(event);
- p_event->command_name = estrdup(mongoc_apm_command_succeeded_get_command_name(event));
- p_event->server_id = mongoc_apm_command_succeeded_get_server_id(event);
- p_event->operation_id = mongoc_apm_command_succeeded_get_operation_id(event);
- p_event->request_id = mongoc_apm_command_succeeded_get_request_id(event);
- p_event->duration_micros = mongoc_apm_command_succeeded_get_duration(event);
- p_event->reply = bson_copy(mongoc_apm_command_succeeded_get_reply(event));
-
- php_phongo_dispatch_handlers("commandSucceeded", &z_event);
- zval_ptr_dtor(&z_event);
-}
-
-static void php_phongo_command_failed(const mongoc_apm_command_failed_t* event)
-{
- php_phongo_commandfailedevent_t* p_event;
- zval z_event;
- bson_error_t tmp_error = { 0 };
- zend_class_entry* default_exception_ce;
-
- default_exception_ce = zend_exception_get_default();
-
- /* Return early if there are no APM subscribers to notify */
- if (!MONGODB_G(subscribers) || zend_hash_num_elements(MONGODB_G(subscribers)) == 0) {
- return;
- }
-
- object_init_ex(&z_event, php_phongo_commandfailedevent_ce);
- p_event = Z_COMMANDFAILEDEVENT_OBJ_P(&z_event);
-
- p_event->client = mongoc_apm_command_failed_get_context(event);
- p_event->command_name = estrdup(mongoc_apm_command_failed_get_command_name(event));
- p_event->server_id = mongoc_apm_command_failed_get_server_id(event);
- p_event->operation_id = mongoc_apm_command_failed_get_operation_id(event);
- p_event->request_id = mongoc_apm_command_failed_get_request_id(event);
- p_event->duration_micros = mongoc_apm_command_failed_get_duration(event);
- p_event->reply = bson_copy(mongoc_apm_command_failed_get_reply(event));
-
- /* We need to process and convert the error right here, otherwise
- * debug_info will turn into a recursive loop, and with the wrong trace
- * locations */
- mongoc_apm_command_failed_get_error(event, &tmp_error);
-
- object_init_ex(&p_event->z_error, phongo_exception_from_mongoc_domain(tmp_error.domain, tmp_error.code));
- zend_update_property_string(default_exception_ce, &p_event->z_error, ZEND_STRL("message"), tmp_error.message);
- zend_update_property_long(default_exception_ce, &p_event->z_error, ZEND_STRL("code"), tmp_error.code);
-
- php_phongo_dispatch_handlers("commandFailed", &z_event);
- zval_ptr_dtor(&z_event);
-}
-
-/* Sets the callbacks for APM */
-int php_phongo_set_monitoring_callbacks(mongoc_client_t* client)
-{
- int retval;
-
- mongoc_apm_callbacks_t* callbacks = mongoc_apm_callbacks_new();
-
- mongoc_apm_set_command_started_cb(callbacks, php_phongo_command_started);
- mongoc_apm_set_command_succeeded_cb(callbacks, php_phongo_command_succeeded);
- mongoc_apm_set_command_failed_cb(callbacks, php_phongo_command_failed);
- retval = mongoc_client_set_apm_callbacks(client, callbacks, client);
-
- mongoc_apm_callbacks_destroy(callbacks);
-
- return retval;
-}
-
-static zval* php_phongo_manager_prepare_manager_for_hash(zval* driverOptions, bool* free)
-{
- php_phongo_manager_t* manager;
- zval* autoEncryptionOpts = NULL;
- zval* keyVaultClient = NULL;
- zval* driverOptionsClone = NULL;
- zval* autoEncryptionOptsClone = NULL;
- zval stackAutoEncryptionOptsClone;
-
- *free = false;
-
- if (!driverOptions) {
- return NULL;
- }
-
- if (!php_array_existsc(driverOptions, "autoEncryption")) {
- goto ref;
- }
-
- autoEncryptionOpts = php_array_fetchc(driverOptions, "autoEncryption");
- if (Z_TYPE_P(autoEncryptionOpts) != IS_ARRAY) {
- goto ref;
- }
-
- if (!php_array_existsc(autoEncryptionOpts, "keyVaultClient")) {
- goto ref;
- }
-
- keyVaultClient = php_array_fetchc(autoEncryptionOpts, "keyVaultClient");
- if (Z_TYPE_P(keyVaultClient) != IS_OBJECT || !instanceof_function(Z_OBJCE_P(keyVaultClient), php_phongo_manager_ce)) {
- goto ref;
- }
-
- *free = true;
-
- manager = Z_MANAGER_OBJ_P(keyVaultClient);
-
- driverOptionsClone = ecalloc(sizeof(zval), 1);
- autoEncryptionOptsClone = &stackAutoEncryptionOptsClone;
-
- ZVAL_DUP(autoEncryptionOptsClone, autoEncryptionOpts);
- ADD_ASSOC_STRINGL(autoEncryptionOptsClone, "keyVaultClient", manager->client_hash, manager->client_hash_len);
-
- ZVAL_DUP(driverOptionsClone, driverOptions);
- ADD_ASSOC_ZVAL_EX(driverOptionsClone, "autoEncryption", autoEncryptionOptsClone);
-
- return driverOptionsClone;
-
-ref:
- Z_ADDREF_P(driverOptions);
- return driverOptions;
-}
-
-/* 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)
-{
- char* hash = NULL;
- smart_str var_buf = { 0 };
- php_serialize_data_t var_hash;
- zval* serializable_driver_options = NULL;
- bool free_driver_options = false;
-
- zval args;
-
- 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) {
- serializable_driver_options = php_phongo_manager_prepare_manager_for_hash(driverOptions, &free_driver_options);
- ADD_ASSOC_ZVAL_EX(&args, "driverOptions", serializable_driver_options);
- } 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 = estrndup(ZSTR_VAL(var_buf.s), *hash_len);
- }
-
- zval_ptr_dtor(&args);
-
- if (free_driver_options) {
- efree(serializable_driver_options);
- }
-
- smart_str_free(&var_buf);
-
- return hash;
-}
-
-static bool php_phongo_extract_handshake_data(zval* driver, const char* key, char** value, size_t* value_len)
-{
- zval* zvalue;
-
- if (!php_array_exists(driver, key)) {
- *value = NULL;
- *value_len = 0;
-
- return true;
- }
-
- zvalue = php_array_fetch(driver, key);
-
- if (Z_TYPE_P(zvalue) != IS_STRING) {
- phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT TSRMLS_CC, "Expected \"%s\" handshake option to be a string, %s given", key, PHONGO_ZVAL_CLASS_OR_TYPE_NAME_P(zvalue));
- return false;
- }
-
- *value = estrdup(Z_STRVAL_P(zvalue));
- *value_len = Z_STRLEN_P(zvalue);
-
- return true;
-}
-
-static char* php_phongo_concat_handshake_data(const char* default_value, const char* custom_value, size_t custom_value_len)
-{
- char* ret;
- /* Length of the returned value needs to include the trailing null byte */
- size_t ret_len = strlen(default_value) + 1;
-
- if (custom_value) {
- /* Increase the length by that of the custom value as well as one byte for the separator */
- ret_len += custom_value_len + PHONGO_METADATA_SEPARATOR_LEN;
- }
-
- ret = ecalloc(sizeof(char*), ret_len);
-
- if (custom_value) {
- snprintf(ret, ret_len, "%s%s%s", default_value, PHONGO_METADATA_SEPARATOR, custom_value);
- } else {
- snprintf(ret, ret_len, "%s", default_value);
- }
-
- return ret;
-}
-
-static void php_phongo_handshake_data_append(const char* name, size_t name_len, const char* version, size_t version_len, const char* platform, size_t platform_len)
-{
- char* php_version_string;
- size_t php_version_string_len;
- char* driver_name;
- char* driver_version;
- char* full_platform;
-
- php_version_string_len = strlen(PHP_VERSION);
- php_version_string = ecalloc(sizeof(char*), 4 + php_version_string_len);
- snprintf(php_version_string, 4 + php_version_string_len, "PHP %s", PHP_VERSION);
-
- driver_name = php_phongo_concat_handshake_data("ext-mongodb:PHP", name, name_len);
- driver_version = php_phongo_concat_handshake_data(PHP_MONGODB_VERSION, version, version_len);
- full_platform = php_phongo_concat_handshake_data(php_version_string, platform, platform_len);
-
- MONGOC_DEBUG(
- "Setting driver handshake data: name %s, version %s, platform %s",
- driver_name,
- driver_version,
- full_platform);
-
- mongoc_handshake_data_append(driver_name, driver_version, full_platform);
-
- efree(php_version_string);
- efree(driver_name);
- efree(driver_version);
- efree(full_platform);
-}
-
-static void php_phongo_set_handshake_data(zval* driverOptions)
-{
- char* name = NULL;
- size_t name_len = 0;
- char* version = NULL;
- size_t version_len = 0;
- char* platform = NULL;
- size_t platform_len = 0;
-
- if (driverOptions && php_array_existsc(driverOptions, "driver")) {
- zval* driver = php_array_fetchc(driverOptions, "driver");
-
- if (Z_TYPE_P(driver) != IS_ARRAY) {
- phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT TSRMLS_CC, "Expected \"driver\" driver option to be an array, %s given", PHONGO_ZVAL_CLASS_OR_TYPE_NAME_P(driver));
- return;
- }
-
- if (!php_phongo_extract_handshake_data(driver, "name", &name, &name_len)) {
- /* Exception already thrown */
- goto cleanup;
- }
-
- if (!php_phongo_extract_handshake_data(driver, "version", &version, &version_len)) {
- /* Exception already thrown */
- goto cleanup;
- }
-
- if (!php_phongo_extract_handshake_data(driver, "platform", &platform, &platform_len)) {
- /* Exception already thrown */
- goto cleanup;
- }
- }
-
- php_phongo_handshake_data_append(name, name_len, version, version_len, platform, platform_len);
-
-cleanup:
- if (name) {
- efree(name);
- }
- if (version) {
- efree(version);
- }
- if (platform) {
- efree(platform);
- }
-}
-
-static mongoc_client_t* php_phongo_make_mongo_client(const mongoc_uri_t* uri, zval* driverOptions) /* {{{ */
-{
- const char *mongoc_version, *bson_version;
-
-#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",
- PHP_MONGODB_VERSION,
- PHP_MONGODB_STABILITY,
- MONGOC_VERSION_S,
- mongoc_version,
- BSON_VERSION_S,
- bson_version,
- PHP_VERSION);
-
- php_phongo_set_handshake_data(driverOptions);
-
- return mongoc_client_new_from_uri(uri);
-} /* }}} */
-
-static void php_phongo_persist_client(const char* hash, size_t hash_len, mongoc_client_t* client)
-{
- php_phongo_pclient_t* pclient = (php_phongo_pclient_t*) pecalloc(1, sizeof(php_phongo_pclient_t), 1);
-
- pclient->created_by_pid = (int) getpid();
- pclient->client = client;
-
- zend_hash_str_update_ptr(&MONGODB_G(pclients), hash, hash_len, pclient);
-}
-
-static mongoc_client_t* php_phongo_find_client(const char* hash, size_t hash_len)
-{
- php_phongo_pclient_t* pclient;
-
- if ((pclient = zend_hash_str_find_ptr(&MONGODB_G(pclients), hash, hash_len)) != NULL) {
- return pclient->client;
- }
-
- return NULL;
-}
-
-#ifdef MONGOC_ENABLE_CLIENT_SIDE_ENCRYPTION
-static bool phongo_manager_set_auto_encryption_opts(php_phongo_manager_t* manager, zval* driverOptions) /* {{{ */
-{
- zval* zAutoEncryptionOpts;
- bson_error_t error = { 0 };
- mongoc_auto_encryption_opts_t* auto_encryption_opts = NULL;
- bool retval = false;
-
- if (!driverOptions || !php_array_existsc(driverOptions, "autoEncryption")) {
- return true;
- }
-
- zAutoEncryptionOpts = php_array_fetch(driverOptions, "autoEncryption");
-
- if (Z_TYPE_P(zAutoEncryptionOpts) != IS_ARRAY) {
- phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Expected \"autoEncryption\" driver option to be array, %s given", PHONGO_ZVAL_CLASS_OR_TYPE_NAME_P(zAutoEncryptionOpts));
- return false;
- }
-
- auto_encryption_opts = mongoc_auto_encryption_opts_new();
-
- if (php_array_existsc(zAutoEncryptionOpts, "keyVaultClient")) {
- zval* key_vault_client = php_array_fetch(zAutoEncryptionOpts, "keyVaultClient");
-
- if (Z_TYPE_P(key_vault_client) != IS_OBJECT || !instanceof_function(Z_OBJCE_P(key_vault_client), php_phongo_manager_ce)) {
- phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Expected \"keyVaultClient\" encryption option to be %s, %s given", ZSTR_VAL(php_phongo_manager_ce->name), PHONGO_ZVAL_CLASS_OR_TYPE_NAME_P(key_vault_client));
- goto cleanup;
- }
-
- mongoc_auto_encryption_opts_set_keyvault_client(auto_encryption_opts, Z_MANAGER_OBJ_P(key_vault_client)->client);
- }
-
- if (php_array_existsc(zAutoEncryptionOpts, "keyVaultNamespace")) {
- char* key_vault_ns;
- char* db_name;
- char* coll_name;
- int plen;
- zend_bool pfree;
-
- key_vault_ns = php_array_fetch_string(zAutoEncryptionOpts, "keyVaultNamespace", &plen, &pfree);
-
- if (!phongo_split_namespace(key_vault_ns, &db_name, &coll_name)) {
- phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Expected \"keyVaultNamespace\" encryption option to contain a full collection name");
-
- if (pfree) {
- efree(key_vault_ns);
- }
-
- goto cleanup;
- }
-
- mongoc_auto_encryption_opts_set_keyvault_namespace(auto_encryption_opts, db_name, coll_name);
-
- efree(db_name);
- efree(coll_name);
-
- if (pfree) {
- efree(key_vault_ns);
- }
- }
-
- if (php_array_existsc(zAutoEncryptionOpts, "kmsProviders")) {
- zval* kms_providers = php_array_fetch(zAutoEncryptionOpts, "kmsProviders");
- bson_t bson_providers = BSON_INITIALIZER;
-
- if (Z_TYPE_P(kms_providers) != IS_OBJECT && Z_TYPE_P(kms_providers) != IS_ARRAY) {
- phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Expected \"kmsProviders\" encryption option to be an array or object");
- goto cleanup;
- }
-
- php_phongo_zval_to_bson(kms_providers, PHONGO_BSON_NONE, &bson_providers, NULL);
- if (EG(exception)) {
- goto cleanup;
- }
-
- mongoc_auto_encryption_opts_set_kms_providers(auto_encryption_opts, &bson_providers);
-
- bson_destroy(&bson_providers);
- }
-
- if (php_array_existsc(zAutoEncryptionOpts, "schemaMap")) {
- zval* schema_map = php_array_fetch(zAutoEncryptionOpts, "schemaMap");
- bson_t bson_map = BSON_INITIALIZER;
-
- if (Z_TYPE_P(schema_map) != IS_OBJECT && Z_TYPE_P(schema_map) != IS_ARRAY) {
- phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Expected \"schemaMap\" encryption option to be an array or object");
- goto cleanup;
- }
-
- php_phongo_zval_to_bson(schema_map, PHONGO_BSON_NONE, &bson_map, NULL);
- if (EG(exception)) {
- goto cleanup;
- }
-
- mongoc_auto_encryption_opts_set_schema_map(auto_encryption_opts, &bson_map);
-
- bson_destroy(&bson_map);
- }
-
- if (php_array_existsc(zAutoEncryptionOpts, "bypassAutoEncryption")) {
- zend_bool bypass_auto_encryption = php_array_fetch_bool(zAutoEncryptionOpts, "bypassAutoEncryption");
-
- mongoc_auto_encryption_opts_set_bypass_auto_encryption(auto_encryption_opts, bypass_auto_encryption);
- }
-
- if (php_array_existsc(zAutoEncryptionOpts, "extraOptions")) {
- zval* extra_options = php_array_fetch(zAutoEncryptionOpts, "extraOptions");
- bson_t bson_options = BSON_INITIALIZER;
-
- php_phongo_zval_to_bson(extra_options, PHONGO_BSON_NONE, &bson_options, NULL);
- if (EG(exception)) {
- goto cleanup;
- }
-
- mongoc_auto_encryption_opts_set_extra(auto_encryption_opts, &bson_options);
-
- bson_destroy(&bson_options);
- }
-
- if (!mongoc_client_enable_auto_encryption(manager->client, auto_encryption_opts, &error)) {
- phongo_throw_exception_from_bson_error_t(&error);
- goto cleanup;
- }
-
- retval = true;
-
-cleanup:
- mongoc_auto_encryption_opts_destroy(auto_encryption_opts);
- return retval;
-}
-/* }}} */
-
-static mongoc_client_encryption_opts_t* phongo_clientencryption_opts_from_zval(mongoc_client_t* defaultKeyVaultClient, zval* options) /* {{{ */
-{
- mongoc_client_encryption_opts_t* opts;
-
- opts = mongoc_client_encryption_opts_new();
-
- if (!options || Z_TYPE_P(options) != IS_ARRAY) {
- return opts;
- }
-
- if (php_array_existsc(options, "keyVaultClient")) {
- zval* key_vault_client = php_array_fetch(options, "keyVaultClient");
-
- if (Z_TYPE_P(key_vault_client) != IS_OBJECT || !instanceof_function(Z_OBJCE_P(key_vault_client), php_phongo_manager_ce)) {
- phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Expected \"keyVaultClient\" encryption option to be %s, %s given", ZSTR_VAL(php_phongo_manager_ce->name), PHONGO_ZVAL_CLASS_OR_TYPE_NAME_P(key_vault_client));
- goto cleanup;
- }
-
- mongoc_client_encryption_opts_set_keyvault_client(opts, Z_MANAGER_OBJ_P(key_vault_client)->client);
- } else {
- mongoc_client_encryption_opts_set_keyvault_client(opts, defaultKeyVaultClient);
- }
-
- if (php_array_existsc(options, "keyVaultNamespace")) {
- char* keyvault_namespace;
- char* db_name;
- char* coll_name;
- int plen;
- zend_bool pfree;
-
- keyvault_namespace = php_array_fetchc_string(options, "keyVaultNamespace", &plen, &pfree);
-
- if (!phongo_split_namespace(keyvault_namespace, &db_name, &coll_name)) {
- phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Expected \"keyVaultNamespace\" encryption option to contain a full collection name");
-
- if (pfree) {
- efree(keyvault_namespace);
- }
-
- goto cleanup;
- }
-
- mongoc_client_encryption_opts_set_keyvault_namespace(opts, db_name, coll_name);
- efree(db_name);
- efree(coll_name);
-
- if (pfree) {
- efree(keyvault_namespace);
- }
- }
-
- if (php_array_existsc(options, "kmsProviders")) {
- zval* kms_providers = php_array_fetchc(options, "kmsProviders");
- bson_t bson_providers = BSON_INITIALIZER;
-
- if (Z_TYPE_P(kms_providers) != IS_ARRAY && Z_TYPE_P(kms_providers) != IS_OBJECT) {
- phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Expected \"kmsProviders\" encryption option to be an array or object");
- goto cleanup;
- }
-
- php_phongo_zval_to_bson(kms_providers, PHONGO_BSON_NONE, &bson_providers, NULL);
- if (EG(exception)) {
- goto cleanup;
- }
-
- mongoc_client_encryption_opts_set_kms_providers(opts, &bson_providers);
- bson_destroy(&bson_providers);
- }
-
- return opts;
-
-cleanup:
- if (opts) {
- mongoc_client_encryption_opts_destroy(opts);
- }
-
- return NULL;
-} /* }}} */
-
-void phongo_clientencryption_init(php_phongo_clientencryption_t* clientencryption, mongoc_client_t* client, zval* options) /* {{{ */
-{
- mongoc_client_encryption_t* ce;
- mongoc_client_encryption_opts_t* opts;
- bson_error_t error = { 0 };
-
- opts = phongo_clientencryption_opts_from_zval(client, options);
- if (!opts) {
- /* Exception already thrown */
- goto cleanup;
- }
-
- ce = mongoc_client_encryption_new(opts, &error);
- if (!ce) {
- phongo_throw_exception_from_bson_error_t(&error);
-
- goto cleanup;
- }
-
- clientencryption->client_encryption = ce;
-
-cleanup:
- if (opts) {
- mongoc_client_encryption_opts_destroy(opts);
- }
-} /* }}} */
-
-static mongoc_client_encryption_datakey_opts_t* phongo_clientencryption_datakey_opts_from_zval(zval* options) /* {{{ */
-{
- mongoc_client_encryption_datakey_opts_t* opts;
-
- opts = mongoc_client_encryption_datakey_opts_new();
-
- if (!options || Z_TYPE_P(options) != IS_ARRAY) {
- return opts;
- }
-
- if (php_array_existsc(options, "keyAltNames")) {
- zval* zkeyaltnames = php_array_fetchc(options, "keyAltNames");
- HashTable* ht_data;
- uint32_t keyaltnames_count;
- char** keyaltnames;
- uint32_t i = 0;
- uint32_t j = 0;
- bool failed = false;
-
- if (!zkeyaltnames || Z_TYPE_P(zkeyaltnames) != IS_ARRAY) {
- phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Expected keyAltNames to be array, %s given", PHONGO_ZVAL_CLASS_OR_TYPE_NAME_P(zkeyaltnames));
- goto cleanup;
- }
-
- ht_data = HASH_OF(zkeyaltnames);
- keyaltnames_count = ht_data ? zend_hash_num_elements(ht_data) : 0;
- keyaltnames = ecalloc(keyaltnames_count, sizeof(char*));
-
- {
- zend_string* string_key = NULL;
- zend_ulong num_key = 0;
- zval* keyaltname;
-
- ZEND_HASH_FOREACH_KEY_VAL(ht_data, num_key, string_key, keyaltname)
- {
- if (i >= keyaltnames_count) {
- phongo_throw_exception(PHONGO_ERROR_LOGIC, "Iterating over too many keyAltNames. Please file a bug report");
- failed = true;
- break;
- }
-
- if (Z_TYPE_P(keyaltname) != IS_STRING) {
- if (string_key) {
- phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Expected keyAltName with index \"%s\" to be string, %s given", ZSTR_VAL(string_key), PHONGO_ZVAL_CLASS_OR_TYPE_NAME_P(keyaltname));
- } else {
- phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Expected keyAltName with index \"%lu\" to be string, %s given", num_key, PHONGO_ZVAL_CLASS_OR_TYPE_NAME_P(keyaltname));
- }
-
- failed = true;
- break;
- }
-
- keyaltnames[i] = estrdup(Z_STRVAL_P(keyaltname));
- i++;
- }
- ZEND_HASH_FOREACH_END();
- }
-
- if (!failed) {
- mongoc_client_encryption_datakey_opts_set_keyaltnames(opts, keyaltnames, keyaltnames_count);
- }
-
- for (j = 0; j < i; j++) {
- efree(keyaltnames[j]);
- }
- efree(keyaltnames);
-
- if (failed) {
- goto cleanup;
- }
- }
-
- if (php_array_existsc(options, "masterKey")) {
- bson_t masterkey = BSON_INITIALIZER;
-
- php_phongo_zval_to_bson(php_array_fetchc(options, "masterKey"), PHONGO_BSON_NONE, &masterkey, NULL);
- if (EG(exception)) {
- goto cleanup;
- }
-
- mongoc_client_encryption_datakey_opts_set_masterkey(opts, &masterkey);
- }
-
- return opts;
-
-cleanup:
- if (opts) {
- mongoc_client_encryption_datakey_opts_destroy(opts);
- }
-
- return NULL;
-} /* }}} */
-
-void phongo_clientencryption_create_datakey(php_phongo_clientencryption_t* clientencryption, zval* return_value, char* kms_provider, zval* options) /* {{{ */
-{
- mongoc_client_encryption_datakey_opts_t* opts;
- bson_value_t keyid;
- bson_error_t error = { 0 };
-
- opts = phongo_clientencryption_datakey_opts_from_zval(options);
- if (!opts) {
- /* Exception already thrown */
- goto cleanup;
- }
-
- if (!mongoc_client_encryption_create_datakey(clientencryption->client_encryption, kms_provider, opts, &keyid, &error)) {
- phongo_throw_exception_from_bson_error_t(&error);
- goto cleanup;
- }
-
- if (!php_phongo_bson_value_to_zval(&keyid, return_value)) {
- /* Exception already thrown */
- goto cleanup;
- }
-
-cleanup:
- if (opts) {
- mongoc_client_encryption_datakey_opts_destroy(opts);
- }
-} /* }}} */
-
-static mongoc_client_encryption_encrypt_opts_t* phongo_clientencryption_encrypt_opts_from_zval(zval* options) /* {{{ */
-{
- mongoc_client_encryption_encrypt_opts_t* opts;
-
- opts = mongoc_client_encryption_encrypt_opts_new();
-
- if (!options || Z_TYPE_P(options) != IS_ARRAY) {
- return opts;
- }
-
- if (php_array_existsc(options, "keyId")) {
- bson_value_t keyid;
-
- php_phongo_zval_to_bson_value(php_array_fetchc(options, "keyId"), PHONGO_BSON_NONE, &keyid);
- if (EG(exception)) {
- goto cleanup;
- }
-
- mongoc_client_encryption_encrypt_opts_set_keyid(opts, &keyid);
- }
-
- if (php_array_existsc(options, "keyAltName")) {
- char* keyaltname;
- int plen;
- zend_bool pfree;
-
- keyaltname = php_array_fetch_string(options, "keyAltName", &plen, &pfree);
- mongoc_client_encryption_encrypt_opts_set_keyaltname(opts, keyaltname);
-
- if (pfree) {
- efree(keyaltname);
- }
- }
-
- if (php_array_existsc(options, "algorithm")) {
- char* algorithm;
- int plen;
- zend_bool pfree;
-
- algorithm = php_array_fetch_string(options, "algorithm", &plen, &pfree);
- mongoc_client_encryption_encrypt_opts_set_algorithm(opts, algorithm);
-
- if (pfree) {
- efree(algorithm);
- }
- }
-
- return opts;
-
-cleanup:
- if (opts) {
- mongoc_client_encryption_encrypt_opts_destroy(opts);
- }
-
- return NULL;
-} /* }}} */
-
-void phongo_clientencryption_encrypt(php_phongo_clientencryption_t* clientencryption, zval* zvalue, zval* zciphertext, zval* options) /* {{{ */
-{
- mongoc_client_encryption_encrypt_opts_t* opts;
- bson_value_t ciphertext, value;
- bson_error_t error = { 0 };
-
- php_phongo_zval_to_bson_value(zvalue, PHONGO_BSON_NONE, &value);
-
- opts = phongo_clientencryption_encrypt_opts_from_zval(options);
- if (!opts) {
- /* Exception already thrown */
- goto cleanup;
- }
-
- if (!mongoc_client_encryption_encrypt(clientencryption->client_encryption, &value, opts, &ciphertext, &error)) {
- phongo_throw_exception_from_bson_error_t(&error);
- goto cleanup;
- }
-
- if (!php_phongo_bson_value_to_zval(&ciphertext, zciphertext)) {
- /* Exception already thrown */
- goto cleanup;
- }
-
-cleanup:
- if (opts) {
- mongoc_client_encryption_encrypt_opts_destroy(opts);
- }
-} /* }}} */
-
-void phongo_clientencryption_decrypt(php_phongo_clientencryption_t* clientencryption, zval* zciphertext, zval* zvalue) /* {{{ */
-{
- bson_value_t ciphertext, value;
- bson_error_t error = { 0 };
-
- php_phongo_zval_to_bson_value(zciphertext, PHONGO_BSON_NONE, &ciphertext);
-
- if (!mongoc_client_encryption_decrypt(clientencryption->client_encryption, &ciphertext, &value, &error)) {
- phongo_throw_exception_from_bson_error_t(&error);
- return;
- }
-
- if (!php_phongo_bson_value_to_zval(&value, zvalue)) {
- /* Exception already thrown */
- return;
- }
-}
-/* }}} */
-#else /* MONGOC_ENABLE_CLIENT_SIDE_ENCRYPTION */
-static void phongo_throw_exception_no_cse(php_phongo_error_domain_t domain, const char* message) /* {{{ */
-{
- phongo_throw_exception(domain, "%s Please recompile with support for libmongocrypt using the with-mongodb-client-side-encryption configure switch.", message);
-}
-/* }}} */
-
-static bool phongo_manager_set_auto_encryption_opts(php_phongo_manager_t* manager, zval* driverOptions) /* {{{ */
-{
- if (!driverOptions || !php_array_existsc(driverOptions, "autoEncryption")) {
- return true;
- }
-
- phongo_throw_exception_no_cse(PHONGO_ERROR_INVALID_ARGUMENT, "Cannot enable automatic field-level encryption.");
-
- return false;
-}
-/* }}} */
-
-void phongo_clientencryption_init(php_phongo_clientencryption_t* clientencryption, mongoc_client_t* client, zval* options) /* {{{ */
-{
- phongo_throw_exception_no_cse(PHONGO_ERROR_RUNTIME, "Cannot configure clientEncryption object.");
-}
-/* }}} */
-
-void phongo_clientencryption_create_datakey(php_phongo_clientencryption_t* clientencryption, zval* return_value, char* kms_provider, zval* options) /* {{{ */
-{
- phongo_throw_exception_no_cse(PHONGO_ERROR_RUNTIME, "Cannot create encryption key.");
-}
-/* }}} */
-
-void phongo_clientencryption_encrypt(php_phongo_clientencryption_t* clientencryption, zval* zvalue, zval* zciphertext, zval* options) /* {{{ */
-{
- phongo_throw_exception_no_cse(PHONGO_ERROR_RUNTIME, "Cannot encrypt value.");
-}
-/* }}} */
-
-void phongo_clientencryption_decrypt(php_phongo_clientencryption_t* clientencryption, zval* zciphertext, zval* zvalue) /* {{{ */
-{
- phongo_throw_exception_no_cse(PHONGO_ERROR_RUNTIME, "Cannot decrypt value.");
-}
-/* }}} */
-#endif
-
-void phongo_manager_init(php_phongo_manager_t* manager, const char* uri_string, zval* options, zval* driverOptions) /* {{{ */
-{
- bson_t bson_options = BSON_INITIALIZER;
- mongoc_uri_t* uri = NULL;
-#ifdef MONGOC_ENABLE_SSL
- mongoc_ssl_opt_t* ssl_opt = NULL;
-#endif
-
- if (!(manager->client_hash = php_phongo_manager_make_client_hash(uri_string, options, driverOptions, &manager->client_hash_len))) {
- /* Exception should already have been thrown and there is nothing to free */
- return;
- }
-
- if ((manager->client = php_phongo_find_client(manager->client_hash, manager->client_hash_len))) {
- MONGOC_DEBUG("Found client for hash: %s\n", manager->client_hash);
- goto cleanup;
- }
-
- if (options) {
- php_phongo_zval_to_bson(options, PHONGO_BSON_NONE, &bson_options, NULL);
- }
-
- /* An exception may be thrown during BSON conversion */
- if (EG(exception)) {
- goto cleanup;
- }
-
- if (!(uri = php_phongo_make_uri(uri_string))) {
- /* Exception should already have been thrown */
- goto cleanup;
- }
-
- if (!php_phongo_apply_options_to_uri(uri, &bson_options) ||
- !php_phongo_apply_rc_options_to_uri(uri, &bson_options) ||
- !php_phongo_apply_rp_options_to_uri(uri, &bson_options) ||
- !php_phongo_apply_wc_options_to_uri(uri, &bson_options)) {
- /* Exception should already have been thrown */
- goto cleanup;
- }
-
-#ifdef MONGOC_ENABLE_SSL
- if (!php_phongo_apply_driver_options_to_uri(uri, driverOptions)) {
- /* Exception should already have been thrown */
- goto cleanup;
- }
-
- ssl_opt = php_phongo_make_ssl_opt(uri, driverOptions);
-
- /* An exception may be thrown during SSL option creation */
- if (EG(exception)) {
- goto cleanup;
- }
-
- if (!php_phongo_uri_finalize_tls(uri)) {
- /* Exception should already have been thrown */
- goto cleanup;
- }
-#else
- if (mongoc_uri_get_tls(uri)) {
- phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Cannot create SSL client. SSL is not enabled in this build.");
- goto cleanup;
- }
-#endif
-
- manager->client = php_phongo_make_mongo_client(uri, driverOptions);
- mongoc_client_set_error_api(manager->client, MONGOC_ERROR_API_VERSION_2);
-
- if (!manager->client) {
- phongo_throw_exception(PHONGO_ERROR_RUNTIME, "Failed to create Manager from URI: '%s'", uri_string);
- goto cleanup;
- }
-
-#ifdef MONGOC_ENABLE_SSL
- if (ssl_opt) {
- mongoc_client_set_ssl_opts(manager->client, ssl_opt);
- }
-#endif
-
- if (!phongo_manager_set_auto_encryption_opts(manager, driverOptions)) {
- /* Exception should already have been thrown */
- goto cleanup;
- }
-
- MONGOC_DEBUG("Created client hash: %s\n", manager->client_hash);
- php_phongo_persist_client(manager->client_hash, manager->client_hash_len, manager->client);
-
-cleanup:
- bson_destroy(&bson_options);
-
- if (uri) {
- mongoc_uri_destroy(uri);
- }
-
-#ifdef MONGOC_ENABLE_SSL
- if (ssl_opt) {
- php_phongo_free_ssl_opt(ssl_opt);
- }
-#endif
-} /* }}} */
-
-bool php_phongo_parse_int64(int64_t* retval, const char* data, size_t data_len) /* {{{ */
-{
- int64_t value;
- char* endptr = NULL;
-
- /* bson_ascii_strtoll() sets errno if conversion fails. If conversion
- * succeeds, we still want to ensure that the entire string was parsed. */
- value = bson_ascii_strtoll(data, &endptr, 10);
-
- if (errno || (endptr && endptr != ((const char*) data + data_len))) {
- return false;
- }
-
- *retval = value;
-
- return true;
-} /* }}} */
-
-/* {{{ 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);
- }
-} /* }}} */
-
-/* }}} */
-
-/* {{{ M[INIT|SHUTDOWN] R[INIT|SHUTDOWN] G[INIT|SHUTDOWN] MINFO INI */
-
-ZEND_INI_MH(OnUpdateDebug)
-{
- void*** ctx = NULL;
- char* tmp_dir = NULL;
-
- /* 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);
-
- return OnUpdateString(entry, new_value, mh_arg1, mh_arg2, mh_arg3, stage);
- }
-
- 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;
- zend_string* filename;
-
- time(&t);
- len = spprintf(&prefix, 0, "PHONGO-%ld", t);
-
- fd = php_open_temporary_fd(tmp_dir, prefix, &filename);
- 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);
-
- return OnUpdateString(entry, new_value, mh_arg1, mh_arg2, mh_arg3, stage);
-}
-
-/* {{{ INI entries */
-PHP_INI_BEGIN()
- STD_PHP_INI_ENTRY(PHONGO_DEBUG_INI, PHONGO_DEBUG_INI_DEFAULT, PHP_INI_ALL, OnUpdateDebug, debug, zend_mongodb_globals, mongodb_globals)
-PHP_INI_END()
-/* }}} */
-
-static void phongo_pclient_reset_once(php_phongo_pclient_t* pclient, int pid)
-{
- if (pclient->last_reset_by_pid != pid) {
- mongoc_client_reset(pclient->client);
- pclient->last_reset_by_pid = pid;
- }
-}
-
-/* Resets the libmongoc client if it has not already been reset for the current
- * PID (based on information in the hash table of persisted libmongoc clients).
- * This ensures that we do not reset a client multiple times from the same child
- * process. */
-void php_phongo_client_reset_once(mongoc_client_t* client, int pid)
-{
- HashTable* pclients;
- zval* z_ptr;
- php_phongo_pclient_t* pclient;
-
- pclients = &MONGODB_G(pclients);
-
- ZEND_HASH_FOREACH_VAL(pclients, z_ptr)
- {
- if ((Z_TYPE_P(z_ptr) != IS_PTR)) {
- continue;
- }
-
- pclient = (php_phongo_pclient_t*) Z_PTR_P(z_ptr);
-
- if (pclient->client == client) {
- phongo_pclient_reset_once(pclient, pid);
- return;
- }
- }
- ZEND_HASH_FOREACH_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->created_by_pid == getpid()) {
- mongoc_client_destroy(pclient->client);
- }
-
- pefree(pclient, 1);
-}
-
-/* {{{ PHP_RINIT_FUNCTION */
-PHP_RINIT_FUNCTION(mongodb)
-{
- /* Initialize HashTable for APM subscribers, which is initialized to NULL in
- * GINIT and destroyed and reset to NULL in RSHUTDOWN. */
- if (MONGODB_G(subscribers) == NULL) {
- ALLOC_HASHTABLE(MONGODB_G(subscribers));
- zend_hash_init(MONGODB_G(subscribers), 0, NULL, ZVAL_PTR_DTOR, 0);
- }
-
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ 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 defined(COMPILE_DL_MONGODB) && defined(ZTS)
- ZEND_TSRMLS_CACHE_UPDATE();
-#endif
- memset(mongodb_globals, 0, sizeof(zend_mongodb_globals));
- mongodb_globals->bsonMemVTable = bsonMemVTable;
-
- /* Initialize HashTable for persistent clients */
- zend_hash_init_ex(&mongodb_globals->pclients, 0, NULL, NULL, 1, 0);
-}
-/* }}} */
-
-static zend_class_entry* php_phongo_fetch_internal_class(const char* class_name, size_t class_name_len)
-{
- zend_class_entry* pce;
-
- if ((pce = zend_hash_str_find_ptr(CG(class_table), class_name, class_name_len))) {
- return pce;
- }
-
- return NULL;
-}
-
-static HashTable* php_phongo_std_get_gc(zval* object, zval** table, int* n) /* {{{ */
-{
- *table = NULL;
- *n = 0;
- return zend_std_get_properties(object);
-} /* }}} */
-
-/* {{{ PHP_MINIT_FUNCTION */
-PHP_MINIT_FUNCTION(mongodb)
-{
- (void) type; /* We don't care if we are loaded via dl() or extension= */
-
- REGISTER_INI_ENTRIES();
-
- /* Initialize libmongoc */
- mongoc_init();
-
- /* 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));
- /* Disable cloning by default. Individual classes can opt in if they need to
- * support this (e.g. BSON objects). */
- phongo_std_object_handlers.clone_obj = NULL;
- /* Ensure that get_gc delegates to zend_std_get_properties directly in case
- * our class defines a get_properties handler for debugging purposes. */
- phongo_std_object_handlers.get_gc = php_phongo_std_get_gc;
-
- /* 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"));
- php_phongo_json_serializable_ce = php_phongo_fetch_internal_class(ZEND_STRL("jsonserializable"));
-
- 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;
- }
-
- /* Register base BSON classes first */
- php_phongo_type_init_ce(INIT_FUNC_ARGS_PASSTHRU);
- php_phongo_serializable_init_ce(INIT_FUNC_ARGS_PASSTHRU);
- php_phongo_unserializable_init_ce(INIT_FUNC_ARGS_PASSTHRU);
-
- php_phongo_binary_interface_init_ce(INIT_FUNC_ARGS_PASSTHRU);
- php_phongo_decimal128_interface_init_ce(INIT_FUNC_ARGS_PASSTHRU);
- php_phongo_javascript_interface_init_ce(INIT_FUNC_ARGS_PASSTHRU);
- php_phongo_maxkey_interface_init_ce(INIT_FUNC_ARGS_PASSTHRU);
- php_phongo_minkey_interface_init_ce(INIT_FUNC_ARGS_PASSTHRU);
- php_phongo_objectid_interface_init_ce(INIT_FUNC_ARGS_PASSTHRU);
- php_phongo_regex_interface_init_ce(INIT_FUNC_ARGS_PASSTHRU);
- php_phongo_timestamp_interface_init_ce(INIT_FUNC_ARGS_PASSTHRU);
- php_phongo_utcdatetime_interface_init_ce(INIT_FUNC_ARGS_PASSTHRU);
-
- php_phongo_binary_init_ce(INIT_FUNC_ARGS_PASSTHRU);
- php_phongo_dbpointer_init_ce(INIT_FUNC_ARGS_PASSTHRU);
- php_phongo_decimal128_init_ce(INIT_FUNC_ARGS_PASSTHRU);
- php_phongo_int64_init_ce(INIT_FUNC_ARGS_PASSTHRU);
- php_phongo_javascript_init_ce(INIT_FUNC_ARGS_PASSTHRU);
- php_phongo_maxkey_init_ce(INIT_FUNC_ARGS_PASSTHRU);
- php_phongo_minkey_init_ce(INIT_FUNC_ARGS_PASSTHRU);
- php_phongo_objectid_init_ce(INIT_FUNC_ARGS_PASSTHRU);
- php_phongo_persistable_init_ce(INIT_FUNC_ARGS_PASSTHRU);
- php_phongo_regex_init_ce(INIT_FUNC_ARGS_PASSTHRU);
- php_phongo_symbol_init_ce(INIT_FUNC_ARGS_PASSTHRU);
- php_phongo_timestamp_init_ce(INIT_FUNC_ARGS_PASSTHRU);
- php_phongo_undefined_init_ce(INIT_FUNC_ARGS_PASSTHRU);
- php_phongo_utcdatetime_init_ce(INIT_FUNC_ARGS_PASSTHRU);
-
- php_phongo_cursor_interface_init_ce(INIT_FUNC_ARGS_PASSTHRU);
-
- php_phongo_bulkwrite_init_ce(INIT_FUNC_ARGS_PASSTHRU);
- php_phongo_clientencryption_init_ce(INIT_FUNC_ARGS_PASSTHRU);
- php_phongo_command_init_ce(INIT_FUNC_ARGS_PASSTHRU);
- php_phongo_cursor_init_ce(INIT_FUNC_ARGS_PASSTHRU);
- php_phongo_cursorid_init_ce(INIT_FUNC_ARGS_PASSTHRU);
- php_phongo_manager_init_ce(INIT_FUNC_ARGS_PASSTHRU);
- php_phongo_query_init_ce(INIT_FUNC_ARGS_PASSTHRU);
- php_phongo_readconcern_init_ce(INIT_FUNC_ARGS_PASSTHRU);
- php_phongo_readpreference_init_ce(INIT_FUNC_ARGS_PASSTHRU);
- php_phongo_server_init_ce(INIT_FUNC_ARGS_PASSTHRU);
- php_phongo_session_init_ce(INIT_FUNC_ARGS_PASSTHRU);
- php_phongo_writeconcern_init_ce(INIT_FUNC_ARGS_PASSTHRU);
- php_phongo_writeconcernerror_init_ce(INIT_FUNC_ARGS_PASSTHRU);
- php_phongo_writeerror_init_ce(INIT_FUNC_ARGS_PASSTHRU);
- php_phongo_writeresult_init_ce(INIT_FUNC_ARGS_PASSTHRU);
-
- /* Register base exception classes first */
- php_phongo_exception_init_ce(INIT_FUNC_ARGS_PASSTHRU);
- php_phongo_runtimeexception_init_ce(INIT_FUNC_ARGS_PASSTHRU);
- php_phongo_serverexception_init_ce(INIT_FUNC_ARGS_PASSTHRU);
- php_phongo_connectionexception_init_ce(INIT_FUNC_ARGS_PASSTHRU);
- php_phongo_writeexception_init_ce(INIT_FUNC_ARGS_PASSTHRU);
-
- php_phongo_authenticationexception_init_ce(INIT_FUNC_ARGS_PASSTHRU);
- php_phongo_bulkwriteexception_init_ce(INIT_FUNC_ARGS_PASSTHRU);
- php_phongo_commandexception_init_ce(INIT_FUNC_ARGS_PASSTHRU);
- php_phongo_connectiontimeoutexception_init_ce(INIT_FUNC_ARGS_PASSTHRU);
- php_phongo_encryptionexception_init_ce(INIT_FUNC_ARGS_PASSTHRU);
- php_phongo_executiontimeoutexception_init_ce(INIT_FUNC_ARGS_PASSTHRU);
- php_phongo_invalidargumentexception_init_ce(INIT_FUNC_ARGS_PASSTHRU);
- php_phongo_logicexception_init_ce(INIT_FUNC_ARGS_PASSTHRU);
- php_phongo_sslconnectionexception_init_ce(INIT_FUNC_ARGS_PASSTHRU);
- php_phongo_unexpectedvalueexception_init_ce(INIT_FUNC_ARGS_PASSTHRU);
-
- /* Register base APM classes first */
- php_phongo_subscriber_init_ce(INIT_FUNC_ARGS_PASSTHRU);
- php_phongo_commandsubscriber_init_ce(INIT_FUNC_ARGS_PASSTHRU);
- php_phongo_commandfailedevent_init_ce(INIT_FUNC_ARGS_PASSTHRU);
- php_phongo_commandstartedevent_init_ce(INIT_FUNC_ARGS_PASSTHRU);
- php_phongo_commandsucceededevent_init_ce(INIT_FUNC_ARGS_PASSTHRU);
-
- 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)
-{
- HashTable* pclients = &MONGODB_G(pclients);
- zval* z_ptr;
- (void) type; /* We don't care if we are loaded via dl() or extension= */
-
- /* Destroy mongoc_client_t objects in reverse order. This is necessary to
- * prevent segmentation faults as clients may reference other clients in
- * encryption settings. */
- ZEND_HASH_REVERSE_FOREACH_VAL(pclients, z_ptr)
- {
- if ((Z_TYPE_P(z_ptr) != IS_PTR)) {
- continue;
- }
-
- php_phongo_pclient_destroy((php_phongo_pclient_t*) Z_PTR_P(z_ptr));
- }
- ZEND_HASH_FOREACH_END();
-
- /* Destroy HashTable for persistent clients. mongoc_client_t objects have been destroyed earlier. */
- zend_hash_destroy(&MONGODB_G(pclients));
-
- bson_mem_restore_vtable();
- /* Cleanup after libmongoc */
- mongoc_cleanup();
-
- UNREGISTER_INI_ENTRIES();
-
- return SUCCESS;
-}
-/* }}} */
-
-/* {{{ PHP_RSHUTDOWN_FUNCTION */
-PHP_RSHUTDOWN_FUNCTION(mongodb)
-{
- /* Destroy HashTable for APM subscribers, which was initialized in RINIT */
- if (MONGODB_G(subscribers)) {
- zend_hash_destroy(MONGODB_G(subscribers));
- FREE_HASHTABLE(MONGODB_G(subscribers));
- MONGODB_G(subscribers) = NULL;
- }
-
- 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", 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 /* MONGOC_ENABLE_SSL */
- 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 /* MONGOC_ENABLE_CRYPTO */
- 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
-
-#ifdef MONGOC_ENABLE_ICU
- php_info_print_table_row(2, "libmongoc ICU", "enabled");
-#else
- php_info_print_table_row(2, "libmongoc ICU", "disabled");
-#endif
-
-#ifdef MONGOC_ENABLE_COMPRESSION
- php_info_print_table_row(2, "libmongoc compression", "enabled");
-#ifdef MONGOC_ENABLE_COMPRESSION_SNAPPY
- php_info_print_table_row(2, "libmongoc compression snappy", "enabled");
-#else
- php_info_print_table_row(2, "libmongoc compression snappy", "disabled");
-#endif
-#ifdef MONGOC_ENABLE_COMPRESSION_ZLIB
- php_info_print_table_row(2, "libmongoc compression zlib", "enabled");
-#else
- php_info_print_table_row(2, "libmongoc compression zlib", "disabled");
-#endif
-#ifdef MONGOC_ENABLE_COMPRESSION_ZSTD
- php_info_print_table_row(2, "libmongoc compression zstd", "enabled");
-#else
- php_info_print_table_row(2, "libmongoc compression zstd", "disabled");
-#endif
-#else /* MONGOC_ENABLE_COMPRESSION */
- php_info_print_table_row(2, "libmongoc compression", "disabled");
-#endif
-
-#ifdef MONGOC_ENABLE_CLIENT_SIDE_ENCRYPTION
-#ifdef HAVE_SYSTEM_LIBMONGOCRYPT
- php_info_print_table_row(2, "libmongocrypt headers version", MONGOCRYPT_VERSION);
- php_info_print_table_row(2, "libmongocrypt library version", mongocrypt_version(NULL));
-#else
- php_info_print_table_row(2, "libmongocrypt bundled version", MONGOCRYPT_VERSION);
-#endif
-
-#ifdef MONGOCRYPT_ENABLE_CRYPTO
- php_info_print_table_row(2, "libmongocrypt crypto", "enabled");
-
-#if defined(MONGOCRYPT_ENABLE_CRYPTO_LIBCRYPTO)
- php_info_print_table_row(2, "libmongocrypt crypto library", "libcrypto");
-#elif defined(MONGOCRYPT_ENABLE_CRYPTO_COMMON_CRYPTO)
- php_info_print_table_row(2, "libmongocrypt crypto library", "Common Crypto");
-#elif defined(MONGOCRYPT_ENABLE_CRYPTO_CNG)
- php_info_print_table_row(2, "libmongocrypt crypto library", "CNG");
-#else
- php_info_print_table_row(2, "libmongocrypt crypto library", "unknown");
-#endif
-#else /* MONGOCRYPT_ENABLE_CRYPTO */
- php_info_print_table_row(2, "libmongocrypt crypto", "disabled");
-#endif
-#else /* MONGOC_ENABLE_CLIENT_SIDE_ENCRYPTION */
- php_info_print_table_row(2, "libmongocrypt", "disabled");
-#endif
-
- php_info_print_table_end();
-
- DISPLAY_INI_ENTRIES();
-}
-/* }}} */
-/* }}} */
-
-/* {{{ Shared function entries for disabling constructors and unserialize() */
-PHP_FUNCTION(MongoDB_disabled___construct) /* {{{ */
-{
- phongo_throw_exception(PHONGO_ERROR_RUNTIME, "Accessing private constructor");
-} /* }}} */
-
-PHP_FUNCTION(MongoDB_disabled___wakeup) /* {{{ */
-{
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
-
- phongo_throw_exception(PHONGO_ERROR_RUNTIME, "%s", "MongoDB\\Driver objects cannot be serialized");
-} /* }}} */
- /* }}} */
-
-/* {{{ 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_ARG_ARRAY_INFO(0, typemap, 0)
-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();
-
-ZEND_BEGIN_ARG_INFO_EX(ai_mongodb_driver_monitoring_subscriber, 0, 0, 1)
- ZEND_ARG_OBJ_INFO(0, subscriber, MongoDB\\Driver\\Monitoring\\Subscriber, 0)
-ZEND_END_ARG_INFO();
-
-static const zend_function_entry mongodb_functions[] = {
- ZEND_NS_NAMED_FE("MongoDB\\BSON", fromPHP, PHP_FN(MongoDB_BSON_fromPHP), ai_bson_fromPHP)
- ZEND_NS_NAMED_FE("MongoDB\\BSON", toPHP, PHP_FN(MongoDB_BSON_toPHP), ai_bson_toPHP)
- ZEND_NS_NAMED_FE("MongoDB\\BSON", toJSON, PHP_FN(MongoDB_BSON_toJSON), ai_bson_toJSON)
- ZEND_NS_NAMED_FE("MongoDB\\BSON", toCanonicalExtendedJSON, PHP_FN(MongoDB_BSON_toCanonicalExtendedJSON), ai_bson_toJSON)
- ZEND_NS_NAMED_FE("MongoDB\\BSON", toRelaxedExtendedJSON, PHP_FN(MongoDB_BSON_toRelaxedExtendedJSON), ai_bson_toJSON)
- ZEND_NS_NAMED_FE("MongoDB\\BSON", fromJSON, PHP_FN(MongoDB_BSON_fromJSON), ai_bson_fromJSON)
- ZEND_NS_NAMED_FE("MongoDB\\Driver\\Monitoring", addSubscriber, PHP_FN(MongoDB_Driver_Monitoring_addSubscriber), ai_mongodb_driver_monitoring_subscriber)
- ZEND_NS_NAMED_FE("MongoDB\\Driver\\Monitoring", removeSubscriber, PHP_FN(MongoDB_Driver_Monitoring_removeSubscriber), ai_mongodb_driver_monitoring_subscriber)
- 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),
- PHP_RINIT(mongodb),
- PHP_RSHUTDOWN(mongodb),
- PHP_MINFO(mongodb),
- 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.8.1/php_phongo_classes.h b/mongodb-1.8.1/php_phongo_classes.h
deleted file mode 100644
index e832319e..00000000
--- a/mongodb-1.8.1/php_phongo_classes.h
+++ /dev/null
@@ -1,369 +0,0 @@
-/*
- * 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_CLASSES_H
-#define PHONGO_CLASSES_H
-
-#include "php_phongo_structs.h"
-
-/* Export zend_class_entry dependencies, which are initialized in MINIT */
-extern zend_class_entry* php_phongo_date_immutable_ce;
-extern zend_class_entry* php_phongo_json_serializable_ce;
-
-static inline php_phongo_bulkwrite_t* php_bulkwrite_fetch_object(zend_object* obj)
-{
- return (php_phongo_bulkwrite_t*) ((char*) obj - XtOffsetOf(php_phongo_bulkwrite_t, std));
-}
-static inline php_phongo_clientencryption_t* php_clientencryption_fetch_object(zend_object* obj)
-{
- return (php_phongo_clientencryption_t*) ((char*) obj - XtOffsetOf(php_phongo_clientencryption_t, std));
-}
-static inline php_phongo_command_t* php_command_fetch_object(zend_object* obj)
-{
- return (php_phongo_command_t*) ((char*) obj - XtOffsetOf(php_phongo_command_t, std));
-}
-static inline php_phongo_cursor_t* php_cursor_fetch_object(zend_object* obj)
-{
- return (php_phongo_cursor_t*) ((char*) obj - XtOffsetOf(php_phongo_cursor_t, std));
-}
-static inline php_phongo_cursorid_t* php_cursorid_fetch_object(zend_object* obj)
-{
- return (php_phongo_cursorid_t*) ((char*) obj - XtOffsetOf(php_phongo_cursorid_t, std));
-}
-static inline php_phongo_manager_t* php_manager_fetch_object(zend_object* obj)
-{
- return (php_phongo_manager_t*) ((char*) obj - XtOffsetOf(php_phongo_manager_t, std));
-}
-static inline php_phongo_query_t* php_query_fetch_object(zend_object* obj)
-{
- return (php_phongo_query_t*) ((char*) obj - XtOffsetOf(php_phongo_query_t, std));
-}
-static inline php_phongo_readconcern_t* php_readconcern_fetch_object(zend_object* obj)
-{
- return (php_phongo_readconcern_t*) ((char*) obj - XtOffsetOf(php_phongo_readconcern_t, std));
-}
-static inline php_phongo_readpreference_t* php_readpreference_fetch_object(zend_object* obj)
-{
- return (php_phongo_readpreference_t*) ((char*) obj - XtOffsetOf(php_phongo_readpreference_t, std));
-}
-static inline php_phongo_server_t* php_server_fetch_object(zend_object* obj)
-{
- return (php_phongo_server_t*) ((char*) obj - XtOffsetOf(php_phongo_server_t, std));
-}
-static inline php_phongo_session_t* php_session_fetch_object(zend_object* obj)
-{
- return (php_phongo_session_t*) ((char*) obj - XtOffsetOf(php_phongo_session_t, std));
-}
-static inline php_phongo_writeconcern_t* php_writeconcern_fetch_object(zend_object* obj)
-{
- return (php_phongo_writeconcern_t*) ((char*) obj - XtOffsetOf(php_phongo_writeconcern_t, std));
-}
-static inline php_phongo_writeconcernerror_t* php_writeconcernerror_fetch_object(zend_object* obj)
-{
- return (php_phongo_writeconcernerror_t*) ((char*) obj - XtOffsetOf(php_phongo_writeconcernerror_t, std));
-}
-static inline php_phongo_writeerror_t* php_writeerror_fetch_object(zend_object* obj)
-{
- return (php_phongo_writeerror_t*) ((char*) obj - XtOffsetOf(php_phongo_writeerror_t, std));
-}
-static inline php_phongo_writeresult_t* php_writeresult_fetch_object(zend_object* obj)
-{
- return (php_phongo_writeresult_t*) ((char*) obj - XtOffsetOf(php_phongo_writeresult_t, std));
-}
-static inline php_phongo_binary_t* php_binary_fetch_object(zend_object* obj)
-{
- return (php_phongo_binary_t*) ((char*) obj - XtOffsetOf(php_phongo_binary_t, std));
-}
-static inline php_phongo_dbpointer_t* php_dbpointer_fetch_object(zend_object* obj)
-{
- return (php_phongo_dbpointer_t*) ((char*) obj - XtOffsetOf(php_phongo_dbpointer_t, std));
-}
-static inline php_phongo_decimal128_t* php_decimal128_fetch_object(zend_object* obj)
-{
- return (php_phongo_decimal128_t*) ((char*) obj - XtOffsetOf(php_phongo_decimal128_t, std));
-}
-static inline php_phongo_int64_t* php_int64_fetch_object(zend_object* obj)
-{
- return (php_phongo_int64_t*) ((char*) obj - XtOffsetOf(php_phongo_int64_t, std));
-}
-static inline php_phongo_javascript_t* php_javascript_fetch_object(zend_object* obj)
-{
- return (php_phongo_javascript_t*) ((char*) obj - XtOffsetOf(php_phongo_javascript_t, std));
-}
-static inline php_phongo_maxkey_t* php_maxkey_fetch_object(zend_object* obj)
-{
- return (php_phongo_maxkey_t*) ((char*) obj - XtOffsetOf(php_phongo_maxkey_t, std));
-}
-static inline php_phongo_minkey_t* php_minkey_fetch_object(zend_object* obj)
-{
- return (php_phongo_minkey_t*) ((char*) obj - XtOffsetOf(php_phongo_minkey_t, std));
-}
-static inline php_phongo_objectid_t* php_objectid_fetch_object(zend_object* obj)
-{
- return (php_phongo_objectid_t*) ((char*) obj - XtOffsetOf(php_phongo_objectid_t, std));
-}
-static inline php_phongo_regex_t* php_regex_fetch_object(zend_object* obj)
-{
- return (php_phongo_regex_t*) ((char*) obj - XtOffsetOf(php_phongo_regex_t, std));
-}
-static inline php_phongo_symbol_t* php_symbol_fetch_object(zend_object* obj)
-{
- return (php_phongo_symbol_t*) ((char*) obj - XtOffsetOf(php_phongo_symbol_t, std));
-}
-static inline php_phongo_timestamp_t* php_timestamp_fetch_object(zend_object* obj)
-{
- return (php_phongo_timestamp_t*) ((char*) obj - XtOffsetOf(php_phongo_timestamp_t, std));
-}
-static inline php_phongo_undefined_t* php_undefined_fetch_object(zend_object* obj)
-{
- return (php_phongo_undefined_t*) ((char*) obj - XtOffsetOf(php_phongo_undefined_t, std));
-}
-static inline php_phongo_utcdatetime_t* php_utcdatetime_fetch_object(zend_object* obj)
-{
- return (php_phongo_utcdatetime_t*) ((char*) obj - XtOffsetOf(php_phongo_utcdatetime_t, std));
-}
-static inline php_phongo_commandfailedevent_t* php_commandfailedevent_fetch_object(zend_object* obj)
-{
- return (php_phongo_commandfailedevent_t*) ((char*) obj - XtOffsetOf(php_phongo_commandfailedevent_t, std));
-}
-static inline php_phongo_commandstartedevent_t* php_commandstartedevent_fetch_object(zend_object* obj)
-{
- return (php_phongo_commandstartedevent_t*) ((char*) obj - XtOffsetOf(php_phongo_commandstartedevent_t, std));
-}
-static inline php_phongo_commandsucceededevent_t* php_commandsucceededevent_fetch_object(zend_object* obj)
-{
- return (php_phongo_commandsucceededevent_t*) ((char*) obj - XtOffsetOf(php_phongo_commandsucceededevent_t, std));
-}
-
-#define Z_CLIENTENCRYPTION_OBJ_P(zv) (php_clientencryption_fetch_object(Z_OBJ_P(zv)))
-#define Z_COMMAND_OBJ_P(zv) (php_command_fetch_object(Z_OBJ_P(zv)))
-#define Z_CURSOR_OBJ_P(zv) (php_cursor_fetch_object(Z_OBJ_P(zv)))
-#define Z_CURSORID_OBJ_P(zv) (php_cursorid_fetch_object(Z_OBJ_P(zv)))
-#define Z_MANAGER_OBJ_P(zv) (php_manager_fetch_object(Z_OBJ_P(zv)))
-#define Z_QUERY_OBJ_P(zv) (php_query_fetch_object(Z_OBJ_P(zv)))
-#define Z_READCONCERN_OBJ_P(zv) (php_readconcern_fetch_object(Z_OBJ_P(zv)))
-#define Z_READPREFERENCE_OBJ_P(zv) (php_readpreference_fetch_object(Z_OBJ_P(zv)))
-#define Z_SERVER_OBJ_P(zv) (php_server_fetch_object(Z_OBJ_P(zv)))
-#define Z_SESSION_OBJ_P(zv) (php_session_fetch_object(Z_OBJ_P(zv)))
-#define Z_BULKWRITE_OBJ_P(zv) (php_bulkwrite_fetch_object(Z_OBJ_P(zv)))
-#define Z_WRITECONCERN_OBJ_P(zv) (php_writeconcern_fetch_object(Z_OBJ_P(zv)))
-#define Z_WRITECONCERNERROR_OBJ_P(zv) (php_writeconcernerror_fetch_object(Z_OBJ_P(zv)))
-#define Z_WRITEERROR_OBJ_P(zv) (php_writeerror_fetch_object(Z_OBJ_P(zv)))
-#define Z_WRITERESULT_OBJ_P(zv) (php_writeresult_fetch_object(Z_OBJ_P(zv)))
-#define Z_BINARY_OBJ_P(zv) (php_binary_fetch_object(Z_OBJ_P(zv)))
-#define Z_DBPOINTER_OBJ_P(zv) (php_dbpointer_fetch_object(Z_OBJ_P(zv)))
-#define Z_DECIMAL128_OBJ_P(zv) (php_decimal128_fetch_object(Z_OBJ_P(zv)))
-#define Z_INT64_OBJ_P(zv) (php_int64_fetch_object(Z_OBJ_P(zv)))
-#define Z_JAVASCRIPT_OBJ_P(zv) (php_javascript_fetch_object(Z_OBJ_P(zv)))
-#define Z_MAXKEY_OBJ_P(zv) (php_maxkey_fetch_object(Z_OBJ_P(zv)))
-#define Z_MINKEY_OBJ_P(zv) (php_minkey_fetch_object(Z_OBJ_P(zv)))
-#define Z_OBJECTID_OBJ_P(zv) (php_objectid_fetch_object(Z_OBJ_P(zv)))
-#define Z_REGEX_OBJ_P(zv) (php_regex_fetch_object(Z_OBJ_P(zv)))
-#define Z_SYMBOL_OBJ_P(zv) (php_symbol_fetch_object(Z_OBJ_P(zv)))
-#define Z_TIMESTAMP_OBJ_P(zv) (php_timestamp_fetch_object(Z_OBJ_P(zv)))
-#define Z_UNDEFINED_OBJ_P(zv) (php_undefined_fetch_object(Z_OBJ_P(zv)))
-#define Z_UTCDATETIME_OBJ_P(zv) (php_utcdatetime_fetch_object(Z_OBJ_P(zv)))
-#define Z_COMMANDFAILEDEVENT_OBJ_P(zv) (php_commandfailedevent_fetch_object(Z_OBJ_P(zv)))
-#define Z_COMMANDSTARTEDEVENT_OBJ_P(zv) (php_commandstartedevent_fetch_object(Z_OBJ_P(zv)))
-#define Z_COMMANDSUCCEEDEDEVENT_OBJ_P(zv) (php_commandsucceededevent_fetch_object(Z_OBJ_P(zv)))
-
-#define Z_OBJ_CLIENTENCRYPTION(zo) (php_clientencryption_fetch_object(zo))
-#define Z_OBJ_COMMAND(zo) (php_command_fetch_object(zo))
-#define Z_OBJ_CURSOR(zo) (php_cursor_fetch_object(zo))
-#define Z_OBJ_CURSORID(zo) (php_cursorid_fetch_object(zo))
-#define Z_OBJ_MANAGER(zo) (php_manager_fetch_object(zo))
-#define Z_OBJ_QUERY(zo) (php_query_fetch_object(zo))
-#define Z_OBJ_READCONCERN(zo) (php_readconcern_fetch_object(zo))
-#define Z_OBJ_READPREFERENCE(zo) (php_readpreference_fetch_object(zo))
-#define Z_OBJ_SERVER(zo) (php_server_fetch_object(zo))
-#define Z_OBJ_SESSION(zo) (php_session_fetch_object(zo))
-#define Z_OBJ_BULKWRITE(zo) (php_bulkwrite_fetch_object(zo))
-#define Z_OBJ_WRITECONCERN(zo) (php_writeconcern_fetch_object(zo))
-#define Z_OBJ_WRITECONCERNERROR(zo) (php_writeconcernerror_fetch_object(zo))
-#define Z_OBJ_WRITEERROR(zo) (php_writeerror_fetch_object(zo))
-#define Z_OBJ_WRITERESULT(zo) (php_writeresult_fetch_object(zo))
-#define Z_OBJ_BINARY(zo) (php_binary_fetch_object(zo))
-#define Z_OBJ_DBPOINTER(zo) (php_dbpointer_fetch_object(zo))
-#define Z_OBJ_DECIMAL128(zo) (php_decimal128_fetch_object(zo))
-#define Z_OBJ_INT64(zo) (php_int64_fetch_object(zo))
-#define Z_OBJ_JAVASCRIPT(zo) (php_javascript_fetch_object(zo))
-#define Z_OBJ_MAXKEY(zo) (php_maxkey_fetch_object(zo))
-#define Z_OBJ_MINKEY(zo) (php_minkey_fetch_object(zo))
-#define Z_OBJ_OBJECTID(zo) (php_objectid_fetch_object(zo))
-#define Z_OBJ_REGEX(zo) (php_regex_fetch_object(zo))
-#define Z_OBJ_SYMBOL(zo) (php_symbol_fetch_object(zo))
-#define Z_OBJ_TIMESTAMP(zo) (php_timestamp_fetch_object(zo))
-#define Z_OBJ_UNDEFINED(zo) (php_undefined_fetch_object(zo))
-#define Z_OBJ_UTCDATETIME(zo) (php_utcdatetime_fetch_object(zo))
-#define Z_OBJ_COMMANDFAILEDEVENT(zo) (php_commandfailedevent_fetch_object(zo))
-#define Z_OBJ_COMMANDSTARTEDEVENT(zo) (php_commandstartedevent_fetch_object(zo))
-#define Z_OBJ_COMMANDSUCCEEDEDEVENT(zo) (php_commandsucceededevent_fetch_object(zo))
-
-typedef struct {
- zend_object_iterator intern;
- php_phongo_cursor_t* cursor;
-} php_phongo_cursor_iterator;
-
-extern zend_class_entry* php_phongo_clientencryption_ce;
-extern zend_class_entry* php_phongo_command_ce;
-extern zend_class_entry* php_phongo_cursor_ce;
-extern zend_class_entry* php_phongo_cursorid_ce;
-extern zend_class_entry* php_phongo_manager_ce;
-extern zend_class_entry* php_phongo_query_ce;
-extern zend_class_entry* php_phongo_readconcern_ce;
-extern zend_class_entry* php_phongo_readpreference_ce;
-extern zend_class_entry* php_phongo_server_ce;
-extern zend_class_entry* php_phongo_session_ce;
-extern zend_class_entry* php_phongo_bulkwrite_ce;
-extern zend_class_entry* php_phongo_writeconcern_ce;
-extern zend_class_entry* php_phongo_writeconcernerror_ce;
-extern zend_class_entry* php_phongo_writeerror_ce;
-extern zend_class_entry* php_phongo_writeresult_ce;
-
-extern zend_class_entry* php_phongo_cursor_interface_ce;
-
-extern zend_class_entry* php_phongo_exception_ce;
-extern zend_class_entry* php_phongo_logicexception_ce;
-extern zend_class_entry* php_phongo_runtimeexception_ce;
-extern zend_class_entry* php_phongo_serverexception_ce;
-extern zend_class_entry* php_phongo_commandexception_ce;
-extern zend_class_entry* php_phongo_unexpectedvalueexception_ce;
-extern zend_class_entry* php_phongo_invalidargumentexception_ce;
-extern zend_class_entry* php_phongo_connectionexception_ce;
-extern zend_class_entry* php_phongo_authenticationexception_ce;
-extern zend_class_entry* php_phongo_sslconnectionexception_ce;
-extern zend_class_entry* php_phongo_encryptionexception_ce;
-extern zend_class_entry* php_phongo_executiontimeoutexception_ce;
-extern zend_class_entry* php_phongo_connectiontimeoutexception_ce;
-extern zend_class_entry* php_phongo_writeexception_ce;
-extern zend_class_entry* php_phongo_bulkwriteexception_ce;
-
-extern zend_class_entry* php_phongo_type_ce;
-extern zend_class_entry* php_phongo_persistable_ce;
-extern zend_class_entry* php_phongo_unserializable_ce;
-extern zend_class_entry* php_phongo_serializable_ce;
-extern zend_class_entry* php_phongo_binary_ce;
-extern zend_class_entry* php_phongo_dbpointer_ce;
-extern zend_class_entry* php_phongo_decimal128_ce;
-extern zend_class_entry* php_phongo_int64_ce;
-extern zend_class_entry* php_phongo_javascript_ce;
-extern zend_class_entry* php_phongo_maxkey_ce;
-extern zend_class_entry* php_phongo_minkey_ce;
-extern zend_class_entry* php_phongo_objectid_ce;
-extern zend_class_entry* php_phongo_regex_ce;
-extern zend_class_entry* php_phongo_symbol_ce;
-extern zend_class_entry* php_phongo_timestamp_ce;
-extern zend_class_entry* php_phongo_undefined_ce;
-extern zend_class_entry* php_phongo_utcdatetime_ce;
-
-extern zend_class_entry* php_phongo_binary_interface_ce;
-extern zend_class_entry* php_phongo_decimal128_interface_ce;
-extern zend_class_entry* php_phongo_javascript_interface_ce;
-extern zend_class_entry* php_phongo_maxkey_interface_ce;
-extern zend_class_entry* php_phongo_minkey_interface_ce;
-extern zend_class_entry* php_phongo_objectid_interface_ce;
-extern zend_class_entry* php_phongo_regex_interface_ce;
-extern zend_class_entry* php_phongo_timestamp_interface_ce;
-extern zend_class_entry* php_phongo_utcdatetime_interface_ce;
-
-extern zend_class_entry* php_phongo_commandfailedevent_ce;
-extern zend_class_entry* php_phongo_commandstartedevent_ce;
-extern zend_class_entry* php_phongo_commandsubscriber_ce;
-extern zend_class_entry* php_phongo_commandsucceededevent_ce;
-extern zend_class_entry* php_phongo_subscriber_ce;
-
-extern void php_phongo_binary_init_ce(INIT_FUNC_ARGS);
-extern void php_phongo_dbpointer_init_ce(INIT_FUNC_ARGS);
-extern void php_phongo_decimal128_init_ce(INIT_FUNC_ARGS);
-extern void php_phongo_int64_init_ce(INIT_FUNC_ARGS);
-extern void php_phongo_javascript_init_ce(INIT_FUNC_ARGS);
-extern void php_phongo_maxkey_init_ce(INIT_FUNC_ARGS);
-extern void php_phongo_minkey_init_ce(INIT_FUNC_ARGS);
-extern void php_phongo_objectid_init_ce(INIT_FUNC_ARGS);
-extern void php_phongo_persistable_init_ce(INIT_FUNC_ARGS);
-extern void php_phongo_regex_init_ce(INIT_FUNC_ARGS);
-extern void php_phongo_serializable_init_ce(INIT_FUNC_ARGS);
-extern void php_phongo_symbol_init_ce(INIT_FUNC_ARGS);
-extern void php_phongo_timestamp_init_ce(INIT_FUNC_ARGS);
-extern void php_phongo_type_init_ce(INIT_FUNC_ARGS);
-extern void php_phongo_undefined_init_ce(INIT_FUNC_ARGS);
-extern void php_phongo_unserializable_init_ce(INIT_FUNC_ARGS);
-extern void php_phongo_utcdatetime_init_ce(INIT_FUNC_ARGS);
-
-extern void php_phongo_binary_interface_init_ce(INIT_FUNC_ARGS);
-extern void php_phongo_decimal128_interface_init_ce(INIT_FUNC_ARGS);
-extern void php_phongo_javascript_interface_init_ce(INIT_FUNC_ARGS);
-extern void php_phongo_maxkey_interface_init_ce(INIT_FUNC_ARGS);
-extern void php_phongo_minkey_interface_init_ce(INIT_FUNC_ARGS);
-extern void php_phongo_objectid_interface_init_ce(INIT_FUNC_ARGS);
-extern void php_phongo_regex_interface_init_ce(INIT_FUNC_ARGS);
-extern void php_phongo_timestamp_interface_init_ce(INIT_FUNC_ARGS);
-extern void php_phongo_utcdatetime_interface_init_ce(INIT_FUNC_ARGS);
-
-extern void php_phongo_bulkwrite_init_ce(INIT_FUNC_ARGS);
-extern void php_phongo_clientencryption_init_ce(INIT_FUNC_ARGS);
-extern void php_phongo_command_init_ce(INIT_FUNC_ARGS);
-extern void php_phongo_cursor_init_ce(INIT_FUNC_ARGS);
-extern void php_phongo_cursorid_init_ce(INIT_FUNC_ARGS);
-extern void php_phongo_manager_init_ce(INIT_FUNC_ARGS);
-extern void php_phongo_query_init_ce(INIT_FUNC_ARGS);
-extern void php_phongo_readconcern_init_ce(INIT_FUNC_ARGS);
-extern void php_phongo_readpreference_init_ce(INIT_FUNC_ARGS);
-extern void php_phongo_server_init_ce(INIT_FUNC_ARGS);
-extern void php_phongo_session_init_ce(INIT_FUNC_ARGS);
-extern void php_phongo_writeconcern_init_ce(INIT_FUNC_ARGS);
-extern void php_phongo_writeconcernerror_init_ce(INIT_FUNC_ARGS);
-extern void php_phongo_writeerror_init_ce(INIT_FUNC_ARGS);
-extern void php_phongo_writeresult_init_ce(INIT_FUNC_ARGS);
-
-extern void php_phongo_cursor_interface_init_ce(INIT_FUNC_ARGS);
-
-extern void php_phongo_authenticationexception_init_ce(INIT_FUNC_ARGS);
-extern void php_phongo_bulkwriteexception_init_ce(INIT_FUNC_ARGS);
-extern void php_phongo_commandexception_init_ce(INIT_FUNC_ARGS);
-extern void php_phongo_connectionexception_init_ce(INIT_FUNC_ARGS);
-extern void php_phongo_connectiontimeoutexception_init_ce(INIT_FUNC_ARGS);
-extern void php_phongo_encryptionexception_init_ce(INIT_FUNC_ARGS);
-extern void php_phongo_exception_init_ce(INIT_FUNC_ARGS);
-extern void php_phongo_executiontimeoutexception_init_ce(INIT_FUNC_ARGS);
-extern void php_phongo_invalidargumentexception_init_ce(INIT_FUNC_ARGS);
-extern void php_phongo_logicexception_init_ce(INIT_FUNC_ARGS);
-extern void php_phongo_runtimeexception_init_ce(INIT_FUNC_ARGS);
-extern void php_phongo_serverexception_init_ce(INIT_FUNC_ARGS);
-extern void php_phongo_sslconnectionexception_init_ce(INIT_FUNC_ARGS);
-extern void php_phongo_unexpectedvalueexception_init_ce(INIT_FUNC_ARGS);
-extern void php_phongo_writeexception_init_ce(INIT_FUNC_ARGS);
-
-extern void php_phongo_commandfailedevent_init_ce(INIT_FUNC_ARGS);
-extern void php_phongo_commandstartedevent_init_ce(INIT_FUNC_ARGS);
-extern void php_phongo_commandsubscriber_init_ce(INIT_FUNC_ARGS);
-extern void php_phongo_commandsucceededevent_init_ce(INIT_FUNC_ARGS);
-extern void php_phongo_subscriber_init_ce(INIT_FUNC_ARGS);
-
-/* Shared function entries for disabling constructors and unserialize() */
-PHP_FUNCTION(MongoDB_disabled___construct);
-PHP_FUNCTION(MongoDB_disabled___wakeup);
-
-#endif /* PHONGO_CLASSES_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.8.1/php_phongo_structs.h b/mongodb-1.8.1/php_phongo_structs.h
deleted file mode 100644
index 267b3a66..00000000
--- a/mongodb-1.8.1/php_phongo_structs.h
+++ /dev/null
@@ -1,272 +0,0 @@
-/*
- * 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_STRUCTS_H
-#define PHONGO_STRUCTS_H
-
-#include <php.h>
-
-#include "php_bson.h"
-
-typedef struct {
- mongoc_bulk_operation_t* bulk;
- size_t num_ops;
- bool ordered;
- int bypass;
- char* database;
- char* collection;
- bool executed;
- zend_object std;
-} php_phongo_bulkwrite_t;
-
-typedef struct {
- mongoc_client_encryption_t* client_encryption;
- zend_object std;
-} php_phongo_clientencryption_t;
-
-typedef struct {
- bson_t* bson;
- uint32_t max_await_time_ms;
- uint32_t batch_size;
- zend_object std;
-} php_phongo_command_t;
-
-typedef struct {
- mongoc_cursor_t* cursor;
- mongoc_client_t* client;
- int created_by_pid;
- uint32_t server_id;
- bool advanced;
- php_phongo_bson_state visitor_data;
- bool got_iterator;
- long current;
- char* database;
- char* collection;
- zval query;
- zval command;
- zval read_preference;
- zval session;
- zend_object std;
-} php_phongo_cursor_t;
-
-typedef struct {
- int64_t id;
- zend_object std;
-} php_phongo_cursorid_t;
-
-typedef struct {
- mongoc_client_t* client;
- int created_by_pid;
- char* client_hash;
- size_t client_hash_len;
- zend_object std;
-} php_phongo_manager_t;
-
-typedef struct {
- bson_t* filter;
- bson_t* opts;
- mongoc_read_concern_t* read_concern;
- uint32_t max_await_time_ms;
- zend_object std;
-} php_phongo_query_t;
-
-typedef struct {
- mongoc_read_concern_t* read_concern;
- HashTable* properties;
- zend_object std;
-} php_phongo_readconcern_t;
-
-typedef struct {
- mongoc_read_prefs_t* read_preference;
- HashTable* properties;
- zend_object std;
-} php_phongo_readpreference_t;
-
-typedef struct {
- mongoc_client_t* client;
- int created_by_pid;
- uint32_t server_id;
- zend_object std;
-} php_phongo_server_t;
-
-typedef struct {
- mongoc_client_session_t* client_session;
- mongoc_client_t* client;
- int created_by_pid;
- zend_object std;
-} php_phongo_session_t;
-
-typedef struct {
- HashTable* properties;
- mongoc_write_concern_t* write_concern;
- zend_object std;
-} php_phongo_writeconcern_t;
-
-typedef struct {
- int code;
- char* message;
- zval info;
- zend_object std;
-} php_phongo_writeconcernerror_t;
-
-typedef struct {
- int code;
- char* message;
- zval info;
- uint32_t index;
- zend_object std;
-} php_phongo_writeerror_t;
-
-typedef struct {
- mongoc_write_concern_t* write_concern;
- bson_t* reply;
- mongoc_client_t* client;
- uint32_t server_id;
- zend_object std;
-} php_phongo_writeresult_t;
-
-typedef struct {
- char* data;
- int data_len;
- uint8_t type;
- HashTable* properties;
- zend_object std;
-} php_phongo_binary_t;
-
-typedef struct {
- char* ref;
- size_t ref_len;
- char id[25];
- HashTable* properties;
- zend_object std;
-} php_phongo_dbpointer_t;
-
-typedef struct {
- bool initialized;
- bson_decimal128_t decimal;
- HashTable* properties;
- zend_object std;
-} php_phongo_decimal128_t;
-
-typedef struct {
- bool initialized;
- int64_t integer;
- HashTable* properties;
- zend_object std;
-} php_phongo_int64_t;
-
-typedef struct {
- char* code;
- size_t code_len;
- bson_t* scope;
- HashTable* properties;
- zend_object std;
-} php_phongo_javascript_t;
-
-typedef struct {
- zend_object std;
-} php_phongo_maxkey_t;
-
-typedef struct {
- zend_object std;
-} php_phongo_minkey_t;
-
-typedef struct {
- bool initialized;
- char oid[25];
- HashTable* properties;
- zend_object std;
-} php_phongo_objectid_t;
-
-typedef struct {
- char* pattern;
- int pattern_len;
- char* flags;
- int flags_len;
- HashTable* properties;
- zend_object std;
-} php_phongo_regex_t;
-
-typedef struct {
- char* symbol;
- size_t symbol_len;
- HashTable* properties;
- zend_object std;
-} php_phongo_symbol_t;
-
-typedef struct {
- bool initialized;
- uint32_t increment;
- uint32_t timestamp;
- HashTable* properties;
- zend_object std;
-} php_phongo_timestamp_t;
-
-typedef struct {
- zend_object std;
-} php_phongo_undefined_t;
-
-typedef struct {
- bool initialized;
- int64_t milliseconds;
- HashTable* properties;
- zend_object std;
-} php_phongo_utcdatetime_t;
-
-typedef struct {
- mongoc_client_t* client;
- char* command_name;
- uint32_t server_id;
- uint64_t operation_id;
- uint64_t request_id;
- uint64_t duration_micros;
- bson_t* reply;
- zval z_error;
- zend_object std;
-} php_phongo_commandfailedevent_t;
-
-typedef struct {
- mongoc_client_t* client;
- char* command_name;
- uint32_t server_id;
- uint64_t operation_id;
- uint64_t request_id;
- bson_t* command;
- char* database_name;
- zend_object std;
-} php_phongo_commandstartedevent_t;
-
-typedef struct {
- mongoc_client_t* client;
- char* command_name;
- uint32_t server_id;
- uint64_t operation_id;
- uint64_t request_id;
- uint64_t duration_micros;
- bson_t* reply;
- zend_object std;
-} php_phongo_commandsucceededevent_t;
-
-#endif /* PHONGO_STRUCTS */
-
-/*
- * 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.8.1/scripts/autotools/CheckHost.m4 b/mongodb-1.8.1/scripts/autotools/CheckHost.m4
deleted file mode 100644
index 52448385..00000000
--- a/mongodb-1.8.1/scripts/autotools/CheckHost.m4
+++ /dev/null
@@ -1,54 +0,0 @@
-AC_CANONICAL_HOST
-
-os_win32=no
-os_netbsd=no
-os_freebsd=no
-os_openbsd=no
-os_hpux=no
-os_linux=no
-os_solaris=no
-os_darwin=no
-os_gnu=no
-
-case "$host" in
- *-mingw*|*-*-cygwin*)
- os_win32=yes
- TARGET_OS=windows
- ;;
- *-*-*netbsd*)
- os_netbsd=yes
- TARGET_OS=unix
- ;;
- *-*-*freebsd*)
- os_freebsd=yes
- TARGET_OS=unix
- ;;
- *-*-*openbsd*)
- os_openbsd=yes
- TARGET_OS=unix
- ;;
- *-*-hpux*)
- os_hpux=yes
- TARGET_OS=unix
- ;;
- *-*-linux*)
- os_linux=yes
- os_gnu=yes
- TARGET_OS=unix
- ;;
- *-*-solaris*)
- os_solaris=yes
- TARGET_OS=unix
- ;;
- *-*-darwin*)
- os_darwin=yes
- TARGET_OS=unix
- ;;
- gnu*|k*bsd*-gnu*)
- os_gnu=yes
- TARGET_OS=unix
- ;;
- *)
- AC_MSG_WARN([*** Please add $host to configure.ac checks!])
- ;;
-esac
diff --git a/mongodb-1.8.1/scripts/autotools/libmongoc/CheckResolv.m4 b/mongodb-1.8.1/scripts/autotools/libmongoc/CheckResolv.m4
deleted file mode 100644
index 5cfa238c..00000000
--- a/mongodb-1.8.1/scripts/autotools/libmongoc/CheckResolv.m4
+++ /dev/null
@@ -1,94 +0,0 @@
-dnl Disable Windows DNSAPI
-AC_SUBST(MONGOC_HAVE_DNSAPI, 0)
-
-found_resolv="no"
-
-old_LIBS="$LIBS"
-LIBS="$LIBS -lresolv"
-
-dnl Thread-safe DNS query function for _mongoc_client_get_srv.
-dnl Could be a macro, not a function, so check with AC_LINK_IFELSE.
-AC_MSG_CHECKING([for res_nsearch])
-AC_LINK_IFELSE([AC_LANG_PROGRAM([[
- #include <sys/types.h>
- #include <netinet/in.h>
- #include <arpa/nameser.h>
- #include <resolv.h>
-]], [[
- int len;
- unsigned char reply[1024];
- res_state statep;
- len = res_nsearch(
- statep, "example.com", ns_c_in, ns_t_srv, reply, sizeof(reply));
-]])], [
- AC_MSG_RESULT([yes])
- AC_SUBST(MONGOC_HAVE_RES_SEARCH, 0)
- AC_SUBST(MONGOC_HAVE_RES_NSEARCH, 1)
- found_resolv="yes"
-
- dnl We have res_nsearch. Call res_ndestroy (BSD/Mac) or res_nclose (Linux)?
- AC_MSG_CHECKING([for res_ndestroy])
- AC_LINK_IFELSE([AC_LANG_PROGRAM([[
- #include <sys/types.h>
- #include <netinet/in.h>
- #include <arpa/nameser.h>
- #include <resolv.h>
- ]], [[
- res_state statep;
- res_ndestroy(statep);
- ]])], [
- AC_MSG_RESULT([yes])
- AC_SUBST(MONGOC_HAVE_RES_NDESTROY, 1)
- AC_SUBST(MONGOC_HAVE_RES_NCLOSE, 0)
- ], [
- AC_MSG_RESULT([no])
- AC_SUBST(MONGOC_HAVE_RES_NDESTROY, 0)
- AC_MSG_CHECKING([for res_nclose])
- AC_LINK_IFELSE([AC_LANG_PROGRAM([[
- #include <sys/types.h>
- #include <netinet/in.h>
- #include <arpa/nameser.h>
- #include <resolv.h>
- ]], [[
- res_state statep;
- res_nclose(statep);
- ]])], [
- AC_MSG_RESULT([yes])
- AC_SUBST(MONGOC_HAVE_RES_NCLOSE, 1)
- ], [
- AC_MSG_RESULT([no])
- AC_SUBST(MONGOC_HAVE_RES_NCLOSE, 0)
- ])
- ])
-],[
- AC_MSG_RESULT([no])
- AC_SUBST(MONGOC_HAVE_RES_NSEARCH, 0)
- AC_SUBST(MONGOC_HAVE_RES_NDESTROY, 0)
- AC_SUBST(MONGOC_HAVE_RES_NCLOSE, 0)
-
- dnl Thread-unsafe function.
- AC_MSG_CHECKING([for res_search])
- AC_LINK_IFELSE([AC_LANG_PROGRAM([[
- #include <sys/types.h>
- #include <netinet/in.h>
- #include <arpa/nameser.h>
- #include <resolv.h>
- ]], [[
- int len;
- unsigned char reply[1024];
- len = res_search("example.com", ns_c_in, ns_t_srv, reply, sizeof(reply));
- ]])], [
- AC_MSG_RESULT([yes])
- AC_SUBST(MONGOC_HAVE_RES_SEARCH, 1)
- found_resolv="yes"
- ], [
- AC_MSG_RESULT([no])
- AC_SUBST(MONGOC_HAVE_RES_SEARCH, 0)
- ])
-])
-
-LIBS="$old_LIBS"
-
-AS_IF([test "$found_resolv" = "yes"],[
- PHP_ADD_LIBRARY([resolv],,[MONGODB_SHARED_LIBADD])
-])
diff --git a/mongodb-1.8.1/scripts/autotools/libmongoc/FindDependencies.m4 b/mongodb-1.8.1/scripts/autotools/libmongoc/FindDependencies.m4
deleted file mode 100644
index 6bc59c05..00000000
--- a/mongodb-1.8.1/scripts/autotools/libmongoc/FindDependencies.m4
+++ /dev/null
@@ -1,45 +0,0 @@
-# Solaris needs to link against socket libs
-if test "$os_solaris" = "yes"; then
- PHP_MONGODB_BUNDLED_CFLAGS="$PHP_MONGODB_BUNDLED_CFLAGS -D__EXTENSIONS__"
- PHP_MONGODB_BUNDLED_CFLAGS="$PHP_MONGODB_BUNDLED_CFLAGS -D_XOPEN_SOURCE=1"
- PHP_MONGODB_BUNDLED_CFLAGS="$PHP_MONGODB_BUNDLED_CFLAGS -D_XOPEN_SOURCE_EXTENDED=1"
- PHP_ADD_LIBRARY([socket],,[MONGODB_SHARED_LIBADD])
- PHP_ADD_LIBRARY([nsl],,[MONGODB_SHARED_LIBADD])
-fi
-
-# Check for shm functions
-AC_CHECK_FUNCS([shm_open],[],[
- AC_CHECK_LIB([rt],
- [shm_open],
- [PHP_ADD_LIBRARY([rt],,[MONGODB_SHARED_LIBADD])],
- [])
-])
-
-# Check for sched_getcpu
-AC_CHECK_FUNC([sched_getcpu],
- [AC_SUBST(MONGOC_HAVE_SCHED_GETCPU, 1)],
- [AC_SUBST(MONGOC_HAVE_SCHED_GETCPU, 0)])
-
-AC_CHECK_TYPE([socklen_t],
- [AC_SUBST(MONGOC_HAVE_SOCKLEN, 1)],
- [AC_SUBST(MONGOC_HAVE_SOCKLEN, 0)],
- [#include <sys/socket.h>])
-
-AC_CHECK_MEMBER([struct sockaddr_storage.ss_family],
- [AC_SUBST(MONGOC_HAVE_SS_FAMILY, 0)],
- [AC_SUBST(MONGOC_HAVE_SS_FAMILY, 1)],
- [#include <sys/socket.h>])
-
-# Check for pthreads. libmongoc's original FindDependencies.m4 script did not
-# require pthreads, but it does appear to be necessary on non-Windows platforms
-# based on mongoc-openssl.c and mongoc-thread-private.h.
-AX_PTHREAD([
- PHP_MONGODB_BUNDLED_CFLAGS="$PHP_MONGODB_BUNDLED_CFLAGS $PTHREAD_CFLAGS"
- PHP_EVAL_LIBLINE([$PTHREAD_LIBS],[MONGODB_SHARED_LIBADD])
-
- # PTHREAD_CFLAGS may come back as "-pthread", which should also be used when
- # linking. We can trust PHP_EVAL_LIBLINE to ignore other values.
- PHP_EVAL_LIBLINE([$PTHREAD_CFLAGS],[MONGODB_SHARED_LIBADD])
-],[
- AC_MSG_ERROR([libmongoc requires pthreads on non-Windows platforms.])
-])
diff --git a/mongodb-1.8.1/scripts/convert-bson-corpus-tests.php b/mongodb-1.8.1/scripts/convert-bson-corpus-tests.php
deleted file mode 100644
index 5b514cba..00000000
--- a/mongodb-1.8.1/scripts/convert-bson-corpus-tests.php
+++ /dev/null
@@ -1,305 +0,0 @@
-<?php
-
-require_once __DIR__ . '/../tests/utils/tools.php';
-
-$expectedFailures = [
- 'Double type: 1.23456789012345677E+18' => 'Variation in double\'s string representation (SPEC-850)',
- 'Double type: -1.23456789012345677E+18' => 'Variation in double\'s string representation (SPEC-850)',
- 'Int64 type: -1' => 'PHP encodes integers as 32-bit if range allows',
- 'Int64 type: 0' => 'PHP encodes integers as 32-bit if range allows',
- 'Int64 type: 1' => 'PHP encodes integers as 32-bit if range allows',
- 'Javascript Code with Scope: Unicode and embedded null in code string, empty scope' => 'Embedded null in code string is not supported in libbson (CDRIVER-1879)',
- 'Multiple types within the same document: All BSON types' => 'PHP encodes integers as 32-bit if range allows',
- 'Top-level document validity: Bad $date (number, not string or hash)' => 'Legacy extended JSON $date syntax uses numbers (CDRIVER-2223)',
-];
-
-$for64bitOnly = [
- /* Note: Although 64-bit integers be represented by the Int64 class, these
- * tests fail on 32-bit platforms due to json_canonicalize() roundtripping
- * values through PHP, which converts large integers to floats. */
- 'Int64 type: MinValue' => "Can't represent 64-bit ints on a 32-bit platform",
- 'Int64 type: MaxValue' => "Can't represent 64-bit ints on a 32-bit platform",
-];
-
-$outputPath = realpath(__DIR__ . '/../tests') . '/bson-corpus/';
-
-if ( ! is_dir($outputPath) && ! mkdir($outputPath, 0755, true)) {
- printf("Error creating output path: %s\n", $outputPath);
-}
-
-foreach (array_slice($argv, 1) as $inputFile) {
- if ( ! is_readable($inputFile) || ! is_file($inputFile)) {
- printf("Error reading %s\n", $inputFile);
- continue;
- }
-
- $test = json_decode(file_get_contents($inputFile), true);
-
- if (json_last_error() !== JSON_ERROR_NONE) {
- printf("Error decoding %s: %s\n", $inputFile, json_last_error_msg());
- continue;
- }
-
- if ( ! isset($test['description'])) {
- printf("Skipping test file without \"description\" field: %s\n", $inputFile);
- continue;
- }
-
- if ( ! empty($test['valid'])) {
- foreach ($test['valid'] as $i => $case) {
- $outputFile = sprintf('%s-valid-%03d.phpt', pathinfo($inputFile, PATHINFO_FILENAME), $i + 1);
- try {
- $output = renderPhpt(getParamsForValid($test, $case), $expectedFailures, $for64bitOnly);
- } catch (Exception $e) {
- printf("Error processing valid[%d] in %s: %s\n", $i, $inputFile, $e->getMessage());
- continue;
- }
-
- if (false === file_put_contents($outputPath . '/' . $outputFile, $output)) {
- printf("Error writing valid[%d] in %s\n", $i, $inputFile);
- continue;
- }
- }
- }
-
- if ( ! empty($test['decodeErrors'])) {
- foreach ($test['decodeErrors'] as $i => $case) {
- $outputFile = sprintf('%s-decodeError-%03d.phpt', pathinfo($inputFile, PATHINFO_FILENAME), $i + 1);
- try {
- $output = renderPhpt(getParamsForDecodeError($test, $case), $expectedFailures, $for64bitOnly);
- } catch (Exception $e) {
- printf("Error processing decodeErrors[%d] in %s: %s\n", $i, $inputFile, $e->getMessage());
- continue;
- }
-
- if (false === file_put_contents($outputPath . '/' . $outputFile, $output)) {
- printf("Error writing decodeErrors[%d] in %s\n", $i, $inputFile);
- continue;
- }
- }
- }
-
- if ( ! empty($test['parseErrors'])) {
- foreach ($test['parseErrors'] as $i => $case) {
- $outputFile = sprintf('%s-parseError-%03d.phpt', pathinfo($inputFile, PATHINFO_FILENAME), $i + 1);
- try {
- $output = renderPhpt(getParamsForParseError($test, $case), $expectedFailures, $for64bitOnly);
- } catch (Exception $e) {
- printf("Error processing parseErrors[%d] in %s: %s\n", $i, $inputFile, $e->getMessage());
- continue;
- }
-
- if (false === file_put_contents($outputPath . '/' . $outputFile, $output)) {
- printf("Error writing parseErrors[%d] in %s\n", $i, $inputFile);
- continue;
- }
- }
- }
-}
-
-function getParamsForValid(array $test, array $case)
-{
- foreach (['description', 'canonical_bson', 'canonical_extjson'] as $field) {
- if (!isset($case[$field])) {
- throw new InvalidArgumentException(sprintf('Missing "%s" field', $field));
- }
- }
-
- $code = '';
- $expect = '';
-
- $lossy = isset($case['lossy']) ? (boolean) $case['lossy'] : false;
-
- $canonicalBson = $case['canonical_bson'];
- $expectedCanonicalBson = strtolower($canonicalBson);
- $code .= sprintf('$canonicalBson = hex2bin(%s);', var_export($canonicalBson, true)) . "\n";
-
- if (isset($case['degenerate_bson'])) {
- $degenerateBson = $case['degenerate_bson'];
- $expectedDegenerateBson = strtolower($degenerateBson);
- $code .= sprintf('$degenerateBson = hex2bin(%s);', var_export($degenerateBson, true)) . "\n";
- }
-
- if (isset($case['converted_bson'])) {
- $convertedBson = $case['converted_bson'];
- $expectedConvertedBson = strtolower($convertedBson);
- $code .= sprintf('$convertedBson = hex2bin(%s);', var_export($convertedBson, true)) . "\n";
- }
-
- $canonicalExtJson = $case['canonical_extjson'];
- $expectedCanonicalExtJson = json_canonicalize($canonicalExtJson);
- $code .= sprintf('$canonicalExtJson = %s;', var_export($canonicalExtJson, true)) . "\n";
-
- if (isset($case['relaxed_extjson'])) {
- $relaxedExtJson = $case['relaxed_extjson'];
- $expectedRelaxedExtJson = json_canonicalize($relaxedExtJson);
- $code .= sprintf('$relaxedExtJson = %s;', var_export($relaxedExtJson, true)) . "\n";
- }
-
- if (isset($case['degenerate_extjson'])) {
- $degenerateExtJson = $case['degenerate_extjson'];
- $expectedDegenerateExtJson = json_canonicalize($degenerateExtJson);
- $code .= sprintf('$degenerateExtJson = %s;', var_export($degenerateExtJson, true)) . "\n";
- }
-
- if (isset($case['converted_extjson'])) {
- $convertedExtJson = $case['converted_extjson'];
- $expectedConvertedExtJson = json_canonicalize($convertedExtJson);
- $code .= sprintf('$convertedExtJson = %s;', var_export($convertedExtJson, true)) . "\n";
- }
-
- $code .= "\n// Canonical BSON -> Native -> Canonical BSON \n";
- $code .= 'echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";' . "\n";
- $expect .= $expectedCanonicalBson . "\n";
-
- $code .= "\n// Canonical BSON -> Canonical extJSON \n";
- $code .= 'echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";' . "\n";;
- $expect .= $expectedCanonicalExtJson . "\n";
-
- if (isset($relaxedExtJson)) {
- $code .= "\n// Canonical BSON -> Relaxed extJSON \n";
- $code .= 'echo json_canonicalize(toRelaxedExtendedJSON($canonicalBson)), "\n";' . "\n";;
- $expect .= $expectedRelaxedExtJson . "\n";
- }
-
- if (!$lossy) {
- $code .= "\n// Canonical extJSON -> Canonical BSON \n";
- $code .= 'echo bin2hex(fromJSON($canonicalExtJson)), "\n";' . "\n";
- $expect .= $expectedCanonicalBson . "\n";
- }
-
- if (isset($degenerateBson)) {
- $code .= "\n// Degenerate BSON -> Native -> Canonical BSON \n";
- $code .= 'echo bin2hex(fromPHP(toPHP($degenerateBson))), "\n";' . "\n";
- $expect .= $expectedCanonicalBson . "\n";
-
- $code .= "\n// Degenerate BSON -> Canonical extJSON \n";
- $code .= 'echo json_canonicalize(toCanonicalExtendedJSON($degenerateBson)), "\n";' . "\n";;
- $expect .= $expectedCanonicalExtJson . "\n";
-
- if (isset($relaxedExtJson)) {
- $code .= "\n// Degenerate BSON -> Relaxed extJSON \n";
- $code .= 'echo json_canonicalize(toRelaxedExtendedJSON($degenerateBson)), "\n";' . "\n";;
- $expect .= $expectedRelaxedExtJson . "\n";
- }
- }
-
- if (isset($degenerateExtJson) && !$lossy) {
- $code .= "\n// Degenerate extJSON -> Canonical BSON \n";
- $code .= 'echo bin2hex(fromJSON($degenerateExtJson)), "\n";' . "\n";
- $expect .= $expectedCanonicalBson . "\n";
- }
-
- if (isset($relaxedExtJson)) {
- $code .= "\n// Relaxed extJSON -> BSON -> Relaxed extJSON \n";
- $code .= 'echo json_canonicalize(toRelaxedExtendedJSON(fromJSON($relaxedExtJson))), "\n";' . "\n";
- $expect .= $expectedRelaxedExtJson . "\n";
- }
-
- return [
- '%NAME%' => sprintf('%s: %s', trim($test['description']), trim($case['description'])),
- '%CODE%' => trim($code),
- '%EXPECT%' => trim($expect),
- ];
-}
-
-function getParamsForDecodeError(array $test, array $case)
-{
- foreach (['description', 'bson'] as $field) {
- if (!isset($case[$field])) {
- throw new InvalidArgumentException(sprintf('Missing "%s" field', $field));
- }
- }
-
- $code = sprintf('$bson = hex2bin(%s);', var_export($case['bson'], true)) . "\n\n";
- $code .= "throws(function() use (\$bson) {\n";
- $code .= " var_dump(toPHP(\$bson));\n";
- $code .= "}, 'MongoDB\Driver\Exception\UnexpectedValueException');";
-
- /* We do not test for the exception message, since that may differ based on
- * the nature of the decoding error. */
- $expect = "OK: Got MongoDB\Driver\Exception\UnexpectedValueException";
-
- return [
- '%NAME%' => sprintf('%s: %s', trim($test['description']), trim($case['description'])),
- '%CODE%' => trim($code),
- '%EXPECT%' => trim($expect),
- ];
-}
-
-function getParamsForParseError(array $test, array $case)
-{
- foreach (['description', 'string'] as $field) {
- if (!isset($case[$field])) {
- throw new InvalidArgumentException(sprintf('Missing "%s" field', $field));
- }
- }
-
- $code = '';
- $expect = '';
-
- switch ($test['bson_type']) {
- case '0x00': // Top-level document
- $code = "throws(function() {\n";
- $code .= sprintf(" fromJSON(%s);\n", var_export($case['string'], true));
- $code .= "}, 'MongoDB\Driver\Exception\UnexpectedValueException');";
-
- /* We do not test for the exception message, since that may differ
- * based on the nature of the parse error. */
- $expect = "OK: Got MongoDB\Driver\Exception\UnexpectedValueException";
- break;
-
- case '0x13': // Decimal128
- $code = "throws(function() {\n";
- $code .= sprintf(" new MongoDB\BSON\Decimal128(%s);\n", var_export($case['string'], true));
- $code .= "}, 'MongoDB\Driver\Exception\InvalidArgumentException');";
-
- /* We do not test for the exception message, since that may differ
- * based on the nature of the parse error. */
- $expect = "OK: Got MongoDB\Driver\Exception\InvalidArgumentException";
- break;
-
- default:
- throw new UnexpectedValueException(sprintf("Parse errors not supported for BSON type: %s", $test['bson_type']));
- }
-
- return [
- '%NAME%' => sprintf('%s: %s', trim($test['description']), trim($case['description'])),
- '%CODE%' => trim($code),
- '%EXPECT%' => trim($expect),
- ];
-}
-
-function renderPhpt(array $params, array $expectedFailures, array $for64bitOnly)
-{
- $params['%XFAIL%'] = isset($expectedFailures[$params['%NAME%']])
- ? "--XFAIL--\n" . $expectedFailures[$params['%NAME%']] . "\n"
- : '';
- $params['%SKIPIF%'] = isset($for64bitOnly[$params['%NAME%']])
- ? "--SKIPIF--\n" . "<?php if (PHP_INT_SIZE !== 8) { die(\"skip {$for64bitOnly[$params['%NAME%']]}\"); } ?>" . "\n"
- : '';
-
- $template = <<< 'TEMPLATE'
---TEST--
-%NAME%
-%XFAIL%%SKIPIF%--DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-%CODE%
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-%EXPECT%
-===DONE===
-TEMPLATE;
-
- return str_replace(array_keys($params), array_values($params), $template);
-}
diff --git a/mongodb-1.8.1/src/BSON/Binary.c b/mongodb-1.8.1/src/BSON/Binary.c
deleted file mode 100644
index 44bf926f..00000000
--- a/mongodb-1.8.1/src/BSON/Binary.c
+++ /dev/null
@@ -1,429 +0,0 @@
-/*
- * 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.
- */
-
-#include <php.h>
-#include <ext/standard/base64.h>
-#include <Zend/zend_interfaces.h>
-#include <Zend/zend_operators.h>
-#include <ext/standard/php_var.h>
-#include <zend_smart_str.h>
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "phongo_compat.h"
-#include "php_phongo.h"
-
-#define PHONGO_BINARY_UUID_SIZE 16
-
-zend_class_entry* php_phongo_binary_ce;
-
-/* 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, size_t data_len, zend_long type) /* {{{ */
-{
- if (type < 0 || type > UINT8_MAX) {
- phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Expected type to be an unsigned 8-bit integer, %" PHONGO_LONG_FORMAT " given", type);
- return false;
- }
-
- if ((type == BSON_SUBTYPE_UUID_DEPRECATED || type == BSON_SUBTYPE_UUID) && data_len != PHONGO_BINARY_UUID_SIZE) {
- phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Expected UUID length to be %d bytes, %d given", PHONGO_BINARY_UUID_SIZE, data_len);
- 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) /* {{{ */
-{
- 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));
- }
-
- phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "%s initialization requires \"data\" string and \"type\" integer fields", ZSTR_VAL(php_phongo_binary_ce->name));
- return false;
-} /* }}} */
-
-/* {{{ proto void MongoDB\BSON\Binary::__construct(string $data, int $type)
- Construct a new BSON binary type */
-static PHP_METHOD(Binary, __construct)
-{
- php_phongo_binary_t* intern;
- zend_error_handling error_handling;
- char* data;
- size_t data_len;
- zend_long type;
-
- zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
- intern = Z_BINARY_OBJ_P(getThis());
-
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "sl", &data, &data_len, &type) == FAILURE) {
- zend_restore_error_handling(&error_handling);
- return;
- }
- zend_restore_error_handling(&error_handling);
-
- php_phongo_binary_init(intern, data, data_len, type);
-} /* }}} */
-
-/* {{{ proto void MongoDB\BSON\Binary::__set_state(array $properties)
-*/
-static PHP_METHOD(Binary, __set_state)
-{
- php_phongo_binary_t* intern;
- HashTable* props;
- zval* array;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "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);
-} /* }}} */
-
-/* {{{ proto string MongoDB\BSON\Binary::__toString()
- Return the Binary's data string. */
-static PHP_METHOD(Binary, __toString)
-{
- php_phongo_binary_t* intern;
-
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
-
- intern = Z_BINARY_OBJ_P(getThis());
-
- RETURN_STRINGL(intern->data, intern->data_len);
-} /* }}} */
-
-/* {{{ proto string MongoDB\BSON\Binary::getData()
-*/
-static PHP_METHOD(Binary, getData)
-{
- php_phongo_binary_t* intern;
-
- intern = Z_BINARY_OBJ_P(getThis());
-
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
-
- RETURN_STRINGL(intern->data, intern->data_len);
-} /* }}} */
-
-/* {{{ proto integer MongoDB\BSON\Binary::getType()
-*/
-static 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 MongoDB\BSON\Binary::jsonSerialize()
-*/
-static 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);
-
- {
- 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);
- }
-
- type_len = snprintf(type, sizeof(type), "%02x", intern->type);
- ADD_ASSOC_STRINGL(return_value, "$type", type, type_len);
-} /* }}} */
-
-/* {{{ proto string MongoDB\BSON\Binary::serialize()
-*/
-static PHP_METHOD(Binary, serialize)
-{
- php_phongo_binary_t* intern;
- zval retval;
- php_serialize_data_t var_hash;
- smart_str buf = { 0 };
-
- intern = Z_BINARY_OBJ_P(getThis());
-
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
-
- array_init_size(&retval, 2);
- ADD_ASSOC_STRINGL(&retval, "data", intern->data, intern->data_len);
- ADD_ASSOC_LONG_EX(&retval, "type", intern->type);
-
- PHP_VAR_SERIALIZE_INIT(var_hash);
- php_var_serialize(&buf, &retval, &var_hash);
- smart_str_0(&buf);
- PHP_VAR_SERIALIZE_DESTROY(var_hash);
-
- PHONGO_RETVAL_SMART_STR(buf);
-
- smart_str_free(&buf);
- zval_ptr_dtor(&retval);
-} /* }}} */
-
-/* {{{ proto void MongoDB\BSON\Binary::unserialize(string $serialized)
-*/
-static PHP_METHOD(Binary, unserialize)
-{
- php_phongo_binary_t* intern;
- zend_error_handling error_handling;
- char* serialized;
- size_t serialized_len;
- zval props;
- 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);
-
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &serialized, &serialized_len) == FAILURE) {
- zend_restore_error_handling(&error_handling);
- return;
- }
- zend_restore_error_handling(&error_handling);
-
- PHP_VAR_UNSERIALIZE_INIT(var_hash);
- if (!php_var_unserialize(&props, (const unsigned char**) &serialized, (unsigned char*) serialized + serialized_len, &var_hash)) {
- zval_ptr_dtor(&props);
- phongo_throw_exception(PHONGO_ERROR_UNEXPECTED_VALUE, "%s unserialization failed", ZSTR_VAL(php_phongo_binary_ce->name));
-
- PHP_VAR_UNSERIALIZE_DESTROY(var_hash);
- return;
- }
- PHP_VAR_UNSERIALIZE_DESTROY(var_hash);
-
- php_phongo_binary_init_from_hash(intern, HASH_OF(&props));
- zval_ptr_dtor(&props);
-} /* }}} */
-
-/* {{{ MongoDB\BSON\Binary function entries */
-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[] = {
- /* clang-format off */
- 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
- /* clang-format on */
-};
-/* }}} */
-
-/* {{{ MongoDB\BSON\Binary object handlers */
-static zend_object_handlers php_phongo_handler_binary;
-
-static void php_phongo_binary_free_object(zend_object* object) /* {{{ */
-{
- php_phongo_binary_t* intern = Z_OBJ_BINARY(object);
-
- zend_object_std_dtor(&intern->std);
-
- if (intern->data) {
- efree(intern->data);
- }
-
- if (intern->properties) {
- zend_hash_destroy(intern->properties);
- FREE_HASHTABLE(intern->properties);
- }
-} /* }}} */
-
-static zend_object* php_phongo_binary_create_object(zend_class_entry* class_type) /* {{{ */
-{
- 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);
- object_properties_init(&intern->std, class_type);
-
- intern->std.handlers = &php_phongo_handler_binary;
-
- return &intern->std;
-} /* }}} */
-
-static zend_object* php_phongo_binary_clone_object(zval* object) /* {{{ */
-{
- php_phongo_binary_t* intern;
- php_phongo_binary_t* new_intern;
- zend_object* new_object;
-
- intern = Z_BINARY_OBJ_P(object);
- new_object = php_phongo_binary_create_object(Z_OBJCE_P(object));
-
- new_intern = Z_OBJ_BINARY(new_object);
- zend_objects_clone_members(&new_intern->std, &intern->std);
-
- php_phongo_binary_init(new_intern, intern->data, intern->data_len, intern->type);
-
- return new_object;
-} /* }}} */
-
-static int php_phongo_binary_compare_objects(zval* o1, zval* o2) /* {{{ */
-{
- 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_properties_hash(zval* object, bool is_debug) /* {{{ */
-{
- php_phongo_binary_t* intern;
- HashTable* props;
-
- intern = Z_BINARY_OBJ_P(object);
-
- PHONGO_GET_PROPERTY_HASH_INIT_PROPS(is_debug, intern, props, 2);
-
- if (!intern->data) {
- return props;
- }
-
- {
- 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);
- }
-
- return props;
-} /* }}} */
-
-static HashTable* php_phongo_binary_get_debug_info(zval* object, int* is_temp) /* {{{ */
-{
- *is_temp = 1;
- return php_phongo_binary_get_properties_hash(object, true);
-} /* }}} */
-
-static HashTable* php_phongo_binary_get_properties(zval* object) /* {{{ */
-{
- return php_phongo_binary_get_properties_hash(object, false);
-} /* }}} */
-/* }}} */
-
-void php_phongo_binary_init_ce(INIT_FUNC_ARGS) /* {{{ */
-{
- zend_class_entry ce;
-
- INIT_NS_CLASS_ENTRY(ce, "MongoDB\\BSON", "Binary", php_phongo_binary_me);
- php_phongo_binary_ce = zend_register_internal_class(&ce);
- 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, 1, php_phongo_binary_interface_ce);
- zend_class_implements(php_phongo_binary_ce, 1, php_phongo_json_serializable_ce);
- zend_class_implements(php_phongo_binary_ce, 1, php_phongo_type_ce);
- zend_class_implements(php_phongo_binary_ce, 1, zend_ce_serializable);
-
- memcpy(&php_phongo_handler_binary, phongo_get_std_object_handlers(), sizeof(zend_object_handlers));
- php_phongo_handler_binary.clone_obj = php_phongo_binary_clone_object;
- php_phongo_handler_binary.compare_objects = php_phongo_binary_compare_objects;
- php_phongo_handler_binary.get_debug_info = php_phongo_binary_get_debug_info;
- php_phongo_handler_binary.get_properties = php_phongo_binary_get_properties;
- php_phongo_handler_binary.free_obj = php_phongo_binary_free_object;
- php_phongo_handler_binary.offset = XtOffsetOf(php_phongo_binary_t, std);
-
- zend_declare_class_constant_long(php_phongo_binary_ce, ZEND_STRL("TYPE_GENERIC"), BSON_SUBTYPE_BINARY);
- zend_declare_class_constant_long(php_phongo_binary_ce, ZEND_STRL("TYPE_FUNCTION"), BSON_SUBTYPE_FUNCTION);
- zend_declare_class_constant_long(php_phongo_binary_ce, ZEND_STRL("TYPE_OLD_BINARY"), BSON_SUBTYPE_BINARY_DEPRECATED);
- zend_declare_class_constant_long(php_phongo_binary_ce, ZEND_STRL("TYPE_OLD_UUID"), BSON_SUBTYPE_UUID_DEPRECATED);
- zend_declare_class_constant_long(php_phongo_binary_ce, ZEND_STRL("TYPE_UUID"), BSON_SUBTYPE_UUID);
- zend_declare_class_constant_long(php_phongo_binary_ce, ZEND_STRL("TYPE_MD5"), BSON_SUBTYPE_MD5);
- zend_declare_class_constant_long(php_phongo_binary_ce, ZEND_STRL("TYPE_ENCRYPTED"), BSON_SUBTYPE_ENCRYPTED);
- zend_declare_class_constant_long(php_phongo_binary_ce, ZEND_STRL("TYPE_USER_DEFINED"), BSON_SUBTYPE_USER);
-} /* }}} */
-
-/*
- * 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.8.1/src/BSON/DBPointer.c b/mongodb-1.8.1/src/BSON/DBPointer.c
deleted file mode 100644
index 6c506f95..00000000
--- a/mongodb-1.8.1/src/BSON/DBPointer.c
+++ /dev/null
@@ -1,331 +0,0 @@
-/*
- * 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.
- */
-
-#include <php.h>
-#include <Zend/zend_interfaces.h>
-#include <ext/standard/php_var.h>
-#include <zend_smart_str.h>
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "phongo_compat.h"
-#include "php_phongo.h"
-#include "php_bson.h"
-
-zend_class_entry* php_phongo_dbpointer_ce;
-
-/* Initialize the object and return whether it was successful. An exception will
- * be thrown on error. */
-static bool php_phongo_dbpointer_init(php_phongo_dbpointer_t* intern, const char* ref, size_t ref_len, const char* id, size_t id_len) /* {{{ */
-{
- if (strlen(ref) != (size_t) ref_len) {
- phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Ref cannot contain null bytes");
- return false;
- }
-
- if (!bson_oid_is_valid(id, id_len)) {
- phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Error parsing ObjectId string: %s", id);
- return false;
- }
-
- intern->ref = estrndup(ref, ref_len);
- intern->ref_len = ref_len;
-
- strncpy(intern->id, id, sizeof(intern->id));
-
- 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_dbpointer_init_from_hash(php_phongo_dbpointer_t* intern, HashTable* props) /* {{{ */
-{
- zval *ref, *id;
-
- if ((ref = zend_hash_str_find(props, "ref", sizeof("ref") - 1)) && Z_TYPE_P(ref) == IS_STRING &&
- (id = zend_hash_str_find(props, "id", sizeof("id") - 1)) && Z_TYPE_P(id) == IS_STRING) {
-
- return php_phongo_dbpointer_init(intern, Z_STRVAL_P(ref), Z_STRLEN_P(ref), Z_STRVAL_P(id), Z_STRLEN_P(id));
- }
-
- phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "%s initialization requires \"ref\" and \"id\" string fields", ZSTR_VAL(php_phongo_dbpointer_ce->name));
- return false;
-} /* }}} */
-
-/* {{{ proto string MongoDB\BSON\DBPointer::__toString()
- Return the DBPointer's namespace string and ObjectId. */
-static PHP_METHOD(DBPointer, __toString)
-{
- php_phongo_dbpointer_t* intern;
- char* retval;
- int retval_len;
-
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
-
- intern = Z_DBPOINTER_OBJ_P(getThis());
-
- retval_len = spprintf(&retval, 0, "[%s/%s]", intern->ref, intern->id);
- RETVAL_STRINGL(retval, retval_len);
- efree(retval);
-} /* }}} */
-
-/* {{{ proto array MongoDB\BSON\Symbol::jsonSerialize()
-*/
-static PHP_METHOD(DBPointer, jsonSerialize)
-{
- php_phongo_dbpointer_t* intern;
- zval zdb_pointer;
- zval zoid;
-
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
-
- intern = Z_DBPOINTER_OBJ_P(getThis());
-
- array_init_size(&zdb_pointer, 2);
- array_init_size(&zoid, 1);
- ADD_ASSOC_STRINGL(&zdb_pointer, "$ref", intern->ref, intern->ref_len);
- ADD_ASSOC_STRING(&zoid, "$oid", intern->id);
- ADD_ASSOC_ZVAL(&zdb_pointer, "$id", &zoid);
-
- array_init_size(return_value, 1);
- ADD_ASSOC_ZVAL(return_value, "$dbPointer", &zdb_pointer);
-} /* }}} */
-
-/* {{{ proto string MongoDB\BSON\DBPointer::serialize()
-*/
-static PHP_METHOD(DBPointer, serialize)
-{
- php_phongo_dbpointer_t* intern;
- zval retval;
- php_serialize_data_t var_hash;
- smart_str buf = { 0 };
-
- intern = Z_DBPOINTER_OBJ_P(getThis());
-
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
-
- array_init_size(&retval, 2);
- ADD_ASSOC_STRINGL(&retval, "ref", intern->ref, intern->ref_len);
- ADD_ASSOC_STRING(&retval, "id", intern->id);
-
- PHP_VAR_SERIALIZE_INIT(var_hash);
- php_var_serialize(&buf, &retval, &var_hash);
- smart_str_0(&buf);
- PHP_VAR_SERIALIZE_DESTROY(var_hash);
-
- PHONGO_RETVAL_SMART_STR(buf);
-
- smart_str_free(&buf);
- zval_ptr_dtor(&retval);
-} /* }}} */
-
-/* {{{ proto void MongoDB\BSON\DBPointer::unserialize(string $serialized)
-*/
-static PHP_METHOD(DBPointer, unserialize)
-{
- php_phongo_dbpointer_t* intern;
- zend_error_handling error_handling;
- char* serialized;
- size_t serialized_len;
- zval props;
- php_unserialize_data_t var_hash;
-
- intern = Z_DBPOINTER_OBJ_P(getThis());
-
- zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
-
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &serialized, &serialized_len) == FAILURE) {
- zend_restore_error_handling(&error_handling);
- return;
- }
- zend_restore_error_handling(&error_handling);
-
- PHP_VAR_UNSERIALIZE_INIT(var_hash);
- if (!php_var_unserialize(&props, (const unsigned char**) &serialized, (unsigned char*) serialized + serialized_len, &var_hash)) {
- zval_ptr_dtor(&props);
- phongo_throw_exception(PHONGO_ERROR_UNEXPECTED_VALUE, "%s unserialization failed", ZSTR_VAL(php_phongo_dbpointer_ce->name));
-
- PHP_VAR_UNSERIALIZE_DESTROY(var_hash);
- return;
- }
- PHP_VAR_UNSERIALIZE_DESTROY(var_hash);
-
- php_phongo_dbpointer_init_from_hash(intern, HASH_OF(&props));
- zval_ptr_dtor(&props);
-} /* }}} */
-
-/* {{{ MongoDB\BSON\DBPointer function entries */
-ZEND_BEGIN_ARG_INFO_EX(ai_DBPointer_unserialize, 0, 0, 1)
- ZEND_ARG_INFO(0, serialized)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(ai_DBPointer_void, 0, 0, 0)
-ZEND_END_ARG_INFO()
-
-static zend_function_entry php_phongo_dbpointer_me[] = {
- /* clang-format off */
- /* __set_state intentionally missing */
- PHP_ME(DBPointer, __toString, ai_DBPointer_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
- PHP_ME(DBPointer, jsonSerialize, ai_DBPointer_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
- PHP_ME(DBPointer, serialize, ai_DBPointer_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
- PHP_ME(DBPointer, unserialize, ai_DBPointer_unserialize, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
- ZEND_NAMED_ME(__construct, PHP_FN(MongoDB_disabled___construct), ai_DBPointer_void, ZEND_ACC_PRIVATE | ZEND_ACC_FINAL)
- PHP_FE_END
- /* clang-format on */
-};
-/* }}} */
-
-/* {{{ MongoDB\BSON\DBPointer object handlers */
-static zend_object_handlers php_phongo_handler_dbpointer;
-
-static void php_phongo_dbpointer_free_object(zend_object* object) /* {{{ */
-{
- php_phongo_dbpointer_t* intern = Z_OBJ_DBPOINTER(object);
-
- zend_object_std_dtor(&intern->std);
-
- if (intern->ref) {
- efree(intern->ref);
- }
-
- if (intern->properties) {
- zend_hash_destroy(intern->properties);
- FREE_HASHTABLE(intern->properties);
- }
-} /* }}} */
-
-zend_object* php_phongo_dbpointer_create_object(zend_class_entry* class_type) /* {{{ */
-{
- php_phongo_dbpointer_t* intern = NULL;
-
- intern = PHONGO_ALLOC_OBJECT_T(php_phongo_dbpointer_t, class_type);
- zend_object_std_init(&intern->std, class_type);
- object_properties_init(&intern->std, class_type);
-
- intern->std.handlers = &php_phongo_handler_dbpointer;
-
- return &intern->std;
-} /* }}} */
-
-static zend_object* php_phongo_dbpointer_clone_object(zval* object) /* {{{ */
-{
- php_phongo_dbpointer_t* intern;
- php_phongo_dbpointer_t* new_intern;
- zend_object* new_object;
-
- intern = Z_DBPOINTER_OBJ_P(object);
- new_object = php_phongo_dbpointer_create_object(Z_OBJCE_P(object));
-
- new_intern = Z_OBJ_DBPOINTER(new_object);
- zend_objects_clone_members(&new_intern->std, &intern->std);
-
- php_phongo_dbpointer_init(new_intern, intern->ref, intern->ref_len, intern->id, 24);
-
- return new_object;
-} /* }}} */
-
-static int php_phongo_dbpointer_compare_objects(zval* o1, zval* o2) /* {{{ */
-{
- php_phongo_dbpointer_t *intern1, *intern2;
- int retval;
-
- intern1 = Z_DBPOINTER_OBJ_P(o1);
- intern2 = Z_DBPOINTER_OBJ_P(o2);
-
- retval = strcmp(intern1->ref, intern2->ref);
-
- if (retval != 0) {
- return retval;
- }
-
- return strcmp(intern1->id, intern2->id);
-} /* }}} */
-
-HashTable* php_phongo_dbpointer_get_properties_hash(zval* object, bool is_debug) /* {{{ */
-{
- php_phongo_dbpointer_t* intern;
- HashTable* props;
-
- intern = Z_DBPOINTER_OBJ_P(object);
-
- PHONGO_GET_PROPERTY_HASH_INIT_PROPS(is_debug, intern, props, 2);
-
- if (!intern->ref) {
- return props;
- }
-
- {
- zval ref, id;
-
- ZVAL_STRING(&ref, intern->ref);
- ZVAL_STRING(&id, intern->id);
- zend_hash_str_update(props, "ref", sizeof("ref") - 1, &ref);
- zend_hash_str_update(props, "id", sizeof("id") - 1, &id);
- }
-
- return props;
-} /* }}} */
-
-static HashTable* php_phongo_dbpointer_get_debug_info(zval* object, int* is_temp) /* {{{ */
-{
- *is_temp = 1;
- return php_phongo_dbpointer_get_properties_hash(object, true);
-} /* }}} */
-
-static HashTable* php_phongo_dbpointer_get_properties(zval* object) /* {{{ */
-{
- return php_phongo_dbpointer_get_properties_hash(object, false);
-} /* }}} */
-/* }}} */
-
-void php_phongo_dbpointer_init_ce(INIT_FUNC_ARGS) /* {{{ */
-{
- zend_class_entry ce;
-
- INIT_NS_CLASS_ENTRY(ce, "MongoDB\\BSON", "DBPointer", php_phongo_dbpointer_me);
- php_phongo_dbpointer_ce = zend_register_internal_class(&ce);
- php_phongo_dbpointer_ce->create_object = php_phongo_dbpointer_create_object;
- PHONGO_CE_FINAL(php_phongo_dbpointer_ce);
-
- zend_class_implements(php_phongo_dbpointer_ce, 1, php_phongo_json_serializable_ce);
- zend_class_implements(php_phongo_dbpointer_ce, 1, php_phongo_type_ce);
- zend_class_implements(php_phongo_dbpointer_ce, 1, zend_ce_serializable);
-
- memcpy(&php_phongo_handler_dbpointer, phongo_get_std_object_handlers(), sizeof(zend_object_handlers));
- php_phongo_handler_dbpointer.clone_obj = php_phongo_dbpointer_clone_object;
- php_phongo_handler_dbpointer.compare_objects = php_phongo_dbpointer_compare_objects;
- php_phongo_handler_dbpointer.get_debug_info = php_phongo_dbpointer_get_debug_info;
- php_phongo_handler_dbpointer.get_properties = php_phongo_dbpointer_get_properties;
- php_phongo_handler_dbpointer.free_obj = php_phongo_dbpointer_free_object;
- php_phongo_handler_dbpointer.offset = XtOffsetOf(php_phongo_dbpointer_t, std);
-} /* }}} */
-
-/*
- * 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.8.1/src/BSON/Decimal128.c b/mongodb-1.8.1/src/BSON/Decimal128.c
deleted file mode 100644
index 86bdffe8..00000000
--- a/mongodb-1.8.1/src/BSON/Decimal128.c
+++ /dev/null
@@ -1,346 +0,0 @@
-/*
- * 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.
- */
-
-#include <php.h>
-#include <Zend/zend_interfaces.h>
-#include <ext/standard/php_var.h>
-#include <zend_smart_str.h>
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "phongo_compat.h"
-#include "php_phongo.h"
-
-zend_class_entry* php_phongo_decimal128_ce;
-
-/* 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) /* {{{ */
-{
- if (!bson_decimal128_from_string(value, &intern->decimal)) {
- phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "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) /* {{{ */
-{
- 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));
- }
-
- phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "%s initialization requires \"dec\" string field", ZSTR_VAL(php_phongo_decimal128_ce->name));
- return false;
-} /* }}} */
-
-/* {{{ proto void MongoDB\BSON\Decimal128::__construct(string $value)
- Construct a new BSON Decimal128 type */
-static PHP_METHOD(Decimal128, __construct)
-{
- php_phongo_decimal128_t* intern;
- zend_error_handling error_handling;
- char* value;
- size_t value_len;
-
- zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
- intern = Z_DECIMAL128_OBJ_P(getThis());
-
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &value, &value_len) == FAILURE) {
- zend_restore_error_handling(&error_handling);
- return;
- }
- zend_restore_error_handling(&error_handling);
-
- php_phongo_decimal128_init(intern, value);
-} /* }}} */
-
-/* {{{ proto void MongoDB\BSON\Decimal128::__set_state(array $properties)
-*/
-static PHP_METHOD(Decimal128, __set_state)
-{
- php_phongo_decimal128_t* intern;
- HashTable* props;
- zval* array;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "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);
-} /* }}} */
-
-/* {{{ proto string MongoDB\BSON\Decimal128::__toString()
-*/
-static 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);
-
- RETURN_STRING(outbuf);
-} /* }}} */
-
-/* {{{ proto array MongoDB\BSON\Decimal128::jsonSerialize()
-*/
-static 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 MongoDB\BSON\Decimal128::serialize()
-*/
-static PHP_METHOD(Decimal128, serialize)
-{
- php_phongo_decimal128_t* intern;
- zval retval;
- 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);
- array_init_size(&retval, 1);
- ADD_ASSOC_STRING(&retval, "dec", outbuf);
-
- PHP_VAR_SERIALIZE_INIT(var_hash);
- php_var_serialize(&buf, &retval, &var_hash);
- smart_str_0(&buf);
- PHP_VAR_SERIALIZE_DESTROY(var_hash);
-
- PHONGO_RETVAL_SMART_STR(buf);
-
- smart_str_free(&buf);
- zval_ptr_dtor(&retval);
-} /* }}} */
-
-/* {{{ proto void MongoDB\BSON\Decimal128::unserialize(string $serialized)
-*/
-static PHP_METHOD(Decimal128, unserialize)
-{
- php_phongo_decimal128_t* intern;
- zend_error_handling error_handling;
- char* serialized;
- size_t serialized_len;
- zval props;
- 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);
-
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &serialized, &serialized_len) == FAILURE) {
- zend_restore_error_handling(&error_handling);
- return;
- }
- zend_restore_error_handling(&error_handling);
-
- PHP_VAR_UNSERIALIZE_INIT(var_hash);
- if (!php_var_unserialize(&props, (const unsigned char**) &serialized, (unsigned char*) serialized + serialized_len, &var_hash)) {
- zval_ptr_dtor(&props);
- phongo_throw_exception(PHONGO_ERROR_UNEXPECTED_VALUE, "%s unserialization failed", ZSTR_VAL(php_phongo_decimal128_ce->name));
-
- PHP_VAR_UNSERIALIZE_DESTROY(var_hash);
- return;
- }
- PHP_VAR_UNSERIALIZE_DESTROY(var_hash);
-
- php_phongo_decimal128_init_from_hash(intern, HASH_OF(&props));
- zval_ptr_dtor(&props);
-} /* }}} */
-
-/* {{{ MongoDB\BSON\Decimal128 function entries */
-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[] = {
- /* clang-format off */
- 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
- /* clang-format on */
-};
-/* }}} */
-
-/* {{{ MongoDB\BSON\Decimal128 object handlers */
-static zend_object_handlers php_phongo_handler_decimal128;
-
-static void php_phongo_decimal128_free_object(zend_object* object) /* {{{ */
-{
- php_phongo_decimal128_t* intern = Z_OBJ_DECIMAL128(object);
-
- zend_object_std_dtor(&intern->std);
-
- if (intern->properties) {
- zend_hash_destroy(intern->properties);
- FREE_HASHTABLE(intern->properties);
- }
-} /* }}} */
-
-static zend_object* php_phongo_decimal128_create_object(zend_class_entry* class_type) /* {{{ */
-{
- 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);
- object_properties_init(&intern->std, class_type);
-
- intern->std.handlers = &php_phongo_handler_decimal128;
-
- return &intern->std;
-} /* }}} */
-
-static zend_object* php_phongo_decimal128_clone_object(zval* object) /* {{{ */
-{
- php_phongo_decimal128_t* intern;
- php_phongo_decimal128_t* new_intern;
- zend_object* new_object;
-
- intern = Z_DECIMAL128_OBJ_P(object);
- new_object = php_phongo_decimal128_create_object(Z_OBJCE_P(object));
-
- new_intern = Z_OBJ_DECIMAL128(new_object);
- zend_objects_clone_members(&new_intern->std, &intern->std);
-
- // Use memcpy to copy bson value to avoid converting to string and back
- memcpy(&new_intern->decimal, &intern->decimal, sizeof(bson_decimal128_t));
- new_intern->initialized = true;
-
- return new_object;
-} /* }}} */
-
-static HashTable* php_phongo_decimal128_get_properties_hash(zval* object, bool is_debug) /* {{{ */
-{
- php_phongo_decimal128_t* intern;
- HashTable* props;
- char outbuf[BSON_DECIMAL128_STRING] = "";
-
- intern = Z_DECIMAL128_OBJ_P(object);
-
- PHONGO_GET_PROPERTY_HASH_INIT_PROPS(is_debug, intern, props, 1);
-
- if (!intern->initialized) {
- return props;
- }
-
- bson_decimal128_to_string(&intern->decimal, outbuf);
-
- {
- zval dec;
-
- ZVAL_STRING(&dec, outbuf);
- zend_hash_str_update(props, "dec", sizeof("dec") - 1, &dec);
- }
-
- return props;
-} /* }}} */
-
-static HashTable* php_phongo_decimal128_get_debug_info(zval* object, int* is_temp) /* {{{ */
-{
- *is_temp = 1;
- return php_phongo_decimal128_get_properties_hash(object, true);
-} /* }}} */
-
-static HashTable* php_phongo_decimal128_get_properties(zval* object) /* {{{ */
-{
- return php_phongo_decimal128_get_properties_hash(object, false);
-} /* }}} */
-/* }}} */
-
-void php_phongo_decimal128_init_ce(INIT_FUNC_ARGS) /* {{{ */
-{
- zend_class_entry ce;
-
- INIT_NS_CLASS_ENTRY(ce, "MongoDB\\BSON", "Decimal128", php_phongo_decimal128_me);
- php_phongo_decimal128_ce = zend_register_internal_class(&ce);
- 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, 1, php_phongo_decimal128_interface_ce);
- zend_class_implements(php_phongo_decimal128_ce, 1, php_phongo_json_serializable_ce);
- zend_class_implements(php_phongo_decimal128_ce, 1, php_phongo_type_ce);
- zend_class_implements(php_phongo_decimal128_ce, 1, zend_ce_serializable);
-
- memcpy(&php_phongo_handler_decimal128, phongo_get_std_object_handlers(), sizeof(zend_object_handlers));
- php_phongo_handler_decimal128.clone_obj = php_phongo_decimal128_clone_object;
- php_phongo_handler_decimal128.get_debug_info = php_phongo_decimal128_get_debug_info;
- php_phongo_handler_decimal128.get_properties = php_phongo_decimal128_get_properties;
- php_phongo_handler_decimal128.free_obj = php_phongo_decimal128_free_object;
- php_phongo_handler_decimal128.offset = XtOffsetOf(php_phongo_decimal128_t, std);
-} /* }}} */
-
-/*
- * 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.8.1/src/BSON/Int64.c b/mongodb-1.8.1/src/BSON/Int64.c
deleted file mode 100644
index 80904795..00000000
--- a/mongodb-1.8.1/src/BSON/Int64.c
+++ /dev/null
@@ -1,309 +0,0 @@
-/*
- * Copyright 2018-present 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 <php.h>
-#include <Zend/zend_interfaces.h>
-#include <ext/standard/php_var.h>
-#include <zend_smart_str.h>
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "phongo_compat.h"
-#include "php_phongo.h"
-#include "php_bson.h"
-
-zend_class_entry* php_phongo_int64_ce;
-
-/* Initialize the object and return whether it was successful. */
-static bool php_phongo_int64_init(php_phongo_int64_t* intern, int64_t integer) /* {{{ */
-{
- intern->integer = integer;
- 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_int64_init_from_string(php_phongo_int64_t* intern, const char* s_integer, size_t s_integer_len) /* {{{ */
-{
- int64_t integer;
-
- if (!php_phongo_parse_int64(&integer, s_integer, s_integer_len)) {
- phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Error parsing \"%s\" as 64-bit integer for %s initialization", s_integer, ZSTR_VAL(php_phongo_int64_ce->name));
- return false;
- }
-
- return php_phongo_int64_init(intern, integer);
-} /* }}} */
-
-/* Initialize the object from a HashTable and return whether it was successful.
- * An exception will be thrown on error. */
-static bool php_phongo_int64_init_from_hash(php_phongo_int64_t* intern, HashTable* props) /* {{{ */
-{
- zval* value;
-
- if ((value = zend_hash_str_find(props, "integer", sizeof("integer") - 1)) && Z_TYPE_P(value) == IS_STRING) {
- return php_phongo_int64_init_from_string(intern, Z_STRVAL_P(value), Z_STRLEN_P(value));
- }
-
- phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "%s initialization requires \"integer\" string field", ZSTR_VAL(php_phongo_int64_ce->name));
- return false;
-} /* }}} */
-
-/* {{{ proto string MongoDB\BSON\Int64::__toString()
- Return the Int64's value as a string. */
-static PHP_METHOD(Int64, __toString)
-{
- php_phongo_int64_t* intern;
-
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
-
- intern = Z_INT64_OBJ_P(getThis());
-
- ZVAL_INT64_STRING(return_value, intern->integer);
-} /* }}} */
-
-/* {{{ proto array MongoDB\BSON\Int64::jsonSerialize()
-*/
-static PHP_METHOD(Int64, jsonSerialize)
-{
- php_phongo_int64_t* intern;
-
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
-
- intern = Z_INT64_OBJ_P(getThis());
-
- array_init_size(return_value, 1);
-
- ADD_ASSOC_INT64_AS_STRING(return_value, "$numberLong", intern->integer);
-} /* }}} */
-
-/* {{{ proto string MongoDB\BSON\Int64::serialize()
-*/
-static PHP_METHOD(Int64, serialize)
-{
- php_phongo_int64_t* intern;
- zval retval;
- php_serialize_data_t var_hash;
- smart_str buf = { 0 };
-
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
-
- intern = Z_INT64_OBJ_P(getThis());
-
- array_init_size(&retval, 1);
- ADD_ASSOC_INT64_AS_STRING(&retval, "integer", intern->integer);
-
- PHP_VAR_SERIALIZE_INIT(var_hash);
- php_var_serialize(&buf, &retval, &var_hash);
- smart_str_0(&buf);
- PHP_VAR_SERIALIZE_DESTROY(var_hash);
-
- PHONGO_RETVAL_SMART_STR(buf);
-
- smart_str_free(&buf);
- zval_ptr_dtor(&retval);
-} /* }}} */
-
-/* {{{ proto void MongoDB\BSON\Int64::unserialize(string $serialized)
-*/
-static PHP_METHOD(Int64, unserialize)
-{
- php_phongo_int64_t* intern;
- zend_error_handling error_handling;
- char* serialized;
- size_t serialized_len;
- zval props;
- php_unserialize_data_t var_hash;
-
- intern = Z_INT64_OBJ_P(getThis());
-
- zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
-
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &serialized, &serialized_len) == FAILURE) {
- zend_restore_error_handling(&error_handling);
- return;
- }
- zend_restore_error_handling(&error_handling);
-
- PHP_VAR_UNSERIALIZE_INIT(var_hash);
- if (!php_var_unserialize(&props, (const unsigned char**) &serialized, (unsigned char*) serialized + serialized_len, &var_hash)) {
- zval_ptr_dtor(&props);
- phongo_throw_exception(PHONGO_ERROR_UNEXPECTED_VALUE, "%s unserialization failed", ZSTR_VAL(php_phongo_int64_ce->name));
-
- PHP_VAR_UNSERIALIZE_DESTROY(var_hash);
- return;
- }
- PHP_VAR_UNSERIALIZE_DESTROY(var_hash);
-
- php_phongo_int64_init_from_hash(intern, HASH_OF(&props));
- zval_ptr_dtor(&props);
-} /* }}} */
-
-/* {{{ MongoDB\BSON\Int64 function entries */
-ZEND_BEGIN_ARG_INFO_EX(ai_Int64_unserialize, 0, 0, 1)
- ZEND_ARG_INFO(0, serialized)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(ai_Int64_void, 0, 0, 0)
-ZEND_END_ARG_INFO()
-
-static zend_function_entry php_phongo_int64_me[] = {
- /* clang-format off */
- /* __set_state intentionally missing */
- PHP_ME(Int64, __toString, ai_Int64_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
- PHP_ME(Int64, jsonSerialize, ai_Int64_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
- PHP_ME(Int64, serialize, ai_Int64_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
- PHP_ME(Int64, unserialize, ai_Int64_unserialize, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
- ZEND_NAMED_ME(__construct, PHP_FN(MongoDB_disabled___construct), ai_Int64_void, ZEND_ACC_PRIVATE | ZEND_ACC_FINAL)
- PHP_FE_END
- /* clang-format on */
-};
-/* }}} */
-
-/* {{{ MongoDB\BSON\Int64 object handlers */
-static zend_object_handlers php_phongo_handler_int64;
-
-static void php_phongo_int64_free_object(zend_object* object) /* {{{ */
-{
- php_phongo_int64_t* intern = Z_OBJ_INT64(object);
-
- zend_object_std_dtor(&intern->std);
-
- if (intern->properties) {
- zend_hash_destroy(intern->properties);
- FREE_HASHTABLE(intern->properties);
- }
-} /* }}} */
-
-zend_object* php_phongo_int64_create_object(zend_class_entry* class_type) /* {{{ */
-{
- php_phongo_int64_t* intern = NULL;
-
- intern = PHONGO_ALLOC_OBJECT_T(php_phongo_int64_t, class_type);
- zend_object_std_init(&intern->std, class_type);
- object_properties_init(&intern->std, class_type);
-
- intern->std.handlers = &php_phongo_handler_int64;
-
- return &intern->std;
-} /* }}} */
-
-static zend_object* php_phongo_int64_clone_object(zval* object) /* {{{ */
-{
- php_phongo_int64_t* intern;
- php_phongo_int64_t* new_intern;
- zend_object* new_object;
-
- intern = Z_INT64_OBJ_P(object);
- new_object = php_phongo_int64_create_object(Z_OBJCE_P(object));
-
- new_intern = Z_OBJ_INT64(new_object);
- zend_objects_clone_members(&new_intern->std, &intern->std);
-
- php_phongo_int64_init(new_intern, intern->integer);
-
- return new_object;
-} /* }}} */
-
-static int php_phongo_int64_compare_objects(zval* o1, zval* o2) /* {{{ */
-{
- php_phongo_int64_t *intern1, *intern2;
-
- intern1 = Z_INT64_OBJ_P(o1);
- intern2 = Z_INT64_OBJ_P(o2);
-
- if (intern1->integer != intern2->integer) {
- return intern1->integer < intern2->integer ? -1 : 1;
- }
-
- return 0;
-} /* }}} */
-
-HashTable* php_phongo_int64_get_properties_hash(zval* object, bool is_debug) /* {{{ */
-{
- php_phongo_int64_t* intern;
- HashTable* props;
-
- intern = Z_INT64_OBJ_P(object);
-
- PHONGO_GET_PROPERTY_HASH_INIT_PROPS(is_debug, intern, props, 2);
-
- if (!intern->initialized) {
- return props;
- }
-
- {
- zval value;
-
- ZVAL_INT64_STRING(&value, intern->integer);
- zend_hash_str_update(props, "integer", sizeof("integer") - 1, &value);
- }
-
- return props;
-} /* }}} */
-
-static HashTable* php_phongo_int64_get_debug_info(zval* object, int* is_temp) /* {{{ */
-{
- *is_temp = 1;
- return php_phongo_int64_get_properties_hash(object, true);
-} /* }}} */
-
-static HashTable* php_phongo_int64_get_properties(zval* object) /* {{{ */
-{
- return php_phongo_int64_get_properties_hash(object, false);
-} /* }}} */
-/* }}} */
-
-void php_phongo_int64_init_ce(INIT_FUNC_ARGS) /* {{{ */
-{
- zend_class_entry ce;
-
- INIT_NS_CLASS_ENTRY(ce, "MongoDB\\BSON", "Int64", php_phongo_int64_me);
- php_phongo_int64_ce = zend_register_internal_class(&ce);
- php_phongo_int64_ce->create_object = php_phongo_int64_create_object;
- PHONGO_CE_FINAL(php_phongo_int64_ce);
-
- zend_class_implements(php_phongo_int64_ce, 1, php_phongo_json_serializable_ce);
- zend_class_implements(php_phongo_int64_ce, 1, php_phongo_type_ce);
- zend_class_implements(php_phongo_int64_ce, 1, zend_ce_serializable);
-
- memcpy(&php_phongo_handler_int64, phongo_get_std_object_handlers(), sizeof(zend_object_handlers));
- php_phongo_handler_int64.clone_obj = php_phongo_int64_clone_object;
- php_phongo_handler_int64.compare_objects = php_phongo_int64_compare_objects;
- php_phongo_handler_int64.get_debug_info = php_phongo_int64_get_debug_info;
- php_phongo_handler_int64.get_properties = php_phongo_int64_get_properties;
- php_phongo_handler_int64.free_obj = php_phongo_int64_free_object;
- php_phongo_handler_int64.offset = XtOffsetOf(php_phongo_int64_t, std);
-} /* }}} */
-
-/*
- * 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.8.1/src/BSON/Javascript.c b/mongodb-1.8.1/src/BSON/Javascript.c
deleted file mode 100644
index fa182228..00000000
--- a/mongodb-1.8.1/src/BSON/Javascript.c
+++ /dev/null
@@ -1,469 +0,0 @@
-/*
- * 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.
- */
-
-#include <php.h>
-#include <Zend/zend_interfaces.h>
-#include <ext/standard/php_var.h>
-#include <zend_smart_str.h>
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "phongo_compat.h"
-#include "php_phongo.h"
-#include "php_bson.h"
-
-zend_class_entry* php_phongo_javascript_ce;
-
-/* 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, size_t code_len, zval* scope) /* {{{ */
-{
- 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, "Expected scope to be array or object, %s given", zend_get_type_by_const(Z_TYPE_P(scope)));
- return false;
- }
-
- if (strlen(code) != (size_t) code_len) {
- phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "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();
- php_phongo_zval_to_bson(scope, PHONGO_BSON_NONE, intern->scope, NULL);
- } 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) /* {{{ */
-{
- 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);
- }
-
- phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "%s initialization requires \"code\" string field", ZSTR_VAL(php_phongo_javascript_ce->name));
- return false;
-} /* }}} */
-
-/* {{{ proto void MongoDB\BSON\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. */
-static PHP_METHOD(Javascript, __construct)
-{
- php_phongo_javascript_t* intern;
- zend_error_handling error_handling;
- char* code;
- size_t code_len;
- zval* scope = NULL;
-
- zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
- intern = Z_JAVASCRIPT_OBJ_P(getThis());
-
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|A!", &code, &code_len, &scope) == FAILURE) {
- zend_restore_error_handling(&error_handling);
- return;
- }
- zend_restore_error_handling(&error_handling);
-
- php_phongo_javascript_init(intern, code, code_len, scope);
-} /* }}} */
-
-/* {{{ proto void MongoDB\BSON\Javascript::__set_state(array $properties)
-*/
-static PHP_METHOD(Javascript, __set_state)
-{
- php_phongo_javascript_t* intern;
- HashTable* props;
- zval* array;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "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);
-} /* }}} */
-
-/* {{{ proto string MongoDB\BSON\Javascript::__toString()
- Return the Javascript's code string. */
-static PHP_METHOD(Javascript, __toString)
-{
- php_phongo_javascript_t* intern;
-
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
-
- intern = Z_JAVASCRIPT_OBJ_P(getThis());
-
- RETURN_STRINGL(intern->code, intern->code_len);
-} /* }}} */
-
-/* {{{ proto string MongoDB\BSON\Javascript::getCode()
-*/
-static PHP_METHOD(Javascript, getCode)
-{
- php_phongo_javascript_t* intern;
-
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
-
- intern = Z_JAVASCRIPT_OBJ_P(getThis());
-
- RETURN_STRINGL(intern->code, intern->code_len);
-} /* }}} */
-
-/* {{{ proto object|null MongoDB\BSON\Javascript::getScope()
-*/
-static 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_INIT_STATE(state);
-
- if (!php_phongo_bson_to_zval_ex(bson_get_data(intern->scope), intern->scope->len, &state)) {
- zval_ptr_dtor(&state.zchild);
- return;
- }
-
- RETURN_ZVAL(&state.zchild, 0, 1);
- } else {
- RETURN_NULL();
- }
-} /* }}} */
-
-/* {{{ proto array MongoDB\BSON\Javascript::jsonSerialize()
-*/
-static 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_INIT_STATE(state);
- if (!php_phongo_bson_to_zval_ex(bson_get_data(intern->scope), intern->scope->len, &state)) {
- zval_ptr_dtor(&state.zchild);
- return;
- }
-
- ADD_ASSOC_ZVAL_EX(return_value, "$scope", &state.zchild);
- }
-} /* }}} */
-
-/* {{{ proto string MongoDB\BSON\Javascript::serialize()
-*/
-static PHP_METHOD(Javascript, serialize)
-{
- php_phongo_javascript_t* intern;
- zval retval;
- php_phongo_bson_state state;
- php_serialize_data_t var_hash;
- smart_str buf = { 0 };
-
- PHONGO_BSON_INIT_STATE(state);
-
- intern = Z_JAVASCRIPT_OBJ_P(getThis());
-
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
-
- if (intern->scope && intern->scope->len) {
- if (!php_phongo_bson_to_zval_ex(bson_get_data(intern->scope), intern->scope->len, &state)) {
- zval_ptr_dtor(&state.zchild);
- return;
- }
- } else {
- ZVAL_NULL(&state.zchild);
- }
-
- array_init_size(&retval, 2);
- ADD_ASSOC_STRINGL(&retval, "code", intern->code, intern->code_len);
- ADD_ASSOC_ZVAL(&retval, "scope", &state.zchild);
-
- PHP_VAR_SERIALIZE_INIT(var_hash);
- php_var_serialize(&buf, &retval, &var_hash);
- smart_str_0(&buf);
- PHP_VAR_SERIALIZE_DESTROY(var_hash);
-
- PHONGO_RETVAL_SMART_STR(buf);
-
- smart_str_free(&buf);
- zval_ptr_dtor(&retval);
-} /* }}} */
-
-/* {{{ proto void MongoDB\BSON\Javascript::unserialize(string $serialized)
-*/
-static PHP_METHOD(Javascript, unserialize)
-{
- php_phongo_javascript_t* intern;
- zend_error_handling error_handling;
- char* serialized;
- size_t serialized_len;
- zval props;
- 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);
-
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &serialized, &serialized_len) == FAILURE) {
- zend_restore_error_handling(&error_handling);
- return;
- }
- zend_restore_error_handling(&error_handling);
-
- PHP_VAR_UNSERIALIZE_INIT(var_hash);
- if (!php_var_unserialize(&props, (const unsigned char**) &serialized, (unsigned char*) serialized + serialized_len, &var_hash)) {
- zval_ptr_dtor(&props);
- phongo_throw_exception(PHONGO_ERROR_UNEXPECTED_VALUE, "%s unserialization failed", ZSTR_VAL(php_phongo_javascript_ce->name));
-
- PHP_VAR_UNSERIALIZE_DESTROY(var_hash);
- return;
- }
- PHP_VAR_UNSERIALIZE_DESTROY(var_hash);
-
- php_phongo_javascript_init_from_hash(intern, HASH_OF(&props));
- zval_ptr_dtor(&props);
-} /* }}} */
-
-/* {{{ MongoDB\BSON\Javascript function entries */
-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[] = {
- /* clang-format off */
- 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
- /* clang-format on */
-};
-/* }}} */
-
-/* {{{ MongoDB\BSON\Javascript object handlers */
-static zend_object_handlers php_phongo_handler_javascript;
-
-static void php_phongo_javascript_free_object(zend_object* object) /* {{{ */
-{
- php_phongo_javascript_t* intern = Z_OBJ_JAVASCRIPT(object);
-
- zend_object_std_dtor(&intern->std);
-
- if (intern->code) {
- efree(intern->code);
- }
- if (intern->scope) {
- bson_destroy(intern->scope);
- intern->scope = NULL;
- }
-
- if (intern->properties) {
- zend_hash_destroy(intern->properties);
- FREE_HASHTABLE(intern->properties);
- }
-} /* }}} */
-
-zend_object* php_phongo_javascript_create_object(zend_class_entry* class_type) /* {{{ */
-{
- 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);
- object_properties_init(&intern->std, class_type);
-
- intern->std.handlers = &php_phongo_handler_javascript;
-
- return &intern->std;
-} /* }}} */
-
-static zend_object* php_phongo_javascript_clone_object(zval* object) /* {{{ */
-{
- php_phongo_javascript_t* intern;
- php_phongo_javascript_t* new_intern;
- zend_object* new_object;
-
- intern = Z_JAVASCRIPT_OBJ_P(object);
- new_object = php_phongo_javascript_create_object(Z_OBJCE_P(object));
-
- new_intern = Z_OBJ_JAVASCRIPT(new_object);
- zend_objects_clone_members(&new_intern->std, &intern->std);
-
- php_phongo_javascript_init(new_intern, intern->code, intern->code_len, NULL);
- new_intern->scope = bson_copy(intern->scope);
-
- return new_object;
-} /* }}} */
-
-static int php_phongo_javascript_compare_objects(zval* o1, zval* o2) /* {{{ */
-{
- 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);
-} /* }}} */
-
-HashTable* php_phongo_javascript_get_properties_hash(zval* object, bool is_debug) /* {{{ */
-{
- php_phongo_javascript_t* intern;
- HashTable* props;
-
- intern = Z_JAVASCRIPT_OBJ_P(object);
-
- PHONGO_GET_PROPERTY_HASH_INIT_PROPS(is_debug, intern, props, 2);
-
- if (!intern->code) {
- return props;
- }
-
- {
- 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_INIT_STATE(state);
- if (!php_phongo_bson_to_zval_ex(bson_get_data(intern->scope), intern->scope->len, &state)) {
- zval_ptr_dtor(&state.zchild);
- goto failure;
- }
-
- 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);
- }
- }
-
- return props;
-
-failure:
- PHONGO_GET_PROPERTY_HASH_FREE_PROPS(is_debug, props);
- return NULL;
-} /* }}} */
-
-static HashTable* php_phongo_javascript_get_debug_info(zval* object, int* is_temp) /* {{{ */
-{
- *is_temp = 1;
- return php_phongo_javascript_get_properties_hash(object, true);
-} /* }}} */
-
-static HashTable* php_phongo_javascript_get_properties(zval* object) /* {{{ */
-{
- return php_phongo_javascript_get_properties_hash(object, false);
-} /* }}} */
-/* }}} */
-
-void php_phongo_javascript_init_ce(INIT_FUNC_ARGS) /* {{{ */
-{
- zend_class_entry ce;
-
- INIT_NS_CLASS_ENTRY(ce, "MongoDB\\BSON", "Javascript", php_phongo_javascript_me);
- php_phongo_javascript_ce = zend_register_internal_class(&ce);
- 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, 1, php_phongo_javascript_interface_ce);
- zend_class_implements(php_phongo_javascript_ce, 1, php_phongo_json_serializable_ce);
- zend_class_implements(php_phongo_javascript_ce, 1, php_phongo_type_ce);
- zend_class_implements(php_phongo_javascript_ce, 1, zend_ce_serializable);
-
- memcpy(&php_phongo_handler_javascript, phongo_get_std_object_handlers(), sizeof(zend_object_handlers));
- php_phongo_handler_javascript.clone_obj = php_phongo_javascript_clone_object;
- php_phongo_handler_javascript.compare_objects = php_phongo_javascript_compare_objects;
- php_phongo_handler_javascript.get_debug_info = php_phongo_javascript_get_debug_info;
- php_phongo_handler_javascript.get_properties = php_phongo_javascript_get_properties;
- php_phongo_handler_javascript.free_obj = php_phongo_javascript_free_object;
- php_phongo_handler_javascript.offset = XtOffsetOf(php_phongo_javascript_t, std);
-} /* }}} */
-
-/*
- * 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.8.1/src/BSON/MaxKey.c b/mongodb-1.8.1/src/BSON/MaxKey.c
deleted file mode 100644
index 0ffa4200..00000000
--- a/mongodb-1.8.1/src/BSON/MaxKey.c
+++ /dev/null
@@ -1,155 +0,0 @@
-/*
- * 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.
- */
-
-#include <php.h>
-#include <Zend/zend_interfaces.h>
-#include <ext/standard/php_var.h>
-#include <zend_smart_str.h>
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "phongo_compat.h"
-#include "php_phongo.h"
-
-zend_class_entry* php_phongo_maxkey_ce;
-
-/* {{{ proto void MongoDB\BSON\MaxKey::__set_state(array $properties)
-*/
-static PHP_METHOD(MaxKey, __set_state)
-{
- zval* array;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "a", &array) == FAILURE) {
- RETURN_FALSE;
- }
-
- object_init_ex(return_value, php_phongo_maxkey_ce);
-} /* }}} */
-
-/* {{{ proto array MongoDB\BSON\MaxKey::jsonSerialize()
-*/
-static PHP_METHOD(MaxKey, jsonSerialize)
-{
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
-
- array_init_size(return_value, 1);
- ADD_ASSOC_LONG_EX(return_value, "$maxKey", 1);
-} /* }}} */
-
-/* {{{ proto string MongoDB\BSON\MaxKey::serialize()
-*/
-static PHP_METHOD(MaxKey, serialize)
-{
- RETURN_STRING("");
-} /* }}} */
-
-/* {{{ proto void MongoDB\BSON\MaxKey::unserialize(string $serialized)
-*/
-static PHP_METHOD(MaxKey, unserialize)
-{
- zend_error_handling error_handling;
- char* serialized;
- size_t serialized_len;
-
- zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
-
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &serialized, &serialized_len) == FAILURE) {
- zend_restore_error_handling(&error_handling);
- return;
- }
- zend_restore_error_handling(&error_handling);
-} /* }}} */
-
-/* {{{ MongoDB\BSON\MaxKey function entries */
-ZEND_BEGIN_ARG_INFO_EX(ai_MaxKey___set_state, 0, 0, 1)
- ZEND_ARG_ARRAY_INFO(0, properties, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(ai_MaxKey_unserialize, 0, 0, 1)
- ZEND_ARG_INFO(0, serialized)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(ai_MaxKey_void, 0, 0, 0)
-ZEND_END_ARG_INFO()
-
-static zend_function_entry php_phongo_maxkey_me[] = {
- /* clang-format off */
- PHP_ME(MaxKey, __set_state, ai_MaxKey___set_state, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
- PHP_ME(MaxKey, jsonSerialize, ai_MaxKey_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
- PHP_ME(MaxKey, serialize, ai_MaxKey_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
- PHP_ME(MaxKey, unserialize, ai_MaxKey_unserialize, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
- PHP_FE_END
- /* clang-format on */
-};
-/* }}} */
-
-/* {{{ MongoDB\BSON\MaxKey object handlers */
-static zend_object_handlers php_phongo_handler_maxkey;
-
-static void php_phongo_maxkey_free_object(zend_object* object) /* {{{ */
-{
- php_phongo_maxkey_t* intern = Z_OBJ_MAXKEY(object);
-
- zend_object_std_dtor(&intern->std);
-} /* }}} */
-
-static zend_object* php_phongo_maxkey_create_object(zend_class_entry* class_type) /* {{{ */
-{
- php_phongo_maxkey_t* intern = NULL;
-
- intern = PHONGO_ALLOC_OBJECT_T(php_phongo_maxkey_t, class_type);
- zend_object_std_init(&intern->std, class_type);
- object_properties_init(&intern->std, class_type);
-
- intern->std.handlers = &php_phongo_handler_maxkey;
-
- return &intern->std;
-} /* }}} */
-/* }}} */
-
-void php_phongo_maxkey_init_ce(INIT_FUNC_ARGS) /* {{{ */
-{
- zend_class_entry ce;
-
- INIT_NS_CLASS_ENTRY(ce, "MongoDB\\BSON", "MaxKey", php_phongo_maxkey_me);
- php_phongo_maxkey_ce = zend_register_internal_class(&ce);
- php_phongo_maxkey_ce->create_object = php_phongo_maxkey_create_object;
- PHONGO_CE_FINAL(php_phongo_maxkey_ce);
-
- zend_class_implements(php_phongo_maxkey_ce, 1, php_phongo_maxkey_interface_ce);
- zend_class_implements(php_phongo_maxkey_ce, 1, php_phongo_json_serializable_ce);
- zend_class_implements(php_phongo_maxkey_ce, 1, php_phongo_type_ce);
- zend_class_implements(php_phongo_maxkey_ce, 1, zend_ce_serializable);
-
- memcpy(&php_phongo_handler_maxkey, phongo_get_std_object_handlers(), sizeof(zend_object_handlers));
- /* Re-assign default handler previously removed in php_phongo.c */
- php_phongo_handler_maxkey.clone_obj = zend_objects_clone_obj;
- php_phongo_handler_maxkey.free_obj = php_phongo_maxkey_free_object;
- php_phongo_handler_maxkey.offset = XtOffsetOf(php_phongo_maxkey_t, std);
-} /* }}} */
-
-/*
- * 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.8.1/src/BSON/MinKey.c b/mongodb-1.8.1/src/BSON/MinKey.c
deleted file mode 100644
index 87564591..00000000
--- a/mongodb-1.8.1/src/BSON/MinKey.c
+++ /dev/null
@@ -1,156 +0,0 @@
-/*
- * 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.
- */
-
-#include <php.h>
-#include <Zend/zend_interfaces.h>
-#include <ext/standard/php_var.h>
-#include <zend_smart_str.h>
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "phongo_compat.h"
-#include "php_phongo.h"
-
-zend_class_entry* php_phongo_minkey_ce;
-
-/* {{{ proto void MongoDB\BSON\MinKey::__set_state(array $properties)
-*/
-static PHP_METHOD(MinKey, __set_state)
-{
- zval* array;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "a", &array) == FAILURE) {
- RETURN_FALSE;
- }
-
- object_init_ex(return_value, php_phongo_minkey_ce);
-} /* }}} */
-
-/* {{{ proto array MongoDB\BSON\MinKey::jsonSerialize()
-*/
-static PHP_METHOD(MinKey, jsonSerialize)
-{
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
-
- array_init_size(return_value, 1);
- ADD_ASSOC_LONG_EX(return_value, "$minKey", 1);
-} /* }}} */
-
-/* {{{ proto string MongoDB\BSON\MinKey::serialize()
-*/
-static PHP_METHOD(MinKey, serialize)
-{
- RETURN_STRING("");
-} /* }}} */
-
-/* {{{ proto void MongoDB\BSON\MinKey::unserialize(string $serialized)
-*/
-static PHP_METHOD(MinKey, unserialize)
-{
- zend_error_handling error_handling;
- char* serialized;
- size_t serialized_len;
-
- zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
-
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &serialized, &serialized_len) == FAILURE) {
- zend_restore_error_handling(&error_handling);
- return;
- }
- zend_restore_error_handling(&error_handling);
-} /* }}} */
-
-/* {{{ MongoDB\BSON\MinKey function entries */
-ZEND_BEGIN_ARG_INFO_EX(ai_MinKey___set_state, 0, 0, 1)
- ZEND_ARG_ARRAY_INFO(0, properties, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(ai_MinKey_unserialize, 0, 0, 1)
- ZEND_ARG_INFO(0, serialized)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(ai_MinKey_void, 0, 0, 0)
-ZEND_END_ARG_INFO()
-
-static zend_function_entry php_phongo_minkey_me[] = {
- /* clang-format off */
- PHP_ME(MinKey, __set_state, ai_MinKey___set_state, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
- PHP_ME(MinKey, jsonSerialize, ai_MinKey_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
- PHP_ME(MinKey, serialize, ai_MinKey_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
- PHP_ME(MinKey, unserialize, ai_MinKey_unserialize, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
- PHP_FE_END
- /* clang-format on */
-};
-/* }}} */
-
-/* {{{ MongoDB\BSON\MinKey object handlers */
-static zend_object_handlers php_phongo_handler_minkey;
-
-static void php_phongo_minkey_free_object(zend_object* object) /* {{{ */
-{
- php_phongo_minkey_t* intern = Z_OBJ_MINKEY(object);
-
- zend_object_std_dtor(&intern->std);
-} /* }}} */
-
-static zend_object* php_phongo_minkey_create_object(zend_class_entry* class_type) /* {{{ */
-{
- php_phongo_minkey_t* intern = NULL;
-
- intern = PHONGO_ALLOC_OBJECT_T(php_phongo_minkey_t, class_type);
-
- zend_object_std_init(&intern->std, class_type);
- object_properties_init(&intern->std, class_type);
-
- intern->std.handlers = &php_phongo_handler_minkey;
-
- return &intern->std;
-} /* }}} */
-/* }}} */
-
-void php_phongo_minkey_init_ce(INIT_FUNC_ARGS) /* {{{ */
-{
- zend_class_entry ce;
-
- INIT_NS_CLASS_ENTRY(ce, "MongoDB\\BSON", "MinKey", php_phongo_minkey_me);
- php_phongo_minkey_ce = zend_register_internal_class(&ce);
- php_phongo_minkey_ce->create_object = php_phongo_minkey_create_object;
- PHONGO_CE_FINAL(php_phongo_minkey_ce);
-
- zend_class_implements(php_phongo_minkey_ce, 1, php_phongo_minkey_interface_ce);
- zend_class_implements(php_phongo_minkey_ce, 1, php_phongo_json_serializable_ce);
- zend_class_implements(php_phongo_minkey_ce, 1, php_phongo_type_ce);
- zend_class_implements(php_phongo_minkey_ce, 1, zend_ce_serializable);
-
- memcpy(&php_phongo_handler_minkey, phongo_get_std_object_handlers(), sizeof(zend_object_handlers));
- /* Re-assign default handler previously removed in php_phongo.c */
- php_phongo_handler_minkey.clone_obj = zend_objects_clone_obj;
- php_phongo_handler_minkey.free_obj = php_phongo_minkey_free_object;
- php_phongo_handler_minkey.offset = XtOffsetOf(php_phongo_minkey_t, std);
-} /* }}} */
-
-/*
- * 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.8.1/src/BSON/ObjectId.c b/mongodb-1.8.1/src/BSON/ObjectId.c
deleted file mode 100644
index da54982c..00000000
--- a/mongodb-1.8.1/src/BSON/ObjectId.c
+++ /dev/null
@@ -1,394 +0,0 @@
-/*
- * 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.
- */
-
-#include <php.h>
-#include <Zend/zend_interfaces.h>
-#include <ext/standard/php_var.h>
-#include <zend_smart_str.h>
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "phongo_compat.h"
-#include "php_phongo.h"
-
-#define PHONGO_OID_SIZE sizeof(((php_phongo_objectid_t*) 0)->oid)
-#define PHONGO_OID_LEN (PHONGO_OID_SIZE - 1)
-
-zend_class_entry* php_phongo_objectid_ce;
-
-/* 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* hex, size_t hex_len) /* {{{ */
-{
- if (bson_oid_is_valid(hex, hex_len)) {
- bson_oid_t oid;
-
- bson_oid_init_from_string(&oid, hex);
- bson_oid_to_string(&oid, intern->oid);
- intern->initialized = true;
-
- return true;
- }
-
- phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Error parsing ObjectId string: %s", hex);
-
- 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) /* {{{ */
-{
- 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));
- }
-
- phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "%s initialization requires \"oid\" string field", ZSTR_VAL(php_phongo_objectid_ce->name));
- return false;
-} /* }}} */
-
-/* {{{ proto void MongoDB\BSON\ObjectId::__construct([string $id])
- Constructs a new BSON ObjectId type, optionally from a hex string. */
-static PHP_METHOD(ObjectId, __construct)
-{
- php_phongo_objectid_t* intern;
- zend_error_handling error_handling;
- char* id = NULL;
- size_t id_len;
-
- zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
- intern = Z_OBJECTID_OBJ_P(getThis());
-
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "|s!", &id, &id_len) == FAILURE) {
- zend_restore_error_handling(&error_handling);
- return;
- }
- zend_restore_error_handling(&error_handling);
-
- if (id) {
- php_phongo_objectid_init_from_hex_string(intern, id, id_len);
- } else {
- php_phongo_objectid_init(intern);
- }
-} /* }}} */
-
-/* {{{ proto integer MongoDB\BSON\ObjectId::getTimestamp()
-*/
-static 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 MongoDB\BSON\ObjectId::__set_state(array $properties)
-*/
-static PHP_METHOD(ObjectId, __set_state)
-{
- php_phongo_objectid_t* intern;
- HashTable* props;
- zval* array;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "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);
-} /* }}} */
-
-/* {{{ proto string MongoDB\BSON\ObjectId::__toString()
-*/
-static PHP_METHOD(ObjectId, __toString)
-{
- php_phongo_objectid_t* intern;
-
- intern = Z_OBJECTID_OBJ_P(getThis());
-
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
-
- RETURN_STRINGL(intern->oid, PHONGO_OID_LEN);
-} /* }}} */
-
-/* {{{ proto array MongoDB\BSON\ObjectId::jsonSerialize()
-*/
-static 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, PHONGO_OID_LEN);
-} /* }}} */
-
-/* {{{ proto string MongoDB\BSON\ObjectId::serialize()
-*/
-static PHP_METHOD(ObjectId, serialize)
-{
- php_phongo_objectid_t* intern;
- zval retval;
- php_serialize_data_t var_hash;
- smart_str buf = { 0 };
-
- intern = Z_OBJECTID_OBJ_P(getThis());
-
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
-
- array_init_size(&retval, 1);
- ADD_ASSOC_STRINGL(&retval, "oid", intern->oid, PHONGO_OID_LEN);
-
- PHP_VAR_SERIALIZE_INIT(var_hash);
- php_var_serialize(&buf, &retval, &var_hash);
- smart_str_0(&buf);
- PHP_VAR_SERIALIZE_DESTROY(var_hash);
-
- PHONGO_RETVAL_SMART_STR(buf);
-
- smart_str_free(&buf);
- zval_ptr_dtor(&retval);
-} /* }}} */
-
-/* {{{ proto void MongoDB\BSON\ObjectId::unserialize(string $serialized)
-*/
-static PHP_METHOD(ObjectId, unserialize)
-{
- php_phongo_objectid_t* intern;
- zend_error_handling error_handling;
- char* serialized;
- size_t serialized_len;
- zval props;
- 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);
-
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &serialized, &serialized_len) == FAILURE) {
- zend_restore_error_handling(&error_handling);
- return;
- }
- zend_restore_error_handling(&error_handling);
-
- PHP_VAR_UNSERIALIZE_INIT(var_hash);
- if (!php_var_unserialize(&props, (const unsigned char**) &serialized, (unsigned char*) serialized + serialized_len, &var_hash)) {
- zval_ptr_dtor(&props);
- phongo_throw_exception(PHONGO_ERROR_UNEXPECTED_VALUE, "%s unserialization failed", ZSTR_VAL(php_phongo_objectid_ce->name));
-
- PHP_VAR_UNSERIALIZE_DESTROY(var_hash);
- return;
- }
- PHP_VAR_UNSERIALIZE_DESTROY(var_hash);
-
- php_phongo_objectid_init_from_hash(intern, HASH_OF(&props));
- zval_ptr_dtor(&props);
-} /* }}} */
-
-/* {{{ MongoDB\BSON\ObjectId function entries */
-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[] = {
- /* clang-format off */
- 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
- /* clang-format on */
-};
-/* }}} */
-
-/* {{{ MongoDB\BSON\ObjectId object handlers */
-static zend_object_handlers php_phongo_handler_objectid;
-
-static void php_phongo_objectid_free_object(zend_object* object) /* {{{ */
-{
- php_phongo_objectid_t* intern = Z_OBJ_OBJECTID(object);
-
- zend_object_std_dtor(&intern->std);
-
- if (intern->properties) {
- zend_hash_destroy(intern->properties);
- FREE_HASHTABLE(intern->properties);
- }
-} /* }}} */
-
-static zend_object* php_phongo_objectid_create_object(zend_class_entry* class_type) /* {{{ */
-{
- 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);
- object_properties_init(&intern->std, class_type);
-
- intern->std.handlers = &php_phongo_handler_objectid;
-
- return &intern->std;
-} /* }}} */
-
-static zend_object* php_phongo_objectid_clone_object(zval* object) /* {{{ */
-{
- php_phongo_objectid_t* intern;
- php_phongo_objectid_t* new_intern;
- zend_object* new_object;
-
- intern = Z_OBJECTID_OBJ_P(object);
- new_object = php_phongo_objectid_create_object(Z_OBJCE_P(object));
-
- new_intern = Z_OBJ_OBJECTID(new_object);
- zend_objects_clone_members(&new_intern->std, &intern->std);
-
- // Use memcpy to copy bson value to avoid converting to string and back
- memcpy(&new_intern->oid, &intern->oid, PHONGO_OID_SIZE);
- new_intern->initialized = true;
-
- return new_object;
-} /* }}} */
-
-static int php_phongo_objectid_compare_objects(zval* o1, zval* o2) /* {{{ */
-{
- 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_properties_hash(zval* object, bool is_debug) /* {{{ */
-{
- php_phongo_objectid_t* intern;
- HashTable* props;
-
- intern = Z_OBJECTID_OBJ_P(object);
-
- PHONGO_GET_PROPERTY_HASH_INIT_PROPS(is_debug, intern, props, 1);
-
- if (!intern->initialized) {
- return props;
- }
-
- {
- zval zv;
-
- ZVAL_STRING(&zv, intern->oid);
- zend_hash_str_update(props, "oid", sizeof("oid") - 1, &zv);
- }
-
- return props;
-} /* }}} */
-
-static HashTable* php_phongo_objectid_get_debug_info(zval* object, int* is_temp) /* {{{ */
-{
- *is_temp = 1;
- return php_phongo_objectid_get_properties_hash(object, true);
-} /* }}} */
-
-static HashTable* php_phongo_objectid_get_properties(zval* object) /* {{{ */
-{
- return php_phongo_objectid_get_properties_hash(object, false);
-} /* }}} */
-/* }}} */
-
-void php_phongo_objectid_init_ce(INIT_FUNC_ARGS) /* {{{ */
-{
- zend_class_entry ce;
-
- INIT_NS_CLASS_ENTRY(ce, "MongoDB\\BSON", "ObjectId", php_phongo_objectid_me);
- php_phongo_objectid_ce = zend_register_internal_class(&ce);
- 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, 1, php_phongo_objectid_interface_ce);
- zend_class_implements(php_phongo_objectid_ce, 1, php_phongo_json_serializable_ce);
- zend_class_implements(php_phongo_objectid_ce, 1, php_phongo_type_ce);
- zend_class_implements(php_phongo_objectid_ce, 1, zend_ce_serializable);
-
- memcpy(&php_phongo_handler_objectid, phongo_get_std_object_handlers(), sizeof(zend_object_handlers));
- php_phongo_handler_objectid.clone_obj = php_phongo_objectid_clone_object;
- php_phongo_handler_objectid.compare_objects = php_phongo_objectid_compare_objects;
- php_phongo_handler_objectid.get_debug_info = php_phongo_objectid_get_debug_info;
- php_phongo_handler_objectid.get_properties = php_phongo_objectid_get_properties;
- php_phongo_handler_objectid.free_obj = php_phongo_objectid_free_object;
- php_phongo_handler_objectid.offset = XtOffsetOf(php_phongo_objectid_t, std);
-} /* }}} */
-
-/*
- * 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.8.1/src/BSON/Regex.c b/mongodb-1.8.1/src/BSON/Regex.c
deleted file mode 100644
index dd689f85..00000000
--- a/mongodb-1.8.1/src/BSON/Regex.c
+++ /dev/null
@@ -1,431 +0,0 @@
-/*
- * 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.
- */
-
-#include <php.h>
-#include <Zend/zend_interfaces.h>
-#include <ext/standard/php_var.h>
-#include <zend_smart_str.h>
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "phongo_compat.h"
-#include "php_phongo.h"
-
-zend_class_entry* php_phongo_regex_ce;
-
-/* 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, size_t pattern_len, const char* flags, size_t flags_len) /* {{{ */
-{
- if (strlen(pattern) != (size_t) pattern_len) {
- phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Pattern cannot contain null bytes");
- return false;
- }
- intern->pattern = estrndup(pattern, pattern_len);
- intern->pattern_len = pattern_len;
-
- if (flags) {
- if (strlen(flags) != (size_t) flags_len) {
- phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "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) /* {{{ */
-{
- 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));
- }
-
- phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "%s initialization requires \"pattern\" and \"flags\" string fields", ZSTR_VAL(php_phongo_regex_ce->name));
- return false;
-} /* }}} */
-
-/* {{{ proto void MongoDB\BSON\Regex::__construct(string $pattern [, string $flags])
- Constructs a new BSON regular expression type. */
-static PHP_METHOD(Regex, __construct)
-{
- php_phongo_regex_t* intern;
- zend_error_handling error_handling;
- char* pattern;
- size_t pattern_len;
- char* flags = NULL;
- size_t flags_len = 0;
-
- zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
- intern = Z_REGEX_OBJ_P(getThis());
-
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|s", &pattern, &pattern_len, &flags, &flags_len) == FAILURE) {
- zend_restore_error_handling(&error_handling);
- return;
- }
- zend_restore_error_handling(&error_handling);
-
- php_phongo_regex_init(intern, pattern, pattern_len, flags, flags_len);
-} /* }}} */
-
-/* {{{ proto string MongoDB\BSON\Regex::getPattern()
-*/
-static PHP_METHOD(Regex, getPattern)
-{
- php_phongo_regex_t* intern;
-
- intern = Z_REGEX_OBJ_P(getThis());
-
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
-
- RETURN_STRINGL(intern->pattern, intern->pattern_len);
-} /* }}} */
-
-/* {{{ proto string MongoDB\BSON\Regex::getFlags()
-*/
-static PHP_METHOD(Regex, getFlags)
-{
- php_phongo_regex_t* intern;
-
- intern = Z_REGEX_OBJ_P(getThis());
-
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
-
- RETURN_STRINGL(intern->flags, intern->flags_len);
-} /* }}} */
-
-/* {{{ proto void MongoDB\BSON\Regex::__set_state(array $properties)
-*/
-static PHP_METHOD(Regex, __set_state)
-{
- php_phongo_regex_t* intern;
- HashTable* props;
- zval* array;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "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);
-} /* }}} */
-
-/* {{{ proto string MongoDB\BSON\Regex::__toString()
- Returns a string in the form: /pattern/flags */
-static 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);
- RETVAL_STRINGL(regex, regex_len);
- efree(regex);
-} /* }}} */
-
-/* {{{ proto array MongoDB\BSON\Regex::jsonSerialize()
-*/
-static 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 MongoDB\BSON\Regex::serialize()
-*/
-static PHP_METHOD(Regex, serialize)
-{
- php_phongo_regex_t* intern;
- zval retval;
- php_serialize_data_t var_hash;
- smart_str buf = { 0 };
-
- intern = Z_REGEX_OBJ_P(getThis());
-
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
-
- 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);
-
- PHP_VAR_SERIALIZE_INIT(var_hash);
- php_var_serialize(&buf, &retval, &var_hash);
- smart_str_0(&buf);
- PHP_VAR_SERIALIZE_DESTROY(var_hash);
-
- PHONGO_RETVAL_SMART_STR(buf);
-
- smart_str_free(&buf);
- zval_ptr_dtor(&retval);
-} /* }}} */
-
-/* {{{ proto void MongoDB\BSON\Regex::unserialize(string $serialized)
-*/
-static PHP_METHOD(Regex, unserialize)
-{
- php_phongo_regex_t* intern;
- zend_error_handling error_handling;
- char* serialized;
- size_t serialized_len;
- zval props;
- 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);
-
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &serialized, &serialized_len) == FAILURE) {
- zend_restore_error_handling(&error_handling);
- return;
- }
- zend_restore_error_handling(&error_handling);
-
- PHP_VAR_UNSERIALIZE_INIT(var_hash);
- if (!php_var_unserialize(&props, (const unsigned char**) &serialized, (unsigned char*) serialized + serialized_len, &var_hash)) {
- zval_ptr_dtor(&props);
- phongo_throw_exception(PHONGO_ERROR_UNEXPECTED_VALUE, "%s unserialization failed", ZSTR_VAL(php_phongo_regex_ce->name));
-
- PHP_VAR_UNSERIALIZE_DESTROY(var_hash);
- return;
- }
- PHP_VAR_UNSERIALIZE_DESTROY(var_hash);
-
- php_phongo_regex_init_from_hash(intern, HASH_OF(&props));
- zval_ptr_dtor(&props);
-} /* }}} */
-
-/* {{{ MongoDB\BSON\Regex function entries */
-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[] = {
- /* clang-format off */
- 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
- /* clang-format on */
-};
-/* }}} */
-
-/* {{{ MongoDB\BSON\Regex object handlers */
-static zend_object_handlers php_phongo_handler_regex;
-
-static void php_phongo_regex_free_object(zend_object* object) /* {{{ */
-{
- php_phongo_regex_t* intern = Z_OBJ_REGEX(object);
-
- zend_object_std_dtor(&intern->std);
-
- if (intern->pattern) {
- efree(intern->pattern);
- }
-
- if (intern->flags) {
- efree(intern->flags);
- }
-
- if (intern->properties) {
- zend_hash_destroy(intern->properties);
- FREE_HASHTABLE(intern->properties);
- }
-} /* }}} */
-
-static zend_object* php_phongo_regex_create_object(zend_class_entry* class_type) /* {{{ */
-{
- 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);
- object_properties_init(&intern->std, class_type);
-
- intern->std.handlers = &php_phongo_handler_regex;
-
- return &intern->std;
-} /* }}} */
-
-static zend_object* php_phongo_regex_clone_object(zval* object) /* {{{ */
-{
- php_phongo_regex_t* intern;
- php_phongo_regex_t* new_intern;
- zend_object* new_object;
-
- intern = Z_REGEX_OBJ_P(object);
- new_object = php_phongo_regex_create_object(Z_OBJCE_P(object));
-
- new_intern = Z_OBJ_REGEX(new_object);
- zend_objects_clone_members(&new_intern->std, &intern->std);
-
- php_phongo_regex_init(new_intern, intern->pattern, intern->pattern_len, intern->flags, intern->flags_len);
-
- return new_object;
-} /* }}} */
-
-static int php_phongo_regex_compare_objects(zval* o1, zval* o2) /* {{{ */
-{
- 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_properties_hash(zval* object, bool is_debug) /* {{{ */
-{
- php_phongo_regex_t* intern;
- HashTable* props;
-
- intern = Z_REGEX_OBJ_P(object);
-
- PHONGO_GET_PROPERTY_HASH_INIT_PROPS(is_debug, intern, props, 2);
-
- if (!intern->pattern) {
- return props;
- }
-
- {
- 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);
- }
-
- return props;
-} /* }}} */
-
-static HashTable* php_phongo_regex_get_debug_info(zval* object, int* is_temp) /* {{{ */
-{
- *is_temp = 1;
- return php_phongo_regex_get_properties_hash(object, true);
-} /* }}} */
-
-static HashTable* php_phongo_regex_get_properties(zval* object) /* {{{ */
-{
- return php_phongo_regex_get_properties_hash(object, false);
-} /* }}} */
-/* }}} */
-
-void php_phongo_regex_init_ce(INIT_FUNC_ARGS) /* {{{ */
-{
- zend_class_entry ce;
-
- INIT_NS_CLASS_ENTRY(ce, "MongoDB\\BSON", "Regex", php_phongo_regex_me);
- php_phongo_regex_ce = zend_register_internal_class(&ce);
- 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, 1, php_phongo_regex_interface_ce);
- zend_class_implements(php_phongo_regex_ce, 1, php_phongo_type_ce);
- zend_class_implements(php_phongo_regex_ce, 1, zend_ce_serializable);
- zend_class_implements(php_phongo_regex_ce, 1, php_phongo_json_serializable_ce);
-
- memcpy(&php_phongo_handler_regex, phongo_get_std_object_handlers(), sizeof(zend_object_handlers));
- php_phongo_handler_regex.clone_obj = php_phongo_regex_clone_object;
- php_phongo_handler_regex.compare_objects = php_phongo_regex_compare_objects;
- php_phongo_handler_regex.get_debug_info = php_phongo_regex_get_debug_info;
- php_phongo_handler_regex.get_properties = php_phongo_regex_get_properties;
- php_phongo_handler_regex.free_obj = php_phongo_regex_free_object;
- php_phongo_handler_regex.offset = XtOffsetOf(php_phongo_regex_t, std);
-} /* }}} */
-
-/*
- * 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.8.1/src/BSON/Symbol.c b/mongodb-1.8.1/src/BSON/Symbol.c
deleted file mode 100644
index d3f4a8a6..00000000
--- a/mongodb-1.8.1/src/BSON/Symbol.c
+++ /dev/null
@@ -1,300 +0,0 @@
-/*
- * 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.
- */
-
-#include <php.h>
-#include <Zend/zend_interfaces.h>
-#include <ext/standard/php_var.h>
-#include <zend_smart_str.h>
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "phongo_compat.h"
-#include "php_phongo.h"
-#include "php_bson.h"
-
-zend_class_entry* php_phongo_symbol_ce;
-
-/* Initialize the object and return whether it was successful. An exception will
- * be thrown on error. */
-static bool php_phongo_symbol_init(php_phongo_symbol_t* intern, const char* symbol, size_t symbol_len) /* {{{ */
-{
- if (strlen(symbol) != (size_t) symbol_len) {
- phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Symbol cannot contain null bytes");
- return false;
- }
-
- intern->symbol = estrndup(symbol, symbol_len);
- intern->symbol_len = symbol_len;
-
- 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_symbol_init_from_hash(php_phongo_symbol_t* intern, HashTable* props) /* {{{ */
-{
- zval* symbol;
-
- if ((symbol = zend_hash_str_find(props, "symbol", sizeof("symbol") - 1)) && Z_TYPE_P(symbol) == IS_STRING) {
- return php_phongo_symbol_init(intern, Z_STRVAL_P(symbol), Z_STRLEN_P(symbol));
- }
-
- phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "%s initialization requires \"symbol\" string field", ZSTR_VAL(php_phongo_symbol_ce->name));
- return false;
-} /* }}} */
-
-/* {{{ proto string MongoDB\BSON\Symbol::__toString()
- Return the Symbol's symbol string. */
-static PHP_METHOD(Symbol, __toString)
-{
- php_phongo_symbol_t* intern;
-
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
-
- intern = Z_SYMBOL_OBJ_P(getThis());
-
- RETURN_STRINGL(intern->symbol, intern->symbol_len);
-} /* }}} */
-
-/* {{{ proto array MongoDB\BSON\Symbol::jsonSerialize()
-*/
-static PHP_METHOD(Symbol, jsonSerialize)
-{
- php_phongo_symbol_t* intern;
-
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
-
- intern = Z_SYMBOL_OBJ_P(getThis());
-
- array_init_size(return_value, 1);
- ADD_ASSOC_STRINGL(return_value, "$symbol", intern->symbol, intern->symbol_len);
-} /* }}} */
-
-/* {{{ proto string MongoDB\BSON\Symbol::serialize()
-*/
-static PHP_METHOD(Symbol, serialize)
-{
- php_phongo_symbol_t* intern;
- zval retval;
- php_serialize_data_t var_hash;
- smart_str buf = { 0 };
-
- intern = Z_SYMBOL_OBJ_P(getThis());
-
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
-
- array_init_size(&retval, 1);
- ADD_ASSOC_STRINGL(&retval, "symbol", intern->symbol, intern->symbol_len);
-
- PHP_VAR_SERIALIZE_INIT(var_hash);
- php_var_serialize(&buf, &retval, &var_hash);
- smart_str_0(&buf);
- PHP_VAR_SERIALIZE_DESTROY(var_hash);
-
- PHONGO_RETVAL_SMART_STR(buf);
-
- smart_str_free(&buf);
- zval_ptr_dtor(&retval);
-} /* }}} */
-
-/* {{{ proto void MongoDB\BSON\Symbol::unserialize(string $serialized)
-*/
-static PHP_METHOD(Symbol, unserialize)
-{
- php_phongo_symbol_t* intern;
- zend_error_handling error_handling;
- char* serialized;
- size_t serialized_len;
- zval props;
- php_unserialize_data_t var_hash;
-
- intern = Z_SYMBOL_OBJ_P(getThis());
-
- zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
-
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &serialized, &serialized_len) == FAILURE) {
- zend_restore_error_handling(&error_handling);
- return;
- }
- zend_restore_error_handling(&error_handling);
-
- PHP_VAR_UNSERIALIZE_INIT(var_hash);
- if (!php_var_unserialize(&props, (const unsigned char**) &serialized, (unsigned char*) serialized + serialized_len, &var_hash)) {
- zval_ptr_dtor(&props);
- phongo_throw_exception(PHONGO_ERROR_UNEXPECTED_VALUE, "%s unserialization failed", ZSTR_VAL(php_phongo_symbol_ce->name));
-
- PHP_VAR_UNSERIALIZE_DESTROY(var_hash);
- return;
- }
- PHP_VAR_UNSERIALIZE_DESTROY(var_hash);
-
- php_phongo_symbol_init_from_hash(intern, HASH_OF(&props));
- zval_ptr_dtor(&props);
-} /* }}} */
-
-/* {{{ MongoDB\BSON\Symbol function entries */
-ZEND_BEGIN_ARG_INFO_EX(ai_Symbol_unserialize, 0, 0, 1)
- ZEND_ARG_INFO(0, serialized)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(ai_Symbol_void, 0, 0, 0)
-ZEND_END_ARG_INFO()
-
-static zend_function_entry php_phongo_symbol_me[] = {
- /* clang-format off */
- /* __set_state intentionally missing */
- PHP_ME(Symbol, __toString, ai_Symbol_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
- PHP_ME(Symbol, jsonSerialize, ai_Symbol_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
- PHP_ME(Symbol, serialize, ai_Symbol_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
- PHP_ME(Symbol, unserialize, ai_Symbol_unserialize, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
- ZEND_NAMED_ME(__construct, PHP_FN(MongoDB_disabled___construct), ai_Symbol_void, ZEND_ACC_PRIVATE | ZEND_ACC_FINAL)
- PHP_FE_END
- /* clang-format on */
-};
-/* }}} */
-
-/* {{{ MongoDB\BSON\Symbol object handlers */
-static zend_object_handlers php_phongo_handler_symbol;
-
-static void php_phongo_symbol_free_object(zend_object* object) /* {{{ */
-{
- php_phongo_symbol_t* intern = Z_OBJ_SYMBOL(object);
-
- zend_object_std_dtor(&intern->std);
-
- if (intern->symbol) {
- efree(intern->symbol);
- }
-
- if (intern->properties) {
- zend_hash_destroy(intern->properties);
- FREE_HASHTABLE(intern->properties);
- }
-} /* }}} */
-
-zend_object* php_phongo_symbol_create_object(zend_class_entry* class_type) /* {{{ */
-{
- php_phongo_symbol_t* intern = NULL;
-
- intern = PHONGO_ALLOC_OBJECT_T(php_phongo_symbol_t, class_type);
- zend_object_std_init(&intern->std, class_type);
- object_properties_init(&intern->std, class_type);
-
- intern->std.handlers = &php_phongo_handler_symbol;
-
- return &intern->std;
-} /* }}} */
-
-static zend_object* php_phongo_symbol_clone_object(zval* object) /* {{{ */
-{
- php_phongo_symbol_t* intern;
- php_phongo_symbol_t* new_intern;
- zend_object* new_object;
-
- intern = Z_SYMBOL_OBJ_P(object);
- new_object = php_phongo_symbol_create_object(Z_OBJCE_P(object));
-
- new_intern = Z_OBJ_SYMBOL(new_object);
- zend_objects_clone_members(&new_intern->std, &intern->std);
-
- php_phongo_symbol_init(new_intern, intern->symbol, intern->symbol_len);
-
- return new_object;
-} /* }}} */
-
-static int php_phongo_symbol_compare_objects(zval* o1, zval* o2) /* {{{ */
-{
- php_phongo_symbol_t *intern1, *intern2;
-
- intern1 = Z_SYMBOL_OBJ_P(o1);
- intern2 = Z_SYMBOL_OBJ_P(o2);
-
- return strcmp(intern1->symbol, intern2->symbol);
-} /* }}} */
-
-HashTable* php_phongo_symbol_get_properties_hash(zval* object, bool is_debug) /* {{{ */
-{
- php_phongo_symbol_t* intern;
- HashTable* props;
-
- intern = Z_SYMBOL_OBJ_P(object);
-
- PHONGO_GET_PROPERTY_HASH_INIT_PROPS(is_debug, intern, props, 2);
-
- if (!intern->symbol) {
- return props;
- }
-
- {
- zval symbol;
-
- ZVAL_STRING(&symbol, intern->symbol);
- zend_hash_str_update(props, "symbol", sizeof("symbol") - 1, &symbol);
- }
-
- return props;
-} /* }}} */
-
-static HashTable* php_phongo_symbol_get_debug_info(zval* object, int* is_temp) /* {{{ */
-{
- *is_temp = 1;
- return php_phongo_symbol_get_properties_hash(object, true);
-} /* }}} */
-
-static HashTable* php_phongo_symbol_get_properties(zval* object) /* {{{ */
-{
- return php_phongo_symbol_get_properties_hash(object, false);
-} /* }}} */
-/* }}} */
-
-void php_phongo_symbol_init_ce(INIT_FUNC_ARGS) /* {{{ */
-{
- zend_class_entry ce;
-
- INIT_NS_CLASS_ENTRY(ce, "MongoDB\\BSON", "Symbol", php_phongo_symbol_me);
- php_phongo_symbol_ce = zend_register_internal_class(&ce);
- php_phongo_symbol_ce->create_object = php_phongo_symbol_create_object;
- PHONGO_CE_FINAL(php_phongo_symbol_ce);
-
- zend_class_implements(php_phongo_symbol_ce, 1, php_phongo_json_serializable_ce);
- zend_class_implements(php_phongo_symbol_ce, 1, php_phongo_type_ce);
- zend_class_implements(php_phongo_symbol_ce, 1, zend_ce_serializable);
-
- memcpy(&php_phongo_handler_symbol, phongo_get_std_object_handlers(), sizeof(zend_object_handlers));
- php_phongo_handler_symbol.clone_obj = php_phongo_symbol_clone_object;
- php_phongo_handler_symbol.compare_objects = php_phongo_symbol_compare_objects;
- php_phongo_handler_symbol.get_debug_info = php_phongo_symbol_get_debug_info;
- php_phongo_handler_symbol.get_properties = php_phongo_symbol_get_properties;
- php_phongo_handler_symbol.free_obj = php_phongo_symbol_free_object;
- php_phongo_handler_symbol.offset = XtOffsetOf(php_phongo_symbol_t, std);
-} /* }}} */
-
-/*
- * 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.8.1/src/BSON/Timestamp.c b/mongodb-1.8.1/src/BSON/Timestamp.c
deleted file mode 100644
index 3e77db90..00000000
--- a/mongodb-1.8.1/src/BSON/Timestamp.c
+++ /dev/null
@@ -1,473 +0,0 @@
-/*
- * 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.
- */
-
-#include <php.h>
-#include <Zend/zend_interfaces.h>
-#include <ext/standard/php_var.h>
-#include <zend_smart_str.h>
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "phongo_compat.h"
-#include "php_phongo.h"
-
-zend_class_entry* php_phongo_timestamp_ce;
-
-/* 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) /* {{{ */
-{
- if (increment < 0 || increment > UINT32_MAX) {
- phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Expected increment to be an unsigned 32-bit integer, %" PRId64 " given", increment);
- return false;
- }
-
- if (timestamp < 0 || timestamp > UINT32_MAX) {
- phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Expected timestamp to be an unsigned 32-bit integer, %" PRId64 " 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, size_t s_increment_len, const char* s_timestamp, size_t s_timestamp_len) /* {{{ */
-{
- int64_t increment, timestamp;
-
- if (!php_phongo_parse_int64(&increment, s_increment, s_increment_len)) {
- phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Error parsing \"%s\" as 64-bit integer increment for %s initialization", s_increment, ZSTR_VAL(php_phongo_timestamp_ce->name));
- return false;
- }
-
- if (!php_phongo_parse_int64(&timestamp, s_timestamp, s_timestamp_len)) {
- phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "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);
-} /* }}} */
-
-/* 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) /* {{{ */
-{
- 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));
- }
- 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));
- }
-
- phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "%s initialization requires \"increment\" and \"timestamp\" integer or numeric string fields", ZSTR_VAL(php_phongo_timestamp_ce->name));
- return false;
-} /* }}} */
-
-/* {{{ proto void MongoDB\BSON\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. */
-static 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);
- intern = Z_TIMESTAMP_OBJ_P(getThis());
-
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "zz", &increment, &timestamp) == FAILURE) {
- zend_restore_error_handling(&error_handling);
- return;
- }
- zend_restore_error_handling(&error_handling);
-
- 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));
- 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, "Expected increment to be an unsigned 32-bit integer or string, %s given", PHONGO_ZVAL_CLASS_OR_TYPE_NAME_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, "Expected timestamp to be an unsigned 32-bit integer or string, %s given", PHONGO_ZVAL_CLASS_OR_TYPE_NAME_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));
-} /* }}} */
-
-/* {{{ proto integer MongoDB\BSON\Timestamp::getIncrement()
-*/
-static PHP_METHOD(Timestamp, getIncrement)
-{
- php_phongo_timestamp_t* intern;
-
- intern = Z_TIMESTAMP_OBJ_P(getThis());
-
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
-
- RETVAL_LONG(intern->increment);
-} /* }}} */
-
-/* {{{ proto integer MongoDB\BSON\Timestamp::getTimestamp()
-*/
-static PHP_METHOD(Timestamp, getTimestamp)
-{
- php_phongo_timestamp_t* intern;
-
- intern = Z_TIMESTAMP_OBJ_P(getThis());
-
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
-
- RETVAL_LONG(intern->timestamp);
-} /* }}} */
-
-/* {{{ proto void MongoDB\BSON\Timestamp::__set_state(array $properties)
-*/
-static PHP_METHOD(Timestamp, __set_state)
-{
- php_phongo_timestamp_t* intern;
- HashTable* props;
- zval* array;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "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);
-} /* }}} */
-
-/* {{{ proto string MongoDB\BSON\Timestamp::__toString()
- Returns a string in the form: [increment:timestamp] */
-static 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);
- RETVAL_STRINGL(retval, retval_len);
- efree(retval);
-} /* }}} */
-
-/* {{{ proto array MongoDB\BSON\Timestamp::jsonSerialize()
-*/
-static 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);
-
- {
- 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);
- }
-} /* }}} */
-
-/* {{{ proto string MongoDB\BSON\Timestamp::serialize()
-*/
-static PHP_METHOD(Timestamp, serialize)
-{
- php_phongo_timestamp_t* intern;
- zval retval;
- 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);
-
- 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);
-
- PHP_VAR_SERIALIZE_INIT(var_hash);
- php_var_serialize(&buf, &retval, &var_hash);
- smart_str_0(&buf);
- PHP_VAR_SERIALIZE_DESTROY(var_hash);
-
- PHONGO_RETVAL_SMART_STR(buf);
-
- smart_str_free(&buf);
- zval_ptr_dtor(&retval);
-} /* }}} */
-
-/* {{{ proto void MongoDB\BSON\Timestamp::unserialize(string $serialized)
-*/
-static PHP_METHOD(Timestamp, unserialize)
-{
- php_phongo_timestamp_t* intern;
- zend_error_handling error_handling;
- char* serialized;
- size_t serialized_len;
- zval props;
- 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);
-
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &serialized, &serialized_len) == FAILURE) {
- zend_restore_error_handling(&error_handling);
- return;
- }
- zend_restore_error_handling(&error_handling);
-
- PHP_VAR_UNSERIALIZE_INIT(var_hash);
- if (!php_var_unserialize(&props, (const unsigned char**) &serialized, (unsigned char*) serialized + serialized_len, &var_hash)) {
- zval_ptr_dtor(&props);
- phongo_throw_exception(PHONGO_ERROR_UNEXPECTED_VALUE, "%s unserialization failed", ZSTR_VAL(php_phongo_timestamp_ce->name));
-
- PHP_VAR_UNSERIALIZE_DESTROY(var_hash);
- return;
- }
- PHP_VAR_UNSERIALIZE_DESTROY(var_hash);
-
- php_phongo_timestamp_init_from_hash(intern, HASH_OF(&props));
- zval_ptr_dtor(&props);
-} /* }}} */
-
-/* {{{ MongoDB\BSON\Timestamp function entries */
-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[] = {
- /* clang-format off */
- 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_ME(Timestamp, getIncrement, ai_Timestamp_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
- PHP_ME(Timestamp, getTimestamp, ai_Timestamp_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
- PHP_FE_END
- /* clang-format on */
-};
-/* }}} */
-
-/* {{{ MongoDB\BSON\Timestamp object handlers */
-static zend_object_handlers php_phongo_handler_timestamp;
-
-static void php_phongo_timestamp_free_object(zend_object* object) /* {{{ */
-{
- php_phongo_timestamp_t* intern = Z_OBJ_TIMESTAMP(object);
-
- zend_object_std_dtor(&intern->std);
-
- if (intern->properties) {
- zend_hash_destroy(intern->properties);
- FREE_HASHTABLE(intern->properties);
- }
-} /* }}} */
-
-static zend_object* php_phongo_timestamp_create_object(zend_class_entry* class_type) /* {{{ */
-{
- 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);
- object_properties_init(&intern->std, class_type);
-
- intern->std.handlers = &php_phongo_handler_timestamp;
-
- return &intern->std;
-} /* }}} */
-
-static zend_object* php_phongo_timestamp_clone_object(zval* object) /* {{{ */
-{
- php_phongo_timestamp_t* intern;
- php_phongo_timestamp_t* new_intern;
- zend_object* new_object;
-
- intern = Z_TIMESTAMP_OBJ_P(object);
- new_object = php_phongo_timestamp_create_object(Z_OBJCE_P(object));
-
- new_intern = Z_OBJ_TIMESTAMP(new_object);
- zend_objects_clone_members(&new_intern->std, &intern->std);
-
- php_phongo_timestamp_init(new_intern, intern->increment, intern->timestamp);
-
- return new_object;
-} /* }}} */
-
-static int php_phongo_timestamp_compare_objects(zval* o1, zval* o2) /* {{{ */
-{
- 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_properties_hash(zval* object, bool is_debug) /* {{{ */
-{
- 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);
-
- PHONGO_GET_PROPERTY_HASH_INIT_PROPS(is_debug, intern, props, 2);
-
- 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);
-
- {
- 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);
- }
-
- return props;
-} /* }}} */
-
-static HashTable* php_phongo_timestamp_get_debug_info(zval* object, int* is_temp) /* {{{ */
-{
- *is_temp = 1;
- return php_phongo_timestamp_get_properties_hash(object, true);
-} /* }}} */
-
-static HashTable* php_phongo_timestamp_get_properties(zval* object) /* {{{ */
-{
- return php_phongo_timestamp_get_properties_hash(object, false);
-} /* }}} */
-/* }}} */
-
-void php_phongo_timestamp_init_ce(INIT_FUNC_ARGS) /* {{{ */
-{
- zend_class_entry ce;
-
- INIT_NS_CLASS_ENTRY(ce, "MongoDB\\BSON", "Timestamp", php_phongo_timestamp_me);
- php_phongo_timestamp_ce = zend_register_internal_class(&ce);
- 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, 1, php_phongo_timestamp_interface_ce);
- zend_class_implements(php_phongo_timestamp_ce, 1, php_phongo_json_serializable_ce);
- zend_class_implements(php_phongo_timestamp_ce, 1, php_phongo_type_ce);
- zend_class_implements(php_phongo_timestamp_ce, 1, zend_ce_serializable);
-
- memcpy(&php_phongo_handler_timestamp, phongo_get_std_object_handlers(), sizeof(zend_object_handlers));
- php_phongo_handler_timestamp.clone_obj = php_phongo_timestamp_clone_object;
- php_phongo_handler_timestamp.compare_objects = php_phongo_timestamp_compare_objects;
- php_phongo_handler_timestamp.get_debug_info = php_phongo_timestamp_get_debug_info;
- php_phongo_handler_timestamp.get_properties = php_phongo_timestamp_get_properties;
- php_phongo_handler_timestamp.free_obj = php_phongo_timestamp_free_object;
- php_phongo_handler_timestamp.offset = XtOffsetOf(php_phongo_timestamp_t, std);
-} /* }}} */
-
-/*
- * 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.8.1/src/BSON/UTCDateTime.c b/mongodb-1.8.1/src/BSON/UTCDateTime.c
deleted file mode 100644
index 178ff0c7..00000000
--- a/mongodb-1.8.1/src/BSON/UTCDateTime.c
+++ /dev/null
@@ -1,480 +0,0 @@
-/*
- * 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.
- */
-
-#include <math.h>
-
-#include <php.h>
-#include <Zend/zend_interfaces.h>
-#include <ext/date/php_date.h>
-#include <ext/standard/php_var.h>
-#include <zend_smart_str.h>
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#ifdef PHP_WIN32
-#include "win32/time.h"
-#endif
-#include "phongo_compat.h"
-#include "php_phongo.h"
-
-zend_class_entry* php_phongo_utcdatetime_ce;
-
-/* 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, size_t s_milliseconds_len TSRMLS_DC) /* {{{ */
-{
- int64_t milliseconds;
-
- if (!php_phongo_parse_int64(&milliseconds, 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) /* {{{ */
-{
- 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);
- }
-
- 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;
-#if PHP_VERSION_ID >= 70200
- usec = (int64_t) floor(datetime_obj->time->us);
-#else
- usec = (int64_t) floor(datetime_obj->time->f * 1000000 + 0.5);
-#endif
-
- intern->milliseconds = (sec * 1000) + (usec / 1000);
- intern->initialized = true;
-
- return true;
-} /* }}} */
-
-/* {{{ proto void MongoDB\BSON\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. */
-static 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", PHONGO_ZVAL_CLASS_OR_TYPE_NAME_P(milliseconds));
- return;
- }
-
- php_phongo_utcdatetime_init_from_string(intern, Z_STRVAL_P(milliseconds), Z_STRLEN_P(milliseconds) TSRMLS_CC);
-} /* }}} */
-
-/* {{{ proto void MongoDB\BSON\UTCDateTime::__set_state(array $properties)
-*/
-static 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 MongoDB\BSON\UTCDateTime::__toString()
- Returns the UTCDateTime's milliseconds as a string */
-static PHP_METHOD(UTCDateTime, __toString)
-{
- php_phongo_utcdatetime_t* intern;
-
- intern = Z_UTCDATETIME_OBJ_P(getThis());
-
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
-
- ZVAL_INT64_STRING(return_value, intern->milliseconds);
-} /* }}} */
-
-/* {{{ proto DateTime MongoDB\BSON\UTCDateTime::toDateTime()
- Returns a DateTime object representing this UTCDateTime */
-static 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);
-
-#if PHP_VERSION_ID >= 70200
- datetime_obj->time->us = (intern->milliseconds % 1000) * 1000;
-#else
- datetime_obj->time->f = (double) (intern->milliseconds % 1000) / 1000;
-#endif
-}
-/* }}} */
-
-/* {{{ proto array MongoDB\BSON\UTCDateTime::jsonSerialize()
-*/
-static PHP_METHOD(UTCDateTime, jsonSerialize)
-{
- php_phongo_utcdatetime_t* intern;
-
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
-
- intern = Z_UTCDATETIME_OBJ_P(getThis());
-
- array_init_size(return_value, 1);
-
- {
- zval udt;
-
- array_init_size(&udt, 1);
- ADD_ASSOC_INT64_AS_STRING(&udt, "$numberLong", intern->milliseconds);
- ADD_ASSOC_ZVAL_EX(return_value, "$date", &udt);
- }
-} /* }}} */
-
-/* {{{ proto string MongoDB\BSON\UTCDateTime::serialize()
-*/
-static PHP_METHOD(UTCDateTime, serialize)
-{
- php_phongo_utcdatetime_t* intern;
- zval retval;
- php_serialize_data_t var_hash;
- smart_str buf = { 0 };
-
- intern = Z_UTCDATETIME_OBJ_P(getThis());
-
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
-
- array_init_size(&retval, 1);
- ADD_ASSOC_INT64_AS_STRING(&retval, "milliseconds", intern->milliseconds);
-
- 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 void MongoDB\BSON\UTCDateTime::unserialize(string $serialized)
-*/
-static PHP_METHOD(UTCDateTime, unserialize)
-{
- php_phongo_utcdatetime_t* intern;
- zend_error_handling error_handling;
- char* serialized;
- size_t serialized_len;
- zval props;
- 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);
-
- 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);
-
- php_phongo_utcdatetime_init_from_hash(intern, HASH_OF(&props) TSRMLS_CC);
- zval_ptr_dtor(&props);
-} /* }}} */
-
-/* {{{ MongoDB\BSON\UTCDateTime function entries */
-ZEND_BEGIN_ARG_INFO_EX(ai_UTCDateTime___construct, 0, 0, 0)
- 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[] = {
- /* clang-format off */
- 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
- /* clang-format on */
-};
-/* }}} */
-
-/* {{{ MongoDB\BSON\UTCDateTime object handlers */
-static zend_object_handlers php_phongo_handler_utcdatetime;
-
-static void php_phongo_utcdatetime_free_object(zend_object* object TSRMLS_DC) /* {{{ */
-{
- php_phongo_utcdatetime_t* intern = Z_OBJ_UTCDATETIME(object);
-
- zend_object_std_dtor(&intern->std TSRMLS_CC);
-
- if (intern->properties) {
- zend_hash_destroy(intern->properties);
- FREE_HASHTABLE(intern->properties);
- }
-} /* }}} */
-
-static zend_object* 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);
-
- intern->std.handlers = &php_phongo_handler_utcdatetime;
-
- return &intern->std;
-} /* }}} */
-
-static zend_object* php_phongo_utcdatetime_clone_object(zval* object TSRMLS_DC) /* {{{ */
-{
- php_phongo_utcdatetime_t* intern;
- php_phongo_utcdatetime_t* new_intern;
- zend_object* new_object;
-
- intern = Z_UTCDATETIME_OBJ_P(object);
- new_object = php_phongo_utcdatetime_create_object(Z_OBJCE_P(object) TSRMLS_CC);
-
- new_intern = Z_OBJ_UTCDATETIME(new_object);
- zend_objects_clone_members(&new_intern->std, &intern->std TSRMLS_CC);
-
- php_phongo_utcdatetime_init(new_intern, intern->milliseconds);
-
- return new_object;
-} /* }}} */
-
-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_properties_hash(zval* object, bool is_debug TSRMLS_DC) /* {{{ */
-{
- php_phongo_utcdatetime_t* intern;
- HashTable* props;
-
- intern = Z_UTCDATETIME_OBJ_P(object);
-
- PHONGO_GET_PROPERTY_HASH_INIT_PROPS(is_debug, intern, props, 1);
-
- if (!intern->initialized) {
- return props;
- }
-
- {
- zval milliseconds;
-
- ZVAL_INT64_STRING(&milliseconds, intern->milliseconds);
- zend_hash_str_update(props, "milliseconds", sizeof("milliseconds") - 1, &milliseconds);
- }
-
- return props;
-} /* }}} */
-
-static HashTable* php_phongo_utcdatetime_get_debug_info(zval* object, int* is_temp TSRMLS_DC) /* {{{ */
-{
- *is_temp = 1;
- return php_phongo_utcdatetime_get_properties_hash(object, true TSRMLS_CC);
-} /* }}} */
-
-static HashTable* php_phongo_utcdatetime_get_properties(zval* object TSRMLS_DC) /* {{{ */
-{
- return php_phongo_utcdatetime_get_properties_hash(object, false TSRMLS_CC);
-} /* }}} */
-/* }}} */
-
-void php_phongo_utcdatetime_init_ce(INIT_FUNC_ARGS) /* {{{ */
-{
- zend_class_entry ce;
-
- 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_utcdatetime_interface_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.clone_obj = php_phongo_utcdatetime_clone_object;
- php_phongo_handler_utcdatetime.compare_objects = php_phongo_utcdatetime_compare_objects;
- php_phongo_handler_utcdatetime.get_debug_info = php_phongo_utcdatetime_get_debug_info;
- php_phongo_handler_utcdatetime.get_properties = php_phongo_utcdatetime_get_properties;
- php_phongo_handler_utcdatetime.free_obj = php_phongo_utcdatetime_free_object;
- php_phongo_handler_utcdatetime.offset = XtOffsetOf(php_phongo_utcdatetime_t, std);
-} /* }}} */
-
-/*
- * 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.8.1/src/BSON/Undefined.c b/mongodb-1.8.1/src/BSON/Undefined.c
deleted file mode 100644
index 7f76e6b9..00000000
--- a/mongodb-1.8.1/src/BSON/Undefined.c
+++ /dev/null
@@ -1,146 +0,0 @@
-/*
- * 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.
- */
-
-#include <php.h>
-#include <Zend/zend_interfaces.h>
-#include <ext/standard/php_var.h>
-#include <zend_smart_str.h>
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "phongo_compat.h"
-#include "php_phongo.h"
-
-zend_class_entry* php_phongo_undefined_ce;
-
-/* {{{ proto string MongoDB\BSON\Undefined::__toString()
- Return the empty string. */
-static PHP_METHOD(Undefined, __toString)
-{
- RETURN_STRINGL("", 0);
-} /* }}} */
-
-/* {{{ proto array MongoDB\BSON\Undefined::jsonSerialize()
-*/
-static PHP_METHOD(Undefined, jsonSerialize)
-{
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
-
- array_init_size(return_value, 1);
- ADD_ASSOC_BOOL_EX(return_value, "$undefined", 1);
-} /* }}} */
-
-/* {{{ proto string MongoDB\BSON\Undefined::serialize()
-*/
-static PHP_METHOD(Undefined, serialize)
-{
- RETURN_STRING("");
-} /* }}} */
-
-/* {{{ proto void MongoDB\BSON\Undefined::unserialize(string $serialized)
-*/
-static PHP_METHOD(Undefined, unserialize)
-{
- zend_error_handling error_handling;
- char* serialized;
- size_t serialized_len;
-
- zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
-
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &serialized, &serialized_len) == FAILURE) {
- zend_restore_error_handling(&error_handling);
- return;
- }
- zend_restore_error_handling(&error_handling);
-} /* }}} */
-
-/* {{{ MongoDB\BSON\Undefined function entries */
-ZEND_BEGIN_ARG_INFO_EX(ai_Undefined_unserialize, 0, 0, 1)
- ZEND_ARG_INFO(0, serialized)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(ai_Undefined_void, 0, 0, 0)
-ZEND_END_ARG_INFO()
-
-static zend_function_entry php_phongo_undefined_me[] = {
- /* clang-format off */
- /* __set_state intentionally missing */
- PHP_ME(Undefined, __toString, ai_Undefined_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
- PHP_ME(Undefined, jsonSerialize, ai_Undefined_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
- PHP_ME(Undefined, serialize, ai_Undefined_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
- PHP_ME(Undefined, unserialize, ai_Undefined_unserialize, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
- ZEND_NAMED_ME(__construct, PHP_FN(MongoDB_disabled___construct), ai_Undefined_void, ZEND_ACC_PRIVATE | ZEND_ACC_FINAL)
- PHP_FE_END
- /* clang-format on */
-};
-/* }}} */
-
-/* {{{ MongoDB\BSON\Undefined object handlers */
-static zend_object_handlers php_phongo_handler_undefined;
-
-static void php_phongo_undefined_free_object(zend_object* object) /* {{{ */
-{
- php_phongo_undefined_t* intern = Z_OBJ_UNDEFINED(object);
-
- zend_object_std_dtor(&intern->std);
-} /* }}} */
-
-static zend_object* php_phongo_undefined_create_object(zend_class_entry* class_type) /* {{{ */
-{
- php_phongo_undefined_t* intern = NULL;
-
- intern = PHONGO_ALLOC_OBJECT_T(php_phongo_undefined_t, class_type);
- zend_object_std_init(&intern->std, class_type);
- object_properties_init(&intern->std, class_type);
-
- intern->std.handlers = &php_phongo_handler_undefined;
-
- return &intern->std;
-} /* }}} */
-/* }}} */
-
-void php_phongo_undefined_init_ce(INIT_FUNC_ARGS) /* {{{ */
-{
- zend_class_entry ce;
-
- INIT_NS_CLASS_ENTRY(ce, "MongoDB\\BSON", "Undefined", php_phongo_undefined_me);
- php_phongo_undefined_ce = zend_register_internal_class(&ce);
- php_phongo_undefined_ce->create_object = php_phongo_undefined_create_object;
- PHONGO_CE_FINAL(php_phongo_undefined_ce);
-
- zend_class_implements(php_phongo_undefined_ce, 1, php_phongo_json_serializable_ce);
- zend_class_implements(php_phongo_undefined_ce, 1, php_phongo_type_ce);
- zend_class_implements(php_phongo_undefined_ce, 1, zend_ce_serializable);
-
- memcpy(&php_phongo_handler_undefined, phongo_get_std_object_handlers(), sizeof(zend_object_handlers));
- /* Re-assign default handler previously removed in php_phongo.c */
- php_phongo_handler_undefined.clone_obj = zend_objects_clone_obj;
- php_phongo_handler_undefined.free_obj = php_phongo_undefined_free_object;
- php_phongo_handler_undefined.offset = XtOffsetOf(php_phongo_undefined_t, std);
-} /* }}} */
-
-/*
- * 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.8.1/src/BSON/functions.c b/mongodb-1.8.1/src/BSON/functions.c
deleted file mode 100644
index 02ae6ecd..00000000
--- a/mongodb-1.8.1/src/BSON/functions.c
+++ /dev/null
@@ -1,177 +0,0 @@
-/*
- * 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.
- */
-
-#include <php.h>
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "phongo_compat.h"
-#include "php_phongo.h"
-#include "php_bson.h"
-
-typedef enum {
- PHONGO_JSON_MODE_LEGACY,
- PHONGO_JSON_MODE_CANONICAL,
- PHONGO_JSON_MODE_RELAXED,
-} php_phongo_json_mode_t;
-
-/* {{{ proto string MongoDB\BSON\fromPHP(array|object $value)
- Returns the BSON representation of a PHP value */
-PHP_FUNCTION(MongoDB_BSON_fromPHP)
-{
- zval* data;
- bson_t* bson;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "A", &data) == FAILURE) {
- return;
- }
-
- bson = bson_new();
- php_phongo_zval_to_bson(data, PHONGO_BSON_NONE, bson, NULL);
-
- RETVAL_STRINGL((const char*) bson_get_data(bson), bson->len);
- bson_destroy(bson);
-} /* }}} */
-
-/* {{{ proto array|object MongoDB\BSON\toPHP(string $bson [, array $typemap = array()])
- Returns the PHP representation of a BSON value, optionally converting it into a custom class */
-PHP_FUNCTION(MongoDB_BSON_toPHP)
-{
- char* data;
- size_t data_len;
- zval* typemap = NULL;
- php_phongo_bson_state state;
-
- PHONGO_BSON_INIT_STATE(state);
-
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|a!", &data, &data_len, &typemap) == FAILURE) {
- return;
- }
-
- if (!php_phongo_bson_typemap_to_state(typemap, &state.map)) {
- return;
- }
-
- if (!php_phongo_bson_to_zval_ex((const unsigned char*) data, data_len, &state)) {
- zval_ptr_dtor(&state.zchild);
- php_phongo_bson_typemap_dtor(&state.map);
- RETURN_NULL();
- }
-
- php_phongo_bson_typemap_dtor(&state.map);
-
- RETURN_ZVAL(&state.zchild, 0, 1);
-} /* }}} */
-
-/* {{{ proto string MongoDB\BSON\fromJSON(string $json)
- Returns the BSON representation of a JSON value */
-PHP_FUNCTION(MongoDB_BSON_fromJSON)
-{
- char* json;
- size_t json_len;
- bson_t bson = BSON_INITIALIZER;
- bson_error_t error = { 0 };
-
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &json, &json_len) == FAILURE) {
- return;
- }
-
- if (bson_init_from_json(&bson, (const char*) json, json_len, &error)) {
- RETVAL_STRINGL((const char*) bson_get_data(&bson), bson.len);
- bson_destroy(&bson);
- } else {
- phongo_throw_exception(PHONGO_ERROR_UNEXPECTED_VALUE, "%s", error.domain == BSON_ERROR_JSON ? error.message : "Error parsing JSON");
- }
-} /* }}} */
-
-static void phongo_bson_to_json(INTERNAL_FUNCTION_PARAMETERS, php_phongo_json_mode_t mode)
-{
- char* data;
- size_t data_len;
- const bson_t* bson;
- bool eof = false;
- bson_reader_t* reader;
- char* json = NULL;
- size_t json_len;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &data, &data_len) == FAILURE) {
- return;
- }
-
- reader = bson_reader_new_from_data((const unsigned char*) data, data_len);
- bson = bson_reader_read(reader, NULL);
-
- if (!bson) {
- phongo_throw_exception(PHONGO_ERROR_UNEXPECTED_VALUE, "Could not read document from BSON reader");
- bson_reader_destroy(reader);
- return;
- }
-
- if (mode == PHONGO_JSON_MODE_LEGACY) {
- json = bson_as_json(bson, &json_len);
- } else if (mode == PHONGO_JSON_MODE_CANONICAL) {
- json = bson_as_canonical_extended_json(bson, &json_len);
- } else if (mode == PHONGO_JSON_MODE_RELAXED) {
- json = bson_as_relaxed_extended_json(bson, &json_len);
- }
-
- if (!json) {
- phongo_throw_exception(PHONGO_ERROR_UNEXPECTED_VALUE, "Could not convert BSON document to a JSON string");
- bson_reader_destroy(reader);
- return;
- }
-
- RETVAL_STRINGL(json, json_len);
- bson_free(json);
-
- if (bson_reader_read(reader, &eof) || !eof) {
- phongo_throw_exception(PHONGO_ERROR_UNEXPECTED_VALUE, "Reading document did not exhaust input buffer");
- }
-
- bson_reader_destroy(reader);
-} /* }}} */
-
-/* {{{ proto string MongoDB\BSON\toJSON(string $bson)
- Returns the legacy extended JSON representation of a BSON value */
-PHP_FUNCTION(MongoDB_BSON_toJSON)
-{
- phongo_bson_to_json(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHONGO_JSON_MODE_LEGACY);
-} /* }}} */
-
-/* {{{ proto string MongoDB\BSON\toCanonicalExtendedJSON(string $bson)
- Returns the canonical extended JSON representation of a BSON value */
-PHP_FUNCTION(MongoDB_BSON_toCanonicalExtendedJSON)
-{
- phongo_bson_to_json(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHONGO_JSON_MODE_CANONICAL);
-} /* }}} */
-
-/* {{{ proto string MongoDB\BSON\toRelaxedExtendedJSON(string $bson)
- Returns the relaxed extended JSON representation of a BSON value */
-PHP_FUNCTION(MongoDB_BSON_toRelaxedExtendedJSON)
-{
- phongo_bson_to_json(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHONGO_JSON_MODE_RELAXED);
-} /* }}} */
-
-/*
- * 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.8.1/src/LIBMONGOC_VERSION_CURRENT b/mongodb-1.8.1/src/LIBMONGOC_VERSION_CURRENT
deleted file mode 100644
index 092afa15..00000000
--- a/mongodb-1.8.1/src/LIBMONGOC_VERSION_CURRENT
+++ /dev/null
@@ -1 +0,0 @@
-1.17.0
diff --git a/mongodb-1.8.1/src/MongoDB/BulkWrite.c b/mongodb-1.8.1/src/MongoDB/BulkWrite.c
deleted file mode 100644
index 89e3e230..00000000
--- a/mongodb-1.8.1/src/MongoDB/BulkWrite.c
+++ /dev/null
@@ -1,655 +0,0 @@
-/*
- * 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.
- */
-
-#include <php.h>
-#include <Zend/zend_interfaces.h>
-#include <ext/spl/spl_iterators.h>
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php_array_api.h"
-#include "phongo_compat.h"
-#include "php_phongo.h"
-#include "php_bson.h"
-
-#define PHONGO_BULKWRITE_BYPASS_UNSET -1
-
-zend_class_entry* php_phongo_bulkwrite_ce;
-
-/* Extracts the "_id" field of a BSON document into a return value. */
-static void php_phongo_bulkwrite_extract_id(bson_t* doc, zval** return_value) /* {{{ */
-{
- zval* id = NULL;
- php_phongo_bson_state state;
-
- PHONGO_BSON_INIT_STATE(state);
- state.map.root_type = PHONGO_TYPEMAP_NATIVE_ARRAY;
-
- if (!php_phongo_bson_to_zval_ex(bson_get_data(doc), doc->len, &state)) {
- goto cleanup;
- }
-
- id = php_array_fetchc(&state.zchild, "_id");
-
- if (id) {
- ZVAL_ZVAL(*return_value, id, 1, 0);
- }
-
-cleanup:
- zval_ptr_dtor(&state.zchild);
-} /* }}} */
-
-/* Returns whether any top-level field names in the document contain a "$". */
-static inline bool php_phongo_bulkwrite_update_has_operators(bson_t* bupdate) /* {{{ */
-{
- bson_iter_t iter;
-
- if (bson_iter_init(&iter, bupdate)) {
- while (bson_iter_next(&iter)) {
- if (strchr(bson_iter_key(&iter), '$')) {
- return true;
- }
- }
- }
-
- return false;
-} /* }}} */
-
-/* Returns whether the update document is considered an aggregation pipeline */
-static inline bool php_phongo_bulkwrite_update_is_pipeline(bson_t* bupdate) /* {{{ */
-{
- bson_iter_t iter;
- bson_iter_t child;
- const char* key;
- int i = 0;
- char* i_str;
-
- if (!bson_iter_init(&iter, bupdate)) {
- return false;
- }
-
- while (bson_iter_next(&iter)) {
- key = bson_iter_key(&iter);
- i_str = bson_strdup_printf("%d", i++);
-
- if (strcmp(key, i_str)) {
- bson_free(i_str);
- return false;
- }
-
- bson_free(i_str);
-
- if (BSON_ITER_HOLDS_DOCUMENT(&iter)) {
- if (!bson_iter_recurse(&iter, &child)) {
- return false;
- }
- if (!bson_iter_next(&child)) {
- return false;
- }
- key = bson_iter_key(&child);
- if (key[0] != '$') {
- return false;
- }
- } else {
- return false;
- }
- }
-
- /* should return false when the document is empty */
- return i != 0;
-} /* }}} */
-
-/* Returns whether the BSON array's keys are a sequence of integer strings
- * starting with "0". BSON_APPEND_ARRAY considers it the caller's responsibility
- * to ensure that the array's keys are properly formatted. */
-static inline bool php_phongo_bulkwrite_bson_array_has_valid_keys(bson_t* array) /* {{{ */
-{
- bson_iter_t iter;
-
- if (bson_empty(array)) {
- return true;
- }
-
- if (bson_iter_init(&iter, array)) {
- char key[12];
- int count = 0;
-
- while (bson_iter_next(&iter)) {
- bson_snprintf(key, sizeof(key), "%d", count);
-
- if (0 != strcmp(key, bson_iter_key(&iter))) {
- return false;
- }
-
- count++;
- }
- }
-
- return true;
-} /* }}} */
-
-/* Appends an array field for the given opts document and key. Returns true on
- * success; otherwise, false is returned and an exception is thrown. */
-static bool php_phongo_bulkwrite_opts_append_array(bson_t* opts, const char* key, zval* zarr) /* {{{ */
-{
- zval* value = php_array_fetch(zarr, key);
- bson_t b = BSON_INITIALIZER;
-
- if (Z_TYPE_P(value) != IS_OBJECT && Z_TYPE_P(value) != IS_ARRAY) {
- phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Expected \"%s\" option to be array or object, %s given", key, zend_get_type_by_const(Z_TYPE_P(value)));
- return false;
- }
-
- php_phongo_zval_to_bson(value, PHONGO_BSON_NONE, &b, NULL);
-
- if (EG(exception)) {
- bson_destroy(&b);
- return false;
- }
-
- if (!php_phongo_bulkwrite_bson_array_has_valid_keys(&b)) {
- phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "\"%s\" option has invalid keys for a BSON array", key);
- bson_destroy(&b);
- return false;
- }
-
- if (!BSON_APPEND_ARRAY(opts, key, &b)) {
- phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Error appending \"%s\" option", key);
- bson_destroy(&b);
- return false;
- }
-
- bson_destroy(&b);
- return true;
-} /* }}} */
-
-/* Appends a document field for the given opts document and key. Returns true on
- * success; otherwise, false is returned and an exception is thrown. */
-static bool php_phongo_bulkwrite_opts_append_document(bson_t* opts, const char* key, zval* zarr) /* {{{ */
-{
- zval* value = php_array_fetch(zarr, key);
- bson_t b = BSON_INITIALIZER;
-
- if (Z_TYPE_P(value) != IS_OBJECT && Z_TYPE_P(value) != IS_ARRAY) {
- phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Expected \"%s\" option to be array or object, %s given", key, zend_get_type_by_const(Z_TYPE_P(value)));
- return false;
- }
-
- php_phongo_zval_to_bson(value, PHONGO_BSON_NONE, &b, NULL);
-
- if (EG(exception)) {
- bson_destroy(&b);
- return false;
- }
-
- if (!BSON_APPEND_DOCUMENT(opts, key, &b)) {
- phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Error appending \"%s\" option", key);
- bson_destroy(&b);
- return false;
- }
-
- bson_destroy(&b);
- return true;
-} /* }}} */
-
-#define PHONGO_BULKWRITE_APPEND_BOOL(opt, value) \
- if (!BSON_APPEND_BOOL(boptions, (opt), (value))) { \
- phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Error appending \"%s\" option", (opt)); \
- return false; \
- }
-
-#define PHONGO_BULKWRITE_APPEND_INT32(opt, value) \
- if (!BSON_APPEND_INT32(boptions, (opt), (value))) { \
- phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Error appending \"%s\" option", (opt)); \
- return false; \
- }
-
-#define PHONGO_BULKWRITE_OPT_ARRAY(opt) \
- if (zoptions && php_array_existsc(zoptions, (opt))) { \
- if (!php_phongo_bulkwrite_opts_append_array(boptions, (opt), zoptions)) { \
- return false; \
- } \
- }
-
-#define PHONGO_BULKWRITE_OPT_DOCUMENT(opt) \
- if (zoptions && php_array_existsc(zoptions, (opt))) { \
- if (!php_phongo_bulkwrite_opts_append_document(boptions, (opt), zoptions)) { \
- return false; \
- } \
- }
-
-/* Initialize the "hint" option. Returns true on success; otherwise, false is
- * returned and an exception is thrown.
- *
- * The "hint" option must be a string or document. Check for both types and
- * merge into BSON options accordingly. */
-static bool php_phongo_bulkwrite_opt_hint(bson_t* boptions, zval* zoptions) /* {{{ */
-{
- /* The "hint" option (or "$hint" modifier) must be a string or document.
- * Check for both types and merge into BSON options accordingly. */
- if (zoptions && php_array_existsc(zoptions, "hint")) {
- zend_uchar type = Z_TYPE_P(php_array_fetchc(zoptions, "hint"));
-
- if (type == IS_STRING) {
- zval* value = php_array_fetchc(zoptions, "hint");
-
- if (!bson_append_utf8(boptions, "hint", 4, Z_STRVAL_P(value), Z_STRLEN_P(value))) {
- phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Error appending \"hint\" option");
- return false;
- }
- } else if (type == IS_OBJECT || type == IS_ARRAY) {
- PHONGO_BULKWRITE_OPT_DOCUMENT("hint");
- } else {
- phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Expected \"hint\" option to be string, array, or object, %s given", zend_get_type_by_const(type));
- return false;
- }
- }
-
- return true;
-} /* }}} */
-
-/* Applies options (including defaults) for an update operation. */
-static bool php_phongo_bulkwrite_update_apply_options(bson_t* boptions, zval* zoptions) /* {{{ */
-{
- bool multi = false, upsert = false;
-
- if (zoptions) {
- multi = php_array_fetchc_bool(zoptions, "multi");
- upsert = php_array_fetchc_bool(zoptions, "upsert");
- }
-
- PHONGO_BULKWRITE_APPEND_BOOL("multi", multi);
- PHONGO_BULKWRITE_APPEND_BOOL("upsert", upsert);
- PHONGO_BULKWRITE_OPT_ARRAY("arrayFilters");
- PHONGO_BULKWRITE_OPT_DOCUMENT("collation");
-
- if (!php_phongo_bulkwrite_opt_hint(boptions, zoptions)) {
- return false;
- }
-
- return true;
-} /* }}} */
-
-/* Applies options (including defaults) for an delete operation. */
-static bool php_phongo_bulkwrite_delete_apply_options(bson_t* boptions, zval* zoptions) /* {{{ */
-{
- int32_t limit = 0;
-
- if (zoptions) {
- limit = php_array_fetchc_bool(zoptions, "limit") ? 1 : 0;
- }
-
- PHONGO_BULKWRITE_APPEND_INT32("limit", limit);
- PHONGO_BULKWRITE_OPT_DOCUMENT("collation");
-
- if (!php_phongo_bulkwrite_opt_hint(boptions, zoptions)) {
- return false;
- }
-
- return true;
-} /* }}} */
-
-#undef PHONGO_BULKWRITE_APPEND_BOOL
-#undef PHONGO_BULKWRITE_APPEND_INT32
-#undef PHONGO_BULKWRITE_OPT_DOCUMENT
-
-/* {{{ proto void MongoDB\Driver\BulkWrite::__construct([array $options = array()])
- Constructs a new BulkWrite */
-static PHP_METHOD(BulkWrite, __construct)
-{
- php_phongo_bulkwrite_t* intern;
- zend_error_handling error_handling;
- zval* options = NULL;
- zend_bool ordered = 1;
-
- zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
- intern = Z_BULKWRITE_OBJ_P(getThis());
-
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "|a!", &options) == FAILURE) {
- zend_restore_error_handling(&error_handling);
- return;
- }
- zend_restore_error_handling(&error_handling);
-
- if (options && php_array_existsc(options, "ordered")) {
- ordered = php_array_fetchc_bool(options, "ordered");
- }
-
- intern->bulk = mongoc_bulk_operation_new(ordered);
- intern->ordered = ordered;
- intern->bypass = PHONGO_BULKWRITE_BYPASS_UNSET;
- intern->num_ops = 0;
- intern->executed = false;
-
- if (options && php_array_existsc(options, "bypassDocumentValidation")) {
- zend_bool bypass = php_array_fetchc_bool(options, "bypassDocumentValidation");
- mongoc_bulk_operation_set_bypass_document_validation(intern->bulk, bypass);
- intern->bypass = bypass;
- }
-} /* }}} */
-
-/* {{{ proto mixed MongoDB\Driver\BulkWrite::insert(array|object $document)
- Adds an insert operation to the BulkWrite */
-static PHP_METHOD(BulkWrite, insert)
-{
- php_phongo_bulkwrite_t* intern;
- zval* zdocument;
- bson_t bdocument = BSON_INITIALIZER, boptions = BSON_INITIALIZER;
- bson_t* bson_out = NULL;
- int bson_flags = PHONGO_BSON_ADD_ID;
- bson_error_t error = { 0 };
-
- intern = Z_BULKWRITE_OBJ_P(getThis());
-
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "A", &zdocument) == FAILURE) {
- return;
- }
-
- bson_flags |= PHONGO_BSON_RETURN_ID;
-
- php_phongo_zval_to_bson(zdocument, bson_flags, &bdocument, &bson_out);
-
- if (EG(exception)) {
- goto cleanup;
- }
-
- if (!mongoc_bulk_operation_insert_with_opts(intern->bulk, &bdocument, &boptions, &error)) {
- phongo_throw_exception_from_bson_error_t(&error);
- goto cleanup;
- }
-
- intern->num_ops++;
-
- if (!bson_out) {
- phongo_throw_exception(PHONGO_ERROR_LOGIC, "Did not receive result from bulk write. Please file a bug report.");
- goto cleanup;
- }
-
- php_phongo_bulkwrite_extract_id(bson_out, &return_value);
-
-cleanup:
- bson_destroy(&bdocument);
- bson_destroy(&boptions);
- bson_clear(&bson_out);
-} /* }}} */
-
-/* {{{ proto void MongoDB\Driver\BulkWrite::update(array|object $query, array|object $newObj[, array $updateOptions = array()])
- Adds an update operation to the BulkWrite */
-static PHP_METHOD(BulkWrite, update)
-{
- php_phongo_bulkwrite_t* intern;
- zval * zquery, *zupdate, *zoptions = NULL;
- bson_t bquery = BSON_INITIALIZER, bupdate = BSON_INITIALIZER, boptions = BSON_INITIALIZER;
- bson_error_t error = { 0 };
-
- intern = Z_BULKWRITE_OBJ_P(getThis());
-
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "AA|a!", &zquery, &zupdate, &zoptions) == FAILURE) {
- return;
- }
-
- php_phongo_zval_to_bson(zquery, PHONGO_BSON_NONE, &bquery, NULL);
-
- if (EG(exception)) {
- goto cleanup;
- }
-
- php_phongo_zval_to_bson(zupdate, PHONGO_BSON_NONE, &bupdate, NULL);
-
- if (EG(exception)) {
- goto cleanup;
- }
-
- if (!php_phongo_bulkwrite_update_apply_options(&boptions, zoptions)) {
- goto cleanup;
- }
-
- if (php_phongo_bulkwrite_update_has_operators(&bupdate) || php_phongo_bulkwrite_update_is_pipeline(&bupdate)) {
- if (zoptions && php_array_fetchc_bool(zoptions, "multi")) {
- if (!mongoc_bulk_operation_update_many_with_opts(intern->bulk, &bquery, &bupdate, &boptions, &error)) {
- phongo_throw_exception_from_bson_error_t(&error);
- goto cleanup;
- }
- } else {
- if (!mongoc_bulk_operation_update_one_with_opts(intern->bulk, &bquery, &bupdate, &boptions, &error)) {
- phongo_throw_exception_from_bson_error_t(&error);
- goto cleanup;
- }
- }
- } else {
- if (zoptions && php_array_fetchc_bool(zoptions, "multi")) {
- phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Replacement document conflicts with true \"multi\" option");
- goto cleanup;
- }
-
- if (!mongoc_bulk_operation_replace_one_with_opts(intern->bulk, &bquery, &bupdate, &boptions, &error)) {
- phongo_throw_exception_from_bson_error_t(&error);
- goto cleanup;
- }
- }
-
- intern->num_ops++;
-
-cleanup:
- bson_destroy(&bquery);
- bson_destroy(&bupdate);
- bson_destroy(&boptions);
-} /* }}} */
-
-/* {{{ proto void MongoDB\Driver\BulkWrite::delete(array|object $query[, array $deleteOptions = array()])
- Adds a delete operation to the BulkWrite */
-static PHP_METHOD(BulkWrite, delete)
-{
- php_phongo_bulkwrite_t* intern;
- zval * zquery, *zoptions = NULL;
- bson_t bquery = BSON_INITIALIZER, boptions = BSON_INITIALIZER;
- bson_error_t error = { 0 };
-
- intern = Z_BULKWRITE_OBJ_P(getThis());
-
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "A|a!", &zquery, &zoptions) == FAILURE) {
- return;
- }
-
- php_phongo_zval_to_bson(zquery, PHONGO_BSON_NONE, &bquery, NULL);
-
- if (EG(exception)) {
- goto cleanup;
- }
-
- if (!php_phongo_bulkwrite_delete_apply_options(&boptions, zoptions)) {
- goto cleanup;
- }
-
- if (zoptions && php_array_fetchc_bool(zoptions, "limit")) {
- if (!mongoc_bulk_operation_remove_one_with_opts(intern->bulk, &bquery, &boptions, &error)) {
- phongo_throw_exception_from_bson_error_t(&error);
- goto cleanup;
- }
- } else {
- if (!mongoc_bulk_operation_remove_many_with_opts(intern->bulk, &bquery, &boptions, &error)) {
- phongo_throw_exception_from_bson_error_t(&error);
- goto cleanup;
- }
- }
-
- intern->num_ops++;
-
-cleanup:
- bson_destroy(&bquery);
- bson_destroy(&boptions);
-} /* }}} */
-
-/* {{{ proto integer MongoDB\Driver\BulkWrite::count()
- Returns the number of operations that have been added to the BulkWrite */
-static PHP_METHOD(BulkWrite, count)
-{
- php_phongo_bulkwrite_t* intern;
-
- intern = Z_BULKWRITE_OBJ_P(getThis());
-
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
-
- RETURN_LONG(intern->num_ops);
-} /* }}} */
-
-/* {{{ MongoDB\Driver\BulkWrite function entries */
-ZEND_BEGIN_ARG_INFO_EX(ai_BulkWrite___construct, 0, 0, 0)
- ZEND_ARG_ARRAY_INFO(0, options, 1)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(ai_BulkWrite_insert, 0, 0, 1)
- ZEND_ARG_INFO(0, document)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(ai_BulkWrite_update, 0, 0, 2)
- ZEND_ARG_INFO(0, query)
- ZEND_ARG_INFO(0, newObj)
- ZEND_ARG_ARRAY_INFO(0, updateOptions, 1)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(ai_BulkWrite_delete, 0, 0, 1)
- ZEND_ARG_INFO(0, query)
- ZEND_ARG_ARRAY_INFO(0, deleteOptions, 1)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(ai_BulkWrite_void, 0, 0, 0)
-ZEND_END_ARG_INFO()
-
-static zend_function_entry php_phongo_bulkwrite_me[] = {
- /* clang-format off */
- PHP_ME(BulkWrite, __construct, ai_BulkWrite___construct, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
- PHP_ME(BulkWrite, insert, ai_BulkWrite_insert, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
- PHP_ME(BulkWrite, update, ai_BulkWrite_update, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
- PHP_ME(BulkWrite, delete, ai_BulkWrite_delete, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
- PHP_ME(BulkWrite, count, ai_BulkWrite_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
- ZEND_NAMED_ME(__wakeup, PHP_FN(MongoDB_disabled___wakeup), ai_BulkWrite_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
- PHP_FE_END
- /* clang-format on */
-};
-/* }}} */
-
-/* {{{ MongoDB\Driver\BulkWrite object handlers */
-static zend_object_handlers php_phongo_handler_bulkwrite;
-
-static void php_phongo_bulkwrite_free_object(zend_object* object) /* {{{ */
-{
- php_phongo_bulkwrite_t* intern = Z_OBJ_BULKWRITE(object);
-
- zend_object_std_dtor(&intern->std);
-
- if (intern->bulk) {
- mongoc_bulk_operation_destroy(intern->bulk);
- }
-
- if (intern->database) {
- efree(intern->database);
- }
-
- if (intern->collection) {
- efree(intern->collection);
- }
-} /* }}} */
-
-static zend_object* php_phongo_bulkwrite_create_object(zend_class_entry* class_type) /* {{{ */
-{
- php_phongo_bulkwrite_t* intern = NULL;
-
- intern = PHONGO_ALLOC_OBJECT_T(php_phongo_bulkwrite_t, class_type);
-
- zend_object_std_init(&intern->std, class_type);
- object_properties_init(&intern->std, class_type);
-
- intern->std.handlers = &php_phongo_handler_bulkwrite;
-
- return &intern->std;
-} /* }}} */
-
-static HashTable* php_phongo_bulkwrite_get_debug_info(zval* object, int* is_temp) /* {{{ */
-{
- zval retval = ZVAL_STATIC_INIT;
- php_phongo_bulkwrite_t* intern = NULL;
-
- *is_temp = 1;
- intern = Z_BULKWRITE_OBJ_P(object);
- array_init(&retval);
-
- 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");
- }
-
- ADD_ASSOC_BOOL_EX(&retval, "ordered", intern->ordered);
-
- if (intern->bypass != PHONGO_BULKWRITE_BYPASS_UNSET) {
- ADD_ASSOC_BOOL_EX(&retval, "bypassDocumentValidation", intern->bypass);
- } else {
- ADD_ASSOC_NULL_EX(&retval, "bypassDocumentValidation");
- }
-
- ADD_ASSOC_BOOL_EX(&retval, "executed", intern->executed);
- ADD_ASSOC_LONG_EX(&retval, "server_id", mongoc_bulk_operation_get_hint(intern->bulk));
-
- if (mongoc_bulk_operation_get_write_concern(intern->bulk)) {
- zval write_concern;
-
- php_phongo_write_concern_to_zval(&write_concern, mongoc_bulk_operation_get_write_concern(intern->bulk));
- ADD_ASSOC_ZVAL_EX(&retval, "write_concern", &write_concern);
- } else {
- ADD_ASSOC_NULL_EX(&retval, "write_concern");
- }
-
- return Z_ARRVAL(retval);
-} /* }}} */
-/* }}} */
-
-void php_phongo_bulkwrite_init_ce(INIT_FUNC_ARGS) /* {{{ */
-{
- zend_class_entry ce;
-
- INIT_NS_CLASS_ENTRY(ce, "MongoDB\\Driver", "BulkWrite", php_phongo_bulkwrite_me);
- php_phongo_bulkwrite_ce = zend_register_internal_class(&ce);
- php_phongo_bulkwrite_ce->create_object = php_phongo_bulkwrite_create_object;
- PHONGO_CE_FINAL(php_phongo_bulkwrite_ce);
- PHONGO_CE_DISABLE_SERIALIZATION(php_phongo_bulkwrite_ce);
-
- memcpy(&php_phongo_handler_bulkwrite, phongo_get_std_object_handlers(), sizeof(zend_object_handlers));
- php_phongo_handler_bulkwrite.get_debug_info = php_phongo_bulkwrite_get_debug_info;
- php_phongo_handler_bulkwrite.free_obj = php_phongo_bulkwrite_free_object;
- php_phongo_handler_bulkwrite.offset = XtOffsetOf(php_phongo_bulkwrite_t, std);
-
- zend_class_implements(php_phongo_bulkwrite_ce, 1, spl_ce_Countable);
-} /* }}} */
-
-/*
- * 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.8.1/src/MongoDB/ClientEncryption.c b/mongodb-1.8.1/src/MongoDB/ClientEncryption.c
deleted file mode 100644
index 2b60f258..00000000
--- a/mongodb-1.8.1/src/MongoDB/ClientEncryption.c
+++ /dev/null
@@ -1,192 +0,0 @@
-/*
- * Copyright 2019 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 <php.h>
-#include <Zend/zend_interfaces.h>
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "phongo_compat.h"
-#include "php_phongo.h"
-
-zend_class_entry* php_phongo_clientencryption_ce;
-
-/* {{{ proto MongoDB\BSON\Binary MongoDB\Driver\ClientEncryption::createDataKey(string $kmsProvider[, array $options])
- Creates a new key document and inserts into the key vault collection. */
-static PHP_METHOD(ClientEncryption, createDataKey)
-{
- char* kms_provider = NULL;
- size_t kms_provider_len = 0;
- zval* options = NULL;
- zend_error_handling error_handling;
- php_phongo_clientencryption_t* intern;
-
- intern = Z_CLIENTENCRYPTION_OBJ_P(getThis());
- zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
-
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|a!", &kms_provider, &kms_provider_len, &options) == FAILURE) {
- zend_restore_error_handling(&error_handling);
- return;
- }
-
- zend_restore_error_handling(&error_handling);
-
- phongo_clientencryption_create_datakey(intern, return_value, kms_provider, options);
-} /* }}} */
-
-/* {{{ proto MongoDB\BSON\Binary MongoDB\Driver\ClientEncryption::encrypt(mixed $value[, array $options])
- Encrypts a value with a given key and algorithm */
-static PHP_METHOD(ClientEncryption, encrypt)
-{
- zval* value = NULL;
- zval* options = NULL;
- zend_error_handling error_handling;
- php_phongo_clientencryption_t* intern;
-
- intern = Z_CLIENTENCRYPTION_OBJ_P(getThis());
- zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
-
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "z|a!", &value, &options) == FAILURE) {
- zend_restore_error_handling(&error_handling);
- return;
- }
-
- zend_restore_error_handling(&error_handling);
-
- phongo_clientencryption_encrypt(intern, value, return_value, options);
-} /* }}} */
-
-/* {{{ proto mixed MongoDB\Driver\ClientEncryption::decrypt(MongoDB\BSON\BinaryInterface $value)
- Decrypts an encrypted value (BSON binary of subtype 6). Returns the original BSON value */
-static PHP_METHOD(ClientEncryption, decrypt)
-{
- zval* ciphertext;
- zend_error_handling error_handling;
- php_phongo_clientencryption_t* intern;
-
- intern = Z_CLIENTENCRYPTION_OBJ_P(getThis());
- zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
-
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "O", &ciphertext, php_phongo_binary_interface_ce) == FAILURE) {
- zend_restore_error_handling(&error_handling);
- return;
- }
-
- zend_restore_error_handling(&error_handling);
-
- phongo_clientencryption_decrypt(intern, ciphertext, return_value);
-} /* }}} */
-
-ZEND_BEGIN_ARG_INFO_EX(ai_ClientEncryption_createDataKey, 0, 0, 1)
- ZEND_ARG_INFO(0, kmsProvider)
- ZEND_ARG_ARRAY_INFO(0, options, 1)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(ai_ClientEncryption_encrypt, 0, 0, 1)
- ZEND_ARG_INFO(0, value)
- ZEND_ARG_ARRAY_INFO(0, options, 1)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(ai_ClientEncryption_decrypt, 0, 0, 1)
- ZEND_ARG_OBJ_INFO(0, keyVaultClient, MongoDB\\BSON\\BinaryInterface, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(ai_ClientEncryption_void, 0, 0, 0)
-ZEND_END_ARG_INFO()
-
-static zend_function_entry php_phongo_clientencryption_me[] = {
- /* clang-format off */
- PHP_ME(ClientEncryption, createDataKey, ai_ClientEncryption_createDataKey, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
- PHP_ME(ClientEncryption, encrypt, ai_ClientEncryption_encrypt, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
- PHP_ME(ClientEncryption, decrypt, ai_ClientEncryption_decrypt, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
- ZEND_NAMED_ME(__construct, PHP_FN(MongoDB_disabled___construct), ai_ClientEncryption_void, ZEND_ACC_PRIVATE | ZEND_ACC_FINAL)
- ZEND_NAMED_ME(__wakeup, PHP_FN(MongoDB_disabled___wakeup), ai_ClientEncryption_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
- PHP_FE_END
- /* clang-format on */
-};
-/* }}} */
-
-/* {{{ MongoDB\Driver\ClientEncryption object handlers */
-static zend_object_handlers php_phongo_handler_clientencryption;
-
-static void php_phongo_clientencryption_free_object(zend_object* object) /* {{{ */
-{
- php_phongo_clientencryption_t* intern = Z_OBJ_CLIENTENCRYPTION(object);
-
- zend_object_std_dtor(&intern->std);
-
- if (intern->client_encryption) {
- mongoc_client_encryption_destroy(intern->client_encryption);
- }
-} /* }}} */
-
-static zend_object* php_phongo_clientencryption_create_object(zend_class_entry* class_type) /* {{{ */
-{
- php_phongo_clientencryption_t* intern = NULL;
-
- intern = PHONGO_ALLOC_OBJECT_T(php_phongo_clientencryption_t, class_type);
-
- zend_object_std_init(&intern->std, class_type);
- object_properties_init(&intern->std, class_type);
-
- intern->std.handlers = &php_phongo_handler_clientencryption;
-
- return &intern->std;
-} /* }}} */
-
-static HashTable* php_phongo_clientencryption_get_debug_info(zval* object, int* is_temp) /* {{{ */
-{
- php_phongo_clientencryption_t* intern = NULL;
- zval retval = ZVAL_STATIC_INIT;
-
- *is_temp = 1;
- intern = Z_CLIENTENCRYPTION_OBJ_P(object);
-
- array_init(&retval);
-
- return Z_ARRVAL(retval);
-} /* }}} */
-/* }}} */
-
-void php_phongo_clientencryption_init_ce(INIT_FUNC_ARGS) /* {{{ */
-{
- zend_class_entry ce;
-
- INIT_NS_CLASS_ENTRY(ce, "MongoDB\\Driver", "ClientEncryption", php_phongo_clientencryption_me);
- php_phongo_clientencryption_ce = zend_register_internal_class(&ce);
- php_phongo_clientencryption_ce->create_object = php_phongo_clientencryption_create_object;
- PHONGO_CE_FINAL(php_phongo_clientencryption_ce);
- PHONGO_CE_DISABLE_SERIALIZATION(php_phongo_clientencryption_ce);
-
- memcpy(&php_phongo_handler_clientencryption, phongo_get_std_object_handlers(), sizeof(zend_object_handlers));
- php_phongo_handler_clientencryption.get_debug_info = php_phongo_clientencryption_get_debug_info;
- php_phongo_handler_clientencryption.free_obj = php_phongo_clientencryption_free_object;
- php_phongo_handler_clientencryption.offset = XtOffsetOf(php_phongo_clientencryption_t, std);
-
- zend_declare_class_constant_string(php_phongo_clientencryption_ce, ZEND_STRL("AEAD_AES_256_CBC_HMAC_SHA_512_DETERMINISTIC"), MONGOC_AEAD_AES_256_CBC_HMAC_SHA_512_DETERMINISTIC);
- zend_declare_class_constant_string(php_phongo_clientencryption_ce, ZEND_STRL("AEAD_AES_256_CBC_HMAC_SHA_512_RANDOM"), MONGOC_AEAD_AES_256_CBC_HMAC_SHA_512_RANDOM);
-} /* }}} */
-
-/*
- * 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.8.1/src/MongoDB/Command.c b/mongodb-1.8.1/src/MongoDB/Command.c
deleted file mode 100644
index c352dba0..00000000
--- a/mongodb-1.8.1/src/MongoDB/Command.c
+++ /dev/null
@@ -1,218 +0,0 @@
-/*
- * 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.
- */
-
-#include <php.h>
-#include <Zend/zend_interfaces.h>
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php_array_api.h"
-#include "phongo_compat.h"
-#include "php_phongo.h"
-#include "php_bson.h"
-
-zend_class_entry* php_phongo_command_ce;
-
-/* Initialize the "maxAwaitTimeMS" option. Returns true on success; otherwise,
- * false is returned and an exception is thrown.
- *
- * The "maxAwaitTimeMS" option is assigned to the cursor after query execution
- * via mongoc_cursor_set_max_await_time_ms(). */
-static bool php_phongo_command_init_max_await_time_ms(php_phongo_command_t* intern, zval* options) /* {{{ */
-{
- int64_t max_await_time_ms;
-
- if (!php_array_existsc(options, "maxAwaitTimeMS")) {
- return true;
- }
-
- max_await_time_ms = php_array_fetchc_long(options, "maxAwaitTimeMS");
-
- if (max_await_time_ms < 0) {
- phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Expected \"maxAwaitTimeMS\" option to be >= 0, %" PRId64 " given", max_await_time_ms);
- return false;
- }
-
- if (max_await_time_ms > UINT32_MAX) {
- phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Expected \"maxAwaitTimeMS\" option to be <= %" PRIu32 ", %" PRId64 " given", UINT32_MAX, max_await_time_ms);
- return false;
- }
-
- intern->max_await_time_ms = (uint32_t) max_await_time_ms;
-
- return true;
-} /* }}} */
-
-/* Initializes the php_phongo_command_init from options argument. This
- * function will fall back to a modifier in the absence of a top-level option
- * (where applicable). */
-static bool php_phongo_command_init(php_phongo_command_t* intern, zval* filter, zval* options) /* {{{ */
-{
- bson_iter_t iter;
- bson_iter_t sub_iter;
-
- intern->bson = bson_new();
- intern->batch_size = 0;
- intern->max_await_time_ms = 0;
-
- php_phongo_zval_to_bson(filter, PHONGO_BSON_NONE, intern->bson, NULL);
-
- /* Note: if any exceptions are thrown, we can simply return as PHP will
- * invoke php_phongo_query_free_object to destruct the object. */
- if (EG(exception)) {
- return false;
- }
-
- if (bson_iter_init(&iter, intern->bson) && bson_iter_find_descendant(&iter, "cursor.batchSize", &sub_iter) && BSON_ITER_HOLDS_INT(&sub_iter)) {
- int64_t batch_size = bson_iter_as_int64(&sub_iter);
-
- if (batch_size >= 0 && batch_size <= UINT32_MAX) {
- intern->batch_size = (uint32_t) batch_size;
- }
- }
-
- if (!options) {
- return true;
- }
-
- if (!php_phongo_command_init_max_await_time_ms(intern, options)) {
- return false;
- }
-
- return true;
-} /* }}} */
-
-/* {{{ proto void MongoDB\Driver\Command::__construct(array|object $document[, array $options = array()])
- Constructs a new Command */
-static PHP_METHOD(Command, __construct)
-{
- php_phongo_command_t* intern;
- zend_error_handling error_handling;
- zval* document;
- zval* options = NULL;
-
- zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
- intern = Z_COMMAND_OBJ_P(getThis());
-
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "A|a!", &document, &options) == FAILURE) {
- zend_restore_error_handling(&error_handling);
- return;
- }
- zend_restore_error_handling(&error_handling);
-
- php_phongo_command_init(intern, document, options);
-} /* }}} */
-
-/* {{{ MongoDB\Driver\Command function entries */
-ZEND_BEGIN_ARG_INFO_EX(ai_Command___construct, 0, 0, 1)
- ZEND_ARG_INFO(0, document)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(ai_Command_void, 0, 0, 0)
-ZEND_END_ARG_INFO()
-
-static zend_function_entry php_phongo_command_me[] = {
- /* clang-format off */
- PHP_ME(Command, __construct, ai_Command___construct, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
- ZEND_NAMED_ME(__wakeup, PHP_FN(MongoDB_disabled___wakeup), ai_Command_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
- PHP_FE_END
- /* clang-format on */
-};
-/* }}} */
-
-/* {{{ MongoDB\Driver\Command object handlers */
-static zend_object_handlers php_phongo_handler_command;
-
-static void php_phongo_command_free_object(zend_object* object) /* {{{ */
-{
- php_phongo_command_t* intern = Z_OBJ_COMMAND(object);
-
- zend_object_std_dtor(&intern->std);
-
- if (intern->bson) {
- bson_clear(&intern->bson);
- }
-} /* }}} */
-
-static zend_object* php_phongo_command_create_object(zend_class_entry* class_type) /* {{{ */
-{
- php_phongo_command_t* intern = NULL;
-
- intern = PHONGO_ALLOC_OBJECT_T(php_phongo_command_t, class_type);
-
- zend_object_std_init(&intern->std, class_type);
- object_properties_init(&intern->std, class_type);
-
- intern->std.handlers = &php_phongo_handler_command;
-
- return &intern->std;
-} /* }}} */
-
-static HashTable* php_phongo_command_get_debug_info(zval* object, int* is_temp) /* {{{ */
-{
- php_phongo_command_t* intern;
- zval retval = ZVAL_STATIC_INIT;
-
- *is_temp = 1;
- intern = Z_COMMAND_OBJ_P(object);
-
- array_init_size(&retval, 1);
-
- if (intern->bson) {
- zval zv;
-
- if (!php_phongo_bson_to_zval(bson_get_data(intern->bson), intern->bson->len, &zv)) {
- zval_ptr_dtor(&zv);
- goto done;
- }
-
- ADD_ASSOC_ZVAL_EX(&retval, "command", &zv);
- } else {
- ADD_ASSOC_NULL_EX(&retval, "command");
- }
-
-done:
- return Z_ARRVAL(retval);
-
-} /* }}} */
-/* }}} */
-
-void php_phongo_command_init_ce(INIT_FUNC_ARGS) /* {{{ */
-{
- zend_class_entry ce;
-
- INIT_NS_CLASS_ENTRY(ce, "MongoDB\\Driver", "Command", php_phongo_command_me);
- php_phongo_command_ce = zend_register_internal_class(&ce);
- php_phongo_command_ce->create_object = php_phongo_command_create_object;
- PHONGO_CE_FINAL(php_phongo_command_ce);
- PHONGO_CE_DISABLE_SERIALIZATION(php_phongo_command_ce);
-
- memcpy(&php_phongo_handler_command, phongo_get_std_object_handlers(), sizeof(zend_object_handlers));
- php_phongo_handler_command.get_debug_info = php_phongo_command_get_debug_info;
- php_phongo_handler_command.free_obj = php_phongo_command_free_object;
- php_phongo_handler_command.offset = XtOffsetOf(php_phongo_command_t, std);
-} /* }}} */
-
-/*
- * 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.8.1/src/MongoDB/Cursor.c b/mongodb-1.8.1/src/MongoDB/Cursor.c
deleted file mode 100644
index 14b00437..00000000
--- a/mongodb-1.8.1/src/MongoDB/Cursor.c
+++ /dev/null
@@ -1,520 +0,0 @@
-/*
- * 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.
- */
-
-#include <php.h>
-#include <Zend/zend_interfaces.h>
-#include <ext/spl/spl_iterators.h>
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "phongo_compat.h"
-#include "php_phongo.h"
-#include "php_bson.h"
-
-zend_class_entry* php_phongo_cursor_ce;
-
-/* Check if the cursor is exhausted (i.e. ID is zero) and free any reference to
- * the session. Calling this function during iteration will allow an implicit
- * session to return to the pool immediately after a getMore indicates that the
- * server has no more results to return. */
-static void php_phongo_cursor_free_session_if_exhausted(php_phongo_cursor_t* cursor) /* {{{ */
-{
- if (mongoc_cursor_get_id(cursor->cursor)) {
- return;
- }
-
- if (!Z_ISUNDEF(cursor->session)) {
- zval_ptr_dtor(&cursor->session);
- ZVAL_UNDEF(&cursor->session);
- }
-} /* }}} */
-
-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);
- ZVAL_UNDEF(&cursor->visitor_data.zchild);
- }
-} /* }}} */
-
-/* {{{ MongoDB\Driver\Cursor iterator handlers */
-static void php_phongo_cursor_iterator_dtor(zend_object_iterator* iter) /* {{{ */
-{
- php_phongo_cursor_iterator* cursor_it = (php_phongo_cursor_iterator*) iter;
-
- if (!Z_ISUNDEF(cursor_it->intern.data)) {
- zval_ptr_dtor(&cursor_it->intern.data);
- }
-} /* }}} */
-
-static int php_phongo_cursor_iterator_valid(zend_object_iterator* iter) /* {{{ */
-{
- php_phongo_cursor_t* cursor = ((php_phongo_cursor_iterator*) iter)->cursor;
-
- if (!Z_ISUNDEF(cursor->visitor_data.zchild)) {
- return SUCCESS;
- }
-
- return FAILURE;
-} /* }}} */
-
-static void php_phongo_cursor_iterator_get_current_key(zend_object_iterator* iter, zval* key) /* {{{ */
-{
- php_phongo_cursor_t* cursor = ((php_phongo_cursor_iterator*) iter)->cursor;
-
- ZVAL_LONG(key, cursor->current);
-} /* }}} */
-
-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;
-} /* }}} */
-
-static void php_phongo_cursor_iterator_move_forward(zend_object_iterator* iter) /* {{{ */
-{
- 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);
-
- /* If the cursor has already advanced, increment its position. Otherwise,
- * the first call to mongoc_cursor_next() will be made below and we should
- * leave its position at zero. */
- if (cursor->advanced) {
- cursor->current++;
- } else {
- cursor->advanced = true;
- }
-
- if (mongoc_cursor_next(cursor->cursor, &doc)) {
- if (!php_phongo_bson_to_zval_ex(bson_get_data(doc), doc->len, &cursor->visitor_data)) {
- /* Free invalid result, but don't return as we want to free the
- * session if the cursor is exhausted. */
- php_phongo_cursor_free_current(cursor);
- }
- } else {
- bson_error_t error = { 0 };
- const bson_t* doc = NULL;
-
- if (mongoc_cursor_error_document(cursor->cursor, &error, &doc)) {
- /* Intentionally not destroying the cursor as it will happen
- * naturally now that there are no more results */
- phongo_throw_exception_from_bson_error_t_and_reply(&error, doc);
- }
- }
-
- php_phongo_cursor_free_session_if_exhausted(cursor);
-} /* }}} */
-
-static void php_phongo_cursor_iterator_rewind(zend_object_iterator* iter) /* {{{ */
-{
- php_phongo_cursor_iterator* cursor_it = (php_phongo_cursor_iterator*) iter;
- php_phongo_cursor_t* cursor = cursor_it->cursor;
- const bson_t* doc;
-
- /* If the cursor was never advanced (e.g. command cursor), do so now */
- if (!cursor->advanced) {
- cursor->advanced = true;
-
- if (!phongo_cursor_advance_and_check_for_error(cursor->cursor)) {
- /* Exception should already have been thrown */
- return;
- }
- }
-
- if (cursor->current > 0) {
- phongo_throw_exception(PHONGO_ERROR_LOGIC, "Cursors cannot rewind after starting iteration");
- return;
- }
-
- php_phongo_cursor_free_current(cursor);
-
- doc = mongoc_cursor_current(cursor->cursor);
-
- if (doc) {
- if (!php_phongo_bson_to_zval_ex(bson_get_data(doc), doc->len, &cursor->visitor_data)) {
- /* Free invalid result, but don't return as we want to free the
- * session if the cursor is exhausted. */
- php_phongo_cursor_free_current(cursor);
- }
- }
-
- php_phongo_cursor_free_session_if_exhausted(cursor);
-} /* }}} */
-
-static 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 */
-};
-
-static zend_object_iterator* php_phongo_cursor_get_iterator(zend_class_entry* ce, zval* object, int by_ref) /* {{{ */
-{
- 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, "Cursors cannot yield multiple iterators");
- return NULL;
- }
-
- cursor->got_iterator = true;
-
- cursor_it = ecalloc(1, sizeof(php_phongo_cursor_iterator));
- zend_iterator_init(&cursor_it->intern);
-
- ZVAL_COPY(&cursor_it->intern.data, object);
- 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 MongoDB\Driver\Cursor::setTypeMap(array $typemap)
- Sets a type map to use for BSON unserialization */
-static PHP_METHOD(Cursor, setTypeMap)
-{
- php_phongo_cursor_t* intern;
- php_phongo_bson_state state;
- zval* typemap = NULL;
- bool restore_current_element = false;
-
- PHONGO_BSON_INIT_STATE(state);
-
- intern = Z_CURSOR_OBJ_P(getThis());
-
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "a!", &typemap) == FAILURE) {
- return;
- }
-
- if (!php_phongo_bson_typemap_to_state(typemap, &state.map)) {
- 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;
- }
-
- php_phongo_bson_typemap_dtor(&intern->visitor_data.map);
-
- 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 (restore_current_element && mongoc_cursor_current(intern->cursor)) {
- const bson_t* doc = mongoc_cursor_current(intern->cursor);
-
- if (!php_phongo_bson_to_zval_ex(bson_get_data(doc), doc->len, &intern->visitor_data)) {
- php_phongo_cursor_free_current(intern);
- }
- }
-} /* }}} */
-
-static int php_phongo_cursor_to_array_apply(zend_object_iterator* iter, void* puser) /* {{{ */
-{
- zval* data;
- zval* return_value = (zval*) puser;
-
- data = iter->funcs->get_current_data(iter);
-
- 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);
-
- return ZEND_HASH_APPLY_KEEP;
-} /* }}} */
-
-static void php_phongo_cursor_id_new_from_id(zval* object, int64_t cursorid) /* {{{ */
-{
- php_phongo_cursorid_t* intern;
-
- object_init_ex(object, php_phongo_cursorid_ce);
-
- intern = Z_CURSORID_OBJ_P(object);
- intern->id = cursorid;
-} /* }}} */
-
-/* {{{ proto array MongoDB\Driver\Cursor::toArray()
- Returns an array of all result documents for this cursor */
-static PHP_METHOD(Cursor, toArray)
-{
- 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) != SUCCESS) {
- zval_dtor(return_value);
- RETURN_NULL();
- }
-} /* }}} */
-
-/* {{{ proto MongoDB\Driver\CursorId MongoDB\Driver\Cursor::getId()
- Returns the CursorId for this cursor */
-static PHP_METHOD(Cursor, getId)
-{
- php_phongo_cursor_t* intern;
-
- 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));
-} /* }}} */
-
-/* {{{ proto MongoDB\Driver\Server MongoDB\Driver\Cursor::getServer()
- Returns the Server object to which this cursor is attached */
-static PHP_METHOD(Cursor, getServer)
-{
- php_phongo_cursor_t* intern;
-
- intern = Z_CURSOR_OBJ_P(getThis());
-
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
-
- phongo_server_init(return_value, intern->client, intern->server_id);
-} /* }}} */
-
-/* {{{ proto boolean MongoDB\Driver\Cursor::isDead()
- Checks if a cursor is still alive */
-static PHP_METHOD(Cursor, isDead)
-{
- php_phongo_cursor_t* intern;
-
- intern = Z_CURSOR_OBJ_P(getThis());
-
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
-
- RETURN_BOOL(!mongoc_cursor_more(intern->cursor));
-} /* }}} */
-
-/* {{{ MongoDB\Driver\Cursor function entries */
-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[] = {
- /* clang-format off */
- 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)
- ZEND_NAMED_ME(__construct, PHP_FN(MongoDB_disabled___construct), ai_Cursor_void, ZEND_ACC_PRIVATE | ZEND_ACC_FINAL)
- ZEND_NAMED_ME(__wakeup, PHP_FN(MongoDB_disabled___wakeup), ai_Cursor_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
- PHP_FE_END
- /* clang-format on */
-};
-/* }}} */
-
-/* {{{ MongoDB\Driver\Cursor object handlers */
-static zend_object_handlers php_phongo_handler_cursor;
-
-static void php_phongo_cursor_free_object(zend_object* object) /* {{{ */
-{
- php_phongo_cursor_t* intern = Z_OBJ_CURSOR(object);
-
- zend_object_std_dtor(&intern->std);
-
- /* If this Cursor was created in a different process, reset the client so
- * that mongoc_cursor_destroy does not issue a killCursors command for an
- * active cursor owned by a parent process. */
- PHONGO_RESET_CLIENT_IF_PID_DIFFERS(intern);
-
- 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);
- }
-
- if (!Z_ISUNDEF(intern->session)) {
- zval_ptr_dtor(&intern->session);
- }
-
- php_phongo_bson_typemap_dtor(&intern->visitor_data.map);
-
- php_phongo_cursor_free_current(intern);
-} /* }}} */
-
-static zend_object* php_phongo_cursor_create_object(zend_class_entry* class_type) /* {{{ */
-{
- 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);
- object_properties_init(&intern->std, class_type);
-
- PHONGO_SET_CREATED_BY_PID(intern);
-
- intern->std.handlers = &php_phongo_handler_cursor;
-
- return &intern->std;
-} /* }}} */
-
-static HashTable* php_phongo_cursor_get_debug_info(zval* object, int* is_temp) /* {{{ */
-{
- php_phongo_cursor_t* intern;
- zval retval = ZVAL_STATIC_INIT;
-
- *is_temp = 1;
- intern = Z_CURSOR_OBJ_P(object);
-
- array_init_size(&retval, 10);
-
- 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)) {
- ADD_ASSOC_ZVAL_EX(&retval, "query", &intern->query);
- Z_ADDREF(intern->query);
- } else {
- ADD_ASSOC_NULL_EX(&retval, "query");
- }
-
- if (!Z_ISUNDEF(intern->command)) {
- ADD_ASSOC_ZVAL_EX(&retval, "command", &intern->command);
- Z_ADDREF(intern->command);
- } else {
- ADD_ASSOC_NULL_EX(&retval, "command");
- }
-
- if (!Z_ISUNDEF(intern->read_preference)) {
- ADD_ASSOC_ZVAL_EX(&retval, "readPreference", &intern->read_preference);
- Z_ADDREF(intern->read_preference);
- } else {
- ADD_ASSOC_NULL_EX(&retval, "readPreference");
- }
-
- if (!Z_ISUNDEF(intern->session)) {
- ADD_ASSOC_ZVAL_EX(&retval, "session", &intern->session);
- Z_ADDREF(intern->session);
- } else {
- ADD_ASSOC_NULL_EX(&retval, "session");
- }
-
- ADD_ASSOC_BOOL_EX(&retval, "isDead", !mongoc_cursor_more(intern->cursor));
-
- ADD_ASSOC_LONG_EX(&retval, "currentIndex", intern->current);
-
- if (!Z_ISUNDEF(intern->visitor_data.zchild)) {
- ADD_ASSOC_ZVAL_EX(&retval, "currentDocument", &intern->visitor_data.zchild);
- Z_ADDREF(intern->visitor_data.zchild);
- } else {
- ADD_ASSOC_NULL_EX(&retval, "currentDocument");
- }
-
- {
- zval server;
-
- phongo_server_init(&server, intern->client, intern->server_id);
- ADD_ASSOC_ZVAL_EX(&retval, "server", &server);
- }
-
- return Z_ARRVAL(retval);
-
-} /* }}} */
-/* }}} */
-
-void php_phongo_cursor_init_ce(INIT_FUNC_ARGS) /* {{{ */
-{
- zend_class_entry ce;
-
- INIT_NS_CLASS_ENTRY(ce, "MongoDB\\Driver", "Cursor", php_phongo_cursor_me);
- php_phongo_cursor_ce = zend_register_internal_class(&ce);
- 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;
-
- zend_class_implements(php_phongo_cursor_ce, 1, php_phongo_cursor_interface_ce);
-
- 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;
- php_phongo_handler_cursor.free_obj = php_phongo_cursor_free_object;
- php_phongo_handler_cursor.offset = XtOffsetOf(php_phongo_cursor_t, std);
-} /* }}} */
-
-/*
- * 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.8.1/src/MongoDB/CursorId.c b/mongodb-1.8.1/src/MongoDB/CursorId.c
deleted file mode 100644
index 5f519e99..00000000
--- a/mongodb-1.8.1/src/MongoDB/CursorId.c
+++ /dev/null
@@ -1,231 +0,0 @@
-/*
- * 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.
- */
-
-#include <php.h>
-#include <Zend/zend_interfaces.h>
-#include <ext/standard/php_var.h>
-#include <zend_smart_str.h>
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "phongo_compat.h"
-#include "php_phongo.h"
-
-zend_class_entry* php_phongo_cursorid_ce;
-
-/* Initialize the object from a numeric string and return whether it was
- * successful. An exception will be thrown on error. */
-static bool php_phongo_cursorid_init_from_string(php_phongo_cursorid_t* intern, const char* s_id, size_t s_id_len) /* {{{ */
-{
- int64_t id;
-
- if (!php_phongo_parse_int64(&id, s_id, s_id_len)) {
- phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Error parsing \"%s\" as 64-bit id for %s initialization", s_id, ZSTR_VAL(php_phongo_cursorid_ce->name));
- return false;
- }
-
- intern->id = id;
- 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_cursorid_init_from_hash(php_phongo_cursorid_t* intern, HashTable* props) /* {{{ */
-{
- zval* value;
-
- if ((value = zend_hash_str_find(props, "id", sizeof("id") - 1)) && Z_TYPE_P(value) == IS_STRING) {
- return php_phongo_cursorid_init_from_string(intern, Z_STRVAL_P(value), Z_STRLEN_P(value));
- }
-
- phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "%s initialization requires \"id\" string field", ZSTR_VAL(php_phongo_cursorid_ce->name));
- return false;
-} /* }}} */
-
-/* {{{ proto string MongoDB\Driver\CursorId::__toString()
- Returns the string representation of the CursorId */
-static PHP_METHOD(CursorId, __toString)
-{
- php_phongo_cursorid_t* intern;
- char* tmp;
- int tmp_len;
-
- intern = Z_CURSORID_OBJ_P(getThis());
-
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
-
- tmp_len = spprintf(&tmp, 0, "%" PRId64, intern->id);
- RETVAL_STRINGL(tmp, tmp_len);
- efree(tmp);
-} /* }}} */
-
-/* {{{ proto string MongoDB\Driver\CursorId::serialize()
-*/
-static PHP_METHOD(CursorId, serialize)
-{
- php_phongo_cursorid_t* intern;
- zval retval;
- php_serialize_data_t var_hash;
- smart_str buf = { 0 };
-
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
-
- intern = Z_CURSORID_OBJ_P(getThis());
-
- array_init_size(&retval, 1);
- ADD_ASSOC_INT64_AS_STRING(&retval, "id", intern->id);
-
- PHP_VAR_SERIALIZE_INIT(var_hash);
- php_var_serialize(&buf, &retval, &var_hash);
- smart_str_0(&buf);
- PHP_VAR_SERIALIZE_DESTROY(var_hash);
-
- PHONGO_RETVAL_SMART_STR(buf);
-
- smart_str_free(&buf);
- zval_ptr_dtor(&retval);
-} /* }}} */
-
-/* {{{ proto void MongoDB\Driver\CursorId::unserialize(string $serialized)
-*/
-static PHP_METHOD(CursorId, unserialize)
-{
- php_phongo_cursorid_t* intern;
- zend_error_handling error_handling;
- char* serialized;
- size_t serialized_len;
- zval props;
- php_unserialize_data_t var_hash;
-
- intern = Z_CURSORID_OBJ_P(getThis());
-
- zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
-
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &serialized, &serialized_len) == FAILURE) {
- zend_restore_error_handling(&error_handling);
- return;
- }
- zend_restore_error_handling(&error_handling);
-
- PHP_VAR_UNSERIALIZE_INIT(var_hash);
- if (!php_var_unserialize(&props, (const unsigned char**) &serialized, (unsigned char*) serialized + serialized_len, &var_hash)) {
- zval_ptr_dtor(&props);
- phongo_throw_exception(PHONGO_ERROR_UNEXPECTED_VALUE, "%s unserialization failed", ZSTR_VAL(php_phongo_cursorid_ce->name));
-
- PHP_VAR_UNSERIALIZE_DESTROY(var_hash);
- return;
- }
- PHP_VAR_UNSERIALIZE_DESTROY(var_hash);
-
- php_phongo_cursorid_init_from_hash(intern, HASH_OF(&props));
- zval_ptr_dtor(&props);
-} /* }}} */
-
-/* {{{ MongoDB\Driver\CursorId function entries */
-ZEND_BEGIN_ARG_INFO_EX(ai_CursorId_unserialize, 0, 0, 1)
- ZEND_ARG_INFO(0, serialized)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(ai_CursorId_void, 0, 0, 0)
-ZEND_END_ARG_INFO()
-
-static zend_function_entry php_phongo_cursorid_me[] = {
- /* clang-format off */
- PHP_ME(CursorId, __toString, ai_CursorId_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
- PHP_ME(CursorId, serialize, ai_CursorId_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
- PHP_ME(CursorId, unserialize, ai_CursorId_unserialize, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
- ZEND_NAMED_ME(__construct, PHP_FN(MongoDB_disabled___construct), ai_CursorId_void, ZEND_ACC_PRIVATE | ZEND_ACC_FINAL)
- ZEND_NAMED_ME(__wakeup, PHP_FN(MongoDB_disabled___wakeup), ai_CursorId_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
- PHP_FE_END
- /* clang-format on */
-};
-/* }}} */
-
-/* {{{ MongoDB\Driver\CursorId object handlers */
-static zend_object_handlers php_phongo_handler_cursorid;
-
-static void php_phongo_cursorid_free_object(zend_object* object) /* {{{ */
-{
- php_phongo_cursorid_t* intern = Z_OBJ_CURSORID(object);
-
- zend_object_std_dtor(&intern->std);
-} /* }}} */
-
-static zend_object* php_phongo_cursorid_create_object(zend_class_entry* class_type) /* {{{ */
-{
- php_phongo_cursorid_t* intern = NULL;
-
- intern = PHONGO_ALLOC_OBJECT_T(php_phongo_cursorid_t, class_type);
-
- zend_object_std_init(&intern->std, class_type);
- object_properties_init(&intern->std, class_type);
-
- intern->std.handlers = &php_phongo_handler_cursorid;
-
- return &intern->std;
-} /* }}} */
-
-static HashTable* php_phongo_cursorid_get_debug_info(zval* object, int* is_temp) /* {{{ */
-{
- php_phongo_cursorid_t* intern;
- zval retval = ZVAL_STATIC_INIT;
-
- *is_temp = 1;
- intern = Z_CURSORID_OBJ_P(object);
-
- array_init(&retval);
-
-#if SIZEOF_ZEND_LONG == 4
- ADD_ASSOC_INT64_AS_STRING(&retval, "id", intern->id);
-#else
- ADD_ASSOC_LONG_EX(&retval, "id", intern->id);
-#endif
-
- return Z_ARRVAL(retval);
-} /* }}} */
-/* }}} */
-
-void php_phongo_cursorid_init_ce(INIT_FUNC_ARGS) /* {{{ */
-{
- zend_class_entry ce;
-
- INIT_NS_CLASS_ENTRY(ce, "MongoDB\\Driver", "CursorId", php_phongo_cursorid_me);
- php_phongo_cursorid_ce = zend_register_internal_class(&ce);
- php_phongo_cursorid_ce->create_object = php_phongo_cursorid_create_object;
- PHONGO_CE_FINAL(php_phongo_cursorid_ce);
-
- zend_class_implements(php_phongo_cursorid_ce, 1, zend_ce_serializable);
-
- memcpy(&php_phongo_handler_cursorid, phongo_get_std_object_handlers(), sizeof(zend_object_handlers));
- php_phongo_handler_cursorid.get_debug_info = php_phongo_cursorid_get_debug_info;
- php_phongo_handler_cursorid.free_obj = php_phongo_cursorid_free_object;
- php_phongo_handler_cursorid.offset = XtOffsetOf(php_phongo_cursorid_t, std);
-} /* }}} */
-
-/*
- * 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.8.1/src/MongoDB/Exception/CommandException.c b/mongodb-1.8.1/src/MongoDB/Exception/CommandException.c
deleted file mode 100644
index 017adab2..00000000
--- a/mongodb-1.8.1/src/MongoDB/Exception/CommandException.c
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Copyright 2018 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 <php.h>
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "phongo_compat.h"
-#include "php_phongo.h"
-
-zend_class_entry* php_phongo_commandexception_ce;
-
-/* {{{ proto document MongoDB\Driver\Exception\CommandException::getResultDocument()
- Returns the result document from the failed command. */
-static PHP_METHOD(CommandException, getResultDocument)
-{
- zval* resultdocument;
- zval rv;
-
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
-
- resultdocument = zend_read_property(php_phongo_commandexception_ce, getThis(), ZEND_STRL("resultDocument"), 0, &rv);
-
- RETURN_ZVAL(resultdocument, 1, 0);
-} /* }}} */
-
-/* {{{ MongoDB\Driver\Exception\CommandException function entries */
-ZEND_BEGIN_ARG_INFO_EX(ai_CommandException_void, 0, 0, 0)
-ZEND_END_ARG_INFO()
-
-static zend_function_entry php_phongo_commandexception_me[] = {
- /* clang-format off */
- PHP_ME(CommandException, getResultDocument, ai_CommandException_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
- PHP_FE_END
- /* clang-format on */
-};
-/* }}} */
-
-void php_phongo_commandexception_init_ce(INIT_FUNC_ARGS) /* {{{ */
-{
- zend_class_entry ce;
-
- INIT_NS_CLASS_ENTRY(ce, "MongoDB\\Driver\\Exception", "CommandException", php_phongo_commandexception_me);
- php_phongo_commandexception_ce = zend_register_internal_class_ex(&ce, php_phongo_serverexception_ce);
-
- zend_declare_property_null(php_phongo_commandexception_ce, ZEND_STRL("resultDocument"), ZEND_ACC_PROTECTED);
-} /* }}} */
-
-/*
- * 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.8.1/src/MongoDB/Exception/RuntimeException.c b/mongodb-1.8.1/src/MongoDB/Exception/RuntimeException.c
deleted file mode 100644
index e5090ad8..00000000
--- a/mongodb-1.8.1/src/MongoDB/Exception/RuntimeException.c
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * 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.
- */
-
-#include <php.h>
-#include <ext/spl/spl_exceptions.h>
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "phongo_compat.h"
-#include "php_phongo.h"
-#include "php_array_api.h"
-
-zend_class_entry* php_phongo_runtimeexception_ce;
-
-static bool php_phongo_has_string_array_element(zval* labels, char* label)
-{
- HashTable* ht_data;
-
- if (Z_TYPE_P(labels) != IS_ARRAY) {
- return false;
- }
-
- ht_data = HASH_OF(labels);
-
- {
- zval* z_label;
-
- ZEND_HASH_FOREACH_VAL_IND(ht_data, z_label)
- {
- if ((Z_TYPE_P(z_label) == IS_STRING) && (strcmp(Z_STRVAL_P(z_label), label) == 0)) {
- return true;
- }
- }
- ZEND_HASH_FOREACH_END();
- }
-
- return false;
-}
-
-/* {{{ proto bool MongoDB\Driver\Exception\RuntimeException::hasErrorLabel(string $label)
- Returns whether a specific error label has been set */
-static PHP_METHOD(RuntimeException, hasErrorLabel)
-{
- char* label;
- size_t label_len;
- zval* error_labels;
- zval rv;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &label, &label_len) == FAILURE) {
- return;
- }
-
- error_labels = zend_read_property(php_phongo_runtimeexception_ce, getThis(), ZEND_STRL("errorLabels"), 0, &rv);
-
- RETURN_BOOL(php_phongo_has_string_array_element(error_labels, label));
-} /* }}} */
-
-ZEND_BEGIN_ARG_INFO_EX(ai_RuntimeException_hasErrorLabel, 0, 0, 1)
- ZEND_ARG_INFO(0, label)
-ZEND_END_ARG_INFO()
-
-/* {{{ MongoDB\Driver\Exception\RuntimeException function entries */
-static zend_function_entry php_phongo_runtimeexception_me[] = {
- /* clang-format off */
- PHP_ME(RuntimeException, hasErrorLabel, ai_RuntimeException_hasErrorLabel, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
- PHP_FE_END
- /* clang-format on */
-};
-/* }}} */
-
-void php_phongo_runtimeexception_init_ce(INIT_FUNC_ARGS) /* {{{ */
-{
- zend_class_entry ce;
-
- INIT_NS_CLASS_ENTRY(ce, "MongoDB\\Driver\\Exception", "RuntimeException", php_phongo_runtimeexception_me);
- php_phongo_runtimeexception_ce = zend_register_internal_class_ex(&ce, spl_ce_RuntimeException);
- zend_class_implements(php_phongo_runtimeexception_ce, 1, php_phongo_exception_ce);
-
- zend_declare_property_null(php_phongo_runtimeexception_ce, ZEND_STRL("errorLabels"), ZEND_ACC_PROTECTED);
-} /* }}} */
-
-/*
- * 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.8.1/src/MongoDB/Exception/WriteException.c b/mongodb-1.8.1/src/MongoDB/Exception/WriteException.c
deleted file mode 100644
index 72f4a017..00000000
--- a/mongodb-1.8.1/src/MongoDB/Exception/WriteException.c
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * 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.
- */
-
-#include <php.h>
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "phongo_compat.h"
-#include "php_phongo.h"
-
-zend_class_entry* php_phongo_writeexception_ce;
-
-/* {{{ proto MongoDB\Driver\WriteResult MongoDB\Driver\Exception\WriteException::getWriteResult()
- Returns the WriteResult from the failed write operation. */
-static PHP_METHOD(WriteException, getWriteResult)
-{
- zval* writeresult;
- zval rv;
-
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
-
- writeresult = zend_read_property(php_phongo_writeexception_ce, getThis(), ZEND_STRL("writeResult"), 0, &rv);
-
- RETURN_ZVAL(writeresult, 1, 0);
-} /* }}} */
-
-/* {{{ MongoDB\Driver\Exception\WriteException function entries */
-ZEND_BEGIN_ARG_INFO_EX(ai_WriteException_void, 0, 0, 0)
-ZEND_END_ARG_INFO()
-
-static zend_function_entry php_phongo_writeexception_me[] = {
- /* clang-format off */
- PHP_ME(WriteException, getWriteResult, ai_WriteException_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
- PHP_FE_END
- /* clang-format on */
-};
-/* }}} */
-
-void php_phongo_writeexception_init_ce(INIT_FUNC_ARGS) /* {{{ */
-{
- zend_class_entry ce;
-
- INIT_NS_CLASS_ENTRY(ce, "MongoDB\\Driver\\Exception", "WriteException", php_phongo_writeexception_me);
- php_phongo_writeexception_ce = zend_register_internal_class_ex(&ce, php_phongo_serverexception_ce);
- php_phongo_writeexception_ce->ce_flags |= ZEND_ACC_EXPLICIT_ABSTRACT_CLASS;
-
- zend_declare_property_null(php_phongo_writeexception_ce, ZEND_STRL("writeResult"), ZEND_ACC_PROTECTED);
-} /* }}} */
-
-/*
- * 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.8.1/src/MongoDB/Manager.c b/mongodb-1.8.1/src/MongoDB/Manager.c
deleted file mode 100644
index 01cef7df..00000000
--- a/mongodb-1.8.1/src/MongoDB/Manager.c
+++ /dev/null
@@ -1,890 +0,0 @@
-/*
- * 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.
- */
-
-#include <php.h>
-#include <Zend/zend_hash.h>
-#include <Zend/zend_interfaces.h>
-#include <ext/standard/file.h>
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php_array_api.h"
-#include "phongo_compat.h"
-#include "php_phongo.h"
-#include "Session.h"
-
-#define PHONGO_MANAGER_URI_DEFAULT "mongodb://127.0.0.1/"
-
-/**
- * Manager abstracts a cluster of Server objects (i.e. socket connections).
- *
- * Typically, users will connect to a cluster using a URI, and the Manager will
- * perform tasks such as replica set discovery and create the necessary Server
- * objects. That said, it is also possible to create a Manager with an arbitrary
- * collection of Server objects using the static factory method (this can be
- * useful for testing or administration).
- *
- * Operation methods do not take socket-level options (e.g. socketTimeoutMS).
- * Those options should be specified during construction.
- */
-zend_class_entry* php_phongo_manager_ce;
-
-/* Checks if driverOptions contains a stream context resource in the "context"
- * key and incorporates any of its SSL options into the base array that did not
- * already exist (i.e. array union). The "context" key is then unset from the
- * base array.
- *
- * This handles the merging of any legacy SSL context options and also makes
- * driverOptions suitable for serialization by removing the resource zval. */
-static bool php_phongo_manager_merge_context_options(zval* zdriverOptions) /* {{{ */
-{
- php_stream_context* context;
- zval * zcontext, *zcontextOptions;
-
- if (!php_array_existsc(zdriverOptions, "context")) {
- return true;
- }
-
- zcontext = php_array_fetchc(zdriverOptions, "context");
- context = php_stream_context_from_zval(zcontext, 1);
-
- if (!context) {
- phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "\"context\" driver option is not a valid Stream-Context resource");
- return false;
- }
-
- zcontextOptions = php_array_fetchc_array(&context->options, "ssl");
-
- if (!zcontextOptions) {
- phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Stream-Context resource does not contain \"ssl\" options array");
- return false;
- }
-
- /* When running PHP in debug mode, php_error_docref duplicates the current
- * scope, leading to a COW violation in zend_hash_merge and
- * zend_symtable_str_del (called by php_array_unsetc). This macro allows
- * that violation in debug mode and is a NOOP when in non-debug. */
-#if PHP_VERSION_ID >= 70200
- HT_ALLOW_COW_VIOLATION(Z_ARRVAL_P(zdriverOptions));
-#endif
-
- php_error_docref(NULL, E_DEPRECATED, "The \"context\" driver option is deprecated.");
-
- /* Perform array union (see: add_function() in zend_operators.c) */
- zend_hash_merge(Z_ARRVAL_P(zdriverOptions), Z_ARRVAL_P(zcontextOptions), zval_add_ref, 0);
-
- php_array_unsetc(zdriverOptions, "context");
-
- return true;
-} /* }}} */
-
-/* Prepare authMechanismProperties for BSON encoding by converting a boolean
- * value for the "CANONICALIZE_HOST_NAME" option to a string.
- *
- * Note: URI options are case-insensitive, so we must iterate through the
- * HashTable in order to detect options. */
-static void php_phongo_manager_prep_authmechanismproperties(zval* properties) /* {{{ */
-{
- HashTable* ht_data;
-
- if (Z_TYPE_P(properties) != IS_ARRAY && Z_TYPE_P(properties) != IS_OBJECT) {
- return;
- }
-
- ht_data = HASH_OF(properties);
-
- {
- zend_string* string_key = NULL;
- zend_ulong num_key = 0;
- zval* property;
-
- ZEND_HASH_FOREACH_KEY_VAL_IND(ht_data, num_key, string_key, property)
- {
- if (!string_key) {
- continue;
- }
-
- /* URI options are case-insensitive */
- if (!strcasecmp(ZSTR_VAL(string_key), "CANONICALIZE_HOST_NAME")) {
- ZVAL_DEREF(property);
- if (Z_TYPE_P(property) != IS_STRING && zend_is_true(property)) {
- SEPARATE_ZVAL_NOREF(property);
- ZVAL_NEW_STR(property, zend_string_init(ZEND_STRL("true"), 0));
- }
- }
- }
- ZEND_HASH_FOREACH_END();
- }
-} /* }}} */
-
-/* Prepare URI options for BSON encoding.
- *
- * Read preference tag sets must be an array of documents. In order to ensure
- * that empty arrays serialize as empty documents, array elements will be
- * converted to objects. php_phongo_read_preference_tags_are_valid() handles
- * actual validation of the tag set structure.
- *
- * Auth mechanism properties must have string values, so a boolean true value
- * for the "CANONICALIZE_HOST_NAME" property will be converted to "true".
- *
- * Note: URI options are case-insensitive, so we must iterate through the
- * HashTable in order to detect options. */
-static void php_phongo_manager_prep_uri_options(zval* options) /* {{{ */
-{
- HashTable* ht_data;
-
- if (Z_TYPE_P(options) != IS_ARRAY) {
- return;
- }
-
- ht_data = HASH_OF(options);
-
- {
- zend_string* string_key = NULL;
- zend_ulong num_key = 0;
- zval* option;
-
- ZEND_HASH_FOREACH_KEY_VAL_IND(ht_data, num_key, string_key, option)
- {
- if (!string_key) {
- continue;
- }
-
- if (!strcasecmp(ZSTR_VAL(string_key), MONGOC_URI_READPREFERENCETAGS)) {
- ZVAL_DEREF(option);
- SEPARATE_ZVAL_NOREF(option);
- php_phongo_read_preference_prep_tagsets(option);
- continue;
- }
-
- if (!strcasecmp(ZSTR_VAL(string_key), MONGOC_URI_AUTHMECHANISMPROPERTIES)) {
- ZVAL_DEREF(option);
- SEPARATE_ZVAL_NOREF(option);
- php_phongo_manager_prep_authmechanismproperties(option);
- continue;
- }
- }
- ZEND_HASH_FOREACH_END();
- }
-} /* }}} */
-
-/* Selects a server for an execute method. If "for_writes" is true, a primary
- * will be selected. Otherwise, a read preference will be used to select the
- * server. If zreadPreference is NULL, the client's read preference will be
- * used. If zsession is a session object in a sharded transaction, the session
- * will be checked whether it is pinned to a server. If so, that server will be
- * selected. Otherwise, server selection
- *
- * On success, server_id will be set and the function will return true;
- * otherwise, false is returned and an exception is thrown. */
-static bool php_phongo_manager_select_server(bool for_writes, bool inherit_read_preference, zval* zreadPreference, zval* zsession, mongoc_client_t* client, uint32_t* server_id) /* {{{ */
-{
- mongoc_server_description_t* selected_server;
- const mongoc_read_prefs_t* read_preference = NULL;
- bson_error_t error = { 0 };
-
- if (zsession) {
- const mongoc_client_session_t* session = Z_SESSION_OBJ_P(zsession)->client_session;
-
- /* Attempt to fetch server pinned to session */
- if (mongoc_client_session_get_server_id(session) > 0) {
- *server_id = mongoc_client_session_get_server_id(session);
-
- return true;
- }
- }
-
- if (!for_writes) {
- if (zreadPreference) {
- read_preference = phongo_read_preference_from_zval(zreadPreference);
- } else if (inherit_read_preference) {
- read_preference = mongoc_client_get_read_prefs(client);
- }
- }
-
- selected_server = mongoc_client_select_server(client, for_writes, read_preference, &error);
-
- if (selected_server) {
- *server_id = mongoc_server_description_id(selected_server);
- mongoc_server_description_destroy(selected_server);
-
- return true;
- }
-
- /* Check for connection related exceptions */
- if (!EG(exception)) {
- phongo_throw_exception_from_bson_error_t(&error);
- }
-
- return false;
-} /* }}} */
-
-/* {{{ proto void MongoDB\Driver\Manager::__construct([string $uri = "mongodb://127.0.0.1/"[, array $options = array()[, array $driverOptions = array()]]])
- Constructs a new Manager */
-static PHP_METHOD(Manager, __construct)
-{
- php_phongo_manager_t* intern;
- zend_error_handling error_handling;
- char* uri_string = NULL;
- size_t uri_string_len = 0;
- zval* options = NULL;
- zval* driverOptions = NULL;
-
- zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
-
- intern = Z_MANAGER_OBJ_P(getThis());
-
- /* Separate the options and driverOptions zvals, since we may end up
- * modifying them in php_phongo_manager_prep_uri_options() and
- * php_phongo_manager_merge_context_options() below, respectively. */
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "|s!a/!a/!", &uri_string, &uri_string_len, &options, &driverOptions) == FAILURE) {
- zend_restore_error_handling(&error_handling);
- return;
- }
- zend_restore_error_handling(&error_handling);
-
- if (options) {
- php_phongo_manager_prep_uri_options(options);
- }
-
- if (driverOptions && !php_phongo_manager_merge_context_options(driverOptions)) {
- /* Exception should already have been thrown */
- return;
- }
-
- phongo_manager_init(intern, uri_string ? uri_string : PHONGO_MANAGER_URI_DEFAULT, options, driverOptions);
-
- if (intern->client) {
- php_phongo_set_monitoring_callbacks(intern->client);
- }
-} /* }}} */
-
-/* {{{ proto MongoDB\Driver\ClientEncryption MongoDB\Driver\Manager::createClientEncryption(array $options)
- Return a ClientEncryption instance */
-static PHP_METHOD(Manager, createClientEncryption)
-{
- php_phongo_manager_t* intern;
- php_phongo_clientencryption_t* clientencryption;
- zval* options;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "a", &options) == FAILURE) {
- return;
- }
-
- intern = Z_MANAGER_OBJ_P(getThis());
-
- object_init_ex(return_value, php_phongo_clientencryption_ce);
- clientencryption = Z_CLIENTENCRYPTION_OBJ_P(return_value);
-
- phongo_clientencryption_init(clientencryption, intern->client, options);
-} /* }}} */
-
-/* {{{ proto MongoDB\Driver\Cursor MongoDB\Driver\Manager::executeCommand(string $db, MongoDB\Driver\Command $command[, array $options = null])
- Execute a Command */
-static PHP_METHOD(Manager, executeCommand)
-{
- php_phongo_manager_t* intern;
- char* db;
- size_t db_len;
- zval* command;
- zval* options = NULL;
- bool free_options = false;
- zval* zreadPreference = NULL;
- zval* zsession = NULL;
- uint32_t server_id = 0;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "sO|z!", &db, &db_len, &command, php_phongo_command_ce, &options) == FAILURE) {
- return;
- }
-
- intern = Z_MANAGER_OBJ_P(getThis());
-
- options = php_phongo_prep_legacy_option(options, "readPreference", &free_options);
-
- if (!phongo_parse_session(options, intern->client, NULL, &zsession)) {
- /* Exception should already have been thrown */
- goto cleanup;
- }
-
- if (!phongo_parse_read_preference(options, &zreadPreference)) {
- /* Exception should already have been thrown */
- goto cleanup;
- }
-
- if (!php_phongo_manager_select_server(false, false, zreadPreference, zsession, intern->client, &server_id)) {
- /* Exception should already have been thrown */
- goto cleanup;
- }
-
- /* If the Manager was created in a different process, reset the client so
- * that cursors created by this process can be differentiated and its
- * session pool is cleared. */
- PHONGO_RESET_CLIENT_IF_PID_DIFFERS(intern);
-
- phongo_execute_command(intern->client, PHONGO_COMMAND_RAW, db, command, options, server_id, return_value);
-
-cleanup:
- if (free_options) {
- php_phongo_prep_legacy_option_free(options);
- }
-} /* }}} */
-
-/* {{{ proto MongoDB\Driver\Cursor MongoDB\Driver\Manager::executeReadCommand(string $db, MongoDB\Driver\Command $command[, array $options = null])
- Execute a ReadCommand */
-static PHP_METHOD(Manager, executeReadCommand)
-{
- php_phongo_manager_t* intern;
- char* db;
- size_t db_len;
- zval* command;
- zval* options = NULL;
- zval* zreadPreference = NULL;
- uint32_t server_id = 0;
- zval* zsession = NULL;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "sO|a!", &db, &db_len, &command, php_phongo_command_ce, &options) == FAILURE) {
- return;
- }
-
- intern = Z_MANAGER_OBJ_P(getThis());
-
- if (!phongo_parse_session(options, intern->client, NULL, &zsession)) {
- /* Exception should already have been thrown */
- return;
- }
-
- if (!phongo_parse_read_preference(options, &zreadPreference)) {
- /* Exception should already have been thrown */
- return;
- }
-
- if (!php_phongo_manager_select_server(false, true, zreadPreference, zsession, intern->client, &server_id)) {
- /* Exception should already have been thrown */
- return;
- }
-
- /* If the Manager was created in a different process, reset the client so
- * that cursors created by this process can be differentiated and its
- * session pool is cleared. */
- PHONGO_RESET_CLIENT_IF_PID_DIFFERS(intern);
-
- phongo_execute_command(intern->client, PHONGO_COMMAND_READ, db, command, options, server_id, return_value);
-} /* }}} */
-
-/* {{{ proto MongoDB\Driver\Cursor MongoDB\Driver\Manager::executeWriteCommand(string $db, MongoDB\Driver\Command $command[, array $options = null])
- Execute a WriteCommand */
-static PHP_METHOD(Manager, executeWriteCommand)
-{
- php_phongo_manager_t* intern;
- char* db;
- size_t db_len;
- zval* command;
- zval* options = NULL;
- uint32_t server_id = 0;
- zval* zsession = NULL;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "sO|a!", &db, &db_len, &command, php_phongo_command_ce, &options) == FAILURE) {
- return;
- }
-
- intern = Z_MANAGER_OBJ_P(getThis());
-
- if (!phongo_parse_session(options, intern->client, NULL, &zsession)) {
- /* Exception should already have been thrown */
- return;
- }
-
- if (!php_phongo_manager_select_server(true, false, NULL, zsession, intern->client, &server_id)) {
- /* Exception should already have been thrown */
- return;
- }
-
- /* If the Manager was created in a different process, reset the client so
- * that cursors created by this process can be differentiated and its
- * session pool is cleared. */
- PHONGO_RESET_CLIENT_IF_PID_DIFFERS(intern);
-
- phongo_execute_command(intern->client, PHONGO_COMMAND_WRITE, db, command, options, server_id, return_value);
-} /* }}} */
-
-/* {{{ proto MongoDB\Driver\Cursor MongoDB\Driver\Manager::executeReadWriteCommand(string $db, MongoDB\Driver\Command $command[, array $options = null])
- Execute a ReadWriteCommand */
-static PHP_METHOD(Manager, executeReadWriteCommand)
-{
- php_phongo_manager_t* intern;
- char* db;
- size_t db_len;
- zval* command;
- zval* options = NULL;
- uint32_t server_id = 0;
- zval* zsession = NULL;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "sO|a!", &db, &db_len, &command, php_phongo_command_ce, &options) == FAILURE) {
- return;
- }
-
- intern = Z_MANAGER_OBJ_P(getThis());
-
- if (!phongo_parse_session(options, intern->client, NULL, &zsession)) {
- /* Exception should already have been thrown */
- return;
- }
-
- if (!php_phongo_manager_select_server(true, false, NULL, zsession, intern->client, &server_id)) {
- /* Exception should already have been thrown */
- return;
- }
-
- /* If the Manager was created in a different process, reset the client so
- * that cursors created by this process can be differentiated and its
- * session pool is cleared. */
- PHONGO_RESET_CLIENT_IF_PID_DIFFERS(intern);
-
- phongo_execute_command(intern->client, PHONGO_COMMAND_READ_WRITE, db, command, options, server_id, return_value);
-} /* }}} */
-
-/* {{{ proto MongoDB\Driver\Cursor MongoDB\Driver\Manager::executeQuery(string $namespace, MongoDB\Driver\Query $query[, array $options = null])
- Execute a Query */
-static PHP_METHOD(Manager, executeQuery)
-{
- php_phongo_manager_t* intern;
- char* namespace;
- size_t namespace_len;
- zval* query;
- zval* options = NULL;
- bool free_options = false;
- zval* zreadPreference = NULL;
- uint32_t server_id = 0;
- zval* zsession = NULL;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "sO|z!", &namespace, &namespace_len, &query, php_phongo_query_ce, &options) == FAILURE) {
- return;
- }
-
- intern = Z_MANAGER_OBJ_P(getThis());
-
- options = php_phongo_prep_legacy_option(options, "readPreference", &free_options);
-
- if (!phongo_parse_session(options, intern->client, NULL, &zsession)) {
- /* Exception should already have been thrown */
- goto cleanup;
- }
-
- if (!phongo_parse_read_preference(options, &zreadPreference)) {
- /* Exception should already have been thrown */
- goto cleanup;
- }
-
- if (!php_phongo_manager_select_server(false, true, zreadPreference, zsession, intern->client, &server_id)) {
- /* Exception should already have been thrown */
- goto cleanup;
- }
-
- /* If the Manager was created in a different process, reset the client so
- * that cursors created by this process can be differentiated and its
- * session pool is cleared. */
- PHONGO_RESET_CLIENT_IF_PID_DIFFERS(intern);
-
- phongo_execute_query(intern->client, namespace, query, options, server_id, return_value);
-
-cleanup:
- if (free_options) {
- php_phongo_prep_legacy_option_free(options);
- }
-} /* }}} */
-
-/* {{{ proto MongoDB\Driver\WriteResult MongoDB\Driver\Manager::executeBulkWrite(string $namespace, MongoDB\Driver\BulkWrite $zbulk[, array $options = null])
- Executes a BulkWrite (i.e. any number of insert, update, and delete ops) */
-static PHP_METHOD(Manager, executeBulkWrite)
-{
- php_phongo_manager_t* intern;
- char* namespace;
- size_t namespace_len;
- zval* zbulk;
- php_phongo_bulkwrite_t* bulk;
- zval* options = NULL;
- bool free_options = false;
- uint32_t server_id = 0;
- zval* zsession = NULL;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "sO|z!", &namespace, &namespace_len, &zbulk, php_phongo_bulkwrite_ce, &options) == FAILURE) {
- return;
- }
-
- intern = Z_MANAGER_OBJ_P(getThis());
- bulk = Z_BULKWRITE_OBJ_P(zbulk);
-
- options = php_phongo_prep_legacy_option(options, "writeConcern", &free_options);
-
- if (!phongo_parse_session(options, intern->client, NULL, &zsession)) {
- /* Exception should already have been thrown */
- return;
- }
-
- if (!php_phongo_manager_select_server(true, false, NULL, zsession, intern->client, &server_id)) {
- /* Exception should already have been thrown */
- goto cleanup;
- }
-
- /* If the Server was created in a different process, reset the client so
- * that its session pool is cleared. */
- PHONGO_RESET_CLIENT_IF_PID_DIFFERS(intern);
-
- phongo_execute_bulk_write(intern->client, namespace, bulk, options, server_id, return_value);
-
-cleanup:
- if (free_options) {
- php_phongo_prep_legacy_option_free(options);
- }
-} /* }}} */
-
-/* {{{ proto MongoDB\Driver\ReadConcern MongoDB\Driver\Manager::getReadConcern()
- Returns the ReadConcern associated with this Manager */
-static PHP_METHOD(Manager, getReadConcern)
-{
- php_phongo_manager_t* intern;
-
- intern = Z_MANAGER_OBJ_P(getThis());
-
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
-
- phongo_readconcern_init(return_value, mongoc_client_get_read_concern(intern->client));
-} /* }}} */
-
-/* {{{ proto MongoDB\Driver\ReadPreference MongoDB\Driver\Manager::getReadPreference()
- Returns the ReadPreference associated with this Manager */
-static PHP_METHOD(Manager, getReadPreference)
-{
- php_phongo_manager_t* intern;
-
- intern = Z_MANAGER_OBJ_P(getThis());
-
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
-
- phongo_readpreference_init(return_value, mongoc_client_get_read_prefs(intern->client));
-} /* }}} */
-
-/* {{{ proto MongoDB\Driver\Server[] MongoDB\Driver\Manager::getServers()
- Returns the Servers associated with this Manager */
-static PHP_METHOD(Manager, getServers)
-{
- php_phongo_manager_t* intern;
- mongoc_server_description_t** sds;
- size_t i, n = 0;
-
- intern = Z_MANAGER_OBJ_P(getThis());
-
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
-
- sds = mongoc_client_get_server_descriptions(intern->client, &n);
- array_init_size(return_value, n);
-
- for (i = 0; i < n; i++) {
- zval obj;
-
- phongo_server_init(&obj, intern->client, mongoc_server_description_id(sds[i]));
- add_next_index_zval(return_value, &obj);
- }
-
- mongoc_server_descriptions_destroy_all(sds, n);
-} /* }}} */
-
-/* {{{ proto MongoDB\Driver\WriteConcern MongoDB\Driver\Manager::getWriteConcern()
- Returns the WriteConcern associated with this Manager */
-static PHP_METHOD(Manager, getWriteConcern)
-{
- php_phongo_manager_t* intern;
-
- intern = Z_MANAGER_OBJ_P(getThis());
-
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
-
- phongo_writeconcern_init(return_value, mongoc_client_get_write_concern(intern->client));
-} /* }}} */
-
-/* {{{ proto MongoDB\Driver\Server MongoDB\Driver\Manager::selectServers(MongoDB\Driver\ReadPreference $readPreference)
- Returns a suitable Server for the given ReadPreference */
-static PHP_METHOD(Manager, selectServer)
-{
- php_phongo_manager_t* intern;
- zval* zreadPreference = NULL;
- uint32_t server_id = 0;
-
- intern = Z_MANAGER_OBJ_P(getThis());
-
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "O", &zreadPreference, php_phongo_readpreference_ce) == FAILURE) {
- return;
- }
-
- if (!php_phongo_manager_select_server(false, true, zreadPreference, NULL, intern->client, &server_id)) {
- /* Exception should already have been thrown */
- return;
- }
-
- phongo_server_init(return_value, intern->client, server_id);
-} /* }}} */
-
-/* {{{ proto MongoDB\Driver\Session MongoDB\Driver\Manager::startSession([array $options = null])
- Returns a new client session */
-static PHP_METHOD(Manager, startSession)
-{
- php_phongo_manager_t* intern;
- zval* options = NULL;
- mongoc_session_opt_t* cs_opts = NULL;
- mongoc_client_session_t* cs;
- bson_error_t error = { 0 };
- mongoc_transaction_opt_t* txn_opts = NULL;
-
- intern = Z_MANAGER_OBJ_P(getThis());
-
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "|a!", &options) == FAILURE) {
- return;
- }
-
- if (options && php_array_existsc(options, "causalConsistency")) {
- cs_opts = mongoc_session_opts_new();
- mongoc_session_opts_set_causal_consistency(cs_opts, php_array_fetchc_bool(options, "causalConsistency"));
- }
-
- if (options && php_array_existsc(options, "defaultTransactionOptions")) {
- zval* txn_options = php_array_fetchc(options, "defaultTransactionOptions");
-
- /* Thrown exception and return if the defaultTransactionOptions is not an array */
- if (Z_TYPE_P(txn_options) != IS_ARRAY) {
- phongo_throw_exception(
- PHONGO_ERROR_INVALID_ARGUMENT,
- "Expected \"defaultTransactionOptions\" option to be an array, %s given",
- PHONGO_ZVAL_CLASS_OR_TYPE_NAME_P(txn_options));
- goto cleanup;
- }
-
- /* Parse transaction options */
- txn_opts = php_mongodb_session_parse_transaction_options(txn_options);
-
- /* If an exception is thrown while parsing, the txn_opts struct is also
- * NULL, so no need to free it here */
- if (EG(exception)) {
- goto cleanup;
- }
-
- /* If the options are non-empty, add them to the client session opts struct */
- if (txn_opts) {
- if (!cs_opts) {
- cs_opts = mongoc_session_opts_new();
- }
-
- mongoc_session_opts_set_default_transaction_opts(cs_opts, txn_opts);
- mongoc_transaction_opts_destroy(txn_opts);
- }
- }
-
- /* If the Manager was created in a different process, reset the client so
- * that its session pool is cleared. This will ensure that we do not re-use
- * a server session (i.e. LSID) created by a parent process. */
- PHONGO_RESET_CLIENT_IF_PID_DIFFERS(intern);
-
- cs = mongoc_client_start_session(intern->client, cs_opts, &error);
-
- if (cs) {
- phongo_session_init(return_value, cs);
- } else {
- phongo_throw_exception_from_bson_error_t(&error);
- }
-
-cleanup:
- if (cs_opts) {
- mongoc_session_opts_destroy(cs_opts);
- }
-} /* }}} */
-
-/* {{{ MongoDB\Driver\Manager function entries */
-ZEND_BEGIN_ARG_INFO_EX(ai_Manager___construct, 0, 0, 0)
- ZEND_ARG_INFO(0, uri)
- ZEND_ARG_ARRAY_INFO(0, options, 0)
- ZEND_ARG_ARRAY_INFO(0, driverOptions, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(ai_Manager_createClientEncryption, 0, 0, 1)
- ZEND_ARG_ARRAY_INFO(0, options, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(ai_Manager_executeCommand, 0, 0, 2)
- ZEND_ARG_INFO(0, db)
- ZEND_ARG_OBJ_INFO(0, command, MongoDB\\Driver\\Command, 0)
- ZEND_ARG_INFO(0, options)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(ai_Manager_executeRWCommand, 0, 0, 2)
- ZEND_ARG_INFO(0, db)
- ZEND_ARG_OBJ_INFO(0, command, MongoDB\\Driver\\Command, 0)
- ZEND_ARG_ARRAY_INFO(0, options, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(ai_Manager_executeQuery, 0, 0, 2)
- ZEND_ARG_INFO(0, namespace)
- ZEND_ARG_OBJ_INFO(0, zquery, MongoDB\\Driver\\Query, 0)
- ZEND_ARG_INFO(0, options)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(ai_Manager_executeBulkWrite, 0, 0, 2)
- ZEND_ARG_INFO(0, namespace)
- ZEND_ARG_OBJ_INFO(0, zbulk, MongoDB\\Driver\\BulkWrite, 0)
- ZEND_ARG_INFO(0, options)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(ai_Manager_selectServer, 0, 0, 1)
- ZEND_ARG_OBJ_INFO(0, readPreference, MongoDB\\Driver\\ReadPreference, 1)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(ai_Manager_startSession, 0, 0, 0)
- ZEND_ARG_ARRAY_INFO(0, options, 1)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(ai_Manager_void, 0, 0, 0)
-ZEND_END_ARG_INFO()
-
-static zend_function_entry php_phongo_manager_me[] = {
- /* clang-format off */
- PHP_ME(Manager, __construct, ai_Manager___construct, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
- PHP_ME(Manager, createClientEncryption, ai_Manager_createClientEncryption, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
- PHP_ME(Manager, executeCommand, ai_Manager_executeCommand, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
- PHP_ME(Manager, executeReadCommand, ai_Manager_executeRWCommand, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
- PHP_ME(Manager, executeWriteCommand, ai_Manager_executeRWCommand, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
- PHP_ME(Manager, executeReadWriteCommand, ai_Manager_executeCommand, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
- PHP_ME(Manager, executeQuery, ai_Manager_executeQuery, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
- PHP_ME(Manager, executeBulkWrite, ai_Manager_executeBulkWrite, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
- PHP_ME(Manager, getReadConcern, ai_Manager_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
- PHP_ME(Manager, getReadPreference, ai_Manager_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
- PHP_ME(Manager, getServers, ai_Manager_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
- PHP_ME(Manager, getWriteConcern, ai_Manager_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
- PHP_ME(Manager, selectServer, ai_Manager_selectServer, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
- PHP_ME(Manager, startSession, ai_Manager_startSession, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
- ZEND_NAMED_ME(__wakeup, PHP_FN(MongoDB_disabled___wakeup), ai_Manager_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
- PHP_FE_END
- /* clang-format on */
-};
-/* }}} */
-
-/* {{{ MongoDB\Driver\Manager object handlers */
-static zend_object_handlers php_phongo_handler_manager;
-
-static void php_phongo_manager_free_object(zend_object* object) /* {{{ */
-{
- php_phongo_manager_t* intern = Z_OBJ_MANAGER(object);
-
- zend_object_std_dtor(&intern->std);
-
- if (intern->client) {
- MONGOC_DEBUG("Not destroying persistent client for Manager");
- intern->client = NULL;
- }
-
- if (intern->client_hash) {
- efree(intern->client_hash);
- }
-} /* }}} */
-
-static zend_object* php_phongo_manager_create_object(zend_class_entry* class_type) /* {{{ */
-{
- php_phongo_manager_t* intern = NULL;
-
- intern = PHONGO_ALLOC_OBJECT_T(php_phongo_manager_t, class_type);
-
- zend_object_std_init(&intern->std, class_type);
- object_properties_init(&intern->std, class_type);
-
- PHONGO_SET_CREATED_BY_PID(intern);
-
- intern->std.handlers = &php_phongo_handler_manager;
-
- return &intern->std;
-} /* }}} */
-
-static HashTable* php_phongo_manager_get_debug_info(zval* object, int* is_temp) /* {{{ */
-{
- php_phongo_manager_t* intern;
- mongoc_server_description_t** sds;
- size_t i, n = 0;
- zval retval = ZVAL_STATIC_INIT;
- zval cluster;
-
- *is_temp = 1;
- intern = Z_MANAGER_OBJ_P(object);
-
- array_init_size(&retval, 2);
-
- ADD_ASSOC_STRING(&retval, "uri", mongoc_uri_get_string(mongoc_client_get_uri(intern->client)));
-
- sds = mongoc_client_get_server_descriptions(intern->client, &n);
-
- array_init_size(&cluster, n);
-
- for (i = 0; i < n; i++) {
- zval obj;
-
- if (!php_phongo_server_to_zval(&obj, sds[i])) {
- /* Exception already thrown */
- zval_ptr_dtor(&obj);
- zval_ptr_dtor(&cluster);
- goto done;
- }
-
- add_next_index_zval(&cluster, &obj);
- }
-
- ADD_ASSOC_ZVAL_EX(&retval, "cluster", &cluster);
-
-done:
- mongoc_server_descriptions_destroy_all(sds, n);
-
- return Z_ARRVAL(retval);
-} /* }}} */
-/* }}} */
-
-void php_phongo_manager_init_ce(INIT_FUNC_ARGS) /* {{{ */
-{
- zend_class_entry ce;
-
- INIT_NS_CLASS_ENTRY(ce, "MongoDB\\Driver", "Manager", php_phongo_manager_me);
- php_phongo_manager_ce = zend_register_internal_class(&ce);
- php_phongo_manager_ce->create_object = php_phongo_manager_create_object;
- PHONGO_CE_FINAL(php_phongo_manager_ce);
- PHONGO_CE_DISABLE_SERIALIZATION(php_phongo_manager_ce);
-
- memcpy(&php_phongo_handler_manager, phongo_get_std_object_handlers(), sizeof(zend_object_handlers));
- php_phongo_handler_manager.get_debug_info = php_phongo_manager_get_debug_info;
- php_phongo_handler_manager.free_obj = php_phongo_manager_free_object;
- php_phongo_handler_manager.offset = XtOffsetOf(php_phongo_manager_t, std);
-} /* }}} */
-
-/*
- * 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.8.1/src/MongoDB/Monitoring/CommandFailedEvent.c b/mongodb-1.8.1/src/MongoDB/Monitoring/CommandFailedEvent.c
deleted file mode 100644
index e865b1f0..00000000
--- a/mongodb-1.8.1/src/MongoDB/Monitoring/CommandFailedEvent.c
+++ /dev/null
@@ -1,277 +0,0 @@
-/*
- * Copyright 2016-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.
- */
-
-#include <php.h>
-#include <Zend/zend_interfaces.h>
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "phongo_compat.h"
-#include "php_phongo.h"
-
-zend_class_entry* php_phongo_commandfailedevent_ce;
-
-/* {{{ proto string CommandFailedEvent::getCommandName()
- Returns the command name for this event */
-PHP_METHOD(CommandFailedEvent, getCommandName)
-{
- php_phongo_commandfailedevent_t* intern;
-
- intern = Z_COMMANDFAILEDEVENT_OBJ_P(getThis());
-
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
-
- RETVAL_STRING(intern->command_name);
-} /* }}} */
-
-/* {{{ proto int CommandFailedEvent::getDurationMicros()
- Returns the event's duration in microseconds */
-PHP_METHOD(CommandFailedEvent, getDurationMicros)
-{
- php_phongo_commandfailedevent_t* intern;
-
- intern = Z_COMMANDFAILEDEVENT_OBJ_P(getThis());
-
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
-
- RETURN_LONG(intern->duration_micros);
-} /* }}} */
-
-/* {{{ proto Exception CommandFailedEvent::getError()
- Returns the error document associated with the event */
-PHP_METHOD(CommandFailedEvent, getError)
-{
- php_phongo_commandfailedevent_t* intern;
-
- intern = Z_COMMANDFAILEDEVENT_OBJ_P(getThis());
-
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
-
- RETURN_ZVAL(&intern->z_error, 1, 0);
-} /* }}} */
-
-/* {{{ proto string CommandFailedEvent::getOperationId()
- Returns the event's operation ID */
-PHP_METHOD(CommandFailedEvent, getOperationId)
-{
- php_phongo_commandfailedevent_t* intern;
- char int_as_string[20];
-
- intern = Z_COMMANDFAILEDEVENT_OBJ_P(getThis());
-
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
-
- sprintf(int_as_string, "%" PRIu64, intern->operation_id);
- RETVAL_STRING(int_as_string);
-} /* }}} */
-
-/* {{{ proto stdClass CommandFailedEvent::getReply()
- Returns the reply document associated with the event */
-PHP_METHOD(CommandFailedEvent, getReply)
-{
- php_phongo_commandfailedevent_t* intern;
- php_phongo_bson_state state;
-
- PHONGO_BSON_INIT_STATE(state);
-
- intern = Z_COMMANDFAILEDEVENT_OBJ_P(getThis());
-
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
-
- if (!php_phongo_bson_to_zval_ex(bson_get_data(intern->reply), intern->reply->len, &state)) {
- zval_ptr_dtor(&state.zchild);
- return;
- }
-
- RETURN_ZVAL(&state.zchild, 0, 1);
-} /* }}} */
-
-/* {{{ proto string CommandFailedEvent::getRequestId()
- Returns the event's request ID */
-PHP_METHOD(CommandFailedEvent, getRequestId)
-{
- php_phongo_commandfailedevent_t* intern;
- char int_as_string[20];
-
- intern = Z_COMMANDFAILEDEVENT_OBJ_P(getThis());
-
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
-
- sprintf(int_as_string, "%" PRIu64, intern->request_id);
- RETVAL_STRING(int_as_string);
-} /* }}} */
-
-/* {{{ proto MongoDB\Driver\Server CommandFailedEvent::getServer()
- Returns the Server from which the event originated */
-PHP_METHOD(CommandFailedEvent, getServer)
-{
- php_phongo_commandfailedevent_t* intern;
-
- intern = Z_COMMANDFAILEDEVENT_OBJ_P(getThis());
-
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
-
- phongo_server_init(return_value, intern->client, intern->server_id);
-} /* }}} */
-
-/**
- * Event thrown when a command has failed to execute.
- *
- * This class is only constructed internally.
- */
-
-/* {{{ MongoDB\Driver\Monitoring\CommandFailedEvent function entries */
-ZEND_BEGIN_ARG_INFO_EX(ai_CommandFailedEvent_void, 0, 0, 0)
-ZEND_END_ARG_INFO()
-
-static zend_function_entry php_phongo_commandfailedevent_me[] = {
- /* clang-format off */
- ZEND_NAMED_ME(__construct, PHP_FN(MongoDB_disabled___construct), ai_CommandFailedEvent_void, ZEND_ACC_PRIVATE | ZEND_ACC_FINAL)
- PHP_ME(CommandFailedEvent, getCommandName, ai_CommandFailedEvent_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
- PHP_ME(CommandFailedEvent, getError, ai_CommandFailedEvent_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
- PHP_ME(CommandFailedEvent, getDurationMicros, ai_CommandFailedEvent_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
- PHP_ME(CommandFailedEvent, getOperationId, ai_CommandFailedEvent_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
- PHP_ME(CommandFailedEvent, getReply, ai_CommandFailedEvent_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
- PHP_ME(CommandFailedEvent, getRequestId, ai_CommandFailedEvent_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
- PHP_ME(CommandFailedEvent, getServer, ai_CommandFailedEvent_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
- ZEND_NAMED_ME(__wakeup, PHP_FN(MongoDB_disabled___wakeup), ai_CommandFailedEvent_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
- PHP_FE_END
- /* clang-format on */
-};
-/* }}} */
-
-/* {{{ MongoDB\Driver\Monitoring\CommandFailedEvent object handlers */
-static zend_object_handlers php_phongo_handler_commandfailedevent;
-
-static void php_phongo_commandfailedevent_free_object(zend_object* object) /* {{{ */
-{
- php_phongo_commandfailedevent_t* intern = Z_OBJ_COMMANDFAILEDEVENT(object);
-
- zend_object_std_dtor(&intern->std);
-
- if (!Z_ISUNDEF(intern->z_error)) {
- zval_ptr_dtor(&intern->z_error);
- }
-
- if (intern->reply) {
- bson_destroy(intern->reply);
- }
-
- if (intern->command_name) {
- efree(intern->command_name);
- }
-} /* }}} */
-
-static zend_object* php_phongo_commandfailedevent_create_object(zend_class_entry* class_type) /* {{{ */
-{
- php_phongo_commandfailedevent_t* intern = NULL;
-
- intern = PHONGO_ALLOC_OBJECT_T(php_phongo_commandfailedevent_t, class_type);
-
- zend_object_std_init(&intern->std, class_type);
- object_properties_init(&intern->std, class_type);
-
- intern->std.handlers = &php_phongo_handler_commandfailedevent;
-
- return &intern->std;
-} /* }}} */
-
-static HashTable* php_phongo_commandfailedevent_get_debug_info(zval* object, int* is_temp) /* {{{ */
-{
- php_phongo_commandfailedevent_t* intern;
- zval retval = ZVAL_STATIC_INIT;
- char operation_id[20], request_id[20];
- php_phongo_bson_state reply_state;
-
- PHONGO_BSON_INIT_STATE(reply_state);
-
- intern = Z_COMMANDFAILEDEVENT_OBJ_P(object);
- *is_temp = 1;
- array_init_size(&retval, 6);
-
- ADD_ASSOC_STRING(&retval, "commandName", intern->command_name);
- ADD_ASSOC_INT64(&retval, "durationMicros", (int64_t) intern->duration_micros);
-
- ADD_ASSOC_ZVAL_EX(&retval, "error", &intern->z_error);
- Z_ADDREF(intern->z_error);
-
- sprintf(operation_id, "%" PRIu64, intern->operation_id);
- ADD_ASSOC_STRING(&retval, "operationId", operation_id);
-
- if (!php_phongo_bson_to_zval_ex(bson_get_data(intern->reply), intern->reply->len, &reply_state)) {
- zval_ptr_dtor(&reply_state.zchild);
- goto done;
- }
-
- ADD_ASSOC_ZVAL(&retval, "reply", &reply_state.zchild);
-
- sprintf(request_id, "%" PRIu64, intern->request_id);
- ADD_ASSOC_STRING(&retval, "requestId", request_id);
-
- {
- zval server;
-
- phongo_server_init(&server, intern->client, intern->server_id);
- ADD_ASSOC_ZVAL_EX(&retval, "server", &server);
- }
-
-done:
- return Z_ARRVAL(retval);
-} /* }}} */
-/* }}} */
-
-void php_phongo_commandfailedevent_init_ce(INIT_FUNC_ARGS) /* {{{ */
-{
- zend_class_entry ce;
- (void) type;
- (void) module_number;
-
- INIT_NS_CLASS_ENTRY(ce, "MongoDB\\Driver\\Monitoring", "CommandFailedEvent", php_phongo_commandfailedevent_me);
- php_phongo_commandfailedevent_ce = zend_register_internal_class(&ce);
- php_phongo_commandfailedevent_ce->create_object = php_phongo_commandfailedevent_create_object;
- PHONGO_CE_FINAL(php_phongo_commandfailedevent_ce);
- PHONGO_CE_DISABLE_SERIALIZATION(php_phongo_commandfailedevent_ce);
-
- memcpy(&php_phongo_handler_commandfailedevent, phongo_get_std_object_handlers(), sizeof(zend_object_handlers));
- php_phongo_handler_commandfailedevent.get_debug_info = php_phongo_commandfailedevent_get_debug_info;
- php_phongo_handler_commandfailedevent.free_obj = php_phongo_commandfailedevent_free_object;
- php_phongo_handler_commandfailedevent.offset = XtOffsetOf(php_phongo_commandfailedevent_t, std);
-} /* }}} */
-
-/*
- * 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.8.1/src/MongoDB/Monitoring/CommandStartedEvent.c b/mongodb-1.8.1/src/MongoDB/Monitoring/CommandStartedEvent.c
deleted file mode 100644
index 980eea2e..00000000
--- a/mongodb-1.8.1/src/MongoDB/Monitoring/CommandStartedEvent.c
+++ /dev/null
@@ -1,258 +0,0 @@
-/*
- * Copyright 2016-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.
- */
-
-#include <php.h>
-#include <Zend/zend_interfaces.h>
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "phongo_compat.h"
-#include "php_phongo.h"
-
-zend_class_entry* php_phongo_commandstartedevent_ce;
-
-/* {{{ proto stdClass CommandStartedEvent::getCommand()
- Returns the command document associated with the event */
-PHP_METHOD(CommandStartedEvent, getCommand)
-{
- php_phongo_commandstartedevent_t* intern;
- php_phongo_bson_state state;
-
- PHONGO_BSON_INIT_STATE(state);
-
- intern = Z_COMMANDSTARTEDEVENT_OBJ_P(getThis());
-
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
-
- if (!php_phongo_bson_to_zval_ex(bson_get_data(intern->command), intern->command->len, &state)) {
- zval_ptr_dtor(&state.zchild);
- return;
- }
-
- RETURN_ZVAL(&state.zchild, 0, 1);
-} /* }}} */
-
-/* {{{ proto string CommandStartedEvent::getCommandName()
- Returns the command name for this event */
-PHP_METHOD(CommandStartedEvent, getCommandName)
-{
- php_phongo_commandstartedevent_t* intern;
-
- intern = Z_COMMANDSTARTEDEVENT_OBJ_P(getThis());
-
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
-
- RETVAL_STRING(intern->command_name);
-} /* }}} */
-
-/* {{{ proto string CommandStartedEvent::getDatabaseName()
- Returns the database name for this event */
-PHP_METHOD(CommandStartedEvent, getDatabaseName)
-{
- php_phongo_commandstartedevent_t* intern;
-
- intern = Z_COMMANDSTARTEDEVENT_OBJ_P(getThis());
-
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
-
- RETVAL_STRING(intern->database_name);
-} /* }}} */
-
-/* {{{ proto string CommandStartedEvent::getOperationId()
- Returns the event's operation ID */
-PHP_METHOD(CommandStartedEvent, getOperationId)
-{
- php_phongo_commandstartedevent_t* intern;
- char int_as_string[20];
-
- intern = Z_COMMANDSTARTEDEVENT_OBJ_P(getThis());
-
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
-
- sprintf(int_as_string, "%" PRIu64, intern->operation_id);
- RETVAL_STRING(int_as_string);
-} /* }}} */
-
-/* {{{ proto string CommandStartedEvent::getRequestId()
- Returns the event's request ID */
-PHP_METHOD(CommandStartedEvent, getRequestId)
-{
- php_phongo_commandstartedevent_t* intern;
- char int_as_string[20];
-
- intern = Z_COMMANDSTARTEDEVENT_OBJ_P(getThis());
-
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
-
- sprintf(int_as_string, "%" PRIu64, intern->request_id);
- RETVAL_STRING(int_as_string);
-} /* }}} */
-
-/* {{{ proto MongoDB\Driver\Server CommandStartedEvent::getServer()
- Returns the Server from which the event originated */
-PHP_METHOD(CommandStartedEvent, getServer)
-{
- php_phongo_commandstartedevent_t* intern;
-
- intern = Z_COMMANDSTARTEDEVENT_OBJ_P(getThis());
-
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
-
- phongo_server_init(return_value, intern->client, intern->server_id);
-} /* }}} */
-
-/**
- * Event thrown when a command has started to execute.
- *
- * This class is only constructed internally.
- */
-
-/* {{{ MongoDB\Driver\Monitoring\CommandStartedEvent function entries */
-ZEND_BEGIN_ARG_INFO_EX(ai_CommandStartedEvent_void, 0, 0, 0)
-ZEND_END_ARG_INFO()
-
-static zend_function_entry php_phongo_commandstartedevent_me[] = {
- /* clang-format off */
- ZEND_NAMED_ME(__construct, PHP_FN(MongoDB_disabled___construct), ai_CommandStartedEvent_void, ZEND_ACC_PRIVATE | ZEND_ACC_FINAL)
- PHP_ME(CommandStartedEvent, getCommand, ai_CommandStartedEvent_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
- PHP_ME(CommandStartedEvent, getCommandName, ai_CommandStartedEvent_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
- PHP_ME(CommandStartedEvent, getDatabaseName, ai_CommandStartedEvent_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
- PHP_ME(CommandStartedEvent, getOperationId, ai_CommandStartedEvent_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
- PHP_ME(CommandStartedEvent, getRequestId, ai_CommandStartedEvent_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
- PHP_ME(CommandStartedEvent, getServer, ai_CommandStartedEvent_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
- ZEND_NAMED_ME(__wakeup, PHP_FN(MongoDB_disabled___wakeup), ai_CommandStartedEvent_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
- PHP_FE_END
- /* clang-format on */
-};
-/* }}} */
-
-/* {{{ MongoDB\Driver\Monitoring\CommandStartedEvent object handlers */
-static zend_object_handlers php_phongo_handler_commandstartedevent;
-
-static void php_phongo_commandstartedevent_free_object(zend_object* object) /* {{{ */
-{
- php_phongo_commandstartedevent_t* intern = Z_OBJ_COMMANDSTARTEDEVENT(object);
-
- zend_object_std_dtor(&intern->std);
-
- if (intern->command) {
- bson_destroy(intern->command);
- }
- if (intern->command_name) {
- efree(intern->command_name);
- }
- if (intern->database_name) {
- efree(intern->database_name);
- }
-} /* }}} */
-
-static zend_object* php_phongo_commandstartedevent_create_object(zend_class_entry* class_type) /* {{{ */
-{
- php_phongo_commandstartedevent_t* intern = NULL;
-
- intern = PHONGO_ALLOC_OBJECT_T(php_phongo_commandstartedevent_t, class_type);
-
- zend_object_std_init(&intern->std, class_type);
- object_properties_init(&intern->std, class_type);
-
- intern->std.handlers = &php_phongo_handler_commandstartedevent;
-
- return &intern->std;
-} /* }}} */
-
-static HashTable* php_phongo_commandstartedevent_get_debug_info(zval* object, int* is_temp) /* {{{ */
-{
- php_phongo_commandstartedevent_t* intern;
- zval retval = ZVAL_STATIC_INIT;
- char operation_id[20], request_id[20];
- php_phongo_bson_state command_state;
-
- PHONGO_BSON_INIT_STATE(command_state);
-
- intern = Z_COMMANDSTARTEDEVENT_OBJ_P(object);
- *is_temp = 1;
- array_init_size(&retval, 6);
-
- if (!php_phongo_bson_to_zval_ex(bson_get_data(intern->command), intern->command->len, &command_state)) {
- zval_ptr_dtor(&command_state.zchild);
- goto done;
- }
-
- ADD_ASSOC_ZVAL(&retval, "command", &command_state.zchild);
-
- ADD_ASSOC_STRING(&retval, "commandName", intern->command_name);
- ADD_ASSOC_STRING(&retval, "databaseName", intern->database_name);
-
- sprintf(operation_id, "%" PRIu64, intern->operation_id);
- ADD_ASSOC_STRING(&retval, "operationId", operation_id);
-
- sprintf(request_id, "%" PRIu64, intern->request_id);
- ADD_ASSOC_STRING(&retval, "requestId", request_id);
-
- {
- zval server;
-
- phongo_server_init(&server, intern->client, intern->server_id);
- ADD_ASSOC_ZVAL_EX(&retval, "server", &server);
- }
-
-done:
- return Z_ARRVAL(retval);
-} /* }}} */
-/* }}} */
-
-void php_phongo_commandstartedevent_init_ce(INIT_FUNC_ARGS) /* {{{ */
-{
- zend_class_entry ce;
- (void) type;
- (void) module_number;
-
- INIT_NS_CLASS_ENTRY(ce, "MongoDB\\Driver\\Monitoring", "CommandStartedEvent", php_phongo_commandstartedevent_me);
- php_phongo_commandstartedevent_ce = zend_register_internal_class(&ce);
- php_phongo_commandstartedevent_ce->create_object = php_phongo_commandstartedevent_create_object;
- PHONGO_CE_FINAL(php_phongo_commandstartedevent_ce);
- PHONGO_CE_DISABLE_SERIALIZATION(php_phongo_commandstartedevent_ce);
-
- memcpy(&php_phongo_handler_commandstartedevent, phongo_get_std_object_handlers(), sizeof(zend_object_handlers));
- php_phongo_handler_commandstartedevent.get_debug_info = php_phongo_commandstartedevent_get_debug_info;
- php_phongo_handler_commandstartedevent.free_obj = php_phongo_commandstartedevent_free_object;
- php_phongo_handler_commandstartedevent.offset = XtOffsetOf(php_phongo_commandstartedevent_t, std);
-
- return;
-} /* }}} */
-
-/*
- * 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.8.1/src/MongoDB/Monitoring/CommandSucceededEvent.c b/mongodb-1.8.1/src/MongoDB/Monitoring/CommandSucceededEvent.c
deleted file mode 100644
index f826d204..00000000
--- a/mongodb-1.8.1/src/MongoDB/Monitoring/CommandSucceededEvent.c
+++ /dev/null
@@ -1,255 +0,0 @@
-/*
- * Copyright 2016-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.
- */
-
-#include <php.h>
-#include <Zend/zend_interfaces.h>
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "phongo_compat.h"
-#include "php_phongo.h"
-
-zend_class_entry* php_phongo_commandsucceededevent_ce;
-
-/* {{{ proto string CommandSucceededEvent::getCommandName()
- Returns the command name for this event */
-PHP_METHOD(CommandSucceededEvent, getCommandName)
-{
- php_phongo_commandsucceededevent_t* intern;
-
- intern = Z_COMMANDSUCCEEDEDEVENT_OBJ_P(getThis());
-
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
-
- RETVAL_STRING(intern->command_name);
-} /* }}} */
-
-/* {{{ proto int CommandSucceededEvent::getDurationMicros()
- Returns the event's duration in microseconds */
-PHP_METHOD(CommandSucceededEvent, getDurationMicros)
-{
- php_phongo_commandsucceededevent_t* intern;
-
- intern = Z_COMMANDSUCCEEDEDEVENT_OBJ_P(getThis());
-
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
-
- RETURN_LONG(intern->duration_micros);
-} /* }}} */
-
-/* {{{ proto string CommandSucceededEvent::getOperationId()
- Returns the event's operation ID */
-PHP_METHOD(CommandSucceededEvent, getOperationId)
-{
- php_phongo_commandsucceededevent_t* intern;
- char int_as_string[20];
-
- intern = Z_COMMANDSUCCEEDEDEVENT_OBJ_P(getThis());
-
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
-
- sprintf(int_as_string, "%" PRIu64, intern->operation_id);
- RETVAL_STRING(int_as_string);
-} /* }}} */
-
-/* {{{ proto stdClass CommandSucceededEvent::getReply()
- Returns the reply document associated with the event */
-PHP_METHOD(CommandSucceededEvent, getReply)
-{
- php_phongo_commandsucceededevent_t* intern;
- php_phongo_bson_state state;
-
- PHONGO_BSON_INIT_STATE(state);
-
- intern = Z_COMMANDSUCCEEDEDEVENT_OBJ_P(getThis());
-
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
-
- if (!php_phongo_bson_to_zval_ex(bson_get_data(intern->reply), intern->reply->len, &state)) {
- zval_ptr_dtor(&state.zchild);
- return;
- }
-
- RETURN_ZVAL(&state.zchild, 0, 1);
-} /* }}} */
-
-/* {{{ proto string CommandsucceededEvent::getRequestId()
- Returns the event's request ID */
-PHP_METHOD(CommandSucceededEvent, getRequestId)
-{
- php_phongo_commandsucceededevent_t* intern;
- char int_as_string[20];
-
- intern = Z_COMMANDSUCCEEDEDEVENT_OBJ_P(getThis());
-
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
-
- sprintf(int_as_string, "%" PRIu64, intern->request_id);
- RETVAL_STRING(int_as_string);
-} /* }}} */
-
-/* {{{ proto MongoDB\Driver\Server CommandSucceededEvent::getServer()
- Returns the Server from which the event originated */
-PHP_METHOD(CommandSucceededEvent, getServer)
-{
- php_phongo_commandsucceededevent_t* intern;
-
- intern = Z_COMMANDSUCCEEDEDEVENT_OBJ_P(getThis());
-
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
-
- phongo_server_init(return_value, intern->client, intern->server_id);
-} /* }}} */
-
-/**
- * Event thrown when a command has succeeded to execute.
- *
- * This class is only constructed internally.
- */
-
-/* {{{ MongoDB\Driver\Monitoring\CommandSucceededEvent function entries */
-ZEND_BEGIN_ARG_INFO_EX(ai_CommandSucceededEvent_void, 0, 0, 0)
-ZEND_END_ARG_INFO()
-
-static zend_function_entry php_phongo_commandsucceededevent_me[] = {
- /* clang-format off */
- ZEND_NAMED_ME(__construct, PHP_FN(MongoDB_disabled___construct), ai_CommandSucceededEvent_void, ZEND_ACC_PRIVATE | ZEND_ACC_FINAL)
- PHP_ME(CommandSucceededEvent, getCommandName, ai_CommandSucceededEvent_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
- PHP_ME(CommandSucceededEvent, getDurationMicros, ai_CommandSucceededEvent_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
- PHP_ME(CommandSucceededEvent, getOperationId, ai_CommandSucceededEvent_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
- PHP_ME(CommandSucceededEvent, getReply, ai_CommandSucceededEvent_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
- PHP_ME(CommandSucceededEvent, getRequestId, ai_CommandSucceededEvent_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
- PHP_ME(CommandSucceededEvent, getServer, ai_CommandSucceededEvent_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
- ZEND_NAMED_ME(__wakeup, PHP_FN(MongoDB_disabled___wakeup), ai_CommandSucceededEvent_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
- PHP_FE_END
- /* clang-format on */
-};
-/* }}} */
-
-/* {{{ MongoDB\Driver\Monitoring\CommandSucceededEvent object handlers */
-static zend_object_handlers php_phongo_handler_commandsucceededevent;
-
-static void php_phongo_commandsucceededevent_free_object(zend_object* object) /* {{{ */
-{
- php_phongo_commandsucceededevent_t* intern = Z_OBJ_COMMANDSUCCEEDEDEVENT(object);
-
- zend_object_std_dtor(&intern->std);
-
- if (intern->reply) {
- bson_destroy(intern->reply);
- }
- if (intern->command_name) {
- efree(intern->command_name);
- }
-} /* }}} */
-
-static zend_object* php_phongo_commandsucceededevent_create_object(zend_class_entry* class_type) /* {{{ */
-{
- php_phongo_commandsucceededevent_t* intern = NULL;
-
- intern = PHONGO_ALLOC_OBJECT_T(php_phongo_commandsucceededevent_t, class_type);
-
- zend_object_std_init(&intern->std, class_type);
- object_properties_init(&intern->std, class_type);
-
- intern->std.handlers = &php_phongo_handler_commandsucceededevent;
-
- return &intern->std;
-} /* }}} */
-
-static HashTable* php_phongo_commandsucceededevent_get_debug_info(zval* object, int* is_temp) /* {{{ */
-{
- php_phongo_commandsucceededevent_t* intern;
- zval retval = ZVAL_STATIC_INIT;
- char operation_id[20], request_id[20];
- php_phongo_bson_state reply_state;
-
- PHONGO_BSON_INIT_STATE(reply_state);
-
- intern = Z_COMMANDSUCCEEDEDEVENT_OBJ_P(object);
- *is_temp = 1;
- array_init_size(&retval, 6);
-
- ADD_ASSOC_STRING(&retval, "commandName", intern->command_name);
- ADD_ASSOC_INT64(&retval, "durationMicros", (int64_t) intern->duration_micros);
-
- sprintf(operation_id, "%" PRIu64, intern->operation_id);
- ADD_ASSOC_STRING(&retval, "operationId", operation_id);
-
- if (php_phongo_bson_to_zval_ex(bson_get_data(intern->reply), intern->reply->len, &reply_state)) {
- zval_ptr_dtor(&reply_state.zchild);
- goto done;
- }
-
- ADD_ASSOC_ZVAL(&retval, "reply", &reply_state.zchild);
-
- sprintf(request_id, "%" PRIu64, intern->request_id);
- ADD_ASSOC_STRING(&retval, "requestId", request_id);
-
- {
- zval server;
-
- phongo_server_init(&server, intern->client, intern->server_id);
- ADD_ASSOC_ZVAL_EX(&retval, "server", &server);
- }
-
-done:
- return Z_ARRVAL(retval);
-} /* }}} */
-/* }}} */
-
-void php_phongo_commandsucceededevent_init_ce(INIT_FUNC_ARGS) /* {{{ */
-{
- zend_class_entry ce;
- (void) type;
- (void) module_number;
-
- INIT_NS_CLASS_ENTRY(ce, "MongoDB\\Driver\\Monitoring", "CommandSucceededEvent", php_phongo_commandsucceededevent_me);
- php_phongo_commandsucceededevent_ce = zend_register_internal_class(&ce);
- php_phongo_commandsucceededevent_ce->create_object = php_phongo_commandsucceededevent_create_object;
- PHONGO_CE_FINAL(php_phongo_commandsucceededevent_ce);
- PHONGO_CE_DISABLE_SERIALIZATION(php_phongo_commandsucceededevent_ce);
-
- memcpy(&php_phongo_handler_commandsucceededevent, phongo_get_std_object_handlers(), sizeof(zend_object_handlers));
- php_phongo_handler_commandsucceededevent.get_debug_info = php_phongo_commandsucceededevent_get_debug_info;
- php_phongo_handler_commandsucceededevent.free_obj = php_phongo_commandsucceededevent_free_object;
- php_phongo_handler_commandsucceededevent.offset = XtOffsetOf(php_phongo_commandsucceededevent_t, std);
-
- return;
-} /* }}} */
-
-/*
- * 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.8.1/src/MongoDB/Monitoring/functions.c b/mongodb-1.8.1/src/MongoDB/Monitoring/functions.c
deleted file mode 100644
index d5ea791a..00000000
--- a/mongodb-1.8.1/src/MongoDB/Monitoring/functions.c
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * Copyright 2016-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.
- */
-
-#include <php.h>
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "phongo_compat.h"
-#include "php_phongo.h"
-
-ZEND_EXTERN_MODULE_GLOBALS(mongodb)
-
-static char* php_phongo_make_subscriber_hash(zval* subscriber)
-{
- char* hash;
- int hash_len;
-
- hash_len = spprintf(&hash, 0, "SUBS-%09d", Z_OBJ_HANDLE_P(subscriber));
-
- return hash;
-}
-
-/* {{{ proto void MongoDB\Driver\Monitoring\addSubscriber(MongoDB\Driver\Monitoring\Subscriber $subscriber)
- Adds a monitoring subscriber to the set of subscribers */
-PHP_FUNCTION(MongoDB_Driver_Monitoring_addSubscriber)
-{
- zval* zSubscriber = NULL;
- char* hash;
- zval* subscriber;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "O", &zSubscriber, php_phongo_subscriber_ce) == FAILURE) {
- return;
- }
-
- /* The HashTable should never be NULL, as it's initialized during RINIT and
- * destroyed during RSHUTDOWN. This is simply a defensive guard. */
- if (!MONGODB_G(subscribers)) {
- return;
- }
-
- hash = php_phongo_make_subscriber_hash(zSubscriber);
-
- /* If we have already stored the subscriber, bail out. Otherwise, add
- * subscriber to list */
- if ((subscriber = zend_hash_str_find(MONGODB_G(subscribers), hash, strlen(hash)))) {
- efree(hash);
- return;
- }
-
- zend_hash_str_update(MONGODB_G(subscribers), hash, strlen(hash), zSubscriber);
- Z_ADDREF_P(zSubscriber);
- efree(hash);
-} /* }}} */
-
-/* {{{ proto void MongoDB\Driver\Monitoring\removeSubscriber(MongoDB\Driver\Monitoring\Subscriber $subscriber)
- Removes a monitoring subscriber from the set of subscribers */
-PHP_FUNCTION(MongoDB_Driver_Monitoring_removeSubscriber)
-{
- zval* zSubscriber = NULL;
- char* hash;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "O", &zSubscriber, php_phongo_subscriber_ce) == FAILURE) {
- return;
- }
-
- /* The HashTable should never be NULL, as it's initialized during RINIT and
- * destroyed during RSHUTDOWN. This is simply a defensive guard. */
- if (!MONGODB_G(subscribers)) {
- return;
- }
-
- hash = php_phongo_make_subscriber_hash(zSubscriber);
-
- zend_hash_str_del(MONGODB_G(subscribers), hash, strlen(hash));
- efree(hash);
-} /* }}} */
-
-/*
- * 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.8.1/src/MongoDB/Query.c b/mongodb-1.8.1/src/MongoDB/Query.c
deleted file mode 100644
index 415b083c..00000000
--- a/mongodb-1.8.1/src/MongoDB/Query.c
+++ /dev/null
@@ -1,502 +0,0 @@
-/*
- * 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.
- */
-
-#include <php.h>
-#include <Zend/zend_interfaces.h>
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php_array_api.h"
-#include "phongo_compat.h"
-#include "php_phongo.h"
-#include "php_bson.h"
-
-zend_class_entry* php_phongo_query_ce;
-
-/* Appends a string field into the BSON options. Returns true on success;
- * otherwise, false is returned and an exception is thrown. */
-static bool php_phongo_query_opts_append_string(bson_t* opts, const char* opts_key, zval* zarr, const char* zarr_key) /* {{{ */
-{
- zval* value = php_array_fetch(zarr, zarr_key);
-
- if (Z_TYPE_P(value) != IS_STRING) {
- phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Expected \"%s\" %s to be string, %s given", zarr_key, zarr_key[0] == '$' ? "modifier" : "option", PHONGO_ZVAL_CLASS_OR_TYPE_NAME_P(value));
- return false;
- }
-
- if (!bson_append_utf8(opts, opts_key, strlen(opts_key), Z_STRVAL_P(value), Z_STRLEN_P(value))) {
- phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Error appending \"%s\" option", opts_key);
- return false;
- }
-
- return true;
-} /* }}} */
-
-/* Appends a document field for the given opts document and key. Returns true on
- * success; otherwise, false is returned and an exception is thrown. */
-static bool php_phongo_query_opts_append_document(bson_t* opts, const char* opts_key, zval* zarr, const char* zarr_key) /* {{{ */
-{
- zval* value = php_array_fetch(zarr, zarr_key);
- bson_t b = BSON_INITIALIZER;
-
- if (Z_TYPE_P(value) != IS_OBJECT && Z_TYPE_P(value) != IS_ARRAY) {
- phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Expected \"%s\" %s to be array or object, %s given", zarr_key, zarr_key[0] == '$' ? "modifier" : "option", PHONGO_ZVAL_CLASS_OR_TYPE_NAME_P(value));
- return false;
- }
-
- php_phongo_zval_to_bson(value, PHONGO_BSON_NONE, &b, NULL);
-
- if (EG(exception)) {
- bson_destroy(&b);
- return false;
- }
-
- if (!bson_validate(&b, BSON_VALIDATE_EMPTY_KEYS, NULL)) {
- phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Cannot use empty keys in \"%s\" %s", zarr_key, zarr_key[0] == '$' ? "modifier" : "option");
- bson_destroy(&b);
- return false;
- }
-
- if (!BSON_APPEND_DOCUMENT(opts, opts_key, &b)) {
- phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Error appending \"%s\" option", opts_key);
- bson_destroy(&b);
- return false;
- }
-
- bson_destroy(&b);
- return true;
-} /* }}} */
-
-#define PHONGO_QUERY_OPT_BOOL_EX(opt, zarr, key, deprecated) \
- if ((zarr) && php_array_existsc((zarr), (key))) { \
- if ((deprecated)) { \
- php_error_docref(NULL, E_DEPRECATED, "The \"%s\" option is deprecated and will be removed in a future release", key); \
- } \
- if (!BSON_APPEND_BOOL(intern->opts, (opt), php_array_fetchc_bool((zarr), (key)))) { \
- phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Error appending \"%s\" option", (opt)); \
- return false; \
- } \
- }
-
-#define PHONGO_QUERY_OPT_BOOL(opt, zarr, key) PHONGO_QUERY_OPT_BOOL_EX((opt), (zarr), (key), 0)
-#define PHONGO_QUERY_OPT_BOOL_DEPRECATED(opt, zarr, key) PHONGO_QUERY_OPT_BOOL_EX((opt), (zarr), (key), 1)
-
-#define PHONGO_QUERY_OPT_DOCUMENT(opt, zarr, key) \
- if ((zarr) && php_array_existsc((zarr), (key))) { \
- if (!php_phongo_query_opts_append_document(intern->opts, (opt), (zarr), (key))) { \
- return false; \
- } \
- }
-
-/* Note: handling of integer options will depend on SIZEOF_ZEND_LONG and we
- * are not converting strings to 64-bit integers for 32-bit platforms. */
-
-#define PHONGO_QUERY_OPT_INT64_EX(opt, zarr, key, deprecated) \
- if ((zarr) && php_array_existsc((zarr), (key))) { \
- if ((deprecated)) { \
- php_error_docref(NULL, E_DEPRECATED, "The \"%s\" option is deprecated and will be removed in a future release", key); \
- } \
- if (!BSON_APPEND_INT64(intern->opts, (opt), php_array_fetchc_long((zarr), (key)))) { \
- phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Error appending \"%s\" option", (opt)); \
- return false; \
- } \
- }
-
-#define PHONGO_QUERY_OPT_INT64(opt, zarr, key) PHONGO_QUERY_OPT_INT64_EX((opt), (zarr), (key), 0)
-#define PHONGO_QUERY_OPT_INT64_DEPRECATED(opt, zarr, key) PHONGO_QUERY_OPT_INT64_EX((opt), (zarr), (key), 1)
-
-#define PHONGO_QUERY_OPT_STRING(opt, zarr, key) \
- if ((zarr) && php_array_existsc((zarr), (key))) { \
- if (!php_phongo_query_opts_append_string(intern->opts, (opt), (zarr), (key))) { \
- return false; \
- } \
- }
-
-/* Initialize the "hint" option. Returns true on success; otherwise, false is
- * returned and an exception is thrown.
- *
- * The "hint" option (or "$hint" modifier) must be a string or document. Check
- * for both types and merge into BSON options accordingly. */
-static bool php_phongo_query_init_hint(php_phongo_query_t* intern, zval* options, zval* modifiers) /* {{{ */
-{
- /* The "hint" option (or "$hint" modifier) must be a string or document.
- * Check for both types and merge into BSON options accordingly. */
- if (php_array_existsc(options, "hint")) {
- zend_uchar type = Z_TYPE_P(php_array_fetchc(options, "hint"));
-
- if (type == IS_STRING) {
- PHONGO_QUERY_OPT_STRING("hint", options, "hint");
- } else if (type == IS_OBJECT || type == IS_ARRAY) {
- PHONGO_QUERY_OPT_DOCUMENT("hint", options, "hint");
- } else {
- phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Expected \"hint\" option to be string, array, or object, %s given", zend_get_type_by_const(type));
- return false;
- }
- } else if (modifiers && php_array_existsc(modifiers, "$hint")) {
- zend_uchar type = Z_TYPE_P(php_array_fetchc(modifiers, "$hint"));
-
- if (type == IS_STRING) {
- PHONGO_QUERY_OPT_STRING("hint", modifiers, "$hint");
- } else if (type == IS_OBJECT || type == IS_ARRAY) {
- PHONGO_QUERY_OPT_DOCUMENT("hint", modifiers, "$hint");
- } else {
- phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Expected \"$hint\" modifier to be string, array, or object, %s given", zend_get_type_by_const(type));
- return false;
- }
- }
-
- return true;
-} /* }}} */
-
-/* Initialize the "limit" and "singleBatch" options. Returns true on success;
- * otherwise, false is returned and an exception is thrown.
- *
- * mongoc_collection_find_with_opts() requires a non-negative limit. For
- * backwards compatibility, a negative limit should be set as a positive value
- * and default singleBatch to true. */
-static bool php_phongo_query_init_limit_and_singlebatch(php_phongo_query_t* intern, zval* options) /* {{{ */
-{
- if (php_array_fetchc_long(options, "limit") < 0) {
- zend_long limit = php_array_fetchc_long(options, "limit");
-
- if (!BSON_APPEND_INT64(intern->opts, "limit", -limit)) {
- phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Error appending \"limit\" option");
- return false;
- }
-
- if (php_array_existsc(options, "singleBatch") && !php_array_fetchc_bool(options, "singleBatch")) {
- phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Negative \"limit\" option conflicts with false \"singleBatch\" option");
- return false;
- } else {
- if (!BSON_APPEND_BOOL(intern->opts, "singleBatch", true)) {
- phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Error appending \"singleBatch\" option");
- return false;
- }
- }
- } else {
- PHONGO_QUERY_OPT_INT64("limit", options, "limit");
- PHONGO_QUERY_OPT_BOOL("singleBatch", options, "singleBatch");
- }
-
- return true;
-} /* }}} */
-
-/* Initialize the "readConcern" option. Returns true on success; otherwise,
- * false is returned and an exception is thrown.
- *
- * The "readConcern" option should be a MongoDB\Driver\ReadConcern instance,
- * which must be converted to a mongoc_read_concern_t. */
-static bool php_phongo_query_init_readconcern(php_phongo_query_t* intern, zval* options) /* {{{ */
-{
- zval* read_concern;
-
- if (!php_array_existsc(options, "readConcern")) {
- return true;
- }
-
- read_concern = php_array_fetchc(options, "readConcern");
-
- if (Z_TYPE_P(read_concern) != IS_OBJECT || !instanceof_function(Z_OBJCE_P(read_concern), php_phongo_readconcern_ce)) {
- phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Expected \"readConcern\" option to be %s, %s given", ZSTR_VAL(php_phongo_readconcern_ce->name), PHONGO_ZVAL_CLASS_OR_TYPE_NAME_P(read_concern));
- return false;
- }
-
- intern->read_concern = mongoc_read_concern_copy(phongo_read_concern_from_zval(read_concern));
-
- return true;
-} /* }}} */
-
-/* Initialize the "maxAwaitTimeMS" option. Returns true on success; otherwise,
- * false is returned and an exception is thrown.
- *
- * The "maxAwaitTimeMS" option is assigned to the cursor after query execution
- * via mongoc_cursor_set_max_await_time_ms(). */
-static bool php_phongo_query_init_max_await_time_ms(php_phongo_query_t* intern, zval* options) /* {{{ */
-{
- int64_t max_await_time_ms;
-
- if (!php_array_existsc(options, "maxAwaitTimeMS")) {
- return true;
- }
-
- max_await_time_ms = php_array_fetchc_long(options, "maxAwaitTimeMS");
-
- if (max_await_time_ms < 0) {
- phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Expected \"maxAwaitTimeMS\" option to be >= 0, %" PRId64 " given", max_await_time_ms);
- return false;
- }
-
- if (max_await_time_ms > UINT32_MAX) {
- phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Expected \"maxAwaitTimeMS\" option to be <= %" PRIu32 ", %" PRId64 " given", UINT32_MAX, max_await_time_ms);
- return false;
- }
-
- intern->max_await_time_ms = (uint32_t) max_await_time_ms;
-
- return true;
-} /* }}} */
-
-/* Initializes the php_phongo_query_t from filter and options arguments. This
- * function will fall back to a modifier in the absence of a top-level option
- * (where applicable). */
-static bool php_phongo_query_init(php_phongo_query_t* intern, zval* filter, zval* options) /* {{{ */
-{
- zval* modifiers = NULL;
-
- intern->filter = bson_new();
- intern->opts = bson_new();
- intern->max_await_time_ms = 0;
-
- php_phongo_zval_to_bson(filter, PHONGO_BSON_NONE, intern->filter, NULL);
-
- /* Note: if any exceptions are thrown, we can simply return as PHP will
- * invoke php_phongo_query_free_object to destruct the object. */
- if (EG(exception)) {
- return false;
- }
-
- if (!bson_validate(intern->filter, BSON_VALIDATE_EMPTY_KEYS, NULL)) {
- phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Cannot use empty keys in filter document");
- return false;
- }
-
- if (!options) {
- return true;
- }
-
- if (php_array_existsc(options, "modifiers")) {
- modifiers = php_array_fetchc(options, "modifiers");
-
- if (Z_TYPE_P(modifiers) != IS_ARRAY) {
- phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Expected \"modifiers\" option to be array, %s given", PHONGO_ZVAL_CLASS_OR_TYPE_NAME_P(modifiers));
- return false;
- }
- }
-
- PHONGO_QUERY_OPT_BOOL("allowDiskUse", options, "allowDiskUse")
- PHONGO_QUERY_OPT_BOOL("allowPartialResults", options, "allowPartialResults")
- else PHONGO_QUERY_OPT_BOOL("allowPartialResults", options, "partial");
- PHONGO_QUERY_OPT_BOOL("awaitData", options, "awaitData");
- PHONGO_QUERY_OPT_INT64("batchSize", options, "batchSize");
- PHONGO_QUERY_OPT_DOCUMENT("collation", options, "collation");
- PHONGO_QUERY_OPT_STRING("comment", options, "comment")
- else PHONGO_QUERY_OPT_STRING("comment", modifiers, "$comment");
- PHONGO_QUERY_OPT_BOOL("exhaust", options, "exhaust");
- PHONGO_QUERY_OPT_DOCUMENT("max", options, "max")
- else PHONGO_QUERY_OPT_DOCUMENT("max", modifiers, "$max");
- PHONGO_QUERY_OPT_INT64_DEPRECATED("maxScan", options, "maxScan")
- else PHONGO_QUERY_OPT_INT64_DEPRECATED("maxScan", modifiers, "$maxScan");
- PHONGO_QUERY_OPT_INT64("maxTimeMS", options, "maxTimeMS")
- else PHONGO_QUERY_OPT_INT64("maxTimeMS", modifiers, "$maxTimeMS");
- PHONGO_QUERY_OPT_DOCUMENT("min", options, "min")
- else PHONGO_QUERY_OPT_DOCUMENT("min", modifiers, "$min");
- PHONGO_QUERY_OPT_BOOL("noCursorTimeout", options, "noCursorTimeout");
- PHONGO_QUERY_OPT_BOOL_DEPRECATED("oplogReplay", options, "oplogReplay");
- PHONGO_QUERY_OPT_DOCUMENT("projection", options, "projection");
- PHONGO_QUERY_OPT_BOOL("returnKey", options, "returnKey")
- else PHONGO_QUERY_OPT_BOOL("returnKey", modifiers, "$returnKey");
- PHONGO_QUERY_OPT_BOOL("showRecordId", options, "showRecordId")
- else PHONGO_QUERY_OPT_BOOL("showRecordId", modifiers, "$showDiskLoc");
- PHONGO_QUERY_OPT_INT64("skip", options, "skip");
- PHONGO_QUERY_OPT_DOCUMENT("sort", options, "sort")
- else PHONGO_QUERY_OPT_DOCUMENT("sort", modifiers, "$orderby");
- PHONGO_QUERY_OPT_BOOL_DEPRECATED("snapshot", options, "snapshot")
- else PHONGO_QUERY_OPT_BOOL_DEPRECATED("snapshot", modifiers, "$snapshot");
- PHONGO_QUERY_OPT_BOOL("tailable", options, "tailable");
-
- /* The "$explain" modifier should be converted to an "explain" option, which
- * libmongoc will later convert back to a modifier for the OP_QUERY code
- * path. This modifier will be ignored for the find command code path. */
- PHONGO_QUERY_OPT_BOOL("explain", modifiers, "$explain");
-
- if (!php_phongo_query_init_hint(intern, options, modifiers)) {
- return false;
- }
-
- if (!php_phongo_query_init_limit_and_singlebatch(intern, options)) {
- return false;
- }
-
- if (!php_phongo_query_init_readconcern(intern, options)) {
- return false;
- }
-
- if (!php_phongo_query_init_max_await_time_ms(intern, options)) {
- return false;
- }
-
- return true;
-} /* }}} */
-
-#undef PHONGO_QUERY_OPT_BOOL
-#undef PHONGO_QUERY_OPT_DOCUMENT
-#undef PHONGO_QUERY_OPT_INT64
-#undef PHONGO_QUERY_OPT_STRING
-
-/* {{{ proto void MongoDB\Driver\Query::__construct(array|object $filter[, array $options = array()])
- Constructs a new Query */
-static PHP_METHOD(Query, __construct)
-{
- php_phongo_query_t* intern;
- zend_error_handling error_handling;
- zval* filter;
- zval* options = NULL;
-
- zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
- intern = Z_QUERY_OBJ_P(getThis());
-
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "A|a!", &filter, &options) == FAILURE) {
- zend_restore_error_handling(&error_handling);
- return;
- }
- zend_restore_error_handling(&error_handling);
-
- php_phongo_query_init(intern, filter, options);
-} /* }}} */
-
-/* {{{ MongoDB\Driver\Query function entries */
-ZEND_BEGIN_ARG_INFO_EX(ai_Query___construct, 0, 0, 1)
- ZEND_ARG_INFO(0, filter)
- ZEND_ARG_ARRAY_INFO(0, options, 1)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(ai_Query_void, 0, 0, 0)
-ZEND_END_ARG_INFO()
-
-static zend_function_entry php_phongo_query_me[] = {
- /* clang-format off */
- PHP_ME(Query, __construct, ai_Query___construct, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
- ZEND_NAMED_ME(__wakeup, PHP_FN(MongoDB_disabled___wakeup), ai_Query_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
- PHP_FE_END
- /* clang-format on */
-};
-/* }}} */
-
-/* {{{ MongoDB\Driver\Query object handlers */
-static zend_object_handlers php_phongo_handler_query;
-
-static void php_phongo_query_free_object(zend_object* object) /* {{{ */
-{
- php_phongo_query_t* intern = Z_OBJ_QUERY(object);
-
- zend_object_std_dtor(&intern->std);
-
- if (intern->filter) {
- bson_clear(&intern->filter);
- }
-
- if (intern->opts) {
- bson_clear(&intern->opts);
- }
-
- if (intern->read_concern) {
- mongoc_read_concern_destroy(intern->read_concern);
- }
-} /* }}} */
-
-static zend_object* php_phongo_query_create_object(zend_class_entry* class_type) /* {{{ */
-{
- php_phongo_query_t* intern = NULL;
-
- intern = PHONGO_ALLOC_OBJECT_T(php_phongo_query_t, class_type);
-
- zend_object_std_init(&intern->std, class_type);
- object_properties_init(&intern->std, class_type);
-
- intern->std.handlers = &php_phongo_handler_query;
-
- return &intern->std;
-} /* }}} */
-
-static HashTable* php_phongo_query_get_debug_info(zval* object, int* is_temp) /* {{{ */
-{
- php_phongo_query_t* intern;
- zval retval = ZVAL_STATIC_INIT;
-
- *is_temp = 1;
- intern = Z_QUERY_OBJ_P(object);
-
- array_init_size(&retval, 3);
-
- /* Avoid using PHONGO_TYPEMAP_NATIVE_ARRAY for decoding filter and opts
- * documents so that users can differentiate BSON arrays and documents. */
- if (intern->filter) {
- zval zv;
-
- if (!php_phongo_bson_to_zval(bson_get_data(intern->filter), intern->filter->len, &zv)) {
- zval_ptr_dtor(&zv);
- goto done;
- }
-
- ADD_ASSOC_ZVAL_EX(&retval, "filter", &zv);
- } else {
- ADD_ASSOC_NULL_EX(&retval, "filter");
- }
-
- if (intern->opts) {
- zval zv;
-
- if (!php_phongo_bson_to_zval(bson_get_data(intern->opts), intern->opts->len, &zv)) {
- zval_ptr_dtor(&zv);
- goto done;
- }
-
- ADD_ASSOC_ZVAL_EX(&retval, "options", &zv);
- } else {
- ADD_ASSOC_NULL_EX(&retval, "options");
- }
-
- if (intern->read_concern) {
- zval read_concern;
-
- php_phongo_read_concern_to_zval(&read_concern, intern->read_concern);
- ADD_ASSOC_ZVAL_EX(&retval, "readConcern", &read_concern);
- } else {
- ADD_ASSOC_NULL_EX(&retval, "readConcern");
- }
-
-done:
- return Z_ARRVAL(retval);
-
-} /* }}} */
-/* }}} */
-
-void php_phongo_query_init_ce(INIT_FUNC_ARGS) /* {{{ */
-{
- zend_class_entry ce;
-
- INIT_NS_CLASS_ENTRY(ce, "MongoDB\\Driver", "Query", php_phongo_query_me);
- php_phongo_query_ce = zend_register_internal_class(&ce);
- php_phongo_query_ce->create_object = php_phongo_query_create_object;
- PHONGO_CE_FINAL(php_phongo_query_ce);
- PHONGO_CE_DISABLE_SERIALIZATION(php_phongo_query_ce);
-
- memcpy(&php_phongo_handler_query, phongo_get_std_object_handlers(), sizeof(zend_object_handlers));
- php_phongo_handler_query.get_debug_info = php_phongo_query_get_debug_info;
- php_phongo_handler_query.free_obj = php_phongo_query_free_object;
- php_phongo_handler_query.offset = XtOffsetOf(php_phongo_query_t, std);
-} /* }}} */
-
-/*
- * 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.8.1/src/MongoDB/ReadConcern.c b/mongodb-1.8.1/src/MongoDB/ReadConcern.c
deleted file mode 100644
index 7995001b..00000000
--- a/mongodb-1.8.1/src/MongoDB/ReadConcern.c
+++ /dev/null
@@ -1,362 +0,0 @@
-/*
- * 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.
- */
-
-#include <php.h>
-#include <Zend/zend_interfaces.h>
-#include <ext/standard/php_var.h>
-#include <zend_smart_str.h>
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "phongo_compat.h"
-#include "php_phongo.h"
-
-zend_class_entry* php_phongo_readconcern_ce;
-
-/* Initialize the object from a HashTable and return whether it was successful.
- * An exception will be thrown on error. */
-static bool php_phongo_readconcern_init_from_hash(php_phongo_readconcern_t* intern, HashTable* props) /* {{{ */
-{
- zval* level;
-
- intern->read_concern = mongoc_read_concern_new();
-
- if ((level = zend_hash_str_find(props, "level", sizeof("level") - 1))) {
- if (Z_TYPE_P(level) == IS_STRING) {
- mongoc_read_concern_set_level(intern->read_concern, Z_STRVAL_P(level));
- return true;
- }
-
- phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "%s initialization requires \"level\" string field", ZSTR_VAL(php_phongo_readconcern_ce->name));
- goto failure;
- }
-
- return true;
-
-failure:
- mongoc_read_concern_destroy(intern->read_concern);
- intern->read_concern = NULL;
- return false;
-} /* }}} */
-
-/* {{{ proto void MongoDB\Driver\ReadConcern::__construct([string $level])
- Constructs a new ReadConcern */
-static PHP_METHOD(ReadConcern, __construct)
-{
- php_phongo_readconcern_t* intern;
- zend_error_handling error_handling;
- char* level = NULL;
- size_t level_len = 0;
-
- zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
- intern = Z_READCONCERN_OBJ_P(getThis());
-
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "|s!", &level, &level_len) == FAILURE) {
- zend_restore_error_handling(&error_handling);
- return;
- }
- zend_restore_error_handling(&error_handling);
-
- intern->read_concern = mongoc_read_concern_new();
-
- if (level) {
- mongoc_read_concern_set_level(intern->read_concern, level);
- }
-} /* }}} */
-
-/* {{{ proto void MongoDB\BSON\ReadConcern::__set_state(array $properties)
-*/
-static PHP_METHOD(ReadConcern, __set_state)
-{
- php_phongo_readconcern_t* intern;
- HashTable* props;
- zval* array;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "a", &array) == FAILURE) {
- RETURN_FALSE;
- }
-
- object_init_ex(return_value, php_phongo_readconcern_ce);
-
- intern = Z_READCONCERN_OBJ_P(return_value);
- props = Z_ARRVAL_P(array);
-
- php_phongo_readconcern_init_from_hash(intern, props);
-} /* }}} */
-
-/* {{{ proto string|null MongoDB\Driver\ReadConcern::getLevel()
- Returns the ReadConcern "level" option */
-static PHP_METHOD(ReadConcern, getLevel)
-{
- php_phongo_readconcern_t* intern;
- const char* level;
-
- intern = Z_READCONCERN_OBJ_P(getThis());
-
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
-
- level = mongoc_read_concern_get_level(intern->read_concern);
-
- if (level) {
- RETURN_STRING(level);
- }
-
- RETURN_NULL();
-} /* }}} */
-
-/* {{{ proto boolean MongoDB\Driver\ReadConcern::isDefault()
- Returns whether the read concern has not been modified (i.e. constructed
- without a level or from a Manager with no read concern URI options). */
-static PHP_METHOD(ReadConcern, isDefault)
-{
- php_phongo_readconcern_t* intern;
-
- intern = Z_READCONCERN_OBJ_P(getThis());
-
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
-
- RETURN_BOOL(mongoc_read_concern_is_default(intern->read_concern));
-} /* }}} */
-
-static HashTable* php_phongo_read_concern_get_properties_hash(zval* object, bool is_debug) /* {{{ */
-{
- php_phongo_readconcern_t* intern;
- HashTable* props;
- const char* level;
-
- intern = Z_READCONCERN_OBJ_P(object);
-
- PHONGO_GET_PROPERTY_HASH_INIT_PROPS(is_debug, intern, props, 1);
-
- if (!intern->read_concern) {
- return props;
- }
-
- level = mongoc_read_concern_get_level(intern->read_concern);
-
- if (level) {
- zval z_level;
-
- ZVAL_STRING(&z_level, level);
- zend_hash_str_update(props, "level", sizeof("level") - 1, &z_level);
- }
-
- return props;
-} /* }}} */
-
-/* {{{ proto array MongoDB\Driver\ReadConcern::bsonSerialize()
-*/
-static PHP_METHOD(ReadConcern, bsonSerialize)
-{
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
-
- ZVAL_ARR(return_value, php_phongo_read_concern_get_properties_hash(getThis(), true));
- convert_to_object(return_value);
-} /* }}} */
-
-/* {{{ proto string MongoDB\Driver\ReadConcern::serialize()
-*/
-static PHP_METHOD(ReadConcern, serialize)
-{
- php_phongo_readconcern_t* intern;
- zval retval;
- php_serialize_data_t var_hash;
- smart_str buf = { 0 };
- const char* level;
-
- intern = Z_READCONCERN_OBJ_P(getThis());
-
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
-
- if (!intern->read_concern) {
- return;
- }
-
- level = mongoc_read_concern_get_level(intern->read_concern);
-
- if (!level) {
- RETURN_STRING("");
- }
-
- array_init_size(&retval, 1);
- ADD_ASSOC_STRING(&retval, "level", level);
-
- PHP_VAR_SERIALIZE_INIT(var_hash);
- php_var_serialize(&buf, &retval, &var_hash);
- smart_str_0(&buf);
- PHP_VAR_SERIALIZE_DESTROY(var_hash);
-
- PHONGO_RETVAL_SMART_STR(buf);
-
- smart_str_free(&buf);
- zval_ptr_dtor(&retval);
-} /* }}} */
-
-/* {{{ proto void MongoDB\Driver\ReadConcern::unserialize(string $serialized)
-*/
-static PHP_METHOD(ReadConcern, unserialize)
-{
- php_phongo_readconcern_t* intern;
- zend_error_handling error_handling;
- char* serialized;
- size_t serialized_len;
- zval props;
- php_unserialize_data_t var_hash;
-
- intern = Z_READCONCERN_OBJ_P(getThis());
-
- zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
-
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &serialized, &serialized_len) == FAILURE) {
- zend_restore_error_handling(&error_handling);
- return;
- }
- zend_restore_error_handling(&error_handling);
-
- if (!serialized_len) {
- return;
- }
-
- PHP_VAR_UNSERIALIZE_INIT(var_hash);
- if (!php_var_unserialize(&props, (const unsigned char**) &serialized, (unsigned char*) serialized + serialized_len, &var_hash)) {
- zval_ptr_dtor(&props);
- phongo_throw_exception(PHONGO_ERROR_UNEXPECTED_VALUE, "%s unserialization failed", ZSTR_VAL(php_phongo_readconcern_ce->name));
-
- PHP_VAR_UNSERIALIZE_DESTROY(var_hash);
- return;
- }
- PHP_VAR_UNSERIALIZE_DESTROY(var_hash);
-
- php_phongo_readconcern_init_from_hash(intern, HASH_OF(&props));
- zval_ptr_dtor(&props);
-} /* }}} */
-
-/* {{{ MongoDB\Driver\ReadConcern function entries */
-ZEND_BEGIN_ARG_INFO_EX(ai_ReadConcern___construct, 0, 0, 0)
- ZEND_ARG_INFO(0, level)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(ai_ReadConcern___set_state, 0, 0, 1)
- ZEND_ARG_ARRAY_INFO(0, properties, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(ai_ReadConcern_unserialize, 0, 0, 1)
- ZEND_ARG_INFO(0, serialized)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(ai_ReadConcern_void, 0, 0, 0)
-ZEND_END_ARG_INFO()
-
-static zend_function_entry php_phongo_readconcern_me[] = {
- /* clang-format off */
- PHP_ME(ReadConcern, __construct, ai_ReadConcern___construct, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
- PHP_ME(ReadConcern, __set_state, ai_ReadConcern___set_state, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
- PHP_ME(ReadConcern, getLevel, ai_ReadConcern_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
- PHP_ME(ReadConcern, isDefault, ai_ReadConcern_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
- PHP_ME(ReadConcern, bsonSerialize, ai_ReadConcern_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
- PHP_ME(ReadConcern, serialize, ai_ReadConcern_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
- PHP_ME(ReadConcern, unserialize, ai_ReadConcern_unserialize, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
- PHP_FE_END
- /* clang-format on */
-};
-/* }}} */
-
-/* {{{ MongoDB\Driver\ReadConcern object handlers */
-static zend_object_handlers php_phongo_handler_readconcern;
-
-static void php_phongo_readconcern_free_object(zend_object* object) /* {{{ */
-{
- php_phongo_readconcern_t* intern = Z_OBJ_READCONCERN(object);
-
- zend_object_std_dtor(&intern->std);
-
- if (intern->properties) {
- zend_hash_destroy(intern->properties);
- FREE_HASHTABLE(intern->properties);
- }
-
- if (intern->read_concern) {
- mongoc_read_concern_destroy(intern->read_concern);
- }
-}
-
-static zend_object* php_phongo_readconcern_create_object(zend_class_entry* class_type) /* {{{ */
-{
- php_phongo_readconcern_t* intern = NULL;
-
- intern = PHONGO_ALLOC_OBJECT_T(php_phongo_readconcern_t, class_type);
-
- zend_object_std_init(&intern->std, class_type);
- object_properties_init(&intern->std, class_type);
-
- intern->std.handlers = &php_phongo_handler_readconcern;
-
- return &intern->std;
-} /* }}} */
-
-static HashTable* php_phongo_readconcern_get_debug_info(zval* object, int* is_temp) /* {{{ */
-{
- *is_temp = 1;
- return php_phongo_read_concern_get_properties_hash(object, true);
-} /* }}} */
-
-static HashTable* php_phongo_readconcern_get_properties(zval* object) /* {{{ */
-{
- return php_phongo_read_concern_get_properties_hash(object, false);
-} /* }}} */
-
-void php_phongo_readconcern_init_ce(INIT_FUNC_ARGS) /* {{{ */
-{
- zend_class_entry ce;
-
- INIT_NS_CLASS_ENTRY(ce, "MongoDB\\Driver", "ReadConcern", php_phongo_readconcern_me);
- php_phongo_readconcern_ce = zend_register_internal_class(&ce);
- php_phongo_readconcern_ce->create_object = php_phongo_readconcern_create_object;
- PHONGO_CE_FINAL(php_phongo_readconcern_ce);
-
- zend_class_implements(php_phongo_readconcern_ce, 1, php_phongo_serializable_ce);
- zend_class_implements(php_phongo_readconcern_ce, 1, zend_ce_serializable);
-
- memcpy(&php_phongo_handler_readconcern, phongo_get_std_object_handlers(), sizeof(zend_object_handlers));
- php_phongo_handler_readconcern.get_debug_info = php_phongo_readconcern_get_debug_info;
- php_phongo_handler_readconcern.get_properties = php_phongo_readconcern_get_properties;
- php_phongo_handler_readconcern.free_obj = php_phongo_readconcern_free_object;
- php_phongo_handler_readconcern.offset = XtOffsetOf(php_phongo_readconcern_t, std);
-
- zend_declare_class_constant_stringl(php_phongo_readconcern_ce, ZEND_STRL("LOCAL"), ZEND_STRL(MONGOC_READ_CONCERN_LEVEL_LOCAL));
- zend_declare_class_constant_stringl(php_phongo_readconcern_ce, ZEND_STRL("MAJORITY"), ZEND_STRL(MONGOC_READ_CONCERN_LEVEL_MAJORITY));
- zend_declare_class_constant_stringl(php_phongo_readconcern_ce, ZEND_STRL("LINEARIZABLE"), ZEND_STRL(MONGOC_READ_CONCERN_LEVEL_LINEARIZABLE));
- zend_declare_class_constant_stringl(php_phongo_readconcern_ce, ZEND_STRL("AVAILABLE"), ZEND_STRL(MONGOC_READ_CONCERN_LEVEL_AVAILABLE));
-} /* }}} */
-
-/*
- * 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.8.1/src/MongoDB/ReadPreference.c b/mongodb-1.8.1/src/MongoDB/ReadPreference.c
deleted file mode 100644
index 87acb4d0..00000000
--- a/mongodb-1.8.1/src/MongoDB/ReadPreference.c
+++ /dev/null
@@ -1,758 +0,0 @@
-/*
- * 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.
- */
-
-#include <php.h>
-#include <Zend/zend_interfaces.h>
-#include <ext/standard/php_var.h>
-#include <zend_smart_str.h>
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php_array_api.h"
-#include "phongo_compat.h"
-#include "php_phongo.h"
-#include "php_bson.h"
-
-zend_class_entry* php_phongo_readpreference_ce;
-
-#define PHONGO_READ_PRIMARY "primary"
-#define PHONGO_READ_PRIMARY_PREFERRED "primaryPreferred"
-#define PHONGO_READ_SECONDARY "secondary"
-#define PHONGO_READ_SECONDARY_PREFERRED "secondaryPreferred"
-#define PHONGO_READ_NEAREST "nearest"
-
-/* Initialize the object from a HashTable and return whether it was successful.
- * An exception will be thrown on error. */
-static bool php_phongo_readpreference_init_from_hash(php_phongo_readpreference_t* intern, HashTable* props) /* {{{ */
-{
- zval *mode, *tagSets, *maxStalenessSeconds, *hedge;
-
- if ((mode = zend_hash_str_find(props, "mode", sizeof("mode") - 1)) && Z_TYPE_P(mode) == IS_STRING) {
- if (strcasecmp(Z_STRVAL_P(mode), PHONGO_READ_PRIMARY) == 0) {
- intern->read_preference = mongoc_read_prefs_new(MONGOC_READ_PRIMARY);
- } else if (strcasecmp(Z_STRVAL_P(mode), PHONGO_READ_PRIMARY_PREFERRED) == 0) {
- intern->read_preference = mongoc_read_prefs_new(MONGOC_READ_PRIMARY_PREFERRED);
- } else if (strcasecmp(Z_STRVAL_P(mode), PHONGO_READ_SECONDARY) == 0) {
- intern->read_preference = mongoc_read_prefs_new(MONGOC_READ_SECONDARY);
- } else if (strcasecmp(Z_STRVAL_P(mode), PHONGO_READ_SECONDARY_PREFERRED) == 0) {
- intern->read_preference = mongoc_read_prefs_new(MONGOC_READ_SECONDARY_PREFERRED);
- } else if (strcasecmp(Z_STRVAL_P(mode), PHONGO_READ_NEAREST) == 0) {
- intern->read_preference = mongoc_read_prefs_new(MONGOC_READ_NEAREST);
- } else {
- phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "%s initialization requires specific values for \"mode\" string field", ZSTR_VAL(php_phongo_readpreference_ce->name));
- return false;
- }
- } else {
- phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "%s initialization requires \"mode\" field to be string", ZSTR_VAL(php_phongo_readpreference_ce->name));
- return false;
- }
-
- if ((tagSets = zend_hash_str_find(props, "tags", sizeof("tags") - 1))) {
- if (Z_TYPE_P(tagSets) == IS_ARRAY) {
- bson_t* tags = bson_new();
-
- php_phongo_read_preference_prep_tagsets(tagSets);
- php_phongo_zval_to_bson(tagSets, PHONGO_BSON_NONE, (bson_t*) tags, NULL);
-
- if (!php_phongo_read_preference_tags_are_valid(tags)) {
- phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "%s initialization requires \"tags\" array field to have zero or more documents", ZSTR_VAL(php_phongo_readpreference_ce->name));
- bson_destroy(tags);
- goto failure;
- }
-
- if (!bson_empty(tags) && (mongoc_read_prefs_get_mode(intern->read_preference) == MONGOC_READ_PRIMARY)) {
- phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "%s initialization requires \"tags\" array field to not be present with \"primary\" mode", ZSTR_VAL(php_phongo_readpreference_ce->name));
- bson_destroy(tags);
- goto failure;
- }
-
- mongoc_read_prefs_set_tags(intern->read_preference, tags);
- bson_destroy(tags);
- } else {
- phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "%s initialization requires \"tags\" field to be array", ZSTR_VAL(php_phongo_readpreference_ce->name));
- goto failure;
- }
- }
-
- if ((maxStalenessSeconds = zend_hash_str_find(props, "maxStalenessSeconds", sizeof("maxStalenessSeconds") - 1))) {
- if (Z_TYPE_P(maxStalenessSeconds) == IS_LONG) {
- if (Z_LVAL_P(maxStalenessSeconds) != MONGOC_NO_MAX_STALENESS) {
- if (mongoc_read_prefs_get_mode(intern->read_preference) == MONGOC_READ_PRIMARY) {
- phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "%s initialization requires \"maxStalenessSeconds\" field to not be present with \"primary\" mode", ZSTR_VAL(php_phongo_readpreference_ce->name));
- goto failure;
- }
- if (Z_LVAL_P(maxStalenessSeconds) < MONGOC_SMALLEST_MAX_STALENESS_SECONDS) {
- phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "%s initialization requires \"maxStalenessSeconds\" integer field to be >= %d", ZSTR_VAL(php_phongo_readpreference_ce->name), MONGOC_SMALLEST_MAX_STALENESS_SECONDS);
- goto failure;
- }
- if (Z_LVAL_P(maxStalenessSeconds) > INT32_MAX) {
- phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "%s initialization requires \"maxStalenessSeconds\" integer field to be <= %" PRId32, ZSTR_VAL(php_phongo_readpreference_ce->name), INT32_MAX);
- goto failure;
- }
- }
-
- mongoc_read_prefs_set_max_staleness_seconds(intern->read_preference, Z_LVAL_P(maxStalenessSeconds));
- } else {
- phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "%s initialization requires \"maxStalenessSeconds\" field to be integer", ZSTR_VAL(php_phongo_readpreference_ce->name));
- goto failure;
- }
- }
-
- if ((hedge = zend_hash_str_find(props, "hedge", sizeof("hedge") - 1))) {
- if (Z_TYPE_P(hedge) == IS_ARRAY || Z_TYPE_P(hedge) == IS_OBJECT) {
- bson_t* hedge_doc = bson_new();
-
- if (mongoc_read_prefs_get_mode(intern->read_preference) == MONGOC_READ_PRIMARY) {
- phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "%s initialization requires \"hedge\" field to not be present with \"primary\" mode", ZSTR_VAL(php_phongo_readpreference_ce->name));
- bson_destroy(hedge_doc);
- goto failure;
- }
-
- php_phongo_zval_to_bson(hedge, PHONGO_BSON_NONE, hedge_doc, NULL);
-
- if (EG(exception)) {
- bson_destroy(hedge_doc);
- goto failure;
- }
-
- mongoc_read_prefs_set_hedge(intern->read_preference, hedge_doc);
- bson_destroy(hedge_doc);
- } else {
- phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "%s initialization requires \"hedge\" field to be an array or object", ZSTR_VAL(php_phongo_readpreference_ce->name));
- goto failure;
- }
- }
-
- if (!mongoc_read_prefs_is_valid(intern->read_preference)) {
- phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Read preference is not valid");
- goto failure;
- }
-
- return true;
-
-failure:
- mongoc_read_prefs_destroy(intern->read_preference);
- intern->read_preference = NULL;
- return false;
-} /* }}} */
-
-static const char* php_phongo_readpreference_get_mode_string(mongoc_read_mode_t mode) /* {{{ */
-{
- switch (mode) {
- case MONGOC_READ_PRIMARY:
- return PHONGO_READ_PRIMARY;
- case MONGOC_READ_PRIMARY_PREFERRED:
- return PHONGO_READ_PRIMARY_PREFERRED;
- case MONGOC_READ_SECONDARY:
- return PHONGO_READ_SECONDARY;
- case MONGOC_READ_SECONDARY_PREFERRED:
- return PHONGO_READ_SECONDARY_PREFERRED;
- case MONGOC_READ_NEAREST:
- return PHONGO_READ_NEAREST;
- default:
- /* Should never happen, but if it does: exception */
- phongo_throw_exception(PHONGO_ERROR_LOGIC, "Mode '%d' should never have been passed to php_phongo_readpreference_get_mode_string, please file a bug report", mode);
- break;
- }
-
- return NULL;
-} /* }}} */
-
-/* {{{ proto void MongoDB\Driver\ReadPreference::__construct(int|string $mode[, array $tagSets = array()[, array $options = array()]])
- Constructs a new ReadPreference */
-static PHP_METHOD(ReadPreference, __construct)
-{
- php_phongo_readpreference_t* intern;
- zend_error_handling error_handling;
- zval* mode;
- zval* tagSets = NULL;
- zval* options = NULL;
-
- zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
- intern = Z_READPREFERENCE_OBJ_P(getThis());
-
- /* Separate the tagSets zval, since we may end up modifying it in
- * php_phongo_read_preference_prep_tagsets() below. */
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "z|a/!a!", &mode, &tagSets, &options) == FAILURE) {
- zend_restore_error_handling(&error_handling);
- return;
- }
- zend_restore_error_handling(&error_handling);
-
- if (Z_TYPE_P(mode) == IS_LONG) {
- switch (Z_LVAL_P(mode)) {
- case MONGOC_READ_PRIMARY:
- case MONGOC_READ_SECONDARY:
- case MONGOC_READ_PRIMARY_PREFERRED:
- case MONGOC_READ_SECONDARY_PREFERRED:
- case MONGOC_READ_NEAREST:
- intern->read_preference = mongoc_read_prefs_new(Z_LVAL_P(mode));
- break;
- default:
- phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Invalid mode: %" PHONGO_LONG_FORMAT, Z_LVAL_P(mode));
- return;
- }
- } else if (Z_TYPE_P(mode) == IS_STRING) {
- if (strcasecmp(Z_STRVAL_P(mode), PHONGO_READ_PRIMARY) == 0) {
- intern->read_preference = mongoc_read_prefs_new(MONGOC_READ_PRIMARY);
- } else if (strcasecmp(Z_STRVAL_P(mode), PHONGO_READ_PRIMARY_PREFERRED) == 0) {
- intern->read_preference = mongoc_read_prefs_new(MONGOC_READ_PRIMARY_PREFERRED);
- } else if (strcasecmp(Z_STRVAL_P(mode), PHONGO_READ_SECONDARY) == 0) {
- intern->read_preference = mongoc_read_prefs_new(MONGOC_READ_SECONDARY);
- } else if (strcasecmp(Z_STRVAL_P(mode), PHONGO_READ_SECONDARY_PREFERRED) == 0) {
- intern->read_preference = mongoc_read_prefs_new(MONGOC_READ_SECONDARY_PREFERRED);
- } else if (strcasecmp(Z_STRVAL_P(mode), PHONGO_READ_NEAREST) == 0) {
- intern->read_preference = mongoc_read_prefs_new(MONGOC_READ_NEAREST);
- } else {
- phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Invalid mode: '%s'", Z_STRVAL_P(mode));
- return;
- }
- } else {
- phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Expected mode to be integer or string, %s given", PHONGO_ZVAL_CLASS_OR_TYPE_NAME_P(mode));
- return;
- }
-
- if (tagSets) {
- bson_t* tags = bson_new();
-
- php_phongo_read_preference_prep_tagsets(tagSets);
- php_phongo_zval_to_bson(tagSets, PHONGO_BSON_NONE, (bson_t*) tags, NULL);
-
- if (!php_phongo_read_preference_tags_are_valid(tags)) {
- phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "tagSets must be an array of zero or more documents");
- bson_destroy(tags);
- return;
- }
-
- if (!bson_empty(tags) && (mongoc_read_prefs_get_mode(intern->read_preference) == MONGOC_READ_PRIMARY)) {
- phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "tagSets may not be used with primary mode");
- bson_destroy(tags);
- return;
- }
-
- mongoc_read_prefs_set_tags(intern->read_preference, tags);
- bson_destroy(tags);
- }
-
- if (options && php_array_exists(options, "maxStalenessSeconds")) {
- zend_long maxStalenessSeconds = php_array_fetchc_long(options, "maxStalenessSeconds");
-
- if (maxStalenessSeconds != MONGOC_NO_MAX_STALENESS) {
- if (maxStalenessSeconds < MONGOC_SMALLEST_MAX_STALENESS_SECONDS) {
- phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Expected maxStalenessSeconds to be >= %d, %" PHONGO_LONG_FORMAT " given", MONGOC_SMALLEST_MAX_STALENESS_SECONDS, maxStalenessSeconds);
- return;
- }
- if (maxStalenessSeconds > INT32_MAX) {
- phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Expected maxStalenessSeconds to be <= %" PRId32 ", %" PHONGO_LONG_FORMAT " given", INT32_MAX, maxStalenessSeconds);
- return;
- }
- if (mongoc_read_prefs_get_mode(intern->read_preference) == MONGOC_READ_PRIMARY) {
- phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "maxStalenessSeconds may not be used with primary mode");
- return;
- }
- }
-
- mongoc_read_prefs_set_max_staleness_seconds(intern->read_preference, maxStalenessSeconds);
- }
-
- if (options && php_array_exists(options, "hedge")) {
- zval* hedge = php_array_fetchc(options, "hedge");
-
- if (Z_TYPE_P(hedge) == IS_ARRAY || Z_TYPE_P(hedge) == IS_OBJECT) {
- bson_t* hedge_doc = bson_new();
-
- if (mongoc_read_prefs_get_mode(intern->read_preference) == MONGOC_READ_PRIMARY) {
- phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "hedge may not be used with primary mode");
- bson_destroy(hedge_doc);
- return;
- }
-
- php_phongo_zval_to_bson(hedge, PHONGO_BSON_NONE, hedge_doc, NULL);
-
- if (EG(exception)) {
- bson_destroy(hedge_doc);
- return;
- }
-
- mongoc_read_prefs_set_hedge(intern->read_preference, hedge_doc);
- bson_destroy(hedge_doc);
- } else {
- phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "%s initialization requires \"hedge\" field to be an array or object", ZSTR_VAL(php_phongo_readpreference_ce->name));
- return;
- }
- }
-
- if (!mongoc_read_prefs_is_valid(intern->read_preference)) {
- phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Read preference is not valid");
- return;
- }
-} /* }}} */
-
-/* {{{ proto void MongoDB\BSON\ReadPreference::__set_state(array $properties)
-*/
-static PHP_METHOD(ReadPreference, __set_state)
-{
- php_phongo_readpreference_t* intern;
- HashTable* props;
- zval* array;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "a", &array) == FAILURE) {
- RETURN_FALSE;
- }
-
- object_init_ex(return_value, php_phongo_readpreference_ce);
-
- intern = Z_READPREFERENCE_OBJ_P(return_value);
- props = Z_ARRVAL_P(array);
-
- php_phongo_readpreference_init_from_hash(intern, props);
-} /* }}} */
-
-/* {{{ proto array|null MongoDB\Driver\ReadPreference::getHedge()
- Returns the ReadPreference hedge document */
-static PHP_METHOD(ReadPreference, getHedge)
-{
- php_phongo_readpreference_t* intern;
- const bson_t* hedge;
-
- intern = Z_READPREFERENCE_OBJ_P(getThis());
-
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
-
- hedge = mongoc_read_prefs_get_hedge(intern->read_preference);
-
- if (!bson_empty0(hedge)) {
- php_phongo_bson_state state;
-
- PHONGO_BSON_INIT_STATE(state);
-
- if (!php_phongo_bson_to_zval_ex(bson_get_data(hedge), hedge->len, &state)) {
- zval_ptr_dtor(&state.zchild);
- return;
- }
-
- RETURN_ZVAL(&state.zchild, 0, 1);
- } else {
- RETURN_NULL();
- }
-} /* }}} */
-
-/* {{{ proto integer MongoDB\Driver\ReadPreference::getMaxStalenessSeconds()
- Returns the ReadPreference maxStalenessSeconds value */
-static PHP_METHOD(ReadPreference, getMaxStalenessSeconds)
-{
- php_phongo_readpreference_t* intern;
-
- intern = Z_READPREFERENCE_OBJ_P(getThis());
-
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
-
- RETURN_LONG(mongoc_read_prefs_get_max_staleness_seconds(intern->read_preference));
-} /* }}} */
-
-/* {{{ proto integer MongoDB\Driver\ReadPreference::getMode()
- Returns the ReadPreference mode */
-static PHP_METHOD(ReadPreference, getMode)
-{
- php_phongo_readpreference_t* intern;
-
- intern = Z_READPREFERENCE_OBJ_P(getThis());
-
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
-
- RETURN_LONG(mongoc_read_prefs_get_mode(intern->read_preference));
-} /* }}} */
-
-/* {{{ proto string MongoDB\Driver\ReadPreference::getModeString()
- Returns the ReadPreference mode as string */
-static PHP_METHOD(ReadPreference, getModeString)
-{
- php_phongo_readpreference_t* intern;
- const char* mode_string;
-
- intern = Z_READPREFERENCE_OBJ_P(getThis());
-
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
-
- mode_string = php_phongo_readpreference_get_mode_string(mongoc_read_prefs_get_mode(intern->read_preference));
- if (!mode_string) {
- /* Exception already thrown */
- return;
- }
-
- RETURN_STRING(mode_string);
-} /* }}} */
-
-/* {{{ proto array MongoDB\Driver\ReadPreference::getTagSets()
- Returns the ReadPreference tag sets */
-static PHP_METHOD(ReadPreference, getTagSets)
-{
- php_phongo_readpreference_t* intern;
- const bson_t* tags;
-
- intern = Z_READPREFERENCE_OBJ_P(getThis());
-
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
-
- tags = mongoc_read_prefs_get_tags(intern->read_preference);
-
- if (tags->len) {
- php_phongo_bson_state state;
-
- PHONGO_BSON_INIT_DEBUG_STATE(state);
-
- if (!php_phongo_bson_to_zval_ex(bson_get_data(tags), tags->len, &state)) {
- zval_ptr_dtor(&state.zchild);
- return;
- }
-
- RETURN_ZVAL(&state.zchild, 0, 1);
- } else {
- RETURN_NULL();
- }
-} /* }}} */
-
-static HashTable* php_phongo_readpreference_get_properties_hash(zval* object, bool is_debug) /* {{{ */
-{
- php_phongo_readpreference_t* intern;
- HashTable* props;
- const char* modeString = NULL;
- const bson_t* tags;
- const bson_t* hedge;
- mongoc_read_mode_t mode;
-
- intern = Z_READPREFERENCE_OBJ_P(object);
-
- PHONGO_GET_PROPERTY_HASH_INIT_PROPS(is_debug, intern, props, 4);
-
- if (!intern->read_preference) {
- return props;
- }
-
- tags = mongoc_read_prefs_get_tags(intern->read_preference);
- mode = mongoc_read_prefs_get_mode(intern->read_preference);
- modeString = php_phongo_readpreference_get_mode_string(mode);
- hedge = mongoc_read_prefs_get_hedge(intern->read_preference);
-
- if (modeString) {
- zval z_mode;
-
- ZVAL_STRING(&z_mode, modeString);
- zend_hash_str_update(props, "mode", sizeof("mode") - 1, &z_mode);
- }
-
- if (!bson_empty0(tags)) {
- php_phongo_bson_state state;
-
- /* Use PHONGO_TYPEMAP_NATIVE_ARRAY for the root type since tags is an
- * array; however, inner documents and arrays can use the default. */
- PHONGO_BSON_INIT_STATE(state);
- state.map.root_type = PHONGO_TYPEMAP_NATIVE_ARRAY;
-
- if (!php_phongo_bson_to_zval_ex(bson_get_data(tags), tags->len, &state)) {
- zval_ptr_dtor(&state.zchild);
- goto done;
- }
-
- zend_hash_str_update(props, "tags", sizeof("tags") - 1, &state.zchild);
- }
-
- if (mongoc_read_prefs_get_max_staleness_seconds(intern->read_preference) != MONGOC_NO_MAX_STALENESS) {
- long maxStalenessSeconds = mongoc_read_prefs_get_max_staleness_seconds(intern->read_preference);
- zval z_max_ss;
-
- ZVAL_LONG(&z_max_ss, maxStalenessSeconds);
- zend_hash_str_update(props, "maxStalenessSeconds", sizeof("maxStalenessSeconds") - 1, &z_max_ss);
- }
-
- if (!bson_empty0(hedge)) {
- php_phongo_bson_state state;
-
- PHONGO_BSON_INIT_STATE(state);
-
- if (!php_phongo_bson_to_zval_ex(bson_get_data(hedge), hedge->len, &state)) {
- zval_ptr_dtor(&state.zchild);
- goto done;
- }
-
- zend_hash_str_update(props, "hedge", sizeof("hedge") - 1, &state.zchild);
- }
-
-done:
- return props;
-} /* }}} */
-
-/* {{{ proto array MongoDB\Driver\ReadPreference::bsonSerialize()
-*/
-static PHP_METHOD(ReadPreference, bsonSerialize)
-{
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
-
- ZVAL_ARR(return_value, php_phongo_readpreference_get_properties_hash(getThis(), true));
- convert_to_object(return_value);
-} /* }}} */
-
-/* {{{ proto string MongoDB\Driver\ReadPreference::serialize()
-*/
-static PHP_METHOD(ReadPreference, serialize)
-{
- php_phongo_readpreference_t* intern;
- zval retval;
- php_serialize_data_t var_hash;
- smart_str buf = { 0 };
- const char* modeString = NULL;
- const bson_t* tags;
- const bson_t* hedge;
- int64_t maxStalenessSeconds;
- mongoc_read_mode_t mode;
-
- intern = Z_READPREFERENCE_OBJ_P(getThis());
-
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
-
- if (!intern->read_preference) {
- return;
- }
-
- tags = mongoc_read_prefs_get_tags(intern->read_preference);
- mode = mongoc_read_prefs_get_mode(intern->read_preference);
- modeString = php_phongo_readpreference_get_mode_string(mode);
- maxStalenessSeconds = mongoc_read_prefs_get_max_staleness_seconds(intern->read_preference);
- hedge = mongoc_read_prefs_get_hedge(intern->read_preference);
-
- array_init_size(&retval, 4);
-
- if (modeString) {
- ADD_ASSOC_STRING(&retval, "mode", modeString);
- }
-
- if (!bson_empty0(tags)) {
- php_phongo_bson_state state;
-
- PHONGO_BSON_INIT_DEBUG_STATE(state);
-
- if (!php_phongo_bson_to_zval_ex(bson_get_data(tags), tags->len, &state)) {
- zval_ptr_dtor(&state.zchild);
- return;
- }
-
- ADD_ASSOC_ZVAL_EX(&retval, "tags", &state.zchild);
- }
-
- if (maxStalenessSeconds != MONGOC_NO_MAX_STALENESS) {
- ADD_ASSOC_LONG_EX(&retval, "maxStalenessSeconds", maxStalenessSeconds);
- }
-
- if (!bson_empty0(hedge)) {
- php_phongo_bson_state state;
-
- PHONGO_BSON_INIT_STATE(state);
-
- if (!php_phongo_bson_to_zval_ex(bson_get_data(hedge), hedge->len, &state)) {
- zval_ptr_dtor(&state.zchild);
- return;
- }
-
- ADD_ASSOC_ZVAL_EX(&retval, "hedge", &state.zchild);
- }
-
- PHP_VAR_SERIALIZE_INIT(var_hash);
- php_var_serialize(&buf, &retval, &var_hash);
- smart_str_0(&buf);
- PHP_VAR_SERIALIZE_DESTROY(var_hash);
-
- PHONGO_RETVAL_SMART_STR(buf);
-
- smart_str_free(&buf);
- zval_ptr_dtor(&retval);
-} /* }}} */
-
-/* {{{ proto void MongoDB\Driver\ReadPreference::unserialize(string $serialized)
-*/
-static PHP_METHOD(ReadPreference, unserialize)
-{
- php_phongo_readpreference_t* intern;
- zend_error_handling error_handling;
- char* serialized;
- size_t serialized_len;
- zval props;
- php_unserialize_data_t var_hash;
-
- intern = Z_READPREFERENCE_OBJ_P(getThis());
-
- zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
-
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &serialized, &serialized_len) == FAILURE) {
- zend_restore_error_handling(&error_handling);
- return;
- }
- zend_restore_error_handling(&error_handling);
-
- if (!serialized_len) {
- return;
- }
-
- PHP_VAR_UNSERIALIZE_INIT(var_hash);
- if (!php_var_unserialize(&props, (const unsigned char**) &serialized, (unsigned char*) serialized + serialized_len, &var_hash)) {
- zval_ptr_dtor(&props);
- phongo_throw_exception(PHONGO_ERROR_UNEXPECTED_VALUE, "%s unserialization failed", ZSTR_VAL(php_phongo_readpreference_ce->name));
-
- PHP_VAR_UNSERIALIZE_DESTROY(var_hash);
- return;
- }
- PHP_VAR_UNSERIALIZE_DESTROY(var_hash);
-
- php_phongo_readpreference_init_from_hash(intern, HASH_OF(&props));
- zval_ptr_dtor(&props);
-} /* }}} */
-
-/* {{{ MongoDB\Driver\ReadPreference function entries */
-ZEND_BEGIN_ARG_INFO_EX(ai_ReadPreference___construct, 0, 0, 1)
- ZEND_ARG_INFO(0, mode)
- ZEND_ARG_ARRAY_INFO(0, tagSets, 1)
- ZEND_ARG_ARRAY_INFO(0, options, 1)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(ai_ReadPreference___set_state, 0, 0, 1)
- ZEND_ARG_ARRAY_INFO(0, properties, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(ai_ReadPreference_unserialize, 0, 0, 1)
- ZEND_ARG_INFO(0, serialized)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(ai_ReadPreference_void, 0, 0, 0)
-ZEND_END_ARG_INFO()
-
-static zend_function_entry php_phongo_readpreference_me[] = {
- /* clang-format off */
- PHP_ME(ReadPreference, __construct, ai_ReadPreference___construct, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
- PHP_ME(ReadPreference, __set_state, ai_ReadPreference___set_state, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
- PHP_ME(ReadPreference, getHedge, ai_ReadPreference_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
- PHP_ME(ReadPreference, getMaxStalenessSeconds, ai_ReadPreference_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
- PHP_ME(ReadPreference, getMode, ai_ReadPreference_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
- PHP_ME(ReadPreference, getModeString, ai_ReadPreference_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
- PHP_ME(ReadPreference, getTagSets, ai_ReadPreference_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
- PHP_ME(ReadPreference, bsonSerialize, ai_ReadPreference_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
- PHP_ME(ReadPreference, serialize, ai_ReadPreference_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
- PHP_ME(ReadPreference, unserialize, ai_ReadPreference_unserialize, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
- PHP_FE_END
- /* clang-format on */
-};
-/* }}} */
-
-/* {{{ MongoDB\Driver\ReadPreference object handlers */
-static zend_object_handlers php_phongo_handler_readpreference;
-
-static void php_phongo_readpreference_free_object(zend_object* object) /* {{{ */
-{
- php_phongo_readpreference_t* intern = Z_OBJ_READPREFERENCE(object);
-
- zend_object_std_dtor(&intern->std);
-
- if (intern->properties) {
- zend_hash_destroy(intern->properties);
- FREE_HASHTABLE(intern->properties);
- }
-
- if (intern->read_preference) {
- mongoc_read_prefs_destroy(intern->read_preference);
- }
-} /* }}} */
-
-static zend_object* php_phongo_readpreference_create_object(zend_class_entry* class_type) /* {{{ */
-{
- php_phongo_readpreference_t* intern = NULL;
-
- intern = PHONGO_ALLOC_OBJECT_T(php_phongo_readpreference_t, class_type);
-
- zend_object_std_init(&intern->std, class_type);
- object_properties_init(&intern->std, class_type);
-
- intern->std.handlers = &php_phongo_handler_readpreference;
-
- return &intern->std;
-} /* }}} */
-
-static HashTable* php_phongo_readpreference_get_debug_info(zval* object, int* is_temp) /* {{{ */
-{
- *is_temp = 1;
- return php_phongo_readpreference_get_properties_hash(object, true);
-} /* }}} */
-
-static HashTable* php_phongo_readpreference_get_properties(zval* object) /* {{{ */
-{
- return php_phongo_readpreference_get_properties_hash(object, false);
-} /* }}} */
-/* }}} */
-
-void php_phongo_readpreference_init_ce(INIT_FUNC_ARGS) /* {{{ */
-{
- zend_class_entry ce;
-
- INIT_NS_CLASS_ENTRY(ce, "MongoDB\\Driver", "ReadPreference", php_phongo_readpreference_me);
- php_phongo_readpreference_ce = zend_register_internal_class(&ce);
- php_phongo_readpreference_ce->create_object = php_phongo_readpreference_create_object;
- PHONGO_CE_FINAL(php_phongo_readpreference_ce);
-
- zend_class_implements(php_phongo_readpreference_ce, 1, php_phongo_serializable_ce);
- zend_class_implements(php_phongo_readpreference_ce, 1, zend_ce_serializable);
-
- memcpy(&php_phongo_handler_readpreference, phongo_get_std_object_handlers(), sizeof(zend_object_handlers));
- php_phongo_handler_readpreference.get_debug_info = php_phongo_readpreference_get_debug_info;
- php_phongo_handler_readpreference.get_properties = php_phongo_readpreference_get_properties;
- php_phongo_handler_readpreference.free_obj = php_phongo_readpreference_free_object;
- php_phongo_handler_readpreference.offset = XtOffsetOf(php_phongo_readpreference_t, std);
-
- zend_declare_class_constant_long(php_phongo_readpreference_ce, ZEND_STRL("RP_PRIMARY"), MONGOC_READ_PRIMARY);
- zend_declare_class_constant_long(php_phongo_readpreference_ce, ZEND_STRL("RP_PRIMARY_PREFERRED"), MONGOC_READ_PRIMARY_PREFERRED);
- zend_declare_class_constant_long(php_phongo_readpreference_ce, ZEND_STRL("RP_SECONDARY"), MONGOC_READ_SECONDARY);
- zend_declare_class_constant_long(php_phongo_readpreference_ce, ZEND_STRL("RP_SECONDARY_PREFERRED"), MONGOC_READ_SECONDARY_PREFERRED);
- zend_declare_class_constant_long(php_phongo_readpreference_ce, ZEND_STRL("RP_NEAREST"), MONGOC_READ_NEAREST);
- zend_declare_class_constant_long(php_phongo_readpreference_ce, ZEND_STRL("NO_MAX_STALENESS"), MONGOC_NO_MAX_STALENESS);
- zend_declare_class_constant_long(php_phongo_readpreference_ce, ZEND_STRL("SMALLEST_MAX_STALENESS_SECONDS"), MONGOC_SMALLEST_MAX_STALENESS_SECONDS);
-
- zend_declare_class_constant_string(php_phongo_readpreference_ce, ZEND_STRL("PRIMARY"), PHONGO_READ_PRIMARY);
- zend_declare_class_constant_string(php_phongo_readpreference_ce, ZEND_STRL("PRIMARY_PREFERRED"), PHONGO_READ_PRIMARY_PREFERRED);
- zend_declare_class_constant_string(php_phongo_readpreference_ce, ZEND_STRL("SECONDARY"), PHONGO_READ_SECONDARY);
- zend_declare_class_constant_string(php_phongo_readpreference_ce, ZEND_STRL("SECONDARY_PREFERRED"), PHONGO_READ_SECONDARY_PREFERRED);
- zend_declare_class_constant_string(php_phongo_readpreference_ce, ZEND_STRL("NEAREST"), PHONGO_READ_NEAREST);
-} /* }}} */
-
-/*
- * 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.8.1/src/MongoDB/Server.c b/mongodb-1.8.1/src/MongoDB/Server.c
deleted file mode 100644
index 83236396..00000000
--- a/mongodb-1.8.1/src/MongoDB/Server.c
+++ /dev/null
@@ -1,644 +0,0 @@
-/*
- * 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.
- */
-
-#include <php.h>
-#include <Zend/zend_interfaces.h>
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "phongo_compat.h"
-#include "php_phongo.h"
-#include "php_bson.h"
-
-zend_class_entry* php_phongo_server_ce;
-
-/* {{{ proto MongoDB\Driver\Cursor MongoDB\Driver\Server::executeCommand(string $db, MongoDB\Driver\Command $command[, array $options = null]))
- Executes a Command on this Server */
-static PHP_METHOD(Server, executeCommand)
-{
- php_phongo_server_t* intern;
- char* db;
- size_t db_len;
- zval* command;
- zval* options = NULL;
- bool free_options = false;
-
- intern = Z_SERVER_OBJ_P(getThis());
-
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "sO|z!", &db, &db_len, &command, php_phongo_command_ce, &options) == FAILURE) {
- return;
- }
-
- options = php_phongo_prep_legacy_option(options, "readPreference", &free_options);
-
- /* If the Server was created in a different process, reset the client so
- * that cursors created by this process can be differentiated and its
- * session pool is cleared. */
- PHONGO_RESET_CLIENT_IF_PID_DIFFERS(intern);
-
- phongo_execute_command(intern->client, PHONGO_COMMAND_RAW, db, command, options, intern->server_id, return_value);
-
- if (free_options) {
- php_phongo_prep_legacy_option_free(options);
- }
-} /* }}} */
-
-/* {{{ proto MongoDB\Driver\Cursor MongoDB\Driver\Server::executeReadCommand(string $db, MongoDB\Driver\Command $command[, array $options = null]))
- Executes a ReadCommand on this Server */
-static PHP_METHOD(Server, executeReadCommand)
-{
- php_phongo_server_t* intern;
- char* db;
- size_t db_len;
- zval* command;
- zval* options = NULL;
-
- intern = Z_SERVER_OBJ_P(getThis());
-
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "sO|a!", &db, &db_len, &command, php_phongo_command_ce, &options) == FAILURE) {
- return;
- }
-
- /* If the Server was created in a different process, reset the client so
- * that cursors created by this process can be differentiated and its
- * session pool is cleared. */
- PHONGO_RESET_CLIENT_IF_PID_DIFFERS(intern);
-
- phongo_execute_command(intern->client, PHONGO_COMMAND_READ, db, command, options, intern->server_id, return_value);
-} /* }}} */
-
-/* {{{ proto MongoDB\Driver\Cursor MongoDB\Driver\Server::executeWriteCommand(string $db, MongoDB\Driver\Command $command[, array $options = null]))
- Executes a WriteCommand on this Server */
-static PHP_METHOD(Server, executeWriteCommand)
-{
- php_phongo_server_t* intern;
- char* db;
- size_t db_len;
- zval* command;
- zval* options = NULL;
-
- intern = Z_SERVER_OBJ_P(getThis());
-
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "sO|a!", &db, &db_len, &command, php_phongo_command_ce, &options) == FAILURE) {
- return;
- }
-
- /* If the Server was created in a different process, reset the client so
- * that cursors created by this process can be differentiated. and its
- * session pool is cleared. */
- PHONGO_RESET_CLIENT_IF_PID_DIFFERS(intern);
-
- phongo_execute_command(intern->client, PHONGO_COMMAND_WRITE, db, command, options, intern->server_id, return_value);
-} /* }}} */
-
-/* {{{ proto MongoDB\Driver\Cursor MongoDB\Driver\Server::executeReadWriteCommand(string $db, MongoDB\Driver\Command $command[, array $options = null]))
- Executes a ReadWriteCommand on this Server */
-static PHP_METHOD(Server, executeReadWriteCommand)
-{
- php_phongo_server_t* intern;
- char* db;
- size_t db_len;
- zval* command;
- zval* options = NULL;
-
- intern = Z_SERVER_OBJ_P(getThis());
-
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "sO|a!", &db, &db_len, &command, php_phongo_command_ce, &options) == FAILURE) {
- return;
- }
-
- /* If the Server was created in a different process, reset the client so
- * that cursors created by this process can be differentiated and its
- * session pool is cleared. */
- PHONGO_RESET_CLIENT_IF_PID_DIFFERS(intern);
-
- phongo_execute_command(intern->client, PHONGO_COMMAND_READ_WRITE, db, command, options, intern->server_id, return_value);
-} /* }}} */
-
-/* {{{ proto MongoDB\Driver\Cursor MongoDB\Driver\Server::executeQuery(string $namespace, MongoDB\Driver\Query $query[, array $options = null]))
- Executes a Query on this Server */
-static PHP_METHOD(Server, executeQuery)
-{
- php_phongo_server_t* intern;
- char* namespace;
- size_t namespace_len;
- zval* query;
- zval* options = NULL;
- bool free_options = false;
-
- intern = Z_SERVER_OBJ_P(getThis());
-
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "sO|z!", &namespace, &namespace_len, &query, php_phongo_query_ce, &options) == FAILURE) {
- return;
- }
-
- options = php_phongo_prep_legacy_option(options, "readPreference", &free_options);
-
- /* If the Server was created in a different process, reset the client so
- * that cursors created by this process can be differentiated and its
- * session pool is cleared. */
- PHONGO_RESET_CLIENT_IF_PID_DIFFERS(intern);
-
- phongo_execute_query(intern->client, namespace, query, options, intern->server_id, return_value);
-
- if (free_options) {
- php_phongo_prep_legacy_option_free(options);
- }
-} /* }}} */
-
-/* {{{ proto MongoDB\Driver\WriteResult MongoDB\Driver\Server::executeBulkWrite(string $namespace, MongoDB\Driver\BulkWrite $zbulk[, array $options = null])
- Executes a BulkWrite (i.e. any number of insert, update, and delete ops) on
- this Server */
-static PHP_METHOD(Server, executeBulkWrite)
-{
- php_phongo_server_t* intern;
- char* namespace;
- size_t namespace_len;
- zval* zbulk;
- php_phongo_bulkwrite_t* bulk;
- zval* options = NULL;
- bool free_options = false;
-
- intern = Z_SERVER_OBJ_P(getThis());
-
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "sO|z!", &namespace, &namespace_len, &zbulk, php_phongo_bulkwrite_ce, &options, php_phongo_writeconcern_ce) == FAILURE) {
- return;
- }
-
- bulk = Z_BULKWRITE_OBJ_P(zbulk);
-
- options = php_phongo_prep_legacy_option(options, "writeConcern", &free_options);
-
- /* If the Server was created in a different process, reset the client so
- * that its session pool is cleared. */
- PHONGO_RESET_CLIENT_IF_PID_DIFFERS(intern);
-
- phongo_execute_bulk_write(intern->client, namespace, bulk, options, intern->server_id, return_value);
-
- if (free_options) {
- php_phongo_prep_legacy_option_free(options);
- }
-} /* }}} */
-
-/* {{{ proto string MongoDB\Driver\Server::getHost()
- Returns the hostname for this Server */
-static PHP_METHOD(Server, getHost)
-{
- php_phongo_server_t* intern;
- mongoc_server_description_t* sd;
-
- intern = Z_SERVER_OBJ_P(getThis());
-
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
-
- if ((sd = mongoc_client_get_server_description(intern->client, intern->server_id))) {
- RETVAL_STRING(mongoc_server_description_host(sd)->host);
- mongoc_server_description_destroy(sd);
- return;
- }
-
- phongo_throw_exception(PHONGO_ERROR_RUNTIME, "Failed to get server description");
-} /* }}} */
-
-/* {{{ proto array MongoDB\Driver\Server::getTags()
- Returns the currently configured tags for this Server */
-static PHP_METHOD(Server, getTags)
-{
- php_phongo_server_t* intern;
- mongoc_server_description_t* sd;
-
- intern = Z_SERVER_OBJ_P(getThis());
-
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
-
- if ((sd = mongoc_client_get_server_description(intern->client, intern->server_id))) {
- const bson_t* is_master = mongoc_server_description_ismaster(sd);
- bson_iter_t 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_INIT_DEBUG_STATE(state);
- bson_iter_document(&iter, &len, &bytes);
-
- if (!php_phongo_bson_to_zval_ex(bytes, len, &state)) {
- /* Exception should already have been thrown */
- zval_ptr_dtor(&state.zchild);
- mongoc_server_description_destroy(sd);
- return;
- }
-
- mongoc_server_description_destroy(sd);
-
- RETURN_ZVAL(&state.zchild, 0, 1);
- }
-
- array_init(return_value);
- mongoc_server_description_destroy(sd);
- return;
- }
-
- phongo_throw_exception(PHONGO_ERROR_RUNTIME, "Failed to get server description");
-} /* }}} */
-
-/* {{{ proto array MongoDB\Driver\Server::getInfo()
- Returns the last isMaster result document for this Server */
-static PHP_METHOD(Server, getInfo)
-{
- php_phongo_server_t* intern;
- mongoc_server_description_t* sd;
-
- intern = Z_SERVER_OBJ_P(getThis());
-
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
-
- if ((sd = mongoc_client_get_server_description(intern->client, intern->server_id))) {
- const bson_t* is_master = mongoc_server_description_ismaster(sd);
- php_phongo_bson_state state;
-
- PHONGO_BSON_INIT_DEBUG_STATE(state);
-
- if (!php_phongo_bson_to_zval_ex(bson_get_data(is_master), is_master->len, &state)) {
- /* Exception should already have been thrown */
- zval_ptr_dtor(&state.zchild);
- mongoc_server_description_destroy(sd);
- return;
- }
-
- mongoc_server_description_destroy(sd);
-
- RETURN_ZVAL(&state.zchild, 0, 1);
- }
-
- phongo_throw_exception(PHONGO_ERROR_RUNTIME, "Failed to get server description");
-} /* }}} */
-
-/* {{{ proto integer MongoDB\Driver\Server::getLatency()
- Returns the last measured latency for this Server */
-static PHP_METHOD(Server, getLatency)
-{
- php_phongo_server_t* intern;
- mongoc_server_description_t* sd;
-
- intern = Z_SERVER_OBJ_P(getThis());
-
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
-
- if ((sd = mongoc_client_get_server_description(intern->client, intern->server_id))) {
- RETVAL_LONG((zend_long) mongoc_server_description_round_trip_time(sd));
- mongoc_server_description_destroy(sd);
- return;
- }
-
- phongo_throw_exception(PHONGO_ERROR_RUNTIME, "Failed to get server description");
-} /* }}} */
-
-/* {{{ proto integer MongoDB\Driver\Server::getPort()
- Returns the port for this Server */
-static PHP_METHOD(Server, getPort)
-{
- php_phongo_server_t* intern;
- mongoc_server_description_t* sd;
-
- intern = Z_SERVER_OBJ_P(getThis());
-
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
-
- if ((sd = mongoc_client_get_server_description(intern->client, intern->server_id))) {
- RETVAL_LONG(mongoc_server_description_host(sd)->port);
- mongoc_server_description_destroy(sd);
- return;
- }
-
- phongo_throw_exception(PHONGO_ERROR_RUNTIME, "Failed to get server description");
-} /* }}} */
-
-/* {{{ proto integer MongoDB\Driver\Server::getType()
- Returns the node type of this Server */
-static PHP_METHOD(Server, getType)
-{
- php_phongo_server_t* intern;
- mongoc_server_description_t* sd;
-
- intern = Z_SERVER_OBJ_P(getThis());
-
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
-
- if ((sd = mongoc_client_get_server_description(intern->client, intern->server_id))) {
- RETVAL_LONG(php_phongo_server_description_type(sd));
- mongoc_server_description_destroy(sd);
- return;
- }
-
- phongo_throw_exception(PHONGO_ERROR_RUNTIME, "Failed to get server description");
-} /* }}} */
-
-/* {{{ proto boolean MongoDB\Driver\Server::isPrimary()
- Returns whether this Server is a primary member of a replica set */
-static PHP_METHOD(Server, isPrimary)
-{
- php_phongo_server_t* intern;
- mongoc_server_description_t* sd;
-
- intern = Z_SERVER_OBJ_P(getThis());
-
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
-
- if ((sd = mongoc_client_get_server_description(intern->client, intern->server_id))) {
- RETVAL_BOOL(!strcmp(mongoc_server_description_type(sd), php_phongo_server_description_type_map[PHONGO_SERVER_RS_PRIMARY].name));
- mongoc_server_description_destroy(sd);
- return;
- }
-
- phongo_throw_exception(PHONGO_ERROR_RUNTIME, "Failed to get server description");
-} /* }}} */
-
-/* {{{ proto boolean MongoDB\Driver\Server::isSecondary()
- Returns whether this Server is a secondary member of a replica set */
-static PHP_METHOD(Server, isSecondary)
-{
- php_phongo_server_t* intern;
- mongoc_server_description_t* sd;
-
- intern = Z_SERVER_OBJ_P(getThis());
-
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
-
- if ((sd = mongoc_client_get_server_description(intern->client, intern->server_id))) {
- RETVAL_BOOL(!strcmp(mongoc_server_description_type(sd), php_phongo_server_description_type_map[PHONGO_SERVER_RS_SECONDARY].name));
- mongoc_server_description_destroy(sd);
- return;
- }
-
- phongo_throw_exception(PHONGO_ERROR_RUNTIME, "Failed to get server description");
-} /* }}} */
-
-/* {{{ proto boolean MongoDB\Driver\Server::isArbiter()
- Returns whether this Server is an arbiter member of a replica set */
-static PHP_METHOD(Server, isArbiter)
-{
- php_phongo_server_t* intern;
- mongoc_server_description_t* sd;
-
- intern = Z_SERVER_OBJ_P(getThis());
-
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
-
- if ((sd = mongoc_client_get_server_description(intern->client, intern->server_id))) {
- RETVAL_BOOL(!strcmp(mongoc_server_description_type(sd), php_phongo_server_description_type_map[PHONGO_SERVER_RS_ARBITER].name));
- mongoc_server_description_destroy(sd);
- return;
- }
-
- phongo_throw_exception(PHONGO_ERROR_RUNTIME, "Failed to get server description");
-} /* }}} */
-
-/* {{{ proto boolean MongoDB\Driver\Server::isHidden()
- Returns whether this Server is a hidden member of a replica set */
-static PHP_METHOD(Server, isHidden)
-{
- php_phongo_server_t* intern;
- mongoc_server_description_t* sd;
-
- intern = Z_SERVER_OBJ_P(getThis());
-
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
-
- if ((sd = mongoc_client_get_server_description(intern->client, intern->server_id))) {
- bson_iter_t iter;
-
- RETVAL_BOOL(bson_iter_init_find_case(&iter, mongoc_server_description_ismaster(sd), "hidden") && bson_iter_as_bool(&iter));
- mongoc_server_description_destroy(sd);
- return;
- }
-
- phongo_throw_exception(PHONGO_ERROR_RUNTIME, "Failed to get server description");
-} /* }}} */
-
-/* {{{ proto boolean MongoDB\Driver\Server::isPassive()
- Returns whether this Server is a passive member of a replica set */
-static PHP_METHOD(Server, isPassive)
-{
- php_phongo_server_t* intern;
- mongoc_server_description_t* sd;
-
- intern = Z_SERVER_OBJ_P(getThis());
-
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
-
- if ((sd = mongoc_client_get_server_description(intern->client, intern->server_id))) {
- bson_iter_t iter;
-
- RETVAL_BOOL(bson_iter_init_find_case(&iter, mongoc_server_description_ismaster(sd), "passive") && bson_iter_as_bool(&iter));
- mongoc_server_description_destroy(sd);
- return;
- }
-
- phongo_throw_exception(PHONGO_ERROR_RUNTIME, "Failed to get server description");
-} /* }}} */
-
-/* {{{ MongoDB\Driver\Server function entries */
-ZEND_BEGIN_ARG_INFO_EX(ai_Server_executeCommand, 0, 0, 2)
- ZEND_ARG_INFO(0, db)
- ZEND_ARG_OBJ_INFO(0, command, MongoDB\\Driver\\Command, 0)
- ZEND_ARG_INFO(0, options)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(ai_Server_executeRWCommand, 0, 0, 2)
- ZEND_ARG_INFO(0, db)
- ZEND_ARG_OBJ_INFO(0, command, MongoDB\\Driver\\Command, 0)
- ZEND_ARG_ARRAY_INFO(0, options, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(ai_Server_executeQuery, 0, 0, 2)
- ZEND_ARG_INFO(0, namespace)
- ZEND_ARG_OBJ_INFO(0, zquery, MongoDB\\Driver\\Query, 0)
- ZEND_ARG_INFO(0, options)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(ai_Server_executeBulkWrite, 0, 0, 2)
- ZEND_ARG_INFO(0, namespace)
- ZEND_ARG_OBJ_INFO(0, zbulk, MongoDB\\Driver\\BulkWrite, 0)
- ZEND_ARG_INFO(0, options)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(ai_Server_void, 0, 0, 0)
-ZEND_END_ARG_INFO()
-
-static zend_function_entry php_phongo_server_me[] = {
- /* clang-format off */
- PHP_ME(Server, executeCommand, ai_Server_executeCommand, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
- PHP_ME(Server, executeReadCommand, ai_Server_executeRWCommand, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
- PHP_ME(Server, executeWriteCommand, ai_Server_executeRWCommand, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
- PHP_ME(Server, executeReadWriteCommand, ai_Server_executeRWCommand, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
- PHP_ME(Server, executeQuery, ai_Server_executeQuery, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
- PHP_ME(Server, executeBulkWrite, ai_Server_executeBulkWrite, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
- PHP_ME(Server, getHost, ai_Server_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
- PHP_ME(Server, getTags, ai_Server_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
- PHP_ME(Server, getInfo, ai_Server_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
- PHP_ME(Server, getLatency, ai_Server_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
- PHP_ME(Server, getPort, ai_Server_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
- PHP_ME(Server, getType, ai_Server_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
- PHP_ME(Server, isPrimary, ai_Server_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
- PHP_ME(Server, isSecondary, ai_Server_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
- PHP_ME(Server, isArbiter, ai_Server_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
- PHP_ME(Server, isHidden, ai_Server_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
- PHP_ME(Server, isPassive, ai_Server_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
- ZEND_NAMED_ME(__construct, PHP_FN(MongoDB_disabled___construct), ai_Server_void, ZEND_ACC_PRIVATE | ZEND_ACC_FINAL)
- ZEND_NAMED_ME(__wakeup, PHP_FN(MongoDB_disabled___wakeup), ai_Server_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
- PHP_FE_END
- /* clang-format on */
-};
-/* }}} */
-
-/* {{{ MongoDB\Driver\Server object handlers */
-static zend_object_handlers php_phongo_handler_server;
-
-static int php_phongo_server_compare_objects(zval* o1, zval* o2) /* {{{ */
-{
- php_phongo_server_t* intern1;
- php_phongo_server_t* intern2;
- mongoc_server_description_t *sd1, *sd2;
- int retval = 0;
-
- intern1 = Z_SERVER_OBJ_P(o1);
- intern2 = Z_SERVER_OBJ_P(o2);
-
- sd1 = mongoc_client_get_server_description(intern1->client, intern1->server_id);
- sd2 = mongoc_client_get_server_description(intern2->client, intern2->server_id);
-
- if (sd1 && sd2) {
- retval = strcasecmp(mongoc_server_description_host(sd1)->host_and_port, mongoc_server_description_host(sd2)->host_and_port);
- } else {
- phongo_throw_exception(PHONGO_ERROR_RUNTIME, "Failed to get server description(s)");
- }
-
- if (sd1) {
- mongoc_server_description_destroy(sd1);
- }
-
- if (sd2) {
- mongoc_server_description_destroy(sd2);
- }
-
- return retval;
-} /* }}} */
-
-static void php_phongo_server_free_object(zend_object* object) /* {{{ */
-{
- php_phongo_server_t* intern = Z_OBJ_SERVER(object);
-
- zend_object_std_dtor(&intern->std);
-} /* }}} */
-
-static zend_object* php_phongo_server_create_object(zend_class_entry* class_type) /* {{{ */
-{
- php_phongo_server_t* intern = NULL;
-
- intern = PHONGO_ALLOC_OBJECT_T(php_phongo_server_t, class_type);
-
- zend_object_std_init(&intern->std, class_type);
- object_properties_init(&intern->std, class_type);
-
- PHONGO_SET_CREATED_BY_PID(intern);
-
- intern->std.handlers = &php_phongo_handler_server;
-
- return &intern->std;
-} /* }}} */
-
-static HashTable* php_phongo_server_get_debug_info(zval* object, int* is_temp) /* {{{ */
-{
- php_phongo_server_t* intern = NULL;
- zval retval = ZVAL_STATIC_INIT;
- mongoc_server_description_t* sd;
-
- *is_temp = 1;
- intern = Z_SERVER_OBJ_P(object);
-
- if (!(sd = mongoc_client_get_server_description(intern->client, intern->server_id))) {
- phongo_throw_exception(PHONGO_ERROR_RUNTIME, "Failed to get server description");
- return NULL;
- }
-
- php_phongo_server_to_zval(&retval, sd);
- mongoc_server_description_destroy(sd);
-
- return Z_ARRVAL(retval);
-} /* }}} */
-/* }}} */
-
-void php_phongo_server_init_ce(INIT_FUNC_ARGS) /* {{{ */
-{
- zend_class_entry ce;
-
- INIT_NS_CLASS_ENTRY(ce, "MongoDB\\Driver", "Server", php_phongo_server_me);
- php_phongo_server_ce = zend_register_internal_class(&ce);
- php_phongo_server_ce->create_object = php_phongo_server_create_object;
- PHONGO_CE_FINAL(php_phongo_server_ce);
- PHONGO_CE_DISABLE_SERIALIZATION(php_phongo_server_ce);
-
- memcpy(&php_phongo_handler_server, phongo_get_std_object_handlers(), sizeof(zend_object_handlers));
- php_phongo_handler_server.compare_objects = php_phongo_server_compare_objects;
- php_phongo_handler_server.get_debug_info = php_phongo_server_get_debug_info;
- php_phongo_handler_server.free_obj = php_phongo_server_free_object;
- php_phongo_handler_server.offset = XtOffsetOf(php_phongo_server_t, std);
-
- zend_declare_class_constant_long(php_phongo_server_ce, ZEND_STRL("TYPE_UNKNOWN"), PHONGO_SERVER_UNKNOWN);
- zend_declare_class_constant_long(php_phongo_server_ce, ZEND_STRL("TYPE_STANDALONE"), PHONGO_SERVER_STANDALONE);
- zend_declare_class_constant_long(php_phongo_server_ce, ZEND_STRL("TYPE_MONGOS"), PHONGO_SERVER_MONGOS);
- zend_declare_class_constant_long(php_phongo_server_ce, ZEND_STRL("TYPE_POSSIBLE_PRIMARY"), PHONGO_SERVER_POSSIBLE_PRIMARY);
- zend_declare_class_constant_long(php_phongo_server_ce, ZEND_STRL("TYPE_RS_PRIMARY"), PHONGO_SERVER_RS_PRIMARY);
- zend_declare_class_constant_long(php_phongo_server_ce, ZEND_STRL("TYPE_RS_SECONDARY"), PHONGO_SERVER_RS_SECONDARY);
- zend_declare_class_constant_long(php_phongo_server_ce, ZEND_STRL("TYPE_RS_ARBITER"), PHONGO_SERVER_RS_ARBITER);
- zend_declare_class_constant_long(php_phongo_server_ce, ZEND_STRL("TYPE_RS_OTHER"), PHONGO_SERVER_RS_OTHER);
- zend_declare_class_constant_long(php_phongo_server_ce, ZEND_STRL("TYPE_RS_GHOST"), PHONGO_SERVER_RS_GHOST);
-} /* }}} */
-
-/*
- * 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.8.1/src/MongoDB/Session.c b/mongodb-1.8.1/src/MongoDB/Session.c
deleted file mode 100644
index 53d51e20..00000000
--- a/mongodb-1.8.1/src/MongoDB/Session.c
+++ /dev/null
@@ -1,745 +0,0 @@
-/*
- * Copyright 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.
- */
-
-#include <php.h>
-#include <Zend/zend_interfaces.h>
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "phongo_compat.h"
-#include "php_phongo.h"
-#include "php_bson.h"
-#include "php_array_api.h"
-#include "Session.h"
-
-zend_class_entry* php_phongo_session_ce;
-
-#define PHONGO_TRANSACTION_NONE "none"
-#define PHONGO_TRANSACTION_STARTING "starting"
-#define PHONGO_TRANSACTION_IN_PROGRESS "in_progress"
-#define PHONGO_TRANSACTION_COMMITTED "committed"
-#define PHONGO_TRANSACTION_ABORTED "aborted"
-
-#define SESSION_CHECK_LIVELINESS(i, m) \
- if (!(i)->client_session) { \
- phongo_throw_exception( \
- PHONGO_ERROR_LOGIC, \
- "Cannot call '%s', as the session has already been ended.", \
- (m)); \
- return; \
- }
-
-static bool php_phongo_session_get_timestamp_parts(zval* obj, uint32_t* timestamp, uint32_t* increment)
-{
- bool retval = false;
- zval ztimestamp = ZVAL_STATIC_INIT;
- zval zincrement = ZVAL_STATIC_INIT;
-
- zend_call_method_with_0_params(obj, NULL, NULL, "getTimestamp", &ztimestamp);
-
- if (Z_ISUNDEF(ztimestamp) || EG(exception)) {
- goto cleanup;
- }
-
- zend_call_method_with_0_params(obj, NULL, NULL, "getIncrement", &zincrement);
-
- if (Z_ISUNDEF(zincrement) || EG(exception)) {
- goto cleanup;
- }
-
- *timestamp = Z_LVAL(ztimestamp);
- *increment = Z_LVAL(zincrement);
-
- retval = true;
-
-cleanup:
- if (!Z_ISUNDEF(ztimestamp)) {
- zval_ptr_dtor(&ztimestamp);
- }
-
- if (!Z_ISUNDEF(zincrement)) {
- zval_ptr_dtor(&zincrement);
- }
-
- return retval;
-}
-
-static const char* php_phongo_get_transaction_state_string(mongoc_transaction_state_t state)
-{
- switch (state) {
- case MONGOC_TRANSACTION_NONE:
- return PHONGO_TRANSACTION_NONE;
- case MONGOC_TRANSACTION_STARTING:
- return PHONGO_TRANSACTION_STARTING;
- case MONGOC_TRANSACTION_IN_PROGRESS:
- return PHONGO_TRANSACTION_IN_PROGRESS;
- case MONGOC_TRANSACTION_COMMITTED:
- return PHONGO_TRANSACTION_COMMITTED;
- case MONGOC_TRANSACTION_ABORTED:
- return PHONGO_TRANSACTION_ABORTED;
- default:
- phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Invalid transaction state %d given", (int) state);
- return NULL;
- }
-}
-
-/* {{{ proto void MongoDB\Driver\Session::advanceClusterTime(array|object $clusterTime)
- Advances the cluster time for this Session */
-static PHP_METHOD(Session, advanceClusterTime)
-{
- php_phongo_session_t* intern;
- zval* zcluster_time;
- bson_t cluster_time = BSON_INITIALIZER;
-
- intern = Z_SESSION_OBJ_P(getThis());
- SESSION_CHECK_LIVELINESS(intern, "advanceClusterTime")
-
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "A", &zcluster_time) == FAILURE) {
- return;
- }
-
- php_phongo_zval_to_bson(zcluster_time, PHONGO_BSON_NONE, &cluster_time, NULL);
-
- /* An exception may be thrown during BSON conversion */
- if (EG(exception)) {
- goto cleanup;
- }
-
- mongoc_client_session_advance_cluster_time(intern->client_session, &cluster_time);
-
-cleanup:
- bson_destroy(&cluster_time);
-} /* }}} */
-
-/* {{{ proto void MongoDB\Driver\Session::advanceOperationTime(MongoDB\BSON\TimestampInterface $timestamp)
- Advances the operation time for this Session */
-static PHP_METHOD(Session, advanceOperationTime)
-{
- php_phongo_session_t* intern;
- zval* ztimestamp;
- uint32_t timestamp = 0;
- uint32_t increment = 0;
-
- intern = Z_SESSION_OBJ_P(getThis());
- SESSION_CHECK_LIVELINESS(intern, "advanceOperationTime")
-
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "O", &ztimestamp, php_phongo_timestamp_interface_ce) == FAILURE) {
- return;
- }
-
- if (!php_phongo_session_get_timestamp_parts(ztimestamp, &timestamp, &increment)) {
- return;
- }
-
- mongoc_client_session_advance_operation_time(intern->client_session, timestamp, increment);
-} /* }}} */
-
-/* {{{ proto object|null MongoDB\Driver\Session::getClusterTime()
- Returns the cluster time for this Session */
-static PHP_METHOD(Session, getClusterTime)
-{
- php_phongo_session_t* intern;
- const bson_t* cluster_time;
- php_phongo_bson_state state;
-
- PHONGO_BSON_INIT_STATE(state);
-
- intern = Z_SESSION_OBJ_P(getThis());
- SESSION_CHECK_LIVELINESS(intern, "getClusterTime")
-
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
-
- cluster_time = mongoc_client_session_get_cluster_time(intern->client_session);
-
- if (!cluster_time) {
- RETURN_NULL();
- }
-
- if (!php_phongo_bson_to_zval_ex(bson_get_data(cluster_time), cluster_time->len, &state)) {
- /* Exception should already have been thrown */
- zval_ptr_dtor(&state.zchild);
- return;
- }
-
- RETURN_ZVAL(&state.zchild, 0, 1);
-} /* }}} */
-
-/* {{{ proto object MongoDB\Driver\Session::getLogicalSessionId()
- Returns the logical session ID for this Session */
-static PHP_METHOD(Session, getLogicalSessionId)
-{
- php_phongo_session_t* intern;
- const bson_t* lsid;
- php_phongo_bson_state state;
-
- PHONGO_BSON_INIT_STATE(state);
-
- intern = Z_SESSION_OBJ_P(getThis());
- SESSION_CHECK_LIVELINESS(intern, "getLogicalSessionId")
-
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
-
- lsid = mongoc_client_session_get_lsid(intern->client_session);
-
- if (!php_phongo_bson_to_zval_ex(bson_get_data(lsid), lsid->len, &state)) {
- /* Exception should already have been thrown */
- zval_ptr_dtor(&state.zchild);
- return;
- }
-
- RETURN_ZVAL(&state.zchild, 0, 1);
-} /* }}} */
-
-/* {{{ proto MongoDB\BSON\Timestamp|null MongoDB\Driver\Session::getOperationTime()
- Returns the operation time for this Session */
-static PHP_METHOD(Session, getOperationTime)
-{
- php_phongo_session_t* intern;
- uint32_t timestamp, increment;
-
- intern = Z_SESSION_OBJ_P(getThis());
- SESSION_CHECK_LIVELINESS(intern, "getOperationTime")
-
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
-
- mongoc_client_session_get_operation_time(intern->client_session, &timestamp, &increment);
-
- /* mongoc_client_session_get_operation_time() returns 0 for both parts if
- * the session has not been used. According to the causal consistency spec,
- * the operation time for an unused session is null. */
- if (timestamp == 0 && increment == 0) {
- RETURN_NULL();
- }
-
- php_phongo_bson_new_timestamp_from_increment_and_timestamp(return_value, increment, timestamp);
-} /* }}} */
-
-/* {{{ proto MongoDB\Driver\Server|null MongoDB\Driver\Session::getServer()
- Returns the server this session is pinned to */
-static PHP_METHOD(Session, getServer)
-{
- php_phongo_session_t* intern;
- uint32_t server_id = 0;
-
- intern = Z_SESSION_OBJ_P(getThis());
- SESSION_CHECK_LIVELINESS(intern, "getServer")
-
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
-
- server_id = mongoc_client_session_get_server_id(intern->client_session);
-
- /* For sessions without a pinned server, 0 is returned. */
- if (!server_id) {
- RETURN_NULL();
- }
-
- phongo_server_init(return_value, intern->client, server_id);
-} /* }}} */
-
-/* {{{ proto array|null MongoDB\Driver\Session::getTransactionOptions()
- Returns options for the currently running transaction */
-static PHP_METHOD(Session, getTransactionOptions)
-{
- php_phongo_session_t* intern;
- mongoc_transaction_opt_t* opts;
- int64_t max_commit_time_ms;
- const mongoc_read_concern_t* read_concern;
- const mongoc_read_prefs_t* read_preference;
- const mongoc_write_concern_t* write_concern;
-
- intern = Z_SESSION_OBJ_P(getThis());
- SESSION_CHECK_LIVELINESS(intern, "getTransactionOptions")
-
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
-
- opts = mongoc_session_opts_get_transaction_opts(intern->client_session);
-
- if (!opts) {
- return;
- }
-
- max_commit_time_ms = mongoc_transaction_opts_get_max_commit_time_ms(opts);
- read_concern = mongoc_transaction_opts_get_read_concern(opts);
- read_preference = mongoc_transaction_opts_get_read_prefs(opts);
- write_concern = mongoc_transaction_opts_get_write_concern(opts);
-
- array_init_size(return_value, 4);
-
- if (max_commit_time_ms) {
- ADD_ASSOC_LONG_EX(return_value, "maxCommitTimeMS", max_commit_time_ms);
- }
-
- if (!mongoc_read_concern_is_default(read_concern)) {
- zval zread_concern;
-
- phongo_readconcern_init(&zread_concern, read_concern);
- ADD_ASSOC_ZVAL_EX(return_value, "readConcern", &zread_concern);
- }
-
- if (read_preference) {
- zval zread_preference;
-
- phongo_readpreference_init(&zread_preference, read_preference);
- ADD_ASSOC_ZVAL_EX(return_value, "readPreference", &zread_preference);
- }
-
- if (!mongoc_write_concern_is_default(write_concern)) {
- zval zwrite_concern;
-
- phongo_writeconcern_init(&zwrite_concern, write_concern);
- ADD_ASSOC_ZVAL_EX(return_value, "writeConcern", &zwrite_concern);
- }
-} /* }}} */
-
-/* {{{ proto string MongoDB\Driver\Session::getTransactionState()
- Returns the current transaction state for this session */
-static PHP_METHOD(Session, getTransactionState)
-{
- php_phongo_session_t* intern;
- const char* state;
-
- intern = Z_SESSION_OBJ_P(getThis());
- SESSION_CHECK_LIVELINESS(intern, "getTransactionState")
-
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
-
- state = php_phongo_get_transaction_state_string(mongoc_client_session_get_transaction_state(intern->client_session));
- if (!state) {
- /* Exception already thrown */
- return;
- }
-
- RETURN_STRING(state);
-} /* }}} */
-
-/* Creates a opts structure from an array optionally containing an RP, RC,
- * WC object, and/or maxCommitTimeMS int. Returns NULL if no options were found,
- * or there was an invalid option. If there was an invalid option or structure,
- * an exception will be thrown too. */
-mongoc_transaction_opt_t* php_mongodb_session_parse_transaction_options(zval* options)
-{
- mongoc_transaction_opt_t* opts = NULL;
-
- if (php_array_existsc(options, "maxCommitTimeMS")) {
- int64_t max_commit_time_ms = php_array_fetchc_long(options, "maxCommitTimeMS");
-
- if (max_commit_time_ms < 0) {
- phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Expected \"maxCommitTimeMS\" option to be >= 0, %" PRId64 " given", max_commit_time_ms);
- /* Freeing opts is not needed here, as it can't be set yet. The
- * code is here to keep it consistent with the others in case more
- * options are added before this one. */
- if (opts) {
- mongoc_transaction_opts_destroy(opts);
- }
- return NULL;
- }
-
- if (max_commit_time_ms > UINT32_MAX) {
- phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Expected \"maxCommitTimeMS\" option to be <= %" PRIu32 ", %" PRId64 " given", UINT32_MAX, max_commit_time_ms);
- /* Freeing opts is not needed here, as it can't be set yet. The
- * code is here to keep it consistent with the others in case more
- * options are added before this one. */
- if (opts) {
- mongoc_transaction_opts_destroy(opts);
- }
- return NULL;
- }
-
- if (!opts) {
- opts = mongoc_transaction_opts_new();
- }
-
- mongoc_transaction_opts_set_max_commit_time_ms(opts, max_commit_time_ms);
- }
-
- if (php_array_existsc(options, "readConcern")) {
- zval* read_concern = php_array_fetchc(options, "readConcern");
-
- if (Z_TYPE_P(read_concern) != IS_OBJECT || !instanceof_function(Z_OBJCE_P(read_concern), php_phongo_readconcern_ce)) {
- phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Expected \"readConcern\" option to be %s, %s given", ZSTR_VAL(php_phongo_readconcern_ce->name), PHONGO_ZVAL_CLASS_OR_TYPE_NAME_P(read_concern));
- if (opts) {
- mongoc_transaction_opts_destroy(opts);
- }
- return NULL;
- }
-
- if (!opts) {
- opts = mongoc_transaction_opts_new();
- }
-
- mongoc_transaction_opts_set_read_concern(opts, phongo_read_concern_from_zval(read_concern));
- }
-
- if (php_array_existsc(options, "readPreference")) {
- zval* read_preference = php_array_fetchc(options, "readPreference");
-
- if (Z_TYPE_P(read_preference) != IS_OBJECT || !instanceof_function(Z_OBJCE_P(read_preference), php_phongo_readpreference_ce)) {
- phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Expected \"readPreference\" option to be %s, %s given", ZSTR_VAL(php_phongo_readpreference_ce->name), PHONGO_ZVAL_CLASS_OR_TYPE_NAME_P(read_preference));
- if (opts) {
- mongoc_transaction_opts_destroy(opts);
- }
- return NULL;
- }
-
- if (!opts) {
- opts = mongoc_transaction_opts_new();
- }
-
- mongoc_transaction_opts_set_read_prefs(opts, phongo_read_preference_from_zval(read_preference));
- }
-
- if (php_array_existsc(options, "writeConcern")) {
- zval* write_concern = php_array_fetchc(options, "writeConcern");
-
- if (Z_TYPE_P(write_concern) != IS_OBJECT || !instanceof_function(Z_OBJCE_P(write_concern), php_phongo_writeconcern_ce)) {
- phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Expected \"writeConcern\" option to be %s, %s given", ZSTR_VAL(php_phongo_writeconcern_ce->name), PHONGO_ZVAL_CLASS_OR_TYPE_NAME_P(write_concern));
- if (opts) {
- mongoc_transaction_opts_destroy(opts);
- }
- return NULL;
- }
-
- if (!opts) {
- opts = mongoc_transaction_opts_new();
- }
-
- mongoc_transaction_opts_set_write_concern(opts, phongo_write_concern_from_zval(write_concern));
- }
-
- return opts;
-}
-
-/* {{{ proto void MongoDB\Driver\Session::startTransaction([array $options = null])
- Starts a new transaction */
-static PHP_METHOD(Session, startTransaction)
-{
- php_phongo_session_t* intern;
- zval* options = NULL;
- mongoc_transaction_opt_t* txn_options = NULL;
- bson_error_t error;
-
- intern = Z_SESSION_OBJ_P(getThis());
- SESSION_CHECK_LIVELINESS(intern, "startTransaction")
-
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "|a!", &options) == FAILURE) {
- return;
- }
-
- if (options) {
- txn_options = php_mongodb_session_parse_transaction_options(options);
- }
- if (EG(exception)) {
- return;
- }
-
- if (!mongoc_client_session_start_transaction(intern->client_session, txn_options, &error)) {
- phongo_throw_exception_from_bson_error_t(&error);
- }
-
- if (txn_options) {
- mongoc_transaction_opts_destroy(txn_options);
- }
-} /* }}} */
-
-/* {{{ proto void MongoDB\Driver\Session::commitTransaction(void)
- Commits an existing transaction */
-static PHP_METHOD(Session, commitTransaction)
-{
- php_phongo_session_t* intern;
- bson_error_t error;
- bson_t reply;
-
- intern = Z_SESSION_OBJ_P(getThis());
- SESSION_CHECK_LIVELINESS(intern, "commitTransaction")
-
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
-
- if (!mongoc_client_session_commit_transaction(intern->client_session, &reply, &error)) {
- phongo_throw_exception_from_bson_error_t_and_reply(&error, &reply);
- }
-
- bson_destroy(&reply);
-} /* }}} */
-
-/* {{{ proto void MongoDB\Driver\Session::abortTransaction(void)
- Aborts (rolls back) an existing transaction */
-static PHP_METHOD(Session, abortTransaction)
-{
- php_phongo_session_t* intern;
- bson_error_t error;
-
- intern = Z_SESSION_OBJ_P(getThis());
- SESSION_CHECK_LIVELINESS(intern, "abortTransaction")
-
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
-
- if (!mongoc_client_session_abort_transaction(intern->client_session, &error)) {
- phongo_throw_exception_from_bson_error_t(&error);
- }
-} /* }}} */
-
-/* {{{ proto void MongoDB\Driver\Session::endSession(void)
- Ends the session, and a running transaction if active */
-static PHP_METHOD(Session, endSession)
-{
- php_phongo_session_t* intern;
-
- intern = Z_SESSION_OBJ_P(getThis());
-
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
-
- mongoc_client_session_destroy(intern->client_session);
- intern->client_session = NULL;
-} /* }}} */
-
-/* {{{ proto void MongoDB\Driver\Session::isInTransaction(void)
- Returns whether a multi-document transaction is in progress */
-static PHP_METHOD(Session, isInTransaction)
-{
- php_phongo_session_t* intern;
-
- intern = Z_SESSION_OBJ_P(getThis());
- SESSION_CHECK_LIVELINESS(intern, "isInTransaction")
-
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
-
- RETURN_BOOL(mongoc_client_session_in_transaction(intern->client_session));
-} /* }}} */
-
-/* {{{ MongoDB\Driver\Session function entries */
-ZEND_BEGIN_ARG_INFO_EX(ai_Session_advanceClusterTime, 0, 0, 1)
- ZEND_ARG_INFO(0, clusterTime)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(ai_Session_advanceOperationTime, 0, 0, 1)
- ZEND_ARG_INFO(0, timestamp)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(ai_Session_startTransaction, 0, 0, 0)
- ZEND_ARG_ARRAY_INFO(0, options, 1)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(ai_Session_void, 0, 0, 0)
-ZEND_END_ARG_INFO()
-
-static zend_function_entry php_phongo_session_me[] = {
- /* clang-format off */
- PHP_ME(Session, abortTransaction, ai_Session_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
- PHP_ME(Session, advanceClusterTime, ai_Session_advanceClusterTime, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
- PHP_ME(Session, advanceOperationTime, ai_Session_advanceOperationTime, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
- PHP_ME(Session, commitTransaction, ai_Session_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
- PHP_ME(Session, endSession, ai_Session_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
- PHP_ME(Session, getClusterTime, ai_Session_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
- PHP_ME(Session, getLogicalSessionId, ai_Session_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
- PHP_ME(Session, getOperationTime, ai_Session_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
- PHP_ME(Session, getServer, ai_Session_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
- PHP_ME(Session, getTransactionOptions, ai_Session_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
- PHP_ME(Session, getTransactionState, ai_Session_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
- PHP_ME(Session, isInTransaction, ai_Session_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
- PHP_ME(Session, startTransaction, ai_Session_startTransaction, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
- ZEND_NAMED_ME(__construct, PHP_FN(MongoDB_disabled___construct), ai_Session_void, ZEND_ACC_PRIVATE | ZEND_ACC_FINAL)
- ZEND_NAMED_ME(__wakeup, PHP_FN(MongoDB_disabled___wakeup), ai_Session_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
- PHP_FE_END
- /* clang-format on */
-};
-/* }}} */
-
-/* {{{ MongoDB\Driver\Session object handlers */
-static zend_object_handlers php_phongo_handler_session;
-
-static void php_phongo_session_free_object(zend_object* object) /* {{{ */
-{
- php_phongo_session_t* intern = Z_OBJ_SESSION(object);
-
- zend_object_std_dtor(&intern->std);
-
- /* If this Session was created in a different process, reset the client so
- * that its session pool is cleared and mongoc_client_session_destroy will
- * destroy the corresponding server session rather than return it to the
- * now-empty pool. This will ensure that we do not re-use a server session
- * (i.e. LSID) created by a parent process. */
- PHONGO_RESET_CLIENT_IF_PID_DIFFERS(intern);
-
- if (intern->client_session) {
- mongoc_client_session_destroy(intern->client_session);
- }
-} /* }}} */
-
-static zend_object* php_phongo_session_create_object(zend_class_entry* class_type) /* {{{ */
-{
- php_phongo_session_t* intern = NULL;
-
- intern = PHONGO_ALLOC_OBJECT_T(php_phongo_session_t, class_type);
-
- zend_object_std_init(&intern->std, class_type);
- object_properties_init(&intern->std, class_type);
-
- PHONGO_SET_CREATED_BY_PID(intern);
-
- intern->std.handlers = &php_phongo_handler_session;
-
- return &intern->std;
-} /* }}} */
-
-static HashTable* php_phongo_session_get_debug_info(zval* object, int* is_temp) /* {{{ */
-{
- php_phongo_session_t* intern = NULL;
- const mongoc_session_opt_t* cs_opts;
- zval retval = ZVAL_STATIC_INIT;
-
- *is_temp = 1;
- intern = Z_SESSION_OBJ_P(object);
-
- array_init(&retval);
-
- if (intern->client_session) {
- const bson_t* lsid;
- php_phongo_bson_state state;
-
- PHONGO_BSON_INIT_DEBUG_STATE(state);
-
- lsid = mongoc_client_session_get_lsid(intern->client_session);
-
- if (!php_phongo_bson_to_zval_ex(bson_get_data(lsid), lsid->len, &state)) {
- zval_ptr_dtor(&state.zchild);
- goto done;
- }
-
- ADD_ASSOC_ZVAL_EX(&retval, "logicalSessionId", &state.zchild);
- } else {
- ADD_ASSOC_NULL_EX(&retval, "logicalSessionId");
- }
-
- if (intern->client_session) {
- const bson_t* cluster_time;
-
- cluster_time = mongoc_client_session_get_cluster_time(intern->client_session);
-
- if (cluster_time) {
- php_phongo_bson_state state;
-
- PHONGO_BSON_INIT_DEBUG_STATE(state);
-
- if (!php_phongo_bson_to_zval_ex(bson_get_data(cluster_time), cluster_time->len, &state)) {
- zval_ptr_dtor(&state.zchild);
- goto done;
- }
-
- ADD_ASSOC_ZVAL_EX(&retval, "clusterTime", &state.zchild);
- } else {
- ADD_ASSOC_NULL_EX(&retval, "clusterTime");
- }
- } else {
- ADD_ASSOC_NULL_EX(&retval, "clusterTime");
- }
-
- if (intern->client_session) {
- cs_opts = mongoc_client_session_get_opts(intern->client_session);
- ADD_ASSOC_BOOL_EX(&retval, "causalConsistency", mongoc_session_opts_get_causal_consistency(cs_opts));
- } else {
- ADD_ASSOC_NULL_EX(&retval, "causalConsistency");
- }
-
- if (intern->client_session) {
- uint32_t timestamp, increment;
-
- mongoc_client_session_get_operation_time(intern->client_session, &timestamp, &increment);
-
- if (timestamp && increment) {
- zval ztimestamp;
-
- php_phongo_bson_new_timestamp_from_increment_and_timestamp(&ztimestamp, increment, timestamp);
- ADD_ASSOC_ZVAL_EX(&retval, "operationTime", &ztimestamp);
- } else {
- ADD_ASSOC_NULL_EX(&retval, "operationTime");
- }
- } else {
- ADD_ASSOC_NULL_EX(&retval, "operationTime");
- }
-
- if (intern->client_session) {
- uint32_t server_id = mongoc_client_session_get_server_id(intern->client_session);
-
- if (server_id) {
-
- zval server;
-
- phongo_server_init(&server, intern->client, server_id);
- ADD_ASSOC_ZVAL_EX(&retval, "server", &server);
- } else {
- ADD_ASSOC_NULL_EX(&retval, "server");
- }
- } else {
- ADD_ASSOC_NULL_EX(&retval, "server");
- }
-
-done:
- return Z_ARRVAL(retval);
-} /* }}} */
-/* }}} */
-
-void php_phongo_session_init_ce(INIT_FUNC_ARGS) /* {{{ */
-{
- zend_class_entry ce;
-
- INIT_NS_CLASS_ENTRY(ce, "MongoDB\\Driver", "Session", php_phongo_session_me);
- php_phongo_session_ce = zend_register_internal_class(&ce);
- php_phongo_session_ce->create_object = php_phongo_session_create_object;
- PHONGO_CE_FINAL(php_phongo_session_ce);
- PHONGO_CE_DISABLE_SERIALIZATION(php_phongo_session_ce);
-
- memcpy(&php_phongo_handler_session, phongo_get_std_object_handlers(), sizeof(zend_object_handlers));
- php_phongo_handler_session.get_debug_info = php_phongo_session_get_debug_info;
- php_phongo_handler_session.free_obj = php_phongo_session_free_object;
- php_phongo_handler_session.offset = XtOffsetOf(php_phongo_session_t, std);
-
- zend_declare_class_constant_string(php_phongo_session_ce, ZEND_STRL("TRANSACTION_NONE"), PHONGO_TRANSACTION_NONE);
- zend_declare_class_constant_string(php_phongo_session_ce, ZEND_STRL("TRANSACTION_STARTING"), PHONGO_TRANSACTION_STARTING);
- zend_declare_class_constant_string(php_phongo_session_ce, ZEND_STRL("TRANSACTION_IN_PROGRESS"), PHONGO_TRANSACTION_IN_PROGRESS);
- zend_declare_class_constant_string(php_phongo_session_ce, ZEND_STRL("TRANSACTION_COMMITTED"), PHONGO_TRANSACTION_COMMITTED);
- zend_declare_class_constant_string(php_phongo_session_ce, ZEND_STRL("TRANSACTION_ABORTED"), PHONGO_TRANSACTION_ABORTED);
-} /* }}} */
-
-/*
- * 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.8.1/src/MongoDB/WriteConcern.c b/mongodb-1.8.1/src/MongoDB/WriteConcern.c
deleted file mode 100644
index 58df454f..00000000
--- a/mongodb-1.8.1/src/MongoDB/WriteConcern.c
+++ /dev/null
@@ -1,561 +0,0 @@
-/*
- * 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.
- */
-
-#include <php.h>
-#include <Zend/zend_interfaces.h>
-#include <ext/standard/php_var.h>
-#include <zend_smart_str.h>
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "phongo_compat.h"
-#include "php_phongo.h"
-
-zend_class_entry* php_phongo_writeconcern_ce;
-
-/* Initialize the object from a HashTable and return whether it was successful.
- * An exception will be thrown on error. */
-static bool php_phongo_writeconcern_init_from_hash(php_phongo_writeconcern_t* intern, HashTable* props) /* {{{ */
-{
- zval *w, *wtimeout, *j;
-
- intern->write_concern = mongoc_write_concern_new();
-
- if ((w = zend_hash_str_find(props, "w", sizeof("w") - 1))) {
- if (Z_TYPE_P(w) == IS_LONG) {
- if (Z_LVAL_P(w) < -3) {
- phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "%s initialization requires \"w\" integer field to be >= -3", ZSTR_VAL(php_phongo_writeconcern_ce->name));
- goto failure;
- }
- mongoc_write_concern_set_w(intern->write_concern, Z_LVAL_P(w));
- } else if (Z_TYPE_P(w) == IS_STRING) {
- if (strcmp(Z_STRVAL_P(w), PHONGO_WRITE_CONCERN_W_MAJORITY) == 0) {
- mongoc_write_concern_set_w(intern->write_concern, MONGOC_WRITE_CONCERN_W_MAJORITY);
- } else {
- mongoc_write_concern_set_wtag(intern->write_concern, Z_STRVAL_P(w));
- }
- } else {
- phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "%s initialization requires \"w\" field to be integer or string", ZSTR_VAL(php_phongo_writeconcern_ce->name));
- goto failure;
- }
- }
-
- if ((wtimeout = zend_hash_str_find(props, "wtimeout", sizeof("wtimeout") - 1))) {
- if (Z_TYPE_P(wtimeout) == IS_LONG) {
- if (Z_LVAL_P(wtimeout) < 0) {
- phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "%s initialization requires \"wtimeout\" integer field to be >= 0", ZSTR_VAL(php_phongo_writeconcern_ce->name));
- goto failure;
- }
-
- mongoc_write_concern_set_wtimeout_int64(intern->write_concern, (int64_t) Z_LVAL_P(wtimeout));
- } else if (Z_TYPE_P(wtimeout) == IS_STRING) {
- int64_t timeout;
-
- if (!php_phongo_parse_int64(&timeout, Z_STRVAL_P(wtimeout), Z_STRLEN_P(wtimeout))) {
- phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Error parsing \"%s\" as 64-bit value for %s initialization", Z_STRVAL_P(wtimeout), ZSTR_VAL(php_phongo_writeconcern_ce->name));
- return false;
- }
-
- mongoc_write_concern_set_wtimeout_int64(intern->write_concern, timeout);
- } else {
- phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "%s initialization requires \"wtimeout\" field to be integer or string", ZSTR_VAL(php_phongo_writeconcern_ce->name));
- goto failure;
- }
- }
-
- if ((j = zend_hash_str_find(props, "j", sizeof("j") - 1))) {
- if (Z_TYPE_P(j) == IS_TRUE || Z_TYPE_P(j) == IS_FALSE) {
- if (zend_is_true(j) && (mongoc_write_concern_get_w(intern->write_concern) == MONGOC_WRITE_CONCERN_W_UNACKNOWLEDGED || mongoc_write_concern_get_w(intern->write_concern) == MONGOC_WRITE_CONCERN_W_ERRORS_IGNORED)) {
- phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Cannot enable journaling when using w = 0");
- goto failure;
- }
-
- mongoc_write_concern_set_journal(intern->write_concern, zend_is_true(j));
- } else {
- phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "%s initialization requires \"j\" field to be boolean", ZSTR_VAL(php_phongo_writeconcern_ce->name));
- goto failure;
- }
- }
-
- if (!mongoc_write_concern_is_valid(intern->write_concern)) {
- phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Write concern is not valid");
- goto failure;
- }
-
- return true;
-
-failure:
- mongoc_write_concern_destroy(intern->write_concern);
- intern->write_concern = NULL;
- return false;
-} /* }}} */
-
-/* {{{ proto void MongoDB\Driver\WriteConcern::__construct(integer|string $w[, integer $wtimeout[, boolean $journal]])
- Constructs a new WriteConcern */
-static PHP_METHOD(WriteConcern, __construct)
-{
- php_phongo_writeconcern_t* intern;
- zend_error_handling error_handling;
- zval * w, *journal;
- zend_long wtimeout = 0;
-
- zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
- intern = Z_WRITECONCERN_OBJ_P(getThis());
-
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "z|lz", &w, &wtimeout, &journal) == FAILURE) {
- zend_restore_error_handling(&error_handling);
- return;
- }
- zend_restore_error_handling(&error_handling);
-
- intern->write_concern = mongoc_write_concern_new();
-
- if (Z_TYPE_P(w) == IS_LONG) {
- if (Z_LVAL_P(w) < -3) {
- phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Expected w to be >= -3, %ld given", Z_LVAL_P(w));
- return;
- }
- mongoc_write_concern_set_w(intern->write_concern, Z_LVAL_P(w));
- } else if (Z_TYPE_P(w) == IS_STRING) {
- if (strcmp(Z_STRVAL_P(w), PHONGO_WRITE_CONCERN_W_MAJORITY) == 0) {
- mongoc_write_concern_set_w(intern->write_concern, MONGOC_WRITE_CONCERN_W_MAJORITY);
- } else {
- mongoc_write_concern_set_wtag(intern->write_concern, Z_STRVAL_P(w));
- }
- } else {
- phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Expected w to be integer or string, %s given", PHONGO_ZVAL_CLASS_OR_TYPE_NAME_P(w));
- return;
- }
-
- switch (ZEND_NUM_ARGS()) {
- case 3:
- if (Z_TYPE_P(journal) != IS_NULL) {
- if (zend_is_true(journal) && (mongoc_write_concern_get_w(intern->write_concern) == MONGOC_WRITE_CONCERN_W_UNACKNOWLEDGED || mongoc_write_concern_get_w(intern->write_concern) == MONGOC_WRITE_CONCERN_W_ERRORS_IGNORED)) {
- phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Cannot enable journaling when using w = 0");
- return;
- }
-
- mongoc_write_concern_set_journal(intern->write_concern, zend_is_true(journal));
- }
- /* fallthrough */
- case 2:
- if (wtimeout < 0) {
- phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Expected wtimeout to be >= 0, %" PHONGO_LONG_FORMAT " given", wtimeout);
- return;
- }
-
- mongoc_write_concern_set_wtimeout_int64(intern->write_concern, (int64_t) wtimeout);
- }
-
- if (!mongoc_write_concern_is_valid(intern->write_concern)) {
- phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Write concern is not valid");
- return;
- }
-} /* }}} */
-
-/* {{{ proto void MongoDB\BSON\WriteConcern::__set_state(array $properties)
-*/
-static PHP_METHOD(WriteConcern, __set_state)
-{
- php_phongo_writeconcern_t* intern;
- HashTable* props;
- zval* array;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "a", &array) == FAILURE) {
- RETURN_FALSE;
- }
-
- object_init_ex(return_value, php_phongo_writeconcern_ce);
-
- intern = Z_WRITECONCERN_OBJ_P(return_value);
- props = Z_ARRVAL_P(array);
-
- php_phongo_writeconcern_init_from_hash(intern, props);
-} /* }}} */
-
-/* {{{ proto string|integer|null MongoDB\Driver\WriteConcern::getW()
- Returns the WriteConcern "w" option */
-static PHP_METHOD(WriteConcern, getW)
-{
- php_phongo_writeconcern_t* intern;
- const char* wtag;
-
- intern = Z_WRITECONCERN_OBJ_P(getThis());
-
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
-
- wtag = mongoc_write_concern_get_wtag(intern->write_concern);
-
- if (wtag) {
- RETURN_STRING(wtag);
- }
-
- if (mongoc_write_concern_get_wmajority(intern->write_concern)) {
- RETURN_STRING(PHONGO_WRITE_CONCERN_W_MAJORITY);
- }
-
- if (mongoc_write_concern_get_w(intern->write_concern) != MONGOC_WRITE_CONCERN_W_DEFAULT) {
- RETURN_LONG(mongoc_write_concern_get_w(intern->write_concern));
- }
-
- RETURN_NULL();
-} /* }}} */
-
-/* {{{ proto integer MongoDB\Driver\WriteConcern::getWtimeout()
- Returns the WriteConcern "wtimeout" option */
-static PHP_METHOD(WriteConcern, getWtimeout)
-{
- php_phongo_writeconcern_t* intern;
- int64_t wtimeout;
-
- intern = Z_WRITECONCERN_OBJ_P(getThis());
-
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
-
- wtimeout = mongoc_write_concern_get_wtimeout_int64(intern->write_concern);
-
-#if SIZEOF_ZEND_LONG == 4
- if (wtimeout > INT32_MAX || wtimeout < INT32_MIN) {
- zend_error(E_WARNING, "Truncating 64-bit value for wTimeoutMS");
- }
-#endif
-
- RETURN_LONG(wtimeout);
-} /* }}} */
-
-/* {{{ proto null|boolean MongoDB\Driver\WriteConcern::getJournal()
- Returns the WriteConcern "journal" option */
-static PHP_METHOD(WriteConcern, getJournal)
-{
- php_phongo_writeconcern_t* intern;
-
- intern = Z_WRITECONCERN_OBJ_P(getThis());
-
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
-
- if (mongoc_write_concern_journal_is_set(intern->write_concern)) {
- RETURN_BOOL(mongoc_write_concern_get_journal(intern->write_concern));
- }
-
- RETURN_NULL();
-} /* }}} */
-
-/* {{{ proto boolean MongoDB\Driver\WriteConcern::isDefault()
- Returns whether the write concern has not been modified (i.e. from a Manager
- with no write concern URI options). */
-static PHP_METHOD(WriteConcern, isDefault)
-{
- php_phongo_writeconcern_t* intern;
-
- intern = Z_WRITECONCERN_OBJ_P(getThis());
-
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
-
- RETURN_BOOL(mongoc_write_concern_is_default(intern->write_concern));
-} /* }}} */
-
-static HashTable* php_phongo_write_concern_get_properties_hash(zval* object, bool is_debug, bool is_bson) /* {{{ */
-{
- php_phongo_writeconcern_t* intern;
- HashTable* props;
- const char* wtag;
- int32_t w;
- int64_t wtimeout;
-
- intern = Z_WRITECONCERN_OBJ_P(object);
-
- PHONGO_GET_PROPERTY_HASH_INIT_PROPS(is_debug, intern, props, 4);
-
- if (!intern->write_concern) {
- return props;
- }
-
- wtag = mongoc_write_concern_get_wtag(intern->write_concern);
- w = mongoc_write_concern_get_w(intern->write_concern);
- wtimeout = mongoc_write_concern_get_wtimeout_int64(intern->write_concern);
-
- {
- zval z_w;
-
- if (wtag) {
- ZVAL_STRING(&z_w, wtag);
- zend_hash_str_update(props, "w", sizeof("w") - 1, &z_w);
- } else if (mongoc_write_concern_get_wmajority(intern->write_concern)) {
- ZVAL_STRING(&z_w, PHONGO_WRITE_CONCERN_W_MAJORITY);
- zend_hash_str_update(props, "w", sizeof("w") - 1, &z_w);
- } else if (w != MONGOC_WRITE_CONCERN_W_DEFAULT) {
- ZVAL_LONG(&z_w, w);
- zend_hash_str_update(props, "w", sizeof("w") - 1, &z_w);
- }
-
- if (mongoc_write_concern_journal_is_set(intern->write_concern)) {
- zval z_j;
-
- ZVAL_BOOL(&z_j, mongoc_write_concern_get_journal(intern->write_concern));
- zend_hash_str_update(props, "j", sizeof("j") - 1, &z_j);
- }
-
- if (wtimeout != 0) {
- zval z_wtimeout;
-
- if (is_bson) {
- ZVAL_INT64(&z_wtimeout, wtimeout);
- } else {
-#if SIZEOF_ZEND_LONG == 4
- if (wtimeout > INT32_MAX || wtimeout < INT32_MIN) {
- ZVAL_INT64_STRING(&z_wtimeout, wtimeout);
- } else {
- ZVAL_LONG(&z_wtimeout, wtimeout);
- }
-#else
- ZVAL_LONG(&z_wtimeout, wtimeout);
-#endif
- }
-
- zend_hash_str_update(props, "wtimeout", sizeof("wtimeout") - 1, &z_wtimeout);
- }
- }
-
- return props;
-} /* }}} */
-
-/* {{{ proto array MongoDB\Driver\WriteConcern::bsonSerialize()
-*/
-static PHP_METHOD(WriteConcern, bsonSerialize)
-{
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
-
- ZVAL_ARR(return_value, php_phongo_write_concern_get_properties_hash(getThis(), true, true));
- convert_to_object(return_value);
-} /* }}} */
-
-/* {{{ proto string MongoDB\Driver\WriteConcern::serialize()
-*/
-static PHP_METHOD(WriteConcern, serialize)
-{
- php_phongo_writeconcern_t* intern;
- zval retval;
- php_serialize_data_t var_hash;
- smart_str buf = { 0 };
- const char* wtag;
- int32_t w;
- int64_t wtimeout;
-
- intern = Z_WRITECONCERN_OBJ_P(getThis());
-
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
-
- if (!intern->write_concern) {
- return;
- }
-
- wtag = mongoc_write_concern_get_wtag(intern->write_concern);
- w = mongoc_write_concern_get_w(intern->write_concern);
- wtimeout = mongoc_write_concern_get_wtimeout_int64(intern->write_concern);
-
- array_init_size(&retval, 3);
-
- if (wtag) {
- ADD_ASSOC_STRING(&retval, "w", wtag);
- } else if (mongoc_write_concern_get_wmajority(intern->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(intern->write_concern)) {
- ADD_ASSOC_BOOL_EX(&retval, "j", mongoc_write_concern_get_journal(intern->write_concern));
- }
-
- if (wtimeout != 0) {
- if (wtimeout > INT32_MAX || wtimeout < INT32_MIN) {
- ADD_ASSOC_INT64_AS_STRING(&retval, "wtimeout", wtimeout);
- } else {
- ADD_ASSOC_LONG_EX(&retval, "wtimeout", wtimeout);
- }
- }
-
- PHP_VAR_SERIALIZE_INIT(var_hash);
- php_var_serialize(&buf, &retval, &var_hash);
- smart_str_0(&buf);
- PHP_VAR_SERIALIZE_DESTROY(var_hash);
-
- PHONGO_RETVAL_SMART_STR(buf);
-
- smart_str_free(&buf);
- zval_ptr_dtor(&retval);
-} /* }}} */
-
-/* {{{ proto void MongoDB\Driver\WriteConcern::unserialize(string $serialized)
-*/
-static PHP_METHOD(WriteConcern, unserialize)
-{
- php_phongo_writeconcern_t* intern;
- zend_error_handling error_handling;
- char* serialized;
- size_t serialized_len;
- zval props;
- php_unserialize_data_t var_hash;
-
- intern = Z_WRITECONCERN_OBJ_P(getThis());
-
- zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
-
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &serialized, &serialized_len) == FAILURE) {
- zend_restore_error_handling(&error_handling);
- return;
- }
- zend_restore_error_handling(&error_handling);
-
- if (!serialized_len) {
- return;
- }
-
- PHP_VAR_UNSERIALIZE_INIT(var_hash);
- if (!php_var_unserialize(&props, (const unsigned char**) &serialized, (unsigned char*) serialized + serialized_len, &var_hash)) {
- zval_ptr_dtor(&props);
- phongo_throw_exception(PHONGO_ERROR_UNEXPECTED_VALUE, "%s unserialization failed", ZSTR_VAL(php_phongo_writeconcern_ce->name));
-
- PHP_VAR_UNSERIALIZE_DESTROY(var_hash);
- return;
- }
- PHP_VAR_UNSERIALIZE_DESTROY(var_hash);
-
- php_phongo_writeconcern_init_from_hash(intern, HASH_OF(&props));
- zval_ptr_dtor(&props);
-} /* }}} */
-
-/* {{{ MongoDB\Driver\WriteConcern function entries */
-ZEND_BEGIN_ARG_INFO_EX(ai_WriteConcern___construct, 0, 0, 1)
- ZEND_ARG_INFO(0, w)
- ZEND_ARG_INFO(0, wtimeout)
- ZEND_ARG_INFO(0, journal)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(ai_WriteConcern___set_state, 0, 0, 1)
- ZEND_ARG_ARRAY_INFO(0, properties, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(ai_WriteConcern_unserialize, 0, 0, 1)
- ZEND_ARG_INFO(0, serialized)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(ai_WriteConcern_void, 0, 0, 0)
-ZEND_END_ARG_INFO()
-
-static zend_function_entry php_phongo_writeconcern_me[] = {
- /* clang-format off */
- PHP_ME(WriteConcern, __construct, ai_WriteConcern___construct, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
- PHP_ME(WriteConcern, __set_state, ai_WriteConcern___set_state, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
- PHP_ME(WriteConcern, getW, ai_WriteConcern_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
- PHP_ME(WriteConcern, getWtimeout, ai_WriteConcern_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
- PHP_ME(WriteConcern, getJournal, ai_WriteConcern_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
- PHP_ME(WriteConcern, isDefault, ai_WriteConcern_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
- PHP_ME(WriteConcern, bsonSerialize, ai_WriteConcern_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
- PHP_ME(WriteConcern, serialize, ai_WriteConcern_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
- PHP_ME(WriteConcern, unserialize, ai_WriteConcern_unserialize, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
- PHP_FE_END
- /* clang-format on */
-};
-/* }}} */
-
-/* {{{ MongoDB\Driver\WriteConcern object handlers */
-static zend_object_handlers php_phongo_handler_writeconcern;
-
-static void php_phongo_writeconcern_free_object(zend_object* object) /* {{{ */
-{
- php_phongo_writeconcern_t* intern = Z_OBJ_WRITECONCERN(object);
-
- zend_object_std_dtor(&intern->std);
-
- if (intern->properties) {
- zend_hash_destroy(intern->properties);
- FREE_HASHTABLE(intern->properties);
- }
-
- if (intern->write_concern) {
- mongoc_write_concern_destroy(intern->write_concern);
- }
-} /* }}} */
-
-static zend_object* php_phongo_writeconcern_create_object(zend_class_entry* class_type) /* {{{ */
-{
- php_phongo_writeconcern_t* intern = NULL;
-
- intern = PHONGO_ALLOC_OBJECT_T(php_phongo_writeconcern_t, class_type);
-
- zend_object_std_init(&intern->std, class_type);
- object_properties_init(&intern->std, class_type);
-
- intern->std.handlers = &php_phongo_handler_writeconcern;
-
- return &intern->std;
-} /* }}} */
-
-static HashTable* php_phongo_writeconcern_get_debug_info(zval* object, int* is_temp) /* {{{ */
-{
- *is_temp = 1;
- return php_phongo_write_concern_get_properties_hash(object, true, false);
-} /* }}} */
-
-static HashTable* php_phongo_writeconcern_get_properties(zval* object) /* {{{ */
-{
- return php_phongo_write_concern_get_properties_hash(object, false, false);
-} /* }}} */
-
-void php_phongo_writeconcern_init_ce(INIT_FUNC_ARGS) /* {{{ */
-{
- zend_class_entry ce;
-
- INIT_NS_CLASS_ENTRY(ce, "MongoDB\\Driver", "WriteConcern", php_phongo_writeconcern_me);
- php_phongo_writeconcern_ce = zend_register_internal_class(&ce);
- php_phongo_writeconcern_ce->create_object = php_phongo_writeconcern_create_object;
- PHONGO_CE_FINAL(php_phongo_writeconcern_ce);
-
- zend_class_implements(php_phongo_writeconcern_ce, 1, php_phongo_serializable_ce);
- zend_class_implements(php_phongo_writeconcern_ce, 1, zend_ce_serializable);
-
- memcpy(&php_phongo_handler_writeconcern, phongo_get_std_object_handlers(), sizeof(zend_object_handlers));
- php_phongo_handler_writeconcern.get_debug_info = php_phongo_writeconcern_get_debug_info;
- php_phongo_handler_writeconcern.get_properties = php_phongo_writeconcern_get_properties;
- php_phongo_handler_writeconcern.free_obj = php_phongo_writeconcern_free_object;
- php_phongo_handler_writeconcern.offset = XtOffsetOf(php_phongo_writeconcern_t, std);
-
- zend_declare_class_constant_stringl(php_phongo_writeconcern_ce, ZEND_STRL("MAJORITY"), ZEND_STRL(PHONGO_WRITE_CONCERN_W_MAJORITY));
-} /* }}} */
-
-/*
- * 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.8.1/src/MongoDB/WriteConcernError.c b/mongodb-1.8.1/src/MongoDB/WriteConcernError.c
deleted file mode 100644
index 078a48d9..00000000
--- a/mongodb-1.8.1/src/MongoDB/WriteConcernError.c
+++ /dev/null
@@ -1,169 +0,0 @@
-/*
- * 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.
- */
-
-#include <php.h>
-#include <Zend/zend_interfaces.h>
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "phongo_compat.h"
-#include "php_phongo.h"
-
-zend_class_entry* php_phongo_writeconcernerror_ce;
-
-/* {{{ proto integer MongoDB\Driver\WriteConcernError::getCode()
- Returns the MongoDB error code */
-static PHP_METHOD(WriteConcernError, getCode)
-{
- php_phongo_writeconcernerror_t* intern;
-
- intern = Z_WRITECONCERNERROR_OBJ_P(getThis());
-
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
-
- RETURN_LONG(intern->code);
-} /* }}} */
-
-/* {{{ proto object|null MongoDB\Driver\WriteConcernError::getInfo()
- Returns additional metadata for the error */
-static PHP_METHOD(WriteConcernError, getInfo)
-{
- php_phongo_writeconcernerror_t* intern;
-
- intern = Z_WRITECONCERNERROR_OBJ_P(getThis());
-
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
-
- if (!Z_ISUNDEF(intern->info)) {
- RETURN_ZVAL(&intern->info, 1, 0);
- }
-} /* }}} */
-
-/* {{{ proto string MongoDB\Driver\WriteConcernError::getMessage()
- Returns the actual error message from the server */
-static PHP_METHOD(WriteConcernError, getMessage)
-{
- php_phongo_writeconcernerror_t* intern;
-
- intern = Z_WRITECONCERNERROR_OBJ_P(getThis());
-
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
-
- RETURN_STRING(intern->message);
-} /* }}} */
-
-/* {{{ MongoDB\Driver\WriteConcernError function entries */
-ZEND_BEGIN_ARG_INFO_EX(ai_WriteConcernError_void, 0, 0, 0)
-ZEND_END_ARG_INFO()
-
-static zend_function_entry php_phongo_writeconcernerror_me[] = {
- /* clang-format off */
- PHP_ME(WriteConcernError, getCode, ai_WriteConcernError_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
- PHP_ME(WriteConcernError, getInfo, ai_WriteConcernError_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
- PHP_ME(WriteConcernError, getMessage, ai_WriteConcernError_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
- ZEND_NAMED_ME(__construct, PHP_FN(MongoDB_disabled___construct), ai_WriteConcernError_void, ZEND_ACC_PRIVATE | ZEND_ACC_FINAL)
- ZEND_NAMED_ME(__wakeup, PHP_FN(MongoDB_disabled___wakeup), ai_WriteConcernError_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
- PHP_FE_END
- /* clang-format on */
-};
-/* }}} */
-
-/* {{{ MongoDB\Driver\WriteConcernError object handlers */
-static zend_object_handlers php_phongo_handler_writeconcernerror;
-
-static void php_phongo_writeconcernerror_free_object(zend_object* object) /* {{{ */
-{
- php_phongo_writeconcernerror_t* intern = Z_OBJ_WRITECONCERNERROR(object);
-
- zend_object_std_dtor(&intern->std);
-
- if (intern->message) {
- efree(intern->message);
- }
-
- if (!Z_ISUNDEF(intern->info)) {
- zval_ptr_dtor(&intern->info);
- }
-} /* }}} */
-
-static zend_object* php_phongo_writeconcernerror_create_object(zend_class_entry* class_type) /* {{{ */
-{
- php_phongo_writeconcernerror_t* intern = NULL;
-
- intern = PHONGO_ALLOC_OBJECT_T(php_phongo_writeconcernerror_t, class_type);
-
- zend_object_std_init(&intern->std, class_type);
- object_properties_init(&intern->std, class_type);
-
- intern->std.handlers = &php_phongo_handler_writeconcernerror;
-
- return &intern->std;
-} /* }}} */
-
-static HashTable* php_phongo_writeconcernerror_get_debug_info(zval* object, int* is_temp) /* {{{ */
-{
- php_phongo_writeconcernerror_t* intern;
- zval retval = ZVAL_STATIC_INIT;
-
- *is_temp = 1;
- intern = Z_WRITECONCERNERROR_OBJ_P(object);
-
- array_init_size(&retval, 3);
- ADD_ASSOC_STRING(&retval, "message", intern->message);
- ADD_ASSOC_LONG_EX(&retval, "code", intern->code);
- if (!Z_ISUNDEF(intern->info)) {
- Z_ADDREF(intern->info);
- ADD_ASSOC_ZVAL_EX(&retval, "info", &intern->info);
- } else {
- ADD_ASSOC_NULL_EX(&retval, "info");
- }
-
- return Z_ARRVAL(retval);
-} /* }}} */
-/* }}} */
-
-void php_phongo_writeconcernerror_init_ce(INIT_FUNC_ARGS) /* {{{ */
-{
- zend_class_entry ce;
-
- INIT_NS_CLASS_ENTRY(ce, "MongoDB\\Driver", "WriteConcernError", php_phongo_writeconcernerror_me);
- php_phongo_writeconcernerror_ce = zend_register_internal_class(&ce);
- php_phongo_writeconcernerror_ce->create_object = php_phongo_writeconcernerror_create_object;
- PHONGO_CE_FINAL(php_phongo_writeconcernerror_ce);
- PHONGO_CE_DISABLE_SERIALIZATION(php_phongo_writeconcernerror_ce);
-
- memcpy(&php_phongo_handler_writeconcernerror, phongo_get_std_object_handlers(), sizeof(zend_object_handlers));
- php_phongo_handler_writeconcernerror.get_debug_info = php_phongo_writeconcernerror_get_debug_info;
- php_phongo_handler_writeconcernerror.free_obj = php_phongo_writeconcernerror_free_object;
- php_phongo_handler_writeconcernerror.offset = XtOffsetOf(php_phongo_writeconcernerror_t, std);
-} /* }}} */
-
-/*
- * 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.8.1/src/MongoDB/WriteError.c b/mongodb-1.8.1/src/MongoDB/WriteError.c
deleted file mode 100644
index 0304565a..00000000
--- a/mongodb-1.8.1/src/MongoDB/WriteError.c
+++ /dev/null
@@ -1,187 +0,0 @@
-/*
- * 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.
- */
-
-#include <php.h>
-#include <Zend/zend_interfaces.h>
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "phongo_compat.h"
-#include "php_phongo.h"
-
-zend_class_entry* php_phongo_writeerror_ce;
-
-/* {{{ proto integer MongoDB\Driver\WriteError::getCode()
- Returns the MongoDB error code */
-static PHP_METHOD(WriteError, getCode)
-{
- php_phongo_writeerror_t* intern;
-
- intern = Z_WRITEERROR_OBJ_P(getThis());
-
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
-
- RETURN_LONG(intern->code);
-} /* }}} */
-
-/* {{{ proto integer MongoDB\Driver\WriteError::getIndex()
- Returns the index of the operation in the BulkWrite to which this WriteError
- corresponds. */
-static PHP_METHOD(WriteError, getIndex)
-{
- php_phongo_writeerror_t* intern;
-
- intern = Z_WRITEERROR_OBJ_P(getThis());
-
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
-
- RETURN_LONG(intern->index);
-} /* }}} */
-
-/* {{{ proto string MongoDB\Driver\WriteError::getMessage()
- Returns the actual error message from the server */
-static PHP_METHOD(WriteError, getMessage)
-{
- php_phongo_writeerror_t* intern;
-
- intern = Z_WRITEERROR_OBJ_P(getThis());
-
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
-
- RETURN_STRING(intern->message);
-} /* }}} */
-
-/* {{{ proto object|null MongoDB\Driver\WriteError::getInfo()
- Returns additional metadata for the error */
-static PHP_METHOD(WriteError, getInfo)
-{
- php_phongo_writeerror_t* intern;
-
- intern = Z_WRITEERROR_OBJ_P(getThis());
-
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
-
- if (!Z_ISUNDEF(intern->info)) {
- RETURN_ZVAL(&intern->info, 1, 0);
- }
-} /* }}} */
-
-/* {{{ MongoDB\Driver\WriteError function entries */
-ZEND_BEGIN_ARG_INFO_EX(ai_WriteError_void, 0, 0, 0)
-ZEND_END_ARG_INFO()
-
-static zend_function_entry php_phongo_writeerror_me[] = {
- /* clang-format off */
- PHP_ME(WriteError, getCode, ai_WriteError_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
- PHP_ME(WriteError, getIndex, ai_WriteError_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
- PHP_ME(WriteError, getMessage, ai_WriteError_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
- PHP_ME(WriteError, getInfo, ai_WriteError_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
- ZEND_NAMED_ME(__construct, PHP_FN(MongoDB_disabled___construct), ai_WriteError_void, ZEND_ACC_PRIVATE | ZEND_ACC_FINAL)
- ZEND_NAMED_ME(__wakeup, PHP_FN(MongoDB_disabled___wakeup), ai_WriteError_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
- PHP_FE_END
- /* clang-format on */
-};
-/* }}} */
-
-/* {{{ MongoDB\Driver\WriteError object handlers */
-static zend_object_handlers php_phongo_handler_writeerror;
-
-static void php_phongo_writeerror_free_object(zend_object* object) /* {{{ */
-{
- php_phongo_writeerror_t* intern = Z_OBJ_WRITEERROR(object);
-
- zend_object_std_dtor(&intern->std);
-
- if (intern->message) {
- efree(intern->message);
- }
-
- if (!Z_ISUNDEF(intern->info)) {
- zval_ptr_dtor(&intern->info);
- }
-} /* }}} */
-
-static zend_object* php_phongo_writeerror_create_object(zend_class_entry* class_type) /* {{{ */
-{
- php_phongo_writeerror_t* intern = NULL;
-
- intern = PHONGO_ALLOC_OBJECT_T(php_phongo_writeerror_t, class_type);
-
- zend_object_std_init(&intern->std, class_type);
- object_properties_init(&intern->std, class_type);
-
- intern->std.handlers = &php_phongo_handler_writeerror;
-
- return &intern->std;
-} /* }}} */
-
-static HashTable* php_phongo_writeerror_get_debug_info(zval* object, int* is_temp) /* {{{ */
-{
- php_phongo_writeerror_t* intern;
- zval retval = ZVAL_STATIC_INIT;
-
- *is_temp = 1;
- intern = Z_WRITEERROR_OBJ_P(object);
-
- array_init_size(&retval, 3);
- ADD_ASSOC_STRING(&retval, "message", intern->message);
- ADD_ASSOC_LONG_EX(&retval, "code", intern->code);
- ADD_ASSOC_LONG_EX(&retval, "index", intern->index);
- if (!Z_ISUNDEF(intern->info)) {
- Z_ADDREF(intern->info);
- ADD_ASSOC_ZVAL_EX(&retval, "info", &intern->info);
- } else {
- ADD_ASSOC_NULL_EX(&retval, "info");
- }
-
- return Z_ARRVAL(retval);
-} /* }}} */
-/* }}} */
-
-void php_phongo_writeerror_init_ce(INIT_FUNC_ARGS) /* {{{ */
-{
- zend_class_entry ce;
-
- INIT_NS_CLASS_ENTRY(ce, "MongoDB\\Driver", "WriteError", php_phongo_writeerror_me);
- php_phongo_writeerror_ce = zend_register_internal_class(&ce);
- php_phongo_writeerror_ce->create_object = php_phongo_writeerror_create_object;
- PHONGO_CE_FINAL(php_phongo_writeerror_ce);
- PHONGO_CE_DISABLE_SERIALIZATION(php_phongo_writeerror_ce);
-
- memcpy(&php_phongo_handler_writeerror, phongo_get_std_object_handlers(), sizeof(zend_object_handlers));
- php_phongo_handler_writeerror.get_debug_info = php_phongo_writeerror_get_debug_info;
- php_phongo_handler_writeerror.free_obj = php_phongo_writeerror_free_object;
- php_phongo_handler_writeerror.offset = XtOffsetOf(php_phongo_writeerror_t, std);
-} /* }}} */
-
-/*
- * 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.8.1/src/MongoDB/WriteResult.c b/mongodb-1.8.1/src/MongoDB/WriteResult.c
deleted file mode 100644
index c96853ad..00000000
--- a/mongodb-1.8.1/src/MongoDB/WriteResult.c
+++ /dev/null
@@ -1,441 +0,0 @@
-/*
- * 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.
- */
-
-#include <php.h>
-#include <Zend/zend_interfaces.h>
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php_array_api.h"
-#include "phongo_compat.h"
-#include "php_phongo.h"
-#include "php_bson.h"
-
-#define PHONGO_WRITERESULT_RETURN_LONG_FROM_BSON_INT32(iter, bson, key) \
- if (bson_iter_init_find((iter), (bson), (key)) && BSON_ITER_HOLDS_INT32((iter))) { \
- RETURN_LONG(bson_iter_int32((iter))); \
- }
-
-zend_class_entry* php_phongo_writeresult_ce;
-
-static bool php_phongo_writeresult_get_writeconcernerror(php_phongo_writeresult_t* intern, zval* return_value) /* {{{ */
-{
- bson_iter_t iter, child;
- zval writeconcernerror;
-
- ZVAL_NULL(return_value);
-
- if (bson_iter_init_find(&iter, intern->reply, "writeConcernErrors") && BSON_ITER_HOLDS_ARRAY(&iter) && bson_iter_recurse(&iter, &child)) {
- while (bson_iter_next(&child)) {
- bson_t cbson;
- uint32_t len;
- const uint8_t* data;
-
- if (!BSON_ITER_HOLDS_DOCUMENT(&child)) {
- continue;
- }
-
- bson_iter_document(&child, &len, &data);
-
- if (!bson_init_static(&cbson, data, len)) {
- continue;
- }
-
- if (!phongo_writeconcernerror_init(&writeconcernerror, &cbson)) {
- zval_ptr_dtor(&writeconcernerror);
- return false;
- }
-
- ZVAL_ZVAL(return_value, &writeconcernerror, 1, 1);
-
- return true;
- }
- }
-
- return true;
-} /* }}} */
-
-static bool php_phongo_writeresult_get_writeerrors(php_phongo_writeresult_t* intern, zval* return_value) /* {{{ */
-{
- bson_iter_t iter, child;
-
- array_init(return_value);
-
- if (bson_iter_init_find(&iter, intern->reply, "writeErrors") && BSON_ITER_HOLDS_ARRAY(&iter) && bson_iter_recurse(&iter, &child)) {
- while (bson_iter_next(&child)) {
- bson_t cbson;
- uint32_t len;
- const uint8_t* data;
- zval writeerror;
-
- if (!BSON_ITER_HOLDS_DOCUMENT(&child)) {
- continue;
- }
-
- bson_iter_document(&child, &len, &data);
-
- if (!bson_init_static(&cbson, data, len)) {
- continue;
- }
-
- if (!phongo_writeerror_init(&writeerror, &cbson)) {
- zval_ptr_dtor(&writeerror);
- continue;
- }
-
- add_next_index_zval(return_value, &writeerror);
- }
- }
-
- return true;
-} /* }}} */
-
-/* {{{ proto integer|null MongoDB\Driver\WriteResult::getInsertedCount()
- Returns the number of documents that were inserted */
-static PHP_METHOD(WriteResult, getInsertedCount)
-{
- bson_iter_t iter;
- php_phongo_writeresult_t* intern;
-
- intern = Z_WRITERESULT_OBJ_P(getThis());
-
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
-
- PHONGO_WRITERESULT_RETURN_LONG_FROM_BSON_INT32(&iter, intern->reply, "nInserted");
-} /* }}} */
-
-/* {{{ proto integer|null MongoDB\Driver\WriteResult::getMatchedCount()
- Returns the number of documents that matched the update criteria */
-static PHP_METHOD(WriteResult, getMatchedCount)
-{
- bson_iter_t iter;
- php_phongo_writeresult_t* intern;
-
- intern = Z_WRITERESULT_OBJ_P(getThis());
-
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
-
- PHONGO_WRITERESULT_RETURN_LONG_FROM_BSON_INT32(&iter, intern->reply, "nMatched");
-} /* }}} */
-
-/* {{{ proto integer|null MongoDB\Driver\WriteResult::getModifiedCount()
- Returns the number of documents that were actually modified by an update */
-static PHP_METHOD(WriteResult, getModifiedCount)
-{
- bson_iter_t iter;
- php_phongo_writeresult_t* intern;
-
- intern = Z_WRITERESULT_OBJ_P(getThis());
-
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
-
- PHONGO_WRITERESULT_RETURN_LONG_FROM_BSON_INT32(&iter, intern->reply, "nModified");
-} /* }}} */
-
-/* {{{ proto integer|null MongoDB\Driver\WriteResult::getDeletedCount()
- Returns the number of documents that were deleted */
-static PHP_METHOD(WriteResult, getDeletedCount)
-{
- bson_iter_t iter;
- php_phongo_writeresult_t* intern;
-
- intern = Z_WRITERESULT_OBJ_P(getThis());
-
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
-
- PHONGO_WRITERESULT_RETURN_LONG_FROM_BSON_INT32(&iter, intern->reply, "nRemoved");
-} /* }}} */
-
-/* {{{ proto integer|null MongoDB\Driver\WriteResult::getUpsertedCount()
- Returns the number of documents that were upserted */
-static PHP_METHOD(WriteResult, getUpsertedCount)
-{
- bson_iter_t iter;
- php_phongo_writeresult_t* intern;
-
- intern = Z_WRITERESULT_OBJ_P(getThis());
-
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
-
- PHONGO_WRITERESULT_RETURN_LONG_FROM_BSON_INT32(&iter, intern->reply, "nUpserted");
-} /* }}} */
-
-/* {{{ proto MongoDB\Driver\Server MongoDB\Driver\WriteResult::getServer()
- Returns the Server from which the result originated */
-static PHP_METHOD(WriteResult, getServer)
-{
- php_phongo_writeresult_t* intern;
-
- intern = Z_WRITERESULT_OBJ_P(getThis());
-
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
-
- phongo_server_init(return_value, intern->client, intern->server_id);
-} /* }}} */
-
-/* {{{ proto array MongoDB\Driver\WriteResult::getUpsertedIds()
- Returns the identifiers generated by the server for upsert operations. */
-static PHP_METHOD(WriteResult, getUpsertedIds)
-{
- bson_iter_t iter, child;
- php_phongo_writeresult_t* intern;
-
- intern = Z_WRITERESULT_OBJ_P(getThis());
-
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
-
- array_init(return_value);
-
- if (bson_iter_init_find(&iter, intern->reply, "upserted") && BSON_ITER_HOLDS_ARRAY(&iter) && bson_iter_recurse(&iter, &child)) {
- while (bson_iter_next(&child)) {
- uint32_t data_len;
- const uint8_t* data = NULL;
- php_phongo_bson_state state;
-
- /* Use PHONGO_TYPEMAP_NATIVE_ARRAY for the root type so we can
- * easily access the "index" and "_id" fields. */
- PHONGO_BSON_INIT_STATE(state);
- state.map.root_type = PHONGO_TYPEMAP_NATIVE_ARRAY;
-
- if (!BSON_ITER_HOLDS_DOCUMENT(&child)) {
- continue;
- }
-
- bson_iter_document(&child, &data_len, &data);
-
- if (php_phongo_bson_to_zval_ex(data, data_len, &state)) {
- zval* zid = php_array_fetchc(&state.zchild, "_id");
- add_index_zval(return_value, php_array_fetchc_long(&state.zchild, "index"), zid);
- zval_add_ref(zid);
- }
-
- zval_ptr_dtor(&state.zchild);
- }
- }
-} /* }}} */
-
-/* {{{ proto WriteConcernError MongoDB\Driver\WriteResult::getWriteConcernError()
- Return any write concern error that occurred */
-static PHP_METHOD(WriteResult, getWriteConcernError)
-{
- php_phongo_writeresult_t* intern;
-
- intern = Z_WRITERESULT_OBJ_P(getThis());
-
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
-
- php_phongo_writeresult_get_writeconcernerror(intern, return_value);
-} /* }}} */
-
-/* {{{ proto WriteError[] MongoDB\Driver\WriteResult::getWriteErrors()
- Returns any write errors that occurred */
-static PHP_METHOD(WriteResult, getWriteErrors)
-{
- php_phongo_writeresult_t* intern;
-
- intern = Z_WRITERESULT_OBJ_P(getThis());
-
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
-
- php_phongo_writeresult_get_writeerrors(intern, return_value);
-} /* }}} */
-
-/* {{{ proto boolean MongoDB\Driver\WriteResult::isAcknowledged()
- Returns whether the write operation was acknowledged (based on the write
- concern). */
-static PHP_METHOD(WriteResult, isAcknowledged)
-{
- php_phongo_writeresult_t* intern;
-
- intern = Z_WRITERESULT_OBJ_P(getThis());
-
- if (zend_parse_parameters_none() == FAILURE) {
- return;
- }
-
- RETURN_BOOL(mongoc_write_concern_is_acknowledged(intern->write_concern));
-} /* }}} */
-
-/* {{{ MongoDB\Driver\WriteResult function entries */
-ZEND_BEGIN_ARG_INFO_EX(ai_WriteResult_void, 0, 0, 0)
-ZEND_END_ARG_INFO()
-
-static zend_function_entry php_phongo_writeresult_me[] = {
- /* clang-format off */
- PHP_ME(WriteResult, getInsertedCount, ai_WriteResult_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
- PHP_ME(WriteResult, getMatchedCount, ai_WriteResult_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
- PHP_ME(WriteResult, getModifiedCount, ai_WriteResult_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
- PHP_ME(WriteResult, getDeletedCount, ai_WriteResult_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
- PHP_ME(WriteResult, getUpsertedCount, ai_WriteResult_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
- PHP_ME(WriteResult, getServer, ai_WriteResult_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
- PHP_ME(WriteResult, getUpsertedIds, ai_WriteResult_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
- PHP_ME(WriteResult, getWriteConcernError, ai_WriteResult_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
- PHP_ME(WriteResult, getWriteErrors, ai_WriteResult_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
- PHP_ME(WriteResult, isAcknowledged, ai_WriteResult_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
- ZEND_NAMED_ME(__construct, PHP_FN(MongoDB_disabled___construct), ai_WriteResult_void, ZEND_ACC_PRIVATE | ZEND_ACC_FINAL)
- ZEND_NAMED_ME(__wakeup, PHP_FN(MongoDB_disabled___wakeup), ai_WriteResult_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
- PHP_FE_END
- /* clang-format on */
-};
-/* }}} */
-
-/* {{{ MongoDB\Driver\WriteResult object handlers */
-static zend_object_handlers php_phongo_handler_writeresult;
-
-static void php_phongo_writeresult_free_object(zend_object* object) /* {{{ */
-{
- php_phongo_writeresult_t* intern = Z_OBJ_WRITERESULT(object);
-
- zend_object_std_dtor(&intern->std);
-
- if (intern->reply) {
- bson_destroy(intern->reply);
- }
-
- if (intern->write_concern) {
- mongoc_write_concern_destroy(intern->write_concern);
- }
-} /* }}} */
-
-static zend_object* php_phongo_writeresult_create_object(zend_class_entry* class_type) /* {{{ */
-{
- php_phongo_writeresult_t* intern = NULL;
-
- intern = PHONGO_ALLOC_OBJECT_T(php_phongo_writeresult_t, class_type);
-
- zend_object_std_init(&intern->std, class_type);
- object_properties_init(&intern->std, class_type);
-
- intern->std.handlers = &php_phongo_handler_writeresult;
-
- return &intern->std;
-} /* }}} */
-
-static HashTable* php_phongo_writeresult_get_debug_info(zval* object, int* is_temp) /* {{{ */
-{
- php_phongo_writeresult_t* intern;
- zval retval = ZVAL_STATIC_INIT;
- bson_iter_t iter;
-
- intern = Z_WRITERESULT_OBJ_P(object);
- *is_temp = 1;
- array_init_size(&retval, 9);
-
-#define PHONGO_WRITERESULT_SCP(field) \
- if (bson_iter_init_find(&iter, intern->reply, (field)) && BSON_ITER_HOLDS_INT32(&iter)) { \
- ADD_ASSOC_LONG_EX(&retval, (field), bson_iter_int32(&iter)); \
- } else { \
- ADD_ASSOC_NULL_EX(&retval, (field)); \
- }
-
- PHONGO_WRITERESULT_SCP("nInserted");
- PHONGO_WRITERESULT_SCP("nMatched");
- PHONGO_WRITERESULT_SCP("nModified");
- PHONGO_WRITERESULT_SCP("nRemoved");
- PHONGO_WRITERESULT_SCP("nUpserted");
-#undef PHONGO_WRITERESULT_SCP
-
- if (bson_iter_init_find(&iter, intern->reply, "upserted") && BSON_ITER_HOLDS_ARRAY(&iter)) {
- uint32_t len;
- const uint8_t* data;
- php_phongo_bson_state state;
-
- PHONGO_BSON_INIT_DEBUG_STATE(state);
- bson_iter_array(&iter, &len, &data);
- if (!php_phongo_bson_to_zval_ex(data, len, &state)) {
- zval_ptr_dtor(&state.zchild);
- goto done;
- }
-
- ADD_ASSOC_ZVAL_EX(&retval, "upsertedIds", &state.zchild);
- } else {
- zval upsertedIds;
- array_init(&upsertedIds);
- ADD_ASSOC_ZVAL_EX(&retval, "upsertedIds", &upsertedIds);
- }
-
- {
- zval writeerrors;
-
- php_phongo_writeresult_get_writeerrors(intern, &writeerrors);
- ADD_ASSOC_ZVAL_EX(&retval, "writeErrors", &writeerrors);
- }
-
- {
- zval writeconcernerror;
-
- php_phongo_writeresult_get_writeconcernerror(intern, &writeconcernerror);
- ADD_ASSOC_ZVAL_EX(&retval, "writeConcernError", &writeconcernerror);
- }
-
- if (intern->write_concern) {
- zval write_concern;
-
- phongo_writeconcern_init(&write_concern, intern->write_concern);
- ADD_ASSOC_ZVAL_EX(&retval, "writeConcern", &write_concern);
- } else {
- ADD_ASSOC_NULL_EX(&retval, "writeConcern");
- }
-
-done:
- return Z_ARRVAL(retval);
-} /* }}} */
-/* }}} */
-
-void php_phongo_writeresult_init_ce(INIT_FUNC_ARGS) /* {{{ */
-{
- zend_class_entry ce;
-
- INIT_NS_CLASS_ENTRY(ce, "MongoDB\\Driver", "WriteResult", php_phongo_writeresult_me);
- php_phongo_writeresult_ce = zend_register_internal_class(&ce);
- php_phongo_writeresult_ce->create_object = php_phongo_writeresult_create_object;
- PHONGO_CE_FINAL(php_phongo_writeresult_ce);
- PHONGO_CE_DISABLE_SERIALIZATION(php_phongo_writeresult_ce);
-
- memcpy(&php_phongo_handler_writeresult, phongo_get_std_object_handlers(), sizeof(zend_object_handlers));
- php_phongo_handler_writeresult.get_debug_info = php_phongo_writeresult_get_debug_info;
- php_phongo_handler_writeresult.free_obj = php_phongo_writeresult_free_object;
- php_phongo_handler_writeresult.offset = XtOffsetOf(php_phongo_writeresult_t, std);
-} /* }}} */
-
-/*
- * 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.8.1/src/bson-encode.c b/mongodb-1.8.1/src/bson-encode.c
deleted file mode 100644
index 83c48d44..00000000
--- a/mongodb-1.8.1/src/bson-encode.c
+++ /dev/null
@@ -1,530 +0,0 @@
-/*
- * 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.
- */
-
-#include <bson/bson.h>
-
-#include <php.h>
-#include <Zend/zend_hash.h>
-#include <Zend/zend_interfaces.h>
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php_phongo.h"
-#include "php_bson.h"
-#include "phongo_compat.h"
-
-#if SIZEOF_ZEND_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_ZEND_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"
-
-/* Forwards declarations */
-static void php_phongo_zval_to_bson_internal(zval* data, php_phongo_field_path* field_path, php_phongo_bson_flags_t flags, bson_t* bson, bson_t** bson_out);
-
-/* Determines whether the argument should be serialized as a BSON array or
- * document. IS_ARRAY is returned if the argument's keys are a sequence of
- * integers starting at zero; otherwise, IS_OBJECT is returned. */
-static int php_phongo_is_array_or_document(zval* val) /* {{{ */
-{
- 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) {
- 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 {
- return Z_TYPE_P(val);
- }
-
- return IS_ARRAY;
-} /* }}} */
-
-/* Appends the array or object argument to the BSON document. If the object is
- * an instance of MongoDB\BSON\Serializable, the return value of bsonSerialize()
- * will be appended as an embedded document. Other MongoDB\BSON\Type instances
- * will be appended as the appropriate BSON type. Other array or object values
- * will be appended as an embedded document. */
-static void php_phongo_bson_append_object(bson_t* bson, php_phongo_field_path* field_path, php_phongo_bson_flags_t flags, const char* key, long key_len, zval* object) /* {{{ */
-{
- if (Z_TYPE_P(object) == IS_OBJECT && instanceof_function(Z_OBJCE_P(object), php_phongo_cursorid_ce)) {
- bson_append_int64(bson, key, key_len, Z_CURSORID_OBJ_P(object)->id);
- return;
- }
-
- if (Z_TYPE_P(object) == IS_OBJECT && instanceof_function(Z_OBJCE_P(object), php_phongo_type_ce)) {
- if (instanceof_function(Z_OBJCE_P(object), php_phongo_serializable_ce)) {
- zval obj_data;
- bson_t child;
-
- zend_call_method_with_0_params(object, NULL, NULL, BSON_SERIALIZE_FUNC_NAME, &obj_data);
-
- if (Z_ISUNDEF(obj_data)) {
- /* zend_call_method() failed or bsonSerialize() threw an
- * exception. Either way, there is nothing else to do. */
- return;
- }
-
- if (Z_TYPE(obj_data) != IS_ARRAY && !(Z_TYPE(obj_data) == IS_OBJECT && instanceof_function(Z_OBJCE(obj_data), zend_standard_class_def))) {
- phongo_throw_exception(PHONGO_ERROR_UNEXPECTED_VALUE,
- "Expected %s::%s() to return an array or stdClass, %s given",
- ZSTR_VAL(Z_OBJCE_P(object)->name),
- BSON_SERIALIZE_FUNC_NAME,
- PHONGO_ZVAL_CLASS_OR_TYPE_NAME(obj_data));
- zval_ptr_dtor(&obj_data);
-
- return;
- }
-
- /* Persistable objects must always be serialized as BSON documents;
- * otherwise, infer based on bsonSerialize()'s return value. */
- if (instanceof_function(Z_OBJCE_P(object), php_phongo_persistable_ce) || php_phongo_is_array_or_document(&obj_data) == IS_OBJECT) {
- bson_append_document_begin(bson, key, key_len, &child);
- if (instanceof_function(Z_OBJCE_P(object), php_phongo_persistable_ce)) {
- 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);
- }
- php_phongo_zval_to_bson_internal(&obj_data, field_path, flags, &child, NULL);
- bson_append_document_end(bson, &child);
- } else {
- bson_append_array_begin(bson, key, key_len, &child);
- php_phongo_zval_to_bson_internal(&obj_data, field_path, flags, &child, NULL);
- bson_append_array_end(bson, &child);
- }
-
- zval_ptr_dtor(&obj_data);
- return;
- }
-
- if (instanceof_function(Z_OBJCE_P(object), php_phongo_objectid_ce)) {
- bson_oid_t oid;
- php_phongo_objectid_t* intern = Z_OBJECTID_OBJ_P(object);
-
- mongoc_log(MONGOC_LOG_LEVEL_TRACE, MONGOC_LOG_DOMAIN, "encoding ObjectId");
- bson_oid_init_from_string(&oid, intern->oid);
- bson_append_oid(bson, key, key_len, &oid);
- return;
- }
- if (instanceof_function(Z_OBJCE_P(object), php_phongo_utcdatetime_ce)) {
- php_phongo_utcdatetime_t* intern = Z_UTCDATETIME_OBJ_P(object);
-
- mongoc_log(MONGOC_LOG_LEVEL_TRACE, MONGOC_LOG_DOMAIN, "encoding UTCDateTime");
- bson_append_date_time(bson, key, key_len, intern->milliseconds);
- return;
- }
- if (instanceof_function(Z_OBJCE_P(object), php_phongo_binary_ce)) {
- php_phongo_binary_t* intern = Z_BINARY_OBJ_P(object);
-
- mongoc_log(MONGOC_LOG_LEVEL_TRACE, MONGOC_LOG_DOMAIN, "encoding Binary");
- bson_append_binary(bson, key, key_len, intern->type, (const uint8_t*) intern->data, (uint32_t) intern->data_len);
- return;
- }
- if (instanceof_function(Z_OBJCE_P(object), php_phongo_decimal128_ce)) {
- php_phongo_decimal128_t* intern = Z_DECIMAL128_OBJ_P(object);
-
- mongoc_log(MONGOC_LOG_LEVEL_TRACE, MONGOC_LOG_DOMAIN, "encoding Decimal128");
- bson_append_decimal128(bson, key, key_len, &intern->decimal);
- return;
- }
- if (instanceof_function(Z_OBJCE_P(object), php_phongo_int64_ce)) {
- php_phongo_int64_t* intern = Z_INT64_OBJ_P(object);
-
- mongoc_log(MONGOC_LOG_LEVEL_TRACE, MONGOC_LOG_DOMAIN, "encoding Int64");
- bson_append_int64(bson, key, key_len, intern->integer);
- return;
- }
- if (instanceof_function(Z_OBJCE_P(object), php_phongo_regex_ce)) {
- php_phongo_regex_t* intern = Z_REGEX_OBJ_P(object);
-
- mongoc_log(MONGOC_LOG_LEVEL_TRACE, MONGOC_LOG_DOMAIN, "encoding Regex");
- bson_append_regex(bson, key, key_len, intern->pattern, intern->flags);
- return;
- }
- if (instanceof_function(Z_OBJCE_P(object), php_phongo_javascript_ce)) {
- php_phongo_javascript_t* intern = Z_JAVASCRIPT_OBJ_P(object);
-
- if (intern->scope) {
- mongoc_log(MONGOC_LOG_LEVEL_TRACE, MONGOC_LOG_DOMAIN, "encoding Javascript with scope");
- bson_append_code_with_scope(bson, key, key_len, intern->code, intern->scope);
- } else {
- mongoc_log(MONGOC_LOG_LEVEL_TRACE, MONGOC_LOG_DOMAIN, "encoding Javascript without scope");
- bson_append_code(bson, key, key_len, intern->code);
- }
- return;
- }
- if (instanceof_function(Z_OBJCE_P(object), php_phongo_timestamp_ce)) {
- php_phongo_timestamp_t* intern = Z_TIMESTAMP_OBJ_P(object);
-
- mongoc_log(MONGOC_LOG_LEVEL_TRACE, MONGOC_LOG_DOMAIN, "encoding Timestamp");
- bson_append_timestamp(bson, key, key_len, intern->timestamp, intern->increment);
- return;
- }
- if (instanceof_function(Z_OBJCE_P(object), php_phongo_maxkey_ce)) {
- 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)) {
- mongoc_log(MONGOC_LOG_LEVEL_TRACE, MONGOC_LOG_DOMAIN, "encoding MinKey");
- bson_append_minkey(bson, key, key_len);
- return;
- }
-
- /* Deprecated types */
- if (instanceof_function(Z_OBJCE_P(object), php_phongo_dbpointer_ce)) {
- bson_oid_t oid;
- php_phongo_dbpointer_t* intern = Z_DBPOINTER_OBJ_P(object);
-
- mongoc_log(MONGOC_LOG_LEVEL_TRACE, MONGOC_LOG_DOMAIN, "encoding DBPointer");
- bson_oid_init_from_string(&oid, intern->id);
- bson_append_dbpointer(bson, key, key_len, intern->ref, &oid);
- return;
- }
- if (instanceof_function(Z_OBJCE_P(object), php_phongo_symbol_ce)) {
- php_phongo_symbol_t* intern = Z_SYMBOL_OBJ_P(object);
-
- mongoc_log(MONGOC_LOG_LEVEL_TRACE, MONGOC_LOG_DOMAIN, "encoding Symbol");
- bson_append_symbol(bson, key, key_len, intern->symbol, intern->symbol_len);
- return;
- }
- if (instanceof_function(Z_OBJCE_P(object), php_phongo_undefined_ce)) {
- mongoc_log(MONGOC_LOG_LEVEL_TRACE, MONGOC_LOG_DOMAIN, "encoding Undefined");
- bson_append_undefined(bson, key, key_len);
- return;
- }
-
- phongo_throw_exception(PHONGO_ERROR_UNEXPECTED_VALUE, "Unexpected %s instance: %s", ZSTR_VAL(php_phongo_type_ce->name), ZSTR_VAL(Z_OBJCE_P(object)->name));
- return;
- } else {
- bson_t child;
-
- mongoc_log(MONGOC_LOG_LEVEL_TRACE, MONGOC_LOG_DOMAIN, "encoding document");
- bson_append_document_begin(bson, key, key_len, &child);
- php_phongo_zval_to_bson_internal(object, field_path, flags, &child, NULL);
- bson_append_document_end(bson, &child);
- }
-} /* }}} */
-
-/* Appends the zval argument to the BSON document. If the argument is an object,
- * or an array that should be serialized as an embedded document, this function
- * will defer to php_phongo_bson_append_object(). */
-static void php_phongo_bson_append(bson_t* bson, php_phongo_field_path* field_path, php_phongo_bson_flags_t flags, const char* key, long key_len, zval* entry) /* {{{ */
-{
- php_phongo_field_path_write_item_at_current_level(field_path, key);
-
-try_again:
- switch (Z_TYPE_P(entry)) {
- case IS_NULL:
- bson_append_null(bson, key, key_len);
- break;
- case IS_TRUE:
- bson_append_bool(bson, key, key_len, true);
- break;
-
- case IS_FALSE:
- bson_append_bool(bson, key, key_len, false);
- break;
-
- 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 {
- char* path_string = php_phongo_field_path_as_string(field_path);
- phongo_throw_exception(PHONGO_ERROR_UNEXPECTED_VALUE, "Detected invalid UTF-8 for field path \"%s\": %s", path_string, Z_STRVAL_P(entry));
- efree(path_string);
- }
- break;
-
- case IS_ARRAY:
- if (php_phongo_is_array_or_document(entry) == IS_ARRAY) {
- bson_t child;
- HashTable* tmp_ht = HASH_OF(entry);
-
- if (!php_phongo_zend_hash_apply_protection_begin(tmp_ht)) {
- char* path_string = php_phongo_field_path_as_string(field_path);
- phongo_throw_exception(PHONGO_ERROR_UNEXPECTED_VALUE, "Detected recursion for field path \"%s\"", path_string);
- efree(path_string);
- break;
- }
-
- bson_append_array_begin(bson, key, key_len, &child);
- php_phongo_field_path_write_type_at_current_level(field_path, PHONGO_FIELD_PATH_ITEM_ARRAY);
- field_path->size++;
- php_phongo_zval_to_bson_internal(entry, field_path, flags, &child, NULL);
- field_path->size--;
- bson_append_array_end(bson, &child);
-
- php_phongo_zend_hash_apply_protection_end(tmp_ht);
- break;
- }
- PHONGO_BREAK_INTENTIONALLY_MISSING
-
- case IS_OBJECT: {
- HashTable* tmp_ht = HASH_OF(entry);
-
- if (!php_phongo_zend_hash_apply_protection_begin(tmp_ht)) {
- char* path_string = php_phongo_field_path_as_string(field_path);
- phongo_throw_exception(PHONGO_ERROR_UNEXPECTED_VALUE, "Detected recursion for field path \"%s\"", path_string);
- efree(path_string);
- break;
- }
-
- php_phongo_field_path_write_type_at_current_level(field_path, PHONGO_FIELD_PATH_ITEM_DOCUMENT);
- field_path->size++;
- php_phongo_bson_append_object(bson, field_path, flags, key, key_len, entry);
- field_path->size--;
-
- php_phongo_zend_hash_apply_protection_end(tmp_ht);
- break;
- }
-
- case IS_REFERENCE:
- ZVAL_DEREF(entry);
- goto try_again;
-
- default: {
- char* path_string = php_phongo_field_path_as_string(field_path);
- phongo_throw_exception(PHONGO_ERROR_UNEXPECTED_VALUE, "Detected unsupported PHP type for field path \"%s\": %d (%s)", path_string, Z_TYPE_P(entry), zend_get_type_by_const(Z_TYPE_P(entry)));
- efree(path_string);
- }
- }
-} /* }}} */
-
-static void php_phongo_zval_to_bson_internal(zval* data, php_phongo_field_path* field_path, php_phongo_bson_flags_t flags, bson_t* bson, bson_t** bson_out) /* {{{ */
-{
- HashTable* ht_data = NULL;
- zval obj_data;
-
- /* 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;
-
- /* If the object is an instance of MongoDB\BSON\Persistable, we will need to
- * inject the PHP class name as a BSON key and ignore any existing key in
- * the return value of bsonSerialize(). */
- bool skip_odm_field = false;
-
- ZVAL_UNDEF(&obj_data);
-
- switch (Z_TYPE_P(data)) {
- case IS_OBJECT:
- if (instanceof_function(Z_OBJCE_P(data), php_phongo_serializable_ce)) {
- zend_call_method_with_0_params(data, NULL, NULL, BSON_SERIALIZE_FUNC_NAME, &obj_data);
-
- if (Z_ISUNDEF(obj_data)) {
- /* zend_call_method() failed or bsonSerialize() threw an
- * exception. Either way, there is nothing else to do. */
- return;
- }
-
- if (Z_TYPE(obj_data) != IS_ARRAY && !(Z_TYPE(obj_data) == IS_OBJECT && instanceof_function(Z_OBJCE(obj_data), zend_standard_class_def))) {
- phongo_throw_exception(
- PHONGO_ERROR_UNEXPECTED_VALUE,
- "Expected %s::%s() to return an array or stdClass, %s given",
- ZSTR_VAL(Z_OBJCE_P(data)->name),
- BSON_SERIALIZE_FUNC_NAME,
- PHONGO_ZVAL_CLASS_OR_TYPE_NAME(obj_data));
-
- goto cleanup;
- }
-
- ht_data = HASH_OF(&obj_data);
-
- if (instanceof_function(Z_OBJCE_P(data), php_phongo_persistable_ce)) {
- 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);
- /* Ensure that we ignore an existing key with the same name
- * if one exists in the bsonSerialize() return value. */
- skip_odm_field = true;
- }
-
- break;
- }
-
- if (instanceof_function(Z_OBJCE_P(data), php_phongo_type_ce)) {
- phongo_throw_exception(PHONGO_ERROR_UNEXPECTED_VALUE, "%s instance %s cannot be serialized as a root element", ZSTR_VAL(php_phongo_type_ce->name), ZSTR_VAL(Z_OBJCE_P(data)->name));
- return;
- }
-
- ht_data = Z_OBJ_HT_P(data)->get_properties(data);
- ht_data_from_properties = true;
- break;
-
- case IS_ARRAY:
- ht_data = HASH_OF(data);
- break;
-
- default:
- return;
- }
-
- {
- zend_string* string_key = NULL;
- zend_ulong num_key = 0;
- zval* value;
-
- ZEND_HASH_FOREACH_KEY_VAL_IND(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) {
- continue;
- }
- }
-
- if (strlen(ZSTR_VAL(string_key)) != ZSTR_LEN(string_key)) {
- phongo_throw_exception(PHONGO_ERROR_UNEXPECTED_VALUE, "BSON keys cannot contain null bytes. Unexpected null byte after \"%s\".", ZSTR_VAL(string_key));
-
- goto cleanup;
- }
-
- if (skip_odm_field && !strcmp(ZSTR_VAL(string_key), PHONGO_ODM_FIELD_NAME)) {
- continue;
- }
-
- 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);
- }
-
- php_phongo_bson_append(bson, field_path, flags & ~PHONGO_BSON_ADD_ID, ZSTR_VAL(string_key), strlen(ZSTR_VAL(string_key)), value);
-
- zend_string_release(string_key);
- }
- ZEND_HASH_FOREACH_END();
- }
-
- 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 && bson_out) {
- bson_iter_t iter;
-
- *bson_out = bson_new();
-
- if (bson_iter_init_find(&iter, bson, "_id") && !bson_append_iter(*bson_out, NULL, 0, &iter)) {
- /* This should not be able to happen since we are copying from
- * within a valid bson_t. */
- phongo_throw_exception(PHONGO_ERROR_UNEXPECTED_VALUE, "Error copying \"_id\" field from encoded document");
-
- goto cleanup;
- }
- }
-
-cleanup:
- if (!Z_ISUNDEF(obj_data)) {
- zval_ptr_dtor(&obj_data);
- }
-} /* }}} */
-
-/* Converts the array or object argument to a BSON document. If the object is an
- * instance of MongoDB\BSON\Serializable, the return value of bsonSerialize()
- * will be used. */
-void php_phongo_zval_to_bson(zval* data, php_phongo_bson_flags_t flags, bson_t* bson, bson_t** bson_out) /* {{{ */
-{
- php_phongo_field_path* field_path = php_phongo_field_path_alloc(false);
-
- php_phongo_zval_to_bson_internal(data, field_path, flags, bson, bson_out);
-
- php_phongo_field_path_free(field_path);
-} /* }}} */
-
-/* Converts the argument to a bson_value_t. If the object is an instance of
- * MongoDB\BSON\Serializable, the return value of bsonSerialize() will be
- * used. */
-void php_phongo_zval_to_bson_value(zval* data, php_phongo_bson_flags_t flags, bson_value_t* value) /* {{{ */
-{
- bson_iter_t iter;
- bson_t bson = BSON_INITIALIZER;
-
- zval* data_object = ecalloc(sizeof(zval), 1);
-
- array_init_size(data_object, 1);
- add_assoc_zval(data_object, "data", data);
-
- Z_TRY_ADDREF_P(data);
-
- php_phongo_zval_to_bson(data_object, flags, &bson, NULL);
-
- if (bson_iter_init_find(&iter, &bson, "data")) {
- bson_value_copy(bson_iter_value(&iter), value);
- }
-
- zval_ptr_dtor(data_object);
- efree(data_object);
-} /* }}} */
-
-/*
- * 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.8.1/src/bson.c b/mongodb-1.8.1/src/bson.c
deleted file mode 100644
index 9312de93..00000000
--- a/mongodb-1.8.1/src/bson.c
+++ /dev/null
@@ -1,1378 +0,0 @@
-/*
- * 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.
- */
-
-#include <bson/bson.h>
-
-#include <php.h>
-#include <Zend/zend_hash.h>
-#include <Zend/zend_interfaces.h>
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php_phongo.h"
-#include "php_bson.h"
-#include "phongo_compat.h"
-#include "php_array_api.h"
-
-#define DEBUG 0
-
-#undef MONGOC_LOG_DOMAIN
-#define MONGOC_LOG_DOMAIN "PHONGO-BSON"
-
-#define PHONGO_IS_CLASS_INSTANTIATABLE(ce) \
- (!(ce->ce_flags & (ZEND_ACC_INTERFACE | ZEND_ACC_IMPLICIT_ABSTRACT_CLASS | ZEND_ACC_EXPLICIT_ABSTRACT_CLASS)))
-
-#define PHONGO_BSON_STATE_ZCHILD(state) (&((php_phongo_bson_state*) (state))->zchild)
-
-#define PHONGO_FIELD_PATH_EXPANSION 8
-
-/* Forward declarations */
-static bool php_phongo_bson_visit_document(const bson_iter_t* iter ARG_UNUSED, const char* key, const bson_t* v_document, void* data);
-static bool php_phongo_bson_visit_array(const bson_iter_t* iter ARG_UNUSED, const char* key, const bson_t* v_document, void* data);
-
-/* Path builder */
-char* php_phongo_field_path_as_string(php_phongo_field_path* field_path)
-{
- size_t length = 1; /* NULL character */
- size_t i;
- char* path;
- char* ptr;
-
- if (!field_path) {
- return estrdup("");
- }
- if (!field_path->elements) {
- return estrdup("");
- }
-
- for (i = 0; i <= field_path->size; i++) {
- if (!field_path->elements[i]) {
- continue;
- }
- length += (1 + strlen(field_path->elements[i]));
- }
-
- path = emalloc(length);
- ptr = path;
-
- for (i = 0; i <= field_path->size; i++) {
- if (!field_path->elements[i]) {
- continue;
- }
- strcpy(ptr, field_path->elements[i]);
- ptr += strlen(field_path->elements[i]);
- ptr[0] = '.';
- ptr++;
- }
- ptr[-1] = '\0';
-
- return path;
-}
-
-php_phongo_field_path* php_phongo_field_path_alloc(bool owns_elements)
-{
- php_phongo_field_path* tmp = ecalloc(1, sizeof(php_phongo_field_path));
- tmp->ref_count = 1;
- tmp->owns_elements = owns_elements;
-
- return tmp;
-}
-
-void php_phongo_field_path_free(php_phongo_field_path* field_path)
-{
- if (field_path->owns_elements) {
- size_t i;
-
- for (i = 0; i < field_path->size; i++) {
- efree(field_path->elements[i]);
- }
- }
- if (field_path->elements) {
- efree(field_path->elements);
- }
- if (field_path->element_types) {
- efree(field_path->element_types);
- }
- efree(field_path);
-}
-
-static void php_phongo_field_path_ensure_allocation(php_phongo_field_path* field_path, size_t level)
-{
- if (level >= field_path->allocated_size) {
- size_t i;
-
- field_path->allocated_size = field_path->size + PHONGO_FIELD_PATH_EXPANSION;
- field_path->elements = erealloc(field_path->elements, sizeof(char*) * field_path->allocated_size);
- field_path->element_types = erealloc(field_path->element_types, sizeof(php_phongo_bson_field_path_item_types) * field_path->allocated_size);
-
- for (i = level; i < field_path->allocated_size; i++) {
- field_path->elements[i] = NULL;
- field_path->element_types[i] = PHONGO_FIELD_PATH_ITEM_NONE;
- }
- }
-}
-
-void php_phongo_field_path_write_item_at_current_level(php_phongo_field_path* field_path, const char* element)
-{
- php_phongo_field_path_ensure_allocation(field_path, field_path->size);
-
- if (field_path->owns_elements) {
- field_path->elements[field_path->size] = estrdup(element);
- } else {
- field_path->elements[field_path->size] = (char*) element;
- }
-}
-
-void php_phongo_field_path_write_type_at_current_level(php_phongo_field_path* field_path, php_phongo_bson_field_path_item_types element_type)
-{
- php_phongo_field_path_ensure_allocation(field_path, field_path->size);
-
- field_path->element_types[field_path->size] = element_type;
-}
-
-bool php_phongo_field_path_push(php_phongo_field_path* field_path, const char* element, php_phongo_bson_field_path_item_types element_type)
-{
- php_phongo_field_path_write_item_at_current_level(field_path, element);
- php_phongo_field_path_write_type_at_current_level(field_path, element_type);
-
- field_path->size++;
-
- return true;
-}
-
-bool php_phongo_field_path_pop(php_phongo_field_path* field_path)
-{
- php_phongo_field_path_ensure_allocation(field_path, field_path->size);
-
- field_path->elements[field_path->size] = NULL;
- field_path->element_types[field_path->size] = PHONGO_FIELD_PATH_ITEM_NONE;
-
- field_path->size--;
-
- field_path->elements[field_path->size] = NULL;
- field_path->element_types[field_path->size] = PHONGO_FIELD_PATH_ITEM_NONE;
-
- return true;
-}
-
-inline static bool php_phongo_bson_state_is_initialized(php_phongo_bson_state* state)
-{
- return state->field_path != NULL;
-}
-
-void php_phongo_bson_state_ctor(php_phongo_bson_state* state)
-{
- state->field_path = php_phongo_field_path_alloc(false);
-}
-
-void php_phongo_bson_state_copy_ctor(php_phongo_bson_state* dst, php_phongo_bson_state* src)
-{
- dst->map = src->map;
- if (src->field_path) {
- src->field_path->ref_count++;
- }
- dst->field_path = src->field_path;
-}
-
-void php_phongo_bson_state_dtor(php_phongo_bson_state* state)
-{
- if (state->field_path) {
- state->field_path->ref_count--;
-
- if (state->field_path->ref_count < 1) {
- php_phongo_field_path_free(state->field_path);
- }
- state->field_path = NULL;
- }
-} /* }}} */
-
-static void php_phongo_bson_visit_corrupt(const bson_iter_t* iter ARG_UNUSED, void* data ARG_UNUSED) /* {{{ */
-{
- mongoc_log(MONGOC_LOG_LEVEL_WARNING, MONGOC_LOG_DOMAIN, "Corrupt BSON data detected!");
-} /* }}} */
-
-static 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) /* {{{ */
-{
- php_phongo_bson_state* state = (php_phongo_bson_state*) data;
- char* path_string;
-
- php_phongo_field_path_write_item_at_current_level(state->field_path, key);
- path_string = php_phongo_field_path_as_string(state->field_path);
-
- phongo_throw_exception(PHONGO_ERROR_UNEXPECTED_VALUE, "Detected unknown BSON type 0x%02hhx for field path \"%s\". Are you using the latest driver?", (unsigned char) v_type_code, path_string);
-
- efree(path_string);
-} /* }}} */
-
-static bool php_phongo_bson_visit_double(const bson_iter_t* iter ARG_UNUSED, const char* key, double v_double, void* data) /* {{{ */
-{
- zval* retval = PHONGO_BSON_STATE_ZCHILD(data);
- php_phongo_bson_state* state = (php_phongo_bson_state*) data;
-
- if (state->is_visiting_array) {
- add_next_index_double(retval, v_double);
- } else {
- add_assoc_double(retval, key, v_double);
- }
-
- php_phongo_field_path_write_item_at_current_level(state->field_path, key);
-
- return false;
-} /* }}} */
-
-static 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) /* {{{ */
-{
- zval* retval = PHONGO_BSON_STATE_ZCHILD(data);
- php_phongo_bson_state* state = (php_phongo_bson_state*) data;
-
- if (state->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);
- }
-
- php_phongo_field_path_write_item_at_current_level(state->field_path, key);
-
- return false;
-} /* }}} */
-
-static void php_phongo_bson_new_binary_from_binary_and_type(zval* object, const char* data, size_t data_len, bson_subtype_t type) /* {{{ */
-{
- 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;
-} /* }}} */
-
-static 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) /* {{{ */
-{
- zval* retval = PHONGO_BSON_STATE_ZCHILD(data);
- php_phongo_bson_state* state = (php_phongo_bson_state*) data;
-
- if (v_subtype == 0x80 && strcmp(key, PHONGO_ODM_FIELD_NAME) == 0) {
- 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);
- zend_string_release(zs_classname);
-
- if (found_ce && PHONGO_IS_CLASS_INSTANTIATABLE(found_ce) && instanceof_function(found_ce, php_phongo_persistable_ce)) {
- ((php_phongo_bson_state*) data)->odm = found_ce;
- }
- }
-
- {
- zval zchild;
-
- php_phongo_bson_new_binary_from_binary_and_type(&zchild, (const char*) v_binary, v_binary_len, v_subtype);
-
- if (state->is_visiting_array) {
- add_next_index_zval(retval, &zchild);
- } else {
- ADD_ASSOC_ZVAL(retval, key, &zchild);
- }
- }
-
- php_phongo_field_path_write_item_at_current_level(state->field_path, key);
-
- return false;
-} /* }}} */
-
-static bool php_phongo_bson_visit_undefined(const bson_iter_t* iter, const char* key, void* data) /* {{{ */
-{
- zval* retval = PHONGO_BSON_STATE_ZCHILD(data);
- php_phongo_bson_state* state = (php_phongo_bson_state*) data;
- zval zchild;
-
- object_init_ex(&zchild, php_phongo_undefined_ce);
-
- if (state->is_visiting_array) {
- add_next_index_zval(retval, &zchild);
- } else {
- ADD_ASSOC_ZVAL(retval, key, &zchild);
- }
-
- php_phongo_field_path_write_item_at_current_level(state->field_path, key);
-
- return false;
-} /* }}} */
-
-static void php_phongo_objectid_new_from_oid(zval* object, const bson_oid_t* oid) /* {{{ */
-{
- 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;
-} /* }}} */
-
-static bool php_phongo_bson_visit_oid(const bson_iter_t* iter ARG_UNUSED, const char* key, const bson_oid_t* v_oid, void* data) /* {{{ */
-{
- zval* retval = PHONGO_BSON_STATE_ZCHILD(data);
- php_phongo_bson_state* state = (php_phongo_bson_state*) data;
- zval zchild;
-
- php_phongo_objectid_new_from_oid(&zchild, v_oid);
-
- if (state->is_visiting_array) {
- add_next_index_zval(retval, &zchild);
- } else {
- ADD_ASSOC_ZVAL(retval, key, &zchild);
- }
-
- php_phongo_field_path_write_item_at_current_level(state->field_path, key);
-
- return false;
-} /* }}} */
-
-static bool php_phongo_bson_visit_bool(const bson_iter_t* iter ARG_UNUSED, const char* key, bool v_bool, void* data) /* {{{ */
-{
- zval* retval = PHONGO_BSON_STATE_ZCHILD(data);
- php_phongo_bson_state* state = (php_phongo_bson_state*) data;
-
- if (state->is_visiting_array) {
- add_next_index_bool(retval, v_bool);
- } else {
- add_assoc_bool(retval, key, v_bool);
- }
-
- php_phongo_field_path_write_item_at_current_level(state->field_path, key);
-
- return false;
-} /* }}} */
-
-static void php_phongo_bson_new_utcdatetime_from_epoch(zval* object, int64_t msec_since_epoch) /* {{{ */
-{
- 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;
-} /* }}} */
-
-static bool php_phongo_bson_visit_date_time(const bson_iter_t* iter ARG_UNUSED, const char* key, int64_t msec_since_epoch, void* data) /* {{{ */
-{
- zval* retval = PHONGO_BSON_STATE_ZCHILD(data);
- php_phongo_bson_state* state = (php_phongo_bson_state*) data;
- zval zchild;
-
- php_phongo_bson_new_utcdatetime_from_epoch(&zchild, msec_since_epoch);
-
- if (state->is_visiting_array) {
- add_next_index_zval(retval, &zchild);
- } else {
- ADD_ASSOC_ZVAL(retval, key, &zchild);
- }
-
- php_phongo_field_path_write_item_at_current_level(state->field_path, key);
-
- return false;
-} /* }}} */
-
-static void php_phongo_bson_new_decimal128(zval* object, const bson_decimal128_t* decimal) /* {{{ */
-{
- 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;
-} /* }}} */
-
-static bool php_phongo_bson_visit_decimal128(const bson_iter_t* iter ARG_UNUSED, const char* key, const bson_decimal128_t* decimal, void* data) /* {{{ */
-{
- zval* retval = PHONGO_BSON_STATE_ZCHILD(data);
- php_phongo_bson_state* state = (php_phongo_bson_state*) data;
- zval zchild;
-
- php_phongo_bson_new_decimal128(&zchild, decimal);
-
- if (state->is_visiting_array) {
- add_next_index_zval(retval, &zchild);
- } else {
- ADD_ASSOC_ZVAL(retval, key, &zchild);
- }
-
- php_phongo_field_path_write_item_at_current_level(state->field_path, key);
-
- return false;
-} /* }}} */
-
-static bool php_phongo_bson_visit_null(const bson_iter_t* iter ARG_UNUSED, const char* key, void* data) /* {{{ */
-{
- zval* retval = PHONGO_BSON_STATE_ZCHILD(data);
- php_phongo_bson_state* state = (php_phongo_bson_state*) data;
-
- if (state->is_visiting_array) {
- add_next_index_null(retval);
- } else {
- add_assoc_null(retval, key);
- }
-
- php_phongo_field_path_write_item_at_current_level(state->field_path, key);
-
- return false;
-} /* }}} */
-
-static void php_phongo_bson_new_regex_from_regex_and_options(zval* object, const char* pattern, const char* flags) /* {{{ */
-{
- 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);
-} /* }}} */
-
-static 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) /* {{{ */
-{
- zval* retval = PHONGO_BSON_STATE_ZCHILD(data);
- php_phongo_bson_state* state = (php_phongo_bson_state*) data;
- zval zchild;
-
- php_phongo_bson_new_regex_from_regex_and_options(&zchild, v_regex, v_options);
-
- if (state->is_visiting_array) {
- add_next_index_zval(retval, &zchild);
- } else {
- ADD_ASSOC_ZVAL(retval, key, &zchild);
- }
-
- php_phongo_field_path_write_item_at_current_level(state->field_path, key);
-
- return false;
-} /* }}} */
-
-static void php_phongo_bson_new_symbol(zval* object, const char* symbol, size_t symbol_len) /* {{{ */
-{
- php_phongo_symbol_t* intern;
-
- object_init_ex(object, php_phongo_symbol_ce);
-
- intern = Z_SYMBOL_OBJ_P(object);
- intern->symbol = estrndup(symbol, symbol_len);
- intern->symbol_len = symbol_len;
-} /* }}} */
-
-static bool php_phongo_bson_visit_symbol(const bson_iter_t* iter, const char* key, size_t v_symbol_len, const char* v_symbol, void* data) /* {{{ */
-{
- zval* retval = PHONGO_BSON_STATE_ZCHILD(data);
- php_phongo_bson_state* state = (php_phongo_bson_state*) data;
- zval zchild;
-
- php_phongo_bson_new_symbol(&zchild, v_symbol, v_symbol_len);
-
- if (state->is_visiting_array) {
- add_next_index_zval(retval, &zchild);
- } else {
- ADD_ASSOC_ZVAL(retval, key, &zchild);
- }
-
- php_phongo_field_path_write_item_at_current_level(state->field_path, key);
-
- return false;
-} /* }}} */
-
-static bool php_phongo_bson_new_javascript_from_javascript_and_scope(zval* object, const char* code, size_t code_len, const bson_t* scope) /* {{{ */
-{
- php_phongo_javascript_t* intern;
-
- if (scope) {
- php_phongo_bson_state state;
- bool valid_scope;
-
- PHONGO_BSON_INIT_STATE(state);
-
- valid_scope = php_phongo_bson_to_zval_ex(bson_get_data(scope), scope->len, &state);
- zval_ptr_dtor(&state.zchild);
-
- if (!valid_scope) {
- return false;
- }
- }
-
- 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;
-
- return true;
-} /* }}} */
-
-static bool php_phongo_bson_new_javascript_from_javascript(zval* object, const char* code, size_t code_len) /* {{{ */
-{
- return php_phongo_bson_new_javascript_from_javascript_and_scope(object, code, code_len, NULL);
-} /* }}} */
-
-static 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) /* {{{ */
-{
- zval* retval = PHONGO_BSON_STATE_ZCHILD(data);
- php_phongo_bson_state* state = (php_phongo_bson_state*) data;
- zval zchild;
-
- if (!php_phongo_bson_new_javascript_from_javascript(&zchild, v_code, v_code_len)) {
- return true;
- }
-
- if (state->is_visiting_array) {
- add_next_index_zval(retval, &zchild);
- } else {
- ADD_ASSOC_ZVAL(retval, key, &zchild);
- }
-
- php_phongo_field_path_write_item_at_current_level(state->field_path, key);
-
- return false;
-} /* }}} */
-
-static void php_phongo_bson_new_dbpointer(zval* object, const char* ref, size_t ref_len, const bson_oid_t* oid) /* {{{ */
-{
- php_phongo_dbpointer_t* intern;
-
- object_init_ex(object, php_phongo_dbpointer_ce);
-
- intern = Z_DBPOINTER_OBJ_P(object);
- intern->ref = estrndup(ref, ref_len);
- intern->ref_len = ref_len;
- bson_oid_to_string(oid, intern->id);
-} /* }}} */
-
-static bool php_phongo_bson_visit_dbpointer(const bson_iter_t* iter, const char* key, size_t namespace_len, const char* namespace, const bson_oid_t* oid, void* data) /* {{{ */
-{
- zval* retval = PHONGO_BSON_STATE_ZCHILD(data);
- php_phongo_bson_state* state = (php_phongo_bson_state*) data;
- zval zchild;
-
- php_phongo_bson_new_dbpointer(&zchild, namespace, namespace_len, oid);
-
- if (state->is_visiting_array) {
- add_next_index_zval(retval, &zchild);
- } else {
- ADD_ASSOC_ZVAL(retval, key, &zchild);
- }
-
- php_phongo_field_path_write_item_at_current_level(state->field_path, key);
-
- return false;
-} /* }}} */
-
-static 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) /* {{{ */
-{
- zval* retval = PHONGO_BSON_STATE_ZCHILD(data);
- php_phongo_bson_state* state = (php_phongo_bson_state*) data;
- zval zchild;
-
- if (!php_phongo_bson_new_javascript_from_javascript_and_scope(&zchild, v_code, v_code_len, v_scope)) {
- return true;
- }
-
- if (state->is_visiting_array) {
- add_next_index_zval(retval, &zchild);
- } else {
- ADD_ASSOC_ZVAL(retval, key, &zchild);
- }
-
- php_phongo_field_path_write_item_at_current_level(state->field_path, key);
-
- return false;
-} /* }}} */
-
-static bool php_phongo_bson_visit_int32(const bson_iter_t* iter ARG_UNUSED, const char* key, int32_t v_int32, void* data) /* {{{ */
-{
- zval* retval = PHONGO_BSON_STATE_ZCHILD(data);
- php_phongo_bson_state* state = (php_phongo_bson_state*) data;
-
- if (state->is_visiting_array) {
- add_next_index_long(retval, v_int32);
- } else {
- add_assoc_long(retval, key, v_int32);
- }
-
- php_phongo_field_path_write_item_at_current_level(state->field_path, key);
-
- return false;
-} /* }}} */
-
-static 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) /* {{{ */
-{
- zval* retval = PHONGO_BSON_STATE_ZCHILD(data);
- php_phongo_bson_state* state = (php_phongo_bson_state*) data;
- zval zchild;
-
- php_phongo_bson_new_timestamp_from_increment_and_timestamp(&zchild, v_increment, v_timestamp);
-
- if (state->is_visiting_array) {
- add_next_index_zval(retval, &zchild);
- } else {
- ADD_ASSOC_ZVAL(retval, key, &zchild);
- }
-
- php_phongo_field_path_write_item_at_current_level(state->field_path, key);
-
- return false;
-} /* }}} */
-
-static bool php_phongo_bson_visit_int64(const bson_iter_t* iter ARG_UNUSED, const char* key, int64_t v_int64, void* data) /* {{{ */
-{
- zval* retval = PHONGO_BSON_STATE_ZCHILD(data);
- php_phongo_bson_state* state = (php_phongo_bson_state*) data;
-
- php_phongo_field_path_write_item_at_current_level(state->field_path, key);
-
- if (state->is_visiting_array) {
- ADD_NEXT_INDEX_INT64(retval, v_int64);
- } else {
- ADD_ASSOC_INT64(retval, key, v_int64);
- }
-
- return false;
-} /* }}} */
-
-static bool php_phongo_bson_visit_maxkey(const bson_iter_t* iter ARG_UNUSED, const char* key, void* data) /* {{{ */
-{
- zval* retval = PHONGO_BSON_STATE_ZCHILD(data);
- php_phongo_bson_state* state = (php_phongo_bson_state*) data;
- zval zchild;
-
- object_init_ex(&zchild, php_phongo_maxkey_ce);
-
- if (state->is_visiting_array) {
- add_next_index_zval(retval, &zchild);
- } else {
- ADD_ASSOC_ZVAL(retval, key, &zchild);
- }
-
- php_phongo_field_path_write_item_at_current_level(state->field_path, key);
-
- return false;
-} /* }}} */
-
-static bool php_phongo_bson_visit_minkey(const bson_iter_t* iter ARG_UNUSED, const char* key, void* data) /* {{{ */
-{
- zval* retval = PHONGO_BSON_STATE_ZCHILD(data);
- php_phongo_bson_state* state = (php_phongo_bson_state*) data;
- zval zchild;
-
- object_init_ex(&zchild, php_phongo_minkey_ce);
-
- if (state->is_visiting_array) {
- add_next_index_zval(retval, &zchild);
- } else {
- ADD_ASSOC_ZVAL(retval, key, &zchild);
- }
-
- php_phongo_field_path_write_item_at_current_level(state->field_path, key);
-
- 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,
- 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,
- php_phongo_bson_visit_dbpointer,
- php_phongo_bson_visit_code,
- 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 }
-};
-
-static inline bool map_element_matches_field_path(php_phongo_field_path_map_element* map_element, php_phongo_field_path* current)
-{
- size_t i;
-
- if (map_element->entry->size != current->size) {
- return false;
- }
- for (i = 0; i < current->size; i++) {
- if (strcmp(map_element->entry->elements[i], "$") == 0) {
- continue;
- }
- if (strcmp(map_element->entry->elements[i], current->elements[i]) != 0) {
- return false;
- }
- }
- return true;
-}
-
-static php_phongo_field_path_map_element* map_find_field_path_entry(php_phongo_bson_state* state)
-{
- size_t i;
-
- /* Loop over all field path mappings, and for each, try to see whether it matches the current path */
- for (i = 0; i < state->map.field_paths.size; i++) {
- if (map_element_matches_field_path(state->map.field_paths.map[i], state->field_path)) {
- return state->map.field_paths.map[i];
- }
- }
- return NULL;
-}
-
-static void php_phongo_handle_field_path_entry_for_compound_type(php_phongo_bson_state* state, php_phongo_bson_typemap_types* type, zend_class_entry** ce)
-{
- php_phongo_field_path_map_element* entry = map_find_field_path_entry(state);
-
- if (entry) {
- switch (entry->node_type) {
- case PHONGO_TYPEMAP_NATIVE_ARRAY:
- case PHONGO_TYPEMAP_NATIVE_OBJECT:
- *type = entry->node_type;
- break;
- case PHONGO_TYPEMAP_CLASS:
- *type = entry->node_type;
- *ce = entry->node_ce;
- break;
- default:
- /* Do nothing - pacify compiler */
- break;
- }
- }
-}
-
-static bool php_phongo_bson_visit_document(const bson_iter_t* iter ARG_UNUSED, const char* key, const bson_t* v_document, void* data) /* {{{ */
-{
- zval* retval = PHONGO_BSON_STATE_ZCHILD(data);
- bson_iter_t child;
- php_phongo_bson_state* parent_state = (php_phongo_bson_state*) data;
-
- php_phongo_field_path_push(parent_state->field_path, key, PHONGO_FIELD_PATH_ITEM_DOCUMENT);
-
- if (bson_iter_init(&child, v_document)) {
- php_phongo_bson_state state;
-
- PHONGO_BSON_INIT_STATE(state);
- php_phongo_bson_state_copy_ctor(&state, parent_state);
-
- array_init(&state.zchild);
-
- if (!bson_iter_visit_all(&child, &php_bson_visitors, &state) && !child.err_off) {
- /* Check for entries in the fieldPath type map key, and use them to
- * override the default ones for this type */
- php_phongo_handle_field_path_entry_for_compound_type(&state, &state.map.document_type, &state.map.document);
-
- /* 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_phongo_bson_state*) data)->is_visiting_array) {
- add_next_index_zval(retval, &state.zchild);
- } else {
- ADD_ASSOC_ZVAL(retval, key, &state.zchild);
- }
- break;
-
- case PHONGO_TYPEMAP_CLASS: {
- 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);
- break;
- }
-
- case PHONGO_TYPEMAP_NATIVE_OBJECT:
- default:
- convert_to_object(&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);
- }
- }
- } 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);
- php_phongo_bson_state_dtor(&state);
- return true;
- }
-
- php_phongo_bson_state_dtor(&state);
- php_phongo_field_path_pop(parent_state->field_path);
- }
-
- return false;
-} /* }}} */
-
-static bool php_phongo_bson_visit_array(const bson_iter_t* iter ARG_UNUSED, const char* key, const bson_t* v_array, void* data) /* {{{ */
-{
- zval* retval = PHONGO_BSON_STATE_ZCHILD(data);
- bson_iter_t child;
- php_phongo_bson_state* parent_state = (php_phongo_bson_state*) data;
-
- php_phongo_field_path_push(parent_state->field_path, key, PHONGO_FIELD_PATH_ITEM_ARRAY);
-
- if (bson_iter_init(&child, v_array)) {
- php_phongo_bson_state state;
-
- PHONGO_BSON_INIT_STATE(state);
- php_phongo_bson_state_copy_ctor(&state, parent_state);
-
- /* 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;
-
- array_init(&state.zchild);
-
- if (!bson_iter_visit_all(&child, &php_bson_visitors, &state) && !child.err_off) {
- /* Check for entries in the fieldPath type map key, and use them to
- * override the default ones for this type */
- php_phongo_handle_field_path_entry_for_compound_type(&state, &state.map.array_type, &state.map.array);
-
- switch (state.map.array_type) {
- case PHONGO_TYPEMAP_CLASS: {
- 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);
- break;
- }
-
- case PHONGO_TYPEMAP_NATIVE_OBJECT:
- convert_to_object(&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);
- }
- break;
-
- case PHONGO_TYPEMAP_NATIVE_ARRAY:
- default:
- if (((php_phongo_bson_state*) data)->is_visiting_array) {
- add_next_index_zval(retval, &state.zchild);
- } else {
- ADD_ASSOC_ZVAL(retval, key, &state.zchild);
- }
- 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);
- php_phongo_bson_state_dtor(&state);
- return true;
- }
-
- php_phongo_bson_state_dtor(&state);
- php_phongo_field_path_pop(parent_state->field_path);
- }
-
- return false;
-} /* }}} */
-
-/* Converts a BSON document to a PHP value using the default typemap. */
-bool php_phongo_bson_to_zval(const unsigned char* data, int data_len, zval* zv) /* {{{ */
-{
- bool retval;
- php_phongo_bson_state state;
-
- PHONGO_BSON_INIT_STATE(state);
-
- retval = php_phongo_bson_to_zval_ex(data, data_len, &state);
- ZVAL_ZVAL(zv, &state.zchild, 1, 1);
-
- return retval;
-} /* }}} */
-
-/* Converts a BSON value to a ZVAL. */
-bool php_phongo_bson_value_to_zval(const bson_value_t* value, zval* zv) /* {{{ */
-{
- bson_t bson = BSON_INITIALIZER;
- php_phongo_bson_state state;
- zval* return_value;
- bool retval = false;
-
- PHONGO_BSON_INIT_STATE(state);
- state.map.root_type = PHONGO_TYPEMAP_NATIVE_ARRAY;
-
- bson_append_value(&bson, "data", 4, value);
- if (!php_phongo_bson_to_zval_ex(bson_get_data(&bson), bson.len, &state)) {
- /* Exception already thrown */
- goto cleanup;
- }
-
- retval = true;
-
- return_value = php_array_fetchc(&state.zchild, "data");
-
- if (return_value) {
- ZVAL_ZVAL(zv, return_value, 1, 0);
- }
-
-cleanup:
- zval_ptr_dtor(&state.zchild);
- return retval;
-} /* }}} */
-
-/* Converts a BSON document to a PHP value according to the typemap specified in
- * the state argument.
- *
- * On success, the result will be set on the state argument and true will be
- * returned. On error, an exception will have been thrown and false will be
- * returned.
- *
- * Note: the result zval in the state argument will always be initialized for
- * PHP 5.x so that the caller may always zval_ptr_dtor() it. The zval is left
- * as-is on PHP 7; however, it should have the type undefined if the state
- * was initialized to zero.
- */
-bool php_phongo_bson_to_zval_ex(const unsigned char* data, int data_len, php_phongo_bson_state* state) /* {{{ */
-{
- bson_reader_t* reader = NULL;
- bson_iter_t iter;
- const bson_t* b;
- bool eof = false;
- bool retval = false;
- bool must_dtor_state = false;
-
- if (!php_phongo_bson_state_is_initialized(state)) {
- php_phongo_bson_state_ctor(state);
- must_dtor_state = true;
- }
-
- reader = bson_reader_new_from_data(data, data_len);
-
- if (!(b = bson_reader_read(reader, NULL))) {
- phongo_throw_exception(PHONGO_ERROR_UNEXPECTED_VALUE, "Could not read document from BSON reader");
-
- goto cleanup;
- }
-
- if (!bson_iter_init(&iter, b)) {
- phongo_throw_exception(PHONGO_ERROR_UNEXPECTED_VALUE, "Could not initialize BSON iterator");
-
- goto cleanup;
- }
-
- /* 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). */
- array_init(&state->zchild);
-
- 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)) {
- char* path = php_phongo_field_path_as_string(state->field_path);
- phongo_throw_exception(PHONGO_ERROR_UNEXPECTED_VALUE, "Detected corrupt BSON data for field path '%s' at offset %d", path, iter.err_off);
- efree(path);
- }
-
- goto cleanup;
- }
-
- /* 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: {
- 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);
-
- break;
- }
-
- case PHONGO_TYPEMAP_NATIVE_OBJECT:
- default:
- convert_to_object(&state->zchild);
- }
-
- if (bson_reader_read(reader, &eof) || !eof) {
- phongo_throw_exception(PHONGO_ERROR_UNEXPECTED_VALUE, "Reading document did not exhaust input buffer");
-
- goto cleanup;
- }
-
- retval = true;
-
-cleanup:
- if (reader) {
- bson_reader_destroy(reader);
- }
- if (must_dtor_state) {
- php_phongo_bson_state_dtor(state);
- }
-
- return retval;
-} /* }}} */
-
-/* Fetches a zend_class_entry for the given class name and checks that it is
- * also instantiatable and implements a specified interface. Returns the class
- * on success; otherwise, NULL is returned and an exception is thrown. */
-static zend_class_entry* php_phongo_bson_state_fetch_class(const char* classname, int classname_len, zend_class_entry* interface_ce) /* {{{ */
-{
- 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);
- zend_string_release(zs_classname);
-
- if (!found_ce) {
- phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Class %s does not exist", classname);
- } else if (!PHONGO_IS_CLASS_INSTANTIATABLE(found_ce)) {
- phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Class %s is not instantiatable", classname);
- } else if (!instanceof_function(found_ce, interface_ce)) {
- phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Class %s does not implement %s", classname, ZSTR_VAL(interface_ce->name));
- } else {
- return found_ce;
- }
-
- return NULL;
-} /* }}} */
-
-/* Parses a BSON type (i.e. array, document, or root). On success, the type and
- * type_ce output arguments will be assigned and true will be returned;
- * otherwise, false is returned and an exception is thrown. */
-static bool php_phongo_bson_state_parse_type(zval* options, const char* name, php_phongo_bson_typemap_types* type, zend_class_entry** type_ce) /* {{{ */
-{
- char* classname;
- int classname_len;
- zend_bool classname_free = 0;
- bool retval = true;
-
- classname = php_array_fetch_string(options, name, &classname_len, &classname_free);
-
- if (!classname_len) {
- goto cleanup;
- }
-
- 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 ((*type_ce = php_phongo_bson_state_fetch_class(classname, classname_len, php_phongo_unserializable_ce))) {
- *type = PHONGO_TYPEMAP_CLASS;
- } else {
- retval = false;
- }
- }
-
-cleanup:
- if (classname_free) {
- efree(classname);
- }
-
- return retval;
-} /* }}} */
-
-static void field_path_map_element_set_info(php_phongo_field_path_map_element* element, php_phongo_bson_typemap_types type, zend_class_entry* ce)
-{
- element->node_type = type;
- element->node_ce = ce;
-}
-
-static void map_add_field_path_element(php_phongo_bson_typemap* map, php_phongo_field_path_map_element* element)
-{
- /* Make sure we have allocated enough */
- if (map->field_paths.allocated_size < map->field_paths.size + 1) {
- map->field_paths.allocated_size += PHONGO_FIELD_PATH_EXPANSION;
- map->field_paths.map = erealloc(map->field_paths.map, sizeof(php_phongo_field_path_map_element) * map->field_paths.allocated_size);
- }
-
- map->field_paths.map[map->field_paths.size] = element;
- map->field_paths.size++;
-}
-
-static php_phongo_field_path_map_element* field_path_map_element_alloc(void)
-{
- php_phongo_field_path_map_element* tmp = ecalloc(1, sizeof(php_phongo_field_path_map_element));
-
- tmp->entry = php_phongo_field_path_alloc(true);
-
- return tmp;
-}
-
-static void field_path_map_element_dtor(php_phongo_field_path_map_element* element)
-{
- php_phongo_field_path_free(element->entry);
- efree(element);
-}
-
-bool php_phongo_bson_state_add_field_path(php_phongo_bson_typemap* map, char* field_path_original, php_phongo_bson_typemap_types type, zend_class_entry* ce)
-{
- char* ptr = NULL;
- char* segment_end = NULL;
- php_phongo_field_path_map_element* field_path_map_element;
-
- if (field_path_original[0] == '.') {
- phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "A 'fieldPaths' key may not start with a '.'");
- return false;
- }
-
- if (field_path_original[strlen(field_path_original) - 1] == '.') {
- phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "A 'fieldPaths' key may not end with a '.'");
- return false;
- }
-
- field_path_map_element = field_path_map_element_alloc();
- ptr = field_path_original;
-
- /* Loop over all the segments. A segment is delimited by a "." */
- while ((segment_end = strchr(ptr, '.')) != NULL) {
- char* tmp = NULL;
-
- /* Bail out if we have an empty segment */
- if (ptr == segment_end) {
- field_path_map_element_dtor(field_path_map_element);
- phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "A 'fieldPaths' key may not have an empty segment");
- return false;
- }
-
- tmp = calloc(1, segment_end - ptr + 1);
- memcpy(tmp, ptr, segment_end - ptr);
- php_phongo_field_path_push(field_path_map_element->entry, tmp, PHONGO_FIELD_PATH_ITEM_NONE);
- free(tmp);
-
- ptr = segment_end + 1;
- }
-
- /* Add the last (or single) element */
- php_phongo_field_path_push(field_path_map_element->entry, ptr, PHONGO_FIELD_PATH_ITEM_NONE);
-
- field_path_map_element_set_info(field_path_map_element, type, ce);
- map_add_field_path_element(map, field_path_map_element);
-
- return true;
-}
-
-void php_phongo_bson_typemap_dtor(php_phongo_bson_typemap* map)
-{
- size_t i;
-
- if (map->field_paths.map) {
- for (i = 0; i < map->field_paths.size; i++) {
- field_path_map_element_dtor(map->field_paths.map[i]);
- }
- efree(map->field_paths.map);
- }
-
- map->field_paths.map = NULL;
-}
-
-/* Loops over each element in the fieldPaths array (if exists, and is an
- * array), and then checks whether each element is a valid type mapping */
-bool php_phongo_bson_state_parse_fieldpaths(zval* typemap, php_phongo_bson_typemap* map) /* {{{ */
-{
- zval* fieldpaths = NULL;
- HashTable* ht_data;
-
- if (!php_array_existsc(typemap, "fieldPaths")) {
- return true;
- }
-
- fieldpaths = php_array_fetchc_array(typemap, "fieldPaths");
-
- if (!fieldpaths) {
- phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "The 'fieldPaths' element is not an array");
- return false;
- }
-
- ht_data = HASH_OF(fieldpaths);
-
- {
- zend_string* string_key = NULL;
- zend_ulong num_key = 0;
- zval* property;
-
- ZEND_HASH_FOREACH_KEY_VAL(ht_data, num_key, string_key, property)
- {
- zend_class_entry* map_ce = NULL;
- php_phongo_bson_typemap_types map_type;
-
- if (!string_key) {
- phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "The 'fieldPaths' element is not an associative array");
- return false;
- }
-
- if (strcmp(ZSTR_VAL(string_key), "") == 0) {
- phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "The 'fieldPaths' element may not be an empty string");
- return false;
- }
-
- if (!php_phongo_bson_state_parse_type(fieldpaths, ZSTR_VAL(string_key), &map_type, &map_ce)) {
- return false;
- }
-
- if (!php_phongo_bson_state_add_field_path(map, ZSTR_VAL(string_key), map_type, map_ce)) {
- return false;
- }
- }
- ZEND_HASH_FOREACH_END();
- }
-
- return true;
-} /* }}} */
-
-#if DEBUG
-static void print_node_info(php_phongo_field_path_node* ptr, int level)
-{
- printf("%*sNAME: %s\n", level * 4, "", ptr->name);
- printf("%*s- type:", level * 4, "");
- switch (ptr->node_type) {
- case PHONGO_TYPEMAP_NONE:
- printf(" none (unset)\n");
- break;
- case PHONGO_TYPEMAP_CLASS:
- printf(" class (%s)\n", ZSTR_VAL(ptr->node_ce->name));
- break;
- case PHONGO_TYPEMAP_NATIVE_ARRAY:
- printf(" array\n");
- break;
- case PHONGO_TYPEMAP_NATIVE_OBJECT:
- printf(" stdClass\n");
- break;
- }
-}
-
-static void print_map_list(php_phongo_field_path_node* node, int level)
-{
- php_phongo_field_path_node* ptr = node->children;
-
- if (!ptr) {
- return;
- }
-
- do {
- print_node_info(ptr, level);
- if (ptr->children) {
- printf("%*s- children:\n", level * 4, "");
- print_map_list(ptr, level + 1);
- }
- ptr = ptr->next;
- } while (ptr);
-}
-#endif
-
-/* Applies the array argument to a typemap struct. Returns true on success;
- * otherwise, false is returned an an exception is thrown. */
-bool php_phongo_bson_typemap_to_state(zval* typemap, php_phongo_bson_typemap* map) /* {{{ */
-{
- if (!typemap) {
- return true;
- }
-
- if (!php_phongo_bson_state_parse_type(typemap, "array", &map->array_type, &map->array) ||
- !php_phongo_bson_state_parse_type(typemap, "document", &map->document_type, &map->document) ||
- !php_phongo_bson_state_parse_type(typemap, "root", &map->root_type, &map->root) ||
- !php_phongo_bson_state_parse_fieldpaths(typemap, map)) {
-
- /* Exception should already have been thrown */
- return false;
- }
-#if DEBUG
- print_map_list(&map->field_path_map, 0);
-#endif
- return true;
-} /* }}} */
-
-void php_phongo_bson_new_timestamp_from_increment_and_timestamp(zval* object, uint32_t increment, uint32_t timestamp) /* {{{ */
-{
- 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_bson_new_int64(zval* object, int64_t integer) /* {{{ */
-{
- php_phongo_int64_t* intern;
-
- object_init_ex(object, php_phongo_int64_ce);
-
- intern = Z_INT64_OBJ_P(object);
- intern->integer = integer;
- intern->initialized = true;
-} /* }}} */
-
-/*
- * 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.8.1/src/libmongoc/src/libbson/src/bson/bson-version.h b/mongodb-1.8.1/src/libmongoc/src/libbson/src/bson/bson-version.h
deleted file mode 100644
index 1a986ff7..00000000
--- a/mongodb-1.8.1/src/libmongoc/src/libbson/src/bson/bson-version.h
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * 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/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 (17)
-
-
-/**
- * BSON_MICRO_VERSION:
- *
- * BSON micro version component (e.g. 3 if %BSON_VERSION is 1.2.3)
- */
-#define BSON_MICRO_VERSION (0)
-
-
-/**
- * BSON_PRERELEASE_VERSION:
- *
- * BSON prerelease version component (e.g. pre if %BSON_VERSION is 1.2.3-pre)
- */
-#define BSON_PRERELEASE_VERSION ()
-
-/**
- * BSON_VERSION:
- *
- * BSON version.
- */
-#define BSON_VERSION (1.17.0)
-
-
-/**
- * BSON_VERSION_S:
- *
- * BSON version, encoded as a string, useful for printing and
- * concatenation.
- */
-#define BSON_VERSION_S "1.17.0"
-
-
-/**
- * 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.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-client-private.h b/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-client-private.h
deleted file mode 100644
index b77ca610..00000000
--- a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-client-private.h
+++ /dev/null
@@ -1,246 +0,0 @@
-/*
- * 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-prelude.h"
-
-#ifndef MONGOC_CLIENT_PRIVATE_H
-#define MONGOC_CLIENT_PRIVATE_H
-
-#include <bson/bson.h>
-
-#include "mongoc-apm-private.h"
-#include "mongoc-buffer-private.h"
-#include "mongoc-client.h"
-#include "mongoc-cluster-private.h"
-#include "mongoc-config.h"
-#include "mongoc-host-list.h"
-#include "mongoc-read-prefs.h"
-#include "mongoc-rpc-private.h"
-#include "mongoc-opcode.h"
-#ifdef MONGOC_ENABLE_SSL
-#include "mongoc-ssl.h"
-#endif
-
-#include "mongoc-stream.h"
-#include "mongoc-topology-private.h"
-#include "mongoc-write-concern.h"
-#include "mongoc-crypt-private.h"
-
-BSON_BEGIN_DECLS
-
-/* protocol versions this driver can speak */
-#define WIRE_VERSION_MIN 3
-#define WIRE_VERSION_MAX 9
-
-/* first version that supported "find" and "getMore" commands */
-#define WIRE_VERSION_FIND_CMD 4
-/* first version with "killCursors" command */
-#define WIRE_VERSION_KILLCURSORS_CMD 4
-/* first version when findAndModify accepts writeConcern */
-#define WIRE_VERSION_FAM_WRITE_CONCERN 4
-/* first version to support readConcern */
-#define WIRE_VERSION_READ_CONCERN 4
-/* first version to support maxStalenessSeconds */
-#define WIRE_VERSION_MAX_STALENESS 5
-/* first version to support writeConcern */
-#define WIRE_VERSION_CMD_WRITE_CONCERN 5
-/* first version to support collation */
-#define WIRE_VERSION_COLLATION 5
-/* first version to support server-side errors for unsupported hint options */
-#define WIRE_VERSION_HINT_SERVER_SIDE_ERROR 5
-/* first version to support OP_MSG */
-#define WIRE_VERSION_OP_MSG 6
-/* first version to support array filters for "update" command */
-#define WIRE_VERSION_ARRAY_FILTERS 6
-/* first version to support retryable reads */
-#define WIRE_VERSION_RETRY_READS 6
-/* first version to support retryable writes */
-#define WIRE_VERSION_RETRY_WRITES 6
-/* version corresponding to server 4.0 release */
-#define WIRE_VERSION_4_0 7
-/* first version to support hint for "update" command */
-#define WIRE_VERSION_UPDATE_HINT 8
-/* version corresponding to server 4.2 release */
-#define WIRE_VERSION_4_2 8
-/* version corresponding to client side field level encryption support. */
-#define WIRE_VERSION_CSE 8
-/* first version to throw server-side errors for unsupported hint in
- * "findAndModify" command */
-#define WIRE_VERSION_FIND_AND_MODIFY_HINT_SERVER_SIDE_ERROR 8
-/* first version to support hint for "delete" command */
-#define WIRE_VERSION_DELETE_HINT 9
-/* first version to support hint for "findAndModify" command */
-#define WIRE_VERSION_FIND_AND_MODIFY_HINT 9
-/* version corresponding to server 4.4 release */
-#define WIRE_VERSION_4_4 9
-/* version corresponding to retryable writes error label */
-#define WIRE_VERSION_RETRYABLE_WRITE_ERROR_LABEL 9
-/* first version to support server hedged reads */
-#define WIRE_VERSION_HEDGED_READS 9
-
-struct _mongoc_collection_t;
-
-struct _mongoc_client_t {
- mongoc_uri_t *uri;
- mongoc_cluster_t cluster;
- bool in_exhaust;
-
- mongoc_stream_initiator_t initiator;
- void *initiator_data;
-
-#ifdef MONGOC_ENABLE_SSL
- bool use_ssl;
- mongoc_ssl_opt_t ssl_opts;
-#endif
-
- mongoc_topology_t *topology;
-
- mongoc_read_prefs_t *read_prefs;
- mongoc_read_concern_t *read_concern;
- mongoc_write_concern_t *write_concern;
-
- mongoc_apm_callbacks_t apm_callbacks;
- void *apm_context;
-
- int32_t error_api_version;
- bool error_api_set;
-
- /* mongoc_client_session_t's in use, to look up lsids and clusterTimes */
- mongoc_set_t *client_sessions;
- unsigned int csid_rand_seed;
-
- uint32_t generation;
-};
-
-/* Defines whether _mongoc_client_command_with_opts() is acting as a read
- * command helper for a command like "distinct", or a write command helper for
- * a command like "createRole", or both, like "aggregate" with "$out".
- */
-typedef enum {
- MONGOC_CMD_RAW = 0,
- MONGOC_CMD_READ = 1,
- MONGOC_CMD_WRITE = 2,
- MONGOC_CMD_RW = 3,
-} mongoc_command_mode_t;
-
-BSON_STATIC_ASSERT2 (mongoc_cmd_rw,
- MONGOC_CMD_RW == (MONGOC_CMD_READ | MONGOC_CMD_WRITE));
-
-typedef enum { MONGOC_RR_SRV, MONGOC_RR_TXT } mongoc_rr_type_t;
-
-typedef struct _mongoc_rr_data_t {
- /* Number of records returned by DNS. */
- uint32_t count;
-
- /* Set to lowest TTL found when polling SRV records. */
- uint32_t min_ttl;
-
- /* Set to the resulting host list when polling SRV records */
- mongoc_host_list_t *hosts;
-
- /* Set to the TXT record when polling for TXT */
- char *txt_record_opts;
-} mongoc_rr_data_t;
-
-bool
-_mongoc_client_get_rr (const char *service,
- mongoc_rr_type_t rr_type,
- mongoc_rr_data_t *rr_data,
- bson_error_t *error);
-
-mongoc_client_t *
-_mongoc_client_new_from_uri (mongoc_topology_t *topology);
-
-bool
-_mongoc_client_set_apm_callbacks_private (mongoc_client_t *client,
- mongoc_apm_callbacks_t *callbacks,
- void *context);
-
-mongoc_stream_t *
-mongoc_client_default_stream_initiator (const mongoc_uri_t *uri,
- const mongoc_host_list_t *host,
- void *user_data,
- bson_error_t *error);
-
-mongoc_stream_t *
-_mongoc_client_create_stream (mongoc_client_t *client,
- const mongoc_host_list_t *host,
- bson_error_t *error);
-
-bool
-_mongoc_client_recv (mongoc_client_t *client,
- mongoc_rpc_t *rpc,
- mongoc_buffer_t *buffer,
- mongoc_server_stream_t *server_stream,
- bson_error_t *error);
-
-void
-_mongoc_client_kill_cursor (mongoc_client_t *client,
- uint32_t server_id,
- int64_t cursor_id,
- int64_t operation_id,
- const char *db,
- const char *collection,
- mongoc_client_session_t *cs);
-bool
-_mongoc_client_command_with_opts (mongoc_client_t *client,
- const char *db_name,
- const bson_t *command,
- mongoc_command_mode_t mode,
- const bson_t *opts,
- mongoc_query_flags_t flags,
- const mongoc_read_prefs_t *user_prefs,
- const mongoc_read_prefs_t *default_prefs,
- mongoc_read_concern_t *default_rc,
- mongoc_write_concern_t *default_wc,
- bson_t *reply,
- bson_error_t *error);
-
-mongoc_server_session_t *
-_mongoc_client_pop_server_session (mongoc_client_t *client,
- bson_error_t *error);
-
-bool
-_mongoc_client_lookup_session (const mongoc_client_t *client,
- uint32_t client_session_id,
- mongoc_client_session_t **cs,
- bson_error_t *error);
-
-void
-_mongoc_client_unregister_session (mongoc_client_t *client,
- mongoc_client_session_t *session);
-
-void
-_mongoc_client_push_server_session (mongoc_client_t *client,
- mongoc_server_session_t *server_session);
-void
-_mongoc_client_end_sessions (mongoc_client_t *client);
-
-mongoc_stream_t *
-mongoc_client_connect_tcp (int32_t connecttimeoutms,
- const mongoc_host_list_t *host,
- bson_error_t *error);
-
-mongoc_stream_t *
-mongoc_client_connect (bool buffered,
- bool use_ssl,
- void *ssl_opts_void,
- const mongoc_uri_t *uri,
- const mongoc_host_list_t *host,
- bson_error_t *error);
-BSON_END_DECLS
-
-#endif /* MONGOC_CLIENT_PRIVATE_H */
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-client.c b/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-client.c
deleted file mode 100644
index 4b172489..00000000
--- a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-client.c
+++ /dev/null
@@ -1,3080 +0,0 @@
-/*
- * 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 <bson/bson.h>
-#include "mongoc-config.h"
-#ifdef MONGOC_HAVE_DNSAPI
-/* for DnsQuery_UTF8 */
-#include <Windows.h>
-#include <WinDNS.h>
-#include <ws2tcpip.h>
-#else
-#if defined(MONGOC_HAVE_RES_NSEARCH) || defined(MONGOC_HAVE_RES_SEARCH)
-#include <netdb.h>
-#include <netinet/tcp.h>
-#include <arpa/nameser.h>
-#include <resolv.h>
-#define BSON_INSIDE
-#include <bson/bson-string.h>
-#undef BSON_INSIDE
-
-#endif
-#endif
-
-#include "mongoc-client-private.h"
-#include "mongoc-client-side-encryption-private.h"
-#include "mongoc-collection-private.h"
-#include "mongoc-counters-private.h"
-#include "mongoc-database-private.h"
-#include "mongoc-gridfs-private.h"
-#include "mongoc-error.h"
-#include "mongoc-error-private.h"
-#include "mongoc-log.h"
-#include "mongoc-queue-private.h"
-#include "mongoc-socket.h"
-#include "mongoc-stream-buffered.h"
-#include "mongoc-stream-socket.h"
-#include "mongoc-thread-private.h"
-#include "mongoc-trace-private.h"
-#include "mongoc-uri-private.h"
-#include "mongoc-util-private.h"
-#include "mongoc-set-private.h"
-#include "mongoc-log.h"
-#include "mongoc-write-concern-private.h"
-#include "mongoc-read-concern-private.h"
-#include "mongoc-host-list-private.h"
-#include "mongoc-read-prefs-private.h"
-#include "mongoc-change-stream-private.h"
-#include "mongoc-client-session-private.h"
-#include "mongoc-cursor-private.h"
-
-#ifdef MONGOC_ENABLE_SSL
-#include "mongoc-stream-tls.h"
-#include "mongoc-ssl-private.h"
-#include "mongoc-cmd-private.h"
-#include "mongoc-opts-private.h"
-#endif
-
-
-#undef MONGOC_LOG_DOMAIN
-#define MONGOC_LOG_DOMAIN "client"
-
-
-static void
-_mongoc_client_op_killcursors (mongoc_cluster_t *cluster,
- mongoc_server_stream_t *server_stream,
- int64_t cursor_id,
- int64_t operation_id,
- const char *db,
- const char *collection);
-
-static void
-_mongoc_client_killcursors_command (mongoc_cluster_t *cluster,
- mongoc_server_stream_t *server_stream,
- int64_t cursor_id,
- const char *db,
- const char *collection,
- mongoc_client_session_t *cs);
-
-#define DNS_ERROR(_msg, ...) \
- do { \
- bson_set_error (error, \
- MONGOC_ERROR_STREAM, \
- MONGOC_ERROR_STREAM_NAME_RESOLUTION, \
- _msg, \
- __VA_ARGS__); \
- GOTO (done); \
- } while (0)
-
-
-#ifdef MONGOC_HAVE_DNSAPI
-
-typedef bool (*mongoc_rr_callback_t) (const char *service,
- PDNS_RECORD pdns,
- mongoc_rr_data_t *rr_data,
- bson_error_t *error);
-
-static bool
-srv_callback (const char *service,
- PDNS_RECORD pdns,
- mongoc_rr_data_t *rr_data,
- bson_error_t *error)
-{
- mongoc_host_list_t new_host;
-
- if (rr_data && rr_data->hosts) {
- _mongoc_host_list_remove_host (
- &(rr_data->hosts), pdns->Data.SRV.pNameTarget, pdns->Data.SRV.wPort);
- }
-
- if (!_mongoc_host_list_from_hostport_with_err (
- &new_host, pdns->Data.SRV.pNameTarget, pdns->Data.SRV.wPort, error)) {
- return false;
- }
- _mongoc_host_list_upsert (&rr_data->hosts, &new_host);
-
- return true;
-}
-
-/* rr_data is unused, but here to match srv_callback signature */
-static bool
-txt_callback (const char *service,
- PDNS_RECORD pdns,
- mongoc_rr_data_t *rr_data,
- bson_error_t *error)
-{
- DWORD i;
- bson_string_t *txt;
-
- txt = bson_string_new (NULL);
-
- for (i = 0; i < pdns->Data.TXT.dwStringCount; i++) {
- bson_string_append (txt, pdns->Data.TXT.pStringArray[i]);
- }
-
- rr_data->txt_record_opts = bson_strdup (txt->str);
- bson_string_free (txt, true);
-
- return true;
-}
-
-/*
- *--------------------------------------------------------------------------
- *
- * _mongoc_get_rr_dnsapi --
- *
- * Fetch SRV or TXT resource records using the Windows DNS API and
- * put results in @rr_data.
- *
- * Returns:
- * Success or failure.
- *
- * For an SRV lookup, returns false if there is any error.
- *
- * For TXT lookup, ignores any error fetching the resource record and
- * always returns true.
- *
- * Side effects:
- * @error is set if there is a failure.
- * @rr_data->hosts may be set if querying SRV. Caller must destroy.
- * @rr_data->txt_record_opts may be set if querying TXT. Caller must
- * free.
- *
- *--------------------------------------------------------------------------
- */
-
-static bool
-_mongoc_get_rr_dnsapi (const char *service,
- mongoc_rr_type_t rr_type,
- mongoc_rr_data_t *rr_data,
- bson_error_t *error)
-{
- const char *rr_type_name;
- WORD nst;
- mongoc_rr_callback_t callback;
- PDNS_RECORD pdns = NULL;
- DNS_STATUS res;
- LPVOID lpMsgBuf = NULL;
- bool dns_success;
- bool callback_success = true;
- int i;
-
- ENTRY;
-
- if (rr_type == MONGOC_RR_SRV) {
- /* return true only if DNS succeeds */
- dns_success = false;
- rr_type_name = "SRV";
- nst = DNS_TYPE_SRV;
- callback = srv_callback;
- } else {
- /* return true whether or not DNS succeeds */
- dns_success = true;
- rr_type_name = "TXT";
- nst = DNS_TYPE_TEXT;
- callback = txt_callback;
- }
-
- res = DnsQuery_UTF8 (service,
- nst,
- DNS_QUERY_BYPASS_CACHE,
- NULL /* IP Address */,
- &pdns,
- 0 /* reserved */);
-
- if (res) {
- DWORD flags = FORMAT_MESSAGE_ALLOCATE_BUFFER |
- FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS;
-
- if (FormatMessage (flags,
- 0,
- res,
- MAKELANGID (LANG_NEUTRAL, SUBLANG_DEFAULT),
- (LPTSTR) &lpMsgBuf,
- 0,
- 0)) {
- DNS_ERROR ("Failed to look up %s record \"%s\": %s",
- rr_type_name,
- service,
- (char *) lpMsgBuf);
- }
-
- DNS_ERROR ("Failed to look up %s record \"%s\": Unknown error",
- rr_type_name,
- service);
- }
-
- if (!pdns) {
- DNS_ERROR ("No %s records for \"%s\"", rr_type_name, service);
- }
-
- i = 0;
-
- do {
- /* DnsQuery can return additional records not of the requested type */
- if ((rr_type == MONGOC_RR_TXT && pdns->wType == DNS_TYPE_TEXT) ||
- (rr_type == MONGOC_RR_SRV && pdns->wType == DNS_TYPE_SRV)) {
- if (i > 0 && rr_type == MONGOC_RR_TXT) {
- /* Initial DNS Seedlist Discovery Spec: a client "MUST raise an
- error when multiple TXT records are encountered". */
- callback_success = false;
- DNS_ERROR ("Multiple TXT records for \"%s\"", service);
- }
-
- if (rr_data) {
- if ((i == 0) || (pdns->dwTtl < rr_data->min_ttl)) {
- rr_data->min_ttl = pdns->dwTtl;
- }
- }
-
- if (!callback (service, pdns, rr_data, error)) {
- callback_success = false;
- GOTO (done);
- }
-
- i++;
- }
-
- pdns = pdns->pNext;
- } while (pdns);
-
-
- rr_data->count = i;
- if (i == 0) {
- DNS_ERROR ("No matching %s records for \"%s\"", rr_type_name, service);
- }
- dns_success = true;
-
-done:
- if (pdns) {
- DnsRecordListFree (pdns, DnsFreeRecordList);
- }
-
- if (lpMsgBuf) {
- LocalFree (lpMsgBuf);
- }
-
- RETURN (dns_success && callback_success);
-}
-
-#elif (defined(MONGOC_HAVE_RES_NSEARCH) || defined(MONGOC_HAVE_RES_SEARCH))
-
-typedef bool (*mongoc_rr_callback_t) (const char *service,
- ns_msg *ns_answer,
- ns_rr *rr,
- mongoc_rr_data_t *rr_data,
- bson_error_t *error);
-
-static bool
-srv_callback (const char *service,
- ns_msg *ns_answer,
- ns_rr *rr,
- mongoc_rr_data_t *rr_data,
- bson_error_t *error)
-{
- const uint8_t *data;
- char name[1024];
- uint16_t port;
- int size;
- bool ret = false;
- mongoc_host_list_t new_host;
-
- data = ns_rr_rdata (*rr);
- /* memcpy the network endian port before converting to host endian. we cannot
- * cast (data + 4) directly as a uint16_t*, because it may not align on an
- * 2-byte boundary. */
- memcpy (&port, data + 4, sizeof (port));
- port = ntohs (port);
- size = dn_expand (ns_msg_base (*ns_answer),
- ns_msg_end (*ns_answer),
- data + 6,
- name,
- sizeof (name));
-
- if (size < 1) {
- DNS_ERROR ("Invalid record in SRV answer for \"%s\": \"%s\"",
- service,
- strerror (h_errno));
- }
-
- if (!_mongoc_host_list_from_hostport_with_err (
- &new_host, name, port, error)) {
- GOTO (done);
- }
- _mongoc_host_list_upsert (&rr_data->hosts, &new_host);
- ret = true;
-done:
- return ret;
-}
-
-static bool
-txt_callback (const char *service,
- ns_msg *ns_answer,
- ns_rr *rr,
- mongoc_rr_data_t *rr_data,
- bson_error_t *error)
-{
- char s[256];
- const uint8_t *data;
- bson_string_t *txt;
- uint16_t pos, total;
- uint8_t len;
- bool ret = false;
-
- total = (uint16_t) ns_rr_rdlen (*rr);
- if (total < 1 || total > 255) {
- DNS_ERROR ("Invalid TXT record size %hu for \"%s\"", total, service);
- }
-
- /* a TXT record has one or more strings, each up to 255 chars, each is
- * prefixed by its length as 1 byte. thus endianness doesn't matter. */
- txt = bson_string_new (NULL);
- pos = 0;
- data = ns_rr_rdata (*rr);
-
- while (pos < total) {
- memcpy (&len, data + pos, sizeof (uint8_t));
- pos++;
- bson_strncpy (s, (const char *) (data + pos), (size_t) len + 1);
- bson_string_append (txt, s);
- pos += len;
- }
-
- rr_data->txt_record_opts = bson_strdup (txt->str);
- bson_string_free (txt, true);
- ret = true;
-
-done:
- return ret;
-}
-
-/*
- *--------------------------------------------------------------------------
- *
- * _mongoc_get_rr_search --
- *
- * Fetch SRV or TXT resource records using libresolv and put results in
- * @rr_data.
- *
- * Returns:
- * Success or failure.
- *
- * For an SRV lookup, returns false if there is any error.
- *
- * For TXT lookup, ignores any error fetching the resource record and
- * always returns true.
- *
- * Side effects:
- * @error is set if there is a failure.
- * @rr_data->hosts may be set if querying SRV. Caller must destroy.
- * @rr_data->txt_record_opts may be set if querying TXT. Caller must
- * free.
- *
- *--------------------------------------------------------------------------
- */
-
-static bool
-_mongoc_get_rr_search (const char *service,
- mongoc_rr_type_t rr_type,
- mongoc_rr_data_t *rr_data,
- bson_error_t *error)
-{
-#ifdef MONGOC_HAVE_RES_NSEARCH
- struct __res_state state = {0};
-#endif
- int size = 0;
- unsigned char *search_buf = NULL;
- size_t buffer_size = 1024;
- ns_msg ns_answer;
- int n;
- int i;
- const char *rr_type_name;
- ns_type nst;
- mongoc_rr_callback_t callback;
- ns_rr resource_record;
- bool dns_success;
- bool callback_success = true;
- int num_matching_records;
-
- ENTRY;
-
- if (rr_type == MONGOC_RR_SRV) {
- /* return true only if DNS succeeds */
- dns_success = false;
- rr_type_name = "SRV";
- nst = ns_t_srv;
- callback = srv_callback;
- } else {
- /* return true whether or not DNS succeeds */
- dns_success = true;
- rr_type_name = "TXT";
- nst = ns_t_txt;
- callback = txt_callback;
- }
-
- do {
- if (search_buf) {
- bson_free (search_buf);
-
- /* increase buffer size by the previous response size. This ensures
- * that even if a subsequent response is larger, we'll still be able
- * to fit it in the response buffer */
- buffer_size = buffer_size + size;
- }
-
- search_buf = (unsigned char *) bson_malloc (buffer_size);
- BSON_ASSERT (search_buf);
-
-#ifdef MONGOC_HAVE_RES_NSEARCH
- /* thread-safe */
- res_ninit (&state);
- size =
- res_nsearch (&state, service, ns_c_in, nst, search_buf, buffer_size);
-#elif defined(MONGOC_HAVE_RES_SEARCH)
- size = res_search (service, ns_c_in, nst, search_buf, buffer_size);
-#endif
-
- if (size < 0) {
- DNS_ERROR ("Failed to look up %s record \"%s\": %s",
- rr_type_name,
- service,
- strerror (h_errno));
- }
- } while (size > buffer_size);
-
- if (ns_initparse (search_buf, size, &ns_answer)) {
- DNS_ERROR ("Invalid %s answer for \"%s\"", rr_type_name, service);
- }
-
- n = ns_msg_count (ns_answer, ns_s_an);
- if (!n) {
- DNS_ERROR ("No %s records for \"%s\"", rr_type_name, service);
- }
-
- rr_data->count = n;
- num_matching_records = 0;
- for (i = 0; i < n; i++) {
- if (ns_parserr (&ns_answer, ns_s_an, i, &resource_record)) {
- DNS_ERROR ("Invalid record %d of %s answer for \"%s\": \"%s\"",
- i,
- rr_type_name,
- service,
- strerror (h_errno));
- }
-
- /* Skip records that don't match the ones we requested. CDRIVER-3628 shows
- * that we can receive records that were not requested. */
- if (rr_type == MONGOC_RR_TXT) {
- if (ns_rr_type (resource_record) != ns_t_txt) {
- continue;
- }
- } else if (rr_type == MONGOC_RR_SRV) {
- if (ns_rr_type (resource_record) != ns_t_srv) {
- continue;
- }
- }
-
- if (num_matching_records > 0 && rr_type == MONGOC_RR_TXT) {
- /* Initial DNS Seedlist Discovery Spec: a client "MUST raise an error
- * when multiple TXT records are encountered". */
- callback_success = false;
- DNS_ERROR ("Multiple TXT records for \"%s\"", service);
- }
-
- num_matching_records++;
-
- if (rr_data) {
- uint32_t ttl;
-
- ttl = ns_rr_ttl (resource_record);
- if ((i == 0) || (ttl < rr_data->min_ttl)) {
- rr_data->min_ttl = ttl;
- }
- }
-
- if (!callback (service, &ns_answer, &resource_record, rr_data, error)) {
- callback_success = false;
- GOTO (done);
- }
- }
-
- if (num_matching_records == 0) {
- DNS_ERROR ("No matching %s records for \"%s\"", rr_type_name, service);
- }
-
- dns_success = true;
-
-done:
-
- bson_free (search_buf);
-
-#ifdef MONGOC_HAVE_RES_NDESTROY
- /* defined on BSD/Darwin, and only if MONGOC_HAVE_RES_NSEARCH is defined */
- res_ndestroy (&state);
-#elif defined(MONGOC_HAVE_RES_NCLOSE)
- /* defined on Linux, and only if MONGOC_HAVE_RES_NSEARCH is defined */
- res_nclose (&state);
-#endif
- RETURN (dns_success && callback_success);
-}
-#endif
-
-/*
- *--------------------------------------------------------------------------
- *
- * _mongoc_client_get_rr --
- *
- * Fetch an SRV or TXT resource record and update put results in
- * @rr_data.
- *
- * See RFCs 1464 and 2782, MongoDB's "Initial DNS Seedlist Discovery"
- * spec, and MongoDB's "Polling SRV Records for Mongos Discovery"
- * spec.
- *
- * Returns:
- * Success or failure.
- *
- * Side effects:
- * @error is set if there is a failure. Errors fetching TXT are
- * ignored.
- * @rr_data->hosts may be set if querying SRV. Caller must destroy.
- * @rr_data->txt_record_opts may be set if querying TXT. Caller must
- * free.
- *
- *--------------------------------------------------------------------------
- */
-
-bool
-_mongoc_client_get_rr (const char *service,
- mongoc_rr_type_t rr_type,
- mongoc_rr_data_t *rr_data,
- bson_error_t *error)
-{
-#ifdef MONGOC_HAVE_DNSAPI
- return _mongoc_get_rr_dnsapi (service, rr_type, rr_data, error);
-#elif (defined(MONGOC_HAVE_RES_NSEARCH) || defined(MONGOC_HAVE_RES_SEARCH))
- return _mongoc_get_rr_search (service, rr_type, rr_data, error);
-#else
- bson_set_error (error,
- MONGOC_ERROR_STREAM,
- MONGOC_ERROR_STREAM_NAME_RESOLUTION,
- "libresolv unavailable, cannot use mongodb+srv URI");
- return false;
-#endif
-}
-
-#undef DNS_ERROR
-
-/*
- *--------------------------------------------------------------------------
- *
- * mongoc_client_connect_tcp --
- *
- * Connect to a host using a TCP socket.
- *
- * This will be performed synchronously and return a mongoc_stream_t
- * that can be used to connect with the remote host.
- *
- * Returns:
- * A newly allocated mongoc_stream_t if successful; otherwise
- * NULL and @error is set.
- *
- * Side effects:
- * @error is set if return value is NULL.
- *
- *--------------------------------------------------------------------------
- */
-
-mongoc_stream_t *
-mongoc_client_connect_tcp (int32_t connecttimeoutms,
- const mongoc_host_list_t *host,
- bson_error_t *error)
-{
- mongoc_socket_t *sock = NULL;
- struct addrinfo hints;
- struct addrinfo *result, *rp;
- int64_t expire_at;
- char portstr[8];
- int s;
-
- ENTRY;
-
- BSON_ASSERT (connecttimeoutms);
- BSON_ASSERT (host);
-
- bson_snprintf (portstr, sizeof portstr, "%hu", host->port);
-
- memset (&hints, 0, sizeof hints);
- hints.ai_family = host->family;
- hints.ai_socktype = SOCK_STREAM;
- hints.ai_flags = 0;
- hints.ai_protocol = 0;
-
- TRACE ("DNS lookup for %s", host->host);
- s = getaddrinfo (host->host, portstr, &hints, &result);
-
- if (s != 0) {
- mongoc_counter_dns_failure_inc ();
- TRACE ("Failed to resolve %s", host->host);
- bson_set_error (error,
- MONGOC_ERROR_STREAM,
- MONGOC_ERROR_STREAM_NAME_RESOLUTION,
- "Failed to resolve %s",
- host->host);
- RETURN (NULL);
- }
-
- mongoc_counter_dns_success_inc ();
-
- for (rp = result; rp; rp = rp->ai_next) {
- /*
- * Create a new non-blocking socket.
- */
- if (!(sock = mongoc_socket_new (
- rp->ai_family, rp->ai_socktype, rp->ai_protocol))) {
- continue;
- }
-
- /*
- * Try to connect to the peer.
- */
- expire_at = bson_get_monotonic_time () + (connecttimeoutms * 1000L);
- if (0 !=
- mongoc_socket_connect (
- sock, rp->ai_addr, (mongoc_socklen_t) rp->ai_addrlen, expire_at)) {
- mongoc_socket_destroy (sock);
- sock = NULL;
- continue;
- }
-
- break;
- }
-
- if (!sock) {
- bson_set_error (error,
- MONGOC_ERROR_STREAM,
- MONGOC_ERROR_STREAM_CONNECT,
- "Failed to connect to target host: %s",
- host->host_and_port);
- freeaddrinfo (result);
- RETURN (NULL);
- }
-
- freeaddrinfo (result);
-
- return mongoc_stream_socket_new (sock);
-}
-
-
-/*
- *--------------------------------------------------------------------------
- *
- * mongoc_client_connect_unix --
- *
- * Connect to a MongoDB server using a UNIX domain socket.
- *
- * Returns:
- * A newly allocated mongoc_stream_t if successful; otherwise
- * NULL and @error is set.
- *
- * Side effects:
- * @error is set if return value is NULL.
- *
- *--------------------------------------------------------------------------
- */
-
-static mongoc_stream_t *
-mongoc_client_connect_unix (const mongoc_host_list_t *host, bson_error_t *error)
-{
-#ifdef _WIN32
- ENTRY;
- bson_set_error (error,
- MONGOC_ERROR_STREAM,
- MONGOC_ERROR_STREAM_CONNECT,
- "UNIX domain sockets not supported on win32.");
- RETURN (NULL);
-#else
- struct sockaddr_un saddr;
- mongoc_socket_t *sock;
- mongoc_stream_t *ret = NULL;
-
- ENTRY;
-
- BSON_ASSERT (host);
-
- memset (&saddr, 0, sizeof saddr);
- saddr.sun_family = AF_UNIX;
- bson_snprintf (saddr.sun_path, sizeof saddr.sun_path - 1, "%s", host->host);
-
- sock = mongoc_socket_new (AF_UNIX, SOCK_STREAM, 0);
-
- if (sock == NULL) {
- bson_set_error (error,
- MONGOC_ERROR_STREAM,
- MONGOC_ERROR_STREAM_SOCKET,
- "Failed to create socket.");
- RETURN (NULL);
- }
-
- if (-1 == mongoc_socket_connect (
- sock, (struct sockaddr *) &saddr, sizeof saddr, -1)) {
- mongoc_socket_destroy (sock);
- bson_set_error (error,
- MONGOC_ERROR_STREAM,
- MONGOC_ERROR_STREAM_CONNECT,
- "Failed to connect to UNIX domain socket.");
- RETURN (NULL);
- }
-
- ret = mongoc_stream_socket_new (sock);
-
- RETURN (ret);
-#endif
-}
-
-mongoc_stream_t *
-mongoc_client_connect (bool buffered,
- bool use_ssl,
- void *ssl_opts_void,
- const mongoc_uri_t *uri,
- const mongoc_host_list_t *host,
- bson_error_t *error)
-{
- mongoc_stream_t *base_stream = NULL;
- int32_t connecttimeoutms;
-
- BSON_ASSERT (uri);
- BSON_ASSERT (host);
-
-#ifndef MONGOC_ENABLE_SSL
- if (ssl_opts_void || mongoc_uri_get_tls (uri)) {
- bson_set_error (error,
- MONGOC_ERROR_CLIENT,
- MONGOC_ERROR_CLIENT_NO_ACCEPTABLE_PEER,
- "TLS is not enabled in this build of mongo-c-driver.");
- return NULL;
- }
-#endif
-
- connecttimeoutms = mongoc_uri_get_option_as_int32 (
- uri, MONGOC_URI_CONNECTTIMEOUTMS, MONGOC_DEFAULT_CONNECTTIMEOUTMS);
-
- switch (host->family) {
- case AF_UNSPEC:
-#if defined(AF_INET6)
- case AF_INET6:
-#endif
- case AF_INET:
- base_stream = mongoc_client_connect_tcp (connecttimeoutms, host, error);
- break;
- case AF_UNIX:
- base_stream = mongoc_client_connect_unix (host, error);
- break;
- default:
- bson_set_error (error,
- MONGOC_ERROR_STREAM,
- MONGOC_ERROR_STREAM_INVALID_TYPE,
- "Invalid address family: 0x%02x",
- host->family);
- break;
- }
-
-#ifdef MONGOC_ENABLE_SSL
- if (base_stream) {
- mongoc_ssl_opt_t *ssl_opts;
- const char *mechanism;
-
- ssl_opts = (mongoc_ssl_opt_t *) ssl_opts_void;
- mechanism = mongoc_uri_get_auth_mechanism (uri);
-
- if (use_ssl || (mechanism && (0 == strcmp (mechanism, "MONGODB-X509")))) {
- mongoc_stream_t *original = base_stream;
-
- base_stream = mongoc_stream_tls_new_with_hostname (
- base_stream, host->host, ssl_opts, true);
-
- if (!base_stream) {
- mongoc_stream_destroy (original);
- bson_set_error (error,
- MONGOC_ERROR_STREAM,
- MONGOC_ERROR_STREAM_SOCKET,
- "Failed initialize TLS state.");
- return NULL;
- }
-
- if (!mongoc_stream_tls_handshake_block (
- base_stream, host->host, connecttimeoutms, error)) {
- mongoc_stream_destroy (base_stream);
- return NULL;
- }
- }
- }
-#endif
-
- if (!base_stream) {
- return NULL;
- }
- if (buffered) {
- return mongoc_stream_buffered_new (base_stream, 1024);
- }
- return base_stream;
-}
-
-/*
- *--------------------------------------------------------------------------
- *
- * mongoc_client_default_stream_initiator --
- *
- * A mongoc_stream_initiator_t that will handle the various type
- * of supported sockets by MongoDB including TCP and UNIX.
- *
- * Language binding authors may want to implement an alternate
- * version of this method to use their native stream format.
- *
- * Returns:
- * A mongoc_stream_t if successful; otherwise NULL and @error is set.
- *
- * Side effects:
- * @error is set if return value is NULL.
- *
- *--------------------------------------------------------------------------
- */
-
-mongoc_stream_t *
-mongoc_client_default_stream_initiator (const mongoc_uri_t *uri,
- const mongoc_host_list_t *host,
- void *user_data,
- bson_error_t *error)
-{
- void *ssl_opts_void = NULL;
- bool use_ssl = false;
-#ifdef MONGOC_ENABLE_SSL
- mongoc_client_t *client = (mongoc_client_t *) user_data;
-
- use_ssl = client->use_ssl;
- ssl_opts_void = (void *) &client->ssl_opts;
-
-#endif
-
- return mongoc_client_connect (
- true, use_ssl, ssl_opts_void, uri, host, error);
-}
-
-/*
- *--------------------------------------------------------------------------
- *
- * _mongoc_client_create_stream --
- *
- * INTERNAL API
- *
- * This function is used by the mongoc_cluster_t to initiate a
- * new stream. This is done because cluster is private API and
- * those using mongoc_client_t may need to override this process.
- *
- * This function calls the default initiator for new streams.
- *
- * Returns:
- * A newly allocated mongoc_stream_t if successful; otherwise
- * NULL and @error is set.
- *
- * Side effects:
- * @error is set if return value is NULL.
- *
- *--------------------------------------------------------------------------
- */
-
-mongoc_stream_t *
-_mongoc_client_create_stream (mongoc_client_t *client,
- const mongoc_host_list_t *host,
- bson_error_t *error)
-{
- BSON_ASSERT (client);
- BSON_ASSERT (host);
-
- return client->initiator (client->uri, host, client->initiator_data, error);
-}
-
-
-/*
- *--------------------------------------------------------------------------
- *
- * _mongoc_client_recv --
- *
- * Receives a RPC from a remote MongoDB cluster node.
- *
- * Returns:
- * true if successful; otherwise false and @error is set.
- *
- * Side effects:
- * @error is set if return value is false.
- *
- *--------------------------------------------------------------------------
- */
-
-bool
-_mongoc_client_recv (mongoc_client_t *client,
- mongoc_rpc_t *rpc,
- mongoc_buffer_t *buffer,
- mongoc_server_stream_t *server_stream,
- bson_error_t *error)
-{
- BSON_ASSERT (client);
- BSON_ASSERT (rpc);
- BSON_ASSERT (buffer);
- BSON_ASSERT (server_stream);
-
- return mongoc_cluster_try_recv (
- &client->cluster, rpc, buffer, server_stream, error);
-}
-
-
-/*
- *--------------------------------------------------------------------------
- *
- * mongoc_client_new --
- *
- * Create a new mongoc_client_t using the URI provided.
- *
- * @uri should be a MongoDB URI string such as "mongodb://localhost/"
- * More information on the format can be found at
- * http://docs.mongodb.org/manual/reference/connection-string/
- *
- * Returns:
- * A newly allocated mongoc_client_t or NULL if @uri_string is
- * invalid.
- *
- * Side effects:
- * None.
- *
- *--------------------------------------------------------------------------
- */
-mongoc_client_t *
-mongoc_client_new (const char *uri_string)
-{
- mongoc_topology_t *topology;
- mongoc_client_t *client;
- mongoc_uri_t *uri;
-
-
- if (!uri_string) {
- uri_string = "mongodb://127.0.0.1/";
- }
-
- if (!(uri = mongoc_uri_new (uri_string))) {
- return NULL;
- }
-
- topology = mongoc_topology_new (uri, true);
-
- client = _mongoc_client_new_from_uri (topology);
- if (!client) {
- mongoc_topology_destroy (topology);
- }
- mongoc_uri_destroy (uri);
-
- return client;
-}
-
-
-/*
- *--------------------------------------------------------------------------
- *
- * mongoc_client_set_ssl_opts
- *
- * set ssl opts for a client
- *
- * Returns:
- * Nothing
- *
- * Side effects:
- * None.
- *
- *--------------------------------------------------------------------------
- */
-
-#ifdef MONGOC_ENABLE_SSL
-/* Only called internally. Caller must ensure opts->internal is valid. */
-void
-_mongoc_client_set_internal_tls_opts (mongoc_client_t *client,
- _mongoc_internal_tls_opts_t *internal)
-{
- if (!client->use_ssl) {
- return;
- }
- client->ssl_opts.internal =
- bson_malloc (sizeof (_mongoc_internal_tls_opts_t));
- memcpy (client->ssl_opts.internal,
- internal,
- sizeof (_mongoc_internal_tls_opts_t));
-}
-
-void
-mongoc_client_set_ssl_opts (mongoc_client_t *client,
- const mongoc_ssl_opt_t *opts)
-{
- BSON_ASSERT (client);
- BSON_ASSERT (opts);
-
- _mongoc_ssl_opts_cleanup (&client->ssl_opts,
- false /* don't free internal opts */);
-
- client->use_ssl = true;
- _mongoc_ssl_opts_copy_to (
- opts, &client->ssl_opts, false /* don't overwrite internal opts */);
-
- if (client->topology->single_threaded) {
- mongoc_topology_scanner_set_ssl_opts (client->topology->scanner,
- &client->ssl_opts);
- }
-}
-#endif
-
-
-/*
- *--------------------------------------------------------------------------
- *
- * mongoc_client_new_from_uri --
- *
- * Create a new mongoc_client_t for a mongoc_uri_t.
- *
- * Returns:
- * A newly allocated mongoc_client_t.
- *
- * Side effects:
- * None.
- *
- *--------------------------------------------------------------------------
- */
-
-mongoc_client_t *
-mongoc_client_new_from_uri (const mongoc_uri_t *uri)
-{
- mongoc_topology_t *topology;
-
- topology = mongoc_topology_new (uri, true);
-
- /* topology->uri may be different from uri: if this is a mongodb+srv:// URI
- * then mongoc_topology_new has fetched SRV and TXT records and updated its
- * uri from them.
- */
- return _mongoc_client_new_from_uri (topology);
-}
-
-/*
- *--------------------------------------------------------------------------
- *
- * _mongoc_client_new_from_uri --
- *
- * Create a new mongoc_client_t for a given topology object.
- *
- * Returns:
- * A newly allocated mongoc_client_t.
- *
- * Side effects:
- * None.
- *
- *--------------------------------------------------------------------------
- */
-
-mongoc_client_t *
-_mongoc_client_new_from_uri (mongoc_topology_t *topology)
-{
- mongoc_client_t *client;
- const mongoc_read_prefs_t *read_prefs;
- const mongoc_read_concern_t *read_concern;
- const mongoc_write_concern_t *write_concern;
- const char *appname;
-
- BSON_ASSERT (topology);
-
-#ifndef MONGOC_ENABLE_SSL
- if (mongoc_uri_get_tls (topology->uri)) {
- MONGOC_ERROR ("Can't create SSL client, SSL not enabled in this build.");
- return NULL;
- }
-#endif
-
- client = (mongoc_client_t *) bson_malloc0 (sizeof *client);
- client->uri = mongoc_uri_copy (topology->uri);
- client->initiator = mongoc_client_default_stream_initiator;
- client->initiator_data = client;
- client->topology = topology;
- client->error_api_version = MONGOC_ERROR_API_VERSION_LEGACY;
- client->error_api_set = false;
- client->client_sessions = mongoc_set_new (8, NULL, NULL);
- client->csid_rand_seed = (unsigned int) bson_get_monotonic_time ();
-
- write_concern = mongoc_uri_get_write_concern (client->uri);
- client->write_concern = mongoc_write_concern_copy (write_concern);
-
- read_concern = mongoc_uri_get_read_concern (client->uri);
- client->read_concern = mongoc_read_concern_copy (read_concern);
-
- read_prefs = mongoc_uri_get_read_prefs_t (client->uri);
- client->read_prefs = mongoc_read_prefs_copy (read_prefs);
-
- appname =
- mongoc_uri_get_option_as_utf8 (client->uri, MONGOC_URI_APPNAME, NULL);
- if (appname && client->topology->single_threaded) {
- /* the appname should have already been validated */
- BSON_ASSERT (mongoc_client_set_appname (client, appname));
- }
-
- mongoc_cluster_init (&client->cluster, client->uri, client);
-
-#ifdef MONGOC_ENABLE_SSL
- client->use_ssl = false;
- if (mongoc_uri_get_tls (client->uri)) {
- mongoc_ssl_opt_t ssl_opt = {0};
- _mongoc_internal_tls_opts_t internal_tls_opts = {0};
-
- _mongoc_ssl_opts_from_uri (&ssl_opt, &internal_tls_opts, client->uri);
- /* sets use_ssl = true */
- mongoc_client_set_ssl_opts (client, &ssl_opt);
- _mongoc_client_set_internal_tls_opts (client, &internal_tls_opts);
- }
-#endif
-
- mongoc_counter_clients_active_inc ();
-
- return client;
-}
-
-/*
- *--------------------------------------------------------------------------
- *
- * mongoc_client_destroy --
- *
- * Destroys a mongoc_client_t and cleans up all resources associated
- * with the client instance.
- *
- * Returns:
- * None.
- *
- * Side effects:
- * @client is destroyed.
- *
- *--------------------------------------------------------------------------
- */
-
-void
-mongoc_client_destroy (mongoc_client_t *client)
-{
- if (client) {
- if (client->topology->single_threaded) {
- _mongoc_client_end_sessions (client);
- mongoc_topology_destroy (client->topology);
- }
-
- mongoc_write_concern_destroy (client->write_concern);
- mongoc_read_concern_destroy (client->read_concern);
- mongoc_read_prefs_destroy (client->read_prefs);
- mongoc_cluster_destroy (&client->cluster);
- mongoc_uri_destroy (client->uri);
- mongoc_set_destroy (client->client_sessions);
-
-#ifdef MONGOC_ENABLE_SSL
- _mongoc_ssl_opts_cleanup (&client->ssl_opts, true);
-#endif
-
- bson_free (client);
-
- mongoc_counter_clients_active_dec ();
- mongoc_counter_clients_disposed_inc ();
- }
-}
-
-
-/*
- *--------------------------------------------------------------------------
- *
- * mongoc_client_get_uri --
- *
- * Fetch the URI used for @client.
- *
- * Returns:
- * A mongoc_uri_t that should not be modified or freed.
- *
- * Side effects:
- * None.
- *
- *--------------------------------------------------------------------------
- */
-
-const mongoc_uri_t *
-mongoc_client_get_uri (const mongoc_client_t *client)
-{
- BSON_ASSERT (client);
-
- return client->uri;
-}
-
-/*
- *--------------------------------------------------------------------------
- *
- * mongoc_client_start_session --
- *
- * Creates a structure to communicate in a session over @client.
- *
- * This structure should be freed when the caller is done with it
- * using mongoc_client_session_destroy().
- *
- * Returns:
- * A newly allocated mongoc_client_session_t.
- *
- * Side effects:
- * None.
- *
- *--------------------------------------------------------------------------
- */
-
-mongoc_client_session_t *
-mongoc_client_start_session (mongoc_client_t *client,
- const mongoc_session_opt_t *opts,
- bson_error_t *error)
-{
- mongoc_server_session_t *ss;
- mongoc_client_session_t *cs;
- uint32_t csid;
-
- ENTRY;
-
- ss = _mongoc_client_pop_server_session (client, error);
- if (!ss) {
- RETURN (NULL);
- }
-
- /* get a random internal id for the session, retrying on collision */
- do {
- csid = (uint32_t) _mongoc_rand_simple (&client->csid_rand_seed);
- } while (mongoc_set_get (client->client_sessions, csid));
-
- cs = _mongoc_client_session_new (client, ss, opts, csid);
-
- /* remember session so if we see its client_session_id in a command, we can
- * find its lsid and clusterTime */
- mongoc_set_add (client->client_sessions, csid, cs);
-
- RETURN (cs);
-}
-
-
-/*
- *--------------------------------------------------------------------------
- *
- * mongoc_client_get_database --
- *
- * Fetches a newly allocated database structure to communicate with
- * a database over @client.
- *
- * @database should be a db name such as "test".
- *
- * This structure should be freed when the caller is done with it
- * using mongoc_database_destroy().
- *
- * Returns:
- * A newly allocated mongoc_database_t.
- *
- * Side effects:
- * None.
- *
- *--------------------------------------------------------------------------
- */
-
-mongoc_database_t *
-mongoc_client_get_database (mongoc_client_t *client, const char *name)
-{
- BSON_ASSERT (client);
- BSON_ASSERT (name);
-
- return _mongoc_database_new (client,
- name,
- client->read_prefs,
- client->read_concern,
- client->write_concern);
-}
-
-
-/*
- *--------------------------------------------------------------------------
- *
- * mongoc_client_get_default_database --
- *
- * Get the database named in the MongoDB connection URI, or NULL
- * if none was specified in the URI.
- *
- * This structure should be freed when the caller is done with it
- * using mongoc_database_destroy().
- *
- * Returns:
- * A newly allocated mongoc_database_t or NULL.
- *
- * Side effects:
- * None.
- *
- *--------------------------------------------------------------------------
- */
-
-mongoc_database_t *
-mongoc_client_get_default_database (mongoc_client_t *client)
-{
- const char *db;
-
- BSON_ASSERT (client);
- db = mongoc_uri_get_database (client->uri);
-
- if (db) {
- return mongoc_client_get_database (client, db);
- }
-
- return NULL;
-}
-
-
-/*
- *--------------------------------------------------------------------------
- *
- * mongoc_client_get_collection --
- *
- * This function returns a newly allocated collection structure.
- *
- * @db should be the name of the database, such as "test".
- * @collection should be the name of the collection such as "test".
- *
- * The above would result in the namespace "test.test".
- *
- * You should free this structure when you are done with it using
- * mongoc_collection_destroy().
- *
- * Returns:
- * A newly allocated mongoc_collection_t that should be freed with
- * mongoc_collection_destroy().
- *
- * Side effects:
- * None.
- *
- *--------------------------------------------------------------------------
- */
-
-mongoc_collection_t *
-mongoc_client_get_collection (mongoc_client_t *client,
- const char *db,
- const char *collection)
-{
- BSON_ASSERT (client);
- BSON_ASSERT (db);
- BSON_ASSERT (collection);
-
- return _mongoc_collection_new (client,
- db,
- collection,
- client->read_prefs,
- client->read_concern,
- client->write_concern);
-}
-
-
-/*
- *--------------------------------------------------------------------------
- *
- * mongoc_client_get_gridfs --
- *
- * This function returns a newly allocated collection structure.
- *
- * @db should be the name of the database, such as "test".
- *
- * @prefix optional prefix for GridFS collection names, or NULL. Default
- * is "fs", thus the default collection names for GridFS are "fs.files"
- * and "fs.chunks".
- *
- * Returns:
- * A newly allocated mongoc_gridfs_t that should be freed with
- * mongoc_gridfs_destroy().
- *
- * Side effects:
- * None.
- *
- *--------------------------------------------------------------------------
- */
-
-mongoc_gridfs_t *
-mongoc_client_get_gridfs (mongoc_client_t *client,
- const char *db,
- const char *prefix,
- bson_error_t *error)
-{
- BSON_ASSERT (client);
- BSON_ASSERT (db);
-
- if (!prefix) {
- prefix = "fs";
- }
-
- return _mongoc_gridfs_new (client, db, prefix, error);
-}
-
-
-/*
- *--------------------------------------------------------------------------
- *
- * mongoc_client_get_write_concern --
- *
- * Fetches the default write concern for @client.
- *
- * Returns:
- * A mongoc_write_concern_t that should not be modified or freed.
- *
- * Side effects:
- * None.
- *
- *--------------------------------------------------------------------------
- */
-
-const mongoc_write_concern_t *
-mongoc_client_get_write_concern (const mongoc_client_t *client)
-{
- BSON_ASSERT (client);
-
- return client->write_concern;
-}
-
-
-/*
- *--------------------------------------------------------------------------
- *
- * mongoc_client_set_write_concern --
- *
- * Sets the default write concern for @client.
- *
- * Returns:
- * None.
- *
- * Side effects:
- * None.
- *
- *--------------------------------------------------------------------------
- */
-
-void
-mongoc_client_set_write_concern (mongoc_client_t *client,
- const mongoc_write_concern_t *write_concern)
-{
- BSON_ASSERT (client);
-
- if (write_concern != client->write_concern) {
- if (client->write_concern) {
- mongoc_write_concern_destroy (client->write_concern);
- }
- client->write_concern = write_concern
- ? mongoc_write_concern_copy (write_concern)
- : mongoc_write_concern_new ();
- }
-}
-
-
-/*
- *--------------------------------------------------------------------------
- *
- * mongoc_client_get_read_concern --
- *
- * Fetches the default read concern for @client.
- *
- * Returns:
- * A mongoc_read_concern_t that should not be modified or freed.
- *
- * Side effects:
- * None.
- *
- *--------------------------------------------------------------------------
- */
-
-const mongoc_read_concern_t *
-mongoc_client_get_read_concern (const mongoc_client_t *client)
-{
- BSON_ASSERT (client);
-
- return client->read_concern;
-}
-
-
-/*
- *--------------------------------------------------------------------------
- *
- * mongoc_client_set_read_concern --
- *
- * Sets the default read concern for @client.
- *
- * Returns:
- * None.
- *
- * Side effects:
- * None.
- *
- *--------------------------------------------------------------------------
- */
-
-void
-mongoc_client_set_read_concern (mongoc_client_t *client,
- const mongoc_read_concern_t *read_concern)
-{
- BSON_ASSERT (client);
-
- if (read_concern != client->read_concern) {
- if (client->read_concern) {
- mongoc_read_concern_destroy (client->read_concern);
- }
- client->read_concern = read_concern
- ? mongoc_read_concern_copy (read_concern)
- : mongoc_read_concern_new ();
- }
-}
-
-
-/*
- *--------------------------------------------------------------------------
- *
- * mongoc_client_get_read_prefs --
- *
- * Fetch the default read preferences for @client.
- *
- * Returns:
- * None.
- *
- * Side effects:
- * None.
- *
- *--------------------------------------------------------------------------
- */
-
-const mongoc_read_prefs_t *
-mongoc_client_get_read_prefs (const mongoc_client_t *client)
-{
- BSON_ASSERT (client);
-
- return client->read_prefs;
-}
-
-
-/*
- *--------------------------------------------------------------------------
- *
- * mongoc_client_set_read_prefs --
- *
- * Set the default read preferences for @client.
- *
- * Returns:
- * None.
- *
- * Side effects:
- * None.
- *
- *--------------------------------------------------------------------------
- */
-
-void
-mongoc_client_set_read_prefs (mongoc_client_t *client,
- const mongoc_read_prefs_t *read_prefs)
-{
- BSON_ASSERT (client);
-
- if (read_prefs != client->read_prefs) {
- if (client->read_prefs) {
- mongoc_read_prefs_destroy (client->read_prefs);
- }
- client->read_prefs = read_prefs
- ? mongoc_read_prefs_copy (read_prefs)
- : mongoc_read_prefs_new (MONGOC_READ_PRIMARY);
- }
-}
-
-mongoc_cursor_t *
-mongoc_client_command (mongoc_client_t *client,
- const char *db_name,
- 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 = NULL;
- mongoc_cursor_t *cursor;
-
- BSON_ASSERT (client);
- BSON_ASSERT (db_name);
- BSON_ASSERT (query);
-
- /*
- * Allow a caller to provide a fully qualified namespace
- */
- if (NULL == strstr (db_name, "$cmd")) {
- ns = bson_strdup_printf ("%s.$cmd", db_name);
- db_name = ns;
- }
-
- cursor =
- _mongoc_cursor_cmd_deprecated_new (client, db_name, query, read_prefs);
-
- bson_free (ns);
- return cursor;
-}
-
-
-static bool
-_mongoc_client_retryable_write_command_with_stream (
- mongoc_client_t *client,
- mongoc_cmd_parts_t *parts,
- mongoc_server_stream_t *server_stream,
- bson_t *reply,
- bson_error_t *error)
-{
- mongoc_server_stream_t *retry_server_stream = NULL;
- bson_iter_t txn_number_iter;
- bool is_retryable = true;
- bool ret;
-
- ENTRY;
-
- BSON_ASSERT (parts->is_retryable_write);
-
- /* increment the transaction number for the first attempt of each retryable
- * write command */
- BSON_ASSERT (bson_iter_init_find (
- &txn_number_iter, parts->assembled.command, "txnNumber"));
- bson_iter_overwrite_int64 (
- &txn_number_iter, ++parts->assembled.session->server_session->txn_number);
-
-retry:
- ret = mongoc_cluster_run_command_monitored (
- &client->cluster, &parts->assembled, reply, error);
-
- _mongoc_write_error_handle_labels (
- ret, error, reply, server_stream->sd->max_wire_version);
-
- if (is_retryable) {
- _mongoc_write_error_update_if_unsupported_storage_engine (
- ret, error, reply);
- }
-
- /* If a retryable error is encountered and the write is retryable, select
- * a new writable stream and retry. If server selection fails or the selected
- * server does not support retryable writes, fall through and allow the
- * original error to be reported. */
- if (is_retryable &&
- _mongoc_write_error_get_type (reply) == MONGOC_WRITE_ERR_RETRY) {
- bson_error_t ignored_error;
-
- /* each write command may be retried at most once */
- is_retryable = false;
-
- if (retry_server_stream) {
- mongoc_server_stream_cleanup (retry_server_stream);
- }
-
- retry_server_stream = mongoc_cluster_stream_for_writes (
- &client->cluster, parts->assembled.session, NULL, &ignored_error);
-
- if (retry_server_stream &&
- retry_server_stream->sd->max_wire_version >=
- WIRE_VERSION_RETRY_WRITES) {
- parts->assembled.server_stream = retry_server_stream;
- bson_destroy (reply);
- GOTO (retry);
- }
- }
-
- if (retry_server_stream) {
- mongoc_server_stream_cleanup (retry_server_stream);
- }
-
- if (ret && error) {
- /* if a retry succeeded, clear the initial error */
- memset (error, 0, sizeof (bson_error_t));
- }
-
- RETURN (ret);
-}
-
-
-static bool
-_mongoc_client_retryable_read_command_with_stream (
- mongoc_client_t *client,
- mongoc_cmd_parts_t *parts,
- mongoc_server_stream_t *server_stream,
- bson_t *reply,
- bson_error_t *error)
-{
- mongoc_server_stream_t *retry_server_stream = NULL;
- bool is_retryable = true;
- bool ret;
- bson_t reply_local;
-
- if (reply == NULL) {
- reply = &reply_local;
- }
-
- ENTRY;
-
- BSON_ASSERT (parts->is_retryable_read);
-
-retry:
- ret = mongoc_cluster_run_command_monitored (
- &client->cluster, &parts->assembled, reply, error);
-
- /* If a retryable error is encountered and the read is retryable, select
- * a new readable stream and retry. If server selection fails or the selected
- * server does not support retryable reads, fall through and allow the
- * original error to be reported. */
- if (is_retryable &&
- _mongoc_read_error_get_type (ret, error, reply) ==
- MONGOC_READ_ERR_RETRY) {
- bson_error_t ignored_error;
-
- /* each read command may be retried at most once */
- is_retryable = false;
-
- if (retry_server_stream) {
- mongoc_server_stream_cleanup (retry_server_stream);
- }
-
- retry_server_stream =
- mongoc_cluster_stream_for_reads (&client->cluster,
- parts->read_prefs,
- parts->assembled.session,
- NULL,
- &ignored_error);
-
- if (retry_server_stream &&
- retry_server_stream->sd->max_wire_version >=
- WIRE_VERSION_RETRY_READS) {
- parts->assembled.server_stream = retry_server_stream;
- bson_destroy (reply);
- GOTO (retry);
- }
- }
-
- if (retry_server_stream) {
- mongoc_server_stream_cleanup (retry_server_stream);
- }
-
- if (ret && error) {
- /* if a retry succeeded, clear the initial error */
- memset (error, 0, sizeof (bson_error_t));
- }
-
- RETURN (ret);
-}
-
-
-static bool
-_mongoc_client_command_with_stream (mongoc_client_t *client,
- mongoc_cmd_parts_t *parts,
- const mongoc_read_prefs_t *read_prefs,
- mongoc_server_stream_t *server_stream,
- bson_t *reply,
- bson_error_t *error)
-{
- ENTRY;
-
- parts->assembled.operation_id = ++client->cluster.operation_id;
- if (!mongoc_cmd_parts_assemble (parts, server_stream, error)) {
- _mongoc_bson_init_if_set (reply);
- return false;
- };
-
- if (parts->is_retryable_write) {
- RETURN (_mongoc_client_retryable_write_command_with_stream (
- client, parts, server_stream, reply, error));
- }
-
- if (parts->is_retryable_read) {
- RETURN (_mongoc_client_retryable_read_command_with_stream (
- client, parts, server_stream, reply, error));
- }
-
- RETURN (mongoc_cluster_run_command_monitored (
- &client->cluster, &parts->assembled, reply, error));
-}
-
-
-bool
-mongoc_client_command_simple (mongoc_client_t *client,
- const char *db_name,
- const bson_t *command,
- const mongoc_read_prefs_t *read_prefs,
- bson_t *reply,
- bson_error_t *error)
-{
- mongoc_cluster_t *cluster;
- mongoc_server_stream_t *server_stream = NULL;
- mongoc_cmd_parts_t parts;
- bool ret;
-
- ENTRY;
-
- BSON_ASSERT (client);
- BSON_ASSERT (db_name);
- BSON_ASSERT (command);
-
- if (!_mongoc_read_prefs_validate (read_prefs, error)) {
- RETURN (false);
- }
-
- cluster = &client->cluster;
- mongoc_cmd_parts_init (&parts, client, db_name, MONGOC_QUERY_NONE, command);
- parts.read_prefs = read_prefs;
-
- /* Server Selection Spec: "The generic command method has a default read
- * preference of mode 'primary'. The generic command method MUST ignore any
- * default read preference from client, database or collection
- * configuration. The generic command method SHOULD allow an optional read
- * preference argument."
- */
- server_stream =
- mongoc_cluster_stream_for_reads (cluster, read_prefs, NULL, reply, error);
-
- if (server_stream) {
- ret = _mongoc_client_command_with_stream (
- client, &parts, read_prefs, server_stream, reply, error);
- } else {
- /* reply initialized by mongoc_cluster_stream_for_reads */
- ret = false;
- }
-
- mongoc_cmd_parts_cleanup (&parts);
- mongoc_server_stream_cleanup (server_stream);
-
- RETURN (ret);
-}
-
-
-/*
- *--------------------------------------------------------------------------
- *
- * _mongoc_client_command_with_opts --
- *
- * Execute a command on the server. If mode is MONGOC_CMD_READ or
- * MONGOC_CMD_RW, then read concern is applied from @opts, or else from
- * @default_rc, and read preferences are applied from @user_prefs, or else
- * from @default_prefs. If mode is MONGOC_CMD_WRITE or MONGOC_CMD_RW, then
- * write concern is applied from @opts if present, or else @default_wc.
- *
- * If mode is MONGOC_CMD_RAW, then read concern and write concern are
- * applied from @opts only. Read preferences are applied from
- * @user_prefs.
- *
- * The mongoc_client_t's read preference, read concern, and write concern
- * are *NOT* applied.
- *
- * Returns:
- * Success or failure.
- * A write concern timeout or write concern error is considered a failure.
- *
- * Side effects:
- * @reply is always initialized.
- * @error is filled out if the command fails.
- *
- *--------------------------------------------------------------------------
- */
-bool
-_mongoc_client_command_with_opts (mongoc_client_t *client,
- const char *db_name,
- const bson_t *command,
- mongoc_command_mode_t mode,
- const bson_t *opts,
- mongoc_query_flags_t flags,
- const mongoc_read_prefs_t *user_prefs,
- const mongoc_read_prefs_t *default_prefs,
- mongoc_read_concern_t *default_rc,
- mongoc_write_concern_t *default_wc,
- bson_t *reply,
- bson_error_t *error)
-{
- mongoc_read_write_opts_t read_write_opts;
- mongoc_cmd_parts_t parts;
- const char *command_name;
- const mongoc_read_prefs_t *prefs = COALESCE (user_prefs, default_prefs);
- mongoc_server_stream_t *server_stream = NULL;
- mongoc_cluster_t *cluster;
- mongoc_client_session_t *cs;
- bson_t reply_local;
- bson_t *reply_ptr;
- int32_t wire_version;
- int32_t wc_wire_version;
- bool reply_initialized = false;
- bool ret = false;
-
- ENTRY;
-
- BSON_ASSERT (client);
- BSON_ASSERT (db_name);
- BSON_ASSERT (command);
-
- command_name = _mongoc_get_command_name (command);
- cluster = &client->cluster;
- reply_ptr = reply ? reply : &reply_local;
-
- mongoc_cmd_parts_init (&parts, client, db_name, flags, command);
- parts.is_read_command = (mode & MONGOC_CMD_READ);
- parts.is_write_command = (mode & MONGOC_CMD_WRITE);
-
- if (!_mongoc_read_write_opts_parse (client, opts, &read_write_opts, error)) {
- GOTO (done);
- }
-
- cs = read_write_opts.client_session;
-
- if (!command_name) {
- bson_set_error (error,
- MONGOC_ERROR_COMMAND,
- MONGOC_ERROR_COMMAND_INVALID_ARG,
- "Empty command document");
- GOTO (done);
- }
-
- if (_mongoc_client_session_in_txn (read_write_opts.client_session)) {
- if ((mode == MONGOC_CMD_READ || mode == MONGOC_CMD_RAW) &&
- !IS_PREF_PRIMARY (user_prefs)) {
- bson_set_error (error,
- MONGOC_ERROR_COMMAND,
- MONGOC_ERROR_COMMAND_INVALID_ARG,
- "Read preference in a transaction must be primary");
- GOTO (done);
- }
-
- if (!bson_empty (&read_write_opts.readConcern)) {
- bson_set_error (error,
- MONGOC_ERROR_COMMAND,
- MONGOC_ERROR_COMMAND_INVALID_ARG,
- "Cannot set read concern after starting transaction");
- GOTO (done);
- }
-
- if (read_write_opts.writeConcern &&
- strcmp (command_name, "commitTransaction") != 0 &&
- strcmp (command_name, "abortTransaction") != 0) {
- bson_set_error (error,
- MONGOC_ERROR_COMMAND,
- MONGOC_ERROR_COMMAND_INVALID_ARG,
- "Cannot set write concern after starting transaction");
- GOTO (done);
- }
- }
-
- if (mode == MONGOC_CMD_READ || mode == MONGOC_CMD_RAW) {
- /* NULL read pref is ok */
- if (!_mongoc_read_prefs_validate (prefs, error)) {
- GOTO (done);
- }
-
- parts.read_prefs = prefs;
- } else {
- /* this is a command that writes */
- prefs = NULL;
- }
-
- if (read_write_opts.serverId) {
- /* "serverId" passed in opts */
- server_stream =
- mongoc_cluster_stream_for_server (cluster,
- read_write_opts.serverId,
- true /* reconnect ok */,
- cs,
- reply_ptr,
- error);
-
- if (server_stream && server_stream->sd->type != MONGOC_SERVER_MONGOS) {
- parts.user_query_flags |= MONGOC_QUERY_SLAVE_OK;
- }
- } else if (parts.is_write_command) {
- server_stream =
- mongoc_cluster_stream_for_writes (cluster, cs, reply_ptr, error);
- } else {
- server_stream =
- mongoc_cluster_stream_for_reads (cluster, prefs, cs, reply_ptr, error);
- }
-
- if (!server_stream) {
- /* stream_for_reads/writes/server has initialized reply */
- reply_initialized = true;
- GOTO (done);
- }
-
- wire_version = server_stream->sd->max_wire_version;
- if (!mongoc_cmd_parts_append_read_write (
- &parts, &read_write_opts, wire_version, error)) {
- GOTO (done);
- }
-
- if (mode & MONGOC_CMD_WRITE) {
- wc_wire_version = !strcasecmp (command_name, "findandmodify")
- ? WIRE_VERSION_FAM_WRITE_CONCERN
- : WIRE_VERSION_CMD_WRITE_CONCERN;
-
- if (read_write_opts.write_concern_owned &&
- wire_version < wc_wire_version) {
- bson_set_error (error,
- MONGOC_ERROR_COMMAND,
- MONGOC_ERROR_PROTOCOL_BAD_WIRE_VERSION,
- "\"%s\" command does not support writeConcern with "
- "wire version %d, wire version %d is required",
- command_name,
- wire_version,
- wc_wire_version);
- GOTO (done);
- }
-
- /* use default write concern unless it's in opts */
- if (!mongoc_write_concern_is_default (default_wc) &&
- !read_write_opts.write_concern_owned &&
- wire_version >= wc_wire_version) {
- if (!mongoc_cmd_parts_set_write_concern (
- &parts, default_wc, wire_version, error)) {
- GOTO (done);
- }
- }
- }
-
- /* use default read concern for read command, unless it's in opts */
- if ((mode & MONGOC_CMD_READ) && bson_empty (&read_write_opts.readConcern)) {
- if (!mongoc_cmd_parts_set_read_concern (
- &parts, default_rc, wire_version, error)) {
- GOTO (done);
- }
- }
-
- ret = _mongoc_client_command_with_stream (
- client, &parts, user_prefs, server_stream, reply_ptr, error);
-
- reply_initialized = true;
-
- if (ret && (mode & MONGOC_CMD_WRITE)) {
- ret = !_mongoc_parse_wc_err (reply_ptr, error);
- }
-
-done:
- if (reply_ptr == &reply_local) {
- if (reply_initialized) {
- bson_destroy (reply_ptr);
- }
- } else if (!reply_initialized) {
- _mongoc_bson_init_if_set (reply);
- }
-
- if (server_stream) {
- mongoc_server_stream_cleanup (server_stream);
- }
-
- mongoc_cmd_parts_cleanup (&parts);
- _mongoc_read_write_opts_cleanup (&read_write_opts);
-
- RETURN (ret);
-}
-
-
-bool
-mongoc_client_read_command_with_opts (mongoc_client_t *client,
- const char *db_name,
- const bson_t *command,
- const mongoc_read_prefs_t *read_prefs,
- const bson_t *opts,
- bson_t *reply,
- bson_error_t *error)
-{
- return _mongoc_client_command_with_opts (client,
- db_name,
- command,
- MONGOC_CMD_READ,
- opts,
- MONGOC_QUERY_NONE,
- read_prefs,
- client->read_prefs,
- client->read_concern,
- client->write_concern,
- reply,
- error);
-}
-
-
-bool
-mongoc_client_write_command_with_opts (mongoc_client_t *client,
- const char *db_name,
- const bson_t *command,
- const bson_t *opts,
- bson_t *reply,
- bson_error_t *error)
-{
- return _mongoc_client_command_with_opts (client,
- db_name,
- command,
- MONGOC_CMD_WRITE,
- opts,
- MONGOC_QUERY_NONE,
- NULL,
- client->read_prefs,
- client->read_concern,
- client->write_concern,
- reply,
- error);
-}
-
-
-bool
-mongoc_client_read_write_command_with_opts (
- mongoc_client_t *client,
- const char *db_name,
- const bson_t *command,
- const mongoc_read_prefs_t *read_prefs /* IGNORED */,
- const bson_t *opts,
- bson_t *reply,
- bson_error_t *error)
-{
- return _mongoc_client_command_with_opts (client,
- db_name,
- command,
- MONGOC_CMD_RW,
- opts,
- MONGOC_QUERY_NONE,
- read_prefs,
- client->read_prefs,
- client->read_concern,
- client->write_concern,
- reply,
- error);
-}
-
-
-bool
-mongoc_client_command_with_opts (mongoc_client_t *client,
- const char *db_name,
- const bson_t *command,
- const mongoc_read_prefs_t *read_prefs,
- const bson_t *opts,
- bson_t *reply,
- bson_error_t *error)
-{
- return _mongoc_client_command_with_opts (client,
- db_name,
- command,
- MONGOC_CMD_RAW,
- opts,
- MONGOC_QUERY_NONE,
- read_prefs,
- NULL,
- client->read_concern,
- client->write_concern,
- reply,
- error);
-}
-
-
-bool
-mongoc_client_command_simple_with_server_id (
- mongoc_client_t *client,
- const char *db_name,
- const bson_t *command,
- const mongoc_read_prefs_t *read_prefs,
- uint32_t server_id,
- bson_t *reply,
- bson_error_t *error)
-{
- mongoc_server_stream_t *server_stream;
- mongoc_cmd_parts_t parts;
- bool ret;
-
- ENTRY;
-
- BSON_ASSERT (client);
- BSON_ASSERT (db_name);
- BSON_ASSERT (command);
-
- if (!_mongoc_read_prefs_validate (read_prefs, error)) {
- RETURN (false);
- }
-
- server_stream = mongoc_cluster_stream_for_server (
- &client->cluster, server_id, true /* reconnect ok */, NULL, reply, error);
-
- if (server_stream) {
- mongoc_cmd_parts_init (
- &parts, client, db_name, MONGOC_QUERY_NONE, command);
- parts.read_prefs = read_prefs;
-
- ret = _mongoc_client_command_with_stream (
- client, &parts, read_prefs, server_stream, reply, error);
-
- mongoc_cmd_parts_cleanup (&parts);
- mongoc_server_stream_cleanup (server_stream);
- RETURN (ret);
- } else {
- /* stream_for_server initialized reply */
- RETURN (false);
- }
-}
-
-
-static void
-_mongoc_client_prepare_killcursors_command (int64_t cursor_id,
- const char *collection,
- bson_t *command)
-{
- bson_t child;
-
- bson_append_utf8 (command, "killCursors", 11, collection, -1);
- bson_append_array_begin (command, "cursors", 7, &child);
- bson_append_int64 (&child, "0", 1, cursor_id);
- bson_append_array_end (command, &child);
-}
-
-
-void
-_mongoc_client_kill_cursor (mongoc_client_t *client,
- uint32_t server_id,
- int64_t cursor_id,
- int64_t operation_id,
- const char *db,
- const char *collection,
- mongoc_client_session_t *cs)
-{
- mongoc_server_stream_t *server_stream;
-
- ENTRY;
-
- BSON_ASSERT (client);
- BSON_ASSERT (cursor_id);
-
- /* don't attempt reconnect if server unavailable, and ignore errors */
- server_stream = mongoc_cluster_stream_for_server (
- &client->cluster, server_id, false /* reconnect_ok */, NULL, NULL, NULL);
-
- if (!server_stream) {
- return;
- }
-
- if (db && collection &&
- server_stream->sd->max_wire_version >= WIRE_VERSION_KILLCURSORS_CMD) {
- _mongoc_client_killcursors_command (
- &client->cluster, server_stream, cursor_id, db, collection, cs);
- } else {
- _mongoc_client_op_killcursors (&client->cluster,
- server_stream,
- cursor_id,
- operation_id,
- db,
- collection);
- }
-
- mongoc_server_stream_cleanup (server_stream);
-
- EXIT;
-}
-
-
-static void
-_mongoc_client_monitor_op_killcursors (mongoc_cluster_t *cluster,
- mongoc_server_stream_t *server_stream,
- int64_t cursor_id,
- int64_t operation_id,
- const char *db,
- const char *collection)
-{
- bson_t doc;
- mongoc_client_t *client;
- mongoc_apm_command_started_t event;
-
- ENTRY;
-
- client = cluster->client;
-
- if (!client->apm_callbacks.started) {
- return;
- }
-
- bson_init (&doc);
- _mongoc_client_prepare_killcursors_command (cursor_id, collection, &doc);
- mongoc_apm_command_started_init (&event,
- &doc,
- db,
- "killCursors",
- cluster->request_id,
- 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);
-
- EXIT;
-}
-
-
-static void
-_mongoc_client_monitor_op_killcursors_succeeded (
- mongoc_cluster_t *cluster,
- int64_t duration,
- mongoc_server_stream_t *server_stream,
- int64_t cursor_id,
- int64_t operation_id)
-{
- mongoc_client_t *client;
- bson_t doc;
- bson_t cursors_unknown;
- mongoc_apm_command_succeeded_t event;
-
- ENTRY;
-
- client = cluster->client;
-
- if (!client->apm_callbacks.succeeded) {
- EXIT;
- }
-
- /* fake server reply to killCursors command: {ok: 1, cursorsUnknown: [42]} */
- bson_init (&doc);
- bson_append_int32 (&doc, "ok", 2, 1);
- bson_append_array_begin (&doc, "cursorsUnknown", 14, &cursors_unknown);
- bson_append_int64 (&cursors_unknown, "0", 1, cursor_id);
- bson_append_array_end (&doc, &cursors_unknown);
-
- mongoc_apm_command_succeeded_init (&event,
- duration,
- &doc,
- "killCursors",
- cluster->request_id,
- operation_id,
- &server_stream->sd->host,
- server_stream->sd->id,
- client->apm_context);
-
- client->apm_callbacks.succeeded (&event);
-
- mongoc_apm_command_succeeded_cleanup (&event);
- bson_destroy (&doc);
-}
-
-
-static void
-_mongoc_client_monitor_op_killcursors_failed (
- mongoc_cluster_t *cluster,
- int64_t duration,
- mongoc_server_stream_t *server_stream,
- const bson_error_t *error,
- int64_t operation_id)
-{
- mongoc_client_t *client;
- bson_t doc;
- mongoc_apm_command_failed_t event;
-
- ENTRY;
-
- client = cluster->client;
-
- if (!client->apm_callbacks.failed) {
- EXIT;
- }
-
- /* fake server reply to killCursors command: {ok: 0} */
- bson_init (&doc);
- bson_append_int32 (&doc, "ok", 2, 0);
-
- mongoc_apm_command_failed_init (&event,
- duration,
- "killCursors",
- error,
- &doc,
- cluster->request_id,
- operation_id,
- &server_stream->sd->host,
- server_stream->sd->id,
- client->apm_context);
-
- client->apm_callbacks.failed (&event);
-
- mongoc_apm_command_failed_cleanup (&event);
- bson_destroy (&doc);
-}
-
-
-static void
-_mongoc_client_op_killcursors (mongoc_cluster_t *cluster,
- mongoc_server_stream_t *server_stream,
- int64_t cursor_id,
- int64_t operation_id,
- const char *db,
- const char *collection)
-{
- int64_t started;
- mongoc_rpc_t rpc = {{0}};
- bson_error_t error;
- bool has_ns;
- bool r;
-
- /* called by old mongoc_client_kill_cursor without db/collection? */
- has_ns = (db && collection);
- started = bson_get_monotonic_time ();
-
- ++cluster->request_id;
-
- rpc.header.msg_len = 0;
- rpc.header.request_id = cluster->request_id;
- rpc.header.response_to = 0;
- rpc.header.opcode = MONGOC_OPCODE_KILL_CURSORS;
- rpc.kill_cursors.zero = 0;
- rpc.kill_cursors.cursors = &cursor_id;
- rpc.kill_cursors.n_cursors = 1;
-
- if (has_ns) {
- _mongoc_client_monitor_op_killcursors (
- cluster, server_stream, cursor_id, operation_id, db, collection);
- }
-
- r = mongoc_cluster_legacy_rpc_sendv_to_server (
- cluster, &rpc, server_stream, &error);
-
- if (has_ns) {
- if (r) {
- _mongoc_client_monitor_op_killcursors_succeeded (
- cluster,
- bson_get_monotonic_time () - started,
- server_stream,
- cursor_id,
- operation_id);
- } else {
- _mongoc_client_monitor_op_killcursors_failed (
- cluster,
- bson_get_monotonic_time () - started,
- server_stream,
- &error,
- operation_id);
- }
- }
-}
-
-
-static void
-_mongoc_client_killcursors_command (mongoc_cluster_t *cluster,
- mongoc_server_stream_t *server_stream,
- int64_t cursor_id,
- const char *db,
- const char *collection,
- mongoc_client_session_t *cs)
-{
- bson_t command = BSON_INITIALIZER;
- mongoc_cmd_parts_t parts;
-
- ENTRY;
-
- _mongoc_client_prepare_killcursors_command (cursor_id, collection, &command);
- mongoc_cmd_parts_init (
- &parts, cluster->client, db, MONGOC_QUERY_SLAVE_OK, &command);
- parts.assembled.operation_id = ++cluster->operation_id;
- mongoc_cmd_parts_set_session (&parts, cs);
-
- if (mongoc_cmd_parts_assemble (&parts, server_stream, NULL)) {
- /* Find, getMore And killCursors Commands Spec: "The result from the
- * killCursors command MAY be safely ignored."
- */
- (void) mongoc_cluster_run_command_monitored (
- cluster, &parts.assembled, NULL, NULL);
- }
-
- mongoc_cmd_parts_cleanup (&parts);
- bson_destroy (&command);
-
- EXIT;
-}
-
-
-/*
- *--------------------------------------------------------------------------
- *
- * mongoc_client_kill_cursor --
- *
- * Destroy a cursor on the server.
- *
- * NOTE: this is only reliable when connected to a single mongod or
- * mongos. If connected to a replica set, the driver attempts to
- * kill the cursor on the primary. If connected to multiple mongoses
- * the kill-cursors message is sent to a *random* mongos.
- *
- * If no primary, mongos, or standalone server is known, return
- * without attempting to reconnect.
- *
- * Returns:
- * None.
- *
- * Side effects:
- * None.
- *
- *--------------------------------------------------------------------------
- */
-
-void
-mongoc_client_kill_cursor (mongoc_client_t *client, int64_t cursor_id)
-{
- mongoc_topology_t *topology;
- mongoc_server_description_t *selected_server;
- mongoc_read_prefs_t *read_prefs;
- bson_error_t error;
- uint32_t server_id = 0;
-
- topology = client->topology;
- read_prefs = mongoc_read_prefs_new (MONGOC_READ_PRIMARY);
-
- bson_mutex_lock (&topology->mutex);
- if (!mongoc_topology_compatible (&topology->description, NULL, &error)) {
- MONGOC_ERROR ("Could not kill cursor: %s", error.message);
- bson_mutex_unlock (&topology->mutex);
- mongoc_read_prefs_destroy (read_prefs);
- return;
- }
-
- /* see if there's a known writable server - do no I/O or retries */
- selected_server =
- mongoc_topology_description_select (&topology->description,
- MONGOC_SS_WRITE,
- read_prefs,
- topology->local_threshold_msec);
-
- if (selected_server) {
- server_id = selected_server->id;
- }
-
- bson_mutex_unlock (&topology->mutex);
-
- if (server_id) {
- _mongoc_client_kill_cursor (client,
- server_id,
- cursor_id,
- 0 /* operation_id */,
- NULL /* db */,
- NULL /* collection */,
- NULL /* session */);
- } else {
- MONGOC_INFO ("No server available for mongoc_client_kill_cursor");
- }
-
- mongoc_read_prefs_destroy (read_prefs);
-}
-
-
-char **
-mongoc_client_get_database_names (mongoc_client_t *client, bson_error_t *error)
-{
- return mongoc_client_get_database_names_with_opts (client, NULL, error);
-}
-
-
-char **
-mongoc_client_get_database_names_with_opts (mongoc_client_t *client,
- const bson_t *opts,
- bson_error_t *error)
-{
- bson_iter_t iter;
- const char *name;
- char **ret = NULL;
- int i = 0;
- mongoc_cursor_t *cursor;
- const bson_t *doc;
- bson_t cmd = BSON_INITIALIZER;
-
- BSON_ASSERT (client);
- BSON_APPEND_INT32 (&cmd, "listDatabases", 1);
- BSON_APPEND_BOOL (&cmd, "nameOnly", true);
-
- /* ignore client read prefs */
- cursor = _mongoc_cursor_array_new (client, "admin", &cmd, opts, "databases");
- bson_destroy (&cmd);
-
- while (mongoc_cursor_next (cursor, &doc)) {
- if (bson_iter_init (&iter, doc) && bson_iter_find (&iter, "name") &&
- BSON_ITER_HOLDS_UTF8 (&iter) &&
- (name = bson_iter_utf8 (&iter, NULL))) {
- ret = (char **) bson_realloc (ret, sizeof (char *) * (i + 2));
- ret[i] = bson_strdup (name);
- ret[++i] = NULL;
- }
- }
-
- if (!ret && !mongoc_cursor_error (cursor, error)) {
- ret = (char **) bson_malloc0 (sizeof (void *));
- }
-
- mongoc_cursor_destroy (cursor);
-
- return ret;
-}
-
-
-mongoc_cursor_t *
-mongoc_client_find_databases (mongoc_client_t *client, bson_error_t *error)
-{
- /* existing bug in this deprecated API: error pointer is unused */
- return mongoc_client_find_databases_with_opts (client, NULL);
-}
-
-
-mongoc_cursor_t *
-mongoc_client_find_databases_with_opts (mongoc_client_t *client,
- const bson_t *opts)
-{
- bson_t cmd = BSON_INITIALIZER;
- mongoc_cursor_t *cursor;
-
- BSON_ASSERT (client);
- BSON_APPEND_INT32 (&cmd, "listDatabases", 1);
- cursor = _mongoc_cursor_array_new (client, "admin", &cmd, opts, "databases");
- bson_destroy (&cmd);
- return cursor;
-}
-
-
-int32_t
-mongoc_client_get_max_message_size (mongoc_client_t *client) /* IN */
-{
- BSON_ASSERT (client);
-
- return mongoc_cluster_get_max_msg_size (&client->cluster);
-}
-
-
-int32_t
-mongoc_client_get_max_bson_size (mongoc_client_t *client) /* IN */
-{
- BSON_ASSERT (client);
-
- return mongoc_cluster_get_max_bson_obj_size (&client->cluster);
-}
-
-
-bool
-mongoc_client_get_server_status (mongoc_client_t *client, /* IN */
- mongoc_read_prefs_t *read_prefs, /* IN */
- bson_t *reply, /* OUT */
- bson_error_t *error) /* OUT */
-{
- bson_t cmd = BSON_INITIALIZER;
- bool ret = false;
-
- BSON_ASSERT (client);
-
- BSON_APPEND_INT32 (&cmd, "serverStatus", 1);
- ret = mongoc_client_command_simple (
- client, "admin", &cmd, read_prefs, reply, error);
- bson_destroy (&cmd);
-
- return ret;
-}
-
-
-void
-mongoc_client_set_stream_initiator (mongoc_client_t *client,
- mongoc_stream_initiator_t initiator,
- void *user_data)
-{
- BSON_ASSERT (client);
-
- if (!initiator) {
- initiator = mongoc_client_default_stream_initiator;
- user_data = client;
- } else {
- MONGOC_DEBUG ("Using custom stream initiator.");
- }
-
- client->initiator = initiator;
- client->initiator_data = user_data;
-
- if (client->topology->single_threaded) {
- mongoc_topology_scanner_set_stream_initiator (
- client->topology->scanner, initiator, user_data);
- }
-}
-
-
-bool
-_mongoc_client_set_apm_callbacks_private (mongoc_client_t *client,
- mongoc_apm_callbacks_t *callbacks,
- void *context)
-{
- if (callbacks) {
- memcpy (
- &client->apm_callbacks, callbacks, sizeof (mongoc_apm_callbacks_t));
- } else {
- memset (&client->apm_callbacks, 0, sizeof (mongoc_apm_callbacks_t));
- }
-
- client->apm_context = context;
-
- /* A client pool sets APM callbacks for the entire pool. */
- if (client->topology->single_threaded) {
- mongoc_topology_set_apm_callbacks (client->topology, callbacks, context);
- }
-
- return true;
-}
-
-
-bool
-mongoc_client_set_apm_callbacks (mongoc_client_t *client,
- mongoc_apm_callbacks_t *callbacks,
- void *context)
-{
- if (!client->topology->single_threaded) {
- MONGOC_ERROR ("Cannot set callbacks on a pooled client, use "
- "mongoc_client_pool_set_apm_callbacks");
- return false;
- }
-
- return _mongoc_client_set_apm_callbacks_private (client, callbacks, context);
-}
-
-
-mongoc_server_description_t *
-mongoc_client_get_server_description (mongoc_client_t *client,
- uint32_t server_id)
-{
- /* the error info isn't useful */
- return mongoc_topology_server_by_id (client->topology, server_id, NULL);
-}
-
-
-mongoc_server_description_t **
-mongoc_client_get_server_descriptions (const mongoc_client_t *client,
- size_t *n /* OUT */)
-{
- mongoc_topology_t *topology;
- mongoc_server_description_t **sds;
-
- BSON_ASSERT (client);
- BSON_ASSERT (n);
-
- topology = client->topology;
-
- /* in case the client is pooled */
- bson_mutex_lock (&topology->mutex);
-
- sds = mongoc_topology_description_get_servers (&topology->description, n);
-
- bson_mutex_unlock (&topology->mutex);
-
- return sds;
-}
-
-
-void
-mongoc_server_descriptions_destroy_all (mongoc_server_description_t **sds,
- size_t n)
-{
- size_t i;
-
- for (i = 0; i < n; ++i) {
- mongoc_server_description_destroy (sds[i]);
- }
-
- bson_free (sds);
-}
-
-
-mongoc_server_description_t *
-mongoc_client_select_server (mongoc_client_t *client,
- bool for_writes,
- const mongoc_read_prefs_t *prefs,
- bson_error_t *error)
-{
- mongoc_ss_optype_t optype = for_writes ? MONGOC_SS_WRITE : MONGOC_SS_READ;
- mongoc_server_description_t *sd;
-
- if (for_writes && prefs) {
- bson_set_error (error,
- MONGOC_ERROR_SERVER_SELECTION,
- MONGOC_ERROR_SERVER_SELECTION_FAILURE,
- "Cannot use read preferences with for_writes = true");
- return NULL;
- }
-
- if (!_mongoc_read_prefs_validate (prefs, error)) {
- return NULL;
- }
-
- sd = mongoc_topology_select (client->topology, optype, prefs, error);
- if (!sd) {
- return NULL;
- }
-
- if (mongoc_cluster_check_interval (&client->cluster, sd->id)) {
- /* check not required, or it succeeded */
- return sd;
- }
-
- /* check failed, retry once */
- mongoc_server_description_destroy (sd);
- sd = mongoc_topology_select (client->topology, optype, prefs, error);
- if (sd) {
- return sd;
- }
-
- return NULL;
-}
-
-bool
-mongoc_client_set_error_api (mongoc_client_t *client, int32_t version)
-{
- if (!client->topology->single_threaded) {
- MONGOC_ERROR ("Cannot set Error API Version on a pooled client, use "
- "mongoc_client_pool_set_error_api");
- return false;
- }
-
- if (version != MONGOC_ERROR_API_VERSION_LEGACY &&
- version != MONGOC_ERROR_API_VERSION_2) {
- MONGOC_ERROR ("Unsupported Error API Version: %" PRId32, version);
- return false;
- }
-
- if (client->error_api_set) {
- MONGOC_ERROR ("Can only set Error API Version once");
- return false;
- }
-
- client->error_api_version = version;
- client->error_api_set = true;
-
- return true;
-}
-
-bool
-mongoc_client_set_appname (mongoc_client_t *client, const char *appname)
-{
- if (!client->topology->single_threaded) {
- MONGOC_ERROR ("Cannot call set_appname on a client from a pool");
- return false;
- }
-
- return _mongoc_topology_set_appname (client->topology, appname);
-}
-
-mongoc_server_session_t *
-_mongoc_client_pop_server_session (mongoc_client_t *client, bson_error_t *error)
-{
- return _mongoc_topology_pop_server_session (client->topology, error);
-}
-
-/*
- *--------------------------------------------------------------------------
- *
- * _mongoc_client_lookup_session --
- *
- * Retrieve a mongoc_client_session_t associated with @client_session_id.
- * Use this to find the "lsid" and "$clusterTime" to send in the server
- * command.
- *
- * Returns:
- * True on success, false on error and @error is set. Will return false
- * if the session is from an outdated client generation, a holdover
- * from before a call to mongoc_client_reset.
- *
- * Side effects:
- * None.
- *
- *--------------------------------------------------------------------------
- */
-bool
-_mongoc_client_lookup_session (const mongoc_client_t *client,
- uint32_t client_session_id,
- mongoc_client_session_t **cs /* OUT */,
- bson_error_t *error /* OUT */)
-{
- ENTRY;
-
- *cs = mongoc_set_get (client->client_sessions, client_session_id);
-
- if (*cs) {
- RETURN (true);
- }
-
- bson_set_error (error,
- MONGOC_ERROR_COMMAND,
- MONGOC_ERROR_COMMAND_INVALID_ARG,
- "Invalid sessionId");
-
- RETURN (false);
-}
-
-void
-_mongoc_client_unregister_session (mongoc_client_t *client,
- mongoc_client_session_t *session)
-{
- mongoc_set_rm (client->client_sessions, session->client_session_id);
-}
-
-void
-_mongoc_client_push_server_session (mongoc_client_t *client,
- mongoc_server_session_t *server_session)
-{
- _mongoc_topology_push_server_session (client->topology, server_session);
-}
-
-/*
- *--------------------------------------------------------------------------
- *
- * mongoc_client_end_sessions --
- *
- * End all server sessions in the topology's server session pool.
- * Don't block long: if server selection or connecting fails, quit.
- *
- * The server session pool becomes invalid, but may not be empty.
- * Destroy the topology after this without using any sessions.
- *
- *--------------------------------------------------------------------------
- */
-
-void
-_mongoc_client_end_sessions (mongoc_client_t *client)
-{
- mongoc_topology_t *t = client->topology;
- mongoc_read_prefs_t *prefs;
- bson_error_t error;
- uint32_t server_id;
- bson_t cmd;
- mongoc_server_stream_t *stream;
- mongoc_cmd_parts_t parts;
- mongoc_cluster_t *cluster = &client->cluster;
- bool r;
-
- if (t->session_pool) {
- prefs = mongoc_read_prefs_new (MONGOC_READ_PRIMARY_PREFERRED);
- server_id =
- mongoc_topology_select_server_id (t, MONGOC_SS_READ, prefs, &error);
-
- mongoc_read_prefs_destroy (prefs);
- if (!server_id) {
- MONGOC_WARNING ("Couldn't send \"endSessions\": %s", error.message);
- return;
- }
-
- stream = mongoc_cluster_stream_for_server (
- cluster, server_id, false /* reconnect_ok */, NULL, NULL, &error);
-
- if (!stream) {
- MONGOC_WARNING ("Couldn't send \"endSessions\": %s", error.message);
- return;
- }
-
- /* end sessions in chunks */
- while (_mongoc_topology_end_sessions_cmd (t, &cmd)) {
- mongoc_cmd_parts_init (
- &parts, client, "admin", MONGOC_QUERY_SLAVE_OK, &cmd);
- parts.assembled.operation_id = ++cluster->operation_id;
- parts.prohibit_lsid = true;
-
- r = mongoc_cmd_parts_assemble (&parts, stream, &error);
- if (!r) {
- MONGOC_WARNING ("Couldn't construct \"endSessions\" command: %s",
- error.message);
- } else {
- r = mongoc_cluster_run_command_monitored (
- cluster, &parts.assembled, NULL, &error);
-
- if (!r) {
- MONGOC_WARNING ("Couldn't send \"endSessions\": %s",
- error.message);
- }
- }
-
- mongoc_cmd_parts_cleanup (&parts);
-
- if (!mongoc_cluster_stream_valid (cluster, stream)) {
- /* The stream was invalidated as a result of a network error, so we
- * stop sending commands. */
- break;
- }
-
- bson_destroy (&cmd);
- }
-
- bson_destroy (&cmd);
- mongoc_server_stream_cleanup (stream);
- }
-}
-
-void
-mongoc_client_reset (mongoc_client_t *client)
-{
- BSON_ASSERT (client);
-
- client->generation++;
-
- /* Client sessions are owned and destroyed by the user, but we keep
- local pointers to them for reference. On reset, clear our local
- set without destroying the sessions or calling endSessions.
- client_sessions has no dtor, so it won't destroy its items.
-
- Destroying the local cache of client sessions here ensures they
- cannot be used by future operations--lookup for them will fail. */
- mongoc_set_destroy (client->client_sessions);
- client->client_sessions = mongoc_set_new (8, NULL, NULL);
-
- /* Server sessions are owned by us, so we clear the pool on reset. */
- _mongoc_topology_clear_session_pool (client->topology);
-}
-
-mongoc_change_stream_t *
-mongoc_client_watch (mongoc_client_t *client,
- const bson_t *pipeline,
- const bson_t *opts)
-{
- return _mongoc_change_stream_new_from_client (client, pipeline, opts);
-}
-
-bool
-mongoc_client_enable_auto_encryption (mongoc_client_t *client,
- mongoc_auto_encryption_opts_t *opts,
- bson_error_t *error)
-{
- if (!client->topology->single_threaded) {
- bson_set_error (error,
- MONGOC_ERROR_CLIENT,
- MONGOC_ERROR_CLIENT_INVALID_ENCRYPTION_ARG,
- "Cannot enable auto encryption on a pooled client, use "
- "mongoc_client_pool_enable_auto_encryption");
- return false;
- }
- return _mongoc_cse_client_enable_auto_encryption (client, opts, error);
-}
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-config.h b/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-config.h
deleted file mode 100644
index cc690ec9..00000000
--- a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-config.h
+++ /dev/null
@@ -1,414 +0,0 @@
-/*
- * 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/mongoc.h> can be included directly."
-#endif
-
-
-#ifndef MONGOC_CONFIG_H
-#define MONGOC_CONFIG_H
-
-/* MONGOC_USER_SET_CFLAGS is set from config based on what compiler flags were
- * used to compile mongoc */
-#define MONGOC_USER_SET_CFLAGS ""
-
-#define MONGOC_USER_SET_LDFLAGS ""
-
-/* MONGOC_CC is used to determine what C compiler was used to compile mongoc */
-#define MONGOC_CC "cc"
-
-/*
- * MONGOC_ENABLE_SSL_SECURE_CHANNEL is set from configure to determine if we are
- * compiled with Native SSL support on Windows
- */
-#define MONGOC_ENABLE_SSL_SECURE_CHANNEL 0
-
-#if MONGOC_ENABLE_SSL_SECURE_CHANNEL != 1
-# undef MONGOC_ENABLE_SSL_SECURE_CHANNEL
-#endif
-
-
-/*
- * MONGOC_ENABLE_CRYPTO_CNG is set from configure to determine if we are
- * compiled with Native Crypto support on Windows
- */
-#define MONGOC_ENABLE_CRYPTO_CNG 0
-
-#if MONGOC_ENABLE_CRYPTO_CNG != 1
-# undef MONGOC_ENABLE_CRYPTO_CNG
-#endif
-
-
-/*
- * MONGOC_ENABLE_SSL_SECURE_TRANSPORT is set from configure to determine if we are
- * compiled with Native SSL support on Darwin
- */
-#define MONGOC_ENABLE_SSL_SECURE_TRANSPORT 1
-
-#if MONGOC_ENABLE_SSL_SECURE_TRANSPORT != 1
-# undef MONGOC_ENABLE_SSL_SECURE_TRANSPORT
-#endif
-
-
-/*
- * MONGOC_ENABLE_CRYPTO_COMMON_CRYPTO is set from configure to determine if we are
- * compiled with Native Crypto support on Darwin
- */
-#define MONGOC_ENABLE_CRYPTO_COMMON_CRYPTO 1
-
-#if MONGOC_ENABLE_CRYPTO_COMMON_CRYPTO != 1
-# undef MONGOC_ENABLE_CRYPTO_COMMON_CRYPTO
-#endif
-
-
-/*
- * MONGOC_ENABLE_SSL_LIBRESSL is set from configure to determine if we are
- * compiled with LibreSSL support.
- */
-#define MONGOC_ENABLE_SSL_LIBRESSL 0
-
-#if MONGOC_ENABLE_SSL_LIBRESSL != 1
-# undef MONGOC_ENABLE_SSL_LIBRESSL
-#endif
-
-
-/*
- * MONGOC_ENABLE_SSL_OPENSSL is set from configure to determine if we are
- * compiled with OpenSSL support.
- */
-#define MONGOC_ENABLE_SSL_OPENSSL 0
-
-#if MONGOC_ENABLE_SSL_OPENSSL != 1
-# undef MONGOC_ENABLE_SSL_OPENSSL
-#endif
-
-
-/*
- * MONGOC_ENABLE_CRYPTO_LIBCRYPTO is set from configure to determine if we are
- * compiled with OpenSSL support.
- */
-#define MONGOC_ENABLE_CRYPTO_LIBCRYPTO 0
-
-#if MONGOC_ENABLE_CRYPTO_LIBCRYPTO != 1
-# undef MONGOC_ENABLE_CRYPTO_LIBCRYPTO
-#endif
-
-
-/*
- * MONGOC_ENABLE_SSL is set from configure to determine if we are
- * compiled with any SSL support.
- */
-#define MONGOC_ENABLE_SSL 1
-
-#if MONGOC_ENABLE_SSL != 1
-# undef MONGOC_ENABLE_SSL
-#endif
-
-
-/*
- * MONGOC_ENABLE_CRYPTO is set from configure to determine if we are
- * compiled with any crypto support.
- */
-#define MONGOC_ENABLE_CRYPTO 1
-
-#if MONGOC_ENABLE_CRYPTO != 1
-# undef MONGOC_ENABLE_CRYPTO
-#endif
-
-
-/*
- * Use system crypto profile
- */
-#define MONGOC_ENABLE_CRYPTO_SYSTEM_PROFILE 0
-
-#if MONGOC_ENABLE_CRYPTO_SYSTEM_PROFILE != 1
-# undef MONGOC_ENABLE_CRYPTO_SYSTEM_PROFILE
-#endif
-
-
-/*
- * Use ASN1_STRING_get0_data () rather than the deprecated ASN1_STRING_data
- */
-#define MONGOC_HAVE_ASN1_STRING_GET0_DATA 0
-
-#if MONGOC_HAVE_ASN1_STRING_GET0_DATA != 1
-# undef MONGOC_HAVE_ASN1_STRING_GET0_DATA
-#endif
-
-
-/*
- * MONGOC_ENABLE_SASL is set from configure to determine if we are
- * compiled with SASL support.
- */
-#define MONGOC_ENABLE_SASL 1
-
-#if MONGOC_ENABLE_SASL != 1
-# undef MONGOC_ENABLE_SASL
-#endif
-
-
-/*
- * MONGOC_ENABLE_SASL_CYRUS is set from configure to determine if we are
- * compiled with Cyrus SASL support.
- */
-#define MONGOC_ENABLE_SASL_CYRUS 1
-
-#if MONGOC_ENABLE_SASL_CYRUS != 1
-# undef MONGOC_ENABLE_SASL_CYRUS
-#endif
-
-
-/*
- * MONGOC_ENABLE_SASL_SSPI is set from configure to determine if we are
- * compiled with SSPI support.
- */
-#define MONGOC_ENABLE_SASL_SSPI 0
-
-#if MONGOC_ENABLE_SASL_SSPI != 1
-# undef MONGOC_ENABLE_SASL_SSPI
-#endif
-
-/*
- * MONGOC_HAVE_SASL_CLIENT_DONE is set from configure to determine if we
- * have SASL and its version is new enough to use sasl_client_done (),
- * which supersedes sasl_done ().
- */
-#define MONGOC_HAVE_SASL_CLIENT_DONE 1
-
-#if MONGOC_HAVE_SASL_CLIENT_DONE != 1
-# undef MONGOC_HAVE_SASL_CLIENT_DONE
-#endif
-
-
-/*
- * Disable automatic calls to mongoc_init() and mongoc_cleanup()
- * before main() is called, and after exit() (respectively).
- */
-#define MONGOC_NO_AUTOMATIC_GLOBALS 1
-
-#if MONGOC_NO_AUTOMATIC_GLOBALS != 1
-# undef MONGOC_NO_AUTOMATIC_GLOBALS
-#endif
-
-/*
- * MONGOC_HAVE_SOCKLEN is set from configure to determine if we
- * need to emulate the type.
- */
-#define MONGOC_HAVE_SOCKLEN 1
-
-#if MONGOC_HAVE_SOCKLEN != 1
-# undef MONGOC_HAVE_SOCKLEN
-#endif
-
-
-/*
- * MONGOC_HAVE_DNSAPI is set from configure to determine if we should use the
- * Windows dnsapi for SRV record lookups.
- */
-#define MONGOC_HAVE_DNSAPI 0
-
-#if MONGOC_HAVE_DNSAPI != 1
-# undef MONGOC_HAVE_DNSAPI
-#endif
-
-
-/*
- * MONGOC_HAVE_RES_NSEARCH is set from configure to determine if we
- * have thread-safe res_nsearch().
- */
-#define MONGOC_HAVE_RES_NSEARCH 1
-
-#if MONGOC_HAVE_RES_NSEARCH != 1
-# undef MONGOC_HAVE_RES_NSEARCH
-#endif
-
-
-/*
- * MONGOC_HAVE_RES_NDESTROY is set from configure to determine if we
- * have BSD / Darwin's res_ndestroy().
- */
-#define MONGOC_HAVE_RES_NDESTROY 1
-
-#if MONGOC_HAVE_RES_NDESTROY != 1
-# undef MONGOC_HAVE_RES_NDESTROY
-#endif
-
-
-/*
- * MONGOC_HAVE_RES_NCLOSE is set from configure to determine if we
- * have Linux's res_nclose().
- */
-#define MONGOC_HAVE_RES_NCLOSE 0
-
-#if MONGOC_HAVE_RES_NCLOSE != 1
-# undef MONGOC_HAVE_RES_NCLOSE
-#endif
-
-
-/*
- * MONGOC_HAVE_RES_SEARCH is set from configure to determine if we
- * have thread-unsafe res_search(). It's unset if we have the preferred
- * res_nsearch().
- */
-#define MONGOC_HAVE_RES_SEARCH 0
-
-#if MONGOC_HAVE_RES_SEARCH != 1
-# undef MONGOC_HAVE_RES_SEARCH
-#endif
-
-
-/*
- * Set from configure, see
- * https://curl.haxx.se/mail/lib-2009-04/0287.html
- */
-#define MONGOC_SOCKET_ARG2 struct sockaddr
-#define MONGOC_SOCKET_ARG3 socklen_t
-
-/*
- * Enable wire protocol compression negotiation
- *
- */
-#define MONGOC_ENABLE_COMPRESSION 1
-
-#if MONGOC_ENABLE_COMPRESSION != 1
-# undef MONGOC_ENABLE_COMPRESSION
-#endif
-
-/*
- * Set if we have snappy compression support
- *
- */
-#define MONGOC_ENABLE_COMPRESSION_SNAPPY 0
-
-#if MONGOC_ENABLE_COMPRESSION_SNAPPY != 1
-# undef MONGOC_ENABLE_COMPRESSION_SNAPPY
-#endif
-
-
-/*
- * Set if we have zlib compression support
- *
- */
-#define MONGOC_ENABLE_COMPRESSION_ZLIB 1
-
-#if MONGOC_ENABLE_COMPRESSION_ZLIB != 1
-# undef MONGOC_ENABLE_COMPRESSION_ZLIB
-#endif
-
-/*
- * Set if we have zstd compression support
- *
- */
-#define MONGOC_ENABLE_COMPRESSION_ZSTD 1
-
-#if MONGOC_ENABLE_COMPRESSION_ZSTD != 1
-# undef MONGOC_ENABLE_COMPRESSION_ZSTD
-#endif
-
-/*
- * Set if performance counters are available and not disabled.
- *
- */
-#define MONGOC_ENABLE_SHM_COUNTERS 0
-
-#if MONGOC_ENABLE_SHM_COUNTERS != 1
-# undef MONGOC_ENABLE_SHM_COUNTERS
-#endif
-
-/*
- * Set if we have enabled fast counters on Intel using the RDTSCP instruction
- *
- */
-#define MONGOC_ENABLE_RDTSCP 0
-
-#if MONGOC_ENABLE_RDTSCP != 1
-# undef MONGOC_ENABLE_RDTSCP
-#endif
-
-
-/*
- * Set if we have the sched_getcpu() function for use with counters
- *
- */
-#define MONGOC_HAVE_SCHED_GETCPU 0
-
-#if MONGOC_HAVE_SCHED_GETCPU != 1
-# undef MONGOC_HAVE_SCHED_GETCPU
-#endif
-
-/*
- * Set if tracing is enabled. Logs things like network communication and
- * entry/exit of certain functions.
- *
- */
-#define MONGOC_TRACE 1
-
-#if MONGOC_TRACE != 1
-# undef MONGOC_TRACE
-#endif
-
-/*
- * Set if we have ICU support.
- */
-#define MONGOC_ENABLE_ICU 0
-
-#if MONGOC_ENABLE_ICU != 1
-# undef MONGOC_ENABLE_ICU
-#endif
-
-
-/*
- * Set if we have Client Side Encryption support.
- */
-
-#define MONGOC_ENABLE_CLIENT_SIDE_ENCRYPTION 1
-
-#if MONGOC_ENABLE_CLIENT_SIDE_ENCRYPTION != 1
-# undef MONGOC_ENABLE_CLIENT_SIDE_ENCRYPTION
-#endif
-
-
-/*
- * Set if struct sockaddr_storage has __ss_family (instead of ss_family)
- */
-
-#define MONGOC_HAVE_SS_FAMILY 0
-
-#if MONGOC_HAVE_SS_FAMILY != 1
-# undef MONGOC_HAVE_SS_FAMILY
-#endif
-
-/*
- * Set if building with AWS IAM support.
- */
-#define MONGOC_ENABLE_MONGODB_AWS_AUTH 1
-
-#if MONGOC_ENABLE_MONGODB_AWS_AUTH != 1
-# undef MONGOC_ENABLE_MONGODB_AWS_AUTH
-#endif
-
-/*
- * NOTICE:
- * If you're about to update this file and add a config flag, make sure to
- * update:
- * o The bitfield in mongoc-handshake-private.h
- * o _mongoc_handshake_get_config_hex_string() in mongoc-handshake.c
- * o examples/parse_handshake_cfg.py
- * o test_handshake_config_string in test-mongoc-handshake.c
- */
-
-#endif /* MONGOC_CONFIG_H */
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-topology-background-monitoring.c b/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-topology-background-monitoring.c
deleted file mode 100644
index 43fdc2b0..00000000
--- a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-topology-background-monitoring.c
+++ /dev/null
@@ -1,354 +0,0 @@
-/*
- * Copyright 2020-present 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-topology-background-monitoring-private.h"
-
-#include "mongoc-client-private.h"
-#include "mongoc-log-private.h"
-#include "mongoc-server-monitor-private.h"
-#ifdef MONGOC_ENABLE_SSL
-#include "mongoc-ssl-private.h"
-#endif
-#include "mongoc-stream-private.h"
-#include "mongoc-topology-description-apm-private.h"
-#include "mongoc-topology-private.h"
-#include "mongoc-trace-private.h"
-#include "mongoc-util-private.h"
-
-#undef MONGOC_LOG_DOMAIN
-#define MONGOC_LOG_DOMAIN "monitor"
-
-static BSON_THREAD_FUN (srv_polling_run, topology_void)
-{
- mongoc_topology_t *topology;
-
- topology = topology_void;
- bson_mutex_lock (&topology->mutex);
- while (true) {
- int64_t now_ms;
- int64_t scan_due_ms;
- int64_t sleep_duration_ms;
-
- if (topology->scanner_state != MONGOC_TOPOLOGY_SCANNER_BG_RUNNING) {
- bson_mutex_unlock (&topology->mutex);
- break;
- }
-
- /* This will check if a scan is due. */
- mongoc_topology_rescan_srv (topology);
-
- /* Unlock and sleep until next scan is due, or until shutdown signalled.
- */
- now_ms = bson_get_monotonic_time () / 1000;
- scan_due_ms = topology->srv_polling_last_scan_ms +
- topology->srv_polling_rescan_interval_ms;
- sleep_duration_ms = scan_due_ms - now_ms;
-
- if (sleep_duration_ms > 0) {
- TRACE ("srv polling thread sleeping for %" PRId64 "ms",
- sleep_duration_ms);
- }
-
- /* Check for shutdown again here. mongoc_topology_rescan_srv unlocks the
- * topology mutex for the scan. The topology may have shut down in that
- * time. */
- if (topology->scanner_state != MONGOC_TOPOLOGY_SCANNER_BG_RUNNING) {
- bson_mutex_unlock (&topology->mutex);
- break;
- }
-
- /* If shutting down, stop. */
- mongoc_cond_timedwait (
- &topology->srv_polling_cond, &topology->mutex, sleep_duration_ms);
- }
- BSON_THREAD_RETURN;
-}
-
-/* Create a server monitor if necessary.
- *
- * Called by monitor threads and application threads when reconciling the
- * topology description. Caller must have topology mutex locked.
- */
-static void
-_background_monitor_reconcile_server_monitor (mongoc_topology_t *topology,
- mongoc_server_description_t *sd)
-{
- mongoc_set_t *server_monitors;
- mongoc_server_monitor_t *server_monitor;
-
- server_monitors = topology->server_monitors;
- server_monitor = mongoc_set_get (server_monitors, sd->id);
-
- if (!server_monitor) {
- /* Add a new server monitor. */
- server_monitor = mongoc_server_monitor_new (topology, sd);
- mongoc_server_monitor_run (server_monitor);
- mongoc_set_add (server_monitors, sd->id, server_monitor);
- }
-
- /* Check if an RTT monitor is needed. */
- if (!bson_empty (&sd->topology_version)) {
- mongoc_set_t *rtt_monitors;
- mongoc_server_monitor_t *rtt_monitor;
-
- rtt_monitors = topology->rtt_monitors;
- rtt_monitor = mongoc_set_get (rtt_monitors, sd->id);
- if (!rtt_monitor) {
- rtt_monitor = mongoc_server_monitor_new (topology, sd);
- mongoc_server_monitor_run_as_rtt (rtt_monitor);
- mongoc_set_add (rtt_monitors, sd->id, rtt_monitor);
- }
- }
- return;
-}
-
-/* Start background monitoring.
- *
- * Called by an application thread popping a client from a pool. Safe to
- * call repeatedly.
- * Caller must have topology mutex locked.
- */
-void
-_mongoc_topology_background_monitoring_start (mongoc_topology_t *topology)
-{
- BSON_ASSERT (!topology->single_threaded);
-
- if (topology->scanner_state == MONGOC_TOPOLOGY_SCANNER_BG_RUNNING) {
- return;
- }
-
- TRACE ("%s", "background monitoring starting");
-
- BSON_ASSERT (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);
-
- /* Reconcile to create the first server monitors. */
- _mongoc_topology_background_monitoring_reconcile (topology);
- /* Start SRV polling thread. */
- if (mongoc_uri_get_service (topology->uri)) {
- COMMON_PREFIX (thread_create)
- (&topology->srv_polling_thread, srv_polling_run, topology);
- }
-}
-
-/* Remove server monitors that are no longer in the set of server descriptions.
- *
- * Called by monitor threads and application threads when reconciling the
- * topology description. Caller must have topology mutex locked.
- */
-static void
-_remove_orphaned_server_monitors (mongoc_set_t *server_monitors,
- mongoc_set_t *server_descriptions)
-{
- uint32_t *server_monitor_ids_to_remove;
- uint32_t n_server_monitor_ids_to_remove = 0;
- int i;
-
- /* Signal shutdown to server monitors no longer in the topology description.
- */
- server_monitor_ids_to_remove =
- bson_malloc0 (sizeof (uint32_t) * server_monitors->items_len);
- for (i = 0; i < server_monitors->items_len; i++) {
- mongoc_server_monitor_t *server_monitor;
- uint32_t id;
-
- server_monitor = mongoc_set_get_item_and_id (server_monitors, i, &id);
- if (!mongoc_set_get (server_descriptions, id)) {
- if (mongoc_server_monitor_request_shutdown (server_monitor)) {
- mongoc_server_monitor_wait_for_shutdown (server_monitor);
- mongoc_server_monitor_destroy (server_monitor);
- server_monitor_ids_to_remove[n_server_monitor_ids_to_remove] = id;
- n_server_monitor_ids_to_remove++;
- }
- }
- }
-
- /* Remove freed server monitors that have completed shutdown. */
- for (i = 0; i < n_server_monitor_ids_to_remove; i++) {
- mongoc_set_rm (server_monitors, server_monitor_ids_to_remove[i]);
- }
- bson_free (server_monitor_ids_to_remove);
-}
-
-/* Reconcile the topology description with the set of server monitors.
- *
- * Called when the topology description is updated (via handshake, monitoring,
- * or invalidation). May be called by server monitor thread or an application
- * thread.
- * Caller must have topology mutex locked.
- * Locks server monitor mutexes. May join / remove server monitors that have
- * completed shutdown.
- */
-void
-_mongoc_topology_background_monitoring_reconcile (mongoc_topology_t *topology)
-{
- mongoc_topology_description_t *td;
- mongoc_set_t *server_descriptions;
- int i;
-
- td = &topology->description;
- server_descriptions = td->servers;
-
- BSON_ASSERT (!topology->single_threaded);
-
- if (topology->scanner_state != MONGOC_TOPOLOGY_SCANNER_BG_RUNNING) {
- return;
- }
-
- /* Add newly discovered server monitors, and update existing ones. */
- for (i = 0; i < server_descriptions->items_len; i++) {
- mongoc_server_description_t *sd;
-
- sd = mongoc_set_get_item (server_descriptions, i);
- _background_monitor_reconcile_server_monitor (topology, sd);
- }
-
- _remove_orphaned_server_monitors (topology->server_monitors,
- server_descriptions);
- _remove_orphaned_server_monitors (topology->rtt_monitors,
- server_descriptions);
-}
-
-/* Request all server monitors to scan.
- *
- * Called from application threads (during server selection or "not master"
- * errors). Caller must have topology mutex locked. Locks server monitor mutexes
- * to deliver scan_requested.
- */
-void
-_mongoc_topology_background_monitoring_request_scan (
- mongoc_topology_t *topology)
-{
- mongoc_set_t *server_monitors;
- int i;
-
- BSON_ASSERT (!topology->single_threaded);
-
- if (topology->scanner_state == MONGOC_TOPOLOGY_SCANNER_SHUTTING_DOWN) {
- return;
- }
-
- server_monitors = topology->server_monitors;
-
- for (i = 0; i < server_monitors->items_len; i++) {
- mongoc_server_monitor_t *server_monitor;
- uint32_t id;
-
- server_monitor = mongoc_set_get_item_and_id (server_monitors, i, &id);
- mongoc_server_monitor_request_scan (server_monitor);
- }
-}
-
-/* Stop, join, and destroy all server monitors.
- *
- * Called by application threads when destroying a client pool.
- * Caller must have topology mutex locked.
- * Locks server monitor mutexes to deliver shutdown. Releases topology mutex to
- * join server monitor threads. Leaves topology mutex locked on exit. This
- * function is thread-safe. But in practice, it is only ever called by one
- * application thread (because mongoc_client_pool_destroy is not thread-safe).
- */
-void
-_mongoc_topology_background_monitoring_stop (mongoc_topology_t *topology)
-{
- mongoc_server_monitor_t *server_monitor;
- int i;
- bool is_srv_polling;
-
- BSON_ASSERT (!topology->single_threaded);
-
- if (topology->scanner_state != MONGOC_TOPOLOGY_SCANNER_BG_RUNNING) {
- return;
- }
-
- topology->scanner_state = MONGOC_TOPOLOGY_SCANNER_SHUTTING_DOWN;
- TRACE ("%s", "background monitoring stopping");
-
- is_srv_polling = NULL != mongoc_uri_get_service (topology->uri);
- /* Signal SRV polling to shut down (if it is started). */
- if (is_srv_polling) {
- mongoc_cond_signal (&topology->srv_polling_cond);
- }
-
- /* Signal all server monitors to shut down. */
- for (i = 0; i < topology->server_monitors->items_len; i++) {
- server_monitor = mongoc_set_get_item (topology->server_monitors, i);
- mongoc_server_monitor_request_shutdown (server_monitor);
- }
-
- /* Signal all RTT monitors to shut down. */
- for (i = 0; i < topology->rtt_monitors->items_len; i++) {
- server_monitor = mongoc_set_get_item (topology->rtt_monitors, i);
- mongoc_server_monitor_request_shutdown (server_monitor);
- }
-
- /* Some mongoc_server_monitor_t may be waiting for topology mutex. Unlock so
- * they can proceed to terminate. It is safe to unlock topology mutex. Since
- * scanner_state has transitioned to shutting down, no thread can modify
- * server_monitors. */
- bson_mutex_unlock (&topology->mutex);
-
- for (i = 0; i < topology->server_monitors->items_len; i++) {
- /* Wait for the thread to shutdown. */
- server_monitor = mongoc_set_get_item (topology->server_monitors, i);
- mongoc_server_monitor_wait_for_shutdown (server_monitor);
- mongoc_server_monitor_destroy (server_monitor);
- }
-
- for (i = 0; i < topology->rtt_monitors->items_len; i++) {
- /* Wait for the thread to shutdown. */
- server_monitor = mongoc_set_get_item (topology->rtt_monitors, i);
- mongoc_server_monitor_wait_for_shutdown (server_monitor);
- mongoc_server_monitor_destroy (server_monitor);
- }
-
- /* Wait for SRV polling thread. */
- if (is_srv_polling) {
- COMMON_PREFIX (thread_join) (topology->srv_polling_thread);
- }
-
- bson_mutex_lock (&topology->mutex);
- mongoc_set_destroy (topology->server_monitors);
- mongoc_set_destroy (topology->rtt_monitors);
- topology->server_monitors = mongoc_set_new (1, NULL, NULL);
- topology->rtt_monitors = mongoc_set_new (1, NULL, NULL);
- topology->scanner_state = MONGOC_TOPOLOGY_SCANNER_OFF;
- mongoc_cond_broadcast (&topology->cond_client);
-}
-
-/* Cancel an in-progress streaming ismaster for a specific server (if
- * applicable).
- *
- * Called from application threads on network errors.
- * Caller must have topology mutex locked.
- */
-void
-_mongoc_topology_background_monitoring_cancel_check (
- mongoc_topology_t *topology, uint32_t server_id)
-{
- mongoc_server_monitor_t *server_monitor;
-
- server_monitor = mongoc_set_get (topology->server_monitors, server_id);
- if (!server_monitor) {
- /* Already removed. */
- return;
- }
- mongoc_server_monitor_request_cancel (server_monitor);
-}
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-topology-private.h b/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-topology-private.h
deleted file mode 100644
index 7292ebc9..00000000
--- a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-topology-private.h
+++ /dev/null
@@ -1,228 +0,0 @@
-/*
- * 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-prelude.h"
-
-#ifndef MONGOC_TOPOLOGY_PRIVATE_H
-#define MONGOC_TOPOLOGY_PRIVATE_H
-
-#include "mongoc-config.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"
-#include "mongoc-client-session-private.h"
-#include "mongoc-crypt-private.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 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
-#define MONGOC_TOPOLOGY_MIN_RESCAN_SRV_INTERVAL_MS 60000
-
-typedef enum {
- MONGOC_TOPOLOGY_SCANNER_OFF,
- MONGOC_TOPOLOGY_SCANNER_BG_RUNNING,
- MONGOC_TOPOLOGY_SCANNER_SHUTTING_DOWN
-} mongoc_topology_scanner_state_t;
-
-struct _mongoc_background_monitor_t;
-struct _mongoc_client_pool_t;
-
-typedef struct _mongoc_topology_t {
- mongoc_topology_description_t description;
- /* topology->uri is initialized as a copy of the client/pool's URI.
- * For a "mongodb+srv://" URI, topology->uri is then updated in
- * mongoc_topology_new() after initial seedlist discovery.
- * Afterwards, it remains read-only and may be read outside of the topology
- * mutex.
- */
- 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;
- /* defaults to 500ms, configurable by tests */
- int64_t min_heartbeat_frequency_msec;
-
- /* Minimum of SRV record TTLs, but no lower than 60 seconds.
- * May be zero for non-SRV/non-MongoS topology. */
- int64_t srv_polling_rescan_interval_ms;
- int64_t srv_polling_last_scan_ms;
- /* For multi-threaded, srv polling occurs in a separate thread. */
- bson_thread_t srv_polling_thread;
- mongoc_cond_t srv_polling_cond;
-
- bson_mutex_t mutex;
- mongoc_cond_t cond_client;
- mongoc_topology_scanner_state_t scanner_state;
-
- bool single_threaded;
- bool stale;
-
- mongoc_server_session_t *session_pool;
-
- /* Is client side encryption enabled? */
- bool cse_enabled;
-
-#ifdef MONGOC_ENABLE_CLIENT_SIDE_ENCRYPTION
- _mongoc_crypt_t *crypt;
- struct _mongoc_client_t *mongocryptd_client; /* single threaded */
- struct _mongoc_client_t *keyvault_client; /* single threaded */
- struct _mongoc_client_pool_t *mongocryptd_client_pool; /* multi threaded */
- struct _mongoc_client_pool_t *keyvault_client_pool; /* multi threaded */
- char *keyvault_db;
- char *keyvault_coll;
- bool bypass_auto_encryption;
- bool mongocryptd_bypass_spawn;
- char *mongocryptd_spawn_path;
- bson_t *mongocryptd_spawn_args;
-#endif
-
- /* For background monitoring. */
- mongoc_set_t *server_monitors;
- mongoc_set_t *rtt_monitors;
- bson_mutex_t apm_mutex;
-} 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);
-
-void
-mongoc_topology_reconcile (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);
-
-/* TODO: Try to remove this function when CDRIVER-3654 is complete.
- * It is only called when an application thread needs to mark a server Unknown.
- * But an application error is also tied to other behavior, and should also
- * consider the connection generation. This logic is captured in
- * _mongoc_topology_handle_app_error. This should not be called directly
- */
-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);
-
-void
-_mongoc_topology_update_last_used (mongoc_topology_t *topology,
- uint32_t server_id);
-
-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_set_appname (mongoc_topology_t *topology, const char *appname);
-
-void
-_mongoc_topology_update_cluster_time (mongoc_topology_t *topology,
- const bson_t *reply);
-
-mongoc_server_session_t *
-_mongoc_topology_pop_server_session (mongoc_topology_t *topology,
- bson_error_t *error);
-
-void
-_mongoc_topology_push_server_session (mongoc_topology_t *topology,
- mongoc_server_session_t *server_session);
-
-bool
-_mongoc_topology_end_sessions_cmd (mongoc_topology_t *topology, bson_t *cmd);
-
-void
-_mongoc_topology_clear_session_pool (mongoc_topology_t *topology);
-
-void
-_mongoc_topology_do_blocking_scan (mongoc_topology_t *topology,
- bson_error_t *error);
-const bson_t *
-_mongoc_topology_get_ismaster (mongoc_topology_t *topology);
-void
-_mongoc_topology_request_scan (mongoc_topology_t *topology);
-
-void
-_mongoc_topology_bypass_cooldown (mongoc_topology_t *topology);
-
-typedef enum {
- MONGOC_SDAM_APP_ERROR_COMMAND,
- MONGOC_SDAM_APP_ERROR_NETWORK,
- MONGOC_SDAM_APP_ERROR_TIMEOUT
-} _mongoc_sdam_app_error_type_t;
-
-bool
-_mongoc_topology_handle_app_error (mongoc_topology_t *topology,
- uint32_t server_id,
- bool handshake_complete,
- _mongoc_sdam_app_error_type_t type,
- const bson_t *reply,
- const bson_error_t *why,
- uint32_t max_wire_version,
- uint32_t generation);
-
-void
-_mongoc_topology_clear_connection_pool (mongoc_topology_t *topology,
- uint32_t server_id);
-
-void
-mongoc_topology_rescan_srv (mongoc_topology_t *topology);
-#endif
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-topology.c b/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-topology.c
deleted file mode 100644
index 0ca6608c..00000000
--- a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-topology.c
+++ /dev/null
@@ -1,1771 +0,0 @@
-/*
- * 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-host-list-private.h"
-#include "mongoc-log.h"
-#include "mongoc-topology-private.h"
-#include "mongoc-topology-description-apm-private.h"
-#include "mongoc-client-private.h"
-#include "mongoc-cmd-private.h"
-#include "mongoc-uri-private.h"
-#include "mongoc-util-private.h"
-#include "mongoc-trace-private.h"
-#include "mongoc-error-private.h"
-#include "mongoc-topology-background-monitoring-private.h"
-#include "mongoc-read-prefs-private.h"
-
-#include "utlist.h"
-
-static void
-_topology_collect_errors (mongoc_topology_t *topology, bson_error_t *error_out);
-
-static bool
-_mongoc_topology_reconcile_add_nodes (mongoc_server_description_t *sd,
- mongoc_topology_t *topology)
-{
- 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 (scanner, &sd->host, sd->id);
- mongoc_topology_scanner_scan (scanner, sd->id);
- }
-
- return true;
-}
-
-/* Called from:
- * - the topology scanner callback (when an ismaster was just received)
- * - at the start of a single-threaded scan (mongoc_topology_scan_once)
- * Not called for multi threaded monitoring.
- */
-void
-mongoc_topology_reconcile (mongoc_topology_t *topology)
-{
- mongoc_topology_description_t *description;
- mongoc_set_t *servers;
- mongoc_server_description_t *sd;
- int i;
- mongoc_topology_scanner_node_t *ele, *tmp;
-
- description = &topology->description;
- servers = description->servers;
-
- /* Add newly discovered nodes */
- for (i = 0; i < (int) servers->items_len; i++) {
- sd = (mongoc_server_description_t *) mongoc_set_get_item (servers, i);
- _mongoc_topology_reconcile_add_nodes (sd, topology);
- }
-
- /* Remove removed nodes */
- DL_FOREACH_SAFE (topology->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);
-
- /* 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.
- * Only called for single-threaded monitoring.
- *
- *-------------------------------------------------------------------------
- */
-
-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;
- mongoc_server_description_t *sd;
-
- BSON_ASSERT (data);
-
- topology = (mongoc_topology_t *) data;
-
- bson_mutex_lock (&topology->mutex);
- sd = mongoc_topology_description_server_by_id (
- &topology->description, id, NULL);
-
- if (!ismaster_response) {
- /* Server monitoring: When a server check fails due to a network error
- * (including a network timeout), the client MUST clear its connection
- * pool for the server */
- _mongoc_topology_clear_connection_pool (topology, id);
- }
-
- /* Server Discovery and Monitoring Spec: "Once a server is connected, the
- * client MUST change its type to Unknown only after it has retried the
- * server once." */
- if (!ismaster_response && sd && sd->type != MONGOC_SERVER_UNKNOWN) {
- _mongoc_topology_update_no_lock (
- id, ismaster_response, rtt_msec, topology, error);
-
- /* add another ismaster call to the current scan - the scan continues
- * until all commands are done */
- mongoc_topology_scanner_scan (topology->scanner, sd->id);
- } else {
- _mongoc_topology_update_no_lock (
- id, ismaster_response, rtt_msec, topology, 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);
-
- mongoc_cond_broadcast (&topology->cond_client);
- }
-
- bson_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;
- bool topology_valid;
- mongoc_topology_description_type_t init_type;
- const char *service;
- char *prefixed_service;
- uint32_t id;
- const mongoc_host_list_t *hl;
- mongoc_rr_data_t rr_data;
- bool has_directconnection;
- bool directconnection;
-
- BSON_ASSERT (uri);
- topology_valid = false;
-
-#ifndef MONGOC_ENABLE_CRYPTO
- if (mongoc_uri_get_option_as_bool (
- uri, MONGOC_URI_RETRYWRITES, MONGOC_DEFAULT_RETRYWRITES)) {
- /* retryWrites requires sessions, which require crypto - just warn */
- MONGOC_WARNING (
- "retryWrites not supported without an SSL crypto library");
- }
-#endif
-
- topology = (mongoc_topology_t *) bson_malloc0 (sizeof *topology);
- topology->session_pool = NULL;
- 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, MONGOC_URI_HEARTBEATFREQUENCYMS, heartbeat_default);
-
- mongoc_topology_description_init (&topology->description, heartbeat);
-
- topology->description.set_name =
- bson_strdup (mongoc_uri_get_replica_set (uri));
-
- topology->uri = mongoc_uri_copy (uri);
-
- 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, MONGOC_URI_SERVERSELECTIONTRYONCE, true);
- } else {
- topology->server_selection_try_once = false;
- }
-
- topology->server_selection_timeout_msec = mongoc_uri_get_option_as_int32 (
- topology->uri,
- MONGOC_URI_SERVERSELECTIONTIMEOUTMS,
- MONGOC_TOPOLOGY_SERVER_SELECTION_TIMEOUT_MS);
-
- /* tests can override this */
- topology->min_heartbeat_frequency_msec =
- MONGOC_TOPOLOGY_MIN_HEARTBEAT_FREQUENCY_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,
- MONGOC_URI_CONNECTTIMEOUTMS,
- MONGOC_DEFAULT_CONNECTTIMEOUTMS);
-
- 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->connect_timeout_msec);
-
- bson_mutex_init (&topology->mutex);
- mongoc_cond_init (&topology->cond_client);
-
- if (single_threaded) {
- /* single threaded drivers attempt speculative authentication during a
- * topology scan */
- topology->scanner->speculative_authentication = true;
-
- /* single threaded clients negotiate sasl supported mechanisms during
- * a topology scan. */
- if (_mongoc_uri_requires_auth_negotiation (uri)) {
- topology->scanner->negotiate_sasl_supported_mechs = true;
- }
- }
-
- service = mongoc_uri_get_service (uri);
- if (service) {
- memset (&rr_data, 0, sizeof (mongoc_rr_data_t));
-
- /* Initialize the last scan time and interval. Even if the initial DNS
- * lookup fails, SRV polling will still start when background monitoring
- * starts. */
- topology->srv_polling_last_scan_ms = bson_get_monotonic_time () / 1000;
- topology->srv_polling_rescan_interval_ms =
- MONGOC_TOPOLOGY_MIN_RESCAN_SRV_INTERVAL_MS;
-
- /* a mongodb+srv URI. try SRV lookup, if no error then also try TXT */
- prefixed_service = bson_strdup_printf ("_mongodb._tcp.%s", service);
- if (!_mongoc_client_get_rr (prefixed_service,
- MONGOC_RR_SRV,
- &rr_data,
- &topology->scanner->error)) {
- GOTO (srv_fail);
- }
-
- /* Failure to find TXT records will not return an error (since it is only
- * for options). But _mongoc_client_get_rr may return an error if
- * there is more than one TXT record returned. */
- if (!_mongoc_client_get_rr (
- service, MONGOC_RR_TXT, &rr_data, &topology->scanner->error)) {
- GOTO (srv_fail);
- }
-
- /* Use rr_data to update the topology's URI. */
- if (rr_data.txt_record_opts &&
- !mongoc_uri_parse_options (topology->uri,
- rr_data.txt_record_opts,
- true /* from_dns */,
- &topology->scanner->error)) {
- GOTO (srv_fail);
- }
-
- if (!mongoc_uri_init_with_srv_host_list (
- topology->uri, rr_data.hosts, &topology->scanner->error)) {
- GOTO (srv_fail);
- }
-
- topology->srv_polling_last_scan_ms = bson_get_monotonic_time () / 1000;
- topology->srv_polling_rescan_interval_ms = BSON_MAX (
- rr_data.min_ttl * 1000, MONGOC_TOPOLOGY_MIN_RESCAN_SRV_INTERVAL_MS);
-
- topology_valid = true;
- srv_fail:
- bson_free (rr_data.txt_record_opts);
- bson_free (prefixed_service);
- _mongoc_host_list_destroy_all (rr_data.hosts);
- } else {
- topology_valid = true;
- }
-
- /*
- * Set topology type from URI:
- * + if directConnection=true
- * - whether or not we have a replicaSet name, initialize to SINGLE
- * (directConnect with SRV or multiple hosts triggers a URI parse error)
- * + if directConnection=false
- * - if we've got a replicaSet name, initialize to RS_NO_PRIMARY
- * - otherwise, initialize to UNKNOWN
- * + if directConnection was not specified in the URI (old behavior)
- * - 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
- */
- has_directconnection =
- mongoc_uri_has_option (uri, MONGOC_URI_DIRECTCONNECTION);
- directconnection =
- has_directconnection &&
- mongoc_uri_get_option_as_bool (uri, MONGOC_URI_DIRECTCONNECTION, false);
- hl = mongoc_uri_get_hosts (topology->uri);
- if (service && !has_directconnection) {
- init_type = MONGOC_TOPOLOGY_UNKNOWN;
- } else if (has_directconnection) {
- if (directconnection) {
- init_type = MONGOC_TOPOLOGY_SINGLE;
- } else {
- if (mongoc_uri_get_replica_set (topology->uri)) {
- init_type = MONGOC_TOPOLOGY_RS_NO_PRIMARY;
- } else {
- init_type = MONGOC_TOPOLOGY_UNKNOWN;
- }
- }
- } else if (mongoc_uri_get_replica_set (topology->uri)) {
- init_type = MONGOC_TOPOLOGY_RS_NO_PRIMARY;
- } else {
- if (hl && hl->next) {
- init_type = MONGOC_TOPOLOGY_UNKNOWN;
- } else {
- init_type = MONGOC_TOPOLOGY_SINGLE;
- }
- }
-
- topology->description.type = init_type;
-
- if (!topology->single_threaded) {
- topology->server_monitors = mongoc_set_new (1, NULL, NULL);
- topology->rtt_monitors = mongoc_set_new (1, NULL, NULL);
- bson_mutex_init (&topology->apm_mutex);
- mongoc_cond_init (&topology->srv_polling_cond);
- }
-
- if (!topology_valid) {
- TRACE ("%s", "topology invalid");
- /* add no nodes */
- return topology;
- }
-
- while (hl) {
- mongoc_topology_description_add_server (
- &topology->description, hl->host_and_port, &id);
- mongoc_topology_scanner_add (topology->scanner, hl, id);
-
- hl = hl->next;
- }
-
- return topology;
-}
-/*
- *-------------------------------------------------------------------------
- *
- * mongoc_topology_set_apm_callbacks --
- *
- * Set Application Performance Monitoring callbacks.
- *
- * Caller must hold topology->mutex.
- *
- *-------------------------------------------------------------------------
- */
-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));
- } else {
- memset (&topology->description.apm_callbacks,
- 0,
- sizeof (mongoc_apm_callbacks_t));
- memset (
- &topology->scanner->apm_callbacks, 0, 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;
- }
-
-#ifdef MONGOC_ENABLE_CLIENT_SIDE_ENCRYPTION
- bson_free (topology->keyvault_db);
- bson_free (topology->keyvault_coll);
- mongoc_client_destroy (topology->mongocryptd_client);
- mongoc_client_pool_destroy (topology->mongocryptd_client_pool);
- _mongoc_crypt_destroy (topology->crypt);
- bson_destroy (topology->mongocryptd_spawn_args);
- bson_free (topology->mongocryptd_spawn_path);
-#endif
-
- if (!topology->single_threaded) {
- bson_mutex_lock (&topology->mutex);
- _mongoc_topology_background_monitoring_stop (topology);
- bson_mutex_unlock (&topology->mutex);
- BSON_ASSERT (topology->scanner_state == MONGOC_TOPOLOGY_SCANNER_OFF);
- mongoc_set_destroy (topology->server_monitors);
- mongoc_set_destroy (topology->rtt_monitors);
- bson_mutex_destroy (&topology->apm_mutex);
- mongoc_cond_destroy (&topology->srv_polling_cond);
- }
- _mongoc_topology_description_monitor_closed (&topology->description);
-
- mongoc_uri_destroy (topology->uri);
- mongoc_topology_description_destroy (&topology->description);
- mongoc_topology_scanner_destroy (topology->scanner);
-
- /* If we are single-threaded, the client will try to call
- _mongoc_topology_end_sessions_cmd when it dies. This removes
- sessions from the pool as it calls endSessions on them. In
- case this does not succeed, we clear the pool again here. */
- _mongoc_topology_clear_session_pool (topology);
-
- mongoc_cond_destroy (&topology->cond_client);
- bson_mutex_destroy (&topology->mutex);
-
- bson_free (topology);
-}
-
-/*
- *--------------------------------------------------------------------------
- *
- * _mongoc_topology_clear_session_pool --
- *
- * Clears the pool of server sessions without sending endSessions.
- *
- * Returns:
- * Nothing.
- *
- * Side effects:
- * Server session pool will be emptied.
- *
- *--------------------------------------------------------------------------
- */
-
-void
-_mongoc_topology_clear_session_pool (mongoc_topology_t *topology)
-{
- mongoc_server_session_t *ss, *tmp1, *tmp2;
-
- CDL_FOREACH_SAFE (topology->session_pool, ss, tmp1, tmp2)
- {
- _mongoc_server_session_destroy (ss);
- }
- topology->session_pool = NULL;
-}
-
-/* Returns false if none of the hosts were valid. */
-bool
-mongoc_topology_apply_scanned_srv_hosts (mongoc_uri_t *uri,
- mongoc_topology_description_t *td,
- mongoc_host_list_t *hosts,
- bson_error_t *error)
-{
- mongoc_host_list_t *host;
- mongoc_host_list_t *valid_hosts = NULL;
- bool had_valid_hosts = false;
-
- /* Validate that the hosts have a matching domain.
- * If validation fails, log it.
- * If no valid hosts remain, do not update the topology description.
- */
- LL_FOREACH (hosts, host)
- {
- if (mongoc_uri_validate_srv_result (uri, host->host, error)) {
- _mongoc_host_list_upsert (&valid_hosts, host);
- } else {
- MONGOC_ERROR ("Invalid host returned by SRV: %s", host->host_and_port);
- /* Continue on, there may still be valid hosts returned. */
- }
- }
-
- if (valid_hosts) {
- /* Reconcile with the topology description. Newly found servers will start
- * getting monitored and are eligible to be used by clients. */
- mongoc_topology_description_reconcile (td, valid_hosts);
- had_valid_hosts = true;
- } else {
- bson_set_error (error,
- MONGOC_ERROR_STREAM,
- MONGOC_ERROR_STREAM_NAME_RESOLUTION,
- "SRV response did not contain any valid hosts");
- }
-
- _mongoc_host_list_destroy_all (valid_hosts);
- return had_valid_hosts;
-}
-
-/*
- *--------------------------------------------------------------------------
- *
- * mongoc_topology_rescan_srv --
- *
- * Queries SRV records for new hosts in a mongos cluster.
- *
- * NOTE: this method expects @topology's mutex to be locked on entry.
- *
- * --------------------------------------------------------------------------
- */
-void
-mongoc_topology_rescan_srv (mongoc_topology_t *topology)
-{
- mongoc_rr_data_t rr_data = {0};
- const char *service;
- char *prefixed_service = NULL;
- int64_t scan_time_ms;
- bool ret;
-
- if ((topology->description.type != MONGOC_TOPOLOGY_SHARDED) &&
- (topology->description.type != MONGOC_TOPOLOGY_UNKNOWN)) {
- /* Only perform rescan for sharded topology. */
- return;
- }
-
- service = mongoc_uri_get_service (topology->uri);
- if (!service) {
- /* Only rescan if we have a mongodb+srv:// URI. */
- return;
- }
-
- scan_time_ms = topology->srv_polling_last_scan_ms +
- topology->srv_polling_rescan_interval_ms;
- if (bson_get_monotonic_time () / 1000 < scan_time_ms) {
- /* Query SRV no more frequently than srv_polling_rescan_interval_ms. */
- return;
- }
-
- TRACE ("%s", "Polling for SRV records");
-
- /* Go forth and query... */
- prefixed_service = bson_strdup_printf ("_mongodb._tcp.%s", service);
-
- /* Unlock topology mutex during scan so it does not hold up other operations.
- */
- bson_mutex_unlock (&topology->mutex);
- ret = _mongoc_client_get_rr (
- prefixed_service, MONGOC_RR_SRV, &rr_data, &topology->scanner->error);
- bson_mutex_lock (&topology->mutex);
-
- topology->srv_polling_last_scan_ms = bson_get_monotonic_time () / 1000;
- if (!ret) {
- /* Failed querying, soldier on and try again next time. */
- topology->srv_polling_rescan_interval_ms =
- topology->description.heartbeat_msec;
- MONGOC_ERROR ("SRV polling error: %s", topology->scanner->error.message);
- GOTO (done);
- }
-
- topology->srv_polling_rescan_interval_ms = BSON_MAX (
- rr_data.min_ttl * 1000, MONGOC_TOPOLOGY_MIN_RESCAN_SRV_INTERVAL_MS);
-
- if (!mongoc_topology_apply_scanned_srv_hosts (topology->uri,
- &topology->description,
- rr_data.hosts,
- &topology->scanner->error)) {
- MONGOC_ERROR ("%s", topology->scanner->error.message);
- /* Special case when DNS returns zero records successfully or no valid
- * hosts exist.
- * Leave the toplogy alone and perform another scan at the next interval
- * rather than removing all records and having nothing to connect to.
- * For no verified hosts drivers "MUST temporarily set
- * srv_polling_rescan_interval_ms
- * to heartbeatFrequencyMS until at least one verified SRV record is
- * obtained."
- */
- topology->srv_polling_rescan_interval_ms =
- topology->description.heartbeat_msec;
- GOTO (done);
- }
-
-done:
- bson_free (prefixed_service);
- _mongoc_host_list_destroy_all (rr_data.hosts);
-}
-
-
-/*
- *--------------------------------------------------------------------------
- *
- * mongoc_topology_scan_once --
- *
- * Runs a single complete scan.
- *
- * NOTE: this method expects @topology's mutex to be locked on entry.
- *
- * NOTE: this method unlocks and re-locks @topology's mutex.
- *
- * Only runs for single threaded monitoring. (obey_cooldown is always
- * true).
- *
- *--------------------------------------------------------------------------
- */
-static void
-mongoc_topology_scan_once (mongoc_topology_t *topology, bool obey_cooldown)
-{
- /* Prior to scanning hosts, update the list of SRV hosts, if applicable. */
- mongoc_topology_rescan_srv (topology);
-
- /* since the last scan, members may be added or removed from the topology
- * description based on ismaster responses in connection handshakes, see
- * _mongoc_topology_update_from_handshake. retire scanner nodes for removed
- * members and create scanner nodes for new ones. */
- mongoc_topology_reconcile (topology);
- mongoc_topology_scanner_start (topology->scanner, obey_cooldown);
-
- /* scanning locks and unlocks the mutex itself until the scan is done */
- bson_mutex_unlock (&topology->mutex);
- mongoc_topology_scanner_work (topology->scanner);
-
- bson_mutex_lock (&topology->mutex);
-
- _mongoc_topology_scanner_finish (topology->scanner);
-
- topology->last_scan = bson_get_monotonic_time ();
- topology->stale = false;
-}
-
-
-/*
- *--------------------------------------------------------------------------
- *
- * _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.
- *
- *--------------------------------------------------------------------------
- */
-void
-_mongoc_topology_do_blocking_scan (mongoc_topology_t *topology,
- bson_error_t *error)
-{
- _mongoc_handshake_freeze ();
-
- bson_mutex_lock (&topology->mutex);
- mongoc_topology_scan_once (topology, true /* obey cooldown */);
- bson_mutex_unlock (&topology->mutex);
- mongoc_topology_scanner_get_error (topology->scanner, error);
-}
-
-
-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 (td->compatibility_error.code) {
- if (error) {
- memcpy (error, &td->compatibility_error, sizeof (bson_error_t));
- }
- return false;
- }
-
- 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";
-
- mongoc_topology_scanner_t *ts;
- 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);
- ts = topology->scanner;
-
- bson_mutex_lock (&topology->mutex);
- /* It isn't strictly necessary to lock here, because if the topology
- * is invalid, it will never become valid. Lock anyway for consistency. */
- if (!mongoc_topology_scanner_valid (ts)) {
- if (error) {
- mongoc_topology_scanner_get_error (ts, error);
- error->domain = MONGOC_ERROR_SERVER_SELECTION;
- error->code = MONGOC_ERROR_SERVER_SELECTION_FAILURE;
- }
- bson_mutex_unlock (&topology->mutex);
- return 0;
- }
- bson_mutex_unlock (&topology->mutex);
-
- 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 +
- topology->min_heartbeat_frequency_msec * 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);
-
- return 0;
- }
-
- sleep_usec = scan_ready - loop_end;
- if (sleep_usec > 0) {
- if (try_once &&
- mongoc_topology_scanner_in_cooldown (ts, scan_ready)) {
- _mongoc_server_selection_error (
- "No servers yet eligible for rescan",
- &scanner_error,
- error);
-
- return 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 (;;) {
- bson_mutex_lock (&topology->mutex);
-
- if (!mongoc_topology_compatible (
- &topology->description, read_prefs, error)) {
- bson_mutex_unlock (&topology->mutex);
- return 0;
- }
-
- selected_server = mongoc_topology_description_select (
- &topology->description, optype, read_prefs, local_threshold_ms);
-
- if (!selected_server) {
- TRACE (
- "server selection requesting an immediate scan, want %s",
- _mongoc_read_mode_as_str (mongoc_read_prefs_get_mode (read_prefs)));
- _mongoc_topology_request_scan (topology);
-
- TRACE ("server selection about to wait for %" PRId64 "ms",
- (expire_at - loop_start) / 1000);
- r = mongoc_cond_timedwait (&topology->cond_client,
- &topology->mutex,
- (expire_at - loop_start) / 1000);
- TRACE ("%s", "server selection awake");
- _topology_collect_errors (topology, &scanner_error);
-
- bson_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;
- bson_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;
-
- bson_mutex_lock (&topology->mutex);
-
- sd = mongoc_server_description_new_copy (
- mongoc_topology_description_server_by_id (
- &topology->description, id, error));
-
- bson_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;
-
- bson_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));
- }
-
- bson_mutex_unlock (&topology->mutex);
-
- return host;
-}
-
-/*
-
- * Caller must have topology->mutex locked.
- *
- */
-
-void
-_mongoc_topology_request_scan (mongoc_topology_t *topology)
-{
- _mongoc_topology_background_monitoring_request_scan (topology);
-}
-
-/*
- *--------------------------------------------------------------------------
- *
- * 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);
-
- bson_mutex_lock (&topology->mutex);
- mongoc_topology_description_invalidate_server (
- &topology->description, id, error);
- bson_mutex_unlock (&topology->mutex);
-}
-
-/*
- * Update the topology from the response to a handshake on a new application
- * connection.
- * Only applicable to a client pool (single-threaded clients reuse monitoring
- * connections).
- * Caller must not have the topology->mutex locked.
- * Locks topology->mutex.
- * Called only from app threads (not server monitor threads).
- * 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);
- BSON_ASSERT (!topology->single_threaded);
-
- bson_mutex_lock (&topology->mutex);
-
- /* return false if server was removed from topology */
- 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);
- /* Update background monitoring. */
- _mongoc_topology_background_monitoring_reconcile (topology);
- bson_mutex_unlock (&topology->mutex);
-
- return has_server;
-}
-
-/*
- *--------------------------------------------------------------------------
- *
- * _mongoc_topology_update_last_used --
- *
- * Internal function. In single-threaded mode only, track when the socket
- * to a particular server was last used. This is required for
- * mongoc_cluster_check_interval to know when a socket has been idle.
- *
- *--------------------------------------------------------------------------
- */
-
-void
-_mongoc_topology_update_last_used (mongoc_topology_t *topology,
- uint32_t server_id)
-{
- mongoc_topology_scanner_node_t *node;
-
- if (!topology->single_threaded) {
- return;
- }
-
- node = mongoc_topology_scanner_get_node (topology->scanner, server_id);
- if (node) {
- node->last_used = bson_get_monotonic_time ();
- }
-}
-
-
-/*
- *--------------------------------------------------------------------------
- *
- * _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;
-
- bson_mutex_lock (&topology->mutex);
-
- td_type = topology->description.type;
-
- bson_mutex_unlock (&topology->mutex);
-
- return td_type;
-}
-
-bool
-_mongoc_topology_set_appname (mongoc_topology_t *topology, const char *appname)
-{
- bool ret = false;
- bson_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");
- }
- bson_mutex_unlock (&topology->mutex);
- return ret;
-}
-
-/*
- *--------------------------------------------------------------------------
- *
- * _mongoc_topology_update_cluster_time --
- *
- * Internal function. If the server reply has a later $clusterTime than
- * any seen before, update the topology's clusterTime. See the Driver
- * Sessions Spec.
- *
- *--------------------------------------------------------------------------
- */
-
-void
-_mongoc_topology_update_cluster_time (mongoc_topology_t *topology,
- const bson_t *reply)
-{
- bson_mutex_lock (&topology->mutex);
- mongoc_topology_description_update_cluster_time (&topology->description,
- reply);
- _mongoc_topology_scanner_set_cluster_time (
- topology->scanner, &topology->description.cluster_time);
- bson_mutex_unlock (&topology->mutex);
-}
-
-
-/*
- *--------------------------------------------------------------------------
- *
- * _mongoc_topology_pop_server_session --
- *
- * Internal function. Get a server session from the pool or create
- * one. On error, return NULL and fill out @error.
- *
- *--------------------------------------------------------------------------
- */
-
-mongoc_server_session_t *
-_mongoc_topology_pop_server_session (mongoc_topology_t *topology,
- bson_error_t *error)
-{
- int64_t timeout;
- mongoc_server_session_t *ss = NULL;
- mongoc_topology_description_t *td;
-
- ENTRY;
-
- bson_mutex_lock (&topology->mutex);
-
- td = &topology->description;
- timeout = td->session_timeout_minutes;
-
- if (timeout == MONGOC_NO_SESSIONS) {
- /* if needed, connect and check for session timeout again */
- if (!mongoc_topology_description_has_data_node (td)) {
- bson_mutex_unlock (&topology->mutex);
- if (!mongoc_topology_select_server_id (
- topology, MONGOC_SS_READ, NULL, error)) {
- RETURN (NULL);
- }
-
- bson_mutex_lock (&topology->mutex);
- timeout = td->session_timeout_minutes;
- }
-
- if (timeout == MONGOC_NO_SESSIONS) {
- bson_mutex_unlock (&topology->mutex);
- bson_set_error (error,
- MONGOC_ERROR_CLIENT,
- MONGOC_ERROR_CLIENT_SESSION_FAILURE,
- "Server does not support sessions");
- RETURN (NULL);
- }
- }
-
- while (topology->session_pool) {
- ss = topology->session_pool;
- CDL_DELETE (topology->session_pool, ss);
- if (_mongoc_server_session_timed_out (ss, timeout)) {
- _mongoc_server_session_destroy (ss);
- ss = NULL;
- } else {
- break;
- }
- }
-
- bson_mutex_unlock (&topology->mutex);
-
- if (!ss) {
- ss = _mongoc_server_session_new (error);
- }
-
- RETURN (ss);
-}
-
-/*
- *--------------------------------------------------------------------------
- *
- * _mongoc_topology_push_server_session --
- *
- * Internal function. Return a server session to the pool.
- *
- *--------------------------------------------------------------------------
- */
-
-void
-_mongoc_topology_push_server_session (mongoc_topology_t *topology,
- mongoc_server_session_t *server_session)
-{
- int64_t timeout;
- mongoc_server_session_t *ss;
-
- ENTRY;
-
- bson_mutex_lock (&topology->mutex);
-
- timeout = topology->description.session_timeout_minutes;
-
- /* start at back of queue and reap timed-out sessions */
- while (topology->session_pool && topology->session_pool->prev) {
- ss = topology->session_pool->prev;
- if (_mongoc_server_session_timed_out (ss, timeout)) {
- BSON_ASSERT (ss->next); /* silences clang scan-build */
- CDL_DELETE (topology->session_pool, ss);
- _mongoc_server_session_destroy (ss);
- } else {
- /* if ss is not timed out, sessions in front of it are ok too */
- break;
- }
- }
-
- /* If session is expiring or "dirty" (a network error occurred on it), do not
- * return it to the pool. */
- if (_mongoc_server_session_timed_out (server_session, timeout) ||
- server_session->dirty) {
- _mongoc_server_session_destroy (server_session);
- } else {
- /* silences clang scan-build */
- BSON_ASSERT (!topology->session_pool || (topology->session_pool->next &&
- topology->session_pool->prev));
-
- /* add server session (lsid) to session pool to be reused only if the
- * server session has been used (the server is aware of the session) */
- if (server_session->last_used_usec == SESSION_NEVER_USED) {
- _mongoc_server_session_destroy (server_session);
- } else {
- CDL_PREPEND (topology->session_pool, server_session);
- }
- }
-
- bson_mutex_unlock (&topology->mutex);
-
- EXIT;
-}
-
-
-/*
- *--------------------------------------------------------------------------
- *
- * _mongoc_topology_end_sessions_cmd --
- *
- * Internal function. End up to 10,000 server sessions. @cmd is an
- * uninitialized document. Sessions are destroyed as their ids are
- * appended to @cmd.
- *
- * Driver Sessions Spec: "If the number of sessions is very large the
- * endSessions command SHOULD be run multiple times to end 10,000
- * sessions at a time (in order to avoid creating excessively large
- * commands)."
- *
- * Returns:
- * true if any session ids were appended to @cmd.
- *
- *--------------------------------------------------------------------------
- */
-
-bool
-_mongoc_topology_end_sessions_cmd (mongoc_topology_t *topology, bson_t *cmd)
-{
- mongoc_server_session_t *ss, *tmp1, *tmp2;
- char buf[16];
- const char *key;
- uint32_t i;
- bson_t ar;
-
- bson_init (cmd);
- BSON_APPEND_ARRAY_BEGIN (cmd, "endSessions", &ar);
-
- i = 0;
- CDL_FOREACH_SAFE (topology->session_pool, ss, tmp1, tmp2)
- {
- bson_uint32_to_string (i, &key, buf, sizeof buf);
- BSON_APPEND_DOCUMENT (&ar, key, &ss->lsid);
- CDL_DELETE (topology->session_pool, ss);
- _mongoc_server_session_destroy (ss);
-
- if (++i == 10000) {
- break;
- }
- }
-
- bson_append_array_end (cmd, &ar);
-
- return i > 0;
-}
-
-/*
- *--------------------------------------------------------------------------
- *
- * _mongoc_topology_get_ismaster --
- *
- * Locks topology->mutex and retrieves (possibly constructing) the
- * handshake on the topology scanner.
- *
- * Returns:
- * A bson_t representing an ismaster command.
- *
- *--------------------------------------------------------------------------
- */
-const bson_t *
-_mongoc_topology_get_ismaster (mongoc_topology_t *topology)
-{
- const bson_t *cmd;
- bson_mutex_lock (&topology->mutex);
- cmd = _mongoc_topology_scanner_get_ismaster (topology->scanner);
- bson_mutex_unlock (&topology->mutex);
- return cmd;
-}
-
-void
-_mongoc_topology_bypass_cooldown (mongoc_topology_t *topology)
-{
- BSON_ASSERT (topology->single_threaded);
- topology->scanner->bypass_cooldown = true;
-}
-
-static void
-_find_topology_version (const bson_t *reply, bson_t *topology_version)
-{
- bson_iter_t iter;
- const uint8_t *bytes;
- uint32_t len;
-
- if (!bson_iter_init_find (&iter, reply, "topologyVersion") ||
- !BSON_ITER_HOLDS_DOCUMENT (&iter)) {
- bson_init (topology_version);
- return;
- }
- bson_iter_document (&iter, &len, &bytes);
- bson_init_static (topology_version, bytes, len);
-}
-
-
-/* "Clears" the connection pool by incrementing the generation.
- *
- * Pooled clients with open connections will discover the invalidation
- * the next time they fetch a stream to the server.
- *
- * Caller must lock topology->mutex. */
-void
-_mongoc_topology_clear_connection_pool (mongoc_topology_t *topology,
- uint32_t server_id)
-{
- mongoc_server_description_t *sd;
- bson_error_t error;
-
- sd = mongoc_topology_description_server_by_id (
- &topology->description, server_id, &error);
- if (!sd) {
- /* Server removed, ignore and ignore error. */
- return;
- }
- TRACE ("clearing pool for server: %s", sd->host.host_and_port);
- sd->generation++;
-}
-
-
-/* Handle an error from an app connection.
- *
- * This can be a network error or "not master" / "node is recovering" error.
- * Caller must lock topology->mutex.
- * Returns true if pool was cleared.
- */
-bool
-_mongoc_topology_handle_app_error (mongoc_topology_t *topology,
- uint32_t server_id,
- bool handshake_complete,
- _mongoc_sdam_app_error_type_t type,
- const bson_t *reply,
- const bson_error_t *why,
- uint32_t max_wire_version,
- uint32_t generation)
-{
- bson_error_t server_selection_error;
- mongoc_server_description_t *sd;
- bool pool_cleared;
-
- pool_cleared = false;
- sd = mongoc_topology_description_server_by_id (
- &topology->description, server_id, &server_selection_error);
- if (!sd) {
- /* The server was already removed from the topology. Ignore error. */
- return false;
- }
-
- if (generation < sd->generation) {
- /* This is a stale connection. Ignore. */
- return false;
- }
-
- if (type == MONGOC_SDAM_APP_ERROR_NETWORK) {
- /* Mark server as unknown. */
- mongoc_topology_description_invalidate_server (
- &topology->description, server_id, why);
- _mongoc_topology_clear_connection_pool (topology, server_id);
- pool_cleared = true;
- if (!topology->single_threaded) {
- _mongoc_topology_background_monitoring_cancel_check (topology,
- server_id);
- }
- } else if (type == MONGOC_SDAM_APP_ERROR_TIMEOUT) {
- if (handshake_complete) {
- /* Timeout errors after handshake are ok, do nothing. */
- return false;
- }
- /* Mark server as unknown. */
- mongoc_topology_description_invalidate_server (
- &topology->description, server_id, why);
- _mongoc_topology_clear_connection_pool (topology, server_id);
- pool_cleared = true;
- if (!topology->single_threaded) {
- _mongoc_topology_background_monitoring_cancel_check (topology,
- server_id);
- }
- } else if (type == MONGOC_SDAM_APP_ERROR_COMMAND) {
- bson_error_t cmd_error;
- bson_t incoming_topology_version;
-
- if (_mongoc_cmd_check_ok_no_wce (
- reply, MONGOC_ERROR_API_VERSION_2, &cmd_error)) {
- /* No error. */
- return false;
- }
-
- if (!_mongoc_error_is_state_change (&cmd_error)) {
- /* Not a "not master" or "node is recovering" error. */
- return false;
- }
-
- /* Check if the error is "stale", i.e. the topologyVersion refers to an
- * older
- * version of the server than we have stored in the topology description.
- */
- _find_topology_version (reply, &incoming_topology_version);
- if (mongoc_server_description_topology_version_cmp (
- &sd->topology_version, &incoming_topology_version) >= 0) {
- /* The server description is greater or equal, ignore the error. */
- bson_destroy (&incoming_topology_version);
- return false;
- }
- /* Overwrite the topology version. */
- mongoc_server_description_set_topology_version (
- sd, &incoming_topology_version);
- bson_destroy (&incoming_topology_version);
-
- /* SDAM: When handling a "not master" or "node is recovering" error, the
- * client MUST clear the server's connection pool if and only if the error
- * is "node is shutting down" or the error originated from server version
- * < 4.2.
- */
- if (max_wire_version <= WIRE_VERSION_4_0 ||
- _mongoc_error_is_shutdown (&cmd_error)) {
- _mongoc_topology_clear_connection_pool (topology, server_id);
- pool_cleared = true;
- }
-
- /* SDAM: When the client sees a "not master" or "node is recovering" error
- * and the error's topologyVersion is strictly greater than the current
- * ServerDescription's topologyVersion it MUST replace the server's
- * description with a ServerDescription of type Unknown. */
- mongoc_topology_description_invalidate_server (
- &topology->description, server_id, &cmd_error);
-
- if (topology->single_threaded) {
- /* SDAM: For single-threaded clients, in the case of a "not master" or
- * "node is shutting down" error, the client MUST mark the topology as
- * "stale"
- */
- if (_mongoc_error_is_not_master (&cmd_error)) {
- topology->stale = true;
- }
- } else {
- /* SDAM Spec: "Multi-threaded and asynchronous clients MUST request an
- * immediate check of the server."
- * Instead of requesting a check of the one server, request a scan
- * to all servers (to find the new primary).
- */
- _mongoc_topology_request_scan (topology);
- }
- }
- return pool_cleared;
-}
-
-/* Called from application threads
- * Caller must hold topology lock.
- * Locks topology description mutex to copy out server description errors.
- * For single-threaded monitoring, the topology scanner may include errors for
- * servers that were removed from the topology.
- */
-static void
-_topology_collect_errors (mongoc_topology_t *topology, bson_error_t *error_out)
-{
- mongoc_topology_description_t *topology_description;
- mongoc_server_description_t *server_description;
- bson_string_t *error_message;
- int i;
-
- topology_description = &topology->description;
- memset (error_out, 0, sizeof (bson_error_t));
- error_message = bson_string_new ("");
-
- for (i = 0; i < topology_description->servers->items_len; i++) {
- bson_error_t *error;
-
- server_description = topology_description->servers->items[i].item;
- error = &server_description->error;
- if (error->code) {
- if (error_message->len > 0) {
- bson_string_append_c (error_message, ' ');
- }
- bson_string_append_printf (
- error_message, "[%s]", server_description->error.message);
- /* The last error's code and domain wins. */
- error_out->code = error->code;
- error_out->domain = error->domain;
- }
- }
-
- bson_strncpy ((char *) &error_out->message,
- error_message->str,
- sizeof (error_out->message));
- bson_string_free (error_message, true);
-}
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-version.h b/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-version.h
deleted file mode 100644
index 1eadae31..00000000
--- a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-version.h
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- * 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/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 (17)
-
-
-/**
- * MONGOC_MICRO_VERSION:
- *
- * MONGOC micro version component (e.g. 3 if %MONGOC_VERSION is 1.2.3)
- */
-#define MONGOC_MICRO_VERSION (0)
-
-
-/**
- * MONGOC_PRERELEASE_VERSION:
- *
- * MONGOC prerelease version component (e.g. pre if %MONGOC_VERSION is 1.2.3-pre)
- */
-#define MONGOC_PRERELEASE_VERSION ()
-
-
-/**
- * MONGOC_VERSION:
- *
- * MONGOC version.
- */
-#define MONGOC_VERSION (1.17.0)
-
-
-/**
- * MONGOC_VERSION_S:
- *
- * MONGOC version, encoded as a string, useful for printing and
- * concatenation.
- */
-#define MONGOC_VERSION_S "1.17.0"
-
-
-/**
- * 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.8.1/tests/apm/bug0950-002.phpt b/mongodb-1.8.1/tests/apm/bug0950-002.phpt
deleted file mode 100644
index 83b7c45c..00000000
--- a/mongodb-1.8.1/tests/apm/bug0950-002.phpt
+++ /dev/null
@@ -1,55 +0,0 @@
---TEST--
-PHPC-950: Segfault killing cursor after subscriber HashTable is destroyed (one subscriber)
---SKIPIF--
-<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
-<?php skip_if_not_live(); ?>
-<?php skip_if_not_clean(); ?>
---FILE--
-<?php
-require_once __DIR__ . "/../utils/basic.inc";
-
-class MySubscriber implements MongoDB\Driver\Monitoring\CommandSubscriber
-{
- public function commandStarted(MongoDB\Driver\Monitoring\CommandStartedEvent $event)
- {
- printf("- started: %s\n", $event->getCommandName());
- }
-
- public function commandSucceeded(MongoDB\Driver\Monitoring\CommandSucceededEvent $event)
- {
- printf("- succeeded: %s\n", $event->getCommandName());
- }
-
- public function commandFailed(MongoDB\Driver\Monitoring\CommandFailedEvent $event)
- {
- printf("- failed: %s\n", $event->getCommandName());
- }
-}
-
-$manager = new MongoDB\Driver\Manager(URI);
-
-$bulk = new MongoDB\Driver\BulkWrite();
-$bulk->insert(['_id' => 1]);
-$bulk->insert(['_id' => 2]);
-$bulk->insert(['_id' => 3]);
-$manager->executeBulkWrite(NS, $bulk);
-
-MongoDB\Driver\Monitoring\addSubscriber(new MySubscriber);
-
-$cursor = $manager->executeQuery(NS, new MongoDB\Driver\Query([], ['batchSize' => 2]));
-
-/* Exiting during iteration on a live cursor will result in
- * php_phongo_command_started() being invoked for the killCursor command after
- * RSHUTDOWN has already destroyed the subscriber HashTable */
-foreach ($cursor as $data) {
- echo "Exiting during first iteration on cursor\n";
- exit(0);
-}
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-- started: find
-- succeeded: find
-Exiting during first iteration on cursor
diff --git a/mongodb-1.8.1/tests/bson-corpus/array-valid-001.phpt b/mongodb-1.8.1/tests/bson-corpus/array-valid-001.phpt
deleted file mode 100644
index 0ba7b165..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/array-valid-001.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Array: Empty
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('0D000000046100050000000000');
-$canonicalExtJson = '{"a" : []}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-0d000000046100050000000000
-{"a":[]}
-0d000000046100050000000000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/array-valid-002.phpt b/mongodb-1.8.1/tests/bson-corpus/array-valid-002.phpt
deleted file mode 100644
index 6e4099c4..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/array-valid-002.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Array: Single Element Array
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('140000000461000C0000001030000A0000000000');
-$canonicalExtJson = '{"a" : [{"$numberInt": "10"}]}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-140000000461000c0000001030000a0000000000
-{"a":[{"$numberInt":"10"}]}
-140000000461000c0000001030000a0000000000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/array-valid-003.phpt b/mongodb-1.8.1/tests/bson-corpus/array-valid-003.phpt
deleted file mode 100644
index be1e3706..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/array-valid-003.phpt
+++ /dev/null
@@ -1,40 +0,0 @@
---TEST--
-Array: Single Element Array with index set incorrectly to empty string
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('140000000461000C0000001030000A0000000000');
-$degenerateBson = hex2bin('130000000461000B00000010000A0000000000');
-$canonicalExtJson = '{"a" : [{"$numberInt": "10"}]}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($degenerateBson))), "\n";
-
-// Degenerate BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($degenerateBson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-140000000461000c0000001030000a0000000000
-{"a":[{"$numberInt":"10"}]}
-140000000461000c0000001030000a0000000000
-140000000461000c0000001030000a0000000000
-{"a":[{"$numberInt":"10"}]}
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/array-valid-004.phpt b/mongodb-1.8.1/tests/bson-corpus/array-valid-004.phpt
deleted file mode 100644
index f51e187c..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/array-valid-004.phpt
+++ /dev/null
@@ -1,40 +0,0 @@
---TEST--
-Array: Single Element Array with index set incorrectly to ab
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('140000000461000C0000001030000A0000000000');
-$degenerateBson = hex2bin('150000000461000D000000106162000A0000000000');
-$canonicalExtJson = '{"a" : [{"$numberInt": "10"}]}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($degenerateBson))), "\n";
-
-// Degenerate BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($degenerateBson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-140000000461000c0000001030000a0000000000
-{"a":[{"$numberInt":"10"}]}
-140000000461000c0000001030000a0000000000
-140000000461000c0000001030000a0000000000
-{"a":[{"$numberInt":"10"}]}
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/binary-valid-001.phpt b/mongodb-1.8.1/tests/bson-corpus/binary-valid-001.phpt
deleted file mode 100644
index 2b0d06dc..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/binary-valid-001.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Binary type: subtype 0x00 (Zero-length)
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('0D000000057800000000000000');
-$canonicalExtJson = '{"x" : { "$binary" : {"base64" : "", "subType" : "00"}}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-0d000000057800000000000000
-{"x":{"$binary":{"base64":"","subType":"00"}}}
-0d000000057800000000000000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/binary-valid-002.phpt b/mongodb-1.8.1/tests/bson-corpus/binary-valid-002.phpt
deleted file mode 100644
index 54c712a5..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/binary-valid-002.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Binary type: subtype 0x00 (Zero-length, keys reversed)
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('0D000000057800000000000000');
-$canonicalExtJson = '{"x" : { "$binary" : {"base64" : "", "subType" : "00"}}}';
-$degenerateExtJson = '{"x" : { "$binary" : {"subType" : "00", "base64" : ""}}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-0d000000057800000000000000
-{"x":{"$binary":{"base64":"","subType":"00"}}}
-0d000000057800000000000000
-0d000000057800000000000000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/binary-valid-003.phpt b/mongodb-1.8.1/tests/bson-corpus/binary-valid-003.phpt
deleted file mode 100644
index 582d06f2..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/binary-valid-003.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Binary type: subtype 0x00
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('0F0000000578000200000000FFFF00');
-$canonicalExtJson = '{"x" : { "$binary" : {"base64" : "//8=", "subType" : "00"}}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-0f0000000578000200000000ffff00
-{"x":{"$binary":{"base64":"\/\/8=","subType":"00"}}}
-0f0000000578000200000000ffff00
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/binary-valid-004.phpt b/mongodb-1.8.1/tests/bson-corpus/binary-valid-004.phpt
deleted file mode 100644
index 6479ecd6..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/binary-valid-004.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Binary type: subtype 0x01
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('0F0000000578000200000001FFFF00');
-$canonicalExtJson = '{"x" : { "$binary" : {"base64" : "//8=", "subType" : "01"}}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-0f0000000578000200000001ffff00
-{"x":{"$binary":{"base64":"\/\/8=","subType":"01"}}}
-0f0000000578000200000001ffff00
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/binary-valid-005.phpt b/mongodb-1.8.1/tests/bson-corpus/binary-valid-005.phpt
deleted file mode 100644
index 5f5fb44f..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/binary-valid-005.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Binary type: subtype 0x02
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('13000000057800060000000202000000FFFF00');
-$canonicalExtJson = '{"x" : { "$binary" : {"base64" : "//8=", "subType" : "02"}}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-13000000057800060000000202000000ffff00
-{"x":{"$binary":{"base64":"\/\/8=","subType":"02"}}}
-13000000057800060000000202000000ffff00
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/binary-valid-006.phpt b/mongodb-1.8.1/tests/bson-corpus/binary-valid-006.phpt
deleted file mode 100644
index 3c10c7a0..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/binary-valid-006.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Binary type: subtype 0x03
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('1D000000057800100000000373FFD26444B34C6990E8E7D1DFC035D400');
-$canonicalExtJson = '{"x" : { "$binary" : {"base64" : "c//SZESzTGmQ6OfR38A11A==", "subType" : "03"}}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-1d000000057800100000000373ffd26444b34c6990e8e7d1dfc035d400
-{"x":{"$binary":{"base64":"c\/\/SZESzTGmQ6OfR38A11A==","subType":"03"}}}
-1d000000057800100000000373ffd26444b34c6990e8e7d1dfc035d400
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/binary-valid-007.phpt b/mongodb-1.8.1/tests/bson-corpus/binary-valid-007.phpt
deleted file mode 100644
index 3d4f9482..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/binary-valid-007.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Binary type: subtype 0x04
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('1D000000057800100000000473FFD26444B34C6990E8E7D1DFC035D400');
-$canonicalExtJson = '{"x" : { "$binary" : {"base64" : "c//SZESzTGmQ6OfR38A11A==", "subType" : "04"}}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-1d000000057800100000000473ffd26444b34c6990e8e7d1dfc035d400
-{"x":{"$binary":{"base64":"c\/\/SZESzTGmQ6OfR38A11A==","subType":"04"}}}
-1d000000057800100000000473ffd26444b34c6990e8e7d1dfc035d400
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/binary-valid-008.phpt b/mongodb-1.8.1/tests/bson-corpus/binary-valid-008.phpt
deleted file mode 100644
index 2cc39642..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/binary-valid-008.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Binary type: subtype 0x05
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('1D000000057800100000000573FFD26444B34C6990E8E7D1DFC035D400');
-$canonicalExtJson = '{"x" : { "$binary" : {"base64" : "c//SZESzTGmQ6OfR38A11A==", "subType" : "05"}}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-1d000000057800100000000573ffd26444b34c6990e8e7d1dfc035d400
-{"x":{"$binary":{"base64":"c\/\/SZESzTGmQ6OfR38A11A==","subType":"05"}}}
-1d000000057800100000000573ffd26444b34c6990e8e7d1dfc035d400
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/binary-valid-009.phpt b/mongodb-1.8.1/tests/bson-corpus/binary-valid-009.phpt
deleted file mode 100644
index d47e5bc5..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/binary-valid-009.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Binary type: subtype 0x80
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('0F0000000578000200000080FFFF00');
-$canonicalExtJson = '{"x" : { "$binary" : {"base64" : "//8=", "subType" : "80"}}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-0f0000000578000200000080ffff00
-{"x":{"$binary":{"base64":"\/\/8=","subType":"80"}}}
-0f0000000578000200000080ffff00
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/binary-valid-010.phpt b/mongodb-1.8.1/tests/bson-corpus/binary-valid-010.phpt
deleted file mode 100644
index 994a46c9..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/binary-valid-010.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Binary type: $type query operator (conflicts with legacy $binary form with $type field)
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('1F000000037800170000000224747970650007000000737472696E67000000');
-$canonicalExtJson = '{"x" : { "$type" : "string"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-1f000000037800170000000224747970650007000000737472696e67000000
-{"x":{"$type":"string"}}
-1f000000037800170000000224747970650007000000737472696e67000000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/binary-valid-011.phpt b/mongodb-1.8.1/tests/bson-corpus/binary-valid-011.phpt
deleted file mode 100644
index bf592c3c..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/binary-valid-011.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Binary type: $type query operator (conflicts with legacy $binary form with $type field)
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000000378001000000010247479706500020000000000');
-$canonicalExtJson = '{"x" : { "$type" : {"$numberInt": "2"}}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000000378001000000010247479706500020000000000
-{"x":{"$type":{"$numberInt":"2"}}}
-180000000378001000000010247479706500020000000000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/boolean-valid-001.phpt b/mongodb-1.8.1/tests/bson-corpus/boolean-valid-001.phpt
deleted file mode 100644
index 3e62ed88..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/boolean-valid-001.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Boolean: True
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('090000000862000100');
-$canonicalExtJson = '{"b" : true}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-090000000862000100
-{"b":true}
-090000000862000100
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/boolean-valid-002.phpt b/mongodb-1.8.1/tests/bson-corpus/boolean-valid-002.phpt
deleted file mode 100644
index 662f394b..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/boolean-valid-002.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Boolean: False
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('090000000862000000');
-$canonicalExtJson = '{"b" : false}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-090000000862000000
-{"b":false}
-090000000862000000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/code-valid-001.phpt b/mongodb-1.8.1/tests/bson-corpus/code-valid-001.phpt
deleted file mode 100644
index a5c9420d..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/code-valid-001.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Javascript Code: Empty string
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('0D0000000D6100010000000000');
-$canonicalExtJson = '{"a" : {"$code" : ""}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-0d0000000d6100010000000000
-{"a":{"$code":""}}
-0d0000000d6100010000000000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/code-valid-002.phpt b/mongodb-1.8.1/tests/bson-corpus/code-valid-002.phpt
deleted file mode 100644
index ad467d4b..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/code-valid-002.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Javascript Code: Single character
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('0E0000000D610002000000620000');
-$canonicalExtJson = '{"a" : {"$code" : "b"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-0e0000000d610002000000620000
-{"a":{"$code":"b"}}
-0e0000000d610002000000620000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/code-valid-003.phpt b/mongodb-1.8.1/tests/bson-corpus/code-valid-003.phpt
deleted file mode 100644
index 40a49151..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/code-valid-003.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Javascript Code: Multi-character
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('190000000D61000D0000006162616261626162616261620000');
-$canonicalExtJson = '{"a" : {"$code" : "abababababab"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-190000000d61000d0000006162616261626162616261620000
-{"a":{"$code":"abababababab"}}
-190000000d61000d0000006162616261626162616261620000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/code-valid-004.phpt b/mongodb-1.8.1/tests/bson-corpus/code-valid-004.phpt
deleted file mode 100644
index 6c88de79..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/code-valid-004.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Javascript Code: two-byte UTF-8 (é)
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('190000000261000D000000C3A9C3A9C3A9C3A9C3A9C3A90000');
-$canonicalExtJson = '{"a" : "\\u00e9\\u00e9\\u00e9\\u00e9\\u00e9\\u00e9"}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-190000000261000d000000c3a9c3a9c3a9c3a9c3a9c3a90000
-{"a":"\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9"}
-190000000261000d000000c3a9c3a9c3a9c3a9c3a9c3a90000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/code-valid-005.phpt b/mongodb-1.8.1/tests/bson-corpus/code-valid-005.phpt
deleted file mode 100644
index b4ab4fad..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/code-valid-005.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Javascript Code: three-byte UTF-8 (☆)
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('190000000261000D000000E29886E29886E29886E298860000');
-$canonicalExtJson = '{"a" : "\\u2606\\u2606\\u2606\\u2606"}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-190000000261000d000000e29886e29886e29886e298860000
-{"a":"\u2606\u2606\u2606\u2606"}
-190000000261000d000000e29886e29886e29886e298860000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/code-valid-006.phpt b/mongodb-1.8.1/tests/bson-corpus/code-valid-006.phpt
deleted file mode 100644
index fb3aca93..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/code-valid-006.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Javascript Code: Embedded nulls
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('190000000261000D0000006162006261620062616261620000');
-$canonicalExtJson = '{"a" : "ab\\u0000bab\\u0000babab"}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-190000000261000d0000006162006261620062616261620000
-{"a":"ab\u0000bab\u0000babab"}
-190000000261000d0000006162006261620062616261620000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/code_w_scope-valid-001.phpt b/mongodb-1.8.1/tests/bson-corpus/code_w_scope-valid-001.phpt
deleted file mode 100644
index a912416d..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/code_w_scope-valid-001.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Javascript Code with Scope: Empty code string, empty scope
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('160000000F61000E0000000100000000050000000000');
-$canonicalExtJson = '{"a" : {"$code" : "", "$scope" : {}}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-160000000f61000e0000000100000000050000000000
-{"a":{"$code":"","$scope":{}}}
-160000000f61000e0000000100000000050000000000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/code_w_scope-valid-002.phpt b/mongodb-1.8.1/tests/bson-corpus/code_w_scope-valid-002.phpt
deleted file mode 100644
index 67fb6f18..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/code_w_scope-valid-002.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Javascript Code with Scope: Non-empty code string, empty scope
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('1A0000000F610012000000050000006162636400050000000000');
-$canonicalExtJson = '{"a" : {"$code" : "abcd", "$scope" : {}}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-1a0000000f610012000000050000006162636400050000000000
-{"a":{"$code":"abcd","$scope":{}}}
-1a0000000f610012000000050000006162636400050000000000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/code_w_scope-valid-003.phpt b/mongodb-1.8.1/tests/bson-corpus/code_w_scope-valid-003.phpt
deleted file mode 100644
index 58cd6e76..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/code_w_scope-valid-003.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Javascript Code with Scope: Empty code string, non-empty scope
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('1D0000000F61001500000001000000000C000000107800010000000000');
-$canonicalExtJson = '{"a" : {"$code" : "", "$scope" : {"x" : {"$numberInt": "1"}}}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-1d0000000f61001500000001000000000c000000107800010000000000
-{"a":{"$code":"","$scope":{"x":{"$numberInt":"1"}}}}
-1d0000000f61001500000001000000000c000000107800010000000000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/code_w_scope-valid-004.phpt b/mongodb-1.8.1/tests/bson-corpus/code_w_scope-valid-004.phpt
deleted file mode 100644
index e635df58..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/code_w_scope-valid-004.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Javascript Code with Scope: Non-empty code string and non-empty scope
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('210000000F6100190000000500000061626364000C000000107800010000000000');
-$canonicalExtJson = '{"a" : {"$code" : "abcd", "$scope" : {"x" : {"$numberInt": "1"}}}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-210000000f6100190000000500000061626364000c000000107800010000000000
-{"a":{"$code":"abcd","$scope":{"x":{"$numberInt":"1"}}}}
-210000000f6100190000000500000061626364000c000000107800010000000000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/code_w_scope-valid-005.phpt b/mongodb-1.8.1/tests/bson-corpus/code_w_scope-valid-005.phpt
deleted file mode 100644
index 4e6e9a0e..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/code_w_scope-valid-005.phpt
+++ /dev/null
@@ -1,33 +0,0 @@
---TEST--
-Javascript Code with Scope: Unicode and embedded null in code string, empty scope
---XFAIL--
-Embedded null in code string is not supported in libbson (CDRIVER-1879)
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('1A0000000F61001200000005000000C3A9006400050000000000');
-$canonicalExtJson = '{"a" : {"$code" : "\\u00e9\\u0000d", "$scope" : {}}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-1a0000000f61001200000005000000c3a9006400050000000000
-{"a":{"$code":"\u00e9\u0000d","$scope":{}}}
-1a0000000f61001200000005000000c3a9006400050000000000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/datetime-valid-001.phpt b/mongodb-1.8.1/tests/bson-corpus/datetime-valid-001.phpt
deleted file mode 100644
index 96e3ce65..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/datetime-valid-001.phpt
+++ /dev/null
@@ -1,40 +0,0 @@
---TEST--
-DateTime: epoch
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('10000000096100000000000000000000');
-$canonicalExtJson = '{"a" : {"$date" : {"$numberLong" : "0"}}}';
-$relaxedExtJson = '{"a" : {"$date" : "1970-01-01T00:00:00Z"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical BSON -> Relaxed extJSON
-echo json_canonicalize(toRelaxedExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Relaxed extJSON -> BSON -> Relaxed extJSON
-echo json_canonicalize(toRelaxedExtendedJSON(fromJSON($relaxedExtJson))), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-10000000096100000000000000000000
-{"a":{"$date":{"$numberLong":"0"}}}
-{"a":{"$date":"1970-01-01T00:00:00Z"}}
-10000000096100000000000000000000
-{"a":{"$date":"1970-01-01T00:00:00Z"}}
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/datetime-valid-002.phpt b/mongodb-1.8.1/tests/bson-corpus/datetime-valid-002.phpt
deleted file mode 100644
index 30494e60..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/datetime-valid-002.phpt
+++ /dev/null
@@ -1,40 +0,0 @@
---TEST--
-DateTime: positive ms
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('10000000096100C5D8D6CC3B01000000');
-$canonicalExtJson = '{"a" : {"$date" : {"$numberLong" : "1356351330501"}}}';
-$relaxedExtJson = '{"a" : {"$date" : "2012-12-24T12:15:30.501Z"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical BSON -> Relaxed extJSON
-echo json_canonicalize(toRelaxedExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Relaxed extJSON -> BSON -> Relaxed extJSON
-echo json_canonicalize(toRelaxedExtendedJSON(fromJSON($relaxedExtJson))), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-10000000096100c5d8d6cc3b01000000
-{"a":{"$date":{"$numberLong":"1356351330501"}}}
-{"a":{"$date":"2012-12-24T12:15:30.501Z"}}
-10000000096100c5d8d6cc3b01000000
-{"a":{"$date":"2012-12-24T12:15:30.501Z"}}
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/datetime-valid-003.phpt b/mongodb-1.8.1/tests/bson-corpus/datetime-valid-003.phpt
deleted file mode 100644
index b1b383b8..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/datetime-valid-003.phpt
+++ /dev/null
@@ -1,40 +0,0 @@
---TEST--
-DateTime: negative
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('10000000096100C33CE7B9BDFFFFFF00');
-$canonicalExtJson = '{"a" : {"$date" : {"$numberLong" : "-284643869501"}}}';
-$relaxedExtJson = '{"a" : {"$date" : {"$numberLong" : "-284643869501"}}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical BSON -> Relaxed extJSON
-echo json_canonicalize(toRelaxedExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Relaxed extJSON -> BSON -> Relaxed extJSON
-echo json_canonicalize(toRelaxedExtendedJSON(fromJSON($relaxedExtJson))), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-10000000096100c33ce7b9bdffffff00
-{"a":{"$date":{"$numberLong":"-284643869501"}}}
-{"a":{"$date":{"$numberLong":"-284643869501"}}}
-10000000096100c33ce7b9bdffffff00
-{"a":{"$date":{"$numberLong":"-284643869501"}}}
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/datetime-valid-004.phpt b/mongodb-1.8.1/tests/bson-corpus/datetime-valid-004.phpt
deleted file mode 100644
index c0688631..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/datetime-valid-004.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-DateTime: Y10K
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('1000000009610000DC1FD277E6000000');
-$canonicalExtJson = '{"a":{"$date":{"$numberLong":"253402300800000"}}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-1000000009610000dc1fd277e6000000
-{"a":{"$date":{"$numberLong":"253402300800000"}}}
-1000000009610000dc1fd277e6000000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/dbpointer-valid-001.phpt b/mongodb-1.8.1/tests/bson-corpus/dbpointer-valid-001.phpt
deleted file mode 100644
index 5eddc55c..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/dbpointer-valid-001.phpt
+++ /dev/null
@@ -1,33 +0,0 @@
---TEST--
-DBPointer type (deprecated): DBpointer
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('1A0000000C610002000000620056E1FC72E0C917E9C471416100');
-$convertedBson = hex2bin('2a00000003610022000000022472656600020000006200072469640056e1fc72e0c917e9c47141610000');
-$canonicalExtJson = '{"a": {"$dbPointer": {"$ref": "b", "$id": {"$oid": "56e1fc72e0c917e9c4714161"}}}}';
-$convertedExtJson = '{"a": {"$ref": "b", "$id": {"$oid": "56e1fc72e0c917e9c4714161"}}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-1a0000000c610002000000620056e1fc72e0c917e9c471416100
-{"a":{"$dbPointer":{"$ref":"b","$id":{"$oid":"56e1fc72e0c917e9c4714161"}}}}
-1a0000000c610002000000620056e1fc72e0c917e9c471416100
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/dbpointer-valid-002.phpt b/mongodb-1.8.1/tests/bson-corpus/dbpointer-valid-002.phpt
deleted file mode 100644
index 195037c4..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/dbpointer-valid-002.phpt
+++ /dev/null
@@ -1,38 +0,0 @@
---TEST--
-DBPointer type (deprecated): DBpointer with opposite key order
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('1A0000000C610002000000620056E1FC72E0C917E9C471416100');
-$convertedBson = hex2bin('2a00000003610022000000022472656600020000006200072469640056e1fc72e0c917e9c47141610000');
-$canonicalExtJson = '{"a": {"$dbPointer": {"$ref": "b", "$id": {"$oid": "56e1fc72e0c917e9c4714161"}}}}';
-$degenerateExtJson = '{"a": {"$dbPointer": {"$id": {"$oid": "56e1fc72e0c917e9c4714161"}, "$ref": "b"}}}';
-$convertedExtJson = '{"a": {"$ref": "b", "$id": {"$oid": "56e1fc72e0c917e9c4714161"}}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-1a0000000c610002000000620056e1fc72e0c917e9c471416100
-{"a":{"$dbPointer":{"$ref":"b","$id":{"$oid":"56e1fc72e0c917e9c4714161"}}}}
-1a0000000c610002000000620056e1fc72e0c917e9c471416100
-1a0000000c610002000000620056e1fc72e0c917e9c471416100
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/dbpointer-valid-003.phpt b/mongodb-1.8.1/tests/bson-corpus/dbpointer-valid-003.phpt
deleted file mode 100644
index 88492616..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/dbpointer-valid-003.phpt
+++ /dev/null
@@ -1,33 +0,0 @@
---TEST--
-DBPointer type (deprecated): With two-byte UTF-8
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('1B0000000C610003000000C3A90056E1FC72E0C917E9C471416100');
-$convertedBson = hex2bin('2B0000000361002300000002247265660003000000C3A900072469640056E1FC72E0C917E9C47141610000');
-$canonicalExtJson = '{"a": {"$dbPointer": {"$ref": "é", "$id": {"$oid": "56e1fc72e0c917e9c4714161"}}}}';
-$convertedExtJson = '{"a": {"$ref": "é", "$id": {"$oid": "56e1fc72e0c917e9c4714161"}}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-1b0000000c610003000000c3a90056e1fc72e0c917e9c471416100
-{"a":{"$dbPointer":{"$ref":"\u00e9","$id":{"$oid":"56e1fc72e0c917e9c4714161"}}}}
-1b0000000c610003000000c3a90056e1fc72e0c917e9c471416100
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/dbref-valid-001.phpt b/mongodb-1.8.1/tests/bson-corpus/dbref-valid-001.phpt
deleted file mode 100644
index f1f28a72..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/dbref-valid-001.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-DBRef: DBRef
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('37000000036462726566002b0000000224726566000b000000636f6c6c656374696f6e00072469640058921b3e6e32ab156a22b59e0000');
-$canonicalExtJson = '{"dbref": {"$ref": "collection", "$id": {"$oid": "58921b3e6e32ab156a22b59e"}}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-37000000036462726566002b0000000224726566000b000000636f6c6c656374696f6e00072469640058921b3e6e32ab156a22b59e0000
-{"dbref":{"$ref":"collection","$id":{"$oid":"58921b3e6e32ab156a22b59e"}}}
-37000000036462726566002b0000000224726566000b000000636f6c6c656374696f6e00072469640058921b3e6e32ab156a22b59e0000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/dbref-valid-002.phpt b/mongodb-1.8.1/tests/bson-corpus/dbref-valid-002.phpt
deleted file mode 100644
index 2412ecd9..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/dbref-valid-002.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-DBRef: DBRef with database
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('4300000003646272656600370000000224726566000b000000636f6c6c656374696f6e00072469640058921b3e6e32ab156a22b59e0224646200030000006462000000');
-$canonicalExtJson = '{"dbref": {"$ref": "collection", "$id": {"$oid": "58921b3e6e32ab156a22b59e"}, "$db": "db"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-4300000003646272656600370000000224726566000b000000636f6c6c656374696f6e00072469640058921b3e6e32ab156a22b59e0224646200030000006462000000
-{"dbref":{"$ref":"collection","$id":{"$oid":"58921b3e6e32ab156a22b59e"},"$db":"db"}}
-4300000003646272656600370000000224726566000b000000636f6c6c656374696f6e00072469640058921b3e6e32ab156a22b59e0224646200030000006462000000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/dbref-valid-003.phpt b/mongodb-1.8.1/tests/bson-corpus/dbref-valid-003.phpt
deleted file mode 100644
index 0ebeaa6e..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/dbref-valid-003.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-DBRef: DBRef with database and additional fields
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('48000000036462726566003c0000000224726566000b000000636f6c6c656374696f6e0010246964002a00000002246462000300000064620002666f6f0004000000626172000000');
-$canonicalExtJson = '{"dbref": {"$ref": "collection", "$id": {"$numberInt": "42"}, "$db": "db", "foo": "bar"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-48000000036462726566003c0000000224726566000b000000636f6c6c656374696f6e0010246964002a00000002246462000300000064620002666f6f0004000000626172000000
-{"dbref":{"$ref":"collection","$id":{"$numberInt":"42"},"$db":"db","foo":"bar"}}
-48000000036462726566003c0000000224726566000b000000636f6c6c656374696f6e0010246964002a00000002246462000300000064620002666f6f0004000000626172000000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/dbref-valid-004.phpt b/mongodb-1.8.1/tests/bson-corpus/dbref-valid-004.phpt
deleted file mode 100644
index 3218ddb1..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/dbref-valid-004.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-DBRef: DBRef with additional fields
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('4400000003646272656600380000000224726566000b000000636f6c6c656374696f6e00072469640058921b3e6e32ab156a22b59e02666f6f0004000000626172000000');
-$canonicalExtJson = '{"dbref": {"$ref": "collection", "$id": {"$oid": "58921b3e6e32ab156a22b59e"}, "foo": "bar"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-4400000003646272656600380000000224726566000b000000636f6c6c656374696f6e00072469640058921b3e6e32ab156a22b59e02666f6f0004000000626172000000
-{"dbref":{"$ref":"collection","$id":{"$oid":"58921b3e6e32ab156a22b59e"},"foo":"bar"}}
-4400000003646272656600380000000224726566000b000000636f6c6c656374696f6e00072469640058921b3e6e32ab156a22b59e02666f6f0004000000626172000000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/dbref-valid-005.phpt b/mongodb-1.8.1/tests/bson-corpus/dbref-valid-005.phpt
deleted file mode 100644
index c3e8a79e..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/dbref-valid-005.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-DBRef: Document with key names similar to those of a DBRef
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('3e0000000224726566000c0000006e6f742d612d646272656600072469640058921b3e6e32ab156a22b59e022462616e616e6100050000007065656c0000');
-$canonicalExtJson = '{"$ref": "not-a-dbref", "$id": {"$oid": "58921b3e6e32ab156a22b59e"}, "$banana": "peel"}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-3e0000000224726566000c0000006e6f742d612d646272656600072469640058921b3e6e32ab156a22b59e022462616e616e6100050000007065656c0000
-{"$ref":"not-a-dbref","$id":{"$oid":"58921b3e6e32ab156a22b59e"},"$banana":"peel"}
-3e0000000224726566000c0000006e6f742d612d646272656600072469640058921b3e6e32ab156a22b59e022462616e616e6100050000007065656c0000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-1-valid-001.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-1-valid-001.phpt
deleted file mode 100644
index d80d6278..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-1-valid-001.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: Special - Canonical NaN
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000000000000000000000000000000007C00');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "NaN"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000000000000000000000000000000007c00
-{"d":{"$numberDecimal":"NaN"}}
-180000001364000000000000000000000000000000007c00
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-1-valid-002.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-1-valid-002.phpt
deleted file mode 100644
index b3b75777..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-1-valid-002.phpt
+++ /dev/null
@@ -1,27 +0,0 @@
---TEST--
-Decimal128: Special - Negative NaN
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400000000000000000000000000000000FC00');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "NaN"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400000000000000000000000000000000fc00
-{"d":{"$numberDecimal":"NaN"}}
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-1-valid-003.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-1-valid-003.phpt
deleted file mode 100644
index f56a0e3b..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-1-valid-003.phpt
+++ /dev/null
@@ -1,28 +0,0 @@
---TEST--
-Decimal128: Special - Negative NaN
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400000000000000000000000000000000FC00');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "NaN"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "-NaN"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400000000000000000000000000000000fc00
-{"d":{"$numberDecimal":"NaN"}}
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-1-valid-004.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-1-valid-004.phpt
deleted file mode 100644
index 3237cef9..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-1-valid-004.phpt
+++ /dev/null
@@ -1,27 +0,0 @@
---TEST--
-Decimal128: Special - Canonical SNaN
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000000000000000000000000000000007E00');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "NaN"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000000000000000000000000000000007e00
-{"d":{"$numberDecimal":"NaN"}}
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-1-valid-005.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-1-valid-005.phpt
deleted file mode 100644
index 66f967ed..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-1-valid-005.phpt
+++ /dev/null
@@ -1,27 +0,0 @@
---TEST--
-Decimal128: Special - Negative SNaN
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400000000000000000000000000000000FE00');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "NaN"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400000000000000000000000000000000fe00
-{"d":{"$numberDecimal":"NaN"}}
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-1-valid-006.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-1-valid-006.phpt
deleted file mode 100644
index cc19342b..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-1-valid-006.phpt
+++ /dev/null
@@ -1,27 +0,0 @@
---TEST--
-Decimal128: Special - NaN with a payload
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364001200000000000000000000000000007E00');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "NaN"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364001200000000000000000000000000007e00
-{"d":{"$numberDecimal":"NaN"}}
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-1-valid-007.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-1-valid-007.phpt
deleted file mode 100644
index 58a5e711..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-1-valid-007.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: Special - Canonical Positive Infinity
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000000000000000000000000000000007800');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "Infinity"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000000000000000000000000000000007800
-{"d":{"$numberDecimal":"Infinity"}}
-180000001364000000000000000000000000000000007800
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-1-valid-008.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-1-valid-008.phpt
deleted file mode 100644
index db7f99a3..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-1-valid-008.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: Special - Canonical Negative Infinity
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400000000000000000000000000000000F800');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "-Infinity"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400000000000000000000000000000000f800
-{"d":{"$numberDecimal":"-Infinity"}}
-18000000136400000000000000000000000000000000f800
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-1-valid-009.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-1-valid-009.phpt
deleted file mode 100644
index a589742f..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-1-valid-009.phpt
+++ /dev/null
@@ -1,27 +0,0 @@
---TEST--
-Decimal128: Special - Invalid representation treated as 0
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000000000000000000000000000000106C00');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "0"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000000000000000000000000000000106c00
-{"d":{"$numberDecimal":"0"}}
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-1-valid-010.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-1-valid-010.phpt
deleted file mode 100644
index 1b5fe364..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-1-valid-010.phpt
+++ /dev/null
@@ -1,27 +0,0 @@
---TEST--
-Decimal128: Special - Invalid representation treated as -0
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400DCBA9876543210DEADBEEF00000010EC00');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "-0"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400dcba9876543210deadbeef00000010ec00
-{"d":{"$numberDecimal":"-0"}}
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-1-valid-011.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-1-valid-011.phpt
deleted file mode 100644
index 8ea1a976..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-1-valid-011.phpt
+++ /dev/null
@@ -1,27 +0,0 @@
---TEST--
-Decimal128: Special - Invalid representation treated as 0E3
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400FFFFFFFFFFFFFFFFFFFFFFFFFFFF116C00');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "0E+3"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400ffffffffffffffffffffffffffff116c00
-{"d":{"$numberDecimal":"0E+3"}}
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-1-valid-012.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-1-valid-012.phpt
deleted file mode 100644
index e739ee39..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-1-valid-012.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: Regular - Adjusted Exponent Limit
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400F2AF967ED05C82DE3297FF6FDE3CF22F00');
-$canonicalExtJson = '{"d": { "$numberDecimal": "0.000001234567890123456789012345678901234" }}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400f2af967ed05c82de3297ff6fde3cf22f00
-{"d":{"$numberDecimal":"0.000001234567890123456789012345678901234"}}
-18000000136400f2af967ed05c82de3297ff6fde3cf22f00
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-1-valid-013.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-1-valid-013.phpt
deleted file mode 100644
index c80cbc70..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-1-valid-013.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: Regular - Smallest
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400D204000000000000000000000000343000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "0.001234"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400d204000000000000000000000000343000
-{"d":{"$numberDecimal":"0.001234"}}
-18000000136400d204000000000000000000000000343000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-1-valid-014.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-1-valid-014.phpt
deleted file mode 100644
index e69e6fce..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-1-valid-014.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: Regular - Smallest with Trailing Zeros
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('1800000013640040EF5A07000000000000000000002A3000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "0.00123400000"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-1800000013640040ef5a07000000000000000000002a3000
-{"d":{"$numberDecimal":"0.00123400000"}}
-1800000013640040ef5a07000000000000000000002a3000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-1-valid-015.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-1-valid-015.phpt
deleted file mode 100644
index c01dc621..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-1-valid-015.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: Regular - 0.1
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('1800000013640001000000000000000000000000003E3000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "0.1"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-1800000013640001000000000000000000000000003e3000
-{"d":{"$numberDecimal":"0.1"}}
-1800000013640001000000000000000000000000003e3000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-1-valid-016.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-1-valid-016.phpt
deleted file mode 100644
index 901722b9..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-1-valid-016.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: Regular - 0.1234567890123456789012345678901234
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400F2AF967ED05C82DE3297FF6FDE3CFC2F00');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "0.1234567890123456789012345678901234"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400f2af967ed05c82de3297ff6fde3cfc2f00
-{"d":{"$numberDecimal":"0.1234567890123456789012345678901234"}}
-18000000136400f2af967ed05c82de3297ff6fde3cfc2f00
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-1-valid-017.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-1-valid-017.phpt
deleted file mode 100644
index 568d3f7e..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-1-valid-017.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: Regular - 0
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000000000000000000000000000000403000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "0"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000000000000000000000000000000403000
-{"d":{"$numberDecimal":"0"}}
-180000001364000000000000000000000000000000403000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-1-valid-018.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-1-valid-018.phpt
deleted file mode 100644
index 947aa7bb..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-1-valid-018.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: Regular - -0
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400000000000000000000000000000040B000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "-0"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400000000000000000000000000000040b000
-{"d":{"$numberDecimal":"-0"}}
-18000000136400000000000000000000000000000040b000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-1-valid-019.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-1-valid-019.phpt
deleted file mode 100644
index 7cc6d622..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-1-valid-019.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: Regular - -0.0
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('1800000013640000000000000000000000000000003EB000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "-0.0"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-1800000013640000000000000000000000000000003eb000
-{"d":{"$numberDecimal":"-0.0"}}
-1800000013640000000000000000000000000000003eb000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-1-valid-020.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-1-valid-020.phpt
deleted file mode 100644
index 0cd67d11..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-1-valid-020.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: Regular - 2
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000200000000000000000000000000403000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "2"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000200000000000000000000000000403000
-{"d":{"$numberDecimal":"2"}}
-180000001364000200000000000000000000000000403000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-1-valid-021.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-1-valid-021.phpt
deleted file mode 100644
index c8f57bc4..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-1-valid-021.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: Regular - 2.000
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400D0070000000000000000000000003A3000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "2.000"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400d0070000000000000000000000003a3000
-{"d":{"$numberDecimal":"2.000"}}
-18000000136400d0070000000000000000000000003a3000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-1-valid-022.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-1-valid-022.phpt
deleted file mode 100644
index 71ce9214..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-1-valid-022.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: Regular - Largest
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400F2AF967ED05C82DE3297FF6FDE3C403000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "1234567890123456789012345678901234"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400f2af967ed05c82de3297ff6fde3c403000
-{"d":{"$numberDecimal":"1234567890123456789012345678901234"}}
-18000000136400f2af967ed05c82de3297ff6fde3c403000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-1-valid-023.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-1-valid-023.phpt
deleted file mode 100644
index 001d7531..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-1-valid-023.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: Scientific - Tiniest
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400FFFFFFFF638E8D37C087ADBE09ED010000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "9.999999999999999999999999999999999E-6143"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400ffffffff638e8d37c087adbe09ed010000
-{"d":{"$numberDecimal":"9.999999999999999999999999999999999E-6143"}}
-18000000136400ffffffff638e8d37c087adbe09ed010000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-1-valid-024.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-1-valid-024.phpt
deleted file mode 100644
index 3b54fe0d..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-1-valid-024.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: Scientific - Tiny
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000100000000000000000000000000000000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "1E-6176"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000100000000000000000000000000000000
-{"d":{"$numberDecimal":"1E-6176"}}
-180000001364000100000000000000000000000000000000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-1-valid-025.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-1-valid-025.phpt
deleted file mode 100644
index 6ce1b54d..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-1-valid-025.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: Scientific - Negative Tiny
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000100000000000000000000000000008000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "-1E-6176"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000100000000000000000000000000008000
-{"d":{"$numberDecimal":"-1E-6176"}}
-180000001364000100000000000000000000000000008000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-1-valid-026.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-1-valid-026.phpt
deleted file mode 100644
index 29c2253a..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-1-valid-026.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: Scientific - Adjusted Exponent Limit
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400F2AF967ED05C82DE3297FF6FDE3CF02F00');
-$canonicalExtJson = '{"d": { "$numberDecimal": "1.234567890123456789012345678901234E-7" }}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400f2af967ed05c82de3297ff6fde3cf02f00
-{"d":{"$numberDecimal":"1.234567890123456789012345678901234E-7"}}
-18000000136400f2af967ed05c82de3297ff6fde3cf02f00
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-1-valid-027.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-1-valid-027.phpt
deleted file mode 100644
index 5a0f446d..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-1-valid-027.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: Scientific - Fractional
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('1800000013640064000000000000000000000000002CB000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "-1.00E-8"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-1800000013640064000000000000000000000000002cb000
-{"d":{"$numberDecimal":"-1.00E-8"}}
-1800000013640064000000000000000000000000002cb000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-1-valid-028.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-1-valid-028.phpt
deleted file mode 100644
index 72c10be2..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-1-valid-028.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: Scientific - 0 with Exponent
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000000000000000000000000000000205F00');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "0E+6000"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000000000000000000000000000000205f00
-{"d":{"$numberDecimal":"0E+6000"}}
-180000001364000000000000000000000000000000205f00
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-1-valid-029.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-1-valid-029.phpt
deleted file mode 100644
index 769ff3d8..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-1-valid-029.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: Scientific - 0 with Negative Exponent
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('1800000013640000000000000000000000000000007A2B00');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "0E-611"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-1800000013640000000000000000000000000000007a2b00
-{"d":{"$numberDecimal":"0E-611"}}
-1800000013640000000000000000000000000000007a2b00
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-1-valid-030.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-1-valid-030.phpt
deleted file mode 100644
index cc2cf979..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-1-valid-030.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: Scientific - No Decimal with Signed Exponent
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000100000000000000000000000000463000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "1E+3"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000100000000000000000000000000463000
-{"d":{"$numberDecimal":"1E+3"}}
-180000001364000100000000000000000000000000463000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-1-valid-031.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-1-valid-031.phpt
deleted file mode 100644
index dd235a88..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-1-valid-031.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: Scientific - Trailing Zero
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364001A04000000000000000000000000423000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.050E+4"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364001a04000000000000000000000000423000
-{"d":{"$numberDecimal":"1.050E+4"}}
-180000001364001a04000000000000000000000000423000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-1-valid-032.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-1-valid-032.phpt
deleted file mode 100644
index f6ffa384..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-1-valid-032.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: Scientific - With Decimal
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364006900000000000000000000000000423000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.05E+3"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364006900000000000000000000000000423000
-{"d":{"$numberDecimal":"1.05E+3"}}
-180000001364006900000000000000000000000000423000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-1-valid-033.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-1-valid-033.phpt
deleted file mode 100644
index 7291af6c..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-1-valid-033.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: Scientific - Full
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400FFFFFFFFFFFFFFFFFFFFFFFFFFFF403000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "5192296858534827628530496329220095"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400ffffffffffffffffffffffffffff403000
-{"d":{"$numberDecimal":"5192296858534827628530496329220095"}}
-18000000136400ffffffffffffffffffffffffffff403000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-1-valid-034.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-1-valid-034.phpt
deleted file mode 100644
index d8d22156..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-1-valid-034.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: Scientific - Large
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400000000000A5BC138938D44C64D31FE5F00');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.000000000000000000000000000000000E+6144"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400000000000a5bc138938d44c64d31fe5f00
-{"d":{"$numberDecimal":"1.000000000000000000000000000000000E+6144"}}
-18000000136400000000000a5bc138938d44c64d31fe5f00
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-1-valid-035.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-1-valid-035.phpt
deleted file mode 100644
index bfbac048..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-1-valid-035.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: Scientific - Largest
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400FFFFFFFF638E8D37C087ADBE09EDFF5F00');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "9.999999999999999999999999999999999E+6144"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400ffffffff638e8d37c087adbe09edff5f00
-{"d":{"$numberDecimal":"9.999999999999999999999999999999999E+6144"}}
-18000000136400ffffffff638e8d37c087adbe09edff5f00
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-1-valid-036.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-1-valid-036.phpt
deleted file mode 100644
index 33f98110..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-1-valid-036.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: Non-Canonical Parsing - Exponent Normalization
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('1800000013640064000000000000000000000000002CB000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "-1.00E-8"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "-100E-10"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-1800000013640064000000000000000000000000002cb000
-{"d":{"$numberDecimal":"-1.00E-8"}}
-1800000013640064000000000000000000000000002cb000
-1800000013640064000000000000000000000000002cb000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-1-valid-037.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-1-valid-037.phpt
deleted file mode 100644
index 5a8d16c8..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-1-valid-037.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: Non-Canonical Parsing - Unsigned Positive Exponent
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000100000000000000000000000000463000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "1E+3"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "1E3"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000100000000000000000000000000463000
-{"d":{"$numberDecimal":"1E+3"}}
-180000001364000100000000000000000000000000463000
-180000001364000100000000000000000000000000463000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-1-valid-038.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-1-valid-038.phpt
deleted file mode 100644
index bd825b34..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-1-valid-038.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: Non-Canonical Parsing - Lowercase Exponent Identifier
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000100000000000000000000000000463000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "1E+3"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "1e+3"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000100000000000000000000000000463000
-{"d":{"$numberDecimal":"1E+3"}}
-180000001364000100000000000000000000000000463000
-180000001364000100000000000000000000000000463000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-1-valid-039.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-1-valid-039.phpt
deleted file mode 100644
index b754aadc..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-1-valid-039.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: Non-Canonical Parsing - Long Significand with Exponent
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('1800000013640079D9E0F9763ADA429D0200000000583000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.2345689012345789012345E+34"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "12345689012345789012345E+12"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-1800000013640079d9e0f9763ada429d0200000000583000
-{"d":{"$numberDecimal":"1.2345689012345789012345E+34"}}
-1800000013640079d9e0f9763ada429d0200000000583000
-1800000013640079d9e0f9763ada429d0200000000583000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-1-valid-040.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-1-valid-040.phpt
deleted file mode 100644
index 146860e1..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-1-valid-040.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: Non-Canonical Parsing - Positive Sign
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400F2AF967ED05C82DE3297FF6FDE3C403000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "1234567890123456789012345678901234"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "+1234567890123456789012345678901234"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400f2af967ed05c82de3297ff6fde3c403000
-{"d":{"$numberDecimal":"1234567890123456789012345678901234"}}
-18000000136400f2af967ed05c82de3297ff6fde3c403000
-18000000136400f2af967ed05c82de3297ff6fde3c403000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-1-valid-041.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-1-valid-041.phpt
deleted file mode 100644
index b5997c29..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-1-valid-041.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: Non-Canonical Parsing - Long Decimal String
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000100000000000000000000000000722800');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "1E-999"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : ".000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000100000000000000000000000000722800
-{"d":{"$numberDecimal":"1E-999"}}
-180000001364000100000000000000000000000000722800
-180000001364000100000000000000000000000000722800
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-1-valid-042.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-1-valid-042.phpt
deleted file mode 100644
index 64c93c65..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-1-valid-042.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: Non-Canonical Parsing - nan
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000000000000000000000000000000007C00');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "NaN"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "nan"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000000000000000000000000000000007c00
-{"d":{"$numberDecimal":"NaN"}}
-180000001364000000000000000000000000000000007c00
-180000001364000000000000000000000000000000007c00
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-1-valid-043.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-1-valid-043.phpt
deleted file mode 100644
index 144287be..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-1-valid-043.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: Non-Canonical Parsing - nAn
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000000000000000000000000000000007C00');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "NaN"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "nAn"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000000000000000000000000000000007c00
-{"d":{"$numberDecimal":"NaN"}}
-180000001364000000000000000000000000000000007c00
-180000001364000000000000000000000000000000007c00
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-1-valid-044.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-1-valid-044.phpt
deleted file mode 100644
index 83473b7f..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-1-valid-044.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: Non-Canonical Parsing - +infinity
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000000000000000000000000000000007800');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "Infinity"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "+infinity"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000000000000000000000000000000007800
-{"d":{"$numberDecimal":"Infinity"}}
-180000001364000000000000000000000000000000007800
-180000001364000000000000000000000000000000007800
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-1-valid-045.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-1-valid-045.phpt
deleted file mode 100644
index 56c77290..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-1-valid-045.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: Non-Canonical Parsing - infinity
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000000000000000000000000000000007800');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "Infinity"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "infinity"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000000000000000000000000000000007800
-{"d":{"$numberDecimal":"Infinity"}}
-180000001364000000000000000000000000000000007800
-180000001364000000000000000000000000000000007800
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-1-valid-046.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-1-valid-046.phpt
deleted file mode 100644
index 0f24c6ea..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-1-valid-046.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: Non-Canonical Parsing - infiniTY
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000000000000000000000000000000007800');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "Infinity"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "infiniTY"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000000000000000000000000000000007800
-{"d":{"$numberDecimal":"Infinity"}}
-180000001364000000000000000000000000000000007800
-180000001364000000000000000000000000000000007800
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-1-valid-047.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-1-valid-047.phpt
deleted file mode 100644
index 9b8ae9c9..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-1-valid-047.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: Non-Canonical Parsing - inf
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000000000000000000000000000000007800');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "Infinity"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "inf"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000000000000000000000000000000007800
-{"d":{"$numberDecimal":"Infinity"}}
-180000001364000000000000000000000000000000007800
-180000001364000000000000000000000000000000007800
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-1-valid-048.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-1-valid-048.phpt
deleted file mode 100644
index 7c47d946..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-1-valid-048.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: Non-Canonical Parsing - inF
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000000000000000000000000000000007800');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "Infinity"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "inF"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000000000000000000000000000000007800
-{"d":{"$numberDecimal":"Infinity"}}
-180000001364000000000000000000000000000000007800
-180000001364000000000000000000000000000000007800
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-1-valid-049.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-1-valid-049.phpt
deleted file mode 100644
index 40775320..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-1-valid-049.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: Non-Canonical Parsing - -infinity
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400000000000000000000000000000000F800');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "-Infinity"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "-infinity"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400000000000000000000000000000000f800
-{"d":{"$numberDecimal":"-Infinity"}}
-18000000136400000000000000000000000000000000f800
-18000000136400000000000000000000000000000000f800
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-1-valid-050.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-1-valid-050.phpt
deleted file mode 100644
index c4263e98..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-1-valid-050.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: Non-Canonical Parsing - -infiniTy
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400000000000000000000000000000000F800');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "-Infinity"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "-infiniTy"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400000000000000000000000000000000f800
-{"d":{"$numberDecimal":"-Infinity"}}
-18000000136400000000000000000000000000000000f800
-18000000136400000000000000000000000000000000f800
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-1-valid-051.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-1-valid-051.phpt
deleted file mode 100644
index b7f67d18..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-1-valid-051.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: Non-Canonical Parsing - -Inf
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400000000000000000000000000000000F800');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "-Infinity"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "-Infinity"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400000000000000000000000000000000f800
-{"d":{"$numberDecimal":"-Infinity"}}
-18000000136400000000000000000000000000000000f800
-18000000136400000000000000000000000000000000f800
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-1-valid-052.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-1-valid-052.phpt
deleted file mode 100644
index 0bd00461..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-1-valid-052.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: Non-Canonical Parsing - -inf
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400000000000000000000000000000000F800');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "-Infinity"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "-inf"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400000000000000000000000000000000f800
-{"d":{"$numberDecimal":"-Infinity"}}
-18000000136400000000000000000000000000000000f800
-18000000136400000000000000000000000000000000f800
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-1-valid-053.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-1-valid-053.phpt
deleted file mode 100644
index 320a5918..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-1-valid-053.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: Non-Canonical Parsing - -inF
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400000000000000000000000000000000F800');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "-Infinity"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "-inF"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400000000000000000000000000000000f800
-{"d":{"$numberDecimal":"-Infinity"}}
-18000000136400000000000000000000000000000000f800
-18000000136400000000000000000000000000000000f800
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-1-valid-054.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-1-valid-054.phpt
deleted file mode 100644
index abd05596..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-1-valid-054.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: Rounded Subnormal number
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000100000000000000000000000000000000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "1E-6176"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "10E-6177"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000100000000000000000000000000000000
-{"d":{"$numberDecimal":"1E-6176"}}
-180000001364000100000000000000000000000000000000
-180000001364000100000000000000000000000000000000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-1-valid-055.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-1-valid-055.phpt
deleted file mode 100644
index c2795c84..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-1-valid-055.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: Clamped
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000a00000000000000000000000000fe5f00');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.0E+6112"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "1E6112"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000a00000000000000000000000000fe5f00
-{"d":{"$numberDecimal":"1.0E+6112"}}
-180000001364000a00000000000000000000000000fe5f00
-180000001364000a00000000000000000000000000fe5f00
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-1-valid-056.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-1-valid-056.phpt
deleted file mode 100644
index 2a392d15..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-1-valid-056.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: Exact rounding
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400000000000a5bc138938d44c64d31cc3700');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.000000000000000000000000000000000E+999"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400000000000a5bc138938d44c64d31cc3700
-{"d":{"$numberDecimal":"1.000000000000000000000000000000000E+999"}}
-18000000136400000000000a5bc138938d44c64d31cc3700
-18000000136400000000000a5bc138938d44c64d31cc3700
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-001.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-001.phpt
deleted file mode 100644
index 75a12d99..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-001.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [decq021] Normality
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400F2AF967ED05C82DE3297FF6FDE3C40B000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "-1234567890123456789012345678901234"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400f2af967ed05c82de3297ff6fde3c40b000
-{"d":{"$numberDecimal":"-1234567890123456789012345678901234"}}
-18000000136400f2af967ed05c82de3297ff6fde3c40b000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-002.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-002.phpt
deleted file mode 100644
index 22e7786c..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-002.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [decq823] values around [u]int32 edges (zeros done earlier)
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400010000800000000000000000000040B000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "-2147483649"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400010000800000000000000000000040b000
-{"d":{"$numberDecimal":"-2147483649"}}
-18000000136400010000800000000000000000000040b000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-003.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-003.phpt
deleted file mode 100644
index 9462127f..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-003.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [decq822] values around [u]int32 edges (zeros done earlier)
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400000000800000000000000000000040B000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "-2147483648"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400000000800000000000000000000040b000
-{"d":{"$numberDecimal":"-2147483648"}}
-18000000136400000000800000000000000000000040b000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-004.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-004.phpt
deleted file mode 100644
index 10b8744c..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-004.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [decq821] values around [u]int32 edges (zeros done earlier)
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400FFFFFF7F0000000000000000000040B000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "-2147483647"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400ffffff7f0000000000000000000040b000
-{"d":{"$numberDecimal":"-2147483647"}}
-18000000136400ffffff7f0000000000000000000040b000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-005.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-005.phpt
deleted file mode 100644
index 97424aa4..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-005.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [decq820] values around [u]int32 edges (zeros done earlier)
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400FEFFFF7F0000000000000000000040B000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "-2147483646"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400feffff7f0000000000000000000040b000
-{"d":{"$numberDecimal":"-2147483646"}}
-18000000136400feffff7f0000000000000000000040b000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-006.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-006.phpt
deleted file mode 100644
index 309255c7..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-006.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [decq152] fold-downs (more below)
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400393000000000000000000000000040B000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "-12345"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400393000000000000000000000000040b000
-{"d":{"$numberDecimal":"-12345"}}
-18000000136400393000000000000000000000000040b000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-007.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-007.phpt
deleted file mode 100644
index 2b46237d..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-007.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [decq154] fold-downs (more below)
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400D20400000000000000000000000040B000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "-1234"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400d20400000000000000000000000040b000
-{"d":{"$numberDecimal":"-1234"}}
-18000000136400d20400000000000000000000000040b000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-008.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-008.phpt
deleted file mode 100644
index 30c994ec..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-008.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [decq006] derivative canonical plain strings
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400EE0200000000000000000000000040B000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "-750"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400ee0200000000000000000000000040b000
-{"d":{"$numberDecimal":"-750"}}
-18000000136400ee0200000000000000000000000040b000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-009.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-009.phpt
deleted file mode 100644
index 2f6d9cc2..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-009.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [decq164] fold-downs (more below)
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('1800000013640039300000000000000000000000003CB000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "-123.45"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-1800000013640039300000000000000000000000003cb000
-{"d":{"$numberDecimal":"-123.45"}}
-1800000013640039300000000000000000000000003cb000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-010.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-010.phpt
deleted file mode 100644
index c1af4c51..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-010.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [decq156] fold-downs (more below)
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364007B0000000000000000000000000040B000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "-123"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364007b0000000000000000000000000040b000
-{"d":{"$numberDecimal":"-123"}}
-180000001364007b0000000000000000000000000040b000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-011.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-011.phpt
deleted file mode 100644
index 274c6ca2..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-011.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [decq008] derivative canonical plain strings
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400EE020000000000000000000000003EB000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "-75.0"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400ee020000000000000000000000003eb000
-{"d":{"$numberDecimal":"-75.0"}}
-18000000136400ee020000000000000000000000003eb000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-012.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-012.phpt
deleted file mode 100644
index 3e1e1fae..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-012.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [decq158] fold-downs (more below)
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000C0000000000000000000000000040B000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "-12"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000c0000000000000000000000000040b000
-{"d":{"$numberDecimal":"-12"}}
-180000001364000c0000000000000000000000000040b000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-013.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-013.phpt
deleted file mode 100644
index 469c7270..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-013.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [decq122] Nmax and similar
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400FFFFFFFF638E8D37C087ADBE09EDFFDF00');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "-9.999999999999999999999999999999999E+6144"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400ffffffff638e8d37c087adbe09edffdf00
-{"d":{"$numberDecimal":"-9.999999999999999999999999999999999E+6144"}}
-18000000136400ffffffff638e8d37c087adbe09edffdf00
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-014.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-014.phpt
deleted file mode 100644
index 6e8257be..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-014.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [decq002] (mostly derived from the Strawman 4 document and examples)
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400EE020000000000000000000000003CB000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "-7.50"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400ee020000000000000000000000003cb000
-{"d":{"$numberDecimal":"-7.50"}}
-18000000136400ee020000000000000000000000003cb000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-015.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-015.phpt
deleted file mode 100644
index 33f51a80..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-015.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [decq004] derivative canonical plain strings
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400EE0200000000000000000000000042B000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "-7.50E+3"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400ee0200000000000000000000000042b000
-{"d":{"$numberDecimal":"-7.50E+3"}}
-18000000136400ee0200000000000000000000000042b000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-016.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-016.phpt
deleted file mode 100644
index bfd6f06b..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-016.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [decq018] derivative canonical plain strings
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400EE020000000000000000000000002EB000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "-7.50E-7"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400ee020000000000000000000000002eb000
-{"d":{"$numberDecimal":"-7.50E-7"}}
-18000000136400ee020000000000000000000000002eb000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-017.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-017.phpt
deleted file mode 100644
index 46b42b5f..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-017.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [decq125] Nmax and similar
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400F2AF967ED05C82DE3297FF6FDE3CFEDF00');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "-1.234567890123456789012345678901234E+6144"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400f2af967ed05c82de3297ff6fde3cfedf00
-{"d":{"$numberDecimal":"-1.234567890123456789012345678901234E+6144"}}
-18000000136400f2af967ed05c82de3297ff6fde3cfedf00
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-018.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-018.phpt
deleted file mode 100644
index 9358d4d3..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-018.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [decq131] fold-downs (more below)
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400000000807F1BCF85B27059C8A43CFEDF00');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "-1.230000000000000000000000000000000E+6144"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400000000807f1bcf85b27059c8a43cfedf00
-{"d":{"$numberDecimal":"-1.230000000000000000000000000000000E+6144"}}
-18000000136400000000807f1bcf85b27059c8a43cfedf00
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-019.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-019.phpt
deleted file mode 100644
index 9d0b313e..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-019.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [decq162] fold-downs (more below)
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364007B000000000000000000000000003CB000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "-1.23"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364007b000000000000000000000000003cb000
-{"d":{"$numberDecimal":"-1.23"}}
-180000001364007b000000000000000000000000003cb000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-020.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-020.phpt
deleted file mode 100644
index 4d3173bd..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-020.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [decq176] Nmin and below
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400010000000A5BC138938D44C64D31008000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "-1.000000000000000000000000000000001E-6143"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400010000000a5bc138938d44c64d31008000
-{"d":{"$numberDecimal":"-1.000000000000000000000000000000001E-6143"}}
-18000000136400010000000a5bc138938d44c64d31008000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-021.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-021.phpt
deleted file mode 100644
index df4f33e3..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-021.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [decq174] Nmin and below
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400000000000A5BC138938D44C64D31008000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "-1.000000000000000000000000000000000E-6143"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400000000000a5bc138938d44c64d31008000
-{"d":{"$numberDecimal":"-1.000000000000000000000000000000000E-6143"}}
-18000000136400000000000a5bc138938d44c64d31008000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-022.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-022.phpt
deleted file mode 100644
index f85188f9..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-022.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [decq133] fold-downs (more below)
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400000000000A5BC138938D44C64D31FEDF00');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "-1.000000000000000000000000000000000E+6144"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400000000000a5bc138938d44c64d31fedf00
-{"d":{"$numberDecimal":"-1.000000000000000000000000000000000E+6144"}}
-18000000136400000000000a5bc138938d44c64d31fedf00
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-023.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-023.phpt
deleted file mode 100644
index af345e7d..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-023.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [decq160] fold-downs (more below)
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400010000000000000000000000000040B000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "-1"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400010000000000000000000000000040b000
-{"d":{"$numberDecimal":"-1"}}
-18000000136400010000000000000000000000000040b000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-024.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-024.phpt
deleted file mode 100644
index 9e7c0fbf..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-024.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [decq172] Nmin and below
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000100000000000000000000000000428000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "-1E-6143"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000100000000000000000000000000428000
-{"d":{"$numberDecimal":"-1E-6143"}}
-180000001364000100000000000000000000000000428000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-025.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-025.phpt
deleted file mode 100644
index 3e044b38..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-025.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [decq010] derivative canonical plain strings
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400EE020000000000000000000000003AB000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "-0.750"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400ee020000000000000000000000003ab000
-{"d":{"$numberDecimal":"-0.750"}}
-18000000136400ee020000000000000000000000003ab000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-026.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-026.phpt
deleted file mode 100644
index b1a15ab6..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-026.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [decq012] derivative canonical plain strings
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400EE0200000000000000000000000038B000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "-0.0750"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400ee0200000000000000000000000038b000
-{"d":{"$numberDecimal":"-0.0750"}}
-18000000136400ee0200000000000000000000000038b000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-027.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-027.phpt
deleted file mode 100644
index b02d423a..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-027.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [decq014] derivative canonical plain strings
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400EE0200000000000000000000000034B000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "-0.000750"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400ee0200000000000000000000000034b000
-{"d":{"$numberDecimal":"-0.000750"}}
-18000000136400ee0200000000000000000000000034b000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-028.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-028.phpt
deleted file mode 100644
index 21492e6a..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-028.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [decq016] derivative canonical plain strings
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400EE0200000000000000000000000030B000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "-0.00000750"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400ee0200000000000000000000000030b000
-{"d":{"$numberDecimal":"-0.00000750"}}
-18000000136400ee0200000000000000000000000030b000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-029.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-029.phpt
deleted file mode 100644
index ac32f98d..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-029.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [decq404] zeros
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000000000000000000000000000000000000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "0E-6176"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000000000000000000000000000000000000
-{"d":{"$numberDecimal":"0E-6176"}}
-180000001364000000000000000000000000000000000000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-030.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-030.phpt
deleted file mode 100644
index a82fa76e..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-030.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [decq424] negative zeros
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000000000000000000000000000000008000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "-0E-6176"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000000000000000000000000000000008000
-{"d":{"$numberDecimal":"-0E-6176"}}
-180000001364000000000000000000000000000000008000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-031.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-031.phpt
deleted file mode 100644
index ab496f70..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-031.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [decq407] zeros
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('1800000013640000000000000000000000000000003C3000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "0.00"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-1800000013640000000000000000000000000000003c3000
-{"d":{"$numberDecimal":"0.00"}}
-1800000013640000000000000000000000000000003c3000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-032.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-032.phpt
deleted file mode 100644
index a6a046e0..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-032.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [decq427] negative zeros
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('1800000013640000000000000000000000000000003CB000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "-0.00"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-1800000013640000000000000000000000000000003cb000
-{"d":{"$numberDecimal":"-0.00"}}
-1800000013640000000000000000000000000000003cb000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-033.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-033.phpt
deleted file mode 100644
index 84f47d42..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-033.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [decq409] zeros
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000000000000000000000000000000403000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "0"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000000000000000000000000000000403000
-{"d":{"$numberDecimal":"0"}}
-180000001364000000000000000000000000000000403000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-034.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-034.phpt
deleted file mode 100644
index b37b49a3..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-034.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [decq428] negative zeros
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400000000000000000000000000000040B000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "-0"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400000000000000000000000000000040b000
-{"d":{"$numberDecimal":"-0"}}
-18000000136400000000000000000000000000000040b000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-035.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-035.phpt
deleted file mode 100644
index c70dbbaa..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-035.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [decq700] Selected DPD codes
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000000000000000000000000000000403000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "0"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000000000000000000000000000000403000
-{"d":{"$numberDecimal":"0"}}
-180000001364000000000000000000000000000000403000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-036.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-036.phpt
deleted file mode 100644
index 11d0ea13..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-036.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [decq406] zeros
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('1800000013640000000000000000000000000000003C3000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "0.00"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-1800000013640000000000000000000000000000003c3000
-{"d":{"$numberDecimal":"0.00"}}
-1800000013640000000000000000000000000000003c3000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-037.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-037.phpt
deleted file mode 100644
index 1dcce834..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-037.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [decq426] negative zeros
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('1800000013640000000000000000000000000000003CB000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "-0.00"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-1800000013640000000000000000000000000000003cb000
-{"d":{"$numberDecimal":"-0.00"}}
-1800000013640000000000000000000000000000003cb000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-038.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-038.phpt
deleted file mode 100644
index 2abfd57b..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-038.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [decq410] zeros
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000000000000000000000000000000463000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "0E+3"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000000000000000000000000000000463000
-{"d":{"$numberDecimal":"0E+3"}}
-180000001364000000000000000000000000000000463000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-039.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-039.phpt
deleted file mode 100644
index 214355e8..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-039.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [decq431] negative zeros
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400000000000000000000000000000046B000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "-0E+3"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400000000000000000000000000000046b000
-{"d":{"$numberDecimal":"-0E+3"}}
-18000000136400000000000000000000000000000046b000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-040.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-040.phpt
deleted file mode 100644
index bb132d35..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-040.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [decq419] clamped zeros...
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000000000000000000000000000000FE5F00');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "0E+6111"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000000000000000000000000000000fe5f00
-{"d":{"$numberDecimal":"0E+6111"}}
-180000001364000000000000000000000000000000fe5f00
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-041.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-041.phpt
deleted file mode 100644
index fc416c6a..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-041.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [decq432] negative zeros
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000000000000000000000000000000FEDF00');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "-0E+6111"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000000000000000000000000000000fedf00
-{"d":{"$numberDecimal":"-0E+6111"}}
-180000001364000000000000000000000000000000fedf00
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-042.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-042.phpt
deleted file mode 100644
index 8a940f8e..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-042.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [decq405] zeros
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000000000000000000000000000000000000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "0E-6176"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000000000000000000000000000000000000
-{"d":{"$numberDecimal":"0E-6176"}}
-180000001364000000000000000000000000000000000000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-043.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-043.phpt
deleted file mode 100644
index 837a11f5..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-043.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [decq425] negative zeros
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000000000000000000000000000000008000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "-0E-6176"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000000000000000000000000000000008000
-{"d":{"$numberDecimal":"-0E-6176"}}
-180000001364000000000000000000000000000000008000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-044.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-044.phpt
deleted file mode 100644
index 92ad6693..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-044.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [decq508] Specials
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000000000000000000000000000000007800');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "Infinity"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000000000000000000000000000000007800
-{"d":{"$numberDecimal":"Infinity"}}
-180000001364000000000000000000000000000000007800
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-045.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-045.phpt
deleted file mode 100644
index 1a006102..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-045.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [decq528] Specials
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400000000000000000000000000000000F800');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "-Infinity"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400000000000000000000000000000000f800
-{"d":{"$numberDecimal":"-Infinity"}}
-18000000136400000000000000000000000000000000f800
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-046.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-046.phpt
deleted file mode 100644
index 66a4cb45..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-046.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [decq541] Specials
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000000000000000000000000000000007C00');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "NaN"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000000000000000000000000000000007c00
-{"d":{"$numberDecimal":"NaN"}}
-180000001364000000000000000000000000000000007c00
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-047.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-047.phpt
deleted file mode 100644
index 96b31964..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-047.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [decq074] Nmin and below
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400000000000A5BC138938D44C64D31000000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.000000000000000000000000000000000E-6143"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400000000000a5bc138938d44c64d31000000
-{"d":{"$numberDecimal":"1.000000000000000000000000000000000E-6143"}}
-18000000136400000000000a5bc138938d44c64d31000000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-048.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-048.phpt
deleted file mode 100644
index f5c2bafa..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-048.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [decq602] fold-down full sequence
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400000000000A5BC138938D44C64D31FE5F00');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.000000000000000000000000000000000E+6144"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400000000000a5bc138938d44c64d31fe5f00
-{"d":{"$numberDecimal":"1.000000000000000000000000000000000E+6144"}}
-18000000136400000000000a5bc138938d44c64d31fe5f00
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-049.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-049.phpt
deleted file mode 100644
index 9360263e..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-049.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [decq604] fold-down full sequence
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000000000081EFAC855B416D2DEE04FE5F00');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.00000000000000000000000000000000E+6143"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000000000081efac855b416d2dee04fe5f00
-{"d":{"$numberDecimal":"1.00000000000000000000000000000000E+6143"}}
-180000001364000000000081efac855b416d2dee04fe5f00
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-050.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-050.phpt
deleted file mode 100644
index d79ad92c..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-050.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [decq606] fold-down full sequence
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('1800000013640000000080264B91C02220BE377E00FE5F00');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.0000000000000000000000000000000E+6142"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-1800000013640000000080264b91c02220be377e00fe5f00
-{"d":{"$numberDecimal":"1.0000000000000000000000000000000E+6142"}}
-1800000013640000000080264b91c02220be377e00fe5f00
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-051.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-051.phpt
deleted file mode 100644
index a2dad639..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-051.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [decq608] fold-down full sequence
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('1800000013640000000040EAED7446D09C2C9F0C00FE5F00');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.000000000000000000000000000000E+6141"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-1800000013640000000040eaed7446d09c2c9f0c00fe5f00
-{"d":{"$numberDecimal":"1.000000000000000000000000000000E+6141"}}
-1800000013640000000040eaed7446d09c2c9f0c00fe5f00
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-052.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-052.phpt
deleted file mode 100644
index 392346b6..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-052.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [decq610] fold-down full sequence
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400000000A0CA17726DAE0F1E430100FE5F00');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.00000000000000000000000000000E+6140"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400000000a0ca17726dae0f1e430100fe5f00
-{"d":{"$numberDecimal":"1.00000000000000000000000000000E+6140"}}
-18000000136400000000a0ca17726dae0f1e430100fe5f00
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-053.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-053.phpt
deleted file mode 100644
index ed1fad96..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-053.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [decq612] fold-down full sequence
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400000000106102253E5ECE4F200000FE5F00');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.0000000000000000000000000000E+6139"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400000000106102253e5ece4f200000fe5f00
-{"d":{"$numberDecimal":"1.0000000000000000000000000000E+6139"}}
-18000000136400000000106102253e5ece4f200000fe5f00
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-054.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-054.phpt
deleted file mode 100644
index a845833e..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-054.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [decq614] fold-down full sequence
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400000000E83C80D09F3C2E3B030000FE5F00');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.000000000000000000000000000E+6138"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400000000e83c80d09f3c2e3b030000fe5f00
-{"d":{"$numberDecimal":"1.000000000000000000000000000E+6138"}}
-18000000136400000000e83c80d09f3c2e3b030000fe5f00
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-055.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-055.phpt
deleted file mode 100644
index 04946765..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-055.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [decq616] fold-down full sequence
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400000000E4D20CC8DCD2B752000000FE5F00');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.00000000000000000000000000E+6137"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400000000e4d20cc8dcd2b752000000fe5f00
-{"d":{"$numberDecimal":"1.00000000000000000000000000E+6137"}}
-18000000136400000000e4d20cc8dcd2b752000000fe5f00
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-056.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-056.phpt
deleted file mode 100644
index 27b1964c..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-056.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [decq618] fold-down full sequence
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000000004A48011416954508000000FE5F00');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.0000000000000000000000000E+6136"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000000004a48011416954508000000fe5f00
-{"d":{"$numberDecimal":"1.0000000000000000000000000E+6136"}}
-180000001364000000004a48011416954508000000fe5f00
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-057.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-057.phpt
deleted file mode 100644
index 9b6ce55b..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-057.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [decq620] fold-down full sequence
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400000000A1EDCCCE1BC2D300000000FE5F00');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.000000000000000000000000E+6135"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400000000a1edccce1bc2d300000000fe5f00
-{"d":{"$numberDecimal":"1.000000000000000000000000E+6135"}}
-18000000136400000000a1edccce1bc2d300000000fe5f00
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-058.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-058.phpt
deleted file mode 100644
index a1383e7e..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-058.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [decq622] fold-down full sequence
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400000080F64AE1C7022D1500000000FE5F00');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.00000000000000000000000E+6134"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400000080f64ae1c7022d1500000000fe5f00
-{"d":{"$numberDecimal":"1.00000000000000000000000E+6134"}}
-18000000136400000080f64ae1c7022d1500000000fe5f00
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-059.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-059.phpt
deleted file mode 100644
index f70b663d..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-059.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [decq624] fold-down full sequence
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400000040B2BAC9E0191E0200000000FE5F00');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.0000000000000000000000E+6133"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400000040b2bac9e0191e0200000000fe5f00
-{"d":{"$numberDecimal":"1.0000000000000000000000E+6133"}}
-18000000136400000040b2bac9e0191e0200000000fe5f00
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-060.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-060.phpt
deleted file mode 100644
index 7937092b..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-060.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [decq626] fold-down full sequence
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000000A0DEC5ADC935360000000000FE5F00');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.000000000000000000000E+6132"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000000a0dec5adc935360000000000fe5f00
-{"d":{"$numberDecimal":"1.000000000000000000000E+6132"}}
-180000001364000000a0dec5adc935360000000000fe5f00
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-061.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-061.phpt
deleted file mode 100644
index c2498ef6..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-061.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [decq628] fold-down full sequence
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400000010632D5EC76B050000000000FE5F00');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.00000000000000000000E+6131"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400000010632d5ec76b050000000000fe5f00
-{"d":{"$numberDecimal":"1.00000000000000000000E+6131"}}
-18000000136400000010632d5ec76b050000000000fe5f00
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-062.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-062.phpt
deleted file mode 100644
index 6d33364c..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-062.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [decq630] fold-down full sequence
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000000E8890423C78A000000000000FE5F00');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.0000000000000000000E+6130"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000000e8890423c78a000000000000fe5f00
-{"d":{"$numberDecimal":"1.0000000000000000000E+6130"}}
-180000001364000000e8890423c78a000000000000fe5f00
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-063.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-063.phpt
deleted file mode 100644
index 334df103..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-063.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [decq632] fold-down full sequence
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400000064A7B3B6E00D000000000000FE5F00');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.000000000000000000E+6129"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400000064a7b3b6e00d000000000000fe5f00
-{"d":{"$numberDecimal":"1.000000000000000000E+6129"}}
-18000000136400000064a7b3b6e00d000000000000fe5f00
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-064.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-064.phpt
deleted file mode 100644
index 89a00e20..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-064.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [decq634] fold-down full sequence
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('1800000013640000008A5D78456301000000000000FE5F00');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.00000000000000000E+6128"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-1800000013640000008a5d78456301000000000000fe5f00
-{"d":{"$numberDecimal":"1.00000000000000000E+6128"}}
-1800000013640000008a5d78456301000000000000fe5f00
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-065.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-065.phpt
deleted file mode 100644
index 7fe770ac..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-065.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [decq636] fold-down full sequence
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000000C16FF2862300000000000000FE5F00');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.0000000000000000E+6127"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000000c16ff2862300000000000000fe5f00
-{"d":{"$numberDecimal":"1.0000000000000000E+6127"}}
-180000001364000000c16ff2862300000000000000fe5f00
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-066.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-066.phpt
deleted file mode 100644
index 226482d3..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-066.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [decq638] fold-down full sequence
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000080C6A47E8D0300000000000000FE5F00');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.000000000000000E+6126"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000080c6a47e8d0300000000000000fe5f00
-{"d":{"$numberDecimal":"1.000000000000000E+6126"}}
-180000001364000080c6a47e8d0300000000000000fe5f00
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-067.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-067.phpt
deleted file mode 100644
index 05ad695a..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-067.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [decq640] fold-down full sequence
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('1800000013640000407A10F35A0000000000000000FE5F00');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.00000000000000E+6125"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-1800000013640000407a10f35a0000000000000000fe5f00
-{"d":{"$numberDecimal":"1.00000000000000E+6125"}}
-1800000013640000407a10f35a0000000000000000fe5f00
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-068.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-068.phpt
deleted file mode 100644
index eace276d..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-068.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [decq642] fold-down full sequence
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('1800000013640000A0724E18090000000000000000FE5F00');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.0000000000000E+6124"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-1800000013640000a0724e18090000000000000000fe5f00
-{"d":{"$numberDecimal":"1.0000000000000E+6124"}}
-1800000013640000a0724e18090000000000000000fe5f00
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-069.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-069.phpt
deleted file mode 100644
index 8756ccb1..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-069.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [decq644] fold-down full sequence
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000010A5D4E8000000000000000000FE5F00');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.000000000000E+6123"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000010a5d4e8000000000000000000fe5f00
-{"d":{"$numberDecimal":"1.000000000000E+6123"}}
-180000001364000010a5d4e8000000000000000000fe5f00
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-070.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-070.phpt
deleted file mode 100644
index cfd1f09f..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-070.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [decq646] fold-down full sequence
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('1800000013640000E8764817000000000000000000FE5F00');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.00000000000E+6122"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-1800000013640000e8764817000000000000000000fe5f00
-{"d":{"$numberDecimal":"1.00000000000E+6122"}}
-1800000013640000e8764817000000000000000000fe5f00
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-071.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-071.phpt
deleted file mode 100644
index cd5c9a27..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-071.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [decq648] fold-down full sequence
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('1800000013640000E40B5402000000000000000000FE5F00');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.0000000000E+6121"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-1800000013640000e40b5402000000000000000000fe5f00
-{"d":{"$numberDecimal":"1.0000000000E+6121"}}
-1800000013640000e40b5402000000000000000000fe5f00
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-072.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-072.phpt
deleted file mode 100644
index 29c5bd28..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-072.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [decq650] fold-down full sequence
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('1800000013640000CA9A3B00000000000000000000FE5F00');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.000000000E+6120"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-1800000013640000ca9a3b00000000000000000000fe5f00
-{"d":{"$numberDecimal":"1.000000000E+6120"}}
-1800000013640000ca9a3b00000000000000000000fe5f00
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-073.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-073.phpt
deleted file mode 100644
index ebe6788c..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-073.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [decq652] fold-down full sequence
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('1800000013640000E1F50500000000000000000000FE5F00');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.00000000E+6119"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-1800000013640000e1f50500000000000000000000fe5f00
-{"d":{"$numberDecimal":"1.00000000E+6119"}}
-1800000013640000e1f50500000000000000000000fe5f00
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-074.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-074.phpt
deleted file mode 100644
index e231ae07..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-074.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [decq654] fold-down full sequence
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364008096980000000000000000000000FE5F00');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.0000000E+6118"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364008096980000000000000000000000fe5f00
-{"d":{"$numberDecimal":"1.0000000E+6118"}}
-180000001364008096980000000000000000000000fe5f00
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-075.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-075.phpt
deleted file mode 100644
index 4e40158a..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-075.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [decq656] fold-down full sequence
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('1800000013640040420F0000000000000000000000FE5F00');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.000000E+6117"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-1800000013640040420f0000000000000000000000fe5f00
-{"d":{"$numberDecimal":"1.000000E+6117"}}
-1800000013640040420f0000000000000000000000fe5f00
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-076.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-076.phpt
deleted file mode 100644
index 9b597b6a..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-076.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [decq658] fold-down full sequence
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400A086010000000000000000000000FE5F00');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.00000E+6116"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400a086010000000000000000000000fe5f00
-{"d":{"$numberDecimal":"1.00000E+6116"}}
-18000000136400a086010000000000000000000000fe5f00
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-077.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-077.phpt
deleted file mode 100644
index 981907a8..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-077.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [decq660] fold-down full sequence
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364001027000000000000000000000000FE5F00');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.0000E+6115"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364001027000000000000000000000000fe5f00
-{"d":{"$numberDecimal":"1.0000E+6115"}}
-180000001364001027000000000000000000000000fe5f00
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-078.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-078.phpt
deleted file mode 100644
index dc949eab..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-078.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [decq662] fold-down full sequence
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400E803000000000000000000000000FE5F00');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.000E+6114"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400e803000000000000000000000000fe5f00
-{"d":{"$numberDecimal":"1.000E+6114"}}
-18000000136400e803000000000000000000000000fe5f00
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-079.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-079.phpt
deleted file mode 100644
index 6abdc8ad..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-079.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [decq664] fold-down full sequence
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364006400000000000000000000000000FE5F00');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.00E+6113"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364006400000000000000000000000000fe5f00
-{"d":{"$numberDecimal":"1.00E+6113"}}
-180000001364006400000000000000000000000000fe5f00
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-080.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-080.phpt
deleted file mode 100644
index 72fcc6eb..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-080.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [decq666] fold-down full sequence
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000A00000000000000000000000000FE5F00');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.0E+6112"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000a00000000000000000000000000fe5f00
-{"d":{"$numberDecimal":"1.0E+6112"}}
-180000001364000a00000000000000000000000000fe5f00
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-081.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-081.phpt
deleted file mode 100644
index 3dc21dba..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-081.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [decq060] fold-downs (more below)
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000100000000000000000000000000403000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "1"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000100000000000000000000000000403000
-{"d":{"$numberDecimal":"1"}}
-180000001364000100000000000000000000000000403000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-082.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-082.phpt
deleted file mode 100644
index 79634668..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-082.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [decq670] fold-down full sequence
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000100000000000000000000000000FC5F00');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "1E+6110"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000100000000000000000000000000fc5f00
-{"d":{"$numberDecimal":"1E+6110"}}
-180000001364000100000000000000000000000000fc5f00
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-083.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-083.phpt
deleted file mode 100644
index fb7c9c63..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-083.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [decq668] fold-down full sequence
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000100000000000000000000000000FE5F00');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "1E+6111"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000100000000000000000000000000fe5f00
-{"d":{"$numberDecimal":"1E+6111"}}
-180000001364000100000000000000000000000000fe5f00
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-084.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-084.phpt
deleted file mode 100644
index 52eb06e1..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-084.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [decq072] Nmin and below
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000100000000000000000000000000420000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "1E-6143"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000100000000000000000000000000420000
-{"d":{"$numberDecimal":"1E-6143"}}
-180000001364000100000000000000000000000000420000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-085.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-085.phpt
deleted file mode 100644
index 89a1d319..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-085.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [decq076] Nmin and below
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400010000000A5BC138938D44C64D31000000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.000000000000000000000000000000001E-6143"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400010000000a5bc138938d44c64d31000000
-{"d":{"$numberDecimal":"1.000000000000000000000000000000001E-6143"}}
-18000000136400010000000a5bc138938d44c64d31000000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-086.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-086.phpt
deleted file mode 100644
index 2b6a0d30..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-086.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [decq036] fold-downs (more below)
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400000000807F1BCF85B27059C8A43CFE5F00');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.230000000000000000000000000000000E+6144"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400000000807f1bcf85b27059c8a43cfe5f00
-{"d":{"$numberDecimal":"1.230000000000000000000000000000000E+6144"}}
-18000000136400000000807f1bcf85b27059c8a43cfe5f00
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-087.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-087.phpt
deleted file mode 100644
index 2087a9c1..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-087.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [decq062] fold-downs (more below)
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364007B000000000000000000000000003C3000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.23"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364007b000000000000000000000000003c3000
-{"d":{"$numberDecimal":"1.23"}}
-180000001364007b000000000000000000000000003c3000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-088.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-088.phpt
deleted file mode 100644
index f44fd0ce..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-088.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [decq034] Nmax and similar
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400F2AF967ED05C82DE3297FF6FDE3CFE5F00');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.234567890123456789012345678901234E+6144"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400f2af967ed05c82de3297ff6fde3cfe5f00
-{"d":{"$numberDecimal":"1.234567890123456789012345678901234E+6144"}}
-18000000136400f2af967ed05c82de3297ff6fde3cfe5f00
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-089.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-089.phpt
deleted file mode 100644
index 245e9785..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-089.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [decq441] exponent lengths
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000700000000000000000000000000403000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "7"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000700000000000000000000000000403000
-{"d":{"$numberDecimal":"7"}}
-180000001364000700000000000000000000000000403000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-090.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-090.phpt
deleted file mode 100644
index 45f7b400..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-090.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [decq449] exponent lengths
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('1800000013640007000000000000000000000000001E5F00');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "7E+5999"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-1800000013640007000000000000000000000000001e5f00
-{"d":{"$numberDecimal":"7E+5999"}}
-1800000013640007000000000000000000000000001e5f00
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-091.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-091.phpt
deleted file mode 100644
index f6aa59a0..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-091.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [decq447] exponent lengths
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('1800000013640007000000000000000000000000000E3800');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "7E+999"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-1800000013640007000000000000000000000000000e3800
-{"d":{"$numberDecimal":"7E+999"}}
-1800000013640007000000000000000000000000000e3800
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-092.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-092.phpt
deleted file mode 100644
index afb6673d..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-092.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [decq445] exponent lengths
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000700000000000000000000000000063100');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "7E+99"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000700000000000000000000000000063100
-{"d":{"$numberDecimal":"7E+99"}}
-180000001364000700000000000000000000000000063100
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-093.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-093.phpt
deleted file mode 100644
index 615a0d26..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-093.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [decq443] exponent lengths
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000700000000000000000000000000523000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "7E+9"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000700000000000000000000000000523000
-{"d":{"$numberDecimal":"7E+9"}}
-180000001364000700000000000000000000000000523000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-094.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-094.phpt
deleted file mode 100644
index 52c31152..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-094.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [decq842] VG testcase
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000000FED83F4E7C9FE4E269E38A5BCD1700');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "7.049000000000010795488000000000000E-3097"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000000fed83f4e7c9fe4e269e38a5bcd1700
-{"d":{"$numberDecimal":"7.049000000000010795488000000000000E-3097"}}
-180000001364000000fed83f4e7c9fe4e269e38a5bcd1700
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-095.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-095.phpt
deleted file mode 100644
index 13cebaa5..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-095.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [decq841] VG testcase
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000000203B9DB5056F000000000000002400');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "8.000000000000000000E-1550"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000000203b9db5056f000000000000002400
-{"d":{"$numberDecimal":"8.000000000000000000E-1550"}}
-180000001364000000203b9db5056f000000000000002400
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-096.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-096.phpt
deleted file mode 100644
index bb4ac46e..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-096.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [decq840] VG testcase
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364003C17258419D710C42F0000000000002400');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "8.81125000000001349436E-1548"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364003c17258419d710c42f0000000000002400
-{"d":{"$numberDecimal":"8.81125000000001349436E-1548"}}
-180000001364003c17258419d710c42f0000000000002400
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-097.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-097.phpt
deleted file mode 100644
index d00e1844..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-097.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [decq701] Selected DPD codes
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000900000000000000000000000000403000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "9"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000900000000000000000000000000403000
-{"d":{"$numberDecimal":"9"}}
-180000001364000900000000000000000000000000403000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-098.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-098.phpt
deleted file mode 100644
index e6360a4d..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-098.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [decq032] Nmax and similar
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400FFFFFFFF638E8D37C087ADBE09EDFF5F00');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "9.999999999999999999999999999999999E+6144"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400ffffffff638e8d37c087adbe09edff5f00
-{"d":{"$numberDecimal":"9.999999999999999999999999999999999E+6144"}}
-18000000136400ffffffff638e8d37c087adbe09edff5f00
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-099.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-099.phpt
deleted file mode 100644
index d44cba63..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-099.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [decq702] Selected DPD codes
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000A00000000000000000000000000403000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "10"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000a00000000000000000000000000403000
-{"d":{"$numberDecimal":"10"}}
-180000001364000a00000000000000000000000000403000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-100.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-100.phpt
deleted file mode 100644
index a9698eb5..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-100.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [decq057] fold-downs (more below)
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000C00000000000000000000000000403000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "12"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000c00000000000000000000000000403000
-{"d":{"$numberDecimal":"12"}}
-180000001364000c00000000000000000000000000403000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-101.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-101.phpt
deleted file mode 100644
index bd1fbb96..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-101.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [decq703] Selected DPD codes
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364001300000000000000000000000000403000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "19"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364001300000000000000000000000000403000
-{"d":{"$numberDecimal":"19"}}
-180000001364001300000000000000000000000000403000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-102.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-102.phpt
deleted file mode 100644
index c4a1323c..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-102.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [decq704] Selected DPD codes
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364001400000000000000000000000000403000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "20"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364001400000000000000000000000000403000
-{"d":{"$numberDecimal":"20"}}
-180000001364001400000000000000000000000000403000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-103.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-103.phpt
deleted file mode 100644
index 8fd719cf..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-103.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [decq705] Selected DPD codes
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364001D00000000000000000000000000403000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "29"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364001d00000000000000000000000000403000
-{"d":{"$numberDecimal":"29"}}
-180000001364001d00000000000000000000000000403000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-104.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-104.phpt
deleted file mode 100644
index 907fa545..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-104.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [decq706] Selected DPD codes
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364001E00000000000000000000000000403000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "30"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364001e00000000000000000000000000403000
-{"d":{"$numberDecimal":"30"}}
-180000001364001e00000000000000000000000000403000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-105.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-105.phpt
deleted file mode 100644
index b99e6bc7..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-105.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [decq707] Selected DPD codes
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364002700000000000000000000000000403000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "39"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364002700000000000000000000000000403000
-{"d":{"$numberDecimal":"39"}}
-180000001364002700000000000000000000000000403000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-106.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-106.phpt
deleted file mode 100644
index 0cee1f0f..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-106.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [decq708] Selected DPD codes
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364002800000000000000000000000000403000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "40"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364002800000000000000000000000000403000
-{"d":{"$numberDecimal":"40"}}
-180000001364002800000000000000000000000000403000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-107.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-107.phpt
deleted file mode 100644
index 32d8f2f7..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-107.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [decq709] Selected DPD codes
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364003100000000000000000000000000403000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "49"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364003100000000000000000000000000403000
-{"d":{"$numberDecimal":"49"}}
-180000001364003100000000000000000000000000403000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-108.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-108.phpt
deleted file mode 100644
index 4532b931..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-108.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [decq710] Selected DPD codes
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364003200000000000000000000000000403000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "50"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364003200000000000000000000000000403000
-{"d":{"$numberDecimal":"50"}}
-180000001364003200000000000000000000000000403000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-109.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-109.phpt
deleted file mode 100644
index 20a2eada..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-109.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [decq711] Selected DPD codes
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364003B00000000000000000000000000403000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "59"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364003b00000000000000000000000000403000
-{"d":{"$numberDecimal":"59"}}
-180000001364003b00000000000000000000000000403000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-110.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-110.phpt
deleted file mode 100644
index 6fcf1b86..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-110.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [decq712] Selected DPD codes
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364003C00000000000000000000000000403000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "60"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364003c00000000000000000000000000403000
-{"d":{"$numberDecimal":"60"}}
-180000001364003c00000000000000000000000000403000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-111.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-111.phpt
deleted file mode 100644
index 2c63e557..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-111.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [decq713] Selected DPD codes
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364004500000000000000000000000000403000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "69"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364004500000000000000000000000000403000
-{"d":{"$numberDecimal":"69"}}
-180000001364004500000000000000000000000000403000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-112.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-112.phpt
deleted file mode 100644
index 754575a3..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-112.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [decq714] Selected DPD codes
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364004600000000000000000000000000403000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "70"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364004600000000000000000000000000403000
-{"d":{"$numberDecimal":"70"}}
-180000001364004600000000000000000000000000403000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-113.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-113.phpt
deleted file mode 100644
index d1c9befd..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-113.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [decq715] Selected DPD codes
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364004700000000000000000000000000403000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "71"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364004700000000000000000000000000403000
-{"d":{"$numberDecimal":"71"}}
-180000001364004700000000000000000000000000403000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-114.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-114.phpt
deleted file mode 100644
index a8694e18..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-114.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [decq716] Selected DPD codes
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364004800000000000000000000000000403000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "72"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364004800000000000000000000000000403000
-{"d":{"$numberDecimal":"72"}}
-180000001364004800000000000000000000000000403000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-115.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-115.phpt
deleted file mode 100644
index f2aa1bda..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-115.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [decq717] Selected DPD codes
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364004900000000000000000000000000403000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "73"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364004900000000000000000000000000403000
-{"d":{"$numberDecimal":"73"}}
-180000001364004900000000000000000000000000403000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-116.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-116.phpt
deleted file mode 100644
index 73ff23ca..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-116.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [decq718] Selected DPD codes
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364004A00000000000000000000000000403000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "74"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364004a00000000000000000000000000403000
-{"d":{"$numberDecimal":"74"}}
-180000001364004a00000000000000000000000000403000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-117.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-117.phpt
deleted file mode 100644
index eac2b15c..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-117.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [decq719] Selected DPD codes
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364004B00000000000000000000000000403000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "75"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364004b00000000000000000000000000403000
-{"d":{"$numberDecimal":"75"}}
-180000001364004b00000000000000000000000000403000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-118.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-118.phpt
deleted file mode 100644
index 980a99e1..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-118.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [decq720] Selected DPD codes
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364004C00000000000000000000000000403000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "76"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364004c00000000000000000000000000403000
-{"d":{"$numberDecimal":"76"}}
-180000001364004c00000000000000000000000000403000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-119.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-119.phpt
deleted file mode 100644
index b7d1607a..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-119.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [decq721] Selected DPD codes
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364004D00000000000000000000000000403000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "77"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364004d00000000000000000000000000403000
-{"d":{"$numberDecimal":"77"}}
-180000001364004d00000000000000000000000000403000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-120.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-120.phpt
deleted file mode 100644
index 67f5a397..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-120.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [decq722] Selected DPD codes
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364004E00000000000000000000000000403000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "78"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364004e00000000000000000000000000403000
-{"d":{"$numberDecimal":"78"}}
-180000001364004e00000000000000000000000000403000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-121.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-121.phpt
deleted file mode 100644
index bf66612d..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-121.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [decq723] Selected DPD codes
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364004F00000000000000000000000000403000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "79"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364004f00000000000000000000000000403000
-{"d":{"$numberDecimal":"79"}}
-180000001364004f00000000000000000000000000403000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-122.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-122.phpt
deleted file mode 100644
index c22660d7..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-122.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [decq056] fold-downs (more below)
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364007B00000000000000000000000000403000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "123"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364007b00000000000000000000000000403000
-{"d":{"$numberDecimal":"123"}}
-180000001364007b00000000000000000000000000403000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-123.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-123.phpt
deleted file mode 100644
index f7042939..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-123.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [decq064] fold-downs (more below)
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('1800000013640039300000000000000000000000003C3000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "123.45"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-1800000013640039300000000000000000000000003c3000
-{"d":{"$numberDecimal":"123.45"}}
-1800000013640039300000000000000000000000003c3000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-124.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-124.phpt
deleted file mode 100644
index 6d2b746e..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-124.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [decq732] Selected DPD codes
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000802000000000000000000000000403000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "520"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000802000000000000000000000000403000
-{"d":{"$numberDecimal":"520"}}
-180000001364000802000000000000000000000000403000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-125.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-125.phpt
deleted file mode 100644
index 8a748bf4..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-125.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [decq733] Selected DPD codes
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000902000000000000000000000000403000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "521"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000902000000000000000000000000403000
-{"d":{"$numberDecimal":"521"}}
-180000001364000902000000000000000000000000403000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-126.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-126.phpt
deleted file mode 100644
index 2ac3bc09..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-126.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [decq740] DPD: one of each of the huffman groups
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000903000000000000000000000000403000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "777"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000903000000000000000000000000403000
-{"d":{"$numberDecimal":"777"}}
-180000001364000903000000000000000000000000403000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-127.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-127.phpt
deleted file mode 100644
index a72535bd..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-127.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [decq741] DPD: one of each of the huffman groups
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000A03000000000000000000000000403000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "778"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000a03000000000000000000000000403000
-{"d":{"$numberDecimal":"778"}}
-180000001364000a03000000000000000000000000403000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-128.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-128.phpt
deleted file mode 100644
index f5fb3160..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-128.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [decq742] DPD: one of each of the huffman groups
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364001303000000000000000000000000403000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "787"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364001303000000000000000000000000403000
-{"d":{"$numberDecimal":"787"}}
-180000001364001303000000000000000000000000403000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-129.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-129.phpt
deleted file mode 100644
index 6945d67f..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-129.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [decq746] DPD: one of each of the huffman groups
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364001F03000000000000000000000000403000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "799"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364001f03000000000000000000000000403000
-{"d":{"$numberDecimal":"799"}}
-180000001364001f03000000000000000000000000403000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-130.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-130.phpt
deleted file mode 100644
index 23324be6..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-130.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [decq743] DPD: one of each of the huffman groups
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364006D03000000000000000000000000403000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "877"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364006d03000000000000000000000000403000
-{"d":{"$numberDecimal":"877"}}
-180000001364006d03000000000000000000000000403000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-131.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-131.phpt
deleted file mode 100644
index 564d4b0b..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-131.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [decq753] DPD all-highs cases (includes the 24 redundant codes)
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364007803000000000000000000000000403000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "888"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364007803000000000000000000000000403000
-{"d":{"$numberDecimal":"888"}}
-180000001364007803000000000000000000000000403000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-132.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-132.phpt
deleted file mode 100644
index 673fe096..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-132.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [decq754] DPD all-highs cases (includes the 24 redundant codes)
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364007903000000000000000000000000403000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "889"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364007903000000000000000000000000403000
-{"d":{"$numberDecimal":"889"}}
-180000001364007903000000000000000000000000403000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-133.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-133.phpt
deleted file mode 100644
index 2ff19d9b..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-133.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [decq760] DPD all-highs cases (includes the 24 redundant codes)
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364008203000000000000000000000000403000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "898"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364008203000000000000000000000000403000
-{"d":{"$numberDecimal":"898"}}
-180000001364008203000000000000000000000000403000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-134.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-134.phpt
deleted file mode 100644
index 3fafee40..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-134.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [decq764] DPD all-highs cases (includes the 24 redundant codes)
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364008303000000000000000000000000403000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "899"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364008303000000000000000000000000403000
-{"d":{"$numberDecimal":"899"}}
-180000001364008303000000000000000000000000403000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-135.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-135.phpt
deleted file mode 100644
index 5e4b1803..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-135.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [decq745] DPD: one of each of the huffman groups
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400D303000000000000000000000000403000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "979"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400d303000000000000000000000000403000
-{"d":{"$numberDecimal":"979"}}
-18000000136400d303000000000000000000000000403000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-136.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-136.phpt
deleted file mode 100644
index cf3960e8..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-136.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [decq770] DPD all-highs cases (includes the 24 redundant codes)
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400DC03000000000000000000000000403000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "988"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400dc03000000000000000000000000403000
-{"d":{"$numberDecimal":"988"}}
-18000000136400dc03000000000000000000000000403000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-137.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-137.phpt
deleted file mode 100644
index c897e658..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-137.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [decq774] DPD all-highs cases (includes the 24 redundant codes)
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400DD03000000000000000000000000403000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "989"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400dd03000000000000000000000000403000
-{"d":{"$numberDecimal":"989"}}
-18000000136400dd03000000000000000000000000403000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-138.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-138.phpt
deleted file mode 100644
index 93ff23f9..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-138.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [decq730] Selected DPD codes
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400E203000000000000000000000000403000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "994"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400e203000000000000000000000000403000
-{"d":{"$numberDecimal":"994"}}
-18000000136400e203000000000000000000000000403000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-139.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-139.phpt
deleted file mode 100644
index 15c3ea46..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-139.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [decq731] Selected DPD codes
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400E303000000000000000000000000403000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "995"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400e303000000000000000000000000403000
-{"d":{"$numberDecimal":"995"}}
-18000000136400e303000000000000000000000000403000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-140.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-140.phpt
deleted file mode 100644
index 18d51cfb..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-140.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [decq744] DPD: one of each of the huffman groups
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400E503000000000000000000000000403000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "997"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400e503000000000000000000000000403000
-{"d":{"$numberDecimal":"997"}}
-18000000136400e503000000000000000000000000403000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-141.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-141.phpt
deleted file mode 100644
index 8ce50e98..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-141.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [decq780] DPD all-highs cases (includes the 24 redundant codes)
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400E603000000000000000000000000403000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "998"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400e603000000000000000000000000403000
-{"d":{"$numberDecimal":"998"}}
-18000000136400e603000000000000000000000000403000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-142.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-142.phpt
deleted file mode 100644
index 5c481e1c..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-142.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [decq787] DPD all-highs cases (includes the 24 redundant codes)
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400E703000000000000000000000000403000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "999"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400e703000000000000000000000000403000
-{"d":{"$numberDecimal":"999"}}
-18000000136400e703000000000000000000000000403000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-143.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-143.phpt
deleted file mode 100644
index 69001e9b..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-143.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [decq053] fold-downs (more below)
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400D204000000000000000000000000403000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "1234"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400d204000000000000000000000000403000
-{"d":{"$numberDecimal":"1234"}}
-18000000136400d204000000000000000000000000403000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-144.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-144.phpt
deleted file mode 100644
index b37a50e7..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-144.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [decq052] fold-downs (more below)
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364003930000000000000000000000000403000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "12345"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364003930000000000000000000000000403000
-{"d":{"$numberDecimal":"12345"}}
-180000001364003930000000000000000000000000403000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-145.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-145.phpt
deleted file mode 100644
index 2649064f..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-145.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [decq792] Miscellaneous (testers' queries, etc.)
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364003075000000000000000000000000403000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "30000"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364003075000000000000000000000000403000
-{"d":{"$numberDecimal":"30000"}}
-180000001364003075000000000000000000000000403000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-146.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-146.phpt
deleted file mode 100644
index 26d27c5b..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-146.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [decq793] Miscellaneous (testers' queries, etc.)
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('1800000013640090940D0000000000000000000000403000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "890000"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-1800000013640090940d0000000000000000000000403000
-{"d":{"$numberDecimal":"890000"}}
-1800000013640090940d0000000000000000000000403000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-147.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-147.phpt
deleted file mode 100644
index f8cb615a..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-147.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [decq824] values around [u]int32 edges (zeros done earlier)
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400FEFFFF7F00000000000000000000403000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "2147483646"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400feffff7f00000000000000000000403000
-{"d":{"$numberDecimal":"2147483646"}}
-18000000136400feffff7f00000000000000000000403000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-148.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-148.phpt
deleted file mode 100644
index 224f9f9e..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-148.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [decq825] values around [u]int32 edges (zeros done earlier)
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400FFFFFF7F00000000000000000000403000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "2147483647"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400ffffff7f00000000000000000000403000
-{"d":{"$numberDecimal":"2147483647"}}
-18000000136400ffffff7f00000000000000000000403000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-149.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-149.phpt
deleted file mode 100644
index 43d30819..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-149.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [decq826] values around [u]int32 edges (zeros done earlier)
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000000008000000000000000000000403000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "2147483648"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000000008000000000000000000000403000
-{"d":{"$numberDecimal":"2147483648"}}
-180000001364000000008000000000000000000000403000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-150.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-150.phpt
deleted file mode 100644
index 93bd2e7c..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-150.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [decq827] values around [u]int32 edges (zeros done earlier)
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000100008000000000000000000000403000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "2147483649"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000100008000000000000000000000403000
-{"d":{"$numberDecimal":"2147483649"}}
-180000001364000100008000000000000000000000403000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-151.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-151.phpt
deleted file mode 100644
index 6d031205..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-151.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [decq828] values around [u]int32 edges (zeros done earlier)
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400FEFFFFFF00000000000000000000403000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "4294967294"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400feffffff00000000000000000000403000
-{"d":{"$numberDecimal":"4294967294"}}
-18000000136400feffffff00000000000000000000403000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-152.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-152.phpt
deleted file mode 100644
index 6750eca0..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-152.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [decq829] values around [u]int32 edges (zeros done earlier)
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400FFFFFFFF00000000000000000000403000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "4294967295"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400ffffffff00000000000000000000403000
-{"d":{"$numberDecimal":"4294967295"}}
-18000000136400ffffffff00000000000000000000403000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-153.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-153.phpt
deleted file mode 100644
index 6751034a..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-153.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [decq830] values around [u]int32 edges (zeros done earlier)
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000000000001000000000000000000403000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "4294967296"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000000000001000000000000000000403000
-{"d":{"$numberDecimal":"4294967296"}}
-180000001364000000000001000000000000000000403000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-154.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-154.phpt
deleted file mode 100644
index 1a76e882..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-154.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [decq831] values around [u]int32 edges (zeros done earlier)
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000100000001000000000000000000403000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "4294967297"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000100000001000000000000000000403000
-{"d":{"$numberDecimal":"4294967297"}}
-180000001364000100000001000000000000000000403000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-155.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-155.phpt
deleted file mode 100644
index 9c9bb991..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-155.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [decq022] Normality
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400C7711CC7B548F377DC80A131C836403000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "1111111111111111111111111111111111"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400c7711cc7b548f377dc80a131c836403000
-{"d":{"$numberDecimal":"1111111111111111111111111111111111"}}
-18000000136400c7711cc7b548f377dc80a131c836403000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-156.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-156.phpt
deleted file mode 100644
index 9db7feab..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-156.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [decq020] Normality
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400F2AF967ED05C82DE3297FF6FDE3C403000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "1234567890123456789012345678901234"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400f2af967ed05c82de3297ff6fde3c403000
-{"d":{"$numberDecimal":"1234567890123456789012345678901234"}}
-18000000136400f2af967ed05c82de3297ff6fde3c403000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-157.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-157.phpt
deleted file mode 100644
index d4de9cff..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-2-valid-157.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [decq550] Specials
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400FFFFFFFF638E8D37C087ADBE09ED413000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "9999999999999999999999999999999999"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400ffffffff638e8d37c087adbe09ed413000
-{"d":{"$numberDecimal":"9999999999999999999999999999999999"}}
-18000000136400ffffffff638e8d37c087adbe09ed413000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-001.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-001.phpt
deleted file mode 100644
index e40be767..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-001.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx066] strings without E cannot generate E in result
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400185C0ACE0000000000000000000038B000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "-345678.5432"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "-00345678.5432"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400185c0ace0000000000000000000038b000
-{"d":{"$numberDecimal":"-345678.5432"}}
-18000000136400185c0ace0000000000000000000038b000
-18000000136400185c0ace0000000000000000000038b000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-002.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-002.phpt
deleted file mode 100644
index d0658bd5..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-002.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx065] strings without E cannot generate E in result
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400185C0ACE0000000000000000000038B000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "-345678.5432"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "-0345678.5432"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400185c0ace0000000000000000000038b000
-{"d":{"$numberDecimal":"-345678.5432"}}
-18000000136400185c0ace0000000000000000000038b000
-18000000136400185c0ace0000000000000000000038b000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-003.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-003.phpt
deleted file mode 100644
index 8b09cb91..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-003.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [basx064] strings without E cannot generate E in result
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400185C0ACE0000000000000000000038B000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "-345678.5432"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400185c0ace0000000000000000000038b000
-{"d":{"$numberDecimal":"-345678.5432"}}
-18000000136400185c0ace0000000000000000000038b000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-004.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-004.phpt
deleted file mode 100644
index b6a63bbf..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-004.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [basx041] strings without E cannot generate E in result
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364004C0000000000000000000000000040B000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "-76"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364004c0000000000000000000000000040b000
-{"d":{"$numberDecimal":"-76"}}
-180000001364004c0000000000000000000000000040b000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-005.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-005.phpt
deleted file mode 100644
index ea7ff863..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-005.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [basx027] conform to rules and exponent will be in permitted range).
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000F270000000000000000000000003AB000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "-9.999"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000f270000000000000000000000003ab000
-{"d":{"$numberDecimal":"-9.999"}}
-180000001364000f270000000000000000000000003ab000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-006.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-006.phpt
deleted file mode 100644
index 8d8b7662..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-006.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [basx026] conform to rules and exponent will be in permitted range).
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364009F230000000000000000000000003AB000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "-9.119"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364009f230000000000000000000000003ab000
-{"d":{"$numberDecimal":"-9.119"}}
-180000001364009f230000000000000000000000003ab000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-007.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-007.phpt
deleted file mode 100644
index dff293e9..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-007.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [basx025] conform to rules and exponent will be in permitted range).
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364008F030000000000000000000000003CB000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "-9.11"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364008f030000000000000000000000003cb000
-{"d":{"$numberDecimal":"-9.11"}}
-180000001364008f030000000000000000000000003cb000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-008.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-008.phpt
deleted file mode 100644
index 3a7621d1..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-008.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [basx024] conform to rules and exponent will be in permitted range).
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364005B000000000000000000000000003EB000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "-9.1"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364005b000000000000000000000000003eb000
-{"d":{"$numberDecimal":"-9.1"}}
-180000001364005b000000000000000000000000003eb000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-009.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-009.phpt
deleted file mode 100644
index 8c2098ee..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-009.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [dqbsr531] negatives (Rounded)
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('1800000013640099761CC7B548F377DC80A131C836FEAF00');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "-1.111111111111111111111111111112345"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "-1.1111111111111111111111111111123450"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-1800000013640099761cc7b548f377dc80a131c836feaf00
-{"d":{"$numberDecimal":"-1.111111111111111111111111111112345"}}
-1800000013640099761cc7b548f377dc80a131c836feaf00
-1800000013640099761cc7b548f377dc80a131c836feaf00
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-010.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-010.phpt
deleted file mode 100644
index bd0a79bb..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-010.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [basx022] conform to rules and exponent will be in permitted range).
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000A000000000000000000000000003EB000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "-1.0"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000a000000000000000000000000003eb000
-{"d":{"$numberDecimal":"-1.0"}}
-180000001364000a000000000000000000000000003eb000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-011.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-011.phpt
deleted file mode 100644
index 8c633fba..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-011.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [basx021] conform to rules and exponent will be in permitted range).
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400010000000000000000000000000040B000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "-1"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400010000000000000000000000000040b000
-{"d":{"$numberDecimal":"-1"}}
-18000000136400010000000000000000000000000040b000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-012.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-012.phpt
deleted file mode 100644
index 1d706b81..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-012.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx601] Zeros
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('1800000013640000000000000000000000000000002E3000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "0E-9"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "0.000000000"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-1800000013640000000000000000000000000000002e3000
-{"d":{"$numberDecimal":"0E-9"}}
-1800000013640000000000000000000000000000002e3000
-1800000013640000000000000000000000000000002e3000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-013.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-013.phpt
deleted file mode 100644
index f27b22d3..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-013.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx622] Zeros
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('1800000013640000000000000000000000000000002EB000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "-0E-9"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "-0.000000000"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-1800000013640000000000000000000000000000002eb000
-{"d":{"$numberDecimal":"-0E-9"}}
-1800000013640000000000000000000000000000002eb000
-1800000013640000000000000000000000000000002eb000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-014.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-014.phpt
deleted file mode 100644
index 3f3fb7dd..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-014.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx602] Zeros
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000000000000000000000000000000303000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "0E-8"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "0.00000000"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000000000000000000000000000000303000
-{"d":{"$numberDecimal":"0E-8"}}
-180000001364000000000000000000000000000000303000
-180000001364000000000000000000000000000000303000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-015.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-015.phpt
deleted file mode 100644
index 80024fff..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-015.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx621] Zeros
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400000000000000000000000000000030B000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "-0E-8"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "-0.00000000"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400000000000000000000000000000030b000
-{"d":{"$numberDecimal":"-0E-8"}}
-18000000136400000000000000000000000000000030b000
-18000000136400000000000000000000000000000030b000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-016.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-016.phpt
deleted file mode 100644
index a6e214a6..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-016.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx603] Zeros
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000000000000000000000000000000323000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "0E-7"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "0.0000000"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000000000000000000000000000000323000
-{"d":{"$numberDecimal":"0E-7"}}
-180000001364000000000000000000000000000000323000
-180000001364000000000000000000000000000000323000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-017.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-017.phpt
deleted file mode 100644
index c366d641..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-017.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx620] Zeros
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400000000000000000000000000000032B000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "-0E-7"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "-0.0000000"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400000000000000000000000000000032b000
-{"d":{"$numberDecimal":"-0E-7"}}
-18000000136400000000000000000000000000000032b000
-18000000136400000000000000000000000000000032b000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-018.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-018.phpt
deleted file mode 100644
index 4bab024d..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-018.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [basx604] Zeros
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000000000000000000000000000000343000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "0.000000"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000000000000000000000000000000343000
-{"d":{"$numberDecimal":"0.000000"}}
-180000001364000000000000000000000000000000343000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-019.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-019.phpt
deleted file mode 100644
index 2602a14c..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-019.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [basx619] Zeros
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400000000000000000000000000000034B000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "-0.000000"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400000000000000000000000000000034b000
-{"d":{"$numberDecimal":"-0.000000"}}
-18000000136400000000000000000000000000000034b000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-020.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-020.phpt
deleted file mode 100644
index 77799e88..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-020.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [basx605] Zeros
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000000000000000000000000000000363000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "0.00000"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000000000000000000000000000000363000
-{"d":{"$numberDecimal":"0.00000"}}
-180000001364000000000000000000000000000000363000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-021.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-021.phpt
deleted file mode 100644
index e0b3dc22..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-021.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [basx618] Zeros
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400000000000000000000000000000036B000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "-0.00000"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400000000000000000000000000000036b000
-{"d":{"$numberDecimal":"-0.00000"}}
-18000000136400000000000000000000000000000036b000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-022.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-022.phpt
deleted file mode 100644
index 4195de9d..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-022.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx680] Zeros
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000000000000000000000000000000403000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "0"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "000000."}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000000000000000000000000000000403000
-{"d":{"$numberDecimal":"0"}}
-180000001364000000000000000000000000000000403000
-180000001364000000000000000000000000000000403000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-023.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-023.phpt
deleted file mode 100644
index ee42c169..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-023.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [basx606] Zeros
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000000000000000000000000000000383000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "0.0000"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000000000000000000000000000000383000
-{"d":{"$numberDecimal":"0.0000"}}
-180000001364000000000000000000000000000000383000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-024.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-024.phpt
deleted file mode 100644
index 24a9a3ff..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-024.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [basx617] Zeros
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400000000000000000000000000000038B000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "-0.0000"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400000000000000000000000000000038b000
-{"d":{"$numberDecimal":"-0.0000"}}
-18000000136400000000000000000000000000000038b000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-025.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-025.phpt
deleted file mode 100644
index 42cd9588..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-025.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx681] Zeros
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000000000000000000000000000000403000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "0"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "00000."}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000000000000000000000000000000403000
-{"d":{"$numberDecimal":"0"}}
-180000001364000000000000000000000000000000403000
-180000001364000000000000000000000000000000403000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-026.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-026.phpt
deleted file mode 100644
index 021cbe1d..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-026.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx686] Zeros
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000000000000000000000000000000403000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "0"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "+00000."}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000000000000000000000000000000403000
-{"d":{"$numberDecimal":"0"}}
-180000001364000000000000000000000000000000403000
-180000001364000000000000000000000000000000403000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-027.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-027.phpt
deleted file mode 100644
index 4fa0356c..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-027.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx687] Zeros
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400000000000000000000000000000040B000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "-0"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "-00000."}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400000000000000000000000000000040b000
-{"d":{"$numberDecimal":"-0"}}
-18000000136400000000000000000000000000000040b000
-18000000136400000000000000000000000000000040b000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-028.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-028.phpt
deleted file mode 100644
index 2c5405ee..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-028.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx019] conform to rules and exponent will be in permitted range).
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('1800000013640000000000000000000000000000003CB000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "-0.00"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "-00.00"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-1800000013640000000000000000000000000000003cb000
-{"d":{"$numberDecimal":"-0.00"}}
-1800000013640000000000000000000000000000003cb000
-1800000013640000000000000000000000000000003cb000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-029.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-029.phpt
deleted file mode 100644
index 8d29fd42..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-029.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [basx607] Zeros
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('1800000013640000000000000000000000000000003A3000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "0.000"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-1800000013640000000000000000000000000000003a3000
-{"d":{"$numberDecimal":"0.000"}}
-1800000013640000000000000000000000000000003a3000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-030.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-030.phpt
deleted file mode 100644
index 46889ff5..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-030.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [basx616] Zeros
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('1800000013640000000000000000000000000000003AB000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "-0.000"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-1800000013640000000000000000000000000000003ab000
-{"d":{"$numberDecimal":"-0.000"}}
-1800000013640000000000000000000000000000003ab000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-031.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-031.phpt
deleted file mode 100644
index 0e4cc733..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-031.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx682] Zeros
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000000000000000000000000000000403000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "0"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "0000."}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000000000000000000000000000000403000
-{"d":{"$numberDecimal":"0"}}
-180000001364000000000000000000000000000000403000
-180000001364000000000000000000000000000000403000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-032.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-032.phpt
deleted file mode 100644
index e4f50298..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-032.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx155] Numbers with E
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('1800000013640000000000000000000000000000003A3000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "0.000"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "0.000e+0"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-1800000013640000000000000000000000000000003a3000
-{"d":{"$numberDecimal":"0.000"}}
-1800000013640000000000000000000000000000003a3000
-1800000013640000000000000000000000000000003a3000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-033.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-033.phpt
deleted file mode 100644
index 92f67d09..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-033.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx130] Numbers with E
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000000000000000000000000000000383000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "0.0000"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "0.000E-1"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000000000000000000000000000000383000
-{"d":{"$numberDecimal":"0.0000"}}
-180000001364000000000000000000000000000000383000
-180000001364000000000000000000000000000000383000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-034.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-034.phpt
deleted file mode 100644
index d5599fc9..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-034.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx290] some more negative zeros [systematic tests below]
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400000000000000000000000000000038B000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "-0.0000"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "-0.000E-1"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400000000000000000000000000000038b000
-{"d":{"$numberDecimal":"-0.0000"}}
-18000000136400000000000000000000000000000038b000
-18000000136400000000000000000000000000000038b000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-035.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-035.phpt
deleted file mode 100644
index fe4b9b2a..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-035.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx131] Numbers with E
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000000000000000000000000000000363000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "0.00000"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "0.000E-2"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000000000000000000000000000000363000
-{"d":{"$numberDecimal":"0.00000"}}
-180000001364000000000000000000000000000000363000
-180000001364000000000000000000000000000000363000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-036.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-036.phpt
deleted file mode 100644
index fb14b4a5..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-036.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx291] some more negative zeros [systematic tests below]
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400000000000000000000000000000036B000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "-0.00000"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "-0.000E-2"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400000000000000000000000000000036b000
-{"d":{"$numberDecimal":"-0.00000"}}
-18000000136400000000000000000000000000000036b000
-18000000136400000000000000000000000000000036b000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-037.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-037.phpt
deleted file mode 100644
index 677affeb..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-037.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx132] Numbers with E
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000000000000000000000000000000343000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "0.000000"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "0.000E-3"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000000000000000000000000000000343000
-{"d":{"$numberDecimal":"0.000000"}}
-180000001364000000000000000000000000000000343000
-180000001364000000000000000000000000000000343000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-038.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-038.phpt
deleted file mode 100644
index feba2bad..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-038.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx292] some more negative zeros [systematic tests below]
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400000000000000000000000000000034B000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "-0.000000"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "-0.000E-3"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400000000000000000000000000000034b000
-{"d":{"$numberDecimal":"-0.000000"}}
-18000000136400000000000000000000000000000034b000
-18000000136400000000000000000000000000000034b000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-039.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-039.phpt
deleted file mode 100644
index 5373e7d1..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-039.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx133] Numbers with E
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000000000000000000000000000000323000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "0E-7"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "0.000E-4"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000000000000000000000000000000323000
-{"d":{"$numberDecimal":"0E-7"}}
-180000001364000000000000000000000000000000323000
-180000001364000000000000000000000000000000323000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-040.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-040.phpt
deleted file mode 100644
index 68500a42..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-040.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx293] some more negative zeros [systematic tests below]
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400000000000000000000000000000032B000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "-0E-7"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "-0.000E-4"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400000000000000000000000000000032b000
-{"d":{"$numberDecimal":"-0E-7"}}
-18000000136400000000000000000000000000000032b000
-18000000136400000000000000000000000000000032b000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-041.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-041.phpt
deleted file mode 100644
index b1625db4..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-041.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [basx608] Zeros
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('1800000013640000000000000000000000000000003C3000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "0.00"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-1800000013640000000000000000000000000000003c3000
-{"d":{"$numberDecimal":"0.00"}}
-1800000013640000000000000000000000000000003c3000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-042.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-042.phpt
deleted file mode 100644
index cdb3c8bc..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-042.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [basx615] Zeros
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('1800000013640000000000000000000000000000003CB000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "-0.00"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-1800000013640000000000000000000000000000003cb000
-{"d":{"$numberDecimal":"-0.00"}}
-1800000013640000000000000000000000000000003cb000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-043.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-043.phpt
deleted file mode 100644
index d991609f..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-043.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx683] Zeros
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000000000000000000000000000000403000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "0"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "000."}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000000000000000000000000000000403000
-{"d":{"$numberDecimal":"0"}}
-180000001364000000000000000000000000000000403000
-180000001364000000000000000000000000000000403000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-044.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-044.phpt
deleted file mode 100644
index 9cf6a156..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-044.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx630] Zeros
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('1800000013640000000000000000000000000000003C3000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "0.00"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "0.00E+0"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-1800000013640000000000000000000000000000003c3000
-{"d":{"$numberDecimal":"0.00"}}
-1800000013640000000000000000000000000000003c3000
-1800000013640000000000000000000000000000003c3000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-045.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-045.phpt
deleted file mode 100644
index b3b57ab5..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-045.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx670] Zeros
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('1800000013640000000000000000000000000000003C3000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "0.00"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "0.00E-0"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-1800000013640000000000000000000000000000003c3000
-{"d":{"$numberDecimal":"0.00"}}
-1800000013640000000000000000000000000000003c3000
-1800000013640000000000000000000000000000003c3000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-046.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-046.phpt
deleted file mode 100644
index 7113b821..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-046.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx631] Zeros
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('1800000013640000000000000000000000000000003E3000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "0.0"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "0.00E+1"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-1800000013640000000000000000000000000000003e3000
-{"d":{"$numberDecimal":"0.0"}}
-1800000013640000000000000000000000000000003e3000
-1800000013640000000000000000000000000000003e3000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-047.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-047.phpt
deleted file mode 100644
index 0b5d9336..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-047.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx671] Zeros
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('1800000013640000000000000000000000000000003A3000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "0.000"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "0.00E-1"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-1800000013640000000000000000000000000000003a3000
-{"d":{"$numberDecimal":"0.000"}}
-1800000013640000000000000000000000000000003a3000
-1800000013640000000000000000000000000000003a3000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-048.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-048.phpt
deleted file mode 100644
index d58b3d49..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-048.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx134] Numbers with E
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000000000000000000000000000000383000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "0.0000"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "0.00E-2"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000000000000000000000000000000383000
-{"d":{"$numberDecimal":"0.0000"}}
-180000001364000000000000000000000000000000383000
-180000001364000000000000000000000000000000383000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-049.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-049.phpt
deleted file mode 100644
index 29b4a619..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-049.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx294] some more negative zeros [systematic tests below]
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400000000000000000000000000000038B000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "-0.0000"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "-0.00E-2"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400000000000000000000000000000038b000
-{"d":{"$numberDecimal":"-0.0000"}}
-18000000136400000000000000000000000000000038b000
-18000000136400000000000000000000000000000038b000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-050.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-050.phpt
deleted file mode 100644
index 3b9a6bf8..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-050.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx632] Zeros
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000000000000000000000000000000403000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "0"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "0.00E+2"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000000000000000000000000000000403000
-{"d":{"$numberDecimal":"0"}}
-180000001364000000000000000000000000000000403000
-180000001364000000000000000000000000000000403000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-051.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-051.phpt
deleted file mode 100644
index 761aeaf8..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-051.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx672] Zeros
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000000000000000000000000000000383000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "0.0000"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "0.00E-2"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000000000000000000000000000000383000
-{"d":{"$numberDecimal":"0.0000"}}
-180000001364000000000000000000000000000000383000
-180000001364000000000000000000000000000000383000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-052.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-052.phpt
deleted file mode 100644
index ad7585fb..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-052.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx135] Numbers with E
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000000000000000000000000000000363000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "0.00000"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "0.00E-3"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000000000000000000000000000000363000
-{"d":{"$numberDecimal":"0.00000"}}
-180000001364000000000000000000000000000000363000
-180000001364000000000000000000000000000000363000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-053.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-053.phpt
deleted file mode 100644
index 07aa7e9d..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-053.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx295] some more negative zeros [systematic tests below]
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400000000000000000000000000000036B000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "-0.00000"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "-0.00E-3"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400000000000000000000000000000036b000
-{"d":{"$numberDecimal":"-0.00000"}}
-18000000136400000000000000000000000000000036b000
-18000000136400000000000000000000000000000036b000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-054.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-054.phpt
deleted file mode 100644
index f944de47..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-054.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx633] Zeros
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000000000000000000000000000000423000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "0E+1"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "0.00E+3"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000000000000000000000000000000423000
-{"d":{"$numberDecimal":"0E+1"}}
-180000001364000000000000000000000000000000423000
-180000001364000000000000000000000000000000423000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-055.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-055.phpt
deleted file mode 100644
index d95c1074..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-055.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx673] Zeros
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000000000000000000000000000000363000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "0.00000"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "0.00E-3"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000000000000000000000000000000363000
-{"d":{"$numberDecimal":"0.00000"}}
-180000001364000000000000000000000000000000363000
-180000001364000000000000000000000000000000363000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-056.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-056.phpt
deleted file mode 100644
index 45af8de2..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-056.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx136] Numbers with E
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000000000000000000000000000000343000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "0.000000"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "0.00E-4"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000000000000000000000000000000343000
-{"d":{"$numberDecimal":"0.000000"}}
-180000001364000000000000000000000000000000343000
-180000001364000000000000000000000000000000343000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-057.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-057.phpt
deleted file mode 100644
index ffd31b54..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-057.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx674] Zeros
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000000000000000000000000000000343000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "0.000000"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "0.00E-4"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000000000000000000000000000000343000
-{"d":{"$numberDecimal":"0.000000"}}
-180000001364000000000000000000000000000000343000
-180000001364000000000000000000000000000000343000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-058.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-058.phpt
deleted file mode 100644
index 86bfcd85..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-058.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx634] Zeros
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000000000000000000000000000000443000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "0E+2"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "0.00E+4"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000000000000000000000000000000443000
-{"d":{"$numberDecimal":"0E+2"}}
-180000001364000000000000000000000000000000443000
-180000001364000000000000000000000000000000443000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-059.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-059.phpt
deleted file mode 100644
index 3573e381..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-059.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx137] Numbers with E
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000000000000000000000000000000323000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "0E-7"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "0.00E-5"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000000000000000000000000000000323000
-{"d":{"$numberDecimal":"0E-7"}}
-180000001364000000000000000000000000000000323000
-180000001364000000000000000000000000000000323000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-060.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-060.phpt
deleted file mode 100644
index c0f0af73..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-060.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx635] Zeros
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000000000000000000000000000000463000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "0E+3"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "0.00E+5"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000000000000000000000000000000463000
-{"d":{"$numberDecimal":"0E+3"}}
-180000001364000000000000000000000000000000463000
-180000001364000000000000000000000000000000463000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-061.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-061.phpt
deleted file mode 100644
index 1792c12c..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-061.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx675] Zeros
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000000000000000000000000000000323000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "0E-7"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "0.00E-5"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000000000000000000000000000000323000
-{"d":{"$numberDecimal":"0E-7"}}
-180000001364000000000000000000000000000000323000
-180000001364000000000000000000000000000000323000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-062.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-062.phpt
deleted file mode 100644
index 66975d4a..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-062.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx636] Zeros
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000000000000000000000000000000483000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "0E+4"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "0.00E+6"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000000000000000000000000000000483000
-{"d":{"$numberDecimal":"0E+4"}}
-180000001364000000000000000000000000000000483000
-180000001364000000000000000000000000000000483000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-063.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-063.phpt
deleted file mode 100644
index 04896e7c..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-063.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx676] Zeros
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000000000000000000000000000000303000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "0E-8"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "0.00E-6"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000000000000000000000000000000303000
-{"d":{"$numberDecimal":"0E-8"}}
-180000001364000000000000000000000000000000303000
-180000001364000000000000000000000000000000303000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-064.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-064.phpt
deleted file mode 100644
index 8c28d556..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-064.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx637] Zeros
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('1800000013640000000000000000000000000000004A3000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "0E+5"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "0.00E+7"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-1800000013640000000000000000000000000000004a3000
-{"d":{"$numberDecimal":"0E+5"}}
-1800000013640000000000000000000000000000004a3000
-1800000013640000000000000000000000000000004a3000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-065.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-065.phpt
deleted file mode 100644
index 1f09cc65..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-065.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx677] Zeros
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('1800000013640000000000000000000000000000002E3000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "0E-9"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "0.00E-7"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-1800000013640000000000000000000000000000002e3000
-{"d":{"$numberDecimal":"0E-9"}}
-1800000013640000000000000000000000000000002e3000
-1800000013640000000000000000000000000000002e3000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-066.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-066.phpt
deleted file mode 100644
index ae4c0232..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-066.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx638] Zeros
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('1800000013640000000000000000000000000000004C3000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "0E+6"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "0.00E+8"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-1800000013640000000000000000000000000000004c3000
-{"d":{"$numberDecimal":"0E+6"}}
-1800000013640000000000000000000000000000004c3000
-1800000013640000000000000000000000000000004c3000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-067.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-067.phpt
deleted file mode 100644
index ab23056a..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-067.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx678] Zeros
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('1800000013640000000000000000000000000000002C3000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "0E-10"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "0.00E-8"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-1800000013640000000000000000000000000000002c3000
-{"d":{"$numberDecimal":"0E-10"}}
-1800000013640000000000000000000000000000002c3000
-1800000013640000000000000000000000000000002c3000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-068.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-068.phpt
deleted file mode 100644
index 6694fca5..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-068.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx149] Numbers with E
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000000000000000000000000000000523000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "0E+9"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "000E+9"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000000000000000000000000000000523000
-{"d":{"$numberDecimal":"0E+9"}}
-180000001364000000000000000000000000000000523000
-180000001364000000000000000000000000000000523000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-069.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-069.phpt
deleted file mode 100644
index 849d3e79..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-069.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx639] Zeros
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('1800000013640000000000000000000000000000004E3000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "0E+7"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "0.00E+9"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-1800000013640000000000000000000000000000004e3000
-{"d":{"$numberDecimal":"0E+7"}}
-1800000013640000000000000000000000000000004e3000
-1800000013640000000000000000000000000000004e3000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-070.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-070.phpt
deleted file mode 100644
index 9b5f7d1f..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-070.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx679] Zeros
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('1800000013640000000000000000000000000000002A3000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "0E-11"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "0.00E-9"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-1800000013640000000000000000000000000000002a3000
-{"d":{"$numberDecimal":"0E-11"}}
-1800000013640000000000000000000000000000002a3000
-1800000013640000000000000000000000000000002a3000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-071.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-071.phpt
deleted file mode 100644
index 7eb50f5c..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-071.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx063] strings without E cannot generate E in result
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400185C0ACE00000000000000000000383000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "345678.5432"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "+00345678.5432"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400185c0ace00000000000000000000383000
-{"d":{"$numberDecimal":"345678.5432"}}
-18000000136400185c0ace00000000000000000000383000
-18000000136400185c0ace00000000000000000000383000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-072.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-072.phpt
deleted file mode 100644
index fe9bea67..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-072.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [basx018] conform to rules and exponent will be in permitted range).
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('1800000013640000000000000000000000000000003EB000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "-0.0"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-1800000013640000000000000000000000000000003eb000
-{"d":{"$numberDecimal":"-0.0"}}
-1800000013640000000000000000000000000000003eb000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-073.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-073.phpt
deleted file mode 100644
index 1a7de325..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-073.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [basx609] Zeros
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('1800000013640000000000000000000000000000003E3000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "0.0"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-1800000013640000000000000000000000000000003e3000
-{"d":{"$numberDecimal":"0.0"}}
-1800000013640000000000000000000000000000003e3000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-074.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-074.phpt
deleted file mode 100644
index 360846e5..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-074.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [basx614] Zeros
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('1800000013640000000000000000000000000000003EB000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "-0.0"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-1800000013640000000000000000000000000000003eb000
-{"d":{"$numberDecimal":"-0.0"}}
-1800000013640000000000000000000000000000003eb000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-075.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-075.phpt
deleted file mode 100644
index d22d22d5..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-075.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx684] Zeros
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000000000000000000000000000000403000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "0"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "00."}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000000000000000000000000000000403000
-{"d":{"$numberDecimal":"0"}}
-180000001364000000000000000000000000000000403000
-180000001364000000000000000000000000000000403000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-076.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-076.phpt
deleted file mode 100644
index b72cf2f9..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-076.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx640] Zeros
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('1800000013640000000000000000000000000000003E3000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "0.0"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "0.0E+0"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-1800000013640000000000000000000000000000003e3000
-{"d":{"$numberDecimal":"0.0"}}
-1800000013640000000000000000000000000000003e3000
-1800000013640000000000000000000000000000003e3000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-077.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-077.phpt
deleted file mode 100644
index 2e5c11ce..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-077.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx660] Zeros
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('1800000013640000000000000000000000000000003E3000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "0.0"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "0.0E-0"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-1800000013640000000000000000000000000000003e3000
-{"d":{"$numberDecimal":"0.0"}}
-1800000013640000000000000000000000000000003e3000
-1800000013640000000000000000000000000000003e3000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-078.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-078.phpt
deleted file mode 100644
index c9a392c3..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-078.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx641] Zeros
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000000000000000000000000000000403000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "0"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "0.0E+1"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000000000000000000000000000000403000
-{"d":{"$numberDecimal":"0"}}
-180000001364000000000000000000000000000000403000
-180000001364000000000000000000000000000000403000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-079.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-079.phpt
deleted file mode 100644
index d6474898..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-079.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx661] Zeros
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('1800000013640000000000000000000000000000003C3000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "0.00"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "0.0E-1"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-1800000013640000000000000000000000000000003c3000
-{"d":{"$numberDecimal":"0.00"}}
-1800000013640000000000000000000000000000003c3000
-1800000013640000000000000000000000000000003c3000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-080.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-080.phpt
deleted file mode 100644
index 583c2951..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-080.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx296] some more negative zeros [systematic tests below]
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('1800000013640000000000000000000000000000003AB000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "-0.000"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "-0.0E-2"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-1800000013640000000000000000000000000000003ab000
-{"d":{"$numberDecimal":"-0.000"}}
-1800000013640000000000000000000000000000003ab000
-1800000013640000000000000000000000000000003ab000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-081.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-081.phpt
deleted file mode 100644
index f6bfc983..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-081.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx642] Zeros
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000000000000000000000000000000423000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "0E+1"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "0.0E+2"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000000000000000000000000000000423000
-{"d":{"$numberDecimal":"0E+1"}}
-180000001364000000000000000000000000000000423000
-180000001364000000000000000000000000000000423000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-082.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-082.phpt
deleted file mode 100644
index 061edaad..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-082.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx662] Zeros
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('1800000013640000000000000000000000000000003A3000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "0.000"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "0.0E-2"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-1800000013640000000000000000000000000000003a3000
-{"d":{"$numberDecimal":"0.000"}}
-1800000013640000000000000000000000000000003a3000
-1800000013640000000000000000000000000000003a3000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-083.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-083.phpt
deleted file mode 100644
index c97e428c..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-083.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx297] some more negative zeros [systematic tests below]
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400000000000000000000000000000038B000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "-0.0000"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "-0.0E-3"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400000000000000000000000000000038b000
-{"d":{"$numberDecimal":"-0.0000"}}
-18000000136400000000000000000000000000000038b000
-18000000136400000000000000000000000000000038b000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-084.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-084.phpt
deleted file mode 100644
index 67959c9d..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-084.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx643] Zeros
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000000000000000000000000000000443000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "0E+2"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "0.0E+3"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000000000000000000000000000000443000
-{"d":{"$numberDecimal":"0E+2"}}
-180000001364000000000000000000000000000000443000
-180000001364000000000000000000000000000000443000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-085.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-085.phpt
deleted file mode 100644
index 3a728e95..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-085.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx663] Zeros
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000000000000000000000000000000383000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "0.0000"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "0.0E-3"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000000000000000000000000000000383000
-{"d":{"$numberDecimal":"0.0000"}}
-180000001364000000000000000000000000000000383000
-180000001364000000000000000000000000000000383000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-086.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-086.phpt
deleted file mode 100644
index fb4f5378..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-086.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx644] Zeros
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000000000000000000000000000000463000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "0E+3"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "0.0E+4"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000000000000000000000000000000463000
-{"d":{"$numberDecimal":"0E+3"}}
-180000001364000000000000000000000000000000463000
-180000001364000000000000000000000000000000463000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-087.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-087.phpt
deleted file mode 100644
index cdd9dd67..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-087.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx664] Zeros
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000000000000000000000000000000363000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "0.00000"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "0.0E-4"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000000000000000000000000000000363000
-{"d":{"$numberDecimal":"0.00000"}}
-180000001364000000000000000000000000000000363000
-180000001364000000000000000000000000000000363000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-088.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-088.phpt
deleted file mode 100644
index af0eb580..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-088.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx645] Zeros
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000000000000000000000000000000483000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "0E+4"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "0.0E+5"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000000000000000000000000000000483000
-{"d":{"$numberDecimal":"0E+4"}}
-180000001364000000000000000000000000000000483000
-180000001364000000000000000000000000000000483000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-089.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-089.phpt
deleted file mode 100644
index 8628eb22..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-089.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx665] Zeros
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000000000000000000000000000000343000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "0.000000"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "0.0E-5"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000000000000000000000000000000343000
-{"d":{"$numberDecimal":"0.000000"}}
-180000001364000000000000000000000000000000343000
-180000001364000000000000000000000000000000343000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-090.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-090.phpt
deleted file mode 100644
index 9f3464eb..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-090.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx646] Zeros
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('1800000013640000000000000000000000000000004A3000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "0E+5"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "0.0E+6"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-1800000013640000000000000000000000000000004a3000
-{"d":{"$numberDecimal":"0E+5"}}
-1800000013640000000000000000000000000000004a3000
-1800000013640000000000000000000000000000004a3000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-091.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-091.phpt
deleted file mode 100644
index 6b389f52..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-091.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx666] Zeros
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000000000000000000000000000000323000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "0E-7"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "0.0E-6"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000000000000000000000000000000323000
-{"d":{"$numberDecimal":"0E-7"}}
-180000001364000000000000000000000000000000323000
-180000001364000000000000000000000000000000323000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-092.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-092.phpt
deleted file mode 100644
index 2899cc89..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-092.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx647] Zeros
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('1800000013640000000000000000000000000000004C3000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "0E+6"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "0.0E+7"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-1800000013640000000000000000000000000000004c3000
-{"d":{"$numberDecimal":"0E+6"}}
-1800000013640000000000000000000000000000004c3000
-1800000013640000000000000000000000000000004c3000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-093.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-093.phpt
deleted file mode 100644
index d83c63d0..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-093.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx667] Zeros
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000000000000000000000000000000303000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "0E-8"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "0.0E-7"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000000000000000000000000000000303000
-{"d":{"$numberDecimal":"0E-8"}}
-180000001364000000000000000000000000000000303000
-180000001364000000000000000000000000000000303000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-094.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-094.phpt
deleted file mode 100644
index ffeccf21..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-094.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx648] Zeros
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('1800000013640000000000000000000000000000004E3000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "0E+7"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "0.0E+8"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-1800000013640000000000000000000000000000004e3000
-{"d":{"$numberDecimal":"0E+7"}}
-1800000013640000000000000000000000000000004e3000
-1800000013640000000000000000000000000000004e3000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-095.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-095.phpt
deleted file mode 100644
index 7bd91248..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-095.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx668] Zeros
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('1800000013640000000000000000000000000000002E3000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "0E-9"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "0.0E-8"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-1800000013640000000000000000000000000000002e3000
-{"d":{"$numberDecimal":"0E-9"}}
-1800000013640000000000000000000000000000002e3000
-1800000013640000000000000000000000000000002e3000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-096.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-096.phpt
deleted file mode 100644
index 52d76b7d..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-096.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx160] Numbers with E
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000000000000000000000000000000523000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "0E+9"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "00E+9"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000000000000000000000000000000523000
-{"d":{"$numberDecimal":"0E+9"}}
-180000001364000000000000000000000000000000523000
-180000001364000000000000000000000000000000523000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-097.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-097.phpt
deleted file mode 100644
index 5c807e2f..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-097.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx161] Numbers with E
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('1800000013640000000000000000000000000000002E3000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "0E-9"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "00E-9"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-1800000013640000000000000000000000000000002e3000
-{"d":{"$numberDecimal":"0E-9"}}
-1800000013640000000000000000000000000000002e3000
-1800000013640000000000000000000000000000002e3000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-098.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-098.phpt
deleted file mode 100644
index ad89ed6c..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-098.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx649] Zeros
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000000000000000000000000000000503000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "0E+8"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "0.0E+9"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000000000000000000000000000000503000
-{"d":{"$numberDecimal":"0E+8"}}
-180000001364000000000000000000000000000000503000
-180000001364000000000000000000000000000000503000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-099.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-099.phpt
deleted file mode 100644
index 70fe3d9f..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-099.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx669] Zeros
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('1800000013640000000000000000000000000000002C3000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "0E-10"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "0.0E-9"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-1800000013640000000000000000000000000000002c3000
-{"d":{"$numberDecimal":"0E-10"}}
-1800000013640000000000000000000000000000002c3000
-1800000013640000000000000000000000000000002c3000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-100.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-100.phpt
deleted file mode 100644
index b597e620..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-100.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx062] strings without E cannot generate E in result
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400185C0ACE00000000000000000000383000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "345678.5432"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "+0345678.5432"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400185c0ace00000000000000000000383000
-{"d":{"$numberDecimal":"345678.5432"}}
-18000000136400185c0ace00000000000000000000383000
-18000000136400185c0ace00000000000000000000383000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-101.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-101.phpt
deleted file mode 100644
index 6e931c57..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-101.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [basx001] conform to rules and exponent will be in permitted range).
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000000000000000000000000000000403000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "0"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000000000000000000000000000000403000
-{"d":{"$numberDecimal":"0"}}
-180000001364000000000000000000000000000000403000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-102.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-102.phpt
deleted file mode 100644
index e5b8a66c..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-102.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [basx017] conform to rules and exponent will be in permitted range).
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400000000000000000000000000000040B000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "-0"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400000000000000000000000000000040b000
-{"d":{"$numberDecimal":"-0"}}
-18000000136400000000000000000000000000000040b000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-103.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-103.phpt
deleted file mode 100644
index ed45b309..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-103.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx611] Zeros
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000000000000000000000000000000403000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "0"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "0."}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000000000000000000000000000000403000
-{"d":{"$numberDecimal":"0"}}
-180000001364000000000000000000000000000000403000
-180000001364000000000000000000000000000000403000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-104.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-104.phpt
deleted file mode 100644
index 9ecff27c..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-104.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx613] Zeros
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400000000000000000000000000000040B000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "-0"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "-0."}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400000000000000000000000000000040b000
-{"d":{"$numberDecimal":"-0"}}
-18000000136400000000000000000000000000000040b000
-18000000136400000000000000000000000000000040b000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-105.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-105.phpt
deleted file mode 100644
index 55f668fb..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-105.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx685] Zeros
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000000000000000000000000000000403000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "0"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "0."}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000000000000000000000000000000403000
-{"d":{"$numberDecimal":"0"}}
-180000001364000000000000000000000000000000403000
-180000001364000000000000000000000000000000403000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-106.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-106.phpt
deleted file mode 100644
index 6adb44bf..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-106.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx688] Zeros
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000000000000000000000000000000403000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "0"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "+0."}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000000000000000000000000000000403000
-{"d":{"$numberDecimal":"0"}}
-180000001364000000000000000000000000000000403000
-180000001364000000000000000000000000000000403000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-107.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-107.phpt
deleted file mode 100644
index 0f1e9ace..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-107.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx689] Zeros
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400000000000000000000000000000040B000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "-0"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "-0."}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400000000000000000000000000000040b000
-{"d":{"$numberDecimal":"-0"}}
-18000000136400000000000000000000000000000040b000
-18000000136400000000000000000000000000000040b000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-108.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-108.phpt
deleted file mode 100644
index 33677e7e..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-108.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx650] Zeros
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000000000000000000000000000000403000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "0"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "0E+0"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000000000000000000000000000000403000
-{"d":{"$numberDecimal":"0"}}
-180000001364000000000000000000000000000000403000
-180000001364000000000000000000000000000000403000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-109.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-109.phpt
deleted file mode 100644
index 3e5ac0b5..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-109.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [basx651] Zeros
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000000000000000000000000000000423000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "0E+1"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000000000000000000000000000000423000
-{"d":{"$numberDecimal":"0E+1"}}
-180000001364000000000000000000000000000000423000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-110.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-110.phpt
deleted file mode 100644
index 84733529..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-110.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx298] some more negative zeros [systematic tests below]
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('1800000013640000000000000000000000000000003CB000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "-0.00"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "-0E-2"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-1800000013640000000000000000000000000000003cb000
-{"d":{"$numberDecimal":"-0.00"}}
-1800000013640000000000000000000000000000003cb000
-1800000013640000000000000000000000000000003cb000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-111.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-111.phpt
deleted file mode 100644
index 30356be3..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-111.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [basx652] Zeros
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000000000000000000000000000000443000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "0E+2"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000000000000000000000000000000443000
-{"d":{"$numberDecimal":"0E+2"}}
-180000001364000000000000000000000000000000443000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-112.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-112.phpt
deleted file mode 100644
index c740e78e..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-112.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx299] some more negative zeros [systematic tests below]
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('1800000013640000000000000000000000000000003AB000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "-0.000"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "-0E-3"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-1800000013640000000000000000000000000000003ab000
-{"d":{"$numberDecimal":"-0.000"}}
-1800000013640000000000000000000000000000003ab000
-1800000013640000000000000000000000000000003ab000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-113.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-113.phpt
deleted file mode 100644
index 959ab567..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-113.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [basx653] Zeros
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000000000000000000000000000000463000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "0E+3"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000000000000000000000000000000463000
-{"d":{"$numberDecimal":"0E+3"}}
-180000001364000000000000000000000000000000463000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-114.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-114.phpt
deleted file mode 100644
index 1882e3b0..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-114.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [basx654] Zeros
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000000000000000000000000000000483000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "0E+4"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000000000000000000000000000000483000
-{"d":{"$numberDecimal":"0E+4"}}
-180000001364000000000000000000000000000000483000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-115.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-115.phpt
deleted file mode 100644
index cd2de1d2..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-115.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [basx655] Zeros
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('1800000013640000000000000000000000000000004A3000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "0E+5"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-1800000013640000000000000000000000000000004a3000
-{"d":{"$numberDecimal":"0E+5"}}
-1800000013640000000000000000000000000000004a3000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-116.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-116.phpt
deleted file mode 100644
index 4ac288ad..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-116.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [basx656] Zeros
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('1800000013640000000000000000000000000000004C3000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "0E+6"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-1800000013640000000000000000000000000000004c3000
-{"d":{"$numberDecimal":"0E+6"}}
-1800000013640000000000000000000000000000004c3000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-117.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-117.phpt
deleted file mode 100644
index fff05104..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-117.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [basx657] Zeros
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('1800000013640000000000000000000000000000004E3000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "0E+7"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-1800000013640000000000000000000000000000004e3000
-{"d":{"$numberDecimal":"0E+7"}}
-1800000013640000000000000000000000000000004e3000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-118.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-118.phpt
deleted file mode 100644
index 043dd38e..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-118.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [basx658] Zeros
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000000000000000000000000000000503000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "0E+8"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000000000000000000000000000000503000
-{"d":{"$numberDecimal":"0E+8"}}
-180000001364000000000000000000000000000000503000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-119.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-119.phpt
deleted file mode 100644
index 45fd6a16..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-119.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx138] Numbers with E
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000000000000000000000000000000523000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "0E+9"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "+0E+9"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000000000000000000000000000000523000
-{"d":{"$numberDecimal":"0E+9"}}
-180000001364000000000000000000000000000000523000
-180000001364000000000000000000000000000000523000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-120.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-120.phpt
deleted file mode 100644
index 53ae47bd..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-120.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [basx139] Numbers with E
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400000000000000000000000000000052B000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "-0E+9"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400000000000000000000000000000052b000
-{"d":{"$numberDecimal":"-0E+9"}}
-18000000136400000000000000000000000000000052b000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-121.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-121.phpt
deleted file mode 100644
index 0165782b..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-121.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [basx144] Numbers with E
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000000000000000000000000000000523000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "0E+9"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000000000000000000000000000000523000
-{"d":{"$numberDecimal":"0E+9"}}
-180000001364000000000000000000000000000000523000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-122.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-122.phpt
deleted file mode 100644
index f872514e..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-122.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx154] Numbers with E
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000000000000000000000000000000523000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "0E+9"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "0E9"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000000000000000000000000000000523000
-{"d":{"$numberDecimal":"0E+9"}}
-180000001364000000000000000000000000000000523000
-180000001364000000000000000000000000000000523000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-123.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-123.phpt
deleted file mode 100644
index 72583de7..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-123.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [basx659] Zeros
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000000000000000000000000000000523000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "0E+9"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000000000000000000000000000000523000
-{"d":{"$numberDecimal":"0E+9"}}
-180000001364000000000000000000000000000000523000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-124.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-124.phpt
deleted file mode 100644
index 725b8c5f..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-124.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx042] strings without E cannot generate E in result
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400FC040000000000000000000000003C3000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "12.76"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "+12.76"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400fc040000000000000000000000003c3000
-{"d":{"$numberDecimal":"12.76"}}
-18000000136400fc040000000000000000000000003c3000
-18000000136400fc040000000000000000000000003c3000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-125.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-125.phpt
deleted file mode 100644
index 8c4353ec..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-125.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx143] Numbers with E
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000100000000000000000000000000523000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "1E+9"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "+1E+009"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000100000000000000000000000000523000
-{"d":{"$numberDecimal":"1E+9"}}
-180000001364000100000000000000000000000000523000
-180000001364000100000000000000000000000000523000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-126.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-126.phpt
deleted file mode 100644
index 4b4b500e..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-126.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx061] strings without E cannot generate E in result
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400185C0ACE00000000000000000000383000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "345678.5432"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "+345678.5432"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400185c0ace00000000000000000000383000
-{"d":{"$numberDecimal":"345678.5432"}}
-18000000136400185c0ace00000000000000000000383000
-18000000136400185c0ace00000000000000000000383000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-127.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-127.phpt
deleted file mode 100644
index 8b127244..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-127.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx036] conform to rules and exponent will be in permitted range).
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('1800000013640015CD5B0700000000000000000000203000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.23456789E-8"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "0.0000000123456789"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-1800000013640015cd5b0700000000000000000000203000
-{"d":{"$numberDecimal":"1.23456789E-8"}}
-1800000013640015cd5b0700000000000000000000203000
-1800000013640015cd5b0700000000000000000000203000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-128.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-128.phpt
deleted file mode 100644
index eeff88e3..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-128.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx035] conform to rules and exponent will be in permitted range).
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('1800000013640015CD5B0700000000000000000000223000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.23456789E-7"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "0.000000123456789"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-1800000013640015cd5b0700000000000000000000223000
-{"d":{"$numberDecimal":"1.23456789E-7"}}
-1800000013640015cd5b0700000000000000000000223000
-1800000013640015cd5b0700000000000000000000223000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-129.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-129.phpt
deleted file mode 100644
index 7b63fb5c..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-129.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [basx034] conform to rules and exponent will be in permitted range).
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('1800000013640015CD5B0700000000000000000000243000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "0.00000123456789"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-1800000013640015cd5b0700000000000000000000243000
-{"d":{"$numberDecimal":"0.00000123456789"}}
-1800000013640015cd5b0700000000000000000000243000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-130.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-130.phpt
deleted file mode 100644
index b8e3adba..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-130.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [basx053] strings without E cannot generate E in result
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364003200000000000000000000000000323000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "0.0000050"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364003200000000000000000000000000323000
-{"d":{"$numberDecimal":"0.0000050"}}
-180000001364003200000000000000000000000000323000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-131.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-131.phpt
deleted file mode 100644
index d3c009f2..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-131.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [basx033] conform to rules and exponent will be in permitted range).
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('1800000013640015CD5B0700000000000000000000263000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "0.0000123456789"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-1800000013640015cd5b0700000000000000000000263000
-{"d":{"$numberDecimal":"0.0000123456789"}}
-1800000013640015cd5b0700000000000000000000263000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-132.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-132.phpt
deleted file mode 100644
index a22052e3..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-132.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [basx016] conform to rules and exponent will be in permitted range).
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000C000000000000000000000000003A3000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "0.012"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000c000000000000000000000000003a3000
-{"d":{"$numberDecimal":"0.012"}}
-180000001364000c000000000000000000000000003a3000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-133.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-133.phpt
deleted file mode 100644
index 10801875..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-133.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [basx015] conform to rules and exponent will be in permitted range).
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364007B000000000000000000000000003A3000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "0.123"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364007b000000000000000000000000003a3000
-{"d":{"$numberDecimal":"0.123"}}
-180000001364007b000000000000000000000000003a3000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-134.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-134.phpt
deleted file mode 100644
index 584ecf8b..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-134.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [basx037] conform to rules and exponent will be in permitted range).
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('1800000013640078DF0D8648700000000000000000223000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "0.123456789012344"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-1800000013640078df0d8648700000000000000000223000
-{"d":{"$numberDecimal":"0.123456789012344"}}
-1800000013640078df0d8648700000000000000000223000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-135.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-135.phpt
deleted file mode 100644
index 60158f2d..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-135.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [basx038] conform to rules and exponent will be in permitted range).
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('1800000013640079DF0D8648700000000000000000223000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "0.123456789012345"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-1800000013640079df0d8648700000000000000000223000
-{"d":{"$numberDecimal":"0.123456789012345"}}
-1800000013640079df0d8648700000000000000000223000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-136.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-136.phpt
deleted file mode 100644
index 542d7368..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-136.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [basx250] Numbers with E
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400F104000000000000000000000000383000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "0.1265"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400f104000000000000000000000000383000
-{"d":{"$numberDecimal":"0.1265"}}
-18000000136400f104000000000000000000000000383000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-137.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-137.phpt
deleted file mode 100644
index 8858d0af..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-137.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx257] Numbers with E
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400F104000000000000000000000000383000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "0.1265"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "0.1265E-0"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400f104000000000000000000000000383000
-{"d":{"$numberDecimal":"0.1265"}}
-18000000136400f104000000000000000000000000383000
-18000000136400f104000000000000000000000000383000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-138.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-138.phpt
deleted file mode 100644
index 5aa1a973..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-138.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx256] Numbers with E
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400F104000000000000000000000000363000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "0.01265"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "0.1265E-1"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400f104000000000000000000000000363000
-{"d":{"$numberDecimal":"0.01265"}}
-18000000136400f104000000000000000000000000363000
-18000000136400f104000000000000000000000000363000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-139.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-139.phpt
deleted file mode 100644
index 393281a4..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-139.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx258] Numbers with E
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400F1040000000000000000000000003A3000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.265"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "0.1265E+1"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400f1040000000000000000000000003a3000
-{"d":{"$numberDecimal":"1.265"}}
-18000000136400f1040000000000000000000000003a3000
-18000000136400f1040000000000000000000000003a3000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-140.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-140.phpt
deleted file mode 100644
index 284fcbdb..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-140.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx251] Numbers with E
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400F104000000000000000000000000103000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.265E-21"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "0.1265E-20"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400f104000000000000000000000000103000
-{"d":{"$numberDecimal":"1.265E-21"}}
-18000000136400f104000000000000000000000000103000
-18000000136400f104000000000000000000000000103000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-141.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-141.phpt
deleted file mode 100644
index 80059753..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-141.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx263] Numbers with E
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400F104000000000000000000000000603000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.265E+19"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "0.1265E+20"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400f104000000000000000000000000603000
-{"d":{"$numberDecimal":"1.265E+19"}}
-18000000136400f104000000000000000000000000603000
-18000000136400f104000000000000000000000000603000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-142.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-142.phpt
deleted file mode 100644
index ac4815b9..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-142.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx255] Numbers with E
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400F104000000000000000000000000343000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "0.001265"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "0.1265E-2"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400f104000000000000000000000000343000
-{"d":{"$numberDecimal":"0.001265"}}
-18000000136400f104000000000000000000000000343000
-18000000136400f104000000000000000000000000343000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-143.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-143.phpt
deleted file mode 100644
index 31b84dca..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-143.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx259] Numbers with E
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400F1040000000000000000000000003C3000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "12.65"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "0.1265E+2"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400f1040000000000000000000000003c3000
-{"d":{"$numberDecimal":"12.65"}}
-18000000136400f1040000000000000000000000003c3000
-18000000136400f1040000000000000000000000003c3000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-144.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-144.phpt
deleted file mode 100644
index 4823e2f4..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-144.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx254] Numbers with E
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400F104000000000000000000000000323000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "0.0001265"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "0.1265E-3"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400f104000000000000000000000000323000
-{"d":{"$numberDecimal":"0.0001265"}}
-18000000136400f104000000000000000000000000323000
-18000000136400f104000000000000000000000000323000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-145.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-145.phpt
deleted file mode 100644
index 0e866224..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-145.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx260] Numbers with E
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400F1040000000000000000000000003E3000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "126.5"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "0.1265E+3"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400f1040000000000000000000000003e3000
-{"d":{"$numberDecimal":"126.5"}}
-18000000136400f1040000000000000000000000003e3000
-18000000136400f1040000000000000000000000003e3000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-146.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-146.phpt
deleted file mode 100644
index 6c55cad1..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-146.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx253] Numbers with E
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400F104000000000000000000000000303000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "0.00001265"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "0.1265E-4"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400f104000000000000000000000000303000
-{"d":{"$numberDecimal":"0.00001265"}}
-18000000136400f104000000000000000000000000303000
-18000000136400f104000000000000000000000000303000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-147.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-147.phpt
deleted file mode 100644
index 2b9ea321..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-147.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx261] Numbers with E
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400F104000000000000000000000000403000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "1265"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "0.1265E+4"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400f104000000000000000000000000403000
-{"d":{"$numberDecimal":"1265"}}
-18000000136400f104000000000000000000000000403000
-18000000136400f104000000000000000000000000403000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-148.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-148.phpt
deleted file mode 100644
index 29918928..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-148.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx252] Numbers with E
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400F104000000000000000000000000283000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.265E-9"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "0.1265E-8"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400f104000000000000000000000000283000
-{"d":{"$numberDecimal":"1.265E-9"}}
-18000000136400f104000000000000000000000000283000
-18000000136400f104000000000000000000000000283000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-149.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-149.phpt
deleted file mode 100644
index ada81ee6..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-149.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx262] Numbers with E
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400F104000000000000000000000000483000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.265E+7"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "0.1265E+8"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400f104000000000000000000000000483000
-{"d":{"$numberDecimal":"1.265E+7"}}
-18000000136400f104000000000000000000000000483000
-18000000136400f104000000000000000000000000483000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-150.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-150.phpt
deleted file mode 100644
index 127a4a0c..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-150.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx159] Numbers with E
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('1800000013640049000000000000000000000000002E3000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "7.3E-8"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "0.73e-7"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-1800000013640049000000000000000000000000002e3000
-{"d":{"$numberDecimal":"7.3E-8"}}
-1800000013640049000000000000000000000000002e3000
-1800000013640049000000000000000000000000002e3000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-151.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-151.phpt
deleted file mode 100644
index 69e4a753..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-151.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [basx004] conform to rules and exponent will be in permitted range).
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('1800000013640064000000000000000000000000003C3000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.00"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-1800000013640064000000000000000000000000003c3000
-{"d":{"$numberDecimal":"1.00"}}
-1800000013640064000000000000000000000000003c3000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-152.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-152.phpt
deleted file mode 100644
index dd08fb2a..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-152.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [basx003] conform to rules and exponent will be in permitted range).
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000A000000000000000000000000003E3000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.0"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000a000000000000000000000000003e3000
-{"d":{"$numberDecimal":"1.0"}}
-180000001364000a000000000000000000000000003e3000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-153.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-153.phpt
deleted file mode 100644
index dcc7f3ff..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-153.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [basx002] conform to rules and exponent will be in permitted range).
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000100000000000000000000000000403000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "1"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000100000000000000000000000000403000
-{"d":{"$numberDecimal":"1"}}
-180000001364000100000000000000000000000000403000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-154.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-154.phpt
deleted file mode 100644
index cb672966..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-154.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx148] Numbers with E
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000100000000000000000000000000523000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "1E+9"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "1E+009"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000100000000000000000000000000523000
-{"d":{"$numberDecimal":"1E+9"}}
-180000001364000100000000000000000000000000523000
-180000001364000100000000000000000000000000523000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-155.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-155.phpt
deleted file mode 100644
index 49e24be9..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-155.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx153] Numbers with E
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000100000000000000000000000000523000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "1E+9"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "1E009"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000100000000000000000000000000523000
-{"d":{"$numberDecimal":"1E+9"}}
-180000001364000100000000000000000000000000523000
-180000001364000100000000000000000000000000523000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-156.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-156.phpt
deleted file mode 100644
index f344e729..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-156.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx141] Numbers with E
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000100000000000000000000000000523000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "1E+9"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "1e+09"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000100000000000000000000000000523000
-{"d":{"$numberDecimal":"1E+9"}}
-180000001364000100000000000000000000000000523000
-180000001364000100000000000000000000000000523000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-157.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-157.phpt
deleted file mode 100644
index 9461cf16..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-157.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx146] Numbers with E
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000100000000000000000000000000523000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "1E+9"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "1E+09"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000100000000000000000000000000523000
-{"d":{"$numberDecimal":"1E+9"}}
-180000001364000100000000000000000000000000523000
-180000001364000100000000000000000000000000523000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-158.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-158.phpt
deleted file mode 100644
index d2389a6a..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-158.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx151] Numbers with E
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000100000000000000000000000000523000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "1E+9"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "1e09"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000100000000000000000000000000523000
-{"d":{"$numberDecimal":"1E+9"}}
-180000001364000100000000000000000000000000523000
-180000001364000100000000000000000000000000523000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-159.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-159.phpt
deleted file mode 100644
index 5dad4b27..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-159.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [basx142] Numbers with E
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000100000000000000000000000000F43000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "1E+90"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000100000000000000000000000000f43000
-{"d":{"$numberDecimal":"1E+90"}}
-180000001364000100000000000000000000000000f43000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-160.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-160.phpt
deleted file mode 100644
index 21b1d8da..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-160.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx147] Numbers with E
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000100000000000000000000000000F43000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "1E+90"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "1e+90"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000100000000000000000000000000f43000
-{"d":{"$numberDecimal":"1E+90"}}
-180000001364000100000000000000000000000000f43000
-180000001364000100000000000000000000000000f43000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-161.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-161.phpt
deleted file mode 100644
index 1af45802..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-161.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx152] Numbers with E
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000100000000000000000000000000F43000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "1E+90"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "1E90"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000100000000000000000000000000f43000
-{"d":{"$numberDecimal":"1E+90"}}
-180000001364000100000000000000000000000000f43000
-180000001364000100000000000000000000000000f43000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-162.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-162.phpt
deleted file mode 100644
index e364165d..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-162.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [basx140] Numbers with E
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000100000000000000000000000000523000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "1E+9"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000100000000000000000000000000523000
-{"d":{"$numberDecimal":"1E+9"}}
-180000001364000100000000000000000000000000523000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-163.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-163.phpt
deleted file mode 100644
index 42fa239e..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-163.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx150] Numbers with E
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000100000000000000000000000000523000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "1E+9"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "1E9"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000100000000000000000000000000523000
-{"d":{"$numberDecimal":"1E+9"}}
-180000001364000100000000000000000000000000523000
-180000001364000100000000000000000000000000523000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-164.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-164.phpt
deleted file mode 100644
index 7f4d1461..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-164.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [basx014] conform to rules and exponent will be in permitted range).
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400D2040000000000000000000000003A3000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.234"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400d2040000000000000000000000003a3000
-{"d":{"$numberDecimal":"1.234"}}
-18000000136400d2040000000000000000000000003a3000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-165.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-165.phpt
deleted file mode 100644
index 9275d19c..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-165.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [basx170] Numbers with E
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400F1040000000000000000000000003A3000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.265"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400f1040000000000000000000000003a3000
-{"d":{"$numberDecimal":"1.265"}}
-18000000136400f1040000000000000000000000003a3000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-166.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-166.phpt
deleted file mode 100644
index a795ff93..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-166.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx177] Numbers with E
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400F1040000000000000000000000003A3000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.265"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "1.265E-0"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400f1040000000000000000000000003a3000
-{"d":{"$numberDecimal":"1.265"}}
-18000000136400f1040000000000000000000000003a3000
-18000000136400f1040000000000000000000000003a3000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-167.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-167.phpt
deleted file mode 100644
index 37e1b53e..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-167.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx176] Numbers with E
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400F104000000000000000000000000383000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "0.1265"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "1.265E-1"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400f104000000000000000000000000383000
-{"d":{"$numberDecimal":"0.1265"}}
-18000000136400f104000000000000000000000000383000
-18000000136400f104000000000000000000000000383000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-168.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-168.phpt
deleted file mode 100644
index adbc0cec..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-168.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx178] Numbers with E
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400F1040000000000000000000000003C3000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "12.65"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "1.265E+1"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400f1040000000000000000000000003c3000
-{"d":{"$numberDecimal":"12.65"}}
-18000000136400f1040000000000000000000000003c3000
-18000000136400f1040000000000000000000000003c3000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-169.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-169.phpt
deleted file mode 100644
index 5cc433f6..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-169.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [basx171] Numbers with E
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400F104000000000000000000000000123000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.265E-20"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400f104000000000000000000000000123000
-{"d":{"$numberDecimal":"1.265E-20"}}
-18000000136400f104000000000000000000000000123000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-170.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-170.phpt
deleted file mode 100644
index 2ba0a2b8..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-170.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [basx183] Numbers with E
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400F104000000000000000000000000623000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.265E+20"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400f104000000000000000000000000623000
-{"d":{"$numberDecimal":"1.265E+20"}}
-18000000136400f104000000000000000000000000623000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-171.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-171.phpt
deleted file mode 100644
index 58547e6b..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-171.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx175] Numbers with E
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400F104000000000000000000000000363000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "0.01265"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "1.265E-2"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400f104000000000000000000000000363000
-{"d":{"$numberDecimal":"0.01265"}}
-18000000136400f104000000000000000000000000363000
-18000000136400f104000000000000000000000000363000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-172.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-172.phpt
deleted file mode 100644
index 12ea0738..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-172.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx179] Numbers with E
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400F1040000000000000000000000003E3000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "126.5"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "1.265E+2"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400f1040000000000000000000000003e3000
-{"d":{"$numberDecimal":"126.5"}}
-18000000136400f1040000000000000000000000003e3000
-18000000136400f1040000000000000000000000003e3000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-173.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-173.phpt
deleted file mode 100644
index 868cf8bb..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-173.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx174] Numbers with E
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400F104000000000000000000000000343000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "0.001265"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "1.265E-3"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400f104000000000000000000000000343000
-{"d":{"$numberDecimal":"0.001265"}}
-18000000136400f104000000000000000000000000343000
-18000000136400f104000000000000000000000000343000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-174.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-174.phpt
deleted file mode 100644
index e14e8d9c..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-174.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx180] Numbers with E
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400F104000000000000000000000000403000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "1265"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "1.265E+3"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400f104000000000000000000000000403000
-{"d":{"$numberDecimal":"1265"}}
-18000000136400f104000000000000000000000000403000
-18000000136400f104000000000000000000000000403000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-175.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-175.phpt
deleted file mode 100644
index 34abead1..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-175.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx173] Numbers with E
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400F104000000000000000000000000323000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "0.0001265"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "1.265E-4"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400f104000000000000000000000000323000
-{"d":{"$numberDecimal":"0.0001265"}}
-18000000136400f104000000000000000000000000323000
-18000000136400f104000000000000000000000000323000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-176.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-176.phpt
deleted file mode 100644
index 4c8cfbc0..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-176.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [basx181] Numbers with E
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400F104000000000000000000000000423000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.265E+4"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400f104000000000000000000000000423000
-{"d":{"$numberDecimal":"1.265E+4"}}
-18000000136400f104000000000000000000000000423000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-177.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-177.phpt
deleted file mode 100644
index e06088cb..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-177.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [basx172] Numbers with E
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400F1040000000000000000000000002A3000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.265E-8"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400f1040000000000000000000000002a3000
-{"d":{"$numberDecimal":"1.265E-8"}}
-18000000136400f1040000000000000000000000002a3000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-178.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-178.phpt
deleted file mode 100644
index cfa7703d..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-178.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [basx182] Numbers with E
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400F1040000000000000000000000004A3000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.265E+8"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400f1040000000000000000000000004a3000
-{"d":{"$numberDecimal":"1.265E+8"}}
-18000000136400f1040000000000000000000000004a3000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-179.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-179.phpt
deleted file mode 100644
index 21d4a6e3..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-179.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [basx157] Numbers with E
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000400000000000000000000000000523000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "4E+9"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000400000000000000000000000000523000
-{"d":{"$numberDecimal":"4E+9"}}
-180000001364000400000000000000000000000000523000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-180.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-180.phpt
deleted file mode 100644
index 13594e2b..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-180.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx067] examples
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000500000000000000000000000000343000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "0.000005"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "5E-6"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000500000000000000000000000000343000
-{"d":{"$numberDecimal":"0.000005"}}
-180000001364000500000000000000000000000000343000
-180000001364000500000000000000000000000000343000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-181.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-181.phpt
deleted file mode 100644
index 5bec3f9e..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-181.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [basx069] examples
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000500000000000000000000000000323000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "5E-7"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000500000000000000000000000000323000
-{"d":{"$numberDecimal":"5E-7"}}
-180000001364000500000000000000000000000000323000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-182.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-182.phpt
deleted file mode 100644
index 6fc8304a..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-182.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx385] Engineering notation tests
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000700000000000000000000000000403000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "7"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "7E0"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000700000000000000000000000000403000
-{"d":{"$numberDecimal":"7"}}
-180000001364000700000000000000000000000000403000
-180000001364000700000000000000000000000000403000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-183.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-183.phpt
deleted file mode 100644
index cd3d5b3f..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-183.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx365] Engineering notation tests
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000700000000000000000000000000543000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "7E+10"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "7E10"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000700000000000000000000000000543000
-{"d":{"$numberDecimal":"7E+10"}}
-180000001364000700000000000000000000000000543000
-180000001364000700000000000000000000000000543000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-184.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-184.phpt
deleted file mode 100644
index cec47cb5..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-184.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [basx405] Engineering notation tests
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('1800000013640007000000000000000000000000002C3000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "7E-10"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-1800000013640007000000000000000000000000002c3000
-{"d":{"$numberDecimal":"7E-10"}}
-1800000013640007000000000000000000000000002c3000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-185.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-185.phpt
deleted file mode 100644
index 8b09275e..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-185.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx363] Engineering notation tests
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000700000000000000000000000000563000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "7E+11"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "7E11"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000700000000000000000000000000563000
-{"d":{"$numberDecimal":"7E+11"}}
-180000001364000700000000000000000000000000563000
-180000001364000700000000000000000000000000563000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-186.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-186.phpt
deleted file mode 100644
index e6a16784..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-186.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [basx407] Engineering notation tests
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('1800000013640007000000000000000000000000002A3000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "7E-11"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-1800000013640007000000000000000000000000002a3000
-{"d":{"$numberDecimal":"7E-11"}}
-1800000013640007000000000000000000000000002a3000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-187.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-187.phpt
deleted file mode 100644
index 57c3c413..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-187.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx361] Engineering notation tests
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000700000000000000000000000000583000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "7E+12"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "7E12"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000700000000000000000000000000583000
-{"d":{"$numberDecimal":"7E+12"}}
-180000001364000700000000000000000000000000583000
-180000001364000700000000000000000000000000583000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-188.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-188.phpt
deleted file mode 100644
index ecbf8502..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-188.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [basx409] Engineering notation tests
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000700000000000000000000000000283000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "7E-12"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000700000000000000000000000000283000
-{"d":{"$numberDecimal":"7E-12"}}
-180000001364000700000000000000000000000000283000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-189.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-189.phpt
deleted file mode 100644
index 6fa865dc..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-189.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [basx411] Engineering notation tests
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000700000000000000000000000000263000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "7E-13"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000700000000000000000000000000263000
-{"d":{"$numberDecimal":"7E-13"}}
-180000001364000700000000000000000000000000263000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-190.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-190.phpt
deleted file mode 100644
index 8b190568..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-190.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx383] Engineering notation tests
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000700000000000000000000000000423000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "7E+1"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "7E1"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000700000000000000000000000000423000
-{"d":{"$numberDecimal":"7E+1"}}
-180000001364000700000000000000000000000000423000
-180000001364000700000000000000000000000000423000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-191.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-191.phpt
deleted file mode 100644
index 2eae2ed1..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-191.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx387] Engineering notation tests
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('1800000013640007000000000000000000000000003E3000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "0.7"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "7E-1"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-1800000013640007000000000000000000000000003e3000
-{"d":{"$numberDecimal":"0.7"}}
-1800000013640007000000000000000000000000003e3000
-1800000013640007000000000000000000000000003e3000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-192.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-192.phpt
deleted file mode 100644
index bd55ce86..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-192.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx381] Engineering notation tests
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000700000000000000000000000000443000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "7E+2"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "7E2"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000700000000000000000000000000443000
-{"d":{"$numberDecimal":"7E+2"}}
-180000001364000700000000000000000000000000443000
-180000001364000700000000000000000000000000443000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-193.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-193.phpt
deleted file mode 100644
index 79eb71b1..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-193.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx389] Engineering notation tests
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('1800000013640007000000000000000000000000003C3000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "0.07"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "7E-2"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-1800000013640007000000000000000000000000003c3000
-{"d":{"$numberDecimal":"0.07"}}
-1800000013640007000000000000000000000000003c3000
-1800000013640007000000000000000000000000003c3000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-194.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-194.phpt
deleted file mode 100644
index bbc75ca6..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-194.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx379] Engineering notation tests
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000700000000000000000000000000463000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "7E+3"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "7E3"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000700000000000000000000000000463000
-{"d":{"$numberDecimal":"7E+3"}}
-180000001364000700000000000000000000000000463000
-180000001364000700000000000000000000000000463000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-195.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-195.phpt
deleted file mode 100644
index 342146b6..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-195.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx391] Engineering notation tests
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('1800000013640007000000000000000000000000003A3000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "0.007"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "7E-3"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-1800000013640007000000000000000000000000003a3000
-{"d":{"$numberDecimal":"0.007"}}
-1800000013640007000000000000000000000000003a3000
-1800000013640007000000000000000000000000003a3000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-196.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-196.phpt
deleted file mode 100644
index 2b91cfd1..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-196.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx377] Engineering notation tests
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000700000000000000000000000000483000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "7E+4"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "7E4"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000700000000000000000000000000483000
-{"d":{"$numberDecimal":"7E+4"}}
-180000001364000700000000000000000000000000483000
-180000001364000700000000000000000000000000483000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-197.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-197.phpt
deleted file mode 100644
index 45af93d0..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-197.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx393] Engineering notation tests
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000700000000000000000000000000383000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "0.0007"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "7E-4"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000700000000000000000000000000383000
-{"d":{"$numberDecimal":"0.0007"}}
-180000001364000700000000000000000000000000383000
-180000001364000700000000000000000000000000383000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-198.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-198.phpt
deleted file mode 100644
index dce4b08e..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-198.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx375] Engineering notation tests
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('1800000013640007000000000000000000000000004A3000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "7E+5"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "7E5"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-1800000013640007000000000000000000000000004a3000
-{"d":{"$numberDecimal":"7E+5"}}
-1800000013640007000000000000000000000000004a3000
-1800000013640007000000000000000000000000004a3000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-199.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-199.phpt
deleted file mode 100644
index 6f630294..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-199.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx395] Engineering notation tests
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000700000000000000000000000000363000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "0.00007"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "7E-5"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000700000000000000000000000000363000
-{"d":{"$numberDecimal":"0.00007"}}
-180000001364000700000000000000000000000000363000
-180000001364000700000000000000000000000000363000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-200.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-200.phpt
deleted file mode 100644
index 61ec4502..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-200.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx373] Engineering notation tests
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('1800000013640007000000000000000000000000004C3000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "7E+6"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "7E6"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-1800000013640007000000000000000000000000004c3000
-{"d":{"$numberDecimal":"7E+6"}}
-1800000013640007000000000000000000000000004c3000
-1800000013640007000000000000000000000000004c3000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-201.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-201.phpt
deleted file mode 100644
index 2cca27f7..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-201.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx397] Engineering notation tests
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000700000000000000000000000000343000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "0.000007"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "7E-6"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000700000000000000000000000000343000
-{"d":{"$numberDecimal":"0.000007"}}
-180000001364000700000000000000000000000000343000
-180000001364000700000000000000000000000000343000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-202.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-202.phpt
deleted file mode 100644
index f8315b3f..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-202.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx371] Engineering notation tests
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('1800000013640007000000000000000000000000004E3000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "7E+7"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "7E7"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-1800000013640007000000000000000000000000004e3000
-{"d":{"$numberDecimal":"7E+7"}}
-1800000013640007000000000000000000000000004e3000
-1800000013640007000000000000000000000000004e3000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-203.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-203.phpt
deleted file mode 100644
index fe7fd361..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-203.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [basx399] Engineering notation tests
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000700000000000000000000000000323000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "7E-7"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000700000000000000000000000000323000
-{"d":{"$numberDecimal":"7E-7"}}
-180000001364000700000000000000000000000000323000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-204.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-204.phpt
deleted file mode 100644
index 24b31ab7..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-204.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx369] Engineering notation tests
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000700000000000000000000000000503000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "7E+8"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "7E8"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000700000000000000000000000000503000
-{"d":{"$numberDecimal":"7E+8"}}
-180000001364000700000000000000000000000000503000
-180000001364000700000000000000000000000000503000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-205.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-205.phpt
deleted file mode 100644
index 7a75ebfd..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-205.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [basx401] Engineering notation tests
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000700000000000000000000000000303000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "7E-8"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000700000000000000000000000000303000
-{"d":{"$numberDecimal":"7E-8"}}
-180000001364000700000000000000000000000000303000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-206.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-206.phpt
deleted file mode 100644
index 5ead14bc..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-206.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx367] Engineering notation tests
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000700000000000000000000000000523000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "7E+9"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "7E9"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000700000000000000000000000000523000
-{"d":{"$numberDecimal":"7E+9"}}
-180000001364000700000000000000000000000000523000
-180000001364000700000000000000000000000000523000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-207.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-207.phpt
deleted file mode 100644
index e77826e7..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-207.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [basx403] Engineering notation tests
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('1800000013640007000000000000000000000000002E3000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "7E-9"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-1800000013640007000000000000000000000000002e3000
-{"d":{"$numberDecimal":"7E-9"}}
-1800000013640007000000000000000000000000002e3000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-208.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-208.phpt
deleted file mode 100644
index fc4c3178..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-208.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [basx007] conform to rules and exponent will be in permitted range).
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('1800000013640064000000000000000000000000003E3000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "10.0"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-1800000013640064000000000000000000000000003e3000
-{"d":{"$numberDecimal":"10.0"}}
-1800000013640064000000000000000000000000003e3000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-209.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-209.phpt
deleted file mode 100644
index a8179efd..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-209.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [basx005] conform to rules and exponent will be in permitted range).
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000A00000000000000000000000000403000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "10"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000a00000000000000000000000000403000
-{"d":{"$numberDecimal":"10"}}
-180000001364000a00000000000000000000000000403000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-210.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-210.phpt
deleted file mode 100644
index fe4798c7..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-210.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx165] Numbers with E
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000A00000000000000000000000000523000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.0E+10"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "10E+009"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000a00000000000000000000000000523000
-{"d":{"$numberDecimal":"1.0E+10"}}
-180000001364000a00000000000000000000000000523000
-180000001364000a00000000000000000000000000523000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-211.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-211.phpt
deleted file mode 100644
index f2999a4a..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-211.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx163] Numbers with E
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000A00000000000000000000000000523000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.0E+10"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "10E+09"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000a00000000000000000000000000523000
-{"d":{"$numberDecimal":"1.0E+10"}}
-180000001364000a00000000000000000000000000523000
-180000001364000a00000000000000000000000000523000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-212.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-212.phpt
deleted file mode 100644
index 185bc432..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-212.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx325] Engineering notation tests
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000A00000000000000000000000000403000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "10"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "10e0"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000a00000000000000000000000000403000
-{"d":{"$numberDecimal":"10"}}
-180000001364000a00000000000000000000000000403000
-180000001364000a00000000000000000000000000403000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-213.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-213.phpt
deleted file mode 100644
index 8c49afb4..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-213.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx305] Engineering notation tests
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000A00000000000000000000000000543000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.0E+11"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "10e10"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000a00000000000000000000000000543000
-{"d":{"$numberDecimal":"1.0E+11"}}
-180000001364000a00000000000000000000000000543000
-180000001364000a00000000000000000000000000543000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-214.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-214.phpt
deleted file mode 100644
index 265ca313..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-214.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx345] Engineering notation tests
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000A000000000000000000000000002C3000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.0E-9"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "10e-10"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000a000000000000000000000000002c3000
-{"d":{"$numberDecimal":"1.0E-9"}}
-180000001364000a000000000000000000000000002c3000
-180000001364000a000000000000000000000000002c3000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-215.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-215.phpt
deleted file mode 100644
index f4147b6a..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-215.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx303] Engineering notation tests
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000A00000000000000000000000000563000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.0E+12"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "10e11"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000a00000000000000000000000000563000
-{"d":{"$numberDecimal":"1.0E+12"}}
-180000001364000a00000000000000000000000000563000
-180000001364000a00000000000000000000000000563000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-216.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-216.phpt
deleted file mode 100644
index aae68001..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-216.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx347] Engineering notation tests
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000A000000000000000000000000002A3000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.0E-10"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "10e-11"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000a000000000000000000000000002a3000
-{"d":{"$numberDecimal":"1.0E-10"}}
-180000001364000a000000000000000000000000002a3000
-180000001364000a000000000000000000000000002a3000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-217.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-217.phpt
deleted file mode 100644
index d8de3b17..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-217.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx301] Engineering notation tests
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000A00000000000000000000000000583000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.0E+13"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "10e12"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000a00000000000000000000000000583000
-{"d":{"$numberDecimal":"1.0E+13"}}
-180000001364000a00000000000000000000000000583000
-180000001364000a00000000000000000000000000583000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-218.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-218.phpt
deleted file mode 100644
index 8e911a58..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-218.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx349] Engineering notation tests
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000A00000000000000000000000000283000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.0E-11"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "10e-12"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000a00000000000000000000000000283000
-{"d":{"$numberDecimal":"1.0E-11"}}
-180000001364000a00000000000000000000000000283000
-180000001364000a00000000000000000000000000283000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-219.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-219.phpt
deleted file mode 100644
index ef5c4546..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-219.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx351] Engineering notation tests
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000A00000000000000000000000000263000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.0E-12"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "10e-13"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000a00000000000000000000000000263000
-{"d":{"$numberDecimal":"1.0E-12"}}
-180000001364000a00000000000000000000000000263000
-180000001364000a00000000000000000000000000263000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-220.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-220.phpt
deleted file mode 100644
index bf757d47..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-220.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx323] Engineering notation tests
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000A00000000000000000000000000423000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.0E+2"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "10e1"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000a00000000000000000000000000423000
-{"d":{"$numberDecimal":"1.0E+2"}}
-180000001364000a00000000000000000000000000423000
-180000001364000a00000000000000000000000000423000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-221.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-221.phpt
deleted file mode 100644
index a5f2d588..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-221.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx327] Engineering notation tests
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000A000000000000000000000000003E3000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.0"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "10e-1"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000a000000000000000000000000003e3000
-{"d":{"$numberDecimal":"1.0"}}
-180000001364000a000000000000000000000000003e3000
-180000001364000a000000000000000000000000003e3000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-222.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-222.phpt
deleted file mode 100644
index ccb80bf6..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-222.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx321] Engineering notation tests
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000A00000000000000000000000000443000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.0E+3"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "10e2"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000a00000000000000000000000000443000
-{"d":{"$numberDecimal":"1.0E+3"}}
-180000001364000a00000000000000000000000000443000
-180000001364000a00000000000000000000000000443000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-223.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-223.phpt
deleted file mode 100644
index b2ea20e7..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-223.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx329] Engineering notation tests
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000A000000000000000000000000003C3000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "0.10"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "10e-2"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000a000000000000000000000000003c3000
-{"d":{"$numberDecimal":"0.10"}}
-180000001364000a000000000000000000000000003c3000
-180000001364000a000000000000000000000000003c3000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-224.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-224.phpt
deleted file mode 100644
index 649958dc..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-224.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx319] Engineering notation tests
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000A00000000000000000000000000463000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.0E+4"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "10e3"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000a00000000000000000000000000463000
-{"d":{"$numberDecimal":"1.0E+4"}}
-180000001364000a00000000000000000000000000463000
-180000001364000a00000000000000000000000000463000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-225.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-225.phpt
deleted file mode 100644
index 74ac0d8b..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-225.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx331] Engineering notation tests
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000A000000000000000000000000003A3000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "0.010"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "10e-3"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000a000000000000000000000000003a3000
-{"d":{"$numberDecimal":"0.010"}}
-180000001364000a000000000000000000000000003a3000
-180000001364000a000000000000000000000000003a3000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-226.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-226.phpt
deleted file mode 100644
index 0ff96f00..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-226.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx317] Engineering notation tests
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000A00000000000000000000000000483000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.0E+5"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "10e4"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000a00000000000000000000000000483000
-{"d":{"$numberDecimal":"1.0E+5"}}
-180000001364000a00000000000000000000000000483000
-180000001364000a00000000000000000000000000483000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-227.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-227.phpt
deleted file mode 100644
index 2dca404b..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-227.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx333] Engineering notation tests
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000A00000000000000000000000000383000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "0.0010"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "10e-4"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000a00000000000000000000000000383000
-{"d":{"$numberDecimal":"0.0010"}}
-180000001364000a00000000000000000000000000383000
-180000001364000a00000000000000000000000000383000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-228.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-228.phpt
deleted file mode 100644
index 335c4c2e..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-228.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx315] Engineering notation tests
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000A000000000000000000000000004A3000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.0E+6"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "10e5"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000a000000000000000000000000004a3000
-{"d":{"$numberDecimal":"1.0E+6"}}
-180000001364000a000000000000000000000000004a3000
-180000001364000a000000000000000000000000004a3000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-229.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-229.phpt
deleted file mode 100644
index 1cba0d8a..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-229.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx335] Engineering notation tests
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000A00000000000000000000000000363000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "0.00010"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "10e-5"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000a00000000000000000000000000363000
-{"d":{"$numberDecimal":"0.00010"}}
-180000001364000a00000000000000000000000000363000
-180000001364000a00000000000000000000000000363000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-230.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-230.phpt
deleted file mode 100644
index a362ff01..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-230.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx313] Engineering notation tests
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000A000000000000000000000000004C3000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.0E+7"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "10e6"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000a000000000000000000000000004c3000
-{"d":{"$numberDecimal":"1.0E+7"}}
-180000001364000a000000000000000000000000004c3000
-180000001364000a000000000000000000000000004c3000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-231.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-231.phpt
deleted file mode 100644
index 80973672..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-231.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx337] Engineering notation tests
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000A00000000000000000000000000343000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "0.000010"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "10e-6"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000a00000000000000000000000000343000
-{"d":{"$numberDecimal":"0.000010"}}
-180000001364000a00000000000000000000000000343000
-180000001364000a00000000000000000000000000343000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-232.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-232.phpt
deleted file mode 100644
index 440912bf..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-232.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx311] Engineering notation tests
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000A000000000000000000000000004E3000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.0E+8"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "10e7"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000a000000000000000000000000004e3000
-{"d":{"$numberDecimal":"1.0E+8"}}
-180000001364000a000000000000000000000000004e3000
-180000001364000a000000000000000000000000004e3000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-233.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-233.phpt
deleted file mode 100644
index ab009f8a..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-233.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx339] Engineering notation tests
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000A00000000000000000000000000323000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "0.0000010"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "10e-7"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000a00000000000000000000000000323000
-{"d":{"$numberDecimal":"0.0000010"}}
-180000001364000a00000000000000000000000000323000
-180000001364000a00000000000000000000000000323000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-234.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-234.phpt
deleted file mode 100644
index a7a3b1f3..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-234.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx309] Engineering notation tests
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000A00000000000000000000000000503000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.0E+9"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "10e8"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000a00000000000000000000000000503000
-{"d":{"$numberDecimal":"1.0E+9"}}
-180000001364000a00000000000000000000000000503000
-180000001364000a00000000000000000000000000503000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-235.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-235.phpt
deleted file mode 100644
index 18c51694..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-235.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx341] Engineering notation tests
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000A00000000000000000000000000303000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.0E-7"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "10e-8"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000a00000000000000000000000000303000
-{"d":{"$numberDecimal":"1.0E-7"}}
-180000001364000a00000000000000000000000000303000
-180000001364000a00000000000000000000000000303000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-236.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-236.phpt
deleted file mode 100644
index 14059f58..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-236.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx164] Numbers with E
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000A00000000000000000000000000F43000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.0E+91"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "10e+90"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000a00000000000000000000000000f43000
-{"d":{"$numberDecimal":"1.0E+91"}}
-180000001364000a00000000000000000000000000f43000
-180000001364000a00000000000000000000000000f43000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-237.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-237.phpt
deleted file mode 100644
index 79bced1a..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-237.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx162] Numbers with E
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000A00000000000000000000000000523000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.0E+10"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "10E+9"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000a00000000000000000000000000523000
-{"d":{"$numberDecimal":"1.0E+10"}}
-180000001364000a00000000000000000000000000523000
-180000001364000a00000000000000000000000000523000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-238.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-238.phpt
deleted file mode 100644
index d0dc6392..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-238.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx307] Engineering notation tests
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000A00000000000000000000000000523000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.0E+10"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "10e9"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000a00000000000000000000000000523000
-{"d":{"$numberDecimal":"1.0E+10"}}
-180000001364000a00000000000000000000000000523000
-180000001364000a00000000000000000000000000523000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-239.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-239.phpt
deleted file mode 100644
index f0198a1c..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-239.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx343] Engineering notation tests
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000A000000000000000000000000002E3000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.0E-8"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "10e-9"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000a000000000000000000000000002e3000
-{"d":{"$numberDecimal":"1.0E-8"}}
-180000001364000a000000000000000000000000002e3000
-180000001364000a000000000000000000000000002e3000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-240.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-240.phpt
deleted file mode 100644
index e6594676..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-240.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [basx008] conform to rules and exponent will be in permitted range).
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('1800000013640065000000000000000000000000003E3000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "10.1"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-1800000013640065000000000000000000000000003e3000
-{"d":{"$numberDecimal":"10.1"}}
-1800000013640065000000000000000000000000003e3000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-241.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-241.phpt
deleted file mode 100644
index 58fc5445..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-241.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [basx009] conform to rules and exponent will be in permitted range).
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('1800000013640068000000000000000000000000003E3000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "10.4"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-1800000013640068000000000000000000000000003e3000
-{"d":{"$numberDecimal":"10.4"}}
-1800000013640068000000000000000000000000003e3000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-242.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-242.phpt
deleted file mode 100644
index 51fc7d1e..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-242.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [basx010] conform to rules and exponent will be in permitted range).
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('1800000013640069000000000000000000000000003E3000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "10.5"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-1800000013640069000000000000000000000000003e3000
-{"d":{"$numberDecimal":"10.5"}}
-1800000013640069000000000000000000000000003e3000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-243.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-243.phpt
deleted file mode 100644
index dac01473..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-243.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [basx011] conform to rules and exponent will be in permitted range).
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364006A000000000000000000000000003E3000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "10.6"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364006a000000000000000000000000003e3000
-{"d":{"$numberDecimal":"10.6"}}
-180000001364006a000000000000000000000000003e3000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-244.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-244.phpt
deleted file mode 100644
index fa5e8172..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-244.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [basx012] conform to rules and exponent will be in permitted range).
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364006D000000000000000000000000003E3000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "10.9"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364006d000000000000000000000000003e3000
-{"d":{"$numberDecimal":"10.9"}}
-180000001364006d000000000000000000000000003e3000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-245.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-245.phpt
deleted file mode 100644
index 8bc6daac..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-245.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [basx013] conform to rules and exponent will be in permitted range).
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364006E000000000000000000000000003E3000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "11.0"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364006e000000000000000000000000003e3000
-{"d":{"$numberDecimal":"11.0"}}
-180000001364006e000000000000000000000000003e3000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-246.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-246.phpt
deleted file mode 100644
index 801893b8..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-246.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [basx040] strings without E cannot generate E in result
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000C00000000000000000000000000403000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "12"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000c00000000000000000000000000403000
-{"d":{"$numberDecimal":"12"}}
-180000001364000c00000000000000000000000000403000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-247.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-247.phpt
deleted file mode 100644
index 2a7d1c26..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-247.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [basx190] Numbers with E
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400F1040000000000000000000000003C3000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "12.65"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400f1040000000000000000000000003c3000
-{"d":{"$numberDecimal":"12.65"}}
-18000000136400f1040000000000000000000000003c3000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-248.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-248.phpt
deleted file mode 100644
index 1421e0af..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-248.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx197] Numbers with E
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400F1040000000000000000000000003C3000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "12.65"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "12.65E-0"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400f1040000000000000000000000003c3000
-{"d":{"$numberDecimal":"12.65"}}
-18000000136400f1040000000000000000000000003c3000
-18000000136400f1040000000000000000000000003c3000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-249.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-249.phpt
deleted file mode 100644
index 06fa94d8..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-249.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx196] Numbers with E
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400F1040000000000000000000000003A3000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.265"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "12.65E-1"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400f1040000000000000000000000003a3000
-{"d":{"$numberDecimal":"1.265"}}
-18000000136400f1040000000000000000000000003a3000
-18000000136400f1040000000000000000000000003a3000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-250.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-250.phpt
deleted file mode 100644
index 42459594..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-250.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx198] Numbers with E
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400F1040000000000000000000000003E3000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "126.5"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "12.65E+1"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400f1040000000000000000000000003e3000
-{"d":{"$numberDecimal":"126.5"}}
-18000000136400f1040000000000000000000000003e3000
-18000000136400f1040000000000000000000000003e3000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-251.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-251.phpt
deleted file mode 100644
index d8eeec88..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-251.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx191] Numbers with E
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400F104000000000000000000000000143000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.265E-19"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "12.65E-20"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400f104000000000000000000000000143000
-{"d":{"$numberDecimal":"1.265E-19"}}
-18000000136400f104000000000000000000000000143000
-18000000136400f104000000000000000000000000143000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-252.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-252.phpt
deleted file mode 100644
index 9625675d..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-252.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx203] Numbers with E
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400F104000000000000000000000000643000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.265E+21"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "12.65E+20"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400f104000000000000000000000000643000
-{"d":{"$numberDecimal":"1.265E+21"}}
-18000000136400f104000000000000000000000000643000
-18000000136400f104000000000000000000000000643000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-253.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-253.phpt
deleted file mode 100644
index 685ed3fb..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-253.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx195] Numbers with E
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400F104000000000000000000000000383000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "0.1265"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "12.65E-2"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400f104000000000000000000000000383000
-{"d":{"$numberDecimal":"0.1265"}}
-18000000136400f104000000000000000000000000383000
-18000000136400f104000000000000000000000000383000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-254.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-254.phpt
deleted file mode 100644
index 49927ff1..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-254.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx199] Numbers with E
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400F104000000000000000000000000403000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "1265"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "12.65E+2"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400f104000000000000000000000000403000
-{"d":{"$numberDecimal":"1265"}}
-18000000136400f104000000000000000000000000403000
-18000000136400f104000000000000000000000000403000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-255.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-255.phpt
deleted file mode 100644
index 7d616e50..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-255.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx194] Numbers with E
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400F104000000000000000000000000363000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "0.01265"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "12.65E-3"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400f104000000000000000000000000363000
-{"d":{"$numberDecimal":"0.01265"}}
-18000000136400f104000000000000000000000000363000
-18000000136400f104000000000000000000000000363000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-256.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-256.phpt
deleted file mode 100644
index 58c6da47..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-256.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx200] Numbers with E
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400F104000000000000000000000000423000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.265E+4"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "12.65E+3"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400f104000000000000000000000000423000
-{"d":{"$numberDecimal":"1.265E+4"}}
-18000000136400f104000000000000000000000000423000
-18000000136400f104000000000000000000000000423000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-257.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-257.phpt
deleted file mode 100644
index ebec09d3..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-257.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx193] Numbers with E
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400F104000000000000000000000000343000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "0.001265"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "12.65E-4"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400f104000000000000000000000000343000
-{"d":{"$numberDecimal":"0.001265"}}
-18000000136400f104000000000000000000000000343000
-18000000136400f104000000000000000000000000343000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-258.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-258.phpt
deleted file mode 100644
index 09c73b87..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-258.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx201] Numbers with E
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400F104000000000000000000000000443000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.265E+5"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "12.65E+4"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400f104000000000000000000000000443000
-{"d":{"$numberDecimal":"1.265E+5"}}
-18000000136400f104000000000000000000000000443000
-18000000136400f104000000000000000000000000443000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-259.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-259.phpt
deleted file mode 100644
index e1b875c6..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-259.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx192] Numbers with E
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400F1040000000000000000000000002C3000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.265E-7"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "12.65E-8"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400f1040000000000000000000000002c3000
-{"d":{"$numberDecimal":"1.265E-7"}}
-18000000136400f1040000000000000000000000002c3000
-18000000136400f1040000000000000000000000002c3000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-260.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-260.phpt
deleted file mode 100644
index 3e9daf0a..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-260.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx202] Numbers with E
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400F1040000000000000000000000004C3000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.265E+9"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "12.65E+8"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400f1040000000000000000000000004c3000
-{"d":{"$numberDecimal":"1.265E+9"}}
-18000000136400f1040000000000000000000000004c3000
-18000000136400f1040000000000000000000000004c3000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-261.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-261.phpt
deleted file mode 100644
index 8019eb57..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-261.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx044] strings without E cannot generate E in result
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400FC040000000000000000000000003C3000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "12.76"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "012.76"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400fc040000000000000000000000003c3000
-{"d":{"$numberDecimal":"12.76"}}
-18000000136400fc040000000000000000000000003c3000
-18000000136400fc040000000000000000000000003c3000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-262.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-262.phpt
deleted file mode 100644
index ea544f82..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-262.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [basx042] strings without E cannot generate E in result
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400FC040000000000000000000000003C3000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "12.76"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400fc040000000000000000000000003c3000
-{"d":{"$numberDecimal":"12.76"}}
-18000000136400fc040000000000000000000000003c3000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-263.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-263.phpt
deleted file mode 100644
index 56eb7791..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-263.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx046] strings without E cannot generate E in result
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364001100000000000000000000000000403000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "17"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "17."}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364001100000000000000000000000000403000
-{"d":{"$numberDecimal":"17"}}
-180000001364001100000000000000000000000000403000
-180000001364001100000000000000000000000000403000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-264.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-264.phpt
deleted file mode 100644
index ac4486a6..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-264.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx049] strings without E cannot generate E in result
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364002C00000000000000000000000000403000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "44"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "0044"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364002c00000000000000000000000000403000
-{"d":{"$numberDecimal":"44"}}
-180000001364002c00000000000000000000000000403000
-180000001364002c00000000000000000000000000403000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-265.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-265.phpt
deleted file mode 100644
index e5f5c4dc..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-265.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx048] strings without E cannot generate E in result
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364002C00000000000000000000000000403000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "44"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "044"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364002c00000000000000000000000000403000
-{"d":{"$numberDecimal":"44"}}
-180000001364002c00000000000000000000000000403000
-180000001364002c00000000000000000000000000403000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-266.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-266.phpt
deleted file mode 100644
index ddee736b..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-266.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx158] Numbers with E
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364002C00000000000000000000000000523000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "4.4E+10"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "44E+9"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364002c00000000000000000000000000523000
-{"d":{"$numberDecimal":"4.4E+10"}}
-180000001364002c00000000000000000000000000523000
-180000001364002c00000000000000000000000000523000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-267.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-267.phpt
deleted file mode 100644
index 10455e57..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-267.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx068] examples
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364003200000000000000000000000000323000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "0.0000050"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "50E-7"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364003200000000000000000000000000323000
-{"d":{"$numberDecimal":"0.0000050"}}
-180000001364003200000000000000000000000000323000
-180000001364003200000000000000000000000000323000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-268.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-268.phpt
deleted file mode 100644
index 49caa9e4..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-268.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx169] Numbers with E
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364006400000000000000000000000000523000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.00E+11"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "100e+009"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364006400000000000000000000000000523000
-{"d":{"$numberDecimal":"1.00E+11"}}
-180000001364006400000000000000000000000000523000
-180000001364006400000000000000000000000000523000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-269.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-269.phpt
deleted file mode 100644
index e268154c..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-269.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx167] Numbers with E
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364006400000000000000000000000000523000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.00E+11"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "100e+09"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364006400000000000000000000000000523000
-{"d":{"$numberDecimal":"1.00E+11"}}
-180000001364006400000000000000000000000000523000
-180000001364006400000000000000000000000000523000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-270.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-270.phpt
deleted file mode 100644
index 3c1c3c6a..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-270.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx168] Numbers with E
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364006400000000000000000000000000F43000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.00E+92"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "100E+90"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364006400000000000000000000000000f43000
-{"d":{"$numberDecimal":"1.00E+92"}}
-180000001364006400000000000000000000000000f43000
-180000001364006400000000000000000000000000f43000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-271.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-271.phpt
deleted file mode 100644
index 6e475be3..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-271.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx166] Numbers with E
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364006400000000000000000000000000523000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.00E+11"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "100e+9"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364006400000000000000000000000000523000
-{"d":{"$numberDecimal":"1.00E+11"}}
-180000001364006400000000000000000000000000523000
-180000001364006400000000000000000000000000523000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-272.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-272.phpt
deleted file mode 100644
index 89aa9223..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-272.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [basx210] Numbers with E
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400F1040000000000000000000000003E3000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "126.5"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400f1040000000000000000000000003e3000
-{"d":{"$numberDecimal":"126.5"}}
-18000000136400f1040000000000000000000000003e3000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-273.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-273.phpt
deleted file mode 100644
index ae5e452d..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-273.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx217] Numbers with E
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400F1040000000000000000000000003E3000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "126.5"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "126.5E-0"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400f1040000000000000000000000003e3000
-{"d":{"$numberDecimal":"126.5"}}
-18000000136400f1040000000000000000000000003e3000
-18000000136400f1040000000000000000000000003e3000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-274.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-274.phpt
deleted file mode 100644
index cf1bcb55..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-274.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx216] Numbers with E
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400F1040000000000000000000000003C3000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "12.65"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "126.5E-1"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400f1040000000000000000000000003c3000
-{"d":{"$numberDecimal":"12.65"}}
-18000000136400f1040000000000000000000000003c3000
-18000000136400f1040000000000000000000000003c3000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-275.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-275.phpt
deleted file mode 100644
index 2493ddc2..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-275.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx218] Numbers with E
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400F104000000000000000000000000403000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "1265"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "126.5E+1"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400f104000000000000000000000000403000
-{"d":{"$numberDecimal":"1265"}}
-18000000136400f104000000000000000000000000403000
-18000000136400f104000000000000000000000000403000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-276.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-276.phpt
deleted file mode 100644
index 490f7c74..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-276.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx211] Numbers with E
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400F104000000000000000000000000163000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.265E-18"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "126.5E-20"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400f104000000000000000000000000163000
-{"d":{"$numberDecimal":"1.265E-18"}}
-18000000136400f104000000000000000000000000163000
-18000000136400f104000000000000000000000000163000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-277.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-277.phpt
deleted file mode 100644
index 9bb8a8d2..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-277.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx223] Numbers with E
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400F104000000000000000000000000663000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.265E+22"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "126.5E+20"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400f104000000000000000000000000663000
-{"d":{"$numberDecimal":"1.265E+22"}}
-18000000136400f104000000000000000000000000663000
-18000000136400f104000000000000000000000000663000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-278.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-278.phpt
deleted file mode 100644
index 95b51b1e..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-278.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx215] Numbers with E
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400F1040000000000000000000000003A3000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.265"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "126.5E-2"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400f1040000000000000000000000003a3000
-{"d":{"$numberDecimal":"1.265"}}
-18000000136400f1040000000000000000000000003a3000
-18000000136400f1040000000000000000000000003a3000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-279.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-279.phpt
deleted file mode 100644
index 9ce609ae..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-279.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx219] Numbers with E
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400F104000000000000000000000000423000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.265E+4"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "126.5E+2"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400f104000000000000000000000000423000
-{"d":{"$numberDecimal":"1.265E+4"}}
-18000000136400f104000000000000000000000000423000
-18000000136400f104000000000000000000000000423000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-280.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-280.phpt
deleted file mode 100644
index e27155f8..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-280.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx214] Numbers with E
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400F104000000000000000000000000383000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "0.1265"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "126.5E-3"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400f104000000000000000000000000383000
-{"d":{"$numberDecimal":"0.1265"}}
-18000000136400f104000000000000000000000000383000
-18000000136400f104000000000000000000000000383000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-281.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-281.phpt
deleted file mode 100644
index 37f46808..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-281.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx220] Numbers with E
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400F104000000000000000000000000443000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.265E+5"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "126.5E+3"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400f104000000000000000000000000443000
-{"d":{"$numberDecimal":"1.265E+5"}}
-18000000136400f104000000000000000000000000443000
-18000000136400f104000000000000000000000000443000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-282.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-282.phpt
deleted file mode 100644
index 1b83ad72..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-282.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx213] Numbers with E
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400F104000000000000000000000000363000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "0.01265"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "126.5E-4"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400f104000000000000000000000000363000
-{"d":{"$numberDecimal":"0.01265"}}
-18000000136400f104000000000000000000000000363000
-18000000136400f104000000000000000000000000363000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-283.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-283.phpt
deleted file mode 100644
index d70d0638..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-283.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx221] Numbers with E
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400F104000000000000000000000000463000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.265E+6"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "126.5E+4"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400f104000000000000000000000000463000
-{"d":{"$numberDecimal":"1.265E+6"}}
-18000000136400f104000000000000000000000000463000
-18000000136400f104000000000000000000000000463000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-284.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-284.phpt
deleted file mode 100644
index 2ba7cec5..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-284.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx212] Numbers with E
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400F1040000000000000000000000002E3000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "0.000001265"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "126.5E-8"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400f1040000000000000000000000002e3000
-{"d":{"$numberDecimal":"0.000001265"}}
-18000000136400f1040000000000000000000000002e3000
-18000000136400f1040000000000000000000000002e3000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-285.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-285.phpt
deleted file mode 100644
index b8848940..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-285.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx222] Numbers with E
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400F1040000000000000000000000004E3000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.265E+10"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "126.5E+8"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400f1040000000000000000000000004e3000
-{"d":{"$numberDecimal":"1.265E+10"}}
-18000000136400f1040000000000000000000000004e3000
-18000000136400f1040000000000000000000000004e3000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-286.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-286.phpt
deleted file mode 100644
index f19ff565..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-286.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [basx006] conform to rules and exponent will be in permitted range).
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400E803000000000000000000000000403000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "1000"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400e803000000000000000000000000403000
-{"d":{"$numberDecimal":"1000"}}
-18000000136400e803000000000000000000000000403000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-287.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-287.phpt
deleted file mode 100644
index 1ac2e01f..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-287.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [basx230] Numbers with E
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400F104000000000000000000000000403000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "1265"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400f104000000000000000000000000403000
-{"d":{"$numberDecimal":"1265"}}
-18000000136400f104000000000000000000000000403000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-288.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-288.phpt
deleted file mode 100644
index da08e78f..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-288.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx237] Numbers with E
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400F104000000000000000000000000403000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "1265"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "1265E-0"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400f104000000000000000000000000403000
-{"d":{"$numberDecimal":"1265"}}
-18000000136400f104000000000000000000000000403000
-18000000136400f104000000000000000000000000403000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-289.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-289.phpt
deleted file mode 100644
index 889a5250..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-289.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx236] Numbers with E
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400F1040000000000000000000000003E3000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "126.5"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "1265E-1"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400f1040000000000000000000000003e3000
-{"d":{"$numberDecimal":"126.5"}}
-18000000136400f1040000000000000000000000003e3000
-18000000136400f1040000000000000000000000003e3000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-290.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-290.phpt
deleted file mode 100644
index 72881205..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-290.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx238] Numbers with E
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400F104000000000000000000000000423000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.265E+4"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "1265E+1"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400f104000000000000000000000000423000
-{"d":{"$numberDecimal":"1.265E+4"}}
-18000000136400f104000000000000000000000000423000
-18000000136400f104000000000000000000000000423000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-291.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-291.phpt
deleted file mode 100644
index 86e83d1f..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-291.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx231] Numbers with E
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400F104000000000000000000000000183000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.265E-17"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "1265E-20"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400f104000000000000000000000000183000
-{"d":{"$numberDecimal":"1.265E-17"}}
-18000000136400f104000000000000000000000000183000
-18000000136400f104000000000000000000000000183000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-292.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-292.phpt
deleted file mode 100644
index eaae6d76..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-292.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx243] Numbers with E
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400F104000000000000000000000000683000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.265E+23"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "1265E+20"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400f104000000000000000000000000683000
-{"d":{"$numberDecimal":"1.265E+23"}}
-18000000136400f104000000000000000000000000683000
-18000000136400f104000000000000000000000000683000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-293.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-293.phpt
deleted file mode 100644
index e7d64030..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-293.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx235] Numbers with E
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400F1040000000000000000000000003C3000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "12.65"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "1265E-2"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400f1040000000000000000000000003c3000
-{"d":{"$numberDecimal":"12.65"}}
-18000000136400f1040000000000000000000000003c3000
-18000000136400f1040000000000000000000000003c3000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-294.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-294.phpt
deleted file mode 100644
index 5e6eecb6..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-294.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx239] Numbers with E
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400F104000000000000000000000000443000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.265E+5"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "1265E+2"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400f104000000000000000000000000443000
-{"d":{"$numberDecimal":"1.265E+5"}}
-18000000136400f104000000000000000000000000443000
-18000000136400f104000000000000000000000000443000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-295.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-295.phpt
deleted file mode 100644
index 9b92f2f9..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-295.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx234] Numbers with E
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400F1040000000000000000000000003A3000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.265"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "1265E-3"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400f1040000000000000000000000003a3000
-{"d":{"$numberDecimal":"1.265"}}
-18000000136400f1040000000000000000000000003a3000
-18000000136400f1040000000000000000000000003a3000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-296.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-296.phpt
deleted file mode 100644
index ae3d5d0d..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-296.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx240] Numbers with E
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400F104000000000000000000000000463000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.265E+6"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "1265E+3"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400f104000000000000000000000000463000
-{"d":{"$numberDecimal":"1.265E+6"}}
-18000000136400f104000000000000000000000000463000
-18000000136400f104000000000000000000000000463000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-297.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-297.phpt
deleted file mode 100644
index c64c8a16..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-297.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx233] Numbers with E
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400F104000000000000000000000000383000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "0.1265"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "1265E-4"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400f104000000000000000000000000383000
-{"d":{"$numberDecimal":"0.1265"}}
-18000000136400f104000000000000000000000000383000
-18000000136400f104000000000000000000000000383000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-298.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-298.phpt
deleted file mode 100644
index 1996c2a1..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-298.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx241] Numbers with E
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400F104000000000000000000000000483000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.265E+7"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "1265E+4"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400f104000000000000000000000000483000
-{"d":{"$numberDecimal":"1.265E+7"}}
-18000000136400f104000000000000000000000000483000
-18000000136400f104000000000000000000000000483000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-299.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-299.phpt
deleted file mode 100644
index eb35f628..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-299.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx232] Numbers with E
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400F104000000000000000000000000303000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "0.00001265"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "1265E-8"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400f104000000000000000000000000303000
-{"d":{"$numberDecimal":"0.00001265"}}
-18000000136400f104000000000000000000000000303000
-18000000136400f104000000000000000000000000303000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-300.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-300.phpt
deleted file mode 100644
index 27e70240..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-300.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx242] Numbers with E
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400F104000000000000000000000000503000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.265E+11"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "1265E+8"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400f104000000000000000000000000503000
-{"d":{"$numberDecimal":"1.265E+11"}}
-18000000136400f104000000000000000000000000503000
-18000000136400f104000000000000000000000000503000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-301.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-301.phpt
deleted file mode 100644
index de3da8f2..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-301.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [basx060] strings without E cannot generate E in result
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400185C0ACE00000000000000000000383000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "345678.5432"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400185c0ace00000000000000000000383000
-{"d":{"$numberDecimal":"345678.5432"}}
-18000000136400185c0ace00000000000000000000383000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-302.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-302.phpt
deleted file mode 100644
index 93439a7b..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-302.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx059] strings without E cannot generate E in result
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400F198670C08000000000000000000363000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "345678.54321"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "0345678.54321"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400f198670c08000000000000000000363000
-{"d":{"$numberDecimal":"345678.54321"}}
-18000000136400f198670c08000000000000000000363000
-18000000136400f198670c08000000000000000000363000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-303.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-303.phpt
deleted file mode 100644
index 4b3e51c1..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-303.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [basx058] strings without E cannot generate E in result
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364006AF90B7C50000000000000000000343000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "345678.543210"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364006af90b7c50000000000000000000343000
-{"d":{"$numberDecimal":"345678.543210"}}
-180000001364006af90b7c50000000000000000000343000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-304.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-304.phpt
deleted file mode 100644
index 118715db..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-304.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [basx057] strings without E cannot generate E in result
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364006A19562522020000000000000000343000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "2345678.543210"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364006a19562522020000000000000000343000
-{"d":{"$numberDecimal":"2345678.543210"}}
-180000001364006a19562522020000000000000000343000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-305.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-305.phpt
deleted file mode 100644
index 362b5580..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-305.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [basx056] strings without E cannot generate E in result
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364006AB9C8733A0B0000000000000000343000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "12345678.543210"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364006ab9c8733a0b0000000000000000343000
-{"d":{"$numberDecimal":"12345678.543210"}}
-180000001364006ab9c8733a0b0000000000000000343000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-306.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-306.phpt
deleted file mode 100644
index 5247bb67..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-306.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [basx031] conform to rules and exponent will be in permitted range).
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('1800000013640040AF0D8648700000000000000000343000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "123456789.000000"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-1800000013640040af0d8648700000000000000000343000
-{"d":{"$numberDecimal":"123456789.000000"}}
-1800000013640040af0d8648700000000000000000343000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-307.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-307.phpt
deleted file mode 100644
index d2f38af6..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-307.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [basx030] conform to rules and exponent will be in permitted range).
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('1800000013640080910F8648700000000000000000343000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "123456789.123456"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-1800000013640080910f8648700000000000000000343000
-{"d":{"$numberDecimal":"123456789.123456"}}
-1800000013640080910f8648700000000000000000343000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-308.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-308.phpt
deleted file mode 100644
index 219ce738..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-3-valid-308.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [basx032] conform to rules and exponent will be in permitted range).
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('1800000013640080910F8648700000000000000000403000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "123456789123456"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-1800000013640080910f8648700000000000000000403000
-{"d":{"$numberDecimal":"123456789123456"}}
-1800000013640080910f8648700000000000000000403000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-4-valid-001.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-4-valid-001.phpt
deleted file mode 100644
index 822358af..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-4-valid-001.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [basx023] conform to rules and exponent will be in permitted range).
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('1800000013640001000000000000000000000000003EB000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "-0.1"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-1800000013640001000000000000000000000000003eb000
-{"d":{"$numberDecimal":"-0.1"}}
-1800000013640001000000000000000000000000003eb000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-4-valid-002.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-4-valid-002.phpt
deleted file mode 100644
index e75fc8ad..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-4-valid-002.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx045] strings without E cannot generate E in result
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('1800000013640003000000000000000000000000003A3000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "0.003"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "+0.003"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-1800000013640003000000000000000000000000003a3000
-{"d":{"$numberDecimal":"0.003"}}
-1800000013640003000000000000000000000000003a3000
-1800000013640003000000000000000000000000003a3000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-4-valid-003.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-4-valid-003.phpt
deleted file mode 100644
index 8f0ea3b3..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-4-valid-003.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx610] Zeros
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('1800000013640000000000000000000000000000003E3000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "0.0"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : ".0"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-1800000013640000000000000000000000000000003e3000
-{"d":{"$numberDecimal":"0.0"}}
-1800000013640000000000000000000000000000003e3000
-1800000013640000000000000000000000000000003e3000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-4-valid-004.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-4-valid-004.phpt
deleted file mode 100644
index 59715d47..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-4-valid-004.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx612] Zeros
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('1800000013640000000000000000000000000000003EB000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "-0.0"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "-.0"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-1800000013640000000000000000000000000000003eb000
-{"d":{"$numberDecimal":"-0.0"}}
-1800000013640000000000000000000000000000003eb000
-1800000013640000000000000000000000000000003eb000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-4-valid-005.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-4-valid-005.phpt
deleted file mode 100644
index 1505f0fc..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-4-valid-005.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx043] strings without E cannot generate E in result
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400FC040000000000000000000000003C3000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "12.76"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "+12.76"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400fc040000000000000000000000003c3000
-{"d":{"$numberDecimal":"12.76"}}
-18000000136400fc040000000000000000000000003c3000
-18000000136400fc040000000000000000000000003c3000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-4-valid-006.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-4-valid-006.phpt
deleted file mode 100644
index 80054c55..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-4-valid-006.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx055] strings without E cannot generate E in result
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000500000000000000000000000000303000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "5E-8"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "0.00000005"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000500000000000000000000000000303000
-{"d":{"$numberDecimal":"5E-8"}}
-180000001364000500000000000000000000000000303000
-180000001364000500000000000000000000000000303000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-4-valid-007.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-4-valid-007.phpt
deleted file mode 100644
index f27f1bf0..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-4-valid-007.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx054] strings without E cannot generate E in result
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000500000000000000000000000000323000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "5E-7"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "0.0000005"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000500000000000000000000000000323000
-{"d":{"$numberDecimal":"5E-7"}}
-180000001364000500000000000000000000000000323000
-180000001364000500000000000000000000000000323000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-4-valid-008.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-4-valid-008.phpt
deleted file mode 100644
index 366ed7dd..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-4-valid-008.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [basx052] strings without E cannot generate E in result
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000500000000000000000000000000343000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "0.000005"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000500000000000000000000000000343000
-{"d":{"$numberDecimal":"0.000005"}}
-180000001364000500000000000000000000000000343000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-4-valid-009.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-4-valid-009.phpt
deleted file mode 100644
index a1c50c72..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-4-valid-009.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx051] strings without E cannot generate E in result
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000500000000000000000000000000363000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "0.00005"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "00.00005"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000500000000000000000000000000363000
-{"d":{"$numberDecimal":"0.00005"}}
-180000001364000500000000000000000000000000363000
-180000001364000500000000000000000000000000363000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-4-valid-010.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-4-valid-010.phpt
deleted file mode 100644
index 1ca2b0b0..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-4-valid-010.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [basx050] strings without E cannot generate E in result
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000500000000000000000000000000383000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "0.0005"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000500000000000000000000000000383000
-{"d":{"$numberDecimal":"0.0005"}}
-180000001364000500000000000000000000000000383000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-4-valid-011.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-4-valid-011.phpt
deleted file mode 100644
index 6769d43b..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-4-valid-011.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [basx047] strings without E cannot generate E in result
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('1800000013640005000000000000000000000000003E3000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "0.5"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : ".5"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-1800000013640005000000000000000000000000003e3000
-{"d":{"$numberDecimal":"0.5"}}
-1800000013640005000000000000000000000000003e3000
-1800000013640005000000000000000000000000003e3000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-4-valid-012.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-4-valid-012.phpt
deleted file mode 100644
index 2c1757ec..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-4-valid-012.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [dqbsr431] check rounding modes heeded (Rounded)
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('1800000013640099761CC7B548F377DC80A131C836FE2F00');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.111111111111111111111111111112345"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "1.1111111111111111111111111111123450"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-1800000013640099761cc7b548f377dc80a131c836fe2f00
-{"d":{"$numberDecimal":"1.111111111111111111111111111112345"}}
-1800000013640099761cc7b548f377dc80a131c836fe2f00
-1800000013640099761cc7b548f377dc80a131c836fe2f00
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-4-valid-013.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-4-valid-013.phpt
deleted file mode 100644
index bc584aec..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-4-valid-013.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: OK2
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400000000000A5BC138938D44C64D31FC2F00');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "0.1000000000000000000000000000000000"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : ".100000000000000000000000000000000000000000000000000000000000"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400000000000a5bc138938d44c64d31fc2f00
-{"d":{"$numberDecimal":"0.1000000000000000000000000000000000"}}
-18000000136400000000000a5bc138938d44c64d31fc2f00
-18000000136400000000000a5bc138938d44c64d31fc2f00
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-001.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-001.phpt
deleted file mode 100644
index 80541ba3..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-001.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [decq035] fold-downs (more below) (Clamped)
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400000000807F1BCF85B27059C8A43CFE5F00');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.230000000000000000000000000000000E+6144"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "1.23E+6144"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400000000807f1bcf85b27059c8a43cfe5f00
-{"d":{"$numberDecimal":"1.230000000000000000000000000000000E+6144"}}
-18000000136400000000807f1bcf85b27059c8a43cfe5f00
-18000000136400000000807f1bcf85b27059c8a43cfe5f00
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-002.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-002.phpt
deleted file mode 100644
index 13acb8d9..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-002.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [decq037] fold-downs (more below) (Clamped)
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400000000000A5BC138938D44C64D31FE5F00');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.000000000000000000000000000000000E+6144"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "1E+6144"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400000000000a5bc138938d44c64d31fe5f00
-{"d":{"$numberDecimal":"1.000000000000000000000000000000000E+6144"}}
-18000000136400000000000a5bc138938d44c64d31fe5f00
-18000000136400000000000a5bc138938d44c64d31fe5f00
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-003.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-003.phpt
deleted file mode 100644
index 18f99105..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-003.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [decq077] Nmin and below (Subnormal)
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000000000081EFAC855B416D2DEE04000000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.00000000000000000000000000000000E-6144"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "0.100000000000000000000000000000000E-6143"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000000000081efac855b416d2dee04000000
-{"d":{"$numberDecimal":"1.00000000000000000000000000000000E-6144"}}
-180000001364000000000081efac855b416d2dee04000000
-180000001364000000000081efac855b416d2dee04000000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-004.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-004.phpt
deleted file mode 100644
index 4fe39c3b..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-004.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [decq078] Nmin and below (Subnormal)
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000000000081EFAC855B416D2DEE04000000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.00000000000000000000000000000000E-6144"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000000000081efac855b416d2dee04000000
-{"d":{"$numberDecimal":"1.00000000000000000000000000000000E-6144"}}
-180000001364000000000081efac855b416d2dee04000000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-005.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-005.phpt
deleted file mode 100644
index 25b552e4..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-005.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [decq079] Nmin and below (Subnormal)
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000A00000000000000000000000000000000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.0E-6175"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "0.000000000000000000000000000000010E-6143"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000a00000000000000000000000000000000
-{"d":{"$numberDecimal":"1.0E-6175"}}
-180000001364000a00000000000000000000000000000000
-180000001364000a00000000000000000000000000000000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-006.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-006.phpt
deleted file mode 100644
index bd057a7e..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-006.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [decq080] Nmin and below (Subnormal)
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000A00000000000000000000000000000000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.0E-6175"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000a00000000000000000000000000000000
-{"d":{"$numberDecimal":"1.0E-6175"}}
-180000001364000a00000000000000000000000000000000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-007.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-007.phpt
deleted file mode 100644
index 6bb773d6..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-007.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [decq081] Nmin and below (Subnormal)
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000100000000000000000000000000020000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "1E-6175"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "0.00000000000000000000000000000001E-6143"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000100000000000000000000000000020000
-{"d":{"$numberDecimal":"1E-6175"}}
-180000001364000100000000000000000000000000020000
-180000001364000100000000000000000000000000020000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-008.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-008.phpt
deleted file mode 100644
index dc59078e..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-008.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [decq082] Nmin and below (Subnormal)
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000100000000000000000000000000020000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "1E-6175"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000100000000000000000000000000020000
-{"d":{"$numberDecimal":"1E-6175"}}
-180000001364000100000000000000000000000000020000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-009.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-009.phpt
deleted file mode 100644
index 31cb979b..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-009.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [decq083] Nmin and below (Subnormal)
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000100000000000000000000000000000000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "1E-6176"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "0.000000000000000000000000000000001E-6143"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000100000000000000000000000000000000
-{"d":{"$numberDecimal":"1E-6176"}}
-180000001364000100000000000000000000000000000000
-180000001364000100000000000000000000000000000000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-010.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-010.phpt
deleted file mode 100644
index 5dec4fcd..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-010.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [decq084] Nmin and below (Subnormal)
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000100000000000000000000000000000000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "1E-6176"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000100000000000000000000000000000000
-{"d":{"$numberDecimal":"1E-6176"}}
-180000001364000100000000000000000000000000000000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-011.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-011.phpt
deleted file mode 100644
index b590bff2..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-011.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [decq090] underflows cannot be tested for simple copies, check edge cases (Subnormal)
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000100000000000000000000000000000000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "1E-6176"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "1e-6176"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000100000000000000000000000000000000
-{"d":{"$numberDecimal":"1E-6176"}}
-180000001364000100000000000000000000000000000000
-180000001364000100000000000000000000000000000000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-012.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-012.phpt
deleted file mode 100644
index 9bc18501..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-012.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [decq100] underflows cannot be tested for simple copies, check edge cases (Subnormal)
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400FFFFFFFF095BC138938D44C64D31000000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "9.99999999999999999999999999999999E-6144"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "999999999999999999999999999999999e-6176"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400ffffffff095bc138938d44c64d31000000
-{"d":{"$numberDecimal":"9.99999999999999999999999999999999E-6144"}}
-18000000136400ffffffff095bc138938d44c64d31000000
-18000000136400ffffffff095bc138938d44c64d31000000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-013.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-013.phpt
deleted file mode 100644
index f6c2ee21..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-013.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [decq130] fold-downs (more below) (Clamped)
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400000000807F1BCF85B27059C8A43CFEDF00');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "-1.230000000000000000000000000000000E+6144"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "-1.23E+6144"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400000000807f1bcf85b27059c8a43cfedf00
-{"d":{"$numberDecimal":"-1.230000000000000000000000000000000E+6144"}}
-18000000136400000000807f1bcf85b27059c8a43cfedf00
-18000000136400000000807f1bcf85b27059c8a43cfedf00
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-014.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-014.phpt
deleted file mode 100644
index 0804762b..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-014.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [decq132] fold-downs (more below) (Clamped)
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400000000000A5BC138938D44C64D31FEDF00');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "-1.000000000000000000000000000000000E+6144"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "-1E+6144"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400000000000a5bc138938d44c64d31fedf00
-{"d":{"$numberDecimal":"-1.000000000000000000000000000000000E+6144"}}
-18000000136400000000000a5bc138938d44c64d31fedf00
-18000000136400000000000a5bc138938d44c64d31fedf00
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-015.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-015.phpt
deleted file mode 100644
index 44cdd2db..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-015.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [decq177] Nmin and below (Subnormal)
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000000000081EFAC855B416D2DEE04008000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "-1.00000000000000000000000000000000E-6144"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "-0.100000000000000000000000000000000E-6143"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000000000081efac855b416d2dee04008000
-{"d":{"$numberDecimal":"-1.00000000000000000000000000000000E-6144"}}
-180000001364000000000081efac855b416d2dee04008000
-180000001364000000000081efac855b416d2dee04008000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-016.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-016.phpt
deleted file mode 100644
index 7838bb82..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-016.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [decq178] Nmin and below (Subnormal)
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000000000081EFAC855B416D2DEE04008000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "-1.00000000000000000000000000000000E-6144"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000000000081efac855b416d2dee04008000
-{"d":{"$numberDecimal":"-1.00000000000000000000000000000000E-6144"}}
-180000001364000000000081efac855b416d2dee04008000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-017.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-017.phpt
deleted file mode 100644
index 66a70e82..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-017.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [decq179] Nmin and below (Subnormal)
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000A00000000000000000000000000008000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "-1.0E-6175"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "-0.000000000000000000000000000000010E-6143"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000a00000000000000000000000000008000
-{"d":{"$numberDecimal":"-1.0E-6175"}}
-180000001364000a00000000000000000000000000008000
-180000001364000a00000000000000000000000000008000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-018.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-018.phpt
deleted file mode 100644
index c124d7cc..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-018.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [decq180] Nmin and below (Subnormal)
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000A00000000000000000000000000008000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "-1.0E-6175"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000a00000000000000000000000000008000
-{"d":{"$numberDecimal":"-1.0E-6175"}}
-180000001364000a00000000000000000000000000008000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-019.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-019.phpt
deleted file mode 100644
index 06cc0eee..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-019.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [decq181] Nmin and below (Subnormal)
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000100000000000000000000000000028000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "-1E-6175"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "-0.00000000000000000000000000000001E-6143"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000100000000000000000000000000028000
-{"d":{"$numberDecimal":"-1E-6175"}}
-180000001364000100000000000000000000000000028000
-180000001364000100000000000000000000000000028000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-020.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-020.phpt
deleted file mode 100644
index c12a601c..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-020.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [decq182] Nmin and below (Subnormal)
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000100000000000000000000000000028000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "-1E-6175"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000100000000000000000000000000028000
-{"d":{"$numberDecimal":"-1E-6175"}}
-180000001364000100000000000000000000000000028000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-021.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-021.phpt
deleted file mode 100644
index 58aac4d6..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-021.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [decq183] Nmin and below (Subnormal)
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000100000000000000000000000000008000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "-1E-6176"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "-0.000000000000000000000000000000001E-6143"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000100000000000000000000000000008000
-{"d":{"$numberDecimal":"-1E-6176"}}
-180000001364000100000000000000000000000000008000
-180000001364000100000000000000000000000000008000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-022.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-022.phpt
deleted file mode 100644
index 1748cb87..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-022.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Decimal128: [decq184] Nmin and below (Subnormal)
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000100000000000000000000000000008000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "-1E-6176"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000100000000000000000000000000008000
-{"d":{"$numberDecimal":"-1E-6176"}}
-180000001364000100000000000000000000000000008000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-023.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-023.phpt
deleted file mode 100644
index 734e45b8..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-023.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [decq190] underflow edge cases (Subnormal)
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000100000000000000000000000000008000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "-1E-6176"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "-1e-6176"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000100000000000000000000000000008000
-{"d":{"$numberDecimal":"-1E-6176"}}
-180000001364000100000000000000000000000000008000
-180000001364000100000000000000000000000000008000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-024.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-024.phpt
deleted file mode 100644
index 1f43be0a..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-024.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [decq200] underflow edge cases (Subnormal)
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400FFFFFFFF095BC138938D44C64D31008000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "-9.99999999999999999999999999999999E-6144"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "-999999999999999999999999999999999e-6176"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400ffffffff095bc138938d44c64d31008000
-{"d":{"$numberDecimal":"-9.99999999999999999999999999999999E-6144"}}
-18000000136400ffffffff095bc138938d44c64d31008000
-18000000136400ffffffff095bc138938d44c64d31008000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-025.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-025.phpt
deleted file mode 100644
index 59c0bbcb..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-025.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [decq400] zeros (Clamped)
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000000000000000000000000000000000000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "0E-6176"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "0E-8000"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000000000000000000000000000000000000
-{"d":{"$numberDecimal":"0E-6176"}}
-180000001364000000000000000000000000000000000000
-180000001364000000000000000000000000000000000000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-026.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-026.phpt
deleted file mode 100644
index 7080b20e..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-026.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [decq401] zeros (Clamped)
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000000000000000000000000000000000000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "0E-6176"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "0E-6177"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000000000000000000000000000000000000
-{"d":{"$numberDecimal":"0E-6176"}}
-180000001364000000000000000000000000000000000000
-180000001364000000000000000000000000000000000000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-027.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-027.phpt
deleted file mode 100644
index 21bb8f0f..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-027.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [decq414] clamped zeros... (Clamped)
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000000000000000000000000000000FE5F00');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "0E+6111"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "0E+6112"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000000000000000000000000000000fe5f00
-{"d":{"$numberDecimal":"0E+6111"}}
-180000001364000000000000000000000000000000fe5f00
-180000001364000000000000000000000000000000fe5f00
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-028.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-028.phpt
deleted file mode 100644
index 2a2a5107..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-028.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [decq416] clamped zeros... (Clamped)
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000000000000000000000000000000FE5F00');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "0E+6111"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "0E+6144"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000000000000000000000000000000fe5f00
-{"d":{"$numberDecimal":"0E+6111"}}
-180000001364000000000000000000000000000000fe5f00
-180000001364000000000000000000000000000000fe5f00
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-029.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-029.phpt
deleted file mode 100644
index 1c18cef5..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-029.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [decq418] clamped zeros... (Clamped)
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000000000000000000000000000000FE5F00');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "0E+6111"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "0E+8000"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000000000000000000000000000000fe5f00
-{"d":{"$numberDecimal":"0E+6111"}}
-180000001364000000000000000000000000000000fe5f00
-180000001364000000000000000000000000000000fe5f00
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-030.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-030.phpt
deleted file mode 100644
index eee7613c..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-030.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [decq420] negative zeros (Clamped)
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000000000000000000000000000000008000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "-0E-6176"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "-0E-8000"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000000000000000000000000000000008000
-{"d":{"$numberDecimal":"-0E-6176"}}
-180000001364000000000000000000000000000000008000
-180000001364000000000000000000000000000000008000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-031.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-031.phpt
deleted file mode 100644
index 392d017e..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-031.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [decq421] negative zeros (Clamped)
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000000000000000000000000000000008000');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "-0E-6176"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "-0E-6177"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000000000000000000000000000000008000
-{"d":{"$numberDecimal":"-0E-6176"}}
-180000001364000000000000000000000000000000008000
-180000001364000000000000000000000000000000008000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-032.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-032.phpt
deleted file mode 100644
index d82fac3c..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-032.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [decq434] clamped zeros... (Clamped)
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000000000000000000000000000000FEDF00');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "-0E+6111"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "-0E+6112"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000000000000000000000000000000fedf00
-{"d":{"$numberDecimal":"-0E+6111"}}
-180000001364000000000000000000000000000000fedf00
-180000001364000000000000000000000000000000fedf00
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-033.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-033.phpt
deleted file mode 100644
index 0826c69d..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-033.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [decq436] clamped zeros... (Clamped)
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000000000000000000000000000000FEDF00');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "-0E+6111"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "-0E+6144"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000000000000000000000000000000fedf00
-{"d":{"$numberDecimal":"-0E+6111"}}
-180000001364000000000000000000000000000000fedf00
-180000001364000000000000000000000000000000fedf00
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-034.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-034.phpt
deleted file mode 100644
index f1d75002..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-034.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [decq438] clamped zeros... (Clamped)
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000000000000000000000000000000FEDF00');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "-0E+6111"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "-0E+8000"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000000000000000000000000000000fedf00
-{"d":{"$numberDecimal":"-0E+6111"}}
-180000001364000000000000000000000000000000fedf00
-180000001364000000000000000000000000000000fedf00
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-035.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-035.phpt
deleted file mode 100644
index 0683d051..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-035.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [decq601] fold-down full sequence (Clamped)
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400000000000A5BC138938D44C64D31FE5F00');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.000000000000000000000000000000000E+6144"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "1E+6144"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400000000000a5bc138938d44c64d31fe5f00
-{"d":{"$numberDecimal":"1.000000000000000000000000000000000E+6144"}}
-18000000136400000000000a5bc138938d44c64d31fe5f00
-18000000136400000000000a5bc138938d44c64d31fe5f00
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-036.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-036.phpt
deleted file mode 100644
index d19e57ee..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-036.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [decq603] fold-down full sequence (Clamped)
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000000000081EFAC855B416D2DEE04FE5F00');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.00000000000000000000000000000000E+6143"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "1E+6143"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000000000081efac855b416d2dee04fe5f00
-{"d":{"$numberDecimal":"1.00000000000000000000000000000000E+6143"}}
-180000001364000000000081efac855b416d2dee04fe5f00
-180000001364000000000081efac855b416d2dee04fe5f00
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-037.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-037.phpt
deleted file mode 100644
index db92ee1a..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-037.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [decq605] fold-down full sequence (Clamped)
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('1800000013640000000080264B91C02220BE377E00FE5F00');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.0000000000000000000000000000000E+6142"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "1E+6142"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-1800000013640000000080264b91c02220be377e00fe5f00
-{"d":{"$numberDecimal":"1.0000000000000000000000000000000E+6142"}}
-1800000013640000000080264b91c02220be377e00fe5f00
-1800000013640000000080264b91c02220be377e00fe5f00
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-038.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-038.phpt
deleted file mode 100644
index 4b84e848..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-038.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [decq607] fold-down full sequence (Clamped)
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('1800000013640000000040EAED7446D09C2C9F0C00FE5F00');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.000000000000000000000000000000E+6141"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "1E+6141"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-1800000013640000000040eaed7446d09c2c9f0c00fe5f00
-{"d":{"$numberDecimal":"1.000000000000000000000000000000E+6141"}}
-1800000013640000000040eaed7446d09c2c9f0c00fe5f00
-1800000013640000000040eaed7446d09c2c9f0c00fe5f00
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-039.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-039.phpt
deleted file mode 100644
index 1350e1ad..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-039.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [decq609] fold-down full sequence (Clamped)
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400000000A0CA17726DAE0F1E430100FE5F00');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.00000000000000000000000000000E+6140"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "1E+6140"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400000000a0ca17726dae0f1e430100fe5f00
-{"d":{"$numberDecimal":"1.00000000000000000000000000000E+6140"}}
-18000000136400000000a0ca17726dae0f1e430100fe5f00
-18000000136400000000a0ca17726dae0f1e430100fe5f00
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-040.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-040.phpt
deleted file mode 100644
index a8c680f9..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-040.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [decq611] fold-down full sequence (Clamped)
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400000000106102253E5ECE4F200000FE5F00');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.0000000000000000000000000000E+6139"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "1E+6139"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400000000106102253e5ece4f200000fe5f00
-{"d":{"$numberDecimal":"1.0000000000000000000000000000E+6139"}}
-18000000136400000000106102253e5ece4f200000fe5f00
-18000000136400000000106102253e5ece4f200000fe5f00
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-041.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-041.phpt
deleted file mode 100644
index 4530efd8..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-041.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [decq613] fold-down full sequence (Clamped)
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400000000E83C80D09F3C2E3B030000FE5F00');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.000000000000000000000000000E+6138"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "1E+6138"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400000000e83c80d09f3c2e3b030000fe5f00
-{"d":{"$numberDecimal":"1.000000000000000000000000000E+6138"}}
-18000000136400000000e83c80d09f3c2e3b030000fe5f00
-18000000136400000000e83c80d09f3c2e3b030000fe5f00
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-042.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-042.phpt
deleted file mode 100644
index 30208204..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-042.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [decq615] fold-down full sequence (Clamped)
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400000000E4D20CC8DCD2B752000000FE5F00');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.00000000000000000000000000E+6137"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "1E+6137"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400000000e4d20cc8dcd2b752000000fe5f00
-{"d":{"$numberDecimal":"1.00000000000000000000000000E+6137"}}
-18000000136400000000e4d20cc8dcd2b752000000fe5f00
-18000000136400000000e4d20cc8dcd2b752000000fe5f00
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-043.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-043.phpt
deleted file mode 100644
index fa428394..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-043.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [decq617] fold-down full sequence (Clamped)
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000000004A48011416954508000000FE5F00');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.0000000000000000000000000E+6136"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "1E+6136"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000000004a48011416954508000000fe5f00
-{"d":{"$numberDecimal":"1.0000000000000000000000000E+6136"}}
-180000001364000000004a48011416954508000000fe5f00
-180000001364000000004a48011416954508000000fe5f00
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-044.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-044.phpt
deleted file mode 100644
index 76801a83..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-044.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [decq619] fold-down full sequence (Clamped)
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400000000A1EDCCCE1BC2D300000000FE5F00');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.000000000000000000000000E+6135"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "1E+6135"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400000000a1edccce1bc2d300000000fe5f00
-{"d":{"$numberDecimal":"1.000000000000000000000000E+6135"}}
-18000000136400000000a1edccce1bc2d300000000fe5f00
-18000000136400000000a1edccce1bc2d300000000fe5f00
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-045.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-045.phpt
deleted file mode 100644
index d999535e..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-045.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [decq621] fold-down full sequence (Clamped)
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400000080F64AE1C7022D1500000000FE5F00');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.00000000000000000000000E+6134"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "1E+6134"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400000080f64ae1c7022d1500000000fe5f00
-{"d":{"$numberDecimal":"1.00000000000000000000000E+6134"}}
-18000000136400000080f64ae1c7022d1500000000fe5f00
-18000000136400000080f64ae1c7022d1500000000fe5f00
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-046.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-046.phpt
deleted file mode 100644
index cc071366..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-046.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [decq623] fold-down full sequence (Clamped)
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400000040B2BAC9E0191E0200000000FE5F00');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.0000000000000000000000E+6133"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "1E+6133"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400000040b2bac9e0191e0200000000fe5f00
-{"d":{"$numberDecimal":"1.0000000000000000000000E+6133"}}
-18000000136400000040b2bac9e0191e0200000000fe5f00
-18000000136400000040b2bac9e0191e0200000000fe5f00
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-047.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-047.phpt
deleted file mode 100644
index 2c9871d4..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-047.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [decq625] fold-down full sequence (Clamped)
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000000A0DEC5ADC935360000000000FE5F00');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.000000000000000000000E+6132"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "1E+6132"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000000a0dec5adc935360000000000fe5f00
-{"d":{"$numberDecimal":"1.000000000000000000000E+6132"}}
-180000001364000000a0dec5adc935360000000000fe5f00
-180000001364000000a0dec5adc935360000000000fe5f00
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-048.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-048.phpt
deleted file mode 100644
index f56b2b16..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-048.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [decq627] fold-down full sequence (Clamped)
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400000010632D5EC76B050000000000FE5F00');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.00000000000000000000E+6131"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "1E+6131"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400000010632d5ec76b050000000000fe5f00
-{"d":{"$numberDecimal":"1.00000000000000000000E+6131"}}
-18000000136400000010632d5ec76b050000000000fe5f00
-18000000136400000010632d5ec76b050000000000fe5f00
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-049.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-049.phpt
deleted file mode 100644
index 2e343aaa..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-049.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [decq629] fold-down full sequence (Clamped)
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000000E8890423C78A000000000000FE5F00');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.0000000000000000000E+6130"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "1E+6130"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000000e8890423c78a000000000000fe5f00
-{"d":{"$numberDecimal":"1.0000000000000000000E+6130"}}
-180000001364000000e8890423c78a000000000000fe5f00
-180000001364000000e8890423c78a000000000000fe5f00
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-050.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-050.phpt
deleted file mode 100644
index 47e20d1b..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-050.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [decq631] fold-down full sequence (Clamped)
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400000064A7B3B6E00D000000000000FE5F00');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.000000000000000000E+6129"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "1E+6129"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400000064a7b3b6e00d000000000000fe5f00
-{"d":{"$numberDecimal":"1.000000000000000000E+6129"}}
-18000000136400000064a7b3b6e00d000000000000fe5f00
-18000000136400000064a7b3b6e00d000000000000fe5f00
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-051.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-051.phpt
deleted file mode 100644
index 249986f7..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-051.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [decq633] fold-down full sequence (Clamped)
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('1800000013640000008A5D78456301000000000000FE5F00');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.00000000000000000E+6128"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "1E+6128"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-1800000013640000008a5d78456301000000000000fe5f00
-{"d":{"$numberDecimal":"1.00000000000000000E+6128"}}
-1800000013640000008a5d78456301000000000000fe5f00
-1800000013640000008a5d78456301000000000000fe5f00
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-052.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-052.phpt
deleted file mode 100644
index dda3e3aa..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-052.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [decq635] fold-down full sequence (Clamped)
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000000C16FF2862300000000000000FE5F00');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.0000000000000000E+6127"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "1E+6127"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000000c16ff2862300000000000000fe5f00
-{"d":{"$numberDecimal":"1.0000000000000000E+6127"}}
-180000001364000000c16ff2862300000000000000fe5f00
-180000001364000000c16ff2862300000000000000fe5f00
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-053.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-053.phpt
deleted file mode 100644
index 8ea10fd5..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-053.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [decq637] fold-down full sequence (Clamped)
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000080C6A47E8D0300000000000000FE5F00');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.000000000000000E+6126"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "1E+6126"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000080c6a47e8d0300000000000000fe5f00
-{"d":{"$numberDecimal":"1.000000000000000E+6126"}}
-180000001364000080c6a47e8d0300000000000000fe5f00
-180000001364000080c6a47e8d0300000000000000fe5f00
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-054.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-054.phpt
deleted file mode 100644
index d68ca903..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-054.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [decq639] fold-down full sequence (Clamped)
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('1800000013640000407A10F35A0000000000000000FE5F00');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.00000000000000E+6125"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "1E+6125"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-1800000013640000407a10f35a0000000000000000fe5f00
-{"d":{"$numberDecimal":"1.00000000000000E+6125"}}
-1800000013640000407a10f35a0000000000000000fe5f00
-1800000013640000407a10f35a0000000000000000fe5f00
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-055.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-055.phpt
deleted file mode 100644
index a1d071c1..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-055.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [decq641] fold-down full sequence (Clamped)
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('1800000013640000A0724E18090000000000000000FE5F00');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.0000000000000E+6124"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "1E+6124"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-1800000013640000a0724e18090000000000000000fe5f00
-{"d":{"$numberDecimal":"1.0000000000000E+6124"}}
-1800000013640000a0724e18090000000000000000fe5f00
-1800000013640000a0724e18090000000000000000fe5f00
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-056.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-056.phpt
deleted file mode 100644
index bbd8a841..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-056.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [decq643] fold-down full sequence (Clamped)
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000010A5D4E8000000000000000000FE5F00');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.000000000000E+6123"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "1E+6123"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000010a5d4e8000000000000000000fe5f00
-{"d":{"$numberDecimal":"1.000000000000E+6123"}}
-180000001364000010a5d4e8000000000000000000fe5f00
-180000001364000010a5d4e8000000000000000000fe5f00
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-057.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-057.phpt
deleted file mode 100644
index 8ef302db..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-057.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [decq645] fold-down full sequence (Clamped)
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('1800000013640000E8764817000000000000000000FE5F00');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.00000000000E+6122"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "1E+6122"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-1800000013640000e8764817000000000000000000fe5f00
-{"d":{"$numberDecimal":"1.00000000000E+6122"}}
-1800000013640000e8764817000000000000000000fe5f00
-1800000013640000e8764817000000000000000000fe5f00
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-058.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-058.phpt
deleted file mode 100644
index 2312542f..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-058.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [decq647] fold-down full sequence (Clamped)
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('1800000013640000E40B5402000000000000000000FE5F00');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.0000000000E+6121"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "1E+6121"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-1800000013640000e40b5402000000000000000000fe5f00
-{"d":{"$numberDecimal":"1.0000000000E+6121"}}
-1800000013640000e40b5402000000000000000000fe5f00
-1800000013640000e40b5402000000000000000000fe5f00
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-059.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-059.phpt
deleted file mode 100644
index cf59dad2..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-059.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [decq649] fold-down full sequence (Clamped)
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('1800000013640000CA9A3B00000000000000000000FE5F00');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.000000000E+6120"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "1E+6120"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-1800000013640000ca9a3b00000000000000000000fe5f00
-{"d":{"$numberDecimal":"1.000000000E+6120"}}
-1800000013640000ca9a3b00000000000000000000fe5f00
-1800000013640000ca9a3b00000000000000000000fe5f00
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-060.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-060.phpt
deleted file mode 100644
index f1d3272e..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-060.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [decq651] fold-down full sequence (Clamped)
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('1800000013640000E1F50500000000000000000000FE5F00');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.00000000E+6119"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "1E+6119"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-1800000013640000e1f50500000000000000000000fe5f00
-{"d":{"$numberDecimal":"1.00000000E+6119"}}
-1800000013640000e1f50500000000000000000000fe5f00
-1800000013640000e1f50500000000000000000000fe5f00
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-061.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-061.phpt
deleted file mode 100644
index 1f2840c2..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-061.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [decq653] fold-down full sequence (Clamped)
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364008096980000000000000000000000FE5F00');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.0000000E+6118"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "1E+6118"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364008096980000000000000000000000fe5f00
-{"d":{"$numberDecimal":"1.0000000E+6118"}}
-180000001364008096980000000000000000000000fe5f00
-180000001364008096980000000000000000000000fe5f00
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-062.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-062.phpt
deleted file mode 100644
index 22f3792f..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-062.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [decq655] fold-down full sequence (Clamped)
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('1800000013640040420F0000000000000000000000FE5F00');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.000000E+6117"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "1E+6117"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-1800000013640040420f0000000000000000000000fe5f00
-{"d":{"$numberDecimal":"1.000000E+6117"}}
-1800000013640040420f0000000000000000000000fe5f00
-1800000013640040420f0000000000000000000000fe5f00
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-063.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-063.phpt
deleted file mode 100644
index c84518aa..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-063.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [decq657] fold-down full sequence (Clamped)
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400A086010000000000000000000000FE5F00');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.00000E+6116"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "1E+6116"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400a086010000000000000000000000fe5f00
-{"d":{"$numberDecimal":"1.00000E+6116"}}
-18000000136400a086010000000000000000000000fe5f00
-18000000136400a086010000000000000000000000fe5f00
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-064.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-064.phpt
deleted file mode 100644
index 9d09e70f..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-064.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [decq659] fold-down full sequence (Clamped)
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364001027000000000000000000000000FE5F00');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.0000E+6115"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "1E+6115"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364001027000000000000000000000000fe5f00
-{"d":{"$numberDecimal":"1.0000E+6115"}}
-180000001364001027000000000000000000000000fe5f00
-180000001364001027000000000000000000000000fe5f00
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-065.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-065.phpt
deleted file mode 100644
index acd03a51..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-065.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [decq661] fold-down full sequence (Clamped)
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('18000000136400E803000000000000000000000000FE5F00');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.000E+6114"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "1E+6114"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-18000000136400e803000000000000000000000000fe5f00
-{"d":{"$numberDecimal":"1.000E+6114"}}
-18000000136400e803000000000000000000000000fe5f00
-18000000136400e803000000000000000000000000fe5f00
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-066.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-066.phpt
deleted file mode 100644
index 4c550b13..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-066.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [decq663] fold-down full sequence (Clamped)
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364006400000000000000000000000000FE5F00');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.00E+6113"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "1E+6113"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364006400000000000000000000000000fe5f00
-{"d":{"$numberDecimal":"1.00E+6113"}}
-180000001364006400000000000000000000000000fe5f00
-180000001364006400000000000000000000000000fe5f00
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-067.phpt b/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-067.phpt
deleted file mode 100644
index 1cec08ea..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/decimal128-5-valid-067.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Decimal128: [decq665] fold-down full sequence (Clamped)
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000001364000A00000000000000000000000000FE5F00');
-$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.0E+6112"}}';
-$degenerateExtJson = '{"d" : {"$numberDecimal" : "1E+6112"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000001364000a00000000000000000000000000fe5f00
-{"d":{"$numberDecimal":"1.0E+6112"}}
-180000001364000a00000000000000000000000000fe5f00
-180000001364000a00000000000000000000000000fe5f00
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/document-valid-001.phpt b/mongodb-1.8.1/tests/bson-corpus/document-valid-001.phpt
deleted file mode 100644
index b3f8b68f..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/document-valid-001.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Document type (sub-documents): Empty subdoc
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('0D000000037800050000000000');
-$canonicalExtJson = '{"x" : {}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-0d000000037800050000000000
-{"x":{}}
-0d000000037800050000000000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/document-valid-002.phpt b/mongodb-1.8.1/tests/bson-corpus/document-valid-002.phpt
deleted file mode 100644
index 30425b63..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/document-valid-002.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Document type (sub-documents): Empty-string key subdoc
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('150000000378000D00000002000200000062000000');
-$canonicalExtJson = '{"x" : {"" : "b"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-150000000378000d00000002000200000062000000
-{"x":{"":"b"}}
-150000000378000d00000002000200000062000000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/document-valid-003.phpt b/mongodb-1.8.1/tests/bson-corpus/document-valid-003.phpt
deleted file mode 100644
index 910d5726..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/document-valid-003.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Document type (sub-documents): Single-character key subdoc
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('160000000378000E0000000261000200000062000000');
-$canonicalExtJson = '{"x" : {"a" : "b"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-160000000378000e0000000261000200000062000000
-{"x":{"a":"b"}}
-160000000378000e0000000261000200000062000000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/double-valid-001.phpt b/mongodb-1.8.1/tests/bson-corpus/double-valid-001.phpt
deleted file mode 100644
index 719ff9b0..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/double-valid-001.phpt
+++ /dev/null
@@ -1,40 +0,0 @@
---TEST--
-Double type: +1.0
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('10000000016400000000000000F03F00');
-$canonicalExtJson = '{"d" : {"$numberDouble": "1.0"}}';
-$relaxedExtJson = '{"d" : 1.0}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical BSON -> Relaxed extJSON
-echo json_canonicalize(toRelaxedExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Relaxed extJSON -> BSON -> Relaxed extJSON
-echo json_canonicalize(toRelaxedExtendedJSON(fromJSON($relaxedExtJson))), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-10000000016400000000000000f03f00
-{"d":{"$numberDouble":"1.0"}}
-{"d":1}
-10000000016400000000000000f03f00
-{"d":1}
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/double-valid-002.phpt b/mongodb-1.8.1/tests/bson-corpus/double-valid-002.phpt
deleted file mode 100644
index 60eeb115..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/double-valid-002.phpt
+++ /dev/null
@@ -1,40 +0,0 @@
---TEST--
-Double type: -1.0
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('10000000016400000000000000F0BF00');
-$canonicalExtJson = '{"d" : {"$numberDouble": "-1.0"}}';
-$relaxedExtJson = '{"d" : -1.0}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical BSON -> Relaxed extJSON
-echo json_canonicalize(toRelaxedExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Relaxed extJSON -> BSON -> Relaxed extJSON
-echo json_canonicalize(toRelaxedExtendedJSON(fromJSON($relaxedExtJson))), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-10000000016400000000000000f0bf00
-{"d":{"$numberDouble":"-1.0"}}
-{"d":-1}
-10000000016400000000000000f0bf00
-{"d":-1}
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/double-valid-003.phpt b/mongodb-1.8.1/tests/bson-corpus/double-valid-003.phpt
deleted file mode 100644
index 6b89ac73..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/double-valid-003.phpt
+++ /dev/null
@@ -1,40 +0,0 @@
---TEST--
-Double type: +1.0001220703125
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('10000000016400000000008000F03F00');
-$canonicalExtJson = '{"d" : {"$numberDouble": "1.0001220703125"}}';
-$relaxedExtJson = '{"d" : 1.0001220703125}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical BSON -> Relaxed extJSON
-echo json_canonicalize(toRelaxedExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Relaxed extJSON -> BSON -> Relaxed extJSON
-echo json_canonicalize(toRelaxedExtendedJSON(fromJSON($relaxedExtJson))), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-10000000016400000000008000f03f00
-{"d":{"$numberDouble":"1.0001220703125"}}
-{"d":1.0001220703125}
-10000000016400000000008000f03f00
-{"d":1.0001220703125}
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/double-valid-004.phpt b/mongodb-1.8.1/tests/bson-corpus/double-valid-004.phpt
deleted file mode 100644
index 0da30adb..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/double-valid-004.phpt
+++ /dev/null
@@ -1,40 +0,0 @@
---TEST--
-Double type: -1.0001220703125
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('10000000016400000000008000F0BF00');
-$canonicalExtJson = '{"d" : {"$numberDouble": "-1.0001220703125"}}';
-$relaxedExtJson = '{"d" : -1.0001220703125}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical BSON -> Relaxed extJSON
-echo json_canonicalize(toRelaxedExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Relaxed extJSON -> BSON -> Relaxed extJSON
-echo json_canonicalize(toRelaxedExtendedJSON(fromJSON($relaxedExtJson))), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-10000000016400000000008000f0bf00
-{"d":{"$numberDouble":"-1.0001220703125"}}
-{"d":-1.0001220703125}
-10000000016400000000008000f0bf00
-{"d":-1.0001220703125}
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/double-valid-005.phpt b/mongodb-1.8.1/tests/bson-corpus/double-valid-005.phpt
deleted file mode 100644
index 904698a4..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/double-valid-005.phpt
+++ /dev/null
@@ -1,42 +0,0 @@
---TEST--
-Double type: 1.23456789012345677E+18
---XFAIL--
-Variation in double's string representation (SPEC-850)
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('1000000001640081E97DF41022B14300');
-$canonicalExtJson = '{"d" : {"$numberDouble": "1.23456789012345677E+18"}}';
-$relaxedExtJson = '{"d" : 1.23456789012345677E+18}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical BSON -> Relaxed extJSON
-echo json_canonicalize(toRelaxedExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Relaxed extJSON -> BSON -> Relaxed extJSON
-echo json_canonicalize(toRelaxedExtendedJSON(fromJSON($relaxedExtJson))), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-1000000001640081e97df41022b14300
-{"d":{"$numberDouble":"1.23456789012345677E+18"}}
-{"d":1.2345678901234568e+18}
-1000000001640081e97df41022b14300
-{"d":1.2345678901234568e+18}
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/double-valid-006.phpt b/mongodb-1.8.1/tests/bson-corpus/double-valid-006.phpt
deleted file mode 100644
index cf99055a..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/double-valid-006.phpt
+++ /dev/null
@@ -1,42 +0,0 @@
---TEST--
-Double type: -1.23456789012345677E+18
---XFAIL--
-Variation in double's string representation (SPEC-850)
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('1000000001640081E97DF41022B1C300');
-$canonicalExtJson = '{"d" : {"$numberDouble": "-1.23456789012345677E+18"}}';
-$relaxedExtJson = '{"d" : -1.23456789012345677E+18}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical BSON -> Relaxed extJSON
-echo json_canonicalize(toRelaxedExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Relaxed extJSON -> BSON -> Relaxed extJSON
-echo json_canonicalize(toRelaxedExtendedJSON(fromJSON($relaxedExtJson))), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-1000000001640081e97df41022b1c300
-{"d":{"$numberDouble":"-1.23456789012345677E+18"}}
-{"d":-1.2345678901234568e+18}
-1000000001640081e97df41022b1c300
-{"d":-1.2345678901234568e+18}
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/double-valid-007.phpt b/mongodb-1.8.1/tests/bson-corpus/double-valid-007.phpt
deleted file mode 100644
index b234d60f..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/double-valid-007.phpt
+++ /dev/null
@@ -1,40 +0,0 @@
---TEST--
-Double type: 0.0
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('10000000016400000000000000000000');
-$canonicalExtJson = '{"d" : {"$numberDouble": "0.0"}}';
-$relaxedExtJson = '{"d" : 0.0}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical BSON -> Relaxed extJSON
-echo json_canonicalize(toRelaxedExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Relaxed extJSON -> BSON -> Relaxed extJSON
-echo json_canonicalize(toRelaxedExtendedJSON(fromJSON($relaxedExtJson))), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-10000000016400000000000000000000
-{"d":{"$numberDouble":"0.0"}}
-{"d":0}
-10000000016400000000000000000000
-{"d":0}
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/double-valid-008.phpt b/mongodb-1.8.1/tests/bson-corpus/double-valid-008.phpt
deleted file mode 100644
index ff142637..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/double-valid-008.phpt
+++ /dev/null
@@ -1,40 +0,0 @@
---TEST--
-Double type: -0.0
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('10000000016400000000000000008000');
-$canonicalExtJson = '{"d" : {"$numberDouble": "-0.0"}}';
-$relaxedExtJson = '{"d" : -0.0}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical BSON -> Relaxed extJSON
-echo json_canonicalize(toRelaxedExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Relaxed extJSON -> BSON -> Relaxed extJSON
-echo json_canonicalize(toRelaxedExtendedJSON(fromJSON($relaxedExtJson))), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-10000000016400000000000000008000
-{"d":{"$numberDouble":"-0.0"}}
-{"d":-0}
-10000000016400000000000000008000
-{"d":-0}
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/double-valid-009.phpt b/mongodb-1.8.1/tests/bson-corpus/double-valid-009.phpt
deleted file mode 100644
index ef5c483e..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/double-valid-009.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Double type: NaN
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('10000000016400000000000000F87F00');
-$canonicalExtJson = '{"d": {"$numberDouble": "NaN"}}';
-$relaxedExtJson = '{"d": {"$numberDouble": "NaN"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical BSON -> Relaxed extJSON
-echo json_canonicalize(toRelaxedExtendedJSON($canonicalBson)), "\n";
-
-// Relaxed extJSON -> BSON -> Relaxed extJSON
-echo json_canonicalize(toRelaxedExtendedJSON(fromJSON($relaxedExtJson))), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-10000000016400000000000000f87f00
-{"d":{"$numberDouble":"NaN"}}
-{"d":{"$numberDouble":"NaN"}}
-{"d":{"$numberDouble":"NaN"}}
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/double-valid-010.phpt b/mongodb-1.8.1/tests/bson-corpus/double-valid-010.phpt
deleted file mode 100644
index 0ddbaded..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/double-valid-010.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Double type: NaN with payload
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('10000000016400120000000000F87F00');
-$canonicalExtJson = '{"d": {"$numberDouble": "NaN"}}';
-$relaxedExtJson = '{"d": {"$numberDouble": "NaN"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical BSON -> Relaxed extJSON
-echo json_canonicalize(toRelaxedExtendedJSON($canonicalBson)), "\n";
-
-// Relaxed extJSON -> BSON -> Relaxed extJSON
-echo json_canonicalize(toRelaxedExtendedJSON(fromJSON($relaxedExtJson))), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-10000000016400120000000000f87f00
-{"d":{"$numberDouble":"NaN"}}
-{"d":{"$numberDouble":"NaN"}}
-{"d":{"$numberDouble":"NaN"}}
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/double-valid-011.phpt b/mongodb-1.8.1/tests/bson-corpus/double-valid-011.phpt
deleted file mode 100644
index 570848d5..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/double-valid-011.phpt
+++ /dev/null
@@ -1,40 +0,0 @@
---TEST--
-Double type: Inf
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('10000000016400000000000000F07F00');
-$canonicalExtJson = '{"d": {"$numberDouble": "Infinity"}}';
-$relaxedExtJson = '{"d": {"$numberDouble": "Infinity"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical BSON -> Relaxed extJSON
-echo json_canonicalize(toRelaxedExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Relaxed extJSON -> BSON -> Relaxed extJSON
-echo json_canonicalize(toRelaxedExtendedJSON(fromJSON($relaxedExtJson))), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-10000000016400000000000000f07f00
-{"d":{"$numberDouble":"Infinity"}}
-{"d":{"$numberDouble":"Infinity"}}
-10000000016400000000000000f07f00
-{"d":{"$numberDouble":"Infinity"}}
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/double-valid-012.phpt b/mongodb-1.8.1/tests/bson-corpus/double-valid-012.phpt
deleted file mode 100644
index 9de61187..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/double-valid-012.phpt
+++ /dev/null
@@ -1,40 +0,0 @@
---TEST--
-Double type: -Inf
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('10000000016400000000000000F0FF00');
-$canonicalExtJson = '{"d": {"$numberDouble": "-Infinity"}}';
-$relaxedExtJson = '{"d": {"$numberDouble": "-Infinity"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical BSON -> Relaxed extJSON
-echo json_canonicalize(toRelaxedExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Relaxed extJSON -> BSON -> Relaxed extJSON
-echo json_canonicalize(toRelaxedExtendedJSON(fromJSON($relaxedExtJson))), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-10000000016400000000000000f0ff00
-{"d":{"$numberDouble":"-Infinity"}}
-{"d":{"$numberDouble":"-Infinity"}}
-10000000016400000000000000f0ff00
-{"d":{"$numberDouble":"-Infinity"}}
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/int32-valid-001.phpt b/mongodb-1.8.1/tests/bson-corpus/int32-valid-001.phpt
deleted file mode 100644
index dd1b6c3c..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/int32-valid-001.phpt
+++ /dev/null
@@ -1,40 +0,0 @@
---TEST--
-Int32 type: MinValue
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('0C0000001069000000008000');
-$canonicalExtJson = '{"i" : {"$numberInt": "-2147483648"}}';
-$relaxedExtJson = '{"i" : -2147483648}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical BSON -> Relaxed extJSON
-echo json_canonicalize(toRelaxedExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Relaxed extJSON -> BSON -> Relaxed extJSON
-echo json_canonicalize(toRelaxedExtendedJSON(fromJSON($relaxedExtJson))), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-0c0000001069000000008000
-{"i":{"$numberInt":"-2147483648"}}
-{"i":-2147483648}
-0c0000001069000000008000
-{"i":-2147483648}
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/int32-valid-002.phpt b/mongodb-1.8.1/tests/bson-corpus/int32-valid-002.phpt
deleted file mode 100644
index af80fcf2..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/int32-valid-002.phpt
+++ /dev/null
@@ -1,40 +0,0 @@
---TEST--
-Int32 type: MaxValue
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('0C000000106900FFFFFF7F00');
-$canonicalExtJson = '{"i" : {"$numberInt": "2147483647"}}';
-$relaxedExtJson = '{"i" : 2147483647}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical BSON -> Relaxed extJSON
-echo json_canonicalize(toRelaxedExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Relaxed extJSON -> BSON -> Relaxed extJSON
-echo json_canonicalize(toRelaxedExtendedJSON(fromJSON($relaxedExtJson))), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-0c000000106900ffffff7f00
-{"i":{"$numberInt":"2147483647"}}
-{"i":2147483647}
-0c000000106900ffffff7f00
-{"i":2147483647}
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/int32-valid-003.phpt b/mongodb-1.8.1/tests/bson-corpus/int32-valid-003.phpt
deleted file mode 100644
index 5f79cf71..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/int32-valid-003.phpt
+++ /dev/null
@@ -1,40 +0,0 @@
---TEST--
-Int32 type: -1
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('0C000000106900FFFFFFFF00');
-$canonicalExtJson = '{"i" : {"$numberInt": "-1"}}';
-$relaxedExtJson = '{"i" : -1}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical BSON -> Relaxed extJSON
-echo json_canonicalize(toRelaxedExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Relaxed extJSON -> BSON -> Relaxed extJSON
-echo json_canonicalize(toRelaxedExtendedJSON(fromJSON($relaxedExtJson))), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-0c000000106900ffffffff00
-{"i":{"$numberInt":"-1"}}
-{"i":-1}
-0c000000106900ffffffff00
-{"i":-1}
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/int32-valid-004.phpt b/mongodb-1.8.1/tests/bson-corpus/int32-valid-004.phpt
deleted file mode 100644
index 5ac36c93..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/int32-valid-004.phpt
+++ /dev/null
@@ -1,40 +0,0 @@
---TEST--
-Int32 type: 0
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('0C0000001069000000000000');
-$canonicalExtJson = '{"i" : {"$numberInt": "0"}}';
-$relaxedExtJson = '{"i" : 0}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical BSON -> Relaxed extJSON
-echo json_canonicalize(toRelaxedExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Relaxed extJSON -> BSON -> Relaxed extJSON
-echo json_canonicalize(toRelaxedExtendedJSON(fromJSON($relaxedExtJson))), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-0c0000001069000000000000
-{"i":{"$numberInt":"0"}}
-{"i":0}
-0c0000001069000000000000
-{"i":0}
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/int32-valid-005.phpt b/mongodb-1.8.1/tests/bson-corpus/int32-valid-005.phpt
deleted file mode 100644
index 64fd6e40..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/int32-valid-005.phpt
+++ /dev/null
@@ -1,40 +0,0 @@
---TEST--
-Int32 type: 1
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('0C0000001069000100000000');
-$canonicalExtJson = '{"i" : {"$numberInt": "1"}}';
-$relaxedExtJson = '{"i" : 1}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical BSON -> Relaxed extJSON
-echo json_canonicalize(toRelaxedExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Relaxed extJSON -> BSON -> Relaxed extJSON
-echo json_canonicalize(toRelaxedExtendedJSON(fromJSON($relaxedExtJson))), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-0c0000001069000100000000
-{"i":{"$numberInt":"1"}}
-{"i":1}
-0c0000001069000100000000
-{"i":1}
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/int64-valid-001.phpt b/mongodb-1.8.1/tests/bson-corpus/int64-valid-001.phpt
deleted file mode 100644
index 4f63a6d7..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/int64-valid-001.phpt
+++ /dev/null
@@ -1,42 +0,0 @@
---TEST--
-Int64 type: MinValue
---SKIPIF--
-<?php if (PHP_INT_SIZE !== 8) { die("skip Can't represent 64-bit ints on a 32-bit platform"); } ?>
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('10000000126100000000000000008000');
-$canonicalExtJson = '{"a" : {"$numberLong" : "-9223372036854775808"}}';
-$relaxedExtJson = '{"a" : -9223372036854775808}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical BSON -> Relaxed extJSON
-echo json_canonicalize(toRelaxedExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Relaxed extJSON -> BSON -> Relaxed extJSON
-echo json_canonicalize(toRelaxedExtendedJSON(fromJSON($relaxedExtJson))), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-10000000126100000000000000008000
-{"a":{"$numberLong":"-9223372036854775808"}}
-{"a":-9223372036854775808}
-10000000126100000000000000008000
-{"a":-9223372036854775808}
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/int64-valid-002.phpt b/mongodb-1.8.1/tests/bson-corpus/int64-valid-002.phpt
deleted file mode 100644
index 394af40b..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/int64-valid-002.phpt
+++ /dev/null
@@ -1,42 +0,0 @@
---TEST--
-Int64 type: MaxValue
---SKIPIF--
-<?php if (PHP_INT_SIZE !== 8) { die("skip Can't represent 64-bit ints on a 32-bit platform"); } ?>
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('10000000126100FFFFFFFFFFFFFF7F00');
-$canonicalExtJson = '{"a" : {"$numberLong" : "9223372036854775807"}}';
-$relaxedExtJson = '{"a" : 9223372036854775807}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical BSON -> Relaxed extJSON
-echo json_canonicalize(toRelaxedExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Relaxed extJSON -> BSON -> Relaxed extJSON
-echo json_canonicalize(toRelaxedExtendedJSON(fromJSON($relaxedExtJson))), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-10000000126100ffffffffffffff7f00
-{"a":{"$numberLong":"9223372036854775807"}}
-{"a":9223372036854775807}
-10000000126100ffffffffffffff7f00
-{"a":9223372036854775807}
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/int64-valid-003.phpt b/mongodb-1.8.1/tests/bson-corpus/int64-valid-003.phpt
deleted file mode 100644
index 0cf1945f..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/int64-valid-003.phpt
+++ /dev/null
@@ -1,42 +0,0 @@
---TEST--
-Int64 type: -1
---XFAIL--
-PHP encodes integers as 32-bit if range allows
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('10000000126100FFFFFFFFFFFFFFFF00');
-$canonicalExtJson = '{"a" : {"$numberLong" : "-1"}}';
-$relaxedExtJson = '{"a" : -1}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical BSON -> Relaxed extJSON
-echo json_canonicalize(toRelaxedExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Relaxed extJSON -> BSON -> Relaxed extJSON
-echo json_canonicalize(toRelaxedExtendedJSON(fromJSON($relaxedExtJson))), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-10000000126100ffffffffffffffff00
-{"a":{"$numberLong":"-1"}}
-{"a":-1}
-10000000126100ffffffffffffffff00
-{"a":-1}
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/int64-valid-004.phpt b/mongodb-1.8.1/tests/bson-corpus/int64-valid-004.phpt
deleted file mode 100644
index c72d5f82..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/int64-valid-004.phpt
+++ /dev/null
@@ -1,42 +0,0 @@
---TEST--
-Int64 type: 0
---XFAIL--
-PHP encodes integers as 32-bit if range allows
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('10000000126100000000000000000000');
-$canonicalExtJson = '{"a" : {"$numberLong" : "0"}}';
-$relaxedExtJson = '{"a" : 0}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical BSON -> Relaxed extJSON
-echo json_canonicalize(toRelaxedExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Relaxed extJSON -> BSON -> Relaxed extJSON
-echo json_canonicalize(toRelaxedExtendedJSON(fromJSON($relaxedExtJson))), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-10000000126100000000000000000000
-{"a":{"$numberLong":"0"}}
-{"a":0}
-10000000126100000000000000000000
-{"a":0}
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/int64-valid-005.phpt b/mongodb-1.8.1/tests/bson-corpus/int64-valid-005.phpt
deleted file mode 100644
index febbae73..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/int64-valid-005.phpt
+++ /dev/null
@@ -1,42 +0,0 @@
---TEST--
-Int64 type: 1
---XFAIL--
-PHP encodes integers as 32-bit if range allows
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('10000000126100010000000000000000');
-$canonicalExtJson = '{"a" : {"$numberLong" : "1"}}';
-$relaxedExtJson = '{"a" : 1}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical BSON -> Relaxed extJSON
-echo json_canonicalize(toRelaxedExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Relaxed extJSON -> BSON -> Relaxed extJSON
-echo json_canonicalize(toRelaxedExtendedJSON(fromJSON($relaxedExtJson))), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-10000000126100010000000000000000
-{"a":{"$numberLong":"1"}}
-{"a":1}
-10000000126100010000000000000000
-{"a":1}
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/maxkey-valid-001.phpt b/mongodb-1.8.1/tests/bson-corpus/maxkey-valid-001.phpt
deleted file mode 100644
index a393cc4f..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/maxkey-valid-001.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Maxkey type: Maxkey
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('080000007F610000');
-$canonicalExtJson = '{"a" : {"$maxKey" : 1}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-080000007f610000
-{"a":{"$maxKey":1}}
-080000007f610000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/minkey-valid-001.phpt b/mongodb-1.8.1/tests/bson-corpus/minkey-valid-001.phpt
deleted file mode 100644
index fe605432..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/minkey-valid-001.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Minkey type: Minkey
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('08000000FF610000');
-$canonicalExtJson = '{"a" : {"$minKey" : 1}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-08000000ff610000
-{"a":{"$minKey":1}}
-08000000ff610000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/multi-type-deprecated-valid-001.phpt b/mongodb-1.8.1/tests/bson-corpus/multi-type-deprecated-valid-001.phpt
deleted file mode 100644
index 80c8d56b..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/multi-type-deprecated-valid-001.phpt
+++ /dev/null
@@ -1,35 +0,0 @@
---TEST--
-Multiple types within the same document: All BSON types
---XFAIL--
-PHP encodes integers as 32-bit if range allows
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('38020000075F69640057E193D7A9CC81B4027498B50E53796D626F6C000700000073796D626F6C0002537472696E670007000000737472696E670010496E743332002A00000012496E743634002A0000000000000001446F75626C6500000000000000F0BF0542696E617279001000000003A34C38F7C3ABEDC8A37814A992AB8DB60542696E61727955736572446566696E656400050000008001020304050D436F6465000E00000066756E6374696F6E2829207B7D000F436F64655769746853636F7065001B0000000E00000066756E6374696F6E2829207B7D00050000000003537562646F63756D656E74001200000002666F6F0004000000626172000004417272617900280000001030000100000010310002000000103200030000001033000400000010340005000000001154696D657374616D7000010000002A0000000B5265676578007061747465726E0000094461746574696D6545706F6368000000000000000000094461746574696D65506F73697469766500FFFFFF7F00000000094461746574696D654E656761746976650000000080FFFFFFFF085472756500010846616C736500000C4442506F696E746572000B000000636F6C6C656374696F6E0057E193D7A9CC81B4027498B1034442526566003D0000000224726566000B000000636F6C6C656374696F6E00072469640057FD71E96E32AB4225B723FB02246462000900000064617461626173650000FF4D696E6B6579007F4D61786B6579000A4E756C6C0006556E646566696E65640000');
-$convertedBson = hex2bin('48020000075f69640057e193d7a9cc81b4027498b50253796d626f6c000700000073796d626f6c0002537472696e670007000000737472696e670010496e743332002a00000012496e743634002a0000000000000001446f75626c6500000000000000f0bf0542696e617279001000000003a34c38f7c3abedc8a37814a992ab8db60542696e61727955736572446566696e656400050000008001020304050d436f6465000e00000066756e6374696f6e2829207b7d000f436f64655769746853636f7065001b0000000e00000066756e6374696f6e2829207b7d00050000000003537562646f63756d656e74001200000002666f6f0004000000626172000004417272617900280000001030000100000010310002000000103200030000001033000400000010340005000000001154696d657374616d7000010000002a0000000b5265676578007061747465726e0000094461746574696d6545706f6368000000000000000000094461746574696d65506f73697469766500ffffff7f00000000094461746574696d654e656761746976650000000080ffffffff085472756500010846616c73650000034442506f696e746572002b0000000224726566000b000000636f6c6c656374696f6e00072469640057e193d7a9cc81b4027498b100034442526566003d0000000224726566000b000000636f6c6c656374696f6e00072469640057fd71e96e32ab4225b723fb02246462000900000064617461626173650000ff4d696e6b6579007f4d61786b6579000a4e756c6c000a556e646566696e65640000');
-$canonicalExtJson = '{"_id": {"$oid": "57e193d7a9cc81b4027498b5"}, "Symbol": {"$symbol": "symbol"}, "String": "string", "Int32": {"$numberInt": "42"}, "Int64": {"$numberLong": "42"}, "Double": {"$numberDouble": "-1.0"}, "Binary": { "$binary" : {"base64": "o0w498Or7cijeBSpkquNtg==", "subType": "03"}}, "BinaryUserDefined": { "$binary" : {"base64": "AQIDBAU=", "subType": "80"}}, "Code": {"$code": "function() {}"}, "CodeWithScope": {"$code": "function() {}", "$scope": {}}, "Subdocument": {"foo": "bar"}, "Array": [{"$numberInt": "1"}, {"$numberInt": "2"}, {"$numberInt": "3"}, {"$numberInt": "4"}, {"$numberInt": "5"}], "Timestamp": {"$timestamp": {"t": 42, "i": 1}}, "Regex": {"$regularExpression": {"pattern": "pattern", "options": ""}}, "DatetimeEpoch": {"$date": {"$numberLong": "0"}}, "DatetimePositive": {"$date": {"$numberLong": "2147483647"}}, "DatetimeNegative": {"$date": {"$numberLong": "-2147483648"}}, "True": true, "False": false, "DBPointer": {"$dbPointer": {"$ref": "collection", "$id": {"$oid": "57e193d7a9cc81b4027498b1"}}}, "DBRef": {"$ref": "collection", "$id": {"$oid": "57fd71e96e32ab4225b723fb"}, "$db": "database"}, "Minkey": {"$minKey": 1}, "Maxkey": {"$maxKey": 1}, "Null": null, "Undefined": {"$undefined": true}}';
-$convertedExtJson = '{"_id": {"$oid": "57e193d7a9cc81b4027498b5"}, "Symbol": "symbol", "String": "string", "Int32": {"$numberInt": "42"}, "Int64": {"$numberLong": "42"}, "Double": {"$numberDouble": "-1.0"}, "Binary": { "$binary" : {"base64": "o0w498Or7cijeBSpkquNtg==", "subType": "03"}}, "BinaryUserDefined": { "$binary" : {"base64": "AQIDBAU=", "subType": "80"}}, "Code": {"$code": "function() {}"}, "CodeWithScope": {"$code": "function() {}", "$scope": {}}, "Subdocument": {"foo": "bar"}, "Array": [{"$numberInt": "1"}, {"$numberInt": "2"}, {"$numberInt": "3"}, {"$numberInt": "4"}, {"$numberInt": "5"}], "Timestamp": {"$timestamp": {"t": 42, "i": 1}}, "Regex": {"$regularExpression": {"pattern": "pattern", "options": ""}}, "DatetimeEpoch": {"$date": {"$numberLong": "0"}}, "DatetimePositive": {"$date": {"$numberLong": "2147483647"}}, "DatetimeNegative": {"$date": {"$numberLong": "-2147483648"}}, "True": true, "False": false, "DBPointer": {"$ref": "collection", "$id": {"$oid": "57e193d7a9cc81b4027498b1"}}, "DBRef": {"$ref": "collection", "$id": {"$oid": "57fd71e96e32ab4225b723fb"}, "$db": "database"}, "Minkey": {"$minKey": 1}, "Maxkey": {"$maxKey": 1}, "Null": null, "Undefined": null}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-38020000075f69640057e193d7a9cc81b4027498b50e53796d626f6c000700000073796d626f6c0002537472696e670007000000737472696e670010496e743332002a00000012496e743634002a0000000000000001446f75626c6500000000000000f0bf0542696e617279001000000003a34c38f7c3abedc8a37814a992ab8db60542696e61727955736572446566696e656400050000008001020304050d436f6465000e00000066756e6374696f6e2829207b7d000f436f64655769746853636f7065001b0000000e00000066756e6374696f6e2829207b7d00050000000003537562646f63756d656e74001200000002666f6f0004000000626172000004417272617900280000001030000100000010310002000000103200030000001033000400000010340005000000001154696d657374616d7000010000002a0000000b5265676578007061747465726e0000094461746574696d6545706f6368000000000000000000094461746574696d65506f73697469766500ffffff7f00000000094461746574696d654e656761746976650000000080ffffffff085472756500010846616c736500000c4442506f696e746572000b000000636f6c6c656374696f6e0057e193d7a9cc81b4027498b1034442526566003d0000000224726566000b000000636f6c6c656374696f6e00072469640057fd71e96e32ab4225b723fb02246462000900000064617461626173650000ff4d696e6b6579007f4d61786b6579000a4e756c6c0006556e646566696e65640000
-{"_id":{"$oid":"57e193d7a9cc81b4027498b5"},"Symbol":{"$symbol":"symbol"},"String":"string","Int32":{"$numberInt":"42"},"Int64":{"$numberLong":"42"},"Double":{"$numberDouble":"-1.0"},"Binary":{"$binary":{"base64":"o0w498Or7cijeBSpkquNtg==","subType":"03"}},"BinaryUserDefined":{"$binary":{"base64":"AQIDBAU=","subType":"80"}},"Code":{"$code":"function() {}"},"CodeWithScope":{"$code":"function() {}","$scope":{}},"Subdocument":{"foo":"bar"},"Array":[{"$numberInt":"1"},{"$numberInt":"2"},{"$numberInt":"3"},{"$numberInt":"4"},{"$numberInt":"5"}],"Timestamp":{"$timestamp":{"t":42,"i":1}},"Regex":{"$regularExpression":{"pattern":"pattern","options":""}},"DatetimeEpoch":{"$date":{"$numberLong":"0"}},"DatetimePositive":{"$date":{"$numberLong":"2147483647"}},"DatetimeNegative":{"$date":{"$numberLong":"-2147483648"}},"True":true,"False":false,"DBPointer":{"$dbPointer":{"$ref":"collection","$id":{"$oid":"57e193d7a9cc81b4027498b1"}}},"DBRef":{"$ref":"collection","$id":{"$oid":"57fd71e96e32ab4225b723fb"},"$db":"database"},"Minkey":{"$minKey":1},"Maxkey":{"$maxKey":1},"Null":null,"Undefined":{"$undefined":true}}
-38020000075f69640057e193d7a9cc81b4027498b50e53796d626f6c000700000073796d626f6c0002537472696e670007000000737472696e670010496e743332002a00000012496e743634002a0000000000000001446f75626c6500000000000000f0bf0542696e617279001000000003a34c38f7c3abedc8a37814a992ab8db60542696e61727955736572446566696e656400050000008001020304050d436f6465000e00000066756e6374696f6e2829207b7d000f436f64655769746853636f7065001b0000000e00000066756e6374696f6e2829207b7d00050000000003537562646f63756d656e74001200000002666f6f0004000000626172000004417272617900280000001030000100000010310002000000103200030000001033000400000010340005000000001154696d657374616d7000010000002a0000000b5265676578007061747465726e0000094461746574696d6545706f6368000000000000000000094461746574696d65506f73697469766500ffffff7f00000000094461746574696d654e656761746976650000000080ffffffff085472756500010846616c736500000c4442506f696e746572000b000000636f6c6c656374696f6e0057e193d7a9cc81b4027498b1034442526566003d0000000224726566000b000000636f6c6c656374696f6e00072469640057fd71e96e32ab4225b723fb02246462000900000064617461626173650000ff4d696e6b6579007f4d61786b6579000a4e756c6c0006556e646566696e65640000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/multi-type-valid-001.phpt b/mongodb-1.8.1/tests/bson-corpus/multi-type-valid-001.phpt
deleted file mode 100644
index 5841f77a..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/multi-type-valid-001.phpt
+++ /dev/null
@@ -1,33 +0,0 @@
---TEST--
-Multiple types within the same document: All BSON types
---XFAIL--
-PHP encodes integers as 32-bit if range allows
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('F4010000075F69640057E193D7A9CC81B4027498B502537472696E670007000000737472696E670010496E743332002A00000012496E743634002A0000000000000001446F75626C6500000000000000F0BF0542696E617279001000000003A34C38F7C3ABEDC8A37814A992AB8DB60542696E61727955736572446566696E656400050000008001020304050D436F6465000E00000066756E6374696F6E2829207B7D000F436F64655769746853636F7065001B0000000E00000066756E6374696F6E2829207B7D00050000000003537562646F63756D656E74001200000002666F6F0004000000626172000004417272617900280000001030000100000010310002000000103200030000001033000400000010340005000000001154696D657374616D7000010000002A0000000B5265676578007061747465726E0000094461746574696D6545706F6368000000000000000000094461746574696D65506F73697469766500FFFFFF7F00000000094461746574696D654E656761746976650000000080FFFFFFFF085472756500010846616C73650000034442526566003D0000000224726566000B000000636F6C6C656374696F6E00072469640057FD71E96E32AB4225B723FB02246462000900000064617461626173650000FF4D696E6B6579007F4D61786B6579000A4E756C6C0000');
-$canonicalExtJson = '{"_id": {"$oid": "57e193d7a9cc81b4027498b5"}, "String": "string", "Int32": {"$numberInt": "42"}, "Int64": {"$numberLong": "42"}, "Double": {"$numberDouble": "-1.0"}, "Binary": { "$binary" : {"base64": "o0w498Or7cijeBSpkquNtg==", "subType": "03"}}, "BinaryUserDefined": { "$binary" : {"base64": "AQIDBAU=", "subType": "80"}}, "Code": {"$code": "function() {}"}, "CodeWithScope": {"$code": "function() {}", "$scope": {}}, "Subdocument": {"foo": "bar"}, "Array": [{"$numberInt": "1"}, {"$numberInt": "2"}, {"$numberInt": "3"}, {"$numberInt": "4"}, {"$numberInt": "5"}], "Timestamp": {"$timestamp": {"t": 42, "i": 1}}, "Regex": {"$regularExpression": {"pattern": "pattern", "options": ""}}, "DatetimeEpoch": {"$date": {"$numberLong": "0"}}, "DatetimePositive": {"$date": {"$numberLong": "2147483647"}}, "DatetimeNegative": {"$date": {"$numberLong": "-2147483648"}}, "True": true, "False": false, "DBRef": {"$ref": "collection", "$id": {"$oid": "57fd71e96e32ab4225b723fb"}, "$db": "database"}, "Minkey": {"$minKey": 1}, "Maxkey": {"$maxKey": 1}, "Null": null}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-f4010000075f69640057e193d7a9cc81b4027498b502537472696e670007000000737472696e670010496e743332002a00000012496e743634002a0000000000000001446f75626c6500000000000000f0bf0542696e617279001000000003a34c38f7c3abedc8a37814a992ab8db60542696e61727955736572446566696e656400050000008001020304050d436f6465000e00000066756e6374696f6e2829207b7d000f436f64655769746853636f7065001b0000000e00000066756e6374696f6e2829207b7d00050000000003537562646f63756d656e74001200000002666f6f0004000000626172000004417272617900280000001030000100000010310002000000103200030000001033000400000010340005000000001154696d657374616d7000010000002a0000000b5265676578007061747465726e0000094461746574696d6545706f6368000000000000000000094461746574696d65506f73697469766500ffffff7f00000000094461746574696d654e656761746976650000000080ffffffff085472756500010846616c73650000034442526566003d0000000224726566000b000000636f6c6c656374696f6e00072469640057fd71e96e32ab4225b723fb02246462000900000064617461626173650000ff4d696e6b6579007f4d61786b6579000a4e756c6c0000
-{"_id":{"$oid":"57e193d7a9cc81b4027498b5"},"String":"string","Int32":{"$numberInt":"42"},"Int64":{"$numberLong":"42"},"Double":{"$numberDouble":"-1.0"},"Binary":{"$binary":{"base64":"o0w498Or7cijeBSpkquNtg==","subType":"03"}},"BinaryUserDefined":{"$binary":{"base64":"AQIDBAU=","subType":"80"}},"Code":{"$code":"function() {}"},"CodeWithScope":{"$code":"function() {}","$scope":{}},"Subdocument":{"foo":"bar"},"Array":[{"$numberInt":"1"},{"$numberInt":"2"},{"$numberInt":"3"},{"$numberInt":"4"},{"$numberInt":"5"}],"Timestamp":{"$timestamp":{"t":42,"i":1}},"Regex":{"$regularExpression":{"pattern":"pattern","options":""}},"DatetimeEpoch":{"$date":{"$numberLong":"0"}},"DatetimePositive":{"$date":{"$numberLong":"2147483647"}},"DatetimeNegative":{"$date":{"$numberLong":"-2147483648"}},"True":true,"False":false,"DBRef":{"$ref":"collection","$id":{"$oid":"57fd71e96e32ab4225b723fb"},"$db":"database"},"Minkey":{"$minKey":1},"Maxkey":{"$maxKey":1},"Null":null}
-f4010000075f69640057e193d7a9cc81b4027498b502537472696e670007000000737472696e670010496e743332002a00000012496e743634002a0000000000000001446f75626c6500000000000000f0bf0542696e617279001000000003a34c38f7c3abedc8a37814a992ab8db60542696e61727955736572446566696e656400050000008001020304050d436f6465000e00000066756e6374696f6e2829207b7d000f436f64655769746853636f7065001b0000000e00000066756e6374696f6e2829207b7d00050000000003537562646f63756d656e74001200000002666f6f0004000000626172000004417272617900280000001030000100000010310002000000103200030000001033000400000010340005000000001154696d657374616d7000010000002a0000000b5265676578007061747465726e0000094461746574696d6545706f6368000000000000000000094461746574696d65506f73697469766500ffffff7f00000000094461746574696d654e656761746976650000000080ffffffff085472756500010846616c73650000034442526566003d0000000224726566000b000000636f6c6c656374696f6e00072469640057fd71e96e32ab4225b723fb02246462000900000064617461626173650000ff4d696e6b6579007f4d61786b6579000a4e756c6c0000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/null-valid-001.phpt b/mongodb-1.8.1/tests/bson-corpus/null-valid-001.phpt
deleted file mode 100644
index 2eded700..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/null-valid-001.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Null type: Null
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('080000000A610000');
-$canonicalExtJson = '{"a" : null}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-080000000a610000
-{"a":null}
-080000000a610000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/oid-valid-001.phpt b/mongodb-1.8.1/tests/bson-corpus/oid-valid-001.phpt
deleted file mode 100644
index dbd33e45..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/oid-valid-001.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-ObjectId: All zeroes
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('1400000007610000000000000000000000000000');
-$canonicalExtJson = '{"a" : {"$oid" : "000000000000000000000000"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-1400000007610000000000000000000000000000
-{"a":{"$oid":"000000000000000000000000"}}
-1400000007610000000000000000000000000000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/oid-valid-002.phpt b/mongodb-1.8.1/tests/bson-corpus/oid-valid-002.phpt
deleted file mode 100644
index 47d7407e..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/oid-valid-002.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-ObjectId: All ones
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('14000000076100FFFFFFFFFFFFFFFFFFFFFFFF00');
-$canonicalExtJson = '{"a" : {"$oid" : "ffffffffffffffffffffffff"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-14000000076100ffffffffffffffffffffffff00
-{"a":{"$oid":"ffffffffffffffffffffffff"}}
-14000000076100ffffffffffffffffffffffff00
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/oid-valid-003.phpt b/mongodb-1.8.1/tests/bson-corpus/oid-valid-003.phpt
deleted file mode 100644
index 95a51655..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/oid-valid-003.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-ObjectId: Random
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('1400000007610056E1FC72E0C917E9C471416100');
-$canonicalExtJson = '{"a" : {"$oid" : "56e1fc72e0c917e9c4714161"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-1400000007610056e1fc72e0c917e9c471416100
-{"a":{"$oid":"56e1fc72e0c917e9c4714161"}}
-1400000007610056e1fc72e0c917e9c471416100
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/regex-valid-001.phpt b/mongodb-1.8.1/tests/bson-corpus/regex-valid-001.phpt
deleted file mode 100644
index 458ddf12..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/regex-valid-001.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Regular Expression type: empty regex with no options
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('0A0000000B6100000000');
-$canonicalExtJson = '{"a" : {"$regularExpression" : { "pattern": "", "options" : ""}}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-0a0000000b6100000000
-{"a":{"$regularExpression":{"pattern":"","options":""}}}
-0a0000000b6100000000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/regex-valid-002.phpt b/mongodb-1.8.1/tests/bson-corpus/regex-valid-002.phpt
deleted file mode 100644
index c68b7361..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/regex-valid-002.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Regular Expression type: regex without options
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('0D0000000B6100616263000000');
-$canonicalExtJson = '{"a" : {"$regularExpression" : { "pattern": "abc", "options" : ""}}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-0d0000000b6100616263000000
-{"a":{"$regularExpression":{"pattern":"abc","options":""}}}
-0d0000000b6100616263000000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/regex-valid-003.phpt b/mongodb-1.8.1/tests/bson-corpus/regex-valid-003.phpt
deleted file mode 100644
index 945d59b2..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/regex-valid-003.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Regular Expression type: regex with options
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('0F0000000B610061626300696D0000');
-$canonicalExtJson = '{"a" : {"$regularExpression" : { "pattern": "abc", "options" : "im"}}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-0f0000000b610061626300696d0000
-{"a":{"$regularExpression":{"pattern":"abc","options":"im"}}}
-0f0000000b610061626300696d0000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/regex-valid-004.phpt b/mongodb-1.8.1/tests/bson-corpus/regex-valid-004.phpt
deleted file mode 100644
index badc3eb3..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/regex-valid-004.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Regular Expression type: regex with options (keys reversed)
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('0F0000000B610061626300696D0000');
-$canonicalExtJson = '{"a" : {"$regularExpression" : { "pattern": "abc", "options" : "im"}}}';
-$degenerateExtJson = '{"a" : {"$regularExpression" : {"options" : "im", "pattern": "abc"}}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-0f0000000b610061626300696d0000
-{"a":{"$regularExpression":{"pattern":"abc","options":"im"}}}
-0f0000000b610061626300696d0000
-0f0000000b610061626300696d0000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/regex-valid-005.phpt b/mongodb-1.8.1/tests/bson-corpus/regex-valid-005.phpt
deleted file mode 100644
index 57176c55..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/regex-valid-005.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Regular Expression type: regex with slash
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('110000000B610061622F636400696D0000');
-$canonicalExtJson = '{"a" : {"$regularExpression" : { "pattern": "ab/cd", "options" : "im"}}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-110000000b610061622f636400696d0000
-{"a":{"$regularExpression":{"pattern":"ab\/cd","options":"im"}}}
-110000000b610061622f636400696d0000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/regex-valid-006.phpt b/mongodb-1.8.1/tests/bson-corpus/regex-valid-006.phpt
deleted file mode 100644
index 270fdf2b..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/regex-valid-006.phpt
+++ /dev/null
@@ -1,45 +0,0 @@
---TEST--
-Regular Expression type: flags not alphabetized
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('100000000B610061626300696D780000');
-$degenerateBson = hex2bin('100000000B6100616263006D69780000');
-$canonicalExtJson = '{"a" : {"$regularExpression" : { "pattern": "abc", "options" : "imx"}}}';
-$degenerateExtJson = '{"a" : {"$regularExpression" : { "pattern": "abc", "options" : "mix"}}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($degenerateBson))), "\n";
-
-// Degenerate BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($degenerateBson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-100000000b610061626300696d780000
-{"a":{"$regularExpression":{"pattern":"abc","options":"imx"}}}
-100000000b610061626300696d780000
-100000000b610061626300696d780000
-{"a":{"$regularExpression":{"pattern":"abc","options":"imx"}}}
-100000000b610061626300696d780000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/regex-valid-007.phpt b/mongodb-1.8.1/tests/bson-corpus/regex-valid-007.phpt
deleted file mode 100644
index cba6b8b8..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/regex-valid-007.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Regular Expression type: Required escapes
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('100000000B610061625C226162000000');
-$canonicalExtJson = '{"a" : {"$regularExpression" : { "pattern": "ab\\\\\\"ab", "options" : ""}}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-100000000b610061625c226162000000
-{"a":{"$regularExpression":{"pattern":"ab\\\"ab","options":""}}}
-100000000b610061625c226162000000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/regex-valid-008.phpt b/mongodb-1.8.1/tests/bson-corpus/regex-valid-008.phpt
deleted file mode 100644
index b6033b42..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/regex-valid-008.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Regular Expression type: Regular expression as value of $regex query operator
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('180000000B247265676578007061747465726E0069780000');
-$canonicalExtJson = '{"$regex" : {"$regularExpression" : { "pattern": "pattern", "options" : "ix"}}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-180000000b247265676578007061747465726e0069780000
-{"$regex":{"$regularExpression":{"pattern":"pattern","options":"ix"}}}
-180000000b247265676578007061747465726e0069780000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/regex-valid-009.phpt b/mongodb-1.8.1/tests/bson-corpus/regex-valid-009.phpt
deleted file mode 100644
index da3af3d0..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/regex-valid-009.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Regular Expression type: Regular expression as value of $regex query operator with $options
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('270000000B247265676578007061747465726E000002246F7074696F6E73000300000069780000');
-$canonicalExtJson = '{"$regex" : {"$regularExpression" : { "pattern": "pattern", "options" : ""}}, "$options" : "ix"}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-270000000b247265676578007061747465726e000002246f7074696f6e73000300000069780000
-{"$regex":{"$regularExpression":{"pattern":"pattern","options":""}},"$options":"ix"}
-270000000b247265676578007061747465726e000002246f7074696f6e73000300000069780000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/string-valid-001.phpt b/mongodb-1.8.1/tests/bson-corpus/string-valid-001.phpt
deleted file mode 100644
index 337f36dd..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/string-valid-001.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-String: Empty string
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('0D000000026100010000000000');
-$canonicalExtJson = '{"a" : ""}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-0d000000026100010000000000
-{"a":""}
-0d000000026100010000000000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/string-valid-002.phpt b/mongodb-1.8.1/tests/bson-corpus/string-valid-002.phpt
deleted file mode 100644
index 2c284530..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/string-valid-002.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-String: Single character
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('0E00000002610002000000620000');
-$canonicalExtJson = '{"a" : "b"}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-0e00000002610002000000620000
-{"a":"b"}
-0e00000002610002000000620000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/string-valid-003.phpt b/mongodb-1.8.1/tests/bson-corpus/string-valid-003.phpt
deleted file mode 100644
index 3cfab38c..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/string-valid-003.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-String: Multi-character
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('190000000261000D0000006162616261626162616261620000');
-$canonicalExtJson = '{"a" : "abababababab"}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-190000000261000d0000006162616261626162616261620000
-{"a":"abababababab"}
-190000000261000d0000006162616261626162616261620000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/string-valid-004.phpt b/mongodb-1.8.1/tests/bson-corpus/string-valid-004.phpt
deleted file mode 100644
index 0d30a46c..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/string-valid-004.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-String: two-byte UTF-8 (é)
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('190000000261000D000000C3A9C3A9C3A9C3A9C3A9C3A90000');
-$canonicalExtJson = '{"a" : "\\u00e9\\u00e9\\u00e9\\u00e9\\u00e9\\u00e9"}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-190000000261000d000000c3a9c3a9c3a9c3a9c3a9c3a90000
-{"a":"\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9"}
-190000000261000d000000c3a9c3a9c3a9c3a9c3a9c3a90000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/string-valid-005.phpt b/mongodb-1.8.1/tests/bson-corpus/string-valid-005.phpt
deleted file mode 100644
index c69bdbe0..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/string-valid-005.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-String: three-byte UTF-8 (☆)
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('190000000261000D000000E29886E29886E29886E298860000');
-$canonicalExtJson = '{"a" : "\\u2606\\u2606\\u2606\\u2606"}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-190000000261000d000000e29886e29886e29886e298860000
-{"a":"\u2606\u2606\u2606\u2606"}
-190000000261000d000000e29886e29886e29886e298860000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/string-valid-006.phpt b/mongodb-1.8.1/tests/bson-corpus/string-valid-006.phpt
deleted file mode 100644
index 0e6910b1..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/string-valid-006.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-String: Embedded nulls
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('190000000261000D0000006162006261620062616261620000');
-$canonicalExtJson = '{"a" : "ab\\u0000bab\\u0000babab"}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-190000000261000d0000006162006261620062616261620000
-{"a":"ab\u0000bab\u0000babab"}
-190000000261000d0000006162006261620062616261620000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/string-valid-007.phpt b/mongodb-1.8.1/tests/bson-corpus/string-valid-007.phpt
deleted file mode 100644
index 0941b081..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/string-valid-007.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-String: Required escapes
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('320000000261002600000061625C220102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F61620000');
-$canonicalExtJson = '{"a":"ab\\\\\\"\\u0001\\u0002\\u0003\\u0004\\u0005\\u0006\\u0007\\b\\t\\n\\u000b\\f\\r\\u000e\\u000f\\u0010\\u0011\\u0012\\u0013\\u0014\\u0015\\u0016\\u0017\\u0018\\u0019\\u001a\\u001b\\u001c\\u001d\\u001e\\u001fab"}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-320000000261002600000061625c220102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f61620000
-{"a":"ab\\\"\u0001\u0002\u0003\u0004\u0005\u0006\u0007\b\t\n\u000b\f\r\u000e\u000f\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001a\u001b\u001c\u001d\u001e\u001fab"}
-320000000261002600000061625c220102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f61620000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/symbol-valid-001.phpt b/mongodb-1.8.1/tests/bson-corpus/symbol-valid-001.phpt
deleted file mode 100644
index b01486d5..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/symbol-valid-001.phpt
+++ /dev/null
@@ -1,33 +0,0 @@
---TEST--
-Symbol: Empty string
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('0D0000000E6100010000000000');
-$convertedBson = hex2bin('0D000000026100010000000000');
-$canonicalExtJson = '{"a": {"$symbol": ""}}';
-$convertedExtJson = '{"a": ""}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-0d0000000e6100010000000000
-{"a":{"$symbol":""}}
-0d0000000e6100010000000000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/symbol-valid-002.phpt b/mongodb-1.8.1/tests/bson-corpus/symbol-valid-002.phpt
deleted file mode 100644
index b46e07df..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/symbol-valid-002.phpt
+++ /dev/null
@@ -1,33 +0,0 @@
---TEST--
-Symbol: Single character
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('0E0000000E610002000000620000');
-$convertedBson = hex2bin('0E00000002610002000000620000');
-$canonicalExtJson = '{"a": {"$symbol": "b"}}';
-$convertedExtJson = '{"a": "b"}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-0e0000000e610002000000620000
-{"a":{"$symbol":"b"}}
-0e0000000e610002000000620000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/symbol-valid-003.phpt b/mongodb-1.8.1/tests/bson-corpus/symbol-valid-003.phpt
deleted file mode 100644
index 34ee9f7b..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/symbol-valid-003.phpt
+++ /dev/null
@@ -1,33 +0,0 @@
---TEST--
-Symbol: Multi-character
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('190000000E61000D0000006162616261626162616261620000');
-$convertedBson = hex2bin('190000000261000D0000006162616261626162616261620000');
-$canonicalExtJson = '{"a": {"$symbol": "abababababab"}}';
-$convertedExtJson = '{"a": "abababababab"}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-190000000e61000d0000006162616261626162616261620000
-{"a":{"$symbol":"abababababab"}}
-190000000e61000d0000006162616261626162616261620000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/symbol-valid-004.phpt b/mongodb-1.8.1/tests/bson-corpus/symbol-valid-004.phpt
deleted file mode 100644
index e95d9a3c..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/symbol-valid-004.phpt
+++ /dev/null
@@ -1,33 +0,0 @@
---TEST--
-Symbol: two-byte UTF-8 (é)
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('190000000E61000D000000C3A9C3A9C3A9C3A9C3A9C3A90000');
-$convertedBson = hex2bin('190000000261000D000000C3A9C3A9C3A9C3A9C3A9C3A90000');
-$canonicalExtJson = '{"a": {"$symbol": "éééééé"}}';
-$convertedExtJson = '{"a": "éééééé"}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-190000000e61000d000000c3a9c3a9c3a9c3a9c3a9c3a90000
-{"a":{"$symbol":"\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9"}}
-190000000e61000d000000c3a9c3a9c3a9c3a9c3a9c3a90000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/symbol-valid-005.phpt b/mongodb-1.8.1/tests/bson-corpus/symbol-valid-005.phpt
deleted file mode 100644
index e1d0c57f..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/symbol-valid-005.phpt
+++ /dev/null
@@ -1,33 +0,0 @@
---TEST--
-Symbol: three-byte UTF-8 (☆)
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('190000000E61000D000000E29886E29886E29886E298860000');
-$convertedBson = hex2bin('190000000261000D000000E29886E29886E29886E298860000');
-$canonicalExtJson = '{"a": {"$symbol": "☆☆☆☆"}}';
-$convertedExtJson = '{"a": "☆☆☆☆"}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-190000000e61000d000000e29886e29886e29886e298860000
-{"a":{"$symbol":"\u2606\u2606\u2606\u2606"}}
-190000000e61000d000000e29886e29886e29886e298860000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/symbol-valid-006.phpt b/mongodb-1.8.1/tests/bson-corpus/symbol-valid-006.phpt
deleted file mode 100644
index c11c2919..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/symbol-valid-006.phpt
+++ /dev/null
@@ -1,33 +0,0 @@
---TEST--
-Symbol: Embedded nulls
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('190000000E61000D0000006162006261620062616261620000');
-$convertedBson = hex2bin('190000000261000D0000006162006261620062616261620000');
-$canonicalExtJson = '{"a": {"$symbol": "ab\\u0000bab\\u0000babab"}}';
-$convertedExtJson = '{"a": "ab\\u0000bab\\u0000babab"}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-190000000e61000d0000006162006261620062616261620000
-{"a":{"$symbol":"ab\u0000bab\u0000babab"}}
-190000000e61000d0000006162006261620062616261620000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/timestamp-valid-001.phpt b/mongodb-1.8.1/tests/bson-corpus/timestamp-valid-001.phpt
deleted file mode 100644
index 09342f8a..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/timestamp-valid-001.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Timestamp type: Timestamp: (123456789, 42)
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('100000001161002A00000015CD5B0700');
-$canonicalExtJson = '{"a" : {"$timestamp" : {"t" : 123456789, "i" : 42} } }';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-100000001161002a00000015cd5b0700
-{"a":{"$timestamp":{"t":123456789,"i":42}}}
-100000001161002a00000015cd5b0700
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/timestamp-valid-002.phpt b/mongodb-1.8.1/tests/bson-corpus/timestamp-valid-002.phpt
deleted file mode 100644
index c85ef21b..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/timestamp-valid-002.phpt
+++ /dev/null
@@ -1,36 +0,0 @@
---TEST--
-Timestamp type: Timestamp: (123456789, 42) (keys reversed)
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('100000001161002A00000015CD5B0700');
-$canonicalExtJson = '{"a" : {"$timestamp" : {"t" : 123456789, "i" : 42} } }';
-$degenerateExtJson = '{"a" : {"$timestamp" : {"i" : 42, "t" : 123456789} } }';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-// Degenerate extJSON -> Canonical BSON
-echo bin2hex(fromJSON($degenerateExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-100000001161002a00000015cd5b0700
-{"a":{"$timestamp":{"t":123456789,"i":42}}}
-100000001161002a00000015cd5b0700
-100000001161002a00000015cd5b0700
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/timestamp-valid-003.phpt b/mongodb-1.8.1/tests/bson-corpus/timestamp-valid-003.phpt
deleted file mode 100644
index 07f7a61f..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/timestamp-valid-003.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Timestamp type: Timestamp with high-order bit set on both seconds and increment
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('10000000116100FFFFFFFFFFFFFFFF00');
-$canonicalExtJson = '{"a" : {"$timestamp" : {"t" : 4294967295, "i" : 4294967295} } }';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-10000000116100ffffffffffffffff00
-{"a":{"$timestamp":{"t":4294967295,"i":4294967295}}}
-10000000116100ffffffffffffffff00
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/top-parseError-001.phpt b/mongodb-1.8.1/tests/bson-corpus/top-parseError-001.phpt
deleted file mode 100644
index 8c95efa8..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/top-parseError-001.phpt
+++ /dev/null
@@ -1,21 +0,0 @@
---TEST--
-Top-level document validity: Bad $regularExpression (extra field)
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-throws(function() {
- fromJSON('{"a" : "$regularExpression": {"pattern": "abc", "options": "", "unrelated": true}}}');
-}, 'MongoDB\Driver\Exception\UnexpectedValueException');
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-OK: Got MongoDB\Driver\Exception\UnexpectedValueException
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/top-parseError-002.phpt b/mongodb-1.8.1/tests/bson-corpus/top-parseError-002.phpt
deleted file mode 100644
index f764b092..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/top-parseError-002.phpt
+++ /dev/null
@@ -1,21 +0,0 @@
---TEST--
-Top-level document validity: Bad $regularExpression (missing options field)
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-throws(function() {
- fromJSON('{"a" : "$regularExpression": {"pattern": "abc"}}}');
-}, 'MongoDB\Driver\Exception\UnexpectedValueException');
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-OK: Got MongoDB\Driver\Exception\UnexpectedValueException
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/top-parseError-005.phpt b/mongodb-1.8.1/tests/bson-corpus/top-parseError-005.phpt
deleted file mode 100644
index f931cc4b..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/top-parseError-005.phpt
+++ /dev/null
@@ -1,21 +0,0 @@
---TEST--
-Top-level document validity: Bad $regularExpression (missing pattern field)
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-throws(function() {
- fromJSON('{"a" : "$regularExpression": {"options":"ix"}}}');
-}, 'MongoDB\Driver\Exception\UnexpectedValueException');
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-OK: Got MongoDB\Driver\Exception\UnexpectedValueException
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/top-valid-001.phpt b/mongodb-1.8.1/tests/bson-corpus/top-valid-001.phpt
deleted file mode 100644
index b82e5828..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/top-valid-001.phpt
+++ /dev/null
@@ -1,31 +0,0 @@
---TEST--
-Top-level document validity: Document with keys that start with $
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('0F00000010246B6579002A00000000');
-$canonicalExtJson = '{"$key": {"$numberInt": "42"}}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-0f00000010246b6579002a00000000
-{"$key":{"$numberInt":"42"}}
-0f00000010246b6579002a00000000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/undefined-valid-001.phpt b/mongodb-1.8.1/tests/bson-corpus/undefined-valid-001.phpt
deleted file mode 100644
index 68e2df39..00000000
--- a/mongodb-1.8.1/tests/bson-corpus/undefined-valid-001.phpt
+++ /dev/null
@@ -1,33 +0,0 @@
---TEST--
-Undefined type (deprecated): Undefined
---DESCRIPTION--
-Generated by scripts/convert-bson-corpus-tests.php
-
-DO NOT EDIT THIS FILE
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$canonicalBson = hex2bin('0800000006610000');
-$convertedBson = hex2bin('080000000A610000');
-$canonicalExtJson = '{"a" : {"$undefined" : true}}';
-$convertedExtJson = '{"a" : null}';
-
-// Canonical BSON -> Native -> Canonical BSON
-echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
-
-// Canonical BSON -> Canonical extJSON
-echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
-
-// Canonical extJSON -> Canonical BSON
-echo bin2hex(fromJSON($canonicalExtJson)), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-0800000006610000
-{"a":{"$undefined":true}}
-0800000006610000
-===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson/bson-binary_error-001.phpt b/mongodb-1.8.1/tests/bson/bson-binary_error-001.phpt
deleted file mode 100644
index 3e974803..00000000
--- a/mongodb-1.8.1/tests/bson/bson-binary_error-001.phpt
+++ /dev/null
@@ -1,25 +0,0 @@
---TEST--
-MongoDB\BSON\Binary #001 error
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$binary = new MongoDB\BSON\Binary("random binary data", MongoDB\BSON\Binary::TYPE_GENERIC);
-$binary->getData(2);
-$binary->getType(2);
-
-throws(function() {
- new MongoDB\BSON\Binary("random binary data without type");
-}, "MongoDB\\Driver\\Exception\\InvalidArgumentException");
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECTF--
-Warning: MongoDB\BSON\Binary::getData() expects exactly 0 parameters, 1 given in %s on line %d
-
-Warning: MongoDB\BSON\Binary::getType() expects exactly 0 parameters, 1 given in %s on line %d
-OK: Got MongoDB\Driver\Exception\InvalidArgumentException
-===DONE===
-
diff --git a/mongodb-1.8.1/tests/bson/bson-decimal128_error-001.phpt b/mongodb-1.8.1/tests/bson/bson-decimal128_error-001.phpt
deleted file mode 100644
index 2074c32c..00000000
--- a/mongodb-1.8.1/tests/bson/bson-decimal128_error-001.phpt
+++ /dev/null
@@ -1,20 +0,0 @@
---TEST--
-MongoDB\BSON\Decimal128 requires valid decimal string
---SKIPIF--
-<?php if (!class_exists('MongoDB\BSON\Decimal128')) { die('skip MongoDB\BSON\Decimal128 is not available'); } ?>
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-echo throws(function() {
- new MongoDB\BSON\Decimal128([]);
-}, 'MongoDB\Driver\Exception\InvalidArgumentException'), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-OK: Got MongoDB\Driver\Exception\InvalidArgumentException
-MongoDB\BSON\Decimal128::__construct() expects parameter 1 to be string, array given
-===DONE===
diff --git a/mongodb-1.8.1/tests/bson/bson-javascript_error-001.phpt b/mongodb-1.8.1/tests/bson/bson-javascript_error-001.phpt
deleted file mode 100644
index c1da95c4..00000000
--- a/mongodb-1.8.1/tests/bson/bson-javascript_error-001.phpt
+++ /dev/null
@@ -1,17 +0,0 @@
---TEST--
-MongoDB\BSON\Javascript #001 error
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-throws(function() {
- new MongoDB\BSON\Javascript;
-}, "MongoDB\\Driver\\Exception\\InvalidArgumentException");
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-OK: Got MongoDB\Driver\Exception\InvalidArgumentException
-===DONE===
diff --git a/mongodb-1.8.1/tests/bson/bson-objectid-001.phpt b/mongodb-1.8.1/tests/bson/bson-objectid-001.phpt
deleted file mode 100644
index 7c979e8d..00000000
--- a/mongodb-1.8.1/tests/bson/bson-objectid-001.phpt
+++ /dev/null
@@ -1,92 +0,0 @@
---TEST--
-MongoDB\BSON\ObjectId #001
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$sameid = new MongoDB\BSON\ObjectId("53e2a1c40640fd72175d4603");
-$samestd = new stdClass;
-$samestd->my = $sameid;
-$samearr = array("my" => $sameid);
-
-
-$std = new stdclass;
-$std->_id = new MongoDB\BSON\ObjectId;
-
-$array = array(
- "_id" => new MongoDB\BSON\ObjectId,
- "id" => new MongoDB\BSON\ObjectId,
- "d" => new MongoDB\BSON\ObjectId,
-);
-
-$pregenerated = new MongoDB\BSON\ObjectId("53e28b650640fd3162152de1");
-
-$tests = array(
- $array,
- $std,
- $samestd,
- $samearr,
- array("pregenerated" => $pregenerated),
-);
-
-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);
-}
-
-throws(function() {
- $id = new MongoDB\BSON\ObjectId("53e28b650640fd3162152de12");
-}, "MongoDB\\Driver\\Exception\\InvalidArgumentException");
-
-throws(function() {
- $id = new MongoDB\BSON\ObjectId("53e28b650640fd3162152dg1");
-}, "MongoDB\\Driver\\Exception\\InvalidArgumentException");
-
-throws(function() {
- $id = new MongoDB\BSON\ObjectId("-3e28b650640fd3162152da1");
-}, "MongoDB\\Driver\\Exception\\InvalidArgumentException");
-
-throws(function() {
- $id = new MongoDB\BSON\ObjectId(" 3e28b650640fd3162152da1");
-}, "MongoDB\\Driver\\Exception\\InvalidArgumentException");
-
-
-
-raises(function() use($pregenerated) {
- $pregenerated->__toString(1);
-}, E_WARNING);
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECTF--
-Test#0 { "_id" : { "$oid" : "%s" }, "id" : { "$oid" : "%s" }, "d" : { "$oid" : "%s" } }
-string(146) "{ "_id" : { "$oid" : "%s" }, "id" : { "$oid" : "%s" }, "d" : { "$oid" : "%s" } }"
-string(146) "{ "_id" : { "$oid" : "%s" }, "id" : { "$oid" : "%s" }, "d" : { "$oid" : "%s" } }"
-bool(true)
-Test#1 { "_id" : { "$oid" : "%s" } }
-string(51) "{ "_id" : { "$oid" : "%s" } }"
-string(51) "{ "_id" : { "$oid" : "%s" } }"
-bool(true)
-Test#2 { "my" : { "$oid" : "53e2a1c40640fd72175d4603" } }
-string(50) "{ "my" : { "$oid" : "53e2a1c40640fd72175d4603" } }"
-string(50) "{ "my" : { "$oid" : "53e2a1c40640fd72175d4603" } }"
-bool(true)
-Test#3 { "my" : { "$oid" : "53e2a1c40640fd72175d4603" } }
-string(50) "{ "my" : { "$oid" : "53e2a1c40640fd72175d4603" } }"
-string(50) "{ "my" : { "$oid" : "53e2a1c40640fd72175d4603" } }"
-bool(true)
-Test#4 { "pregenerated" : { "$oid" : "53e28b650640fd3162152de1" } }
-string(60) "{ "pregenerated" : { "$oid" : "53e28b650640fd3162152de1" } }"
-string(60) "{ "pregenerated" : { "$oid" : "53e28b650640fd3162152de1" } }"
-bool(true)
-OK: Got MongoDB\Driver\Exception\InvalidArgumentException
-OK: Got MongoDB\Driver\Exception\InvalidArgumentException
-OK: Got MongoDB\Driver\Exception\InvalidArgumentException
-OK: Got MongoDB\Driver\Exception\InvalidArgumentException
-OK: Got E_WARNING
-===DONE===
diff --git a/mongodb-1.8.1/tests/bson/bson-objectid_error-001.phpt b/mongodb-1.8.1/tests/bson/bson-objectid_error-001.phpt
deleted file mode 100644
index 8d3e3006..00000000
--- a/mongodb-1.8.1/tests/bson/bson-objectid_error-001.phpt
+++ /dev/null
@@ -1,18 +0,0 @@
---TEST--
-MongoDB\BSON\ObjectId #001 error
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-throws(function() {
- new MongoDB\BSON\ObjectId(new stdclass);
-}, "MongoDB\\Driver\\Exception\\InvalidArgumentException");
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-OK: Got MongoDB\Driver\Exception\InvalidArgumentException
-===DONE===
-
diff --git a/mongodb-1.8.1/tests/bson/bson-regex_error-001.phpt b/mongodb-1.8.1/tests/bson/bson-regex_error-001.phpt
deleted file mode 100644
index d418cc91..00000000
--- a/mongodb-1.8.1/tests/bson/bson-regex_error-001.phpt
+++ /dev/null
@@ -1,24 +0,0 @@
---TEST--
-MongoDB\BSON\Regex #001 error
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$regexp = new MongoDB\BSON\Regex("regexp", "i");
-$regexp->getPattern(true);
-$regexp->getFlags(true);
-
-throws(function() {
- new MongoDB\BSON\Regex;
-}, "MongoDB\\Driver\\Exception\\InvalidArgumentException");
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECTF--
-Warning: %s\Regex::getPattern() expects exactly 0 parameters, 1 given in %s on line %d
-
-Warning: %s\Regex::getFlags() expects exactly 0 parameters, 1 given in %s on line %d
-OK: Got MongoDB\Driver\Exception\InvalidArgumentException
-===DONE===
diff --git a/mongodb-1.8.1/tests/bson/bson-timestamp_error-001.phpt b/mongodb-1.8.1/tests/bson/bson-timestamp_error-001.phpt
deleted file mode 100644
index 964d6fee..00000000
--- a/mongodb-1.8.1/tests/bson/bson-timestamp_error-001.phpt
+++ /dev/null
@@ -1,18 +0,0 @@
---TEST--
-MongoDB\BSON\Timestamp #001 error
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-throws(function() {
- new MongoDB\BSON\Timestamp;
-}, "MongoDB\\Driver\\Exception\\InvalidArgumentException");
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-OK: Got MongoDB\Driver\Exception\InvalidArgumentException
-===DONE===
-
diff --git a/mongodb-1.8.1/tests/bson/bug0939-001.phpt b/mongodb-1.8.1/tests/bson/bug0939-001.phpt
deleted file mode 100644
index 667028d3..00000000
--- a/mongodb-1.8.1/tests/bson/bug0939-001.phpt
+++ /dev/null
@@ -1,119 +0,0 @@
---TEST--
-PHPC-939: BSON classes should not assign public properties after var_dump()
---FILE--
-<?php
-
-$tests = [
- [ new MongoDB\BSON\Binary('foo', MongoDB\BSON\Binary::TYPE_GENERIC), ['data', 'type'] ],
- [ new MongoDB\BSON\Decimal128('3.14'), ['dec'] ],
- [ new MongoDB\BSON\Javascript('function foo() { return bar; }', ['bar' => 42]), ['code', 'scope'] ],
- [ new MongoDB\BSON\MaxKey, [] ],
- [ new MongoDB\BSON\MinKey, [] ],
- [ new MongoDB\BSON\ObjectId, ['oid'] ],
- [ new MongoDB\BSON\Regex('foo', 'i'), ['pattern', 'flags'] ],
- [ new MongoDB\BSON\Timestamp(1234, 5678), ['increment', 'timestamp'] ],
- [ new MongoDB\BSON\UTCDateTime, ['milliseconds'] ],
-];
-
-foreach ($tests as $test) {
- list($object, $properties) = $test;
-
- var_dump($object);
-
- foreach ($properties as $property) {
- var_dump($object->{$property});
- }
-
- echo "\n";
-}
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECTF--
-object(MongoDB\BSON\Binary)#%d (%d) {
- ["data"]=>
- string(3) "foo"
- ["type"]=>
- int(0)
-}
-
-Notice: Undefined property: MongoDB\BSON\Binary::$data in %s on line %d
-NULL
-
-Notice: Undefined property: MongoDB\BSON\Binary::$type in %s on line %d
-NULL
-
-object(MongoDB\BSON\Decimal128)#%d (%d) {
- ["dec"]=>
- string(4) "3.14"
-}
-
-Notice: Undefined property: MongoDB\BSON\Decimal128::$dec in %s on line %d
-NULL
-
-object(MongoDB\BSON\Javascript)#%d (%d) {
- ["code"]=>
- string(30) "function foo() { return bar; }"
- ["scope"]=>
- object(stdClass)#%d (%d) {
- ["bar"]=>
- int(42)
- }
-}
-
-Notice: Undefined property: MongoDB\BSON\Javascript::$code in %s on line %d
-NULL
-
-Notice: Undefined property: MongoDB\BSON\Javascript::$scope in %s on line %d
-NULL
-
-object(MongoDB\BSON\MaxKey)#%d (%d) {
-}
-
-object(MongoDB\BSON\MinKey)#%d (%d) {
-}
-
-object(MongoDB\BSON\ObjectId)#%d (%d) {
- ["oid"]=>
- string(24) "%x"
-}
-
-Notice: Undefined property: MongoDB\BSON\ObjectId::$oid in %s on line %d
-NULL
-
-object(MongoDB\BSON\Regex)#%d (%d) {
- ["pattern"]=>
- string(3) "foo"
- ["flags"]=>
- string(1) "i"
-}
-
-Notice: Undefined property: MongoDB\BSON\Regex::$pattern in %s on line %d
-NULL
-
-Notice: Undefined property: MongoDB\BSON\Regex::$flags in %s on line %d
-NULL
-
-object(MongoDB\BSON\Timestamp)#%d (%d) {
- ["increment"]=>
- string(4) "1234"
- ["timestamp"]=>
- string(4) "5678"
-}
-
-Notice: Undefined property: MongoDB\BSON\Timestamp::$increment in %s on line %d
-NULL
-
-Notice: Undefined property: MongoDB\BSON\Timestamp::$timestamp in %s on line %d
-NULL
-
-object(MongoDB\BSON\UTCDateTime)#%d (%d) {
- ["milliseconds"]=>
- string(%d) "%d"
-}
-
-Notice: Undefined property: MongoDB\BSON\UTCDateTime::$milliseconds in %s on line %d
-NULL
-
-===DONE===
diff --git a/mongodb-1.8.1/tests/bulk/bulkwrite-debug-001.phpt b/mongodb-1.8.1/tests/bulk/bulkwrite-debug-001.phpt
deleted file mode 100644
index 2b1647eb..00000000
--- a/mongodb-1.8.1/tests/bulk/bulkwrite-debug-001.phpt
+++ /dev/null
@@ -1,102 +0,0 @@
---TEST--
-MongoDB\Driver\BulkWrite debug output before execution
---FILE--
-<?php
-
-$tests = [
- [],
- ['ordered' => true],
- ['ordered' => false],
- ['bypassDocumentValidation' => true],
- ['bypassDocumentValidation' => false],
-];
-
-foreach ($tests as $options) {
- var_dump(new MongoDB\Driver\BulkWrite($options));
-}
-
-?>
-===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(false)
- ["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"]=>
- bool(true)
- ["executed"]=>
- bool(false)
- ["server_id"]=>
- int(0)
- ["write_concern"]=>
- NULL
-}
-object(MongoDB\Driver\BulkWrite)#%d (%d) {
- ["database"]=>
- NULL
- ["collection"]=>
- NULL
- ["ordered"]=>
- bool(true)
- ["bypassDocumentValidation"]=>
- bool(false)
- ["executed"]=>
- bool(false)
- ["server_id"]=>
- int(0)
- ["write_concern"]=>
- NULL
-}
-===DONE===
diff --git a/mongodb-1.8.1/tests/bulk/write-0001.phpt b/mongodb-1.8.1/tests/bulk/write-0001.phpt
deleted file mode 100644
index b5e83630..00000000
--- a/mongodb-1.8.1/tests/bulk/write-0001.phpt
+++ /dev/null
@@ -1,127 +0,0 @@
---TEST--
-MongoDB\Driver\BulkWrite: #001 Variety Bulk
---SKIPIF--
-<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
-<?php skip_if_not_live(); ?>
-<?php skip_if_not_clean(); ?>
---FILE--
-<?php
-require_once __DIR__ . "/../utils/basic.inc";
-
-$manager = new MongoDB\Driver\Manager(URI);
-
-$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(%r[1-9]\d*%r)
- ["write_concern"]=>
- NULL
-}
-Inserted: 3
-Deleted: 1
-Updated: 1
-Upserted: 0
-===DONE===
diff --git a/mongodb-1.8.1/tests/bulk/write-0002.phpt b/mongodb-1.8.1/tests/bulk/write-0002.phpt
deleted file mode 100644
index 100bddea..00000000
--- a/mongodb-1.8.1/tests/bulk/write-0002.phpt
+++ /dev/null
@@ -1,79 +0,0 @@
---TEST--
-MongoDB\Driver\BulkWrite: #002 Get the generated ID
---SKIPIF--
-<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
-<?php skip_if_not_live(); ?>
-<?php skip_if_not_clean(); ?>
---FILE--
-<?php
-require_once __DIR__ . "/../utils/basic.inc";
-
-$manager = new MongoDB\Driver\Manager(URI);
-
-$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(%r[1-9]\d*%r)
- ["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.8.1/tests/cursor/bug1050-001.phpt b/mongodb-1.8.1/tests/cursor/bug1050-001.phpt
deleted file mode 100644
index 00d2b2dd..00000000
--- a/mongodb-1.8.1/tests/cursor/bug1050-001.phpt
+++ /dev/null
@@ -1,74 +0,0 @@
---TEST--
-PHPC-1050: Command cursor should not invoke getMore at execution
---SKIPIF--
-<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
-<?php skip_if_not_replica_set(); ?>
-<?php skip_if_not_clean(); ?>
-<?php skip_if_server_version('<', '3.6'); ?>
-<?php skip_if_not_server_storage_engine('wiredTiger'); ?>
---FILE--
-<?php
-require_once __DIR__ . "/../utils/basic.inc";
-
-$manager = new MongoDB\Driver\Manager(URI);
-
-$cmd = new MongoDB\Driver\Command(
- [
- 'aggregate' => COLLECTION_NAME,
- 'pipeline' => [
- ['$changeStream' => (object) []],
- ],
- 'cursor' => (object) [],
- ],
- [
- 'maxAwaitTimeMS' => 500,
- ]
-);
-
-$start = microtime(true);
-$cursor = $manager->executeReadCommand(DATABASE_NAME, $cmd);
-printf("Executing command took %0.6f seconds\n", microtime(true) - $start);
-
-$it = new IteratorIterator($cursor);
-
-$start = microtime(true);
-$it->rewind();
-printf("Rewinding cursor took %0.6f seconds\n", microtime(true) - $start);
-printf("Current position is valid: %s\n", $it->valid() ? 'yes' : 'no');
-
-$bulk = new MongoDB\Driver\BulkWrite;
-$bulk->insert(['x' => 1]);
-$manager->executeBulkWrite(NS, $bulk);
-
-$start = microtime(true);
-$it->next();
-printf("Advancing cursor took %0.6f seconds\n", microtime(true) - $start);
-printf("Current position is valid: %s\n", $it->valid() ? 'yes' : 'no');
-
-$document = $it->current();
-
-if (isset($document)) {
- printf("Operation type: %s\n", $document->operationType);
- var_dump($document->fullDocument);
-}
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECTF--
-Executing command took 0.%d seconds
-Rewinding cursor took 0.%r(4|5)%r%d seconds
-Current position is valid: no
-Advancing cursor took %d.%d seconds
-Current position is valid: yes
-Operation type: insert
-object(stdClass)#%d (%d) {
- ["_id"]=>
- object(MongoDB\BSON\ObjectId)#%d (%d) {
- ["oid"]=>
- string(24) "%x"
- }
- ["x"]=>
- int(1)
-}
-===DONE===
diff --git a/mongodb-1.8.1/tests/cursor/bug1050-002.phpt b/mongodb-1.8.1/tests/cursor/bug1050-002.phpt
deleted file mode 100644
index 2d324e30..00000000
--- a/mongodb-1.8.1/tests/cursor/bug1050-002.phpt
+++ /dev/null
@@ -1,77 +0,0 @@
---TEST--
-PHPC-1050: Command cursor should not invoke getMore at execution (rewind omitted)
---SKIPIF--
-<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
-<?php skip_if_not_replica_set(); ?>
-<?php skip_if_not_clean(); ?>
-<?php skip_if_server_version('<', '3.6'); ?>
-<?php skip_if_not_server_storage_engine('wiredTiger'); ?>
---FILE--
-<?php
-require_once __DIR__ . "/../utils/basic.inc";
-
-$manager = new MongoDB\Driver\Manager(URI);
-
-$cmd = new MongoDB\Driver\Command(
- [
- 'aggregate' => COLLECTION_NAME,
- 'pipeline' => [
- ['$changeStream' => (object) []],
- ],
- 'cursor' => (object) [],
- ],
- [
- 'maxAwaitTimeMS' => 500,
- ]
-);
-
-$start = microtime(true);
-$cursor = $manager->executeReadCommand(DATABASE_NAME, $cmd);
-printf("Executing command took %0.6f seconds\n", microtime(true) - $start);
-
-$it = new IteratorIterator($cursor);
-
-printf("Current position is valid: %s\n", $it->valid() ? 'yes' : 'no');
-
-$start = microtime(true);
-$it->next();
-printf("Advancing cursor took %0.6f seconds\n", microtime(true) - $start);
-printf("Current position is valid: %s\n", $it->valid() ? 'yes' : 'no');
-
-$bulk = new MongoDB\Driver\BulkWrite;
-$bulk->insert(['x' => 1]);
-$manager->executeBulkWrite(NS, $bulk);
-
-$start = microtime(true);
-$it->next();
-printf("Advancing cursor took %0.6f seconds\n", microtime(true) - $start);
-printf("Current position is valid: %s\n", $it->valid() ? 'yes' : 'no');
-
-$document = $it->current();
-
-if (isset($document)) {
- printf("Operation type: %s\n", $document->operationType);
- var_dump($document->fullDocument);
-}
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECTF--
-Executing command took 0.%d seconds
-Current position is valid: no
-Advancing cursor took 0.%r(4|5)%r%d seconds
-Current position is valid: no
-Advancing cursor took %d.%d seconds
-Current position is valid: yes
-Operation type: insert
-object(stdClass)#%d (%d) {
- ["_id"]=>
- object(MongoDB\BSON\ObjectId)#%d (%d) {
- ["oid"]=>
- string(24) "%x"
- }
- ["x"]=>
- int(1)
-}
-===DONE===
diff --git a/mongodb-1.8.1/tests/cursor/cursor-get_iterator-001.phpt b/mongodb-1.8.1/tests/cursor/cursor-get_iterator-001.phpt
deleted file mode 100644
index 671e23ff..00000000
--- a/mongodb-1.8.1/tests/cursor/cursor-get_iterator-001.phpt
+++ /dev/null
@@ -1,62 +0,0 @@
---TEST--
-MongoDB\Driver\Cursor get_iterator handler does not yield multiple iterators (foreach)
---SKIPIF--
-<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
-<?php skip_if_not_live(); ?>
-<?php skip_if_not_clean(); ?>
---FILE--
-<?php
-require_once __DIR__ . "/../utils/basic.inc";
-
-$manager = new MongoDB\Driver\Manager(URI);
-
-$bulkWrite = new MongoDB\Driver\BulkWrite;
-
-for ($i = 0; $i < 3; $i++) {
- $bulkWrite->insert(array('_id' => $i));
-}
-
-$writeResult = $manager->executeBulkWrite(NS, $bulkWrite);
-printf("Inserted: %d\n", $writeResult->getInsertedCount());
-
-$cursor = $manager->executeQuery(NS, new MongoDB\Driver\Query(array()));
-
-echo "\nFirst foreach statement:\n";
-
-foreach ($cursor as $document) {
- var_dump($document);
-}
-
-echo "\nSecond foreach statement:\n";
-
-try {
- foreach ($cursor as $document) {
- echo "FAILED: get_iterator should not yield multiple iterators\n";
- }
-} catch (MongoDB\Driver\Exception\LogicException $e) {
- printf("LogicException: %s\n", $e->getMessage());
-}
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECTF--
-Inserted: 3
-
-First foreach statement:
-object(stdClass)#%d (1) {
- ["_id"]=>
- int(0)
-}
-object(stdClass)#%d (1) {
- ["_id"]=>
- int(1)
-}
-object(stdClass)#%d (1) {
- ["_id"]=>
- int(2)
-}
-
-Second foreach statement:
-LogicException: Cursors cannot yield multiple iterators
-===DONE===
diff --git a/mongodb-1.8.1/tests/cursor/cursor-get_iterator-002.phpt b/mongodb-1.8.1/tests/cursor/cursor-get_iterator-002.phpt
deleted file mode 100644
index fff3ad37..00000000
--- a/mongodb-1.8.1/tests/cursor/cursor-get_iterator-002.phpt
+++ /dev/null
@@ -1,48 +0,0 @@
---TEST--
-MongoDB\Driver\Cursor get_iterator handler does not yield multiple iterators (IteratorIterator)
---SKIPIF--
-<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
-<?php skip_if_not_live(); ?>
-<?php skip_if_not_clean(); ?>
---FILE--
-<?php
-require_once __DIR__ . "/../utils/basic.inc";
-
-$manager = new MongoDB\Driver\Manager(URI);
-
-$bulkWrite = new MongoDB\Driver\BulkWrite;
-
-for ($i = 0; $i < 3; $i++) {
- $bulkWrite->insert(array('_id' => $i));
-}
-
-$writeResult = $manager->executeBulkWrite(NS, $bulkWrite);
-printf("Inserted: %d\n", $writeResult->getInsertedCount());
-
-$cursor = $manager->executeQuery(NS, new MongoDB\Driver\Query(array()));
-
-echo "\nFirst IteratorIterator wrapping:\n";
-
-var_dump(new IteratorIterator($cursor));
-
-echo "\nSecond IteratorIterator wrapping:\n";
-
-try {
- var_dump(new IteratorIterator($cursor));
-} catch (MongoDB\Driver\Exception\LogicException $e) {
- printf("LogicException: %s\n", $e->getMessage());
-}
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECTF--
-Inserted: 3
-
-First IteratorIterator wrapping:
-object(IteratorIterator)#%d (0) {
-}
-
-Second IteratorIterator wrapping:
-LogicException: Cursors cannot yield multiple iterators
-===DONE===
diff --git a/mongodb-1.8.1/tests/cursor/cursor-get_iterator-003.phpt b/mongodb-1.8.1/tests/cursor/cursor-get_iterator-003.phpt
deleted file mode 100644
index 1b51b3f0..00000000
--- a/mongodb-1.8.1/tests/cursor/cursor-get_iterator-003.phpt
+++ /dev/null
@@ -1,63 +0,0 @@
---TEST--
-MongoDB\Driver\Cursor get_iterator handler does not yield multiple iterators (toArray())
---SKIPIF--
-<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
-<?php skip_if_not_live(); ?>
-<?php skip_if_not_clean(); ?>
---FILE--
-<?php
-require_once __DIR__ . "/../utils/basic.inc";
-
-$manager = new MongoDB\Driver\Manager(URI);
-
-$bulkWrite = new MongoDB\Driver\BulkWrite;
-
-for ($i = 0; $i < 3; $i++) {
- $bulkWrite->insert(array('_id' => $i));
-}
-
-$writeResult = $manager->executeBulkWrite(NS, $bulkWrite);
-printf("Inserted: %d\n", $writeResult->getInsertedCount());
-
-$cursor = $manager->executeQuery(NS, new MongoDB\Driver\Query(array()));
-
-echo "\nFirst Cursor::toArray():\n";
-
- var_dump($cursor->toArray());
-
-echo "\nSecond Cursor::toArray():\n";
-
-try {
- var_dump($cursor->toArray());
-} catch (MongoDB\Driver\Exception\LogicException $e) {
- printf("LogicException: %s\n", $e->getMessage());
-}
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECTF--
-Inserted: 3
-
-First Cursor::toArray():
-array(3) {
- [0]=>
- object(stdClass)#%d (1) {
- ["_id"]=>
- int(0)
- }
- [1]=>
- object(stdClass)#%d (1) {
- ["_id"]=>
- int(1)
- }
- [2]=>
- object(stdClass)#%d (1) {
- ["_id"]=>
- int(2)
- }
-}
-
-Second Cursor::toArray():
-LogicException: Cursors cannot yield multiple iterators
-===DONE===
diff --git a/mongodb-1.8.1/tests/manager/manager-ctor_error-001.phpt b/mongodb-1.8.1/tests/manager/manager-ctor_error-001.phpt
deleted file mode 100644
index 40660fc7..00000000
--- a/mongodb-1.8.1/tests/manager/manager-ctor_error-001.phpt
+++ /dev/null
@@ -1,18 +0,0 @@
---TEST--
-MongoDB\Driver\Manager::__construct(): too many arguments
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-echo throws(function() {
- $manager = new MongoDB\Driver\Manager(null, [], [], 1);
-}, "MongoDB\Driver\Exception\InvalidArgumentException"), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-OK: Got MongoDB\Driver\Exception\InvalidArgumentException
-MongoDB\Driver\Manager::__construct() expects at most 3 parameters, 4 given
-===DONE===
diff --git a/mongodb-1.8.1/tests/manager/manager-executeQuery-006.phpt b/mongodb-1.8.1/tests/manager/manager-executeQuery-006.phpt
deleted file mode 100644
index 7c3132c7..00000000
--- a/mongodb-1.8.1/tests/manager/manager-executeQuery-006.phpt
+++ /dev/null
@@ -1,56 +0,0 @@
---TEST--
-MongoDB\Driver\Manager::executeQuery() pins transaction to server
---SKIPIF--
-<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
-<?php skip_if_not_mongos_with_replica_set(); ?>
-<?php skip_if_server_version('<', '4.1.6'); ?>
-<?php skip_if_not_clean(); ?>
---FILE--
-<?php
-require_once __DIR__ . "/../utils/basic.inc";
-
-$manager = new MongoDB\Driver\Manager(URI);
-
-/* Create collections as that can't be (automatically) done in a transaction */
-$manager->executeReadWriteCommand(
- DATABASE_NAME,
- new \MongoDB\Driver\Command([ 'create' => COLLECTION_NAME ]),
- [ 'writeConcern' => new \MongoDB\Driver\WriteConcern( \MongoDB\Driver\WriteConcern::MAJORITY ) ]
-);
-
-$session = $manager->startSession();
-var_dump($session->getServer() instanceof \MongoDB\Driver\Server);
-
-$session->startTransaction();
-var_dump($session->getServer() instanceof \MongoDB\Driver\Server);
-
-$query = new MongoDB\Driver\Query([]);
-$manager->executeQuery(NS, $query, ['session' => $session]);
-
-$pinnedServer = $session->getServer();
-var_dump($pinnedServer instanceof \MongoDB\Driver\Server);
-
-$bulk = new MongoDB\Driver\BulkWrite();
-$bulk->insert(['x' => 1]);
-$manager->executeBulkWrite(NS, $bulk, ['session' => $session]);
-
-$session->commitTransaction();
-
-var_dump($session->getServer() == $pinnedServer);
-
-$bulk = new MongoDB\Driver\BulkWrite();
-$bulk->insert(['x' => 1]);
-$manager->executeBulkWrite(NS, $bulk, ['session' => $session]);
-
-var_dump($session->getServer() instanceof \MongoDB\Driver\Server);
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-bool(false)
-bool(false)
-bool(true)
-bool(true)
-bool(false)
-===DONE===
diff --git a/mongodb-1.8.1/tests/manager/manager-executeReadCommand-002.phpt b/mongodb-1.8.1/tests/manager/manager-executeReadCommand-002.phpt
deleted file mode 100644
index c3a1758c..00000000
--- a/mongodb-1.8.1/tests/manager/manager-executeReadCommand-002.phpt
+++ /dev/null
@@ -1,60 +0,0 @@
---TEST--
-MongoDB\Driver\Manager::executeReadCommand() pins transaction to server
---SKIPIF--
-<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
-<?php skip_if_not_mongos_with_replica_set(); ?>
-<?php skip_if_server_version('<', '4.1.6'); ?>
-<?php skip_if_not_clean(); ?>
---FILE--
-<?php
-require_once __DIR__ . "/../utils/basic.inc";
-
-$manager = new MongoDB\Driver\Manager(URI);
-
-/* Create collections as that can't be (automatically) done in a transaction */
-$manager->executeReadCommand(
- DATABASE_NAME,
- new \MongoDB\Driver\Command([ 'create' => COLLECTION_NAME ]),
- [ 'writeConcern' => new \MongoDB\Driver\WriteConcern( \MongoDB\Driver\WriteConcern::MAJORITY ) ]
-);
-
-$session = $manager->startSession();
-var_dump($session->getServer() instanceof \MongoDB\Driver\Server);
-
-$session->startTransaction();
-var_dump($session->getServer() instanceof \MongoDB\Driver\Server);
-
-$command = new MongoDB\Driver\Command([
- 'aggregate' => COLLECTION_NAME,
- 'pipeline' => [['$group' => ['_id' => 1]]],
- 'cursor' => (object) []
-]);
-$manager->executeReadCommand(DATABASE_NAME, $command, ['session' => $session]);
-
-$pinnedServer = $session->getServer();
-var_dump($pinnedServer instanceof \MongoDB\Driver\Server);
-
-$bulk = new MongoDB\Driver\BulkWrite();
-$bulk->insert(['x' => 1]);
-$manager->executeBulkWrite(NS, $bulk, ['session' => $session]);
-
-$session->commitTransaction();
-
-var_dump($session->getServer() == $pinnedServer);
-
-$bulk = new MongoDB\Driver\BulkWrite();
-$bulk->insert(['x' => 1]);
-$manager->executeBulkWrite(NS, $bulk, ['session' => $session]);
-
-var_dump($session->getServer() instanceof \MongoDB\Driver\Server);
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-bool(false)
-bool(false)
-bool(true)
-bool(true)
-bool(false)
-===DONE===
diff --git a/mongodb-1.8.1/tests/manager/manager-executeReadWriteCommand-001.phpt b/mongodb-1.8.1/tests/manager/manager-executeReadWriteCommand-001.phpt
deleted file mode 100644
index f06fb4f0..00000000
--- a/mongodb-1.8.1/tests/manager/manager-executeReadWriteCommand-001.phpt
+++ /dev/null
@@ -1,42 +0,0 @@
---TEST--
-MongoDB\Driver\Manager::executeReadWriteCommand()
---SKIPIF--
-<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
-<?php skip_if_not_live(); ?>
-<?php skip_if_not_clean(); ?>
-<?php skip_if_server_version('<', '3.2'); ?>
---FILE--
-<?php
-require_once __DIR__ . "/../utils/basic.inc";
-require_once __DIR__ . "/../utils/observer.php";
-
-$manager = new MongoDB\Driver\Manager(URI);
-
-(new CommandObserver)->observe(
- function() use ($manager) {
- $command = new MongoDB\Driver\Command( [
- 'findAndModify' => NS,
- 'update' => [ '$set' => [ 'foo' => 'bar' ] ],
- ] );
- $manager->executeReadWriteCommand(
- DATABASE_NAME,
- $command,
- [
- 'readConcern' => new \MongoDB\Driver\ReadConcern(\MongoDB\Driver\ReadConcern::LOCAL),
- 'writeConcern' => new \MongoDB\Driver\WriteConcern(\MongoDB\Driver\WriteConcern::MAJORITY),
- ]
- );
- },
- function(stdClass $command) {
- echo "Read Concern: ", $command->readConcern->level, "\n";
- echo "Write Concern: ", $command->writeConcern->w, "\n";
- }
-);
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECTF--
-Read Concern: local
-Write Concern: majority
-===DONE===
diff --git a/mongodb-1.8.1/tests/manager/manager-executeReadWriteCommand-002.phpt b/mongodb-1.8.1/tests/manager/manager-executeReadWriteCommand-002.phpt
deleted file mode 100644
index ac18c7e2..00000000
--- a/mongodb-1.8.1/tests/manager/manager-executeReadWriteCommand-002.phpt
+++ /dev/null
@@ -1,60 +0,0 @@
---TEST--
-MongoDB\Driver\Manager::executeReadWriteCommand() pins transaction to server
---SKIPIF--
-<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
-<?php skip_if_not_mongos_with_replica_set(); ?>
-<?php skip_if_server_version('<', '4.1.6'); ?>
-<?php skip_if_not_clean(); ?>
---FILE--
-<?php
-require_once __DIR__ . "/../utils/basic.inc";
-
-$manager = new MongoDB\Driver\Manager(URI);
-
-/* Create collections as that can't be (automatically) done in a transaction */
-$manager->executeReadWriteCommand(
- DATABASE_NAME,
- new \MongoDB\Driver\Command([ 'create' => COLLECTION_NAME ]),
- [ 'writeConcern' => new \MongoDB\Driver\WriteConcern( \MongoDB\Driver\WriteConcern::MAJORITY ) ]
-);
-
-$session = $manager->startSession();
-var_dump($session->getServer() instanceof \MongoDB\Driver\Server);
-
-$session->startTransaction();
-var_dump($session->getServer() instanceof \MongoDB\Driver\Server);
-
-$command = new MongoDB\Driver\Command([
- 'aggregate' => COLLECTION_NAME,
- 'pipeline' => [['$group' => ['_id' => 1]]],
- 'cursor' => (object) []
-]);
-$manager->executeReadWriteCommand(DATABASE_NAME, $command, ['session' => $session]);
-
-$pinnedServer = $session->getServer();
-var_dump($pinnedServer instanceof \MongoDB\Driver\Server);
-
-$bulk = new MongoDB\Driver\BulkWrite();
-$bulk->insert(['x' => 1]);
-$manager->executeBulkWrite(NS, $bulk, ['session' => $session]);
-
-$session->commitTransaction();
-
-var_dump($session->getServer() == $pinnedServer);
-
-$bulk = new MongoDB\Driver\BulkWrite();
-$bulk->insert(['x' => 1]);
-$manager->executeBulkWrite(NS, $bulk, ['session' => $session]);
-
-var_dump($session->getServer() instanceof \MongoDB\Driver\Server);
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-bool(false)
-bool(false)
-bool(true)
-bool(true)
-bool(false)
-===DONE===
diff --git a/mongodb-1.8.1/tests/manager/manager-executeWriteCommand-002.phpt b/mongodb-1.8.1/tests/manager/manager-executeWriteCommand-002.phpt
deleted file mode 100644
index c88d8e40..00000000
--- a/mongodb-1.8.1/tests/manager/manager-executeWriteCommand-002.phpt
+++ /dev/null
@@ -1,62 +0,0 @@
---TEST--
-MongoDB\Driver\Manager::executeWriteCommand() pins transaction to server
---SKIPIF--
-<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
-<?php skip_if_not_mongos_with_replica_set(); ?>
-<?php skip_if_server_version('<', '4.1.6'); ?>
-<?php skip_if_not_clean(); ?>
---FILE--
-<?php
-require_once __DIR__ . "/../utils/basic.inc";
-
-$manager = new MongoDB\Driver\Manager(URI);
-
-/* Create collections as that can't be (automatically) done in a transaction */
-$manager->executeReadWriteCommand(
- DATABASE_NAME,
- new \MongoDB\Driver\Command([ 'create' => COLLECTION_NAME ]),
- [ 'writeConcern' => new \MongoDB\Driver\WriteConcern( \MongoDB\Driver\WriteConcern::MAJORITY ) ]
-);
-
-$session = $manager->startSession();
-var_dump($session->getServer() instanceof \MongoDB\Driver\Server);
-
-$session->startTransaction();
-var_dump($session->getServer() instanceof \MongoDB\Driver\Server);
-
-$command = new MongoDB\Driver\Command([
- 'findAndModify' => COLLECTION_NAME,
- 'query' => ['_id' => 'foo'],
- 'upsert' => true,
- 'new' => true,
- 'update' => ['x' => 1]
-]);
-$manager->executeWriteCommand(DATABASE_NAME, $command, ['session' => $session]);
-
-$pinnedServer = $session->getServer();
-var_dump($pinnedServer instanceof \MongoDB\Driver\Server);
-
-$bulk = new MongoDB\Driver\BulkWrite();
-$bulk->insert(['x' => 1]);
-$manager->executeBulkWrite(NS, $bulk, ['session' => $session]);
-
-$session->commitTransaction();
-
-var_dump($session->getServer() == $pinnedServer);
-
-$bulk = new MongoDB\Driver\BulkWrite();
-$bulk->insert(['x' => 1]);
-$manager->executeBulkWrite(NS, $bulk, ['session' => $session]);
-
-var_dump($session->getServer() instanceof \MongoDB\Driver\Server);
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-bool(false)
-bool(false)
-bool(true)
-bool(true)
-bool(false)
-===DONE===
diff --git a/mongodb-1.8.1/tests/manager/manager-wakeup.phpt b/mongodb-1.8.1/tests/manager/manager-wakeup.phpt
deleted file mode 100644
index 3b460b47..00000000
--- a/mongodb-1.8.1/tests/manager/manager-wakeup.phpt
+++ /dev/null
@@ -1,22 +0,0 @@
---TEST--
-MongoDB\Driver\Manager: Manager cannot be woken up
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-$manager = new MongoDB\Driver\Manager();
-throws(function() use($manager) {
- $manager->__wakeup();
-}, "MongoDB\Driver\Exception\RuntimeException");
-
-$manager->__wakeup(1, 2);
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECTF--
-OK: Got MongoDB\Driver\Exception\RuntimeException
-
-Warning: MongoDB\Driver\Manager::__wakeup() expects exactly 0 parameters, 2 given in %s on line %d
-===DONE===
diff --git a/mongodb-1.8.1/tests/readConcern/readconcern-ctor_error-001.phpt b/mongodb-1.8.1/tests/readConcern/readconcern-ctor_error-001.phpt
deleted file mode 100644
index 8ccfe195..00000000
--- a/mongodb-1.8.1/tests/readConcern/readconcern-ctor_error-001.phpt
+++ /dev/null
@@ -1,17 +0,0 @@
---TEST--
-MongoDB\Driver\ReadConcern construction (invalid arguments)
---FILE--
-<?php
-require_once __DIR__ . "/../utils/basic.inc";
-
-echo throws(function() {
- new MongoDB\Driver\ReadConcern("string", 1);
-}, 'MongoDB\Driver\Exception\InvalidArgumentException'), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-OK: Got MongoDB\Driver\Exception\InvalidArgumentException
-MongoDB\Driver\ReadConcern::__construct() expects at most 1 parameter, 2 given
-===DONE===
diff --git a/mongodb-1.8.1/tests/readConcern/readconcern-ctor_error-002.phpt b/mongodb-1.8.1/tests/readConcern/readconcern-ctor_error-002.phpt
deleted file mode 100644
index 3ec691ba..00000000
--- a/mongodb-1.8.1/tests/readConcern/readconcern-ctor_error-002.phpt
+++ /dev/null
@@ -1,26 +0,0 @@
---TEST--
-MongoDB\Driver\ReadConcern construction (invalid level type)
---FILE--
-<?php
-require_once __DIR__ . "/../utils/basic.inc";
-
-$tests = [
- [],
- new stdClass,
-];
-
-foreach ($tests as $test) {
- echo throws(function() use ($test) {
- new MongoDB\Driver\ReadConcern($test);
- }, 'MongoDB\Driver\Exception\InvalidArgumentException'), "\n";
-}
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECTF--
-OK: Got MongoDB\Driver\Exception\InvalidArgumentException
-MongoDB\Driver\ReadConcern::__construct() expects parameter 1 to be string, array given
-OK: Got MongoDB\Driver\Exception\InvalidArgumentException
-MongoDB\Driver\ReadConcern::__construct() expects parameter 1 to be string, object given
-===DONE===
diff --git a/mongodb-1.8.1/tests/server/server-errors.phpt b/mongodb-1.8.1/tests/server/server-errors.phpt
deleted file mode 100644
index 4a93cb5f..00000000
--- a/mongodb-1.8.1/tests/server/server-errors.phpt
+++ /dev/null
@@ -1,62 +0,0 @@
---TEST--
-MongoDB\Driver\Server::executeQuery() with sort and empty filter
---SKIPIF--
-<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
-<?php skip_if_not_live(); ?>
-<?php skip_if_not_clean(); ?>
---FILE--
-<?php
-require_once __DIR__ . "/../utils/basic.inc";
-
-$manager = new MongoDB\Driver\Manager(URI);
-$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.8.1/tests/server/server-executeQuery-012.phpt b/mongodb-1.8.1/tests/server/server-executeQuery-012.phpt
deleted file mode 100644
index 17110785..00000000
--- a/mongodb-1.8.1/tests/server/server-executeQuery-012.phpt
+++ /dev/null
@@ -1,68 +0,0 @@
---TEST--
-MongoDB\Driver\Server::executeQuery() pins transaction to server
---SKIPIF--
-<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
-<?php skip_if_not_mongos_with_replica_set(); ?>
-<?php skip_if_server_version('<', '4.1.6'); ?>
-<?php skip_if_not_clean(); ?>
---FILE--
-<?php
-require_once __DIR__ . "/../utils/basic.inc";
-
-$manager = new MongoDB\Driver\Manager(URI);
-
-/* Create collections as that can't be (automatically) done in a transaction */
-$manager->executeReadWriteCommand(
- DATABASE_NAME,
- new \MongoDB\Driver\Command([ 'create' => COLLECTION_NAME ]),
- [ 'writeConcern' => new \MongoDB\Driver\WriteConcern( \MongoDB\Driver\WriteConcern::MAJORITY ) ]
-);
-
-$servers = $manager->getServers();
-$selectedServer = array_pop($servers);
-$wrongServer = array_pop($servers);
-var_dump($selectedServer != $wrongServer);
-
-$session = $manager->startSession();
-var_dump($session->getServer() instanceof \MongoDB\Driver\Server);
-
-$session->startTransaction();
-var_dump($session->getServer() instanceof \MongoDB\Driver\Server);
-
-$query = new MongoDB\Driver\Query([]);
-$selectedServer->executeQuery(NS, $query, ['session' => $session]);
-
-var_dump($session->getServer() == $selectedServer);
-
-$bulk = new MongoDB\Driver\BulkWrite();
-$bulk->insert(['x' => 1]);
-$selectedServer->executeBulkWrite(NS, $bulk, ['session' => $session]);
-
-echo throws(function () use ($wrongServer, $session) {
- $query = new MongoDB\Driver\Query([]);
- $wrongServer->executeQuery(NS, $query, ['session' => $session]);
-}, \MongoDB\Driver\Exception\RuntimeException::class), "\n";
-
-$session->commitTransaction();
-
-var_dump($session->getServer() == $selectedServer);
-
-$bulk = new MongoDB\Driver\BulkWrite();
-$bulk->insert(['x' => 1]);
-$selectedServer->executeBulkWrite(NS, $bulk, ['session' => $session]);
-
-var_dump($session->getServer() instanceof \MongoDB\Driver\Server);
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-bool(true)
-bool(false)
-bool(false)
-bool(true)
-OK: Got MongoDB\Driver\Exception\RuntimeException
-Requested server id does not matched pinned server id
-bool(true)
-bool(false)
-===DONE===
diff --git a/mongodb-1.8.1/tests/server/server-executeReadCommand-002.phpt b/mongodb-1.8.1/tests/server/server-executeReadCommand-002.phpt
deleted file mode 100644
index 610bcc63..00000000
--- a/mongodb-1.8.1/tests/server/server-executeReadCommand-002.phpt
+++ /dev/null
@@ -1,76 +0,0 @@
---TEST--
-MongoDB\Driver\Session test: Manager::executeReadCommand pins transaction to server
---SKIPIF--
-<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
-<?php skip_if_not_mongos_with_replica_set(); ?>
-<?php skip_if_server_version('<', '4.1.6'); ?>
-<?php skip_if_not_clean(); ?>
---FILE--
-<?php
-require_once __DIR__ . "/../utils/basic.inc";
-
-$manager = new MongoDB\Driver\Manager(URI);
-
-/* Create collections as that can't be (automatically) done in a transaction */
-$manager->executeReadCommand(
- DATABASE_NAME,
- new \MongoDB\Driver\Command([ 'create' => COLLECTION_NAME ]),
- [ 'writeConcern' => new \MongoDB\Driver\WriteConcern( \MongoDB\Driver\WriteConcern::MAJORITY ) ]
-);
-
-$servers = $manager->getServers();
-$selectedServer = array_pop($servers);
-$wrongServer = array_pop($servers);
-var_dump($selectedServer != $wrongServer);
-
-$session = $manager->startSession();
-var_dump($session->getServer() instanceof \MongoDB\Driver\Server);
-
-$session->startTransaction();
-var_dump($session->getServer() instanceof \MongoDB\Driver\Server);
-
-$command = new MongoDB\Driver\Command([
- 'aggregate' => COLLECTION_NAME,
- 'pipeline' => [['$group' => ['_id' => 1]]],
- 'cursor' => (object) []
-]);
-$selectedServer->executeReadCommand(DATABASE_NAME, $command, ['session' => $session]);
-
-var_dump($session->getServer() instanceof \MongoDB\Driver\Server);
-
-$bulk = new MongoDB\Driver\BulkWrite();
-$bulk->insert(['x' => 1]);
-$selectedServer->executeBulkWrite(NS, $bulk, ['session' => $session]);
-
-echo throws(function () use ($wrongServer, $session) {
- $command = new MongoDB\Driver\Command([
- 'aggregate' => COLLECTION_NAME,
- 'pipeline' => [['$group' => ['_id' => 1]]],
- 'cursor' => (object) []
- ]);
- $wrongServer->executeReadCommand(DATABASE_NAME, $command, ['session' => $session]);
-}, \MongoDB\Driver\Exception\RuntimeException::class), "\n";
-
-$session->commitTransaction();
-
-var_dump($session->getServer() instanceof \MongoDB\Driver\Server);
-
-$bulk = new MongoDB\Driver\BulkWrite();
-$bulk->insert(['x' => 1]);
-$selectedServer->executeBulkWrite(NS, $bulk, ['session' => $session]);
-
-var_dump($session->getServer() instanceof \MongoDB\Driver\Server);
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-bool(true)
-bool(false)
-bool(false)
-bool(true)
-OK: Got MongoDB\Driver\Exception\RuntimeException
-Requested server id does not matched pinned server id
-bool(true)
-bool(false)
-===DONE===
diff --git a/mongodb-1.8.1/tests/server/server-executeReadWriteCommand-002.phpt b/mongodb-1.8.1/tests/server/server-executeReadWriteCommand-002.phpt
deleted file mode 100644
index 10b0faa9..00000000
--- a/mongodb-1.8.1/tests/server/server-executeReadWriteCommand-002.phpt
+++ /dev/null
@@ -1,76 +0,0 @@
---TEST--
-MongoDB\Driver\Session test: Manager::executeReadWriteCommand pins transaction to server
---SKIPIF--
-<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
-<?php skip_if_not_mongos_with_replica_set(); ?>
-<?php skip_if_server_version('<', '4.1.6'); ?>
-<?php skip_if_not_clean(); ?>
---FILE--
-<?php
-require_once __DIR__ . "/../utils/basic.inc";
-
-$manager = new MongoDB\Driver\Manager(URI);
-
-/* Create collections as that can't be (automatically) done in a transaction */
-$manager->executeReadWriteCommand(
- DATABASE_NAME,
- new \MongoDB\Driver\Command([ 'create' => COLLECTION_NAME ]),
- [ 'writeConcern' => new \MongoDB\Driver\WriteConcern( \MongoDB\Driver\WriteConcern::MAJORITY ) ]
-);
-
-$servers = $manager->getServers();
-$selectedServer = array_pop($servers);
-$wrongServer = array_pop($servers);
-var_dump($selectedServer != $wrongServer);
-
-$session = $manager->startSession();
-var_dump($session->getServer() instanceof \MongoDB\Driver\Server);
-
-$session->startTransaction();
-var_dump($session->getServer() instanceof \MongoDB\Driver\Server);
-
-$command = new MongoDB\Driver\Command([
- 'aggregate' => COLLECTION_NAME,
- 'pipeline' => [['$group' => ['_id' => 1]]],
- 'cursor' => (object) []
-]);
-$selectedServer->executeReadWriteCommand(DATABASE_NAME, $command, ['session' => $session]);
-
-var_dump($session->getServer() instanceof \MongoDB\Driver\Server);
-
-$bulk = new MongoDB\Driver\BulkWrite();
-$bulk->insert(['x' => 1]);
-$selectedServer->executeBulkWrite(NS, $bulk, ['session' => $session]);
-
-echo throws(function () use ($wrongServer, $session) {
- $command = new MongoDB\Driver\Command([
- 'aggregate' => COLLECTION_NAME,
- 'pipeline' => [['$group' => ['_id' => 1]]],
- 'cursor' => (object) []
- ]);
- $wrongServer->executeReadCommand(DATABASE_NAME, $command, ['session' => $session]);
-}, \MongoDB\Driver\Exception\RuntimeException::class), "\n";
-
-$session->commitTransaction();
-
-var_dump($session->getServer() instanceof \MongoDB\Driver\Server);
-
-$bulk = new MongoDB\Driver\BulkWrite();
-$bulk->insert(['x' => 1]);
-$selectedServer->executeBulkWrite(NS, $bulk, ['session' => $session]);
-
-var_dump($session->getServer() instanceof \MongoDB\Driver\Server);
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-bool(true)
-bool(false)
-bool(false)
-bool(true)
-OK: Got MongoDB\Driver\Exception\RuntimeException
-Requested server id does not matched pinned server id
-bool(true)
-bool(false)
-===DONE===
diff --git a/mongodb-1.8.1/tests/server/server-executeWriteCommand-002.phpt b/mongodb-1.8.1/tests/server/server-executeWriteCommand-002.phpt
deleted file mode 100644
index b2a0bc08..00000000
--- a/mongodb-1.8.1/tests/server/server-executeWriteCommand-002.phpt
+++ /dev/null
@@ -1,80 +0,0 @@
---TEST--
-MongoDB\Driver\Session test: Manager::executeWriteCommand pins transaction to server
---SKIPIF--
-<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
-<?php skip_if_not_mongos_with_replica_set(); ?>
-<?php skip_if_server_version('<', '4.1.6'); ?>
-<?php skip_if_not_clean(); ?>
---FILE--
-<?php
-require_once __DIR__ . "/../utils/basic.inc";
-
-$manager = new MongoDB\Driver\Manager(URI);
-
-/* Create collections as that can't be (automatically) done in a transaction */
-$manager->executeReadWriteCommand(
- DATABASE_NAME,
- new \MongoDB\Driver\Command([ 'create' => COLLECTION_NAME ]),
- [ 'writeConcern' => new \MongoDB\Driver\WriteConcern( \MongoDB\Driver\WriteConcern::MAJORITY ) ]
-);
-
-$servers = $manager->getServers();
-$selectedServer = array_pop($servers);
-$wrongServer = array_pop($servers);
-var_dump($selectedServer != $wrongServer);
-
-$session = $manager->startSession();
-var_dump($session->getServer() instanceof \MongoDB\Driver\Server);
-
-$session->startTransaction();
-var_dump($session->getServer() instanceof \MongoDB\Driver\Server);
-
-$command = new MongoDB\Driver\Command([
- 'findAndModify' => COLLECTION_NAME,
- 'query' => ['_id' => 'foo'],
- 'upsert' => true,
- 'new' => true,
- 'update' => ['x' => 1]
-]);
-$selectedServer->executeWriteCommand(DATABASE_NAME, $command, ['session' => $session]);
-
-var_dump($session->getServer() instanceof \MongoDB\Driver\Server);
-
-$bulk = new MongoDB\Driver\BulkWrite();
-$bulk->insert(['x' => 1]);
-$selectedServer->executeBulkWrite(NS, $bulk, ['session' => $session]);
-
-echo throws(function () use ($wrongServer, $session) {
- $command = new MongoDB\Driver\Command([
- 'findAndModify' => COLLECTION_NAME,
- 'query' => ['_id' => 'foo'],
- 'upsert' => true,
- 'new' => true,
- 'update' => ['x' => 1]
- ]);
- $wrongServer->executeWriteCommand(DATABASE_NAME, $command, ['session' => $session]);
-}, \MongoDB\Driver\Exception\RuntimeException::class), "\n";
-
-$session->commitTransaction();
-
-var_dump($session->getServer() instanceof \MongoDB\Driver\Server);
-
-$bulk = new MongoDB\Driver\BulkWrite();
-$bulk->insert(['x' => 1]);
-$selectedServer->executeBulkWrite(NS, $bulk, ['session' => $session]);
-
-var_dump($session->getServer() instanceof \MongoDB\Driver\Server);
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-bool(true)
-bool(false)
-bool(false)
-bool(true)
-OK: Got MongoDB\Driver\Exception\RuntimeException
-Requested server id does not matched pinned server id
-bool(true)
-bool(false)
-===DONE===
diff --git a/mongodb-1.8.1/tests/session/session-startTransaction_error-002.phpt b/mongodb-1.8.1/tests/session/session-startTransaction_error-002.phpt
deleted file mode 100644
index c319577d..00000000
--- a/mongodb-1.8.1/tests/session/session-startTransaction_error-002.phpt
+++ /dev/null
@@ -1,82 +0,0 @@
---TEST--
-MongoDB\Driver\Session::startTransaction() with wrong values in options array
---SKIPIF--
-<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
-<?php skip_if_not_libmongoc_crypto() ?>
-<?php skip_if_no_transactions(); ?>
---FILE--
-<?php
-require_once __DIR__ . "/../utils/basic.inc";
-
-$manager = new MongoDB\Driver\Manager(URI);
-$session = $manager->startSession();
-
-$options = [
- [ 'maxCommitTimeMS' => -1 ],
- [ 'readConcern' => 42 ],
- [ 'readConcern' => new stdClass ],
- [ 'readConcern' => new \MongoDB\Driver\WriteConcern( 2 ) ],
- [ 'readPreference' => 42 ],
- [ 'readPreference' => new stdClass ],
- [ 'readPreference' => new \MongoDB\Driver\ReadConcern( \MongoDB\Driver\ReadConcern::LOCAL ) ],
- [ 'writeConcern' => 42 ],
- [ 'writeConcern' => new stdClass ],
- [ 'writeConcern' => new \MongoDB\Driver\ReadPreference( \MongoDB\Driver\ReadPreference::RP_SECONDARY ) ],
-
- [
- 'readConcern' => new \MongoDB\Driver\ReadConcern( \MongoDB\Driver\ReadConcern::LOCAL ),
- 'readPreference' => new \MongoDB\Driver\ReadConcern( \MongoDB\Driver\ReadConcern::LOCAL ),
- ],
- [
- 'readConcern' => new \MongoDB\Driver\ReadConcern( \MongoDB\Driver\ReadConcern::LOCAL ),
- 'writeConcern' => new \MongoDB\Driver\ReadPreference( \MongoDB\Driver\ReadPreference::RP_SECONDARY ),
- ],
- [
- 'readPreference' => new \MongoDB\Driver\ReadPreference( \MongoDB\Driver\ReadPreference::RP_SECONDARY ),
- 'writeConcern' => new \MongoDB\Driver\ReadPreference( \MongoDB\Driver\ReadPreference::RP_SECONDARY ),
- ],
-];
-
-foreach ($options as $txnOptions) {
- echo throws(function() use ($session, $txnOptions) {
- $session->startTransaction($txnOptions);
- }, 'MongoDB\Driver\Exception\InvalidArgumentException'), "\n";
-}
-
-echo raises(function() use ($session) {
- $session->startTransaction([ 'maxCommitTimeMS' => new stdClass ]);
-}, E_NOTICE), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECTF--
-OK: Got MongoDB\Driver\Exception\InvalidArgumentException
-Expected "maxCommitTimeMS" option to be >= 0, -1 given
-OK: Got MongoDB\Driver\Exception\InvalidArgumentException
-Expected "readConcern" option to be MongoDB\Driver\ReadConcern, int%S given
-OK: Got MongoDB\Driver\Exception\InvalidArgumentException
-Expected "readConcern" option to be MongoDB\Driver\ReadConcern, stdClass given
-OK: Got MongoDB\Driver\Exception\InvalidArgumentException
-Expected "readConcern" option to be MongoDB\Driver\ReadConcern, MongoDB\Driver\WriteConcern given
-OK: Got MongoDB\Driver\Exception\InvalidArgumentException
-Expected "readPreference" option to be MongoDB\Driver\ReadPreference, int%S given
-OK: Got MongoDB\Driver\Exception\InvalidArgumentException
-Expected "readPreference" option to be MongoDB\Driver\ReadPreference, stdClass given
-OK: Got MongoDB\Driver\Exception\InvalidArgumentException
-Expected "readPreference" option to be MongoDB\Driver\ReadPreference, MongoDB\Driver\ReadConcern given
-OK: Got MongoDB\Driver\Exception\InvalidArgumentException
-Expected "writeConcern" option to be MongoDB\Driver\WriteConcern, int%S given
-OK: Got MongoDB\Driver\Exception\InvalidArgumentException
-Expected "writeConcern" option to be MongoDB\Driver\WriteConcern, stdClass given
-OK: Got MongoDB\Driver\Exception\InvalidArgumentException
-Expected "writeConcern" option to be MongoDB\Driver\WriteConcern, MongoDB\Driver\ReadPreference given
-OK: Got MongoDB\Driver\Exception\InvalidArgumentException
-Expected "readPreference" option to be MongoDB\Driver\ReadPreference, MongoDB\Driver\ReadConcern given
-OK: Got MongoDB\Driver\Exception\InvalidArgumentException
-Expected "writeConcern" option to be MongoDB\Driver\WriteConcern, MongoDB\Driver\ReadPreference given
-OK: Got MongoDB\Driver\Exception\InvalidArgumentException
-Expected "writeConcern" option to be MongoDB\Driver\WriteConcern, MongoDB\Driver\ReadPreference given
-OK: Got E_NOTICE
-Object of class stdClass could not be converted to int
-===DONE===
diff --git a/mongodb-1.8.1/tests/session/session-startTransaction_error-004.phpt b/mongodb-1.8.1/tests/session/session-startTransaction_error-004.phpt
deleted file mode 100644
index dafda735..00000000
--- a/mongodb-1.8.1/tests/session/session-startTransaction_error-004.phpt
+++ /dev/null
@@ -1,34 +0,0 @@
---TEST--
-MongoDB\Driver\Session::startTransaction() with wrong argument for options array on PHP 7.0
---SKIPIF--
-<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
-<?php skip_if_not_libmongoc_crypto() ?>
-<?php skip_if_no_transactions(); ?>
-<?php skip_if_php_version('>=', '7.1.0'); ?>
---FILE--
-<?php
-require_once __DIR__ . "/../utils/basic.inc";
-
-$manager = new MongoDB\Driver\Manager(URI);
-$session = $manager->startSession();
-
-$options = [
- 2,
- new stdClass,
-];
-
-foreach ($options as $txnOptions) {
- echo throws(function () use ($session, $txnOptions) {
- $session->startTransaction($txnOptions);
- }, TypeError::class), "\n";
-}
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECTF--
-OK: Got TypeError
-Argument 1 passed to MongoDB\Driver\Session::startTransaction() must be of the type array, int%S given
-OK: Got TypeError
-Argument 1 passed to MongoDB\Driver\Session::startTransaction() must be of the type array, object given
-===DONE===
diff --git a/mongodb-1.8.1/tests/session/session-startTransaction_error-005.phpt b/mongodb-1.8.1/tests/session/session-startTransaction_error-005.phpt
deleted file mode 100644
index 324f5b42..00000000
--- a/mongodb-1.8.1/tests/session/session-startTransaction_error-005.phpt
+++ /dev/null
@@ -1,34 +0,0 @@
---TEST--
-MongoDB\Driver\Session::startTransaction() with wrong argument for options array on PHP 7
---SKIPIF--
-<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
-<?php skip_if_not_libmongoc_crypto() ?>
-<?php skip_if_no_transactions(); ?>
-<?php skip_if_php_version('<', '7.1.0'); ?>
---FILE--
-<?php
-require_once __DIR__ . "/../utils/basic.inc";
-
-$manager = new MongoDB\Driver\Manager(URI);
-$session = $manager->startSession();
-
-$options = [
- 2,
- new stdClass,
-];
-
-foreach ($options as $txnOptions) {
- echo throws(function () use ($session, $txnOptions) {
- $session->startTransaction($txnOptions);
- }, TypeError::class), "\n";
-}
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECTF--
-OK: Got TypeError
-Argument 1 passed to MongoDB\Driver\Session::startTransaction() must be of the type array or null, int%S given
-OK: Got TypeError
-Argument 1 passed to MongoDB\Driver\Session::startTransaction() must be of the type array or null, object given
-===DONE===
diff --git a/mongodb-1.8.1/tests/session/session_error-001.phpt b/mongodb-1.8.1/tests/session/session_error-001.phpt
deleted file mode 100644
index 967e0e1d..00000000
--- a/mongodb-1.8.1/tests/session/session_error-001.phpt
+++ /dev/null
@@ -1,88 +0,0 @@
---TEST--
-MongoDB\Driver\Session with wrong defaultTransactionOptions
---FILE--
-<?php
-require_once __DIR__ . "/../utils/basic.inc";
-
-$manager = new MongoDB\Driver\Manager();
-
-$options = [
- [ 'maxCommitTimeMS' => -1 ],
- [ 'readConcern' => 42 ],
- [ 'readConcern' => new stdClass ],
- [ 'readConcern' => new \MongoDB\Driver\WriteConcern( 2 ) ],
- [ 'readPreference' => 42 ],
- [ 'readPreference' => new stdClass ],
- [ 'readPreference' => new \MongoDB\Driver\ReadConcern( \MongoDB\Driver\ReadConcern::LOCAL ) ],
- [ 'writeConcern' => 42 ],
- [ 'writeConcern' => new stdClass ],
- [ 'writeConcern' => new \MongoDB\Driver\ReadPreference( \MongoDB\Driver\ReadPreference::RP_SECONDARY ) ],
-
- [
- 'readConcern' => new \MongoDB\Driver\ReadConcern( \MongoDB\Driver\ReadConcern::LOCAL ),
- 'readPreference' => new \MongoDB\Driver\ReadConcern( \MongoDB\Driver\ReadConcern::LOCAL ),
- ],
- [
- 'readConcern' => new \MongoDB\Driver\ReadConcern( \MongoDB\Driver\ReadConcern::LOCAL ),
- 'writeConcern' => new \MongoDB\Driver\ReadPreference( \MongoDB\Driver\ReadPreference::RP_SECONDARY ),
- ],
- [
- 'readPreference' => new \MongoDB\Driver\ReadPreference( \MongoDB\Driver\ReadPreference::RP_SECONDARY ),
- 'writeConcern' => new \MongoDB\Driver\ReadPreference( \MongoDB\Driver\ReadPreference::RP_SECONDARY ),
- ],
-
- 42,
- new stdClass,
-];
-
-foreach ($options as $txnOptions) {
- echo throws(function() use ($manager, $txnOptions) {
- $manager->startSession([
- 'defaultTransactionOptions' => $txnOptions
- ]);
- }, 'MongoDB\Driver\Exception\InvalidArgumentException'), "\n";
-}
-
-echo raises(function() use ($manager) {
- $manager->startSession([
- 'defaultTransactionOptions' => [ 'maxCommitTimeMS' => new stdClass ]
- ]);
-}, E_NOTICE), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECTF--
-OK: Got MongoDB\Driver\Exception\InvalidArgumentException
-Expected "maxCommitTimeMS" option to be >= 0, -1 given
-OK: Got MongoDB\Driver\Exception\InvalidArgumentException
-Expected "readConcern" option to be MongoDB\Driver\ReadConcern, int%S given
-OK: Got MongoDB\Driver\Exception\InvalidArgumentException
-Expected "readConcern" option to be MongoDB\Driver\ReadConcern, stdClass given
-OK: Got MongoDB\Driver\Exception\InvalidArgumentException
-Expected "readConcern" option to be MongoDB\Driver\ReadConcern, MongoDB\Driver\WriteConcern given
-OK: Got MongoDB\Driver\Exception\InvalidArgumentException
-Expected "readPreference" option to be MongoDB\Driver\ReadPreference, int%S given
-OK: Got MongoDB\Driver\Exception\InvalidArgumentException
-Expected "readPreference" option to be MongoDB\Driver\ReadPreference, stdClass given
-OK: Got MongoDB\Driver\Exception\InvalidArgumentException
-Expected "readPreference" option to be MongoDB\Driver\ReadPreference, MongoDB\Driver\ReadConcern given
-OK: Got MongoDB\Driver\Exception\InvalidArgumentException
-Expected "writeConcern" option to be MongoDB\Driver\WriteConcern, int%S given
-OK: Got MongoDB\Driver\Exception\InvalidArgumentException
-Expected "writeConcern" option to be MongoDB\Driver\WriteConcern, stdClass given
-OK: Got MongoDB\Driver\Exception\InvalidArgumentException
-Expected "writeConcern" option to be MongoDB\Driver\WriteConcern, MongoDB\Driver\ReadPreference given
-OK: Got MongoDB\Driver\Exception\InvalidArgumentException
-Expected "readPreference" option to be MongoDB\Driver\ReadPreference, MongoDB\Driver\ReadConcern given
-OK: Got MongoDB\Driver\Exception\InvalidArgumentException
-Expected "writeConcern" option to be MongoDB\Driver\WriteConcern, MongoDB\Driver\ReadPreference given
-OK: Got MongoDB\Driver\Exception\InvalidArgumentException
-Expected "writeConcern" option to be MongoDB\Driver\WriteConcern, MongoDB\Driver\ReadPreference given
-OK: Got MongoDB\Driver\Exception\InvalidArgumentException
-Expected "defaultTransactionOptions" option to be an array, int%S given
-OK: Got MongoDB\Driver\Exception\InvalidArgumentException
-Expected "defaultTransactionOptions" option to be an array, stdClass given
-OK: Got E_NOTICE
-Object of class stdClass could not be converted to int
-===DONE===
diff --git a/mongodb-1.8.1/tests/utils/tools.php b/mongodb-1.8.1/tests/utils/tools.php
deleted file mode 100644
index d541a772..00000000
--- a/mongodb-1.8.1/tests/utils/tools.php
+++ /dev/null
@@ -1,783 +0,0 @@
-<?php
-
-use MongoDB\Driver\BulkWrite;
-use MongoDB\Driver\Command;
-use MongoDB\Driver\Manager;
-use MongoDB\Driver\ReadPreference;
-use MongoDB\Driver\Server;
-use MongoDB\Driver\WriteConcern;
-use MongoDB\Driver\WriteConcernError;
-use MongoDB\Driver\WriteError;
-use MongoDB\Driver\WriteResult;
-use MongoDB\Driver\Exception\ConnectionException;
-use MongoDB\Driver\Exception\RuntimeException;
-
-/**
- * Appends an option to a URI string and returns a new URI.
- *
- * @param string $uri
- * @param string $option
- * @param string $value
- * @return string
- */
-function append_uri_option($uri, $option)
-{
- // Append to existing query string
- if (strpos($uri, '?') !== false) {
- return $uri . '&' . $option;
- }
-
- // Terminate host list and append new query string
- if (parse_url($uri, PHP_URL_PATH) === null) {
- return $uri . '/?' . $option;
- }
-
- // Append query string after terminated host list and possible auth database
- return $uri . '?' . $option;
-}
-
-/**
- * Drops a collection on the primary server.
- *
- * @param string $uri Connection string
- * @param string $databaseName Database name
- * @param string $collectionName Collection name
- * @throws RuntimeException
- */
-function drop_collection($uri, $databaseName, $collectionName)
-{
- $server = get_primary_server($uri);
- $command = new Command(['drop' => $collectionName]);
-
- try {
- /* We need to use WriteConcern::MAJORITY here due to the issue
- * explained in SERVER-35613: "drop" uses a two phase commit, and due
- * to that, it is possible that a lock can't be acquired for a
- * transaction that gets quickly started as the "drop" reaper hasn't
- * completed yet. */
- $server->executeCommand(
- $databaseName,
- $command,
- ['writeConcern' => new WriteConcern(WriteConcern::MAJORITY)]
- );
- } catch (RuntimeException $e) {
- if ($e->getMessage() !== 'ns not found') {
- throw $e;
- }
- }
-}
-
-/**
- * Returns the value of a module row from phpinfo(), or null if it's not found.
- *
- * @param string $row
- * @return string|null
- */
-function get_module_info($row)
-{
- ob_start();
- phpinfo(INFO_MODULES);
- $info = ob_get_clean();
-
- $pattern = sprintf('/^%s([\w ]+)$/m', preg_quote($row . ' => '));
-
- if (preg_match($pattern, $info, $matches) !== 1) {
- return null;
- }
-
- return $matches[1];
-}
-
-/**
- * Returns the primary server.
- *
- * @param string $uri Connection string
- * @return Server
- * @throws ConnectionException
- */
-function get_primary_server($uri)
-{
- return (new Manager($uri))->selectServer(new ReadPreference('primary'));
-}
-
-/**
- * Returns a secondary server.
- *
- * @param string $uri Connection string
- * @return Server
- * @throws ConnectionException
- */
-function get_secondary_server($uri)
-{
- return (new Manager($uri))->selectServer(new ReadPreference('secondary'));
-}
-
-/**
- * Runs a command and returns whether an exception was thrown or not
- *
- * @param string $uri Connection string
- * @param array|object $commandSpec
- * @return bool
- * @throws RuntimeException
- */
-function command_works($uri, $commandSpec)
-{
- $command = new Command($commandSpec);
- $server = get_primary_server($uri);
- try {
- $cursor = $server->executeCommand('admin', $command);
- return true;
- } catch (Exception $e) {
- return false;
- }
-}
-
-/**
- * Returns a parameter of the primary server.
- *
- * @param string $uri Connection string
- * @return mixed
- * @throws RuntimeException
- */
-function get_server_parameter($uri, $parameter)
-{
- $server = get_primary_server($uri);
- $command = new Command(['getParameter' => 1, $parameter => 1]);
- $cursor = $server->executeCommand('admin', $command);
-
- return current($cursor->toArray())->$parameter;
-}
-
-/**
- * Returns the storage engine of the primary server.
- *
- * @param string $uri Connection string
- * @return string
- * @throws RuntimeException
- */
-function get_server_storage_engine($uri)
-{
- $server = get_primary_server($uri);
- $command = new Command(['serverStatus' => 1]);
- $cursor = $server->executeCommand('admin', $command);
-
- return current($cursor->toArray())->storageEngine->name;
-}
-
-/**
- * Helper to return the version of a specific server.
- *
- * @param Server $server
- * @return string
- * @throws RuntimeException
- */
-function get_server_version_from_server(Server $server)
-{
- $command = new Command(['buildInfo' => 1]);
- $cursor = $server->executeCommand('admin', $command);
-
- return current($cursor->toArray())->version;
-}
-
-/**
- * Returns the version of the primary server.
- *
- * @param string $uri Connection string
- * @return string
- * @throws RuntimeException
- */
-function get_server_version($uri)
-{
- $server = get_primary_server($uri);
- return get_server_version_from_server($server);
-}
-
-/**
- * Returns the value of a URI option, or null if it's not found.
- *
- * @param string $uri
- * @return string|null
- */
-function get_uri_option($uri, $option)
-{
- $pattern = sprintf('/[?&]%s=([^&]+)/i', preg_quote($option));
-
- if (preg_match($pattern, $uri, $matches) !== 1) {
- return null;
- }
-
- return $matches[1];
-}
-
-/**
- * Checks that the topology is a sharded cluster.
- *
- * @param string $uri
- * @return boolean
- */
-function is_mongos($uri)
-{
- return get_primary_server($uri)->getType() === Server::TYPE_MONGOS;
-}
-
-/**
- * Checks that the topology is a sharded cluster using a replica set
- */
-function is_mongos_with_replica_set($uri)
-{
- if (! is_mongos($uri)) {
- return false;
- }
-
- $cursor = get_primary_server($uri)->executeQuery(
- 'config.shards',
- new \MongoDB\Driver\Query([], ['limit' => 1])
- );
-
- $cursor->setTypeMap(['root' => 'array', 'document' => 'array']);
- $document = current($cursor->toArray());
-
- if (! $document) {
- return false;
- }
-
- /**
- * Use regular expression to distinguish between standalone or replicaset:
- * Without a replicaset: "host" : "localhost:4100"
- * With a replicaset: "host" : "dec6d8a7-9bc1-4c0e-960c-615f860b956f/localhost:4400,localhost:4401"
- */
- return preg_match('@^.*/.*:\d+@', $document['host']);
-}
-
-/**
- * Checks that the topology is a replica set.
- *
- * @param string $uri
- * @return boolean
- */
-function is_replica_set($uri)
-{
- if (get_primary_server($uri)->getType() !== Server::TYPE_RS_PRIMARY) {
- return false;
- }
-
- if (get_uri_option($uri, 'replicaSet') === NULL) {
- return false;
- }
-
- return true;
-}
-
-/**
- * Checks if the connection string uses authentication.
- *
- * @param string $uri
- * @return boolean
- */
-function is_auth($uri)
-{
- if (stripos($uri, 'authmechanism=') !== false) {
- return true;
- }
-
- if (strpos($uri, ':') !== false && strpos($uri, '@') !== false) {
- return true;
- }
-
- return false;
-}
-
-/**
- * Checks if the connection string uses SSL.
- *
- * @param string $uri
- * @return boolean
- */
-function is_ssl($uri)
-{
- return stripos($uri, 'ssl=true') !== false || stripos($uri, 'tls=true') !== false;
-}
-
-/**
- * Checks that the topology is a standalone.
- *
- * @param string $uri
- * @return boolean
- */
-function is_standalone($uri)
-{
- return get_primary_server($uri)->getType() === Server::TYPE_STANDALONE;
-}
-
-/**
- * Converts the server type constant to a string.
- *
- * @see http://php.net/manual/en/class.mongodb-driver-server.php
- * @param integer $type
- * @return string
- */
-function server_type_as_string($type)
-{
- switch ($type) {
- case Server::TYPE_STANDALONE:
- return 'Standalone';
- case Server::TYPE_MONGOS:
- return 'Mongos';
- case Server::TYPE_POSSIBLE_PRIMARY:
- return 'PossiblePrimary';
- case Server::TYPE_RS_PRIMARY:
- return 'RSPrimary';
- case Server::TYPE_RS_SECONDARY:
- return 'RSSecondary';
- case Server::TYPE_RS_ARBITER:
- return 'RSArbiter';
- case Server::TYPE_RS_OTHER:
- return 'RSOther';
- case Server::TYPE_RS_GHOST:
- return 'RSGhost';
- default:
- return 'Unknown';
- }
-}
-
-/**
- * Converts an errno number to a string.
- *
- * @see http://php.net/manual/en/errorfunc.constants.php
- * @param integer $errno
- * @param string
- */
-function errno_as_string($errno)
-{
- $errors = [
- 'E_ERROR',
- 'E_WARNING',
- 'E_PARSE',
- 'E_NOTICE',
- 'E_CORE_ERROR',
- 'E_CORE_WARNING',
- 'E_COMPILE_ERROR',
- 'E_COMPILE_WARNING',
- 'E_USER_ERROR',
- 'E_USER_WARNING',
- 'E_USER_NOTICE',
- 'E_STRICT',
- 'E_RECOVERABLE_ERROR',
- 'E_DEPRECATED',
- 'E_USER_DEPRECATED',
- 'E_ALL',
- ];
-
- foreach ($errors as $error) {
- if ($errno === constant($error)) {
- return $error;
- }
- }
-
- return 'Unknown';
-}
-
-/**
- * Prints a traditional hex dump of byte values and printable characters.
- *
- * @see http://stackoverflow.com/a/4225813/162228
- * @param string $data Binary data
- * @param integer $width Bytes displayed per line
- */
-function hex_dump($data, $width = 16)
-{
- static $pad = '.'; // Placeholder for non-printable characters
- static $from = '';
- static $to = '';
-
- if ($from === '') {
- for ($i = 0; $i <= 0xFF; $i++) {
- $from .= chr($i);
- $to .= ($i >= 0x20 && $i <= 0x7E) ? chr($i) : $pad;
- }
- }
-
- $hex = str_split(bin2hex($data), $width * 2);
- $chars = str_split(strtr($data, $from, $to), $width);
-
- $offset = 0;
- $length = $width * 3;
-
- foreach ($hex as $i => $line) {
- printf("%6X : %-{$length}s [%s]\n", $offset, implode(' ', str_split($line, 2)), $chars[$i]);
- $offset += $width;
- }
-}
-
-/**
- * Canonicalizes a JSON string.
- *
- * @param string $json
- * @return string
- */
-function json_canonicalize($json)
-{
- $json = json_encode(json_decode($json));
-
- /* Versions of PHP before 7.1 replace empty JSON keys with "_empty_" when
- * decoding to a stdClass (see: https://bugs.php.net/bug.php?id=46600). Work
- * around this by replacing "_empty_" keys before returning.
- */
- return str_replace('"_empty_":', '"":', $json);
-}
-
-/**
- * Return a collection name to use for the test file.
- *
- * The filename will be stripped of the base path to the test suite (prefix) as
- * well as the PHP file extension (suffix). Special characters (including hyphen
- * for shell compatibility) will be replaced with underscores.
- *
- * @param string $filename
- * @return string
- */
-function makeCollectionNameFromFilename($filename)
-{
- $filename = realpath($filename);
- $prefix = realpath(dirname(__FILE__) . '/..') . DIRECTORY_SEPARATOR;
-
- $replacements = array(
- // Strip test path prefix
- sprintf('/^%s/', preg_quote($prefix, '/')) => '',
- // Strip file extension suffix
- '/\.php$/' => '',
- // SKIPIFs add ".skip" between base name and extension
- '/\.skip$/' => '',
- // Replace special characters with underscores
- sprintf('/[%s]/', preg_quote('-$/\\', '/')) => '_',
- );
-
- return preg_replace(array_keys($replacements), array_values($replacements), $filename);
-}
-
-function NEEDS($configuration) {
- if (!constant($configuration)) {
- exit("skip -- need '$configuration' defined");
- }
-}
-function SLOW() {
- if (getenv("SKIP_SLOW_TESTS")) {
- exit("skip SKIP_SLOW_TESTS");
- }
-}
-
-function loadFixtures(Manager $manager, $dbname = DATABASE_NAME, $collname = COLLECTION_NAME, $filename = null)
-{
- if (!$filename) {
- $filename = "compress.zlib://" . __DIR__ . "/" . "PHONGO-FIXTURES.json.gz";
- }
-
- $bulk = new BulkWrite(['ordered' => false]);
-
- $server = $manager->selectServer(new ReadPreference(ReadPreference::RP_PRIMARY));
-
- $data = file_get_contents($filename);
- $array = json_decode($data);
-
- foreach($array as $document) {
- $bulk->insert($document);
- }
-
- $retval = $server->executeBulkWrite("$dbname.$collname", $bulk);
-
- if ($retval->getInsertedCount() !== count($array)) {
- exit(sprintf('skip Fixtures were not loaded (expected: %d, actual: %d)', $total, $retval->getInsertedCount()));
- }
-}
-
-function createTemporaryMongoInstance(array $options = [])
-{
- $id = 'mo_' . COLLECTION_NAME;
- $options += [
- "name" => "mongod",
- "id" => $id,
- 'procParams' => [
- 'logpath' => "/tmp/MO/phongo/{$id}.log",
- 'ipv6' => true,
- 'setParameter' => [ 'enableTestCommands' => 1 ],
- ],
- ];
- $opts = array(
- "http" => array(
- "timeout" => 60,
- "method" => "PUT",
- "header" => "Accept: application/json\r\n" .
- "Content-type: application/x-www-form-urlencoded",
- "content" => json_encode($options),
- "ignore_errors" => true,
- ),
- );
- $ctx = stream_context_create($opts);
- $json = file_get_contents(MONGO_ORCHESTRATION_URI . "/servers/$id", false, $ctx);
- $result = json_decode($json, true);
-
- /* Failed -- or was already started */
- if (!isset($result["mongodb_uri"])) {
- destroyTemporaryMongoInstance($id);
- throw new Exception("Could not start temporary server instance\n");
- } else {
- return $result['mongodb_uri'];
- }
-}
-
-function destroyTemporaryMongoInstance($id = NULL)
-{
- if ($id == NULL) {
- $id = 'mo_' . COLLECTION_NAME;
- }
-
- $opts = array(
- "http" => array(
- "timeout" => 60,
- "method" => "DELETE",
- "header" => "Accept: application/json\r\n",
- "ignore_errors" => true,
- ),
- );
- $ctx = stream_context_create($opts);
- $json = file_get_contents(MONGO_ORCHESTRATION_URI . "/servers/$id", false, $ctx);
-}
-
-function severityToString($type) {
- switch($type) {
- case E_DEPRECATED:
- return "E_DEPRECATED";
- case E_RECOVERABLE_ERROR:
- return "E_RECOVERABLE_ERROR";
- case E_WARNING:
- return "E_WARNING";
- case E_NOTICE:
- return "E_NOTICE";
- default:
- return "Some other #_$type";
- }
-}
-function raises($function, $type, $infunction = null) {
- $errhandler = function($severity, $message, $file, $line, $errcontext) {
- throw new ErrorException($message, 0, $severity, $file, $line);
- };
-
- set_error_handler($errhandler, $type);
- try {
- $function();
- } catch(Exception $e) {
- $exceptionname = get_class($e);
-
- if ($e instanceof ErrorException && $e->getSeverity() & $type) {
- if ($infunction) {
- $trace = $e->getTrace();
- $function = $trace[0]["function"];
- if (strcasecmp($function, $infunction) == 0) {
- printf("OK: Got %s thrown from %s\n", $exceptionname, $infunction);
- } else {
- printf("ALMOST: Got %s - but was thrown in %s, not %s\n", $exceptionname, $function, $infunction);
- }
- restore_error_handler();
- return $e->getMessage();
- }
- printf("OK: Got %s\n", severityToString($type));
- } else {
- printf("ALMOST: Got %s - expected %s\n", get_class($e), $exceptionname);
- }
- restore_error_handler();
- return $e->getMessage();
- }
-
- printf("FAILED: Expected %s thrown!\n", ErrorException::class);
- restore_error_handler();
-}
-function throws($function, $exceptionname, $infunction = null) {
- try {
- $function();
- } catch (Throwable $e) {
- } catch (Exception $e) {
- }
-
- if (!isset($e)) {
- echo "FAILED: Expected $exceptionname thrown, but no exception thrown!\n";
- return;
- }
-
- $message = str_replace(array("\n", "\r"), ' ', $e->getMessage());
- if ($e instanceof $exceptionname) {
- if ($infunction) {
- $trace = $e->getTrace();
- $function = $trace[0]["function"];
- if (strcasecmp($function, $infunction) == 0) {
- printf("OK: Got %s thrown from %s\n", $exceptionname, $infunction);
- } else {
- printf("ALMOST: Got %s - but was thrown in %s, not %s (%s)\n", $exceptionname, $function, $infunction, $message);
- }
- return $e->getMessage();
- }
- printf("OK: Got %s\n", $exceptionname);
- } else {
- printf("ALMOST: Got %s (%s) - expected %s\n", get_class($e), $message, $exceptionname);
- }
-
- return $e->getMessage();
-}
-
-function printServer(Server $server)
-{
- printf("server: %s:%d\n", $server->getHost(), $server->getPort());
-}
-
-function printWriteResult(WriteResult $result, $details = true)
-{
- printServer($result->getServer());
-
- printf("insertedCount: %d\n", $result->getInsertedCount());
- printf("matchedCount: %d\n", $result->getMatchedCount());
- printf("modifiedCount: %d\n", $result->getModifiedCount());
- printf("upsertedCount: %d\n", $result->getUpsertedCount());
- printf("deletedCount: %d\n", $result->getDeletedCount());
-
- foreach ($result->getUpsertedIds() as $index => $id) {
- printf("upsertedId[%d]: ", $index);
- var_dump($id);
- }
-
- $writeConcernError = $result->getWriteConcernError();
- printWriteConcernError($writeConcernError ? $writeConcernError : null, $details);
-
- foreach ($result->getWriteErrors() as $writeError) {
- printWriteError($writeError);
- }
-}
-
-function printWriteConcernError(WriteConcernError $error = null, $details)
-{
- if ($error) {
- /* This stuff is generated by the server, no need for us to test it */
- if (!$details) {
- printf("writeConcernError: %s (%d)\n", $error->getMessage(), $error->getCode());
- return;
- }
- var_dump($error);
- printf("writeConcernError.message: %s\n", $error->getMessage());
- printf("writeConcernError.code: %d\n", $error->getCode());
- printf("writeConcernError.info: ");
- var_dump($error->getInfo());
- }
-}
-
-function printWriteError(WriteError $error)
-{
- var_dump($error);
- printf("writeError[%d].message: %s\n", $error->getIndex(), $error->getMessage());
- printf("writeError[%d].code: %d\n", $error->getIndex(), $error->getCode());
-}
-
-function getInsertCount($retval) {
- return $retval->getInsertedCount();
-}
-function getModifiedCount($retval) {
- return $retval->getModifiedCount();
-}
-function getDeletedCount($retval) {
- return $retval->getDeletedCount();
-}
-function getUpsertedCount($retval) {
- return $retval->getUpsertedCount();
-}
-function getWriteErrors($retval) {
- return (array)$retval->getWriteErrors();
-}
-
-function def($arr) {
- foreach($arr as $const => $value) {
- define($const, getenv("PHONGO_TEST_$const") ?: $value);
- }
-}
-
-function configureFailPoint(Manager $manager, $failPoint, $mode, array $data = [])
-{
- $doc = [
- 'configureFailPoint' => $failPoint,
- 'mode' => $mode,
- ];
- if ($data) {
- $doc['data'] = $data;
- }
-
- $cmd = new Command($doc);
- $manager->executeCommand('admin', $cmd);
-}
-
-function configureTargetedFailPoint(Server $server, $failPoint, $mode, array $data = [])
-{
- $doc = array(
- 'configureFailPoint' => $failPoint,
- 'mode' => $mode,
- );
- if ($data) {
- $doc['data'] = $data;
- }
-
- $cmd = new Command($doc);
- $server->executeCommand('admin', $cmd);
-}
-
-function failMaxTimeMS(Server $server)
-{
- configureTargetedFailPoint($server, 'maxTimeAlwaysTimeOut', [ 'times' => 1 ]);
-}
-
-function getMOPresetBase() {
- if (!($BASE = getenv("mongodb_orchestration_base"))) {
- $BASE = "/phongo/";
- }
-
- return $BASE;
-}
-
-function toPHP($var, $typemap = array()) {
- return MongoDB\BSON\toPHP($var, $typemap);
-}
-function fromPHP($var) {
- return MongoDB\BSON\fromPHP($var);
-}
-function toJSON($var) {
- return MongoDB\BSON\toJSON($var);
-}
-function toCanonicalExtendedJSON($var) {
- return MongoDB\BSON\toCanonicalExtendedJSON($var);
-}
-function toRelaxedExtendedJSON($var) {
- return MongoDB\BSON\toRelaxedExtendedJSON($var);
-}
-function fromJSON($var) {
- return MongoDB\BSON\fromJSON($var);
-}
-
-/* Note: this fail point may terminate the mongod process, so you may want to
- * use this in conjunction with a throwaway server. */
-function failGetMore(Manager $manager)
-{
- /* We need to do version detection here */
- $primary = $manager->selectServer(new ReadPreference('primary'));
- $version = get_server_version_from_server($primary);
-
- if (version_compare($version, "3.2", "<")) {
- configureFailPoint($manager, 'failReceivedGetmore', 'alwaysOn');
- return;
- }
-
- if (version_compare($version, "4.0", ">=")) {
- /* We use 237 here, as that's the same original code that MongoD would
- * throw if a cursor had already gone by the time we call getMore. This
- * allows us to make things consistent with the getMore OP behaviour
- * from previous mongod versions. An errorCode is required here for the
- * failPoint to work. */
- configureFailPoint($manager, 'failCommand', 'alwaysOn', [ 'errorCode' => 237, 'failCommands' => ['getMore'] ]);
- return;
- }
-
- throw new Exception("Trying to configure a getMore fail point for a server version ($version) that doesn't support it");
-}
diff --git a/mongodb-1.8.1/tests/writeConcern/writeconcern-ctor_error-001.phpt b/mongodb-1.8.1/tests/writeConcern/writeconcern-ctor_error-001.phpt
deleted file mode 100644
index b1b08083..00000000
--- a/mongodb-1.8.1/tests/writeConcern/writeconcern-ctor_error-001.phpt
+++ /dev/null
@@ -1,18 +0,0 @@
---TEST--
-MongoDB\Driver\WriteConcern construction (invalid arguments)
---FILE--
-<?php
-
-require_once __DIR__ . '/../utils/tools.php';
-
-echo throws(function() {
- new MongoDB\Driver\WriteConcern("string", 10000, false, 1);
-}, 'MongoDB\Driver\Exception\InvalidArgumentException'), "\n";
-
-?>
-===DONE===
-<?php exit(0); ?>
---EXPECT--
-OK: Got MongoDB\Driver\Exception\InvalidArgumentException
-MongoDB\Driver\WriteConcern::__construct() expects at most 3 parameters, 4 given
-===DONE===
diff --git a/mongodb-1.9.0/CONTRIBUTING.md b/mongodb-1.9.0/CONTRIBUTING.md
new file mode 100644
index 00000000..b77913d5
--- /dev/null
+++ b/mongodb-1.9.0/CONTRIBUTING.md
@@ -0,0 +1,532 @@
+# Contributing to the PHP Driver for MongoDB
+
+## Building from Source
+
+Developers who would like to contribute to the driver will need to build it from
+source. The repository may be initialized with:
+
+```
+$ git clone https://github.com/mongodb/mongo-php-driver.git
+$ cd mongo-php-driver
+$ git submodule update --init
+```
+
+The following script may be used to build the driver:
+
+```
+#!/bin/sh
+
+phpize > /dev/null && \
+./configure --enable-mongodb-developer-flags > /dev/null && \
+make clean > /dev/null && make all > /dev/null && make install
+```
+
+## Testing
+
+The extension's test use the PHPT format from PHP internals. This format is
+documented in the following links:
+
+ * [Introduction to PHPT Files](https://qa.php.net/write-test.php)
+ * [PHPT - Test File Layout](https://qa.php.net/phpt_details.php)
+
+Generally, most tests will be based on the following template:
+
+```
+--TEST--
+Description of API or JIRA issue being tested
+--SKIPIF--
+<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
+<?php /* One or more skip functions */ ?>
+--FILE--
+<?php
+require_once __DIR__ . "/../utils/basic.inc";
+
+// Test code
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+===DONE===
+```
+
+The `basic-skipif.inc` and `basic.inc` files contain utility functions for the
+`SKIPIF` and `FILE` sections, respectively. If those functions are not needed
+(e.g. skip logic only depends on checking the `PHP_INT_SIZE` constant), the test
+should not include the file. When it doubt, keep it simple.
+
+### Best Practices for `SKIPIF`
+
+The [`skipif.php`](tests/utils/skipif.php) file defines various helper functions
+for use within a test's [`SKIPIF`](https://qa.php.net/phpt_details.php#skipif_section)
+section. When multiple functions are used in a single `SKIPIF` section, they
+should be logically ordered:
+
+ * Any PHP environment requirements should be checked first. For example, if a
+ test requires a 64-bit architecture, start by checking `PHP_INT_SIZE` before
+ anything else.
+ * Any extension build requirements (e.g. `skip_if_not_libmongoc_crypto()`) or
+ test environment requirements (e.g. `skip_if_auth()`) should then be checked.
+ These functions only examine local information, such as `phpinfo()` output or
+ the structure of the `URI` constant, and do not interact with a remote
+ MongoDB server.
+ * Any remote server requirements should then be checked. A general integration
+ test that requires any type of remote server to be accessible might use
+ `skip_if_not_live()` while a test requiring a replica set would prefer
+ `skip_if_not_replica_set()`.
+ * After requiring a remote server to be accessible (optionally with a specific
+ type), you can enforce requirements about that server. This includes checking
+ its server version, storage engine, availability of test commands, etc.
+ * Finally, use `skip_if_not_clean()` if needed to ensure that the collection(s)
+ under test are dropped before the test runs.
+
+As a rule of thumb, your `SKIPIF` logic should be written to allow the test to
+run in as many environments as possible. To paraphrase the
+[robustness principal](https://en.wikipedia.org/wiki/Robustness_principle):
+
+> Be conservative in what/how you test, and liberal in what environment you require
+
+Consider that a well-crafted `EXPECTF` section may allow a `SKIPIF` section to
+be less restrictive.
+
+### Local Mongo Orchestration (and Travis CI)
+
+The test suite depends on [Mongo Orchestration](https://github.com/10gen/mongo-orchestration).
+Mongo Orchestration is an HTTP server that provides a REST API for maintaining
+MongoDB configurations. These configurations are located in ``scripts/presets``
+and for Travis CI in ``scripts/presets/travis``. The presets for Travis CI can
+also be spun-up locally, and that is the preferred testing method. An older way
+using a specific VM is also still available (see further down).
+
+Mongo Orchestration expects that the ``mongod`` (and ``mongos``) binaries are
+available in the ``PATH``.
+
+Once installed, Mongo Orchestration can be started with
+
+```
+~/.local/bin/mongo-orchestration start --no-fork --enable-majority-read-concern
+```
+
+The Travis CI setup uses
+[deployments](https://github.com/mongodb/mongo-php-driver/blob/master/.travis.scripts/setup_mo.sh)
+to test different topologies. Currently, it supports ``STANDALONE``,
+``STANDALONE_OLD`` (for MongoDB versions before 3.6), ``STANDALONE_SSL``,
+``REPLICASET`` and ``SHARDED_CLUSTER``.
+
+The test suite uses the ``MONGODB_URI`` environment variable as connection
+string to run all tests. In order to make the URI available to the test suite,
+you can run the following for a "deployment" in the *root* of the MongoDB
+Driver GIT checkout:
+
+```
+export TRAVIS_BUILD_DIR=`pwd`
+DEPLOYMENT=STANDALONE_AUTH .travis.scripts/setup_mo.sh
+export MONGODB_URI=`cat /tmp/uri.txt`
+```
+
+With this set-up, the tests can be run with `make test`.
+
+### VM-based Mongo Orchestration (legacy set-up)
+
+Alternative to the Travis CI set-up, our test suite also includes scripts to configure test environments
+with [Vagrant](https://www.vagrantup.com/) and
+[Mongo Orchestration](https://github.com/10gen/mongo-orchestration).
+The deployments started in this Vagrant image have hard coded URLs to be used
+with the ``MONGODB_URI`` environment variable:
+
+Deployment | URI
+--------------------------- | ---
+Standalone (MongoDB 4.0) | `mongodb://192.168.112.10:2000`
+Standalone (MongoDB 3.0) | `mongodb://192.168.112.10:2700`
+Standalone with SSL | `mongodb://192.168.112.10:2100`
+Standalone with Auth | `mongodb://root:toor@192.168.112.10:2200/?authSource=admin`
+Standalone with X509 Auth | `mongodb://C=US,ST=New York,L=New York City,O=MongoDB,OU=KernelUser,CN=client@192.168.112.10:2300/?authSource=$external&authMechanism=MONGODB-X509`
+Standalone with Plain Auth | `mongodb://root:toor@192.168.112.10:2400/?authSource=admin`
+Replicaset (MongoDB 4.0) | `mongodb://192.168.112.10:3000,192.168.112.10:3001,192.168.112.10:3002/?replicaSet=REPLICASET`
+Replicaset (MongoDB 3.0) | `mongodb://192.168.112.10:3100,192.168.112.10:3101,192.168.112.10:3102/?replicaSet=REPLICASET_30`
+Replicaset (MongoDB 3.6) | `mongodb://192.168.112.10:3200,192.168.112.10:3201,192.168.112.10:3202/?replicaSet=REPLICASET_36`
+
+The Vagrant images can be started by using:
+
+```
+$ make vm # Starts the test VMs with Vagrant
+$ make test-bootstrap # Starts the mongod servers within the test VM
+```
+
+After this set-up is completed, you need to export the `MONGODB_URI`
+environment variables with one of the values from the table above. The `test`
+make target may be used to execute the test suite:
+
+```
+$ make test # Executes the test suite against the VMs
+```
+
+To find out which VM servers are running at a later point in time, you can run
+`make test-bootstrap` to obtain a list of deployments and their URIs.
+
+#### Restarting Mongo Orchestration
+
+If something goes awry in the test VM, you can reload it by running:
+
+```
+make test-bootstrap
+```
+
+## Updating libmongoc, libbson, and libmongocrypt
+
+The PHP driver can use either system libraries or bundled versions of
+libmongoc, libbson, and libmongocrypt. If a new version of either library is
+available, the submodule and build configuration will need to be updated to
+reflect the new sources and/or package version.
+
+### Updating libmongoc and libbson
+
+#### Update libmongoc to the latest version
+
+```
+$ cd src/libmongoc
+$ git fetch
+$ git checkout 1.15.0
+```
+
+#### Ensure libmongoc version information is correct
+
+The build process for Autotools and Windows rely on
+`src/LIBMONGOC_VERSION_CURRENT` to infer version information for libmongoc and
+libbson. This file can be regenerated using the following Makefile target:
+
+```
+$ make libmongoc-version-current
+```
+
+Alternatively, the `build/calc_release_version.py` script in libmongoc can be
+executed directly.
+
+#### Update sources in build configurations
+
+The Autotools and Windows build configurations (`config.m4` and `config.w32`,
+respectively) define several variables (e.g. `PHP_MONGODB_MONGOC_SOURCES`) that
+collectively enumerate all of the the sources within the libmongoc submodule to
+include in a bundled build.
+
+These variables should each have a shell command in a preceding comment, which
+should be run to regenerate that particular list of source files. In the event
+that either libmongoc or libbson introduce a new source directory, that will
+need to be manually added (follow prior art).
+
+#### Update package dependencies
+
+The Autotools configuration additionally includes some `pkg-config` commands for
+using libmongoc and libbson as system libraries (in lieu of a bundled build).
+When bumping the libmongoc version, be sure to update the version check _and_
+error message in the `pkg-config` blocks for both libmongoc and libbson.
+
+For example, the following lines might be updated for libmongoc:
+
+```
+if $PKG_CONFIG libmongoc-1.0 --atleast-version 1.15.0; then
+
+...
+
+AC_MSG_ERROR(system libmongoc must be upgraded to version >= 1.15.0)
+```
+
+#### Update tested versions in evergreen configuration
+
+Evergreen tests against multiple versions of libmongoc. When updating to a newer
+libmongoc version, make sure to update the `libmongoc-version` build axis in
+`.evergreen/config.yml`. In general, we test against two additional versions of
+libmongoc:
+- The upcoming patch release of the current libmongoc minor version (e.g. the
+ `r1.x` branch)
+- The upcoming minor release of libmongoc (e.g. the `master` branch)
+
+#### Update sources in PECL package generation script
+
+If either libmongoc or libbson introduce a new source directory, that may also
+require updating the glob patterns in the `bin/prep-release.php` script to
+ensure new source files will be included in any generated PECL package.
+
+#### Test and commit your changes
+
+Verify that the upgrade was successful by ensuring that the driver can compile
+using both the bundled sources and system libraries for libmongoc and libbson,
+and by ensuring that the test suite passes. Once done, commit the changes to all
+of the above files/paths. For example:
+
+```
+$ git commit -m "Bump libmongoc to 1.15.0" config.m4 config.w32 src/libmongoc src/LIBMONGOC_VERSION_CURRENT
+```
+
+### Updating libmongocrypt
+
+To update libmongocrypt, the steps are similar to the above:
+
+```
+$ cd src/libmongocrypt
+$ git fetch
+$ git checkout 1.0.1
+$ make libmongocrypt-version-current
+```
+
+Package dependencies in `config.m4` must also be updated, as do the sources in
+the PECL generation script.
+
+## Releasing
+
+The follow steps outline the release process for a maintenance branch (e.g.
+releasing the `vX.Y` branch as X.Y.Z).
+
+### Ensure PHP version compatibility
+
+Ensure that the extension compiles on PHP 5.6 through the latest PHP 7.x
+release. Be sure to test both ZTS and non-ZTS builds for PHP 5.x.
+
+### Ensure Windows compatibility
+
+PECL will create Windows DLLs for new releases; however, you must ensure that
+the extension successfully builds on Windows before releasing. Note that PHP 5.6
+requires VS2012, while PHP 7.x requires VS2015.
+
+Given the following assumptions:
+
+ * Build directory is `C:\php-sdk\`
+ * Compiling for PHP 5.6 (VS2012 x86 Native Tools Command Prompt is running)
+ * Extension branch checked out in `C:\php-sdk\phpdev\vc11\x86\pecl\mongodb`
+
+The build process will resemble:
+
+```
+cd c:\php-sdk\
+bin\phpsdk_setvars.bat
+
+cd C:\php-sdk\phpdev\vc11\x86\php-5.6.12-src
+nmake clean
+buildconf --force
+configure --disable-all --with-openssl --enable-cli --enable-json --enable-mongodb=shared --with-mongodb-sasl=yes --with-mongodb-client-side-encryption=yes
+nmake
+```
+
+If the extension was successfully compiled, a `php_mongodb.dll` file should be
+generated in the build directory (e.g. `Release_TS`). You should then verify
+that the extension loads and executes properly:
+
+```
+cd Release_TS
+php.exe -d extension=./php_mongodb.dll -m
+php.exe -d extension=./php_mongodb.dll -r "var_dump(new MongoDB\Driver\Manager);"
+```
+
+See the [internals wiki](https://wiki.php.net/internals/windows/stepbystepbuild)
+for more information.
+
+### Transition JIRA issues and version
+
+All issues associated with the release version should be in the "Closed" state
+and have a resolution of "Fixed". Issues with other resolutions (e.g.
+"Duplicate", "Works as Designed") should be removed from the release version so
+that they do not appear in the release notes.
+
+Check the corresponding ".x" fix version to see if it contains any issues that
+are resolved as "Fixed" and should be included in this release version.
+
+Update the version's release date and status from the
+[Manage Versions](https://jira.mongodb.org/plugins/servlet/project-config/PHPC/versions)
+page.
+
+### Update version info
+
+The PHP driver uses [semantic versioning](http://semver.org/). Do not break
+backwards compatibility in a non-major release or your users will kill you.
+
+Before proceeding, ensure that the `master` branch is up-to-date with all code
+changes in this maintenance branch. This is important because we will later
+merge the ensuing release commits up to master with `--strategy=ours`, which
+will ignore changes from the merged commits.
+
+Update the version and stability constants in `phongo_version.h`. This should
+entail removing the version's "-dev" suffix, changing the stability to
+"stable", and increasing the last digit for `PHP_MONGO_VERSION_DESC`:
+
+```
+#define PHP_MONGODB_VERSION "1.1.8-dev"
+#define PHP_MONGODB_STABILITY "devel"
+#define PHP_MONGODB_VERSION_DESC 1,1,8,0
+```
+
+The above would be changed to:
+
+```
+#define PHP_MONGODB_VERSION "1.1.8"
+#define PHP_MONGODB_STABILITY "stable"
+#define PHP_MONGODB_VERSION_DESC 1,1,8,1
+```
+
+The Makefile targets for creating the PECL package depend on these constants, so
+you must rebuild the extension after updating `phongo_version.h`.
+
+> **Note:** If this is an alpha or beta release, the version string should
+> include the X.Y.Z version followed by the stability and an increment. For
+> instance, the first beta release in the 1.4.0 series would be "1.4.0beta1".
+> Alpha and beta releases use "alpha" and "beta" stability strings,
+> respectively. Release candidates (e.g. "1.4.0RC1") also use "beta" stability.
+> See [Documenting release stability and API stability](https://pear.php.net/manual/en/guide.developers.package2.stability.php)
+> for more information. For each change to the suffixes of
+> `PHP_MONGODB_VERSION`, increment the last digit of
+> `PHP_MONGODB_VERSION_DESC`.
+
+### Build PECL package
+
+Create the PECL package description file with `make package.xml`. This creates
+a `package.xml` file from a template. Version, author, and file information will
+be filled in, but release notes must be copied manually from JIRA.
+
+After copying release notes, use `make package` to create the package file (e.g.
+`mongodb-X.Y.Z.tgz`) and ensure that it can be successfully installed:
+
+```
+$ pecl install -f mongodb-X.Y.Z.tgz
+```
+
+### Commit version update and release notes
+
+Commit the modified `phongo_version.h` file as "Package X.Y.Z"
+
+```
+$ git add phongo_version.h
+$ git commit -m "Package X.Y.Z"
+```
+
+### Tag release
+
+The previous commit will be the target for our release tag:
+
+```
+$ git tag -a -m "Release X.Y.Z" X.Y.Z
+```
+
+### Update version info back to dev
+
+After tagging, the version and stability constants in `phongo_version.h` should be
+updated back to development status.
+
+```
+#define PHP_MONGODB_VERSION "1.1.8"
+#define PHP_MONGODB_STABILITY "stable"
+#define PHP_MONGODB_VERSION_DESC 1,1,8,1
+```
+
+The above would be changed to:
+
+```
+#define PHP_MONGODB_VERSION "1.1.9-dev"
+#define PHP_MONGODB_STABILITY "devel"
+#define PHP_MONGODB_VERSION_DESC 1,1,9,0
+```
+
+Commit this change:
+
+```
+$ git commit -m "Back to -dev" phongo_version.h
+```
+
+> **Note:** If this is an alpha, beta, or RC release, the version string should
+> increment the stability sequence instead of the patch version. For example,
+> if the constants were originally "1.4.0-dev" and "devel" and then changed to
+> "1.4.0beta1" and "beta" for the first beta release, this step would see them
+> ultimately changed to "1.4.0beta2-dev" and "devel".
+
+### Push commits and tags
+
+```
+$ git push
+$ git push --tags
+```
+
+### Release PECL package
+
+The PECL package may be published via the
+[Release Upload](https://pecl.php.net/release-upload.php) form. You will have
+one chance to confirm the package information after uploading.
+
+### Merge the maintenance branch up to master
+
+```
+$ git checkout master
+$ git merge vX.Y --strategy=ours
+$ git push
+```
+
+The `--strategy=ours` option ensures that all changes from the merged commits
+will be ignored.
+
+### Publish release notes
+
+The following template should be used for creating GitHub release notes via
+[this form](https://github.com/mongodb/mongo-php-driver/releases/new). The PECL
+package may also be attached to the release notes.
+
+```
+The PHP team is happy to announce that version X.Y.Z of the [mongodb](http://pecl.php.net/package/mongodb) PHP extension is now available on PECL.
+
+**Release Highlights**
+
+<one or more paragraphs describing important changes in this release>
+
+A complete list of resolved issues in this release may be found at:
+$JIRA_URL
+
+**Documentation**
+
+Documentation is available on PHP.net:
+http://php.net/set.mongodb
+
+**Feedback**
+
+We would appreciate any feedback you might have on the project:
+https://jira.mongodb.org/secure/CreateIssue.jspa?pid=12484&issuetype=6
+
+**Installation**
+
+You can either download and install the source manually, or you can install the extension with:
+
+ pecl install mongodb
+
+or update with:
+
+ pecl upgrade mongodb
+
+Windows binaries are available on PECL:
+http://pecl.php.net/package/mongodb
+```
+
+> **Note:** If this is an alpha or beta release, the installation examples
+> should refer to the exact version (e.g. "mongodb-1.8.0beta2"). This is necessary
+> because PECL prioritizes recent, stable releases over any stability preferences
+> (e.g. "mongodb-beta").
+
+The URL for the list of resolved JIRA issues will need to be updated with each
+release. You may obtain the list from
+[this form](https://jira.mongodb.org/secure/ReleaseNote.jspa?projectId=12484).
+
+If commits from community contributors were included in this release, append the
+following section:
+
+```
+**Thanks**
+
+Thanks for our community contributors for X.Y.Z:
+
+ * [$CONTRIBUTOR_NAME](https://github.com/$GITHUB_USERNAME)
+```
+
+Release announcements should also be sent to the [MongoDB Product & Driver Announcements](https://community.mongodb.com/tags/c/community/release-notes/35/php-driver).
+
+Consider announcing each release on Twitter. Significant releases should also be
+announced via [@MongoDB](http://twitter.com/mongodb) as well.
+
+### Update compatibility tables in MongoDB docs
+
+The [compatibility tables](https://docs.mongodb.com/drivers/driver-compatibility-reference#php-driver-compatibility) in
+the MongoDB documentation must be updated to account for new releases. Make sure to update both MongoDB and Language
+compatibility tables, as shown in [this pull request](https://github.com/mongodb/docs-ecosystem/pull/642).
diff --git a/mongodb-1.8.1/CREDITS b/mongodb-1.9.0/CREDITS
similarity index 100%
rename from mongodb-1.8.1/CREDITS
rename to mongodb-1.9.0/CREDITS
diff --git a/mongodb-1.8.1/LICENSE b/mongodb-1.9.0/LICENSE
similarity index 100%
rename from mongodb-1.8.1/LICENSE
rename to mongodb-1.9.0/LICENSE
diff --git a/mongodb-1.8.1/Makefile.frag b/mongodb-1.9.0/Makefile.frag
similarity index 100%
rename from mongodb-1.8.1/Makefile.frag
rename to mongodb-1.9.0/Makefile.frag
diff --git a/mongodb-1.8.1/README.md b/mongodb-1.9.0/README.md
similarity index 100%
rename from mongodb-1.8.1/README.md
rename to mongodb-1.9.0/README.md
diff --git a/mongodb-1.8.1/THIRD_PARTY_NOTICES b/mongodb-1.9.0/THIRD_PARTY_NOTICES
similarity index 100%
rename from mongodb-1.8.1/THIRD_PARTY_NOTICES
rename to mongodb-1.9.0/THIRD_PARTY_NOTICES
diff --git a/mongodb-1.8.1/Vagrantfile b/mongodb-1.9.0/Vagrantfile
similarity index 100%
rename from mongodb-1.8.1/Vagrantfile
rename to mongodb-1.9.0/Vagrantfile
diff --git a/mongodb-1.9.0/config.m4 b/mongodb-1.9.0/config.m4
new file mode 100644
index 00000000..4418550f
--- /dev/null
+++ b/mongodb-1.9.0/config.m4
@@ -0,0 +1,529 @@
+dnl config.m4 for extension mongodb
+PHP_ARG_ENABLE([mongodb],
+ [whether to enable MongoDB support],
+ [AS_HELP_STRING([--enable-mongodb],
+ [Enable MongoDB support])])
+
+if test "$PHP_MONGODB" != "no"; then
+ dnl Check PHP version is compatible with this extension
+ AC_MSG_CHECKING([PHP version])
+
+ PHP_MONGODB_PHP_VERSION=$PHP_VERSION
+ PHP_MONGODB_PHP_VERSION_ID=$PHP_VERSION_ID
+
+ if test -z "$PHP_MONGODB_PHP_VERSION"; then
+ if test -z "$PHP_CONFIG"; then
+ AC_MSG_ERROR([php-config not found])
+ fi
+ PHP_MONGODB_PHP_VERSION=`${PHP_CONFIG} --version`
+ PHP_MONGODB_PHP_VERSION_ID=`echo "${PHP_MONGODB_PHP_VERSION}" | $AWK 'BEGIN { FS = "."; } { printf "%d", ([$]1 * 100 + [$]2) * 100 + [$]3;}'`
+ fi
+
+ AC_MSG_RESULT($PHP_MONGODB_PHP_VERSION)
+ if test "$PHP_MONGODB_PHP_VERSION_ID" -lt "70000"; then
+ AC_MSG_ERROR([not supported. Need a PHP version >= 7.0.0 (found $PHP_MONGODB_PHP_VERSION)])
+ fi
+
+ PHP_ARG_ENABLE([mongodb-developer-flags],
+ [whether to enable developer build flags],
+ [AS_HELP_STRING([--enable-mongodb-developer-flags],
+ [MongoDB: Enable developer flags [default=no]])],
+ [no],
+ [no])
+
+ if test "$PHP_MONGODB_DEVELOPER_FLAGS" = "yes"; then
+ dnl Warn about functions which might be candidates for format attributes
+ AX_CHECK_COMPILE_FLAG(-Wmissing-format-attribute, _MAINTAINER_CFLAGS="$_MAINTAINER_CFLAGS -Wmissing-format-attribute" ,, -Werror)
+ dnl Avoid duplicating values for an enum
+ AX_CHECK_COMPILE_FLAG(-Wduplicate-enum, _MAINTAINER_CFLAGS="$_MAINTAINER_CFLAGS -Wduplicate-enum" ,, -Werror)
+ dnl Warns on mismatches between #ifndef and #define header guards
+ AX_CHECK_COMPILE_FLAG(-Wheader-guard, _MAINTAINER_CFLAGS="$_MAINTAINER_CFLAGS -Wheader-guard" ,, -Werror)
+ dnl logical not of a non-boolean expression
+ AX_CHECK_COMPILE_FLAG(-Wlogical-not-parentheses, _MAINTAINER_CFLAGS="$_MAINTAINER_CFLAGS -Wlogical-not-parentheses" ,, -Werror)
+ dnl Warn about suspicious uses of logical operators in expressions
+ AX_CHECK_COMPILE_FLAG(-Wlogical-op, _MAINTAINER_CFLAGS="$_MAINTAINER_CFLAGS -Wlogical-op",, -Werror ,, -Werror)
+ dnl memory error detector.
+ dnl FIXME: -fsanitize=address,undefined for clang. The AX_CHECK_COMPILE_FLAG macro isn't happy about that string :(
+ AX_CHECK_COMPILE_FLAG(-fsanitize-address, _MAINTAINER_CFLAGS="$_MAINTAINER_CFLAGS -fsanitize-address" ,, -Werror)
+ dnl Enable frame debugging
+ AX_CHECK_COMPILE_FLAG(-fno-omit-frame-pointer, _MAINTAINER_CFLAGS="$_MAINTAINER_CFLAGS -fno-omit-frame-pointer" ,, -Werror)
+ dnl Make sure we don't optimize calls
+ AX_CHECK_COMPILE_FLAG(-fno-optimize-sibling-calls, _MAINTAINER_CFLAGS="$_MAINTAINER_CFLAGS -fno-optimize-sibling-calls" ,, -Werror)
+ AX_CHECK_COMPILE_FLAG(-Wlogical-op-parentheses, _MAINTAINER_CFLAGS="$_MAINTAINER_CFLAGS -Wlogical-op-parentheses" ,, -Werror)
+ AX_CHECK_COMPILE_FLAG(-Wpointer-bool-conversion, _MAINTAINER_CFLAGS="$_MAINTAINER_CFLAGS -Wpointer-bool-conversion" ,, -Werror)
+ AX_CHECK_COMPILE_FLAG(-Wbool-conversion, _MAINTAINER_CFLAGS="$_MAINTAINER_CFLAGS -Wbool-conversion" ,, -Werror)
+ AX_CHECK_COMPILE_FLAG(-Wloop-analysis, _MAINTAINER_CFLAGS="$_MAINTAINER_CFLAGS -Wloop-analysis" ,, -Werror)
+ AX_CHECK_COMPILE_FLAG(-Wsizeof-array-argument, _MAINTAINER_CFLAGS="$_MAINTAINER_CFLAGS -Wsizeof-array-argument" ,, -Werror)
+ AX_CHECK_COMPILE_FLAG(-Wstring-conversion, _MAINTAINER_CFLAGS="$_MAINTAINER_CFLAGS -Wstring-conversion" ,, -Werror)
+ AX_CHECK_COMPILE_FLAG(-Wno-variadic-macros, _MAINTAINER_CFLAGS="$_MAINTAINER_CFLAGS -Wno-variadic-macros" ,, -Werror)
+ AX_CHECK_COMPILE_FLAG(-Wno-sign-compare, _MAINTAINER_CFLAGS="$_MAINTAINER_CFLAGS -Wno-sign-compare" ,, -Werror)
+ AX_CHECK_COMPILE_FLAG(-fstack-protector, _MAINTAINER_CFLAGS="$_MAINTAINER_CFLAGS -fstack-protector" ,, -Werror)
+ AX_CHECK_COMPILE_FLAG(-fno-exceptions, _MAINTAINER_CFLAGS="$_MAINTAINER_CFLAGS -fno-exceptions" ,, -Werror)
+ AX_CHECK_COMPILE_FLAG(-Wformat-security, _MAINTAINER_CFLAGS="$_MAINTAINER_CFLAGS -Wformat-security" ,, -Werror)
+ AX_CHECK_COMPILE_FLAG(-Wformat-nonliteral, _MAINTAINER_CFLAGS="$_MAINTAINER_CFLAGS -Wformat-nonliteral" ,, -Werror)
+ AX_CHECK_COMPILE_FLAG(-Winit-self, _MAINTAINER_CFLAGS="$_MAINTAINER_CFLAGS -Winit-self" ,, -Werror)
+ AX_CHECK_COMPILE_FLAG(-Wwrite-strings, _MAINTAINER_CFLAGS="$_MAINTAINER_CFLAGS -Wwrite-strings" ,, -Werror)
+ AX_CHECK_COMPILE_FLAG(-Wenum-compare, _MAINTAINER_CFLAGS="$_MAINTAINER_CFLAGS -Wenum-compare" ,, -Werror)
+ AX_CHECK_COMPILE_FLAG(-Wempty-body, _MAINTAINER_CFLAGS="$_MAINTAINER_CFLAGS -Wempty-body" ,, -Werror)
+ AX_CHECK_COMPILE_FLAG(-Wparentheses, _MAINTAINER_CFLAGS="$_MAINTAINER_CFLAGS -Wparentheses" ,, -Werror)
+ AX_CHECK_COMPILE_FLAG(-Wdeclaration-after-statement, _MAINTAINER_CFLAGS="$_MAINTAINER_CFLAGS -Wdeclaration-after-statement" ,, -Werror)
+ AX_CHECK_COMPILE_FLAG(-Wmaybe-uninitialized, _MAINTAINER_CFLAGS="$_MAINTAINER_CFLAGS -Wmaybe-uninitialized" ,, -Werror)
+ AX_CHECK_COMPILE_FLAG(-Wimplicit-fallthrough, _MAINTAINER_CFLAGS="$_MAINTAINER_CFLAGS -Wimplicit-fallthrough" ,, -Werror)
+ AX_CHECK_COMPILE_FLAG(-Werror, _MAINTAINER_CFLAGS="$_MAINTAINER_CFLAGS -Werror" ,, -Werror)
+ AX_CHECK_COMPILE_FLAG(-Wextra, _MAINTAINER_CFLAGS="$_MAINTAINER_CFLAGS -Wextra" ,, -Werror)
+ AX_CHECK_COMPILE_FLAG(-Wno-unused-parameter, _MAINTAINER_CFLAGS="$_MAINTAINER_CFLAGS -Wno-unused-parameter" ,, -Werror)
+ AX_CHECK_COMPILE_FLAG(-Wno-unused-but-set-variable, _MAINTAINER_CFLAGS="$_MAINTAINER_CFLAGS -Wno-unused-but-set-variable" ,, -Werror)
+ AX_CHECK_COMPILE_FLAG(-Wno-missing-field-initializers, _MAINTAINER_CFLAGS="$_MAINTAINER_CFLAGS -Wno-missing-field-initializers",, -Werror)
+
+ MAINTAINER_CFLAGS="$_MAINTAINER_CFLAGS"
+ STD_CFLAGS="-g -O0 -Wall"
+ fi
+
+
+ PHP_ARG_ENABLE([mongodb-coverage],
+ [whether to enable code coverage],
+ [AS_HELP_STRING([--enable-mongodb-coverage],
+ [MongoDB: Enable developer code coverage information [default=no]])],
+ [no],
+ [no])
+
+ if test "$PHP_MONGODB_COVERAGE" = "yes"; then
+ if test "$ext_shared" != "yes"; then
+ AC_MSG_ERROR(code coverage is not supported for static builds)
+ fi
+
+ COVERAGE_CFLAGS="--coverage -g"
+ COVERAGE_LDFLAGS="--coverage"
+
+ MONGODB_SHARED_LIBADD="$MONGODB_SHARED_LIBADD $COVERAGE_LDFLAGS"
+ fi
+
+ PHP_MONGODB_CFLAGS="$STD_CFLAGS $MAINTAINER_CFLAGS $COVERAGE_CFLAGS"
+
+ PHP_MONGODB_SOURCES="\
+ php_phongo.c \
+ phongo_compat.c \
+ src/bson.c \
+ src/bson-encode.c \
+ src/BSON/Binary.c \
+ src/BSON/BinaryInterface.c \
+ src/BSON/DBPointer.c \
+ src/BSON/Decimal128.c \
+ src/BSON/Decimal128Interface.c \
+ src/BSON/Int64.c \
+ src/BSON/Javascript.c \
+ src/BSON/JavascriptInterface.c \
+ src/BSON/MaxKey.c \
+ src/BSON/MaxKeyInterface.c \
+ src/BSON/MinKey.c \
+ src/BSON/MinKeyInterface.c \
+ src/BSON/ObjectId.c \
+ src/BSON/ObjectIdInterface.c \
+ src/BSON/Persistable.c \
+ src/BSON/Regex.c \
+ src/BSON/RegexInterface.c \
+ src/BSON/Serializable.c \
+ src/BSON/Symbol.c \
+ src/BSON/Timestamp.c \
+ src/BSON/TimestampInterface.c \
+ src/BSON/Type.c \
+ src/BSON/Undefined.c \
+ src/BSON/Unserializable.c \
+ src/BSON/UTCDateTime.c \
+ src/BSON/UTCDateTimeInterface.c \
+ src/BSON/functions.c \
+ src/MongoDB/BulkWrite.c \
+ src/MongoDB/ClientEncryption.c \
+ src/MongoDB/Command.c \
+ src/MongoDB/Cursor.c \
+ src/MongoDB/CursorId.c \
+ src/MongoDB/CursorInterface.c \
+ src/MongoDB/Manager.c \
+ src/MongoDB/Query.c \
+ src/MongoDB/ReadConcern.c \
+ src/MongoDB/ReadPreference.c \
+ src/MongoDB/Server.c \
+ src/MongoDB/Session.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/CommandException.c \
+ src/MongoDB/Exception/ConnectionException.c \
+ src/MongoDB/Exception/ConnectionTimeoutException.c \
+ src/MongoDB/Exception/EncryptionException.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/ServerException.c \
+ src/MongoDB/Exception/SSLConnectionException.c \
+ src/MongoDB/Exception/UnexpectedValueException.c \
+ src/MongoDB/Exception/WriteException.c \
+ src/MongoDB/Monitoring/CommandFailedEvent.c \
+ src/MongoDB/Monitoring/CommandStartedEvent.c \
+ src/MongoDB/Monitoring/CommandSubscriber.c \
+ src/MongoDB/Monitoring/CommandSucceededEvent.c \
+ src/MongoDB/Monitoring/Subscriber.c \
+ src/MongoDB/Monitoring/functions.c \
+ "
+
+ PHP_ARG_WITH([mongodb-system-libs],
+ [whether to compile against system libraries instead of bundled],
+ [AS_HELP_STRING([--with-mongodb-system-libs=@<:@yes/no@:>@],
+ [MongoDB: Use system libraries for libbson, libmongoc, and libmongocrypt [default=no]])],
+ [no],
+ [no])
+ PHP_ARG_WITH([libbson],
+ [whether to use system libbson],
+ [AS_HELP_STRING([--with-libbson=@<:@yes/no@:>@],
+ [MongoDB: Use system libbson [default=no]])],
+ [no],
+ [no])
+ PHP_ARG_WITH([libmongoc],
+ [whether to use system libmongoc],
+ [AS_HELP_STRING([--with-libmongoc=@<:@yes/no@:>@],
+ [MongoDB: Use system libmongoc [default=no]])],
+ [no],
+ [no])
+ PHP_ARG_WITH([mongodb-client-side-encryption],
+ [whether to enable client-side encryption],
+ [AS_HELP_STRING([--with-mongodb-client-side-encryption=@<:@auto/yes/no@:>@],
+ [MongoDB: Enable client-side encryption [default=auto]])],
+ [auto],
+ [no])
+
+ if test "$PHP_LIBBSON" != "no"; then
+ AC_MSG_WARN(Using --with-libbson is deprecated and will be removed in a future version. Please use --with-system-libs instead)
+
+ if test "$PHP_LIBMONGOC" = "no"; then
+ AC_MSG_ERROR(Cannot use system libbson and bundled libmongoc)
+ fi
+
+ PHP_MONGODB_SYSTEM_LIBS="yes"
+ fi
+
+ if test "$PHP_LIBMONGOC" != "no"; then
+ AC_MSG_WARN(Using --with-libmongoc is deprecated and will be removed in a future version. Please use --with-system-libs instead)
+
+ if test "$PHP_LIBBSON" = "no"; then
+ AC_MSG_ERROR(Cannot use system libmongoc and bundled libbson)
+ fi
+
+ PHP_MONGODB_SYSTEM_LIBS="yes"
+ fi
+
+ PHP_MONGODB_BSON_VERSION_STRING="None"
+ PHP_MONGODB_MONGOC_VERSION_STRING="None"
+ PHP_MONGODB_MONGOCRYPT_VERSION_STRING="None"
+
+ if test "$PHP_MONGODB_SYSTEM_LIBS" != "no"; then
+ 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.17.0; then
+ PHP_MONGODB_BSON_CFLAGS=`$PKG_CONFIG libbson-1.0 --cflags`
+ PHP_MONGODB_BSON_LIBS=`$PKG_CONFIG libbson-1.0 --libs`
+ PHP_MONGODB_BSON_VERSION=`$PKG_CONFIG libbson-1.0 --modversion`
+ PHP_MONGODB_BSON_VERSION_STRING="System ($PHP_MONGODB_BSON_VERSION)"
+ AC_MSG_RESULT(version $PHP_MONGODB_BSON_VERSION found)
+ else
+ AC_MSG_ERROR(system libbson must be upgraded to version >= 1.17.0)
+ fi
+ else
+ AC_MSG_ERROR(pkgconfig and libbson must be installed)
+ fi
+ PHP_MONGODB_CFLAGS="$PHP_MONGODB_CFLAGS $PHP_MONGODB_BSON_CFLAGS"
+ PHP_EVAL_LIBLINE($PHP_MONGODB_BSON_LIBS, MONGODB_SHARED_LIBADD)
+ AC_DEFINE(HAVE_SYSTEM_LIBBSON, 1, [Use system libbson])
+
+ 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.17.0; then
+ PHP_MONGODB_MONGOC_CFLAGS=`$PKG_CONFIG libmongoc-1.0 --cflags`
+ PHP_MONGODB_MONGOC_LIBS=`$PKG_CONFIG libmongoc-1.0 --libs`
+ PHP_MONGODB_MONGOC_VERSION=`$PKG_CONFIG libmongoc-1.0 --modversion`
+ PHP_MONGODB_MONGOC_VERSION_STRING="System ($PHP_MONGODB_MONGOC_VERSION)"
+ AC_MSG_RESULT(version $PHP_MONGODB_MONGOC_VERSION found)
+ else
+ AC_MSG_ERROR(system libmongoc must be upgraded to version >= 1.17.0)
+ fi
+ else
+ AC_MSG_ERROR(pkgconfig and libmongoc must be installed)
+ fi
+ PHP_MONGODB_CFLAGS="$PHP_MONGODB_CFLAGS $PHP_MONGODB_MONGOC_CFLAGS"
+ PHP_EVAL_LIBLINE($PHP_MONGODB_MONGOC_LIBS, MONGODB_SHARED_LIBADD)
+ AC_DEFINE(HAVE_SYSTEM_LIBMONGOC, 1, [Use system libmongoc])
+
+ if test "$PHP_MONGODB_CLIENT_SIDE_ENCRYPTION" != "no"; then
+ AC_MSG_CHECKING(for libmongocrypt)
+
+ if test -x "$PKG_CONFIG" && $PKG_CONFIG --exists libmongocrypt; then
+ if $PKG_CONFIG libmongocrypt --atleast-version 1.0.4; then
+ PHP_MONGODB_MONGOCRYPT_CFLAGS=`$PKG_CONFIG libmongocrypt --cflags`
+ PHP_MONGODB_MONGOCRYPT_LIBS=`$PKG_CONFIG libmongocrypt --libs`
+ PHP_MONGODB_MONGOCRYPT_VERSION=`$PKG_CONFIG libmongocrypt --modversion`
+ PHP_MONGODB_MONGOCRYPT_VERSION_STRING="System ($PHP_MONGODB_MONGOCRYPT_VERSION)"
+ AC_MSG_RESULT(version $PHP_MONGODB_MONGOCRYPT_VERSION found)
+
+ PHP_MONGODB_CFLAGS="$PHP_MONGODB_CFLAGS $PHP_MONGODB_MONGOCRYPT_CFLAGS"
+ PHP_EVAL_LIBLINE($PHP_MONGODB_MONGOCRYPT_LIBS, MONGODB_SHARED_LIBADD)
+ AC_DEFINE(HAVE_SYSTEM_LIBMONGOCRYPT, 1, [Use system libmongocrypt])
+ elif test "$PHP_MONGODB_CLIENT_SIDE_ENCRYPTION" = "yes"; then
+ AC_MSG_ERROR(system libmongocrypt must be upgraded to version >= 1.0.4)
+ else
+ AC_MSG_RESULT(found an older version, compiling without client-side encryption)
+ fi
+ else
+ if test "$PHP_MONGODB_CLIENT_SIDE_ENCRYPTION" = "yes"; then
+ AC_MSG_ERROR(pkgconfig and libmongocrypt must be installed)
+ else
+ AC_MSG_RESULT(not found, compiling without client-side encryption)
+ fi
+ fi
+ fi
+ fi
+
+ if test "$PHP_MONGODB_SYSTEM_LIBS" = "no"; then
+ PHP_MONGODB_BUNDLED_CFLAGS="$STD_CFLAGS -DBSON_COMPILATION -DMONGOC_COMPILATION"
+ dnl TODO: MONGOCRYPT-219 makes the -std argument obsolete
+ PHP_MONGODB_LIBMONGOCRYPT_CFLAGS="-DKMS_MSG_STATIC -std=gnu99"
+
+ dnl M4 doesn't know if we're building statically or as a shared module, so
+ dnl attempt to include both paths while ignoring errors. If neither path
+ dnl exists, report an error during configure (this is later than M4 parsing
+ dnl during phpize but better than nothing).
+ m4_pushdef([_include],[
+ dnl TODO: Fix this for PECL install (PHPC-1218)
+ dnl if test ! \( -f "$1" -o -f "ext/mongodb/$1" \); then
+ dnl AC_MSG_ERROR([m4 could not include $1: No such file or directory])
+ dnl fi
+ m4_builtin([sinclude],[$1])
+ m4_builtin([sinclude],[ext/mongodb/][$1])
+ ])
+
+ dnl Avoid using AC_CONFIG_MACRO_DIR, which might conflict with PHP
+ _include([scripts/autotools/m4/as_var_copy.m4])
+ _include([scripts/autotools/m4/ax_check_compile_flag.m4])
+ _include([scripts/autotools/m4/ax_prototype.m4])
+ _include([scripts/autotools/m4/ax_pthread.m4])
+ _include([scripts/autotools/m4/php_mongodb.m4])
+ _include([scripts/autotools/m4/pkg.m4])
+
+ _include([scripts/autotools/CheckCompiler.m4])
+ _include([scripts/autotools/CheckHost.m4])
+
+ _include([scripts/autotools/libbson/CheckAtomics.m4])
+ _include([scripts/autotools/libbson/CheckHeaders.m4])
+ _include([scripts/autotools/libbson/Endian.m4])
+ _include([scripts/autotools/libbson/FindDependencies.m4])
+ _include([scripts/autotools/libbson/Versions.m4])
+
+ _include([scripts/autotools/libmongoc/CheckCompression.m4])
+ _include([scripts/autotools/libmongoc/CheckResolv.m4])
+ _include([scripts/autotools/libmongoc/CheckSasl.m4])
+ _include([scripts/autotools/libmongoc/CheckSSL.m4])
+ _include([scripts/autotools/libmongoc/CheckICU.m4])
+ _include([scripts/autotools/libmongoc/FindDependencies.m4])
+ _include([scripts/autotools/libmongoc/PlatformFlags.m4])
+ _include([scripts/autotools/libmongoc/Versions.m4])
+ _include([scripts/autotools/libmongoc/WeakSymbols.m4])
+
+ dnl This include modifies the value of $PHP_MONGODB_CLIENT_SIDE_ENCRYPTION to "yes"
+ dnl or "no" depending on whether dependencies for libmongocrypt are fulfilled
+ _include([scripts/autotools/libmongocrypt/CheckSSL.m4])
+ _include([scripts/autotools/libmongocrypt/Version.m4])
+
+ PHP_MONGODB_BSON_VERSION_STRING="Bundled ($BSON_VERSION)"
+ PHP_MONGODB_MONGOC_VERSION_STRING="Bundled ($MONGOC_VERSION)"
+ PHP_MONGODB_MONGOCRYPT_VERSION_STRING="Bundled ($MONGOCRYPT_BUILD_VERSION)"
+
+ m4_popdef([_include])
+
+ AC_SUBST(BSON_EXTRA_ALIGN, 0)
+ AC_SUBST(BSON_OS, 1)
+
+ AC_SUBST(MONGOC_NO_AUTOMATIC_GLOBALS, 1)
+ AC_SUBST(MONGOC_ENABLE_MONGODB_AWS_AUTH, 0)
+ AC_SUBST(MONGOC_ENABLE_RDTSCP, 0)
+ AC_SUBST(MONGOC_ENABLE_SHM_COUNTERS, 0)
+ AC_SUBST(MONGOC_TRACE, 1)
+
+ dnl Assignments for metadata handshake. Leave CFLAGS/LDFLAGS empty as they
+ dnl would likely cause platform info (PHP version) to be truncated. We can
+ dnl consider restoring CFLAGS/LDFLAGS once CDRIVER-3134 is resolved.
+ AC_SUBST(MONGOC_CC, [$CC])
+ AC_SUBST(MONGOC_USER_SET_CFLAGS, [])
+ AC_SUBST(MONGOC_USER_SET_LDFLAGS, [])
+
+ if test "$PHP_MONGODB_CLIENT_SIDE_ENCRYPTION" = "yes"; then
+ AC_SUBST(MONGOC_ENABLE_CLIENT_SIDE_ENCRYPTION, 1)
+ else
+ AC_SUBST(MONGOC_ENABLE_CLIENT_SIDE_ENCRYPTION, 0)
+ fi
+
+ dnl On MacOS, use gcut from the coreutils brew package instead of cut
+ dnl Generated with: find src/libmongoc/src/common -name '*.c' -print0 | cut -sz -d / -f 5- | sort -dz | tr '\000' ' '
+ PHP_MONGODB_COMMON_SOURCES="common-b64.c common-md5.c common-thread.c"
+
+ dnl Generated with: find src/libmongoc/src/kms-message/src -maxdepth 1 -name '*.c' -print0 | cut -sz -d / -f 6- | sort -dz | tr '\000' ' '
+ PHP_MONGODB_KMS_MESSAGE_SOURCES="hexlify.c kms_b64.c kms_caller_identity_request.c kms_crypto_apple.c kms_crypto_libcrypto.c kms_crypto_none.c kms_crypto_windows.c kms_decrypt_request.c kms_encrypt_request.c kms_kv_list.c kms_message.c kms_port.c kms_request.c kms_request_opt.c kms_request_str.c kms_response.c kms_response_parser.c sort.c"
+
+ dnl Generated with: find src/libmongoc/src/libbson/src/bson -name '*.c' -print0 | cut -sz -d / -f 7- | sort -dz | 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"
+
+ dnl Generated with: find src/libmongoc/src/libbson/src/jsonsl -name '*.c' -print0 | cut -sz -d / -f 7- | sort -dz | tr '\000' ' '
+ PHP_MONGODB_JSONSL_SOURCES="jsonsl.c"
+
+ dnl Generated with: find src/libmongoc/src/libmongoc/src/mongoc -name '*.c' -print0 | cut -sz -d / -f 7- | sort -dz | tr '\000' ' '
+ PHP_MONGODB_MONGOC_SOURCES="mongoc-aggregate.c mongoc-apm.c mongoc-array.c mongoc-async.c mongoc-async-cmd.c mongoc-buffer.c mongoc-bulk-operation.c mongoc-change-stream.c mongoc-client.c mongoc-client-pool.c mongoc-client-session.c mongoc-client-side-encryption.c mongoc-cluster-aws.c mongoc-cluster.c mongoc-cluster-cyrus.c mongoc-cluster-sasl.c mongoc-cluster-sspi.c mongoc-cmd.c mongoc-collection.c mongoc-compression.c mongoc-counters.c mongoc-crypt.c mongoc-crypto.c mongoc-crypto-cng.c mongoc-crypto-common-crypto.c mongoc-crypto-openssl.c mongoc-cursor-array.c mongoc-cursor.c mongoc-cursor-change-stream.c mongoc-cursor-cmd.c mongoc-cursor-cmd-deprecated.c mongoc-cursor-find.c mongoc-cursor-find-cmd.c mongoc-cursor-find-opquery.c mongoc-cursor-legacy.c mongoc-cyrus.c mongoc-database.c mongoc-error.c mongoc-find-and-modify.c mongoc-gridfs-bucket.c mongoc-gridfs-bucket-file.c mongoc-gridfs.c mongoc-gridfs-file.c mongoc-gridfs-file-list.c mongoc-gridfs-file-page.c mongoc-handshake.c mongoc-host-list.c mongoc-http.c mongoc-index.c mongoc-init.c mongoc-interrupt.c mongoc-libressl.c mongoc-linux-distro-scanner.c mongoc-list.c mongoc-log.c mongoc-matcher.c mongoc-matcher-op.c mongoc-memcmp.c mongoc-ocsp-cache.c mongoc-openssl.c mongoc-opts.c mongoc-opts-helpers.c mongoc-queue.c mongoc-rand-cng.c mongoc-rand-common-crypto.c mongoc-rand-openssl.c mongoc-read-concern.c mongoc-read-prefs.c mongoc-rpc.c mongoc-sasl.c mongoc-scram.c mongoc-secure-channel.c mongoc-secure-transport.c mongoc-server-description.c mongoc-server-monitor.c mongoc-server-stream.c mongoc-set.c mongoc-socket.c mongoc-ssl.c mongoc-sspi.c mongoc-stream-buffered.c mongoc-stream.c mongoc-stream-file.c mongoc-stream-gridfs.c mongoc-stream-gridfs-download.c mongoc-stream-gridfs-upload.c mongoc-stream-socket.c mongoc-stream-tls.c mongoc-stream-tls-libressl.c mongoc-stream-tls-openssl-bio.c mongoc-stream-tls-openssl.c mongoc-stream-tls-secure-channel.c mongoc-stream-tls-secure-transport.c mongoc-topology-background-monitoring.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-command-legacy.c mongoc-write-concern.c"
+
+ dnl Generated with: find src/libmongoc/src/zlib-1.2.11 -maxdepth 1 -name '*.c' -print0 | cut -sz -d / -f 5- | sort -dz | tr '\000' ' '
+ PHP_MONGODB_ZLIB_SOURCES="adler32.c compress.c crc32.c deflate.c gzclose.c gzlib.c gzread.c gzwrite.c infback.c inffast.c inflate.c inftrees.c trees.c uncompr.c zutil.c"
+
+ PHP_MONGODB_ADD_SOURCES([src/libmongoc/src/common/], $PHP_MONGODB_COMMON_SOURCES, $PHP_MONGODB_BUNDLED_CFLAGS)
+ PHP_MONGODB_ADD_SOURCES([src/libmongoc/src/libbson/src/bson/], $PHP_MONGODB_BSON_SOURCES, $PHP_MONGODB_BUNDLED_CFLAGS)
+ PHP_MONGODB_ADD_SOURCES([src/libmongoc/src/libbson/src/jsonsl/], $PHP_MONGODB_JSONSL_SOURCES, $PHP_MONGODB_BUNDLED_CFLAGS)
+ PHP_MONGODB_ADD_SOURCES([src/libmongoc/src/libmongoc/src/mongoc/], $PHP_MONGODB_MONGOC_SOURCES, $PHP_MONGODB_BUNDLED_CFLAGS)
+
+ PHP_MONGODB_ADD_INCLUDE([src/libmongoc/src/common/])
+ PHP_MONGODB_ADD_INCLUDE([src/libmongoc/src/libbson/src/])
+ PHP_MONGODB_ADD_INCLUDE([src/libmongoc/src/libbson/src/jsonsl/])
+ PHP_MONGODB_ADD_INCLUDE([src/libmongoc/src/libmongoc/src/])
+
+ PHP_MONGODB_ADD_BUILD_DIR([src/libmongoc/src/common/])
+ PHP_MONGODB_ADD_BUILD_DIR([src/libmongoc/src/libbson/src/bson/])
+ PHP_MONGODB_ADD_BUILD_DIR([src/libmongoc/src/libbson/src/jsonsl/])
+ PHP_MONGODB_ADD_BUILD_DIR([src/libmongoc/src/libmongoc/src/mongoc/])
+
+ dnl If compiling without libmongocrypt, use kms_message sources bundled with libmongoc.
+ dnl If compiling with libmongocrypt, kms_message bundled with libmongocrypt is used as it is most likely newer.
+ if test "$PHP_MONGODB_CLIENT_SIDE_ENCRYPTION" != "yes" && test "$PHP_MONGODB_SSL" != "no"; then
+ AC_SUBST(MONGOC_ENABLE_MONGODB_AWS_AUTH, 1)
+ PHP_MONGODB_ADD_SOURCES([src/libmongoc/src/kms-message/src/], $PHP_MONGODB_KMS_MESSAGE_SOURCES, $PHP_MONGODB_BUNDLED_CFLAGS)
+ PHP_MONGODB_ADD_INCLUDE([src/libmongoc/src/kms-message/src/])
+ PHP_MONGODB_ADD_BUILD_DIR([src/libmongoc/src/kms-message/src/])
+ fi
+
+ dnl TODO: Use $ext_srcdir if we can move this after PHP_NEW_EXTENSION
+ ac_config_dir=PHP_EXT_SRCDIR(mongodb)
+
+ AC_CONFIG_FILES([
+ ${ac_config_dir}/src/libmongoc/src/libbson/src/bson/bson-config.h
+ ${ac_config_dir}/src/libmongoc/src/libbson/src/bson/bson-version.h
+ ${ac_config_dir}/src/libmongoc/src/libmongoc/src/mongoc/mongoc-config.h
+ ${ac_config_dir}/src/libmongoc/src/libmongoc/src/mongoc/mongoc-version.h
+ ])
+
+ if test "x$bundled_zlib" = "xyes"; then
+ PHP_MONGODB_ZLIB_CFLAGS="$PHP_MONGODB_BUNDLED_CFLAGS"
+ AC_CHECK_HEADER([unistd.h], [PHP_MONGODB_ZLIB_CFLAGS="$PHP_MONGODB_ZLIB_CFLAGS -DHAVE_UNISTD_H=1"], [])
+ PHP_MONGODB_ADD_SOURCES([src/libmongoc/src/zlib-1.2.11/], $PHP_MONGODB_ZLIB_SOURCES, $PHP_MONGODB_ZLIB_CFLAGS)
+ PHP_MONGODB_ADD_INCLUDE([src/libmongoc/src/zlib-1.2.11/])
+ PHP_MONGODB_ADD_BUILD_DIR([src/libmongoc/src/zlib-1.2.11/])
+ AC_CONFIG_FILES([${ac_config_dir}/src/libmongoc/src/zlib-1.2.11/zconf.h])
+ fi
+
+ if test "$PHP_MONGODB_CLIENT_SIDE_ENCRYPTION" = "yes"; then
+ dnl Since libmongocrypt adds kms-message, we can enable AWS auth in this case
+ AC_SUBST(MONGOC_ENABLE_MONGODB_AWS_AUTH, 1)
+ AC_SUBST(MONGOCRYPT_ENABLE_TRACE, 1)
+
+ dnl Generated with: find src/libmongocrypt/src -maxdepth 1 -name '*.c' -print0 | cut -sz -d / -f 4- | sort -dz | tr '\000' ' '
+ PHP_MONGODB_MONGOCRYPT_SOURCES="mongocrypt-binary.c mongocrypt-buffer.c mongocrypt.c mongocrypt-cache.c mongocrypt-cache-collinfo.c mongocrypt-cache-key.c mongocrypt-ciphertext.c mongocrypt-crypto.c mongocrypt-ctx.c mongocrypt-ctx-datakey.c mongocrypt-ctx-decrypt.c mongocrypt-ctx-encrypt.c mongocrypt-key-broker.c mongocrypt-key.c mongocrypt-kms-ctx.c mongocrypt-log.c mongocrypt-marking.c mongocrypt-opts.c mongocrypt-status.c mongocrypt-traverse-util.c"
+
+ dnl Generated with: find src/libmongocrypt/src/crypto -name '*.c' -print0 | cut -sz -d / -f 5- | sort -dz | tr '\000' ' '
+ PHP_MONGODB_MONGOCRYPT_CRYPTO_SOURCES="cng.c commoncrypto.c libcrypto.c none.c"
+
+ dnl Generated with: find src/libmongocrypt/src/os_posix -name '*.c' -print0 | cut -sz -d / -f 5- | sort -dz | tr '\000' ' '
+ PHP_MONGODB_MONGOCRYPT_OS_POSIX_SOURCES="os_mutex.c os_once.c"
+
+ dnl Generated with: find src/libmongocrypt/src/os_win -name '*.c' -print0 | cut -sz -d / -f 5- | sort -dz | tr '\000' ' '
+ PHP_MONGODB_MONGOCRYPT_OS_WIN_SOURCES="os_mutex.c os_once.c"
+
+ dnl Generated with: find src/libmongocrypt/kms-message/src -maxdepth 1 -name '*.c' -print0 | cut -sz -d / -f 5- | sort -dz | tr '\000' ' '
+ PHP_MONGODB_MONGOCRYPT_KMS_MESSAGE_SOURCES="hexlify.c kms_b64.c kms_caller_identity_request.c kms_crypto_apple.c kms_crypto_libcrypto.c kms_crypto_none.c kms_crypto_windows.c kms_decrypt_request.c kms_encrypt_request.c kms_kv_list.c kms_message.c kms_port.c kms_request.c kms_request_opt.c kms_request_str.c kms_response.c kms_response_parser.c sort.c"
+
+ PHP_MONGODB_LIBMONGOCRYPT_CFLAGS="$PHP_MONGODB_BUNDLED_CFLAGS $PHP_MONGODB_LIBMONGOCRYPT_CFLAGS"
+ PHP_MONGODB_ADD_SOURCES([src/libmongocrypt/src/], $PHP_MONGODB_MONGOCRYPT_SOURCES, $PHP_MONGODB_LIBMONGOCRYPT_CFLAGS)
+ PHP_MONGODB_ADD_SOURCES([src/libmongocrypt/src/crypto/], $PHP_MONGODB_MONGOCRYPT_CRYPTO_SOURCES, $PHP_MONGODB_LIBMONGOCRYPT_CFLAGS)
+ PHP_MONGODB_ADD_SOURCES([src/libmongocrypt/src/os_posix/], $PHP_MONGODB_MONGOCRYPT_OS_POSIX_SOURCES, $PHP_MONGODB_LIBMONGOCRYPT_CFLAGS)
+ PHP_MONGODB_ADD_SOURCES([src/libmongocrypt/src/os_win/], $PHP_MONGODB_MONGOCRYPT_OS_WIN_SOURCES, $PHP_MONGODB_LIBMONGOCRYPT_CFLAGS)
+ PHP_MONGODB_ADD_SOURCES([src/libmongocrypt/kms-message/src/], $PHP_MONGODB_MONGOCRYPT_KMS_MESSAGE_SOURCES, $PHP_MONGODB_LIBMONGOCRYPT_CFLAGS)
+
+ PHP_MONGODB_ADD_INCLUDE([src/libmongocrypt/src/])
+ PHP_MONGODB_ADD_INCLUDE([src/libmongocrypt/kms-message/src/])
+ PHP_MONGODB_ADD_INCLUDE([src/libmongocrypt-compat/])
+
+ PHP_MONGODB_ADD_BUILD_DIR([src/libmongocrypt/src/])
+ PHP_MONGODB_ADD_BUILD_DIR([src/libmongocrypt/src/crypto/])
+ PHP_MONGODB_ADD_BUILD_DIR([src/libmongocrypt/src/os_posix/])
+ PHP_MONGODB_ADD_BUILD_DIR([src/libmongocrypt/src/os_win/])
+ PHP_MONGODB_ADD_BUILD_DIR([src/libmongocrypt/kms-message/src/])
+
+ AC_CONFIG_FILES([
+ ${ac_config_dir}/src/libmongocrypt/src/mongocrypt-config.h
+ ${ac_config_dir}/src/libmongocrypt/src/mongocrypt.h
+ ])
+ fi
+ fi
+
+ PHP_NEW_EXTENSION(mongodb, $PHP_MONGODB_SOURCES, $ext_shared,, $PHP_MONGODB_CFLAGS)
+
+ PHP_SUBST(MONGODB_SHARED_LIBADD)
+
+ 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(PHP_EXT_SRCDIR(mongodb)[/src/BSON/])
+ PHP_ADD_INCLUDE(PHP_EXT_SRCDIR(mongodb)[/src/MongoDB/])
+ PHP_ADD_INCLUDE(PHP_EXT_SRCDIR(mongodb)[/src/MongoDB/Exception/])
+ PHP_ADD_INCLUDE(PHP_EXT_SRCDIR(mongodb)[/src/MongoDB/Monitoring/])
+ PHP_ADD_INCLUDE(PHP_EXT_SRCDIR(mongodb)[/src/contrib/])
+
+ PHP_ADD_BUILD_DIR(PHP_EXT_BUILDDIR(mongodb)[/src/BSON/])
+ PHP_ADD_BUILD_DIR(PHP_EXT_BUILDDIR(mongodb)[/src/MongoDB/])
+ PHP_ADD_BUILD_DIR(PHP_EXT_BUILDDIR(mongodb)[/src/MongoDB/Exception/])
+ PHP_ADD_BUILD_DIR(PHP_EXT_BUILDDIR(mongodb)[/src/MongoDB/Monitoring/])
+ PHP_ADD_BUILD_DIR(PHP_EXT_BUILDDIR(mongodb)[/src/contrib/])
+
+ dnl Necessary to ensure that static builds include "-pthread" when linking
+ if test "$ext_shared" != "yes"; then
+ EXTRA_LDFLAGS_PROGRAM="$EXTRA_LDFLAGS_PROGRAM $EXTRA_LDFLAGS"
+ fi
+
+ dnl This must come after PHP_NEW_EXTENSION, otherwise the srcdir won't be set
+ PHP_ADD_MAKEFILE_FRAGMENT
+
+ dnl The libmongocrypt line intentionally uses the PHP_LIBBSON flag as that decides whether to build against bundled or system libraries.
+ AC_CONFIG_COMMANDS_POST([
+ if test "$enable_static" = "no"; then
+ 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
+ libmongoc : $PHP_MONGODB_BSON_VERSION_STRING
+ libbson : $PHP_MONGODB_MONGOC_VERSION_STRING
+ libmongocrypt : $PHP_MONGODB_MONGOCRYPT_VERSION_STRING
+ LDFLAGS : $LDFLAGS
+ EXTRA_LDFLAGS : $EXTRA_LDFLAGS
+ MONGODB_SHARED_LIBADD : $MONGODB_SHARED_LIBADD
+
+Please submit bugreports at:
+ https://jira.mongodb.org/browse/PHPC
+
+"
+ fi
+ ])
+fi
+
+dnl: vim: et sw=2
diff --git a/mongodb-1.9.0/config.w32 b/mongodb-1.9.0/config.w32
new file mode 100644
index 00000000..a3e617ef
--- /dev/null
+++ b/mongodb-1.9.0/config.w32
@@ -0,0 +1,370 @@
+// 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;
+}
+
+function create_folder_recursive(path)
+{
+ if (FSO.FolderExists(path)) {
+ return;
+ }
+
+ create_folder_recursive(FSO.GetParentFolderName(path));
+ FSO.CreateFolder(path);
+}
+
+function MONGODB_ADD_SOURCES(dir, file_list)
+{
+ // Ensure obj_dir and all parent directories exist
+ create_folder_recursive(FSO.BuildPath(get_define('BUILD_DIR'), dir));
+ ADD_SOURCES(configure_module_dirname + dir, file_list, "mongodb", dir);
+}
+
+ARG_ENABLE("mongodb", "MongoDB support", "no");
+ARG_WITH("mongodb-sasl", "MongoDB: Build against Cyrus-SASL", "yes");
+ARG_WITH("mongodb-client-side-encryption", "MongoDB: Enable client-side encryption", "yes");
+
+if (PHP_MONGODB != "no") {
+ /* Note: ADD_EXTENSION_DEP() only reports the date and standard extensions as
+ * installed in PHP 7.3.25+, 7.4.13+, and 8.0.0+). On other versions, assume
+ * that they're always enabled. */
+ if (
+ PHP_VERSION >= 8 ||
+ (PHP_VERSION == 7 && PHP_MINOR_VERSION == 3 && PHP_RELEASE_VERSION >= 25) ||
+ (PHP_VERSION == 7 && PHP_MINOR_VERSION == 4 && PHP_RELEASE_VERSION >= 13)
+ ) {
+ ADD_EXTENSION_DEP("mongodb", "date", false);
+ ADD_EXTENSION_DEP("mongodb", "standard", false);
+ }
+
+ 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);
+
+ var PHP_MONGODB_CFLAGS="\
+ /D BSON_COMPILATION /D MONGOC_COMPILATION \
+ /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/libmongoc/src/common \
+ /I" + configure_module_dirname + "/src/libmongoc/src/libbson/src \
+ /I" + configure_module_dirname + "/src/libmongoc/src/libbson/src/jsonsl \
+ /I" + configure_module_dirname + "/src/libmongoc/src/libmongoc/src \
+ ";
+
+ // Condense whitespace in CFLAGS
+ PHP_MONGODB_CFLAGS = PHP_MONGODB_CFLAGS.replace(/\s+/g, ' ');
+
+ // On MacOS, use gcut from the coreutils brew package instead of cut
+ // Generated with: find src/libmongoc/src/common -name '*.c' -print0 | cut -sz -d / -f 5- | sort -dz | tr '\000' ' '
+ var PHP_MONGODB_COMMON_SOURCES="common-b64.c common-md5.c common-thread.c"
+
+ // Generated with: find src/libmongoc/src/kms-message/src -maxdepth 1 -name '*.c' -print0 | cut -sz -d / -f 6- | sort -dz | tr '\000' ' '
+ var PHP_MONGODB_KMS_MESSAGE_SOURCES="hexlify.c kms_b64.c kms_caller_identity_request.c kms_crypto_apple.c kms_crypto_libcrypto.c kms_crypto_none.c kms_crypto_windows.c kms_decrypt_request.c kms_encrypt_request.c kms_kv_list.c kms_message.c kms_port.c kms_request.c kms_request_opt.c kms_request_str.c kms_response.c kms_response_parser.c sort.c";
+
+ // Generated with: find src/libmongoc/src/libbson/src/bson -name '*.c' -print0 | cut -sz -d / -f 7- | sort -dz | 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/libmongoc/src/libbson/src/jsonsl -name '*.c' -print0 | cut -sz -d / -f 7- | sort -dz | tr '\000' ' '
+ var PHP_MONGODB_JSONSL_SOURCES="jsonsl.c";
+
+ // Generated with: find src/libmongoc/src/libmongoc/src/mongoc -name '*.c' -print0 | cut -sz -d / -f 7- | sort -dz | tr '\000' ' '
+ var PHP_MONGODB_MONGOC_SOURCES="mongoc-aggregate.c mongoc-apm.c mongoc-array.c mongoc-async.c mongoc-async-cmd.c mongoc-buffer.c mongoc-bulk-operation.c mongoc-change-stream.c mongoc-client.c mongoc-client-pool.c mongoc-client-session.c mongoc-client-side-encryption.c mongoc-cluster-aws.c mongoc-cluster.c mongoc-cluster-cyrus.c mongoc-cluster-sasl.c mongoc-cluster-sspi.c mongoc-cmd.c mongoc-collection.c mongoc-compression.c mongoc-counters.c mongoc-crypt.c mongoc-crypto.c mongoc-crypto-cng.c mongoc-crypto-common-crypto.c mongoc-crypto-openssl.c mongoc-cursor-array.c mongoc-cursor.c mongoc-cursor-change-stream.c mongoc-cursor-cmd.c mongoc-cursor-cmd-deprecated.c mongoc-cursor-find.c mongoc-cursor-find-cmd.c mongoc-cursor-find-opquery.c mongoc-cursor-legacy.c mongoc-cyrus.c mongoc-database.c mongoc-error.c mongoc-find-and-modify.c mongoc-gridfs-bucket.c mongoc-gridfs-bucket-file.c mongoc-gridfs.c mongoc-gridfs-file.c mongoc-gridfs-file-list.c mongoc-gridfs-file-page.c mongoc-handshake.c mongoc-host-list.c mongoc-http.c mongoc-index.c mongoc-init.c mongoc-interrupt.c mongoc-libressl.c mongoc-linux-distro-scanner.c mongoc-list.c mongoc-log.c mongoc-matcher.c mongoc-matcher-op.c mongoc-memcmp.c mongoc-ocsp-cache.c mongoc-openssl.c mongoc-opts.c mongoc-opts-helpers.c mongoc-queue.c mongoc-rand-cng.c mongoc-rand-common-crypto.c mongoc-rand-openssl.c mongoc-read-concern.c mongoc-read-prefs.c mongoc-rpc.c mongoc-sasl.c mongoc-scram.c mongoc-secure-channel.c mongoc-secure-transport.c mongoc-server-description.c mongoc-server-monitor.c mongoc-server-stream.c mongoc-set.c mongoc-socket.c mongoc-ssl.c mongoc-sspi.c mongoc-stream-buffered.c mongoc-stream.c mongoc-stream-file.c mongoc-stream-gridfs.c mongoc-stream-gridfs-download.c mongoc-stream-gridfs-upload.c mongoc-stream-socket.c mongoc-stream-tls.c mongoc-stream-tls-libressl.c mongoc-stream-tls-openssl-bio.c mongoc-stream-tls-openssl.c mongoc-stream-tls-secure-channel.c mongoc-stream-tls-secure-transport.c mongoc-topology-background-monitoring.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-command-legacy.c mongoc-write-concern.c";
+
+ EXTENSION("mongodb", "php_phongo.c phongo_compat.c", null, PHP_MONGODB_CFLAGS);
+ MONGODB_ADD_SOURCES("/src", "bson.c bson-encode.c");
+ MONGODB_ADD_SOURCES("/src/BSON", "Binary.c BinaryInterface.c DBPointer.c Decimal128.c Decimal128Interface.c Int64.c Javascript.c JavascriptInterface.c MaxKey.c MaxKeyInterface.c MinKey.c MinKeyInterface.c ObjectId.c ObjectIdInterface.c Persistable.c Regex.c RegexInterface.c Serializable.c Symbol.c Timestamp.c TimestampInterface.c Type.c Undefined.c Unserializable.c UTCDateTime.c UTCDateTimeInterface.c functions.c");
+ MONGODB_ADD_SOURCES("/src/MongoDB", "BulkWrite.c ClientEncryption.c Command.c Cursor.c CursorId.c CursorInterface.c Manager.c Query.c ReadConcern.c ReadPreference.c Server.c Session.c WriteConcern.c WriteConcernError.c WriteError.c WriteResult.c");
+ MONGODB_ADD_SOURCES("/src/MongoDB/Exception", "AuthenticationException.c BulkWriteException.c CommandException.c ConnectionException.c ConnectionTimeoutException.c EncryptionException.c Exception.c ExecutionTimeoutException.c InvalidArgumentException.c LogicException.c RuntimeException.c ServerException.c SSLConnectionException.c UnexpectedValueException.c WriteException.c");
+ MONGODB_ADD_SOURCES("/src/MongoDB/Monitoring", "CommandFailedEvent.c CommandStartedEvent.c CommandSubscriber.c CommandSucceededEvent.c Subscriber.c functions.c");
+ MONGODB_ADD_SOURCES("/src/libmongoc/src/common", PHP_MONGODB_COMMON_SOURCES);
+ MONGODB_ADD_SOURCES("/src/libmongoc/src/libbson/src/bson", PHP_MONGODB_BSON_SOURCES);
+ MONGODB_ADD_SOURCES("/src/libmongoc/src/libbson/src/jsonsl", PHP_MONGODB_JSONSL_SOURCES);
+ MONGODB_ADD_SOURCES("/src/libmongoc/src/libmongoc/src/mongoc", PHP_MONGODB_MONGOC_SOURCES);
+
+ var bson_opts = {
+ BSON_BYTE_ORDER: 1234,
+ BSON_OS: 2,
+ BSON_HAVE_STDBOOL_H: 0,
+ BSON_HAVE_STRINGS_H: 0,
+ BSON_HAVE_ATOMIC_32_ADD_AND_FETCH: 0,
+ BSON_HAVE_ATOMIC_64_ADD_AND_FETCH: 0,
+ BSON_PTHREAD_ONCE_INIT_NEEDS_BRACES: 0,
+ BSON_HAVE_CLOCK_GETTIME: 0,
+ BSON_HAVE_STRNLEN: 0,
+ BSON_HAVE_SNPRINTF: 0,
+ BSON_HAVE_STRLCPY: 0,
+ BSON_HAVE_REALLOCF: 0,
+ BSON_NEEDS_SET_OUTPUT_FORMAT: 0,
+ BSON_HAVE_TIMESPEC: 0,
+ BSON_EXTRA_ALIGN: 0,
+ BSON_HAVE_SYSCALL_TID: 0,
+ BSON_HAVE_DECIMAL128: 0,
+ BSON_HAVE_GMTIME_R: 0,
+ BSON_HAVE_RAND_R: 0
+ };
+
+ if (CHECK_FUNC_IN_HEADER("stdio.h", "_set_output_format")) {
+ bson_opts.BSON_NEEDS_SET_OUTPUT_FORMAT = 1;
+ }
+
+ mongodb_generate_header(
+ configure_module_dirname + "/src/libmongoc/src/libbson/src/bson/bson-config.h.in",
+ configure_module_dirname + "/src/libmongoc/src/libbson/src/bson/bson-config.h",
+ bson_opts
+ );
+
+ mongodb_generate_header(
+ configure_module_dirname + "/src/libmongoc/src/libbson/src/bson/bson-version.h.in",
+ configure_module_dirname + "/src/libmongoc/src/libbson/src/bson/bson-version.h",
+ mongodb_parse_version_file(configure_module_dirname + "/src/LIBMONGOC_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_CLIENT_SIDE_ENCRYPTION: 0,
+ MONGOC_ENABLE_COMPRESSION_SNAPPY: 0,
+ MONGOC_ENABLE_COMPRESSION_ZLIB: 0,
+ MONGOC_ENABLE_COMPRESSION_ZSTD: 0,
+ MONGOC_ENABLE_COMPRESSION: 0,
+ MONGOC_ENABLE_MONGODB_AWS_AUTH: 0,
+ MONGOC_ENABLE_SASL: 0,
+ MONGOC_ENABLE_SASL_CYRUS: 0,
+ MONGOC_ENABLE_SASL_GSSAPI: 0,
+ MONGOC_ENABLE_SASL_SSPI: 0,
+ MONGOC_ENABLE_ICU: 0,
+ MONGOC_ENABLE_RDTSCP: 0,
+ MONGOC_ENABLE_SHM_COUNTERS: 0,
+ MONGOC_HAVE_ASN1_STRING_GET0_DATA: 0,
+ MONGOC_HAVE_SASL_CLIENT_DONE: 0,
+ MONGOC_HAVE_SCHED_GETCPU: 0,
+ MONGOC_HAVE_SOCKLEN: 1,
+ MONGOC_HAVE_WEAK_SYMBOLS: 0,
+ MONGOC_NO_AUTOMATIC_GLOBALS: 1,
+ MONGOC_SOCKET_ARG2: "struct sockaddr",
+ MONGOC_SOCKET_ARG3: "socklen_t",
+ MONGOC_TRACE: 1,
+ MONGOC_HAVE_DNSAPI: 0,
+ MONGOC_HAVE_RES_NSEARCH: 0,
+ MONGOC_HAVE_RES_NDESTROY: 0,
+ MONGOC_HAVE_RES_NCLOSE: 0,
+ MONGOC_HAVE_RES_SEARCH: 0,
+ MONGOC_HAVE_SS_FAMILY: 0,
+ 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;
+ }
+
+ var mongoc_ssl_found = false;
+
+ /* PHP 7.1.2 introduced SETUP_OPENSSL(), which supports OpenSSL 1.1.x. Earlier
+ * versions will use the legacy check for OpenSSL 1.0.x and lower. */
+ if (typeof SETUP_OPENSSL === 'function') {
+ openssl_type = SETUP_OPENSSL("mongodb", mongoc_ssl_path_to_check);
+ mongoc_ssl_found = openssl_type > 0;
+ if (openssl_type >= 2) {
+ mongoc_opts.MONGOC_HAVE_ASN1_STRING_GET0_DATA = 1;
+ }
+ } else 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", mongoc_ssl_path_to_check) &&
+ CHECK_HEADER_ADD_INCLUDE("openssl/ssl.h", "CFLAGS_MONGODB")) {
+ mongoc_ssl_found = true;
+ }
+
+ if (mongoc_ssl_found) {
+ 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;
+ mongoc_opts.MONGOC_ENABLE_MONGODB_AWS_AUTH = 1;
+
+ ADD_FLAG("CFLAGS_MONGODB", "/D KMS_MSG_STATIC=1 /D KMS_MESSAGE_ENABLE_CRYPTO=1 /D KMS_MESSAGE_ENABLE_CRYPTO_LIBCRYPTO=1");
+ } else {
+ WARNING("mongodb libopenssl support not enabled, libs not found");
+ }
+
+ // TODO: Support building with native GSSAPI (SSPI) on Windows
+ 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;
+ mongoc_opts.MONGOC_ENABLE_SASL_CYRUS = 1;
+ if (CHECK_FUNC_IN_HEADER("sasl/sasl.h", "sasl_client_done")) {
+ mongoc_opts.MONGOC_HAVE_SASL_CLIENT_DONE = 1;
+ }
+ } else if (PHP_MONGODB_SASL != "no") {
+ WARNING("mongodb libsasl support not enabled, libs not found");
+ }
+
+ if (PHP_MONGODB_CLIENT_SIDE_ENCRYPTION != "no" && mongoc_ssl_found) {
+ mongoc_opts.MONGOC_ENABLE_CLIENT_SIDE_ENCRYPTION = 1;
+
+ ADD_FLAG("CFLAGS_MONGODB", "/I" + configure_module_dirname + "/src/libmongocrypt/src");
+ ADD_FLAG("CFLAGS_MONGODB", "/I" + configure_module_dirname + "/src/libmongocrypt/kms-message/src");
+ ADD_FLAG("CFLAGS_MONGODB", "/I" + configure_module_dirname + "/src/libmongocrypt-compat");
+
+ var mongocrypt_opts = {
+ MONGOCRYPT_ENABLE_TRACE: 1,
+ MONGOCRYPT_ENABLE_CRYPTO: 1,
+ MONGOCRYPT_ENABLE_CRYPTO_LIBCRYPTO: 1,
+ // TODO: Support building with Secure Channel on Windows
+ MONGOCRYPT_ENABLE_CRYPTO_CNG: 0,
+ // Secure Transport does not apply to Windows
+ MONGOCRYPT_ENABLE_CRYPTO_COMMON_CRYPTO: 0
+ };
+
+ // Generated with: find src/libmongocrypt/src -maxdepth 1 -name '*.c' -print0 | cut -sz -d / -f 4- | sort -dz | tr '\000' ' '
+ var PHP_MONGODB_MONGOCRYPT_SOURCES="mongocrypt-binary.c mongocrypt-buffer.c mongocrypt.c mongocrypt-cache.c mongocrypt-cache-collinfo.c mongocrypt-cache-key.c mongocrypt-ciphertext.c mongocrypt-crypto.c mongocrypt-ctx.c mongocrypt-ctx-datakey.c mongocrypt-ctx-decrypt.c mongocrypt-ctx-encrypt.c mongocrypt-key-broker.c mongocrypt-key.c mongocrypt-kms-ctx.c mongocrypt-log.c mongocrypt-marking.c mongocrypt-opts.c mongocrypt-status.c mongocrypt-traverse-util.c";
+
+ // Generated with: find src/libmongocrypt/src/crypto -name '*.c' -print0 | cut -sz -d / -f 5- | sort -dz | tr '\000' ' '
+ var PHP_MONGODB_MONGOCRYPT_CRYPTO_SOURCES="cng.c commoncrypto.c libcrypto.c none.c";
+
+ // Generated with: find src/libmongocrypt/src/os_posix -name '*.c' -print0 | cut -sz -d / -f 5- | sort -dz | tr '\000' ' '
+ var PHP_MONGODB_MONGOCRYPT_OS_POSIX_SOURCES="os_mutex.c os_once.c";
+
+ // Generated with: find src/libmongocrypt/src/os_win -name '*.c' -print0 | cut -sz -d / -f 5- | sort -dz | tr '\000' ' '
+ var PHP_MONGODB_MONGOCRYPT_OS_WIN_SOURCES="os_mutex.c os_once.c";
+
+ // Generated with: find src/libmongocrypt/kms-message/src -maxdepth 1 -name '*.c' -print0 | cut -sz -d / -f 5- | sort -dz | tr '\000' ' '
+ var PHP_MONGODB_MONGOCRYPT_KMS_MESSAGE_SOURCES="hexlify.c kms_b64.c kms_caller_identity_request.c kms_crypto_apple.c kms_crypto_libcrypto.c kms_crypto_none.c kms_crypto_windows.c kms_decrypt_request.c kms_encrypt_request.c kms_kv_list.c kms_message.c kms_port.c kms_request.c kms_request_opt.c kms_request_str.c kms_response.c kms_response_parser.c sort.c";
+
+ MONGODB_ADD_SOURCES("/src/libmongocrypt/src", PHP_MONGODB_MONGOCRYPT_SOURCES);
+ MONGODB_ADD_SOURCES("/src/libmongocrypt/src/crypto", PHP_MONGODB_MONGOCRYPT_CRYPTO_SOURCES);
+ MONGODB_ADD_SOURCES("/src/libmongocrypt/src/os_posix", PHP_MONGODB_MONGOCRYPT_OS_POSIX_SOURCES);
+ MONGODB_ADD_SOURCES("/src/libmongocrypt/src/os_win", PHP_MONGODB_MONGOCRYPT_OS_WIN_SOURCES);
+ MONGODB_ADD_SOURCES("/src/libmongocrypt/kms-message/src", PHP_MONGODB_MONGOCRYPT_KMS_MESSAGE_SOURCES);
+
+ var mongocrypt_version = mongodb_parse_version_file(configure_module_dirname + "/src/LIBMONGOCRYPT_VERSION_CURRENT", "")
+ mongocrypt_opts.MONGOCRYPT_BUILD_VERSION = mongocrypt_version.VERSION;
+
+ mongodb_generate_header(
+ configure_module_dirname + "/src/libmongocrypt/src/mongocrypt-config.h.in",
+ configure_module_dirname + "/src/libmongocrypt/src/mongocrypt-config.h",
+ mongocrypt_opts
+ );
+
+ mongodb_generate_header(
+ configure_module_dirname + "/src/libmongocrypt/src/mongocrypt.h.in",
+ configure_module_dirname + "/src/libmongocrypt/src/mongocrypt.h",
+ mongocrypt_opts
+ );
+ } else if (PHP_MONGODB_CLIENT_SIDE_ENCRYPTION != "no") {
+ // No SSL library found, we can't enable libmongocrypt
+ WARNING("mongodb libmongocrypt support not enabled, crypto libs not found");
+ }
+
+ if (PHP_MONGODB_CLIENT_SIDE_ENCRYPTION == "no" && mongoc_ssl_found) {
+ // Add kms-message sources bundled with libmongoc
+ MONGODB_ADD_SOURCES("/src/libmongoc/src/kms-message/src", PHP_MONGODB_KMS_MESSAGE_SOURCES);
+ ADD_FLAG("CFLAGS_MONGODB", "/I" + configure_module_dirname + "/src/libmongoc/src/kms-message/src");
+ }
+
+ if (CHECK_LIB("dnsapi.lib", "mongodb", PHP_MONGODB) &&
+ CHECK_HEADER_ADD_INCLUDE("windns.h", "CFLAGS_MONGODB")) {
+ mongoc_opts.MONGOC_HAVE_DNSAPI = 1;
+ }
+
+ if (CHECK_LIB("icuuc.lib", "mongodb", PHP_MONGODB) &&
+ CHECK_HEADER_ADD_INCLUDE("unicode/utf.h", "CFLAGS_MONGODB")) {
+ mongoc_opts.MONGODB_ENABLE_ICU = 1;
+
+ ADD_FLAG("LIBS_MONGODB", "icudt.lib icuin.lib icuio.lib");
+
+ /* Compat for ICU before 58.1.*/
+ if (CHECK_LIB("icule.lib", "mongodb", PHP_MONGODB)) {
+ ADD_FLAG("LIBS_MONGODB", "icule.lib");
+ }
+ if (CHECK_LIB("iculx.lib", "mongodb", PHP_MONGODB)) {
+ ADD_FLAG("LIBS_MONGODB", "iculx.lib");
+ }
+
+ ADD_FLAG("CFLAGS_MONGODB", "/EHsc /D U_USING_ICU_NAMESPACE=1");
+ }
+
+ if (typeof COMPILER_NAME === 'string') {
+ mongoc_opts.MONGOC_CC = COMPILER_NAME;
+ } else if (typeof VC_VERSIONS === 'array' && typeof VC_VERSIONS[VCVERS] === 'string') {
+ mongoc_opts.MONGOC_CC = VC_VERSIONS[VCVERS];
+ } else if (typeof COMPILER_NAME_LONG === 'string') {
+ mongoc_opts.MONGOC_CC = COMPILER_NAME_LONG;
+ }
+
+ /* 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/libmongoc/src/mongoc/mongoc-config.h.in",
+ configure_module_dirname + "/src/libmongoc/src/libmongoc/src/mongoc/mongoc-config.h",
+ mongoc_opts
+ );
+
+ mongodb_generate_header(
+ configure_module_dirname + "/src/libmongoc/src/libmongoc/src/mongoc/mongoc-version.h.in",
+ configure_module_dirname + "/src/libmongoc/src/libmongoc/src/mongoc/mongoc-version.h",
+ mongodb_parse_version_file(configure_module_dirname + "/src/LIBMONGOC_VERSION_CURRENT", "MONGOC_")
+ );
+}
diff --git a/mongodb-1.9.0/phongo_compat.c b/mongodb-1.9.0/phongo_compat.c
new file mode 100644
index 00000000..721fed79
--- /dev/null
+++ b/mongodb-1.9.0/phongo_compat.c
@@ -0,0 +1,88 @@
+/*
+ * 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.
+ */
+
+/* Our Compatability header */
+#include "phongo_compat.h"
+
+void phongo_add_exception_prop(const char* prop, int prop_len, zval* value)
+{
+ if (EG(exception)) {
+ zval ex;
+ ZVAL_OBJ(&ex, EG(exception));
+ zend_update_property(Z_OBJCE(ex), PHONGO_COMPAT_OBJ_P(&ex), prop, prop_len, value);
+ }
+}
+
+#ifdef ZEND_HASH_GET_APPLY_COUNT /* PHP 7.2 or earlier recursion protection */
+zend_bool php_phongo_zend_hash_apply_protection_begin(HashTable* ht)
+{
+ if (!ht) {
+ return 1;
+ }
+ if (ZEND_HASH_GET_APPLY_COUNT(ht) > 0) {
+ return 0;
+ }
+ if (ZEND_HASH_APPLY_PROTECTION(ht)) {
+ ZEND_HASH_INC_APPLY_COUNT(ht);
+ }
+ return 1;
+}
+
+zend_bool php_phongo_zend_hash_apply_protection_end(HashTable* ht)
+{
+ if (!ht) {
+ return 1;
+ }
+ if (ZEND_HASH_GET_APPLY_COUNT(ht) == 0) {
+ return 0;
+ }
+ if (ZEND_HASH_APPLY_PROTECTION(ht)) {
+ ZEND_HASH_DEC_APPLY_COUNT(ht);
+ }
+ return 1;
+}
+#else /* PHP 7.3 or later */
+zend_bool php_phongo_zend_hash_apply_protection_begin(zend_array* ht)
+{
+ if (GC_IS_RECURSIVE(ht)) {
+ return 0;
+ }
+ if (!(GC_FLAGS(ht) & GC_IMMUTABLE)) {
+ GC_PROTECT_RECURSION(ht);
+ }
+ return 1;
+}
+
+zend_bool php_phongo_zend_hash_apply_protection_end(zend_array* ht)
+{
+ if (!GC_IS_RECURSIVE(ht)) {
+ return 0;
+ }
+ if (!(GC_FLAGS(ht) & GC_IMMUTABLE)) {
+ GC_UNPROTECT_RECURSION(ht);
+ }
+ return 1;
+}
+#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.9.0/phongo_compat.h b/mongodb-1.9.0/phongo_compat.h
new file mode 100644
index 00000000..4436bd85
--- /dev/null
+++ b/mongodb-1.9.0/phongo_compat.h
@@ -0,0 +1,183 @@
+/*
+ * 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>
+#include <Zend/zend_portability.h>
+
+#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 defined(__GNUC__)
+#define ARG_UNUSED __attribute__((unused))
+#else
+#define ARG_UNUSED
+#endif
+
+#if defined(__GNUC__)
+#define PHONGO_GNUC_CHECK_VERSION(major, minor) \
+ ((__GNUC__ > (major)) || \
+ ((__GNUC__ == (major)) && (__GNUC_MINOR__ >= (minor))))
+#else
+#define PHONGO_GNUC_CHECK_VERSION(major, minor) 0
+#endif
+
+#if PHONGO_GNUC_CHECK_VERSION(7, 0)
+#define PHONGO_BREAK_INTENTIONALLY_MISSING __attribute__((fallthrough));
+#else
+#define PHONGO_BREAK_INTENTIONALLY_MISSING
+#endif
+
+#if PHP_VERSION_ID >= 80000
+#define PHONGO_COMPAT_OBJ_P(val) Z_OBJ_P(val)
+#define phongo_compat_object_handler_type zend_object
+#define PHONGO_COMPAT_GET_OBJ(val) val
+#define PHONGO_COMPAT_SET_COMPARE_OBJECTS_HANDLER(type) php_phongo_handler_##type.compare = php_phongo_##type##_compare_objects;
+#else /* PHP_VERSION_ID < 80000 */
+#define PHONGO_COMPAT_OBJ_P(val) val
+#define phongo_compat_object_handler_type zval
+#define PHONGO_COMPAT_GET_OBJ(val) Z_OBJ_P(val)
+#define PHONGO_COMPAT_SET_COMPARE_OBJECTS_HANDLER(type) php_phongo_handler_##type.compare_objects = php_phongo_##type##_compare_objects;
+#define ZEND_COMPARE_OBJECTS_FALLBACK(o1, o2)
+#endif /* PHP_VERSION_ID >= 80000 */
+
+#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 PHONGO_ALLOC_OBJECT_T(_obj_t, _class_type) (_obj_t*) ecalloc(1, sizeof(_obj_t) + zend_object_properties_size(_class_type))
+#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 ZVAL_INT64_STRING(_zv, _value) \
+ do { \
+ char tmp[24]; \
+ int tmp_len; \
+ tmp_len = snprintf(tmp, sizeof(tmp), "%" PRId64, (_value)); \
+ ZVAL_STRINGL((_zv), tmp, tmp_len); \
+ } while (0)
+#define ADD_ASSOC_INT64_AS_STRING(_zv, _key, _value) \
+ do { \
+ zval z_int; \
+ ZVAL_INT64_STRING(&z_int, (_value)); \
+ ADD_ASSOC_ZVAL_EX((_zv), (_key), &z_int); \
+ } while (0)
+#define ADD_NEXT_INDEX_STRINGL(_zv, _value, _len) add_next_index_stringl(_zv, _value, _len);
+#define PHONGO_RETVAL_SMART_STR(val) RETVAL_STRINGL(ZSTR_VAL((val).s), ZSTR_LEN((val).s));
+#define ZVAL_STATIC_INIT \
+ { \
+ { \
+ 0 \
+ } \
+ }
+
+#if SIZEOF_ZEND_LONG == 8
+#define ADD_INDEX_INT64(_zv, _index, _value) add_index_long((_zv), (_index), (_value))
+#define ADD_NEXT_INDEX_INT64(_zv, _value) add_next_index_long((_zv), (_value))
+#define ADD_ASSOC_INT64(_zv, _key, _value) add_assoc_long((_zv), (_key), (_value))
+#define ZVAL_INT64(_zv, _value) ZVAL_LONG((_zv), (_value))
+#elif SIZEOF_ZEND_LONG == 4
+#define ADD_INDEX_INT64(_zv, _index, _value) \
+ if ((_value) > INT32_MAX || (_value) < INT32_MIN) { \
+ zval zchild; \
+ php_phongo_bson_new_int64(&zchild, (_value)); \
+ add_index_zval((_zv), (_index), &zchild); \
+ } else { \
+ add_index_long((_zv), (_index), (_value)); \
+ }
+#define ADD_NEXT_INDEX_INT64(_zv, _value) \
+ if ((_value) > INT32_MAX || (_value) < INT32_MIN) { \
+ zval zchild; \
+ php_phongo_bson_new_int64(&zchild, (_value)); \
+ add_next_index_zval((_zv), &zchild); \
+ } else { \
+ add_next_index_long((_zv), (_value)); \
+ }
+#define ADD_ASSOC_INT64(_zv, _key, _value) \
+ if ((_value) > INT32_MAX || (_value) < INT32_MIN) { \
+ zval zchild; \
+ php_phongo_bson_new_int64(&zchild, (_value)); \
+ add_assoc_zval((_zv), (_key), &zchild); \
+ } else { \
+ add_assoc_long((_zv), (_key), (_value)); \
+ }
+#define ZVAL_INT64(_zv, _value) \
+ if ((_value) > INT32_MAX || (_value) < INT32_MIN) { \
+ php_phongo_bson_new_int64((_zv), (_value)); \
+ } else { \
+ ZVAL_LONG((_zv), (_value)); \
+ }
+#else /* SIZEOF_ZEND_LONG != 8 && SIZEOF_ZEND_LONG != 4 */
+#error Unsupported architecture (integers are neither 32-bit nor 64-bit)
+#endif /* SIZEOF_ZEND_LONG */
+
+#if PHP_VERSION_ID < 70300
+#define ZVAL_COPY_DEREF(z, v) \
+ do { \
+ zval* _z3 = (v); \
+ if (Z_OPT_REFCOUNTED_P(_z3)) { \
+ if (UNEXPECTED(Z_OPT_ISREF_P(_z3))) { \
+ _z3 = Z_REFVAL_P(_z3); \
+ if (Z_OPT_REFCOUNTED_P(_z3)) { \
+ Z_ADDREF_P(_z3); \
+ } \
+ } else { \
+ Z_ADDREF_P(_z3); \
+ } \
+ } \
+ ZVAL_COPY_VALUE(z, _z3); \
+ } while (0)
+#endif /* PHP_VERSION_ID < 70300 */
+
+void phongo_add_exception_prop(const char* prop, int prop_len, zval* value);
+zend_bool php_phongo_zend_hash_apply_protection_begin(HashTable* ht);
+zend_bool php_phongo_zend_hash_apply_protection_end(HashTable* ht);
+
+#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.9.0/phongo_version.h b/mongodb-1.9.0/phongo_version.h
new file mode 100644
index 00000000..4517f981
--- /dev/null
+++ b/mongodb-1.9.0/phongo_version.h
@@ -0,0 +1,26 @@
+/*
+ * Copyright 2014-2018 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_VERSION_H
+#define PHONGO_VERSION_H
+
+/* clang-format off */
+#define PHP_MONGODB_VERSION "1.9.0"
+#define PHP_MONGODB_STABILITY "stable"
+#define PHP_MONGODB_VERSION_DESC 1,9,0,3
+/* clang-format on */
+
+#endif /* PHONGO_VERSION_H */
diff --git a/mongodb-1.8.1/php_bson.h b/mongodb-1.9.0/php_bson.h
similarity index 100%
rename from mongodb-1.8.1/php_bson.h
rename to mongodb-1.9.0/php_bson.h
diff --git a/mongodb-1.9.0/php_phongo.c b/mongodb-1.9.0/php_phongo.c
new file mode 100644
index 00000000..46ebf1d8
--- /dev/null
+++ b/mongodb-1.9.0/php_phongo.c
@@ -0,0 +1,3941 @@
+/*
+ * 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.
+ */
+
+/* External libs */
+#include "bson/bson.h"
+#include "mongoc/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>
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <Zend/zend_smart_str.h>
+
+#ifdef MONGOC_ENABLE_CLIENT_SIDE_ENCRYPTION
+#include <mongocrypt/mongocrypt.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"
+#include "src/BSON/functions.h"
+#include "src/MongoDB/Monitoring/functions.h"
+
+#undef MONGOC_LOG_DOMAIN
+#define MONGOC_LOG_DOMAIN "PHONGO"
+
+#define PHONGO_DEBUG_INI "mongodb.debug"
+#define PHONGO_DEBUG_INI_DEFAULT ""
+#define PHONGO_METADATA_SEPARATOR " / "
+#define PHONGO_METADATA_SEPARATOR_LEN (sizeof(PHONGO_METADATA_SEPARATOR) - 1)
+
+ZEND_DECLARE_MODULE_GLOBALS(mongodb)
+#if defined(ZTS) && defined(COMPILE_DL_MONGODB)
+ZEND_TSRMLS_CACHE_DEFINE();
+#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_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(mongoc_error_domain_t domain, mongoc_error_code_t code)
+{
+ if (domain == MONGOC_ERROR_CLIENT) {
+ if (code == MONGOC_ERROR_CLIENT_AUTHENTICATE) {
+ return php_phongo_authenticationexception_ce;
+ }
+
+ if (code == MONGOC_ERROR_CLIENT_INVALID_ENCRYPTION_ARG) {
+ return php_phongo_invalidargumentexception_ce;
+ }
+ }
+
+ if (domain == MONGOC_ERROR_COMMAND && code == MONGOC_ERROR_COMMAND_INVALID_ARG) {
+ return php_phongo_invalidargumentexception_ce;
+ }
+
+ if (domain == MONGOC_ERROR_SERVER) {
+ if (code == PHONGO_SERVER_ERROR_EXCEEDED_TIME_LIMIT) {
+ return php_phongo_executiontimeoutexception_ce;
+ }
+
+ return php_phongo_serverexception_ce;
+ }
+
+ if (domain == MONGOC_ERROR_SERVER_SELECTION && code == MONGOC_ERROR_SERVER_SELECTION_FAILURE) {
+ return php_phongo_connectiontimeoutexception_ce;
+ }
+
+ if (domain == MONGOC_ERROR_STREAM) {
+ if (code == MONGOC_ERROR_STREAM_SOCKET) {
+ return php_phongo_connectiontimeoutexception_ce;
+ }
+
+ return php_phongo_connectionexception_ce;
+ }
+
+ if (domain == MONGOC_ERROR_WRITE_CONCERN) {
+ return php_phongo_serverexception_ce;
+ }
+
+ if (domain == MONGOC_ERROR_PROTOCOL && code == MONGOC_ERROR_PROTOCOL_BAD_WIRE_VERSION) {
+ return php_phongo_connectionexception_ce;
+ }
+
+ if (domain == MONGOC_ERROR_CLIENT_SIDE_ENCRYPTION) {
+ return php_phongo_encryptionexception_ce;
+ }
+
+ return php_phongo_runtimeexception_ce;
+}
+void phongo_throw_exception(php_phongo_error_domain_t domain, 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);
+ efree(message);
+ va_end(args);
+}
+
+static int phongo_exception_append_error_labels(zval* labels, const bson_iter_t* iter)
+{
+ bson_iter_t error_labels;
+ uint32_t label_count = 0;
+
+ if (!BSON_ITER_HOLDS_ARRAY(iter) || !bson_iter_recurse(iter, &error_labels)) {
+ return label_count;
+ }
+
+ while (bson_iter_next(&error_labels)) {
+ if (BSON_ITER_HOLDS_UTF8(&error_labels)) {
+ const char* error_label;
+ uint32_t error_label_len;
+
+ error_label = bson_iter_utf8(&error_labels, &error_label_len);
+ ADD_NEXT_INDEX_STRINGL(labels, error_label, error_label_len);
+ label_count++;
+ }
+ }
+
+ return label_count;
+}
+
+static void phongo_exception_add_error_labels(const bson_t* reply)
+{
+ bson_iter_t iter, child;
+ zval labels;
+ uint32_t label_count = 0;
+
+ if (!reply) {
+ return;
+ }
+
+ array_init(&labels);
+
+ if (bson_iter_init_find(&iter, reply, "errorLabels")) {
+ label_count += phongo_exception_append_error_labels(&labels, &iter);
+ }
+
+ if (bson_iter_init_find(&iter, reply, "writeConcernError") && BSON_ITER_HOLDS_DOCUMENT(&iter) &&
+ bson_iter_recurse(&iter, &child) && bson_iter_find(&child, "errorLabels")) {
+ label_count += phongo_exception_append_error_labels(&labels, &child);
+ }
+
+ /* mongoc_write_result_t always reports writeConcernErrors in an array, so
+ * we must iterate this to collect WCE labels for BulkWrite replies. */
+ if (bson_iter_init_find(&iter, reply, "writeConcernErrors") && BSON_ITER_HOLDS_ARRAY(&iter) && bson_iter_recurse(&iter, &child)) {
+ bson_iter_t wce;
+
+ while (bson_iter_next(&child)) {
+ if (BSON_ITER_HOLDS_DOCUMENT(&child) && bson_iter_recurse(&child, &wce) && bson_iter_find(&wce, "errorLabels")) {
+ label_count += phongo_exception_append_error_labels(&labels, &wce);
+ }
+ }
+ }
+
+ if (label_count > 0) {
+ phongo_add_exception_prop(ZEND_STRL("errorLabels"), &labels);
+ }
+
+ zval_ptr_dtor(&labels);
+}
+
+void phongo_throw_exception_from_bson_error_t_and_reply(bson_error_t* error, const bson_t* reply)
+{
+ /* Server errors (other than ExceededTimeLimit) and write concern errors
+ * may use CommandException and report the result document for the
+ * failed command. For BC, ExceededTimeLimit errors will continue to use
+ * ExcecutionTimeoutException and omit the result document. */
+ if (reply && ((error->domain == MONGOC_ERROR_SERVER && error->code != PHONGO_SERVER_ERROR_EXCEEDED_TIME_LIMIT) || error->domain == MONGOC_ERROR_WRITE_CONCERN)) {
+ zval zv;
+
+ zend_throw_exception(php_phongo_commandexception_ce, error->message, error->code);
+ if (php_phongo_bson_to_zval(bson_get_data(reply), reply->len, &zv)) {
+ phongo_add_exception_prop(ZEND_STRL("resultDocument"), &zv);
+ }
+
+ zval_ptr_dtor(&zv);
+ } else {
+ zend_throw_exception(phongo_exception_from_mongoc_domain(error->domain, error->code), error->message, error->code);
+ }
+ phongo_exception_add_error_labels(reply);
+}
+
+void phongo_throw_exception_from_bson_error_t(bson_error_t* error)
+{
+ phongo_throw_exception_from_bson_error_t_and_reply(error, NULL);
+}
+
+static void php_phongo_log(mongoc_log_level_t log_level, const char* log_domain, const char* message, void* user_data)
+{
+ struct timeval tv;
+ time_t t;
+ zend_long tu;
+ zend_string* dt;
+
+ (void) user_data;
+
+ gettimeofday(&tv, NULL);
+ t = tv.tv_sec;
+ tu = tv.tv_usec;
+
+ dt = php_format_date((char*) ZEND_STRL("Y-m-d\\TH:i:s"), t, 0);
+
+ fprintf(MONGODB_G(debug_fd), "[%s.%06" PHONGO_LONG_FORMAT "+00:00] %10s: %-8s> %s\n", ZSTR_VAL(dt), tu, log_domain, mongoc_log_level_str(log_level), message);
+ fflush(MONGODB_G(debug_fd));
+ efree(dt);
+}
+
+/* }}} */
+
+/* {{{ Init objects */
+static void phongo_cursor_init(zval* return_value, mongoc_client_t* client, mongoc_cursor_t* cursor, zval* readPreference, zval* session) /* {{{ */
+{
+ 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 = client;
+ intern->advanced = false;
+ intern->current = 0;
+
+ if (readPreference) {
+ ZVAL_ZVAL(&intern->read_preference, readPreference, 1, 0);
+ }
+
+ if (session) {
+ ZVAL_ZVAL(&intern->session, session, 1, 0);
+ }
+} /* }}} */
+
+static void phongo_cursor_init_for_command(zval* return_value, mongoc_client_t* client, mongoc_cursor_t* cursor, const char* db, zval* command, zval* readPreference, zval* session) /* {{{ */
+{
+ php_phongo_cursor_t* intern;
+
+ phongo_cursor_init(return_value, client, cursor, readPreference, session);
+ intern = Z_CURSOR_OBJ_P(return_value);
+
+ intern->database = estrdup(db);
+
+ ZVAL_ZVAL(&intern->command, command, 1, 0);
+} /* }}} */
+
+static void phongo_cursor_init_for_query(zval* return_value, mongoc_client_t* client, mongoc_cursor_t* cursor, const char* namespace, zval* query, zval* readPreference, zval* session) /* {{{ */
+{
+ php_phongo_cursor_t* intern;
+
+ phongo_cursor_init(return_value, client, cursor, readPreference, session);
+ intern = Z_CURSOR_OBJ_P(return_value);
+
+ /* namespace has already been validated by phongo_execute_query() */
+ phongo_split_namespace(namespace, &intern->database, &intern->collection);
+
+ /* cursor has already been advanced by phongo_execute_query() calling
+ * phongo_cursor_advance_and_check_for_error() */
+ intern->advanced = true;
+
+ ZVAL_ZVAL(&intern->query, query, 1, 0);
+} /* }}} */
+
+void phongo_server_init(zval* return_value, mongoc_client_t* client, uint32_t server_id) /* {{{ */
+{
+ 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 = client;
+}
+/* }}} */
+
+void phongo_session_init(zval* return_value, mongoc_client_session_t* client_session) /* {{{ */
+{
+ php_phongo_session_t* session;
+
+ object_init_ex(return_value, php_phongo_session_ce);
+
+ session = Z_SESSION_OBJ_P(return_value);
+ session->client_session = client_session;
+ session->client = mongoc_client_session_get_client(client_session);
+}
+/* }}} */
+
+void phongo_readconcern_init(zval* return_value, const mongoc_read_concern_t* read_concern) /* {{{ */
+{
+ 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) /* {{{ */
+{
+ 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) /* {{{ */
+{
+ 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) /* {{{ */
+{
+ 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);
+ intern->code = 0;
+
+ 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 (!php_phongo_bson_to_zval(data, len, &intern->info)) {
+ zval_ptr_dtor(&intern->info);
+ ZVAL_UNDEF(&intern->info);
+
+ return false;
+ }
+ }
+
+ return true;
+} /* }}} */
+
+zend_bool phongo_writeerror_init(zval* return_value, bson_t* bson) /* {{{ */
+{
+ 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);
+ intern->code = 0;
+ intern->index = 0;
+
+ 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 (!php_phongo_bson_to_zval(data, len, &intern->info)) {
+ zval_ptr_dtor(&intern->info);
+ ZVAL_UNDEF(&intern->info);
+
+ return false;
+ }
+ }
+
+ if (bson_iter_init_find(&iter, bson, "index") && BSON_ITER_HOLDS_INT32(&iter)) {
+ intern->index = bson_iter_int32(&iter);
+ }
+
+ return true;
+} /* }}} */
+
+static php_phongo_writeresult_t* phongo_writeresult_init(zval* return_value, bson_t* reply, mongoc_client_t* client, uint32_t server_id) /* {{{ */
+{
+ 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 = client;
+
+ 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;
+} /* }}} */
+
+/* Parses the "readConcern" option for an execute method. If mongoc_opts is not
+ * NULL, the option will be appended. On error, false is returned and an
+ * exception is thrown. */
+static bool phongo_parse_read_concern(zval* options, bson_t* mongoc_opts) /* {{{ */
+{
+ zval* option = NULL;
+ mongoc_read_concern_t* read_concern;
+
+ if (!options) {
+ return true;
+ }
+
+ if (Z_TYPE_P(options) != IS_ARRAY) {
+ phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Expected options to be array, %s given", PHONGO_ZVAL_CLASS_OR_TYPE_NAME_P(options));
+ return false;
+ }
+
+ option = php_array_fetchc(options, "readConcern");
+
+ if (!option) {
+ return true;
+ }
+
+ if (Z_TYPE_P(option) != IS_OBJECT || !instanceof_function(Z_OBJCE_P(option), php_phongo_readconcern_ce)) {
+ phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Expected \"readConcern\" option to be %s, %s given", ZSTR_VAL(php_phongo_readconcern_ce->name), PHONGO_ZVAL_CLASS_OR_TYPE_NAME_P(option));
+ return false;
+ }
+
+ read_concern = Z_READCONCERN_OBJ_P(option)->read_concern;
+
+ if (mongoc_opts && !mongoc_read_concern_append(read_concern, mongoc_opts)) {
+ phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Error appending \"readConcern\" option");
+ return false;
+ }
+
+ return true;
+} /* }}} */
+
+/* Parses the "readPreference" option for an execute method. If zreadPreference
+ * is not NULL, it will be assigned to the option. On error, false is returned
+ * and an exception is thrown. */
+bool phongo_parse_read_preference(zval* options, zval** zreadPreference) /* {{{ */
+{
+ zval* option = NULL;
+
+ if (!options) {
+ return true;
+ }
+
+ if (Z_TYPE_P(options) != IS_ARRAY) {
+ phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Expected options to be array, %s given", PHONGO_ZVAL_CLASS_OR_TYPE_NAME_P(options));
+ return false;
+ }
+
+ option = php_array_fetchc(options, "readPreference");
+
+ if (!option) {
+ return true;
+ }
+
+ if (Z_TYPE_P(option) != IS_OBJECT || !instanceof_function(Z_OBJCE_P(option), php_phongo_readpreference_ce)) {
+ phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Expected \"readPreference\" option to be %s, %s given", ZSTR_VAL(php_phongo_readpreference_ce->name), PHONGO_ZVAL_CLASS_OR_TYPE_NAME_P(option));
+ return false;
+ }
+
+ if (zreadPreference) {
+ *zreadPreference = option;
+ }
+
+ return true;
+} /* }}} */
+
+/* Parses the "session" option for an execute method. The client object should
+ * correspond to the Manager executing the operation and will be used to ensure
+ * that the session is correctly associated with that client. If mongoc_opts is
+ * not NULL, the option will be appended. If zsession is not NULL, it will be
+ * assigned to the option. On error, false is returned and an exception is
+ * thrown. */
+bool phongo_parse_session(zval* options, mongoc_client_t* client, bson_t* mongoc_opts, zval** zsession) /* {{{ */
+{
+ zval* option = NULL;
+ const mongoc_client_session_t* client_session;
+
+ if (!options) {
+ return true;
+ }
+
+ if (Z_TYPE_P(options) != IS_ARRAY) {
+ phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Expected options to be array, %s given", PHONGO_ZVAL_CLASS_OR_TYPE_NAME_P(options));
+ return false;
+ }
+
+ option = php_array_fetchc(options, "session");
+
+ if (!option) {
+ return true;
+ }
+
+ if (Z_TYPE_P(option) != IS_OBJECT || !instanceof_function(Z_OBJCE_P(option), php_phongo_session_ce)) {
+ phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Expected \"session\" option to be %s, %s given", ZSTR_VAL(php_phongo_session_ce->name), PHONGO_ZVAL_CLASS_OR_TYPE_NAME_P(option));
+ return false;
+ }
+
+ client_session = Z_SESSION_OBJ_P(option)->client_session;
+
+ if (client != mongoc_client_session_get_client(client_session)) {
+ phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Cannot use Session started from a different Manager");
+ return false;
+ }
+
+ if (mongoc_opts && !mongoc_client_session_append(client_session, mongoc_opts, NULL)) {
+ phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Error appending \"session\" option");
+ return false;
+ }
+
+ if (zsession) {
+ *zsession = option;
+ }
+
+ return true;
+} /* }}} */
+
+/* Parses the "writeConcern" option for an execute method. If mongoc_opts is not
+ * NULL, the option will be appended. If zwriteConcern is not NULL, it will be
+ * assigned to the option. On error, false is returned and an exception is
+ * thrown. */
+static bool phongo_parse_write_concern(zval* options, bson_t* mongoc_opts, zval** zwriteConcern) /* {{{ */
+{
+ zval* option = NULL;
+ mongoc_write_concern_t* write_concern;
+
+ if (!options) {
+ return true;
+ }
+
+ if (Z_TYPE_P(options) != IS_ARRAY) {
+ phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Expected options to be array, %s given", PHONGO_ZVAL_CLASS_OR_TYPE_NAME_P(options));
+ return false;
+ }
+
+ option = php_array_fetchc(options, "writeConcern");
+
+ if (!option) {
+ return true;
+ }
+
+ if (Z_TYPE_P(option) != IS_OBJECT || !instanceof_function(Z_OBJCE_P(option), php_phongo_writeconcern_ce)) {
+ phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Expected \"writeConcern\" option to be %s, %s given", ZSTR_VAL(php_phongo_writeconcern_ce->name), PHONGO_ZVAL_CLASS_OR_TYPE_NAME_P(option));
+ return false;
+ }
+
+ write_concern = Z_WRITECONCERN_OBJ_P(option)->write_concern;
+
+ if (mongoc_opts && !mongoc_write_concern_append(write_concern, mongoc_opts)) {
+ phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Error appending \"writeConcern\" option");
+ return false;
+ }
+
+ if (zwriteConcern) {
+ *zwriteConcern = option;
+ }
+
+ return true;
+}
+
+bool phongo_execute_bulk_write(mongoc_client_t* client, const char* namespace, php_phongo_bulkwrite_t* bulk_write, zval* options, uint32_t server_id, zval* return_value) /* {{{ */
+{
+ bson_error_t error = { 0 };
+ int success;
+ bson_t reply = BSON_INITIALIZER;
+ mongoc_bulk_operation_t* bulk = bulk_write->bulk;
+ php_phongo_writeresult_t* writeresult;
+ zval* zwriteConcern = NULL;
+ zval* zsession = NULL;
+ const mongoc_write_concern_t* write_concern = NULL;
+
+ if (bulk_write->executed) {
+ phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "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, "%s: %s", "Invalid namespace provided", namespace);
+ return false;
+ }
+
+ if (!phongo_parse_session(options, client, NULL, &zsession)) {
+ /* Exception should already have been thrown */
+ return false;
+ }
+
+ if (!phongo_parse_write_concern(options, NULL, &zwriteConcern)) {
+ /* Exception should already have been thrown */
+ return false;
+ }
+
+ /* 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.
+ * Additionally, we need to check if an unacknowledged write concern would
+ * conflict with an explicit session. */
+ write_concern = zwriteConcern ? Z_WRITECONCERN_OBJ_P(zwriteConcern)->write_concern : mongoc_client_get_write_concern(client);
+
+ if (zsession && !mongoc_write_concern_is_acknowledged(write_concern)) {
+ phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Cannot combine \"session\" option with an unacknowledged write concern");
+ 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);
+ mongoc_bulk_operation_set_hint(bulk, server_id);
+
+ if (zsession) {
+ ZVAL_ZVAL(&bulk_write->session, zsession, 1, 0);
+ mongoc_bulk_operation_set_client_session(bulk, Z_SESSION_OBJ_P(zsession)->client_session);
+ }
+
+ if (zwriteConcern) {
+ mongoc_bulk_operation_set_write_concern(bulk, Z_WRITECONCERN_OBJ_P(zwriteConcern)->write_concern);
+ }
+
+ success = mongoc_bulk_operation_execute(bulk, &reply, &error);
+ bulk_write->executed = true;
+
+ writeresult = phongo_writeresult_init(return_value, &reply, client, mongoc_bulk_operation_get_hint(bulk));
+ writeresult->write_concern = mongoc_write_concern_copy(write_concern);
+
+ /* A BulkWriteException is always thrown if mongoc_bulk_operation_execute()
+ * fails to ensure that the write result is accessible. If the error does
+ * not originate from the server (e.g. socket error), throw the appropriate
+ * exception first. It will be included in BulkWriteException's message and
+ * will also be accessible via Exception::getPrevious(). */
+ if (!success) {
+ if (error.domain != MONGOC_ERROR_SERVER && error.domain != MONGOC_ERROR_WRITE_CONCERN) {
+ phongo_throw_exception_from_bson_error_t_and_reply(&error, &reply);
+ }
+
+ /* Argument errors occur before command execution, so there is no need
+ * to layer this InvalidArgumentException behind a BulkWriteException.
+ * In practice, this will be a "Cannot do an empty bulk write" error. */
+ if (error.domain == MONGOC_ERROR_COMMAND && error.code == MONGOC_ERROR_COMMAND_INVALID_ARG) {
+ goto cleanup;
+ }
+
+ if (EG(exception)) {
+ char* message;
+
+ (void) spprintf(&message, 0, "Bulk write failed due to previous %s: %s", PHONGO_ZVAL_EXCEPTION_NAME(EG(exception)), error.message);
+ zend_throw_exception(php_phongo_bulkwriteexception_ce, message, 0);
+ efree(message);
+ } else {
+ zend_throw_exception(php_phongo_bulkwriteexception_ce, error.message, error.code);
+ }
+
+ /* Ensure error labels are added to the final BulkWriteException. If a
+ * previous exception was also thrown, error labels will already have
+ * been added by phongo_throw_exception_from_bson_error_t_and_reply. */
+ phongo_exception_add_error_labels(&reply);
+ phongo_add_exception_prop(ZEND_STRL("writeResult"), return_value);
+ }
+
+cleanup:
+ bson_destroy(&reply);
+
+ return success;
+} /* }}} */
+
+/* Advance the cursor and return whether there is an error. On error, false is
+ * returned and an exception is thrown. */
+bool phongo_cursor_advance_and_check_for_error(mongoc_cursor_t* cursor) /* {{{ */
+{
+ const bson_t* doc = NULL;
+
+ if (!mongoc_cursor_next(cursor, &doc)) {
+ bson_error_t error = { 0 };
+
+ /* Check for connection related exceptions */
+ if (EG(exception)) {
+ return false;
+ }
+
+ /* Could simply be no docs, which is not an error */
+ if (mongoc_cursor_error_document(cursor, &error, &doc)) {
+ phongo_throw_exception_from_bson_error_t_and_reply(&error, doc);
+ return false;
+ }
+ }
+
+ return true;
+} /* }}} */
+
+bool phongo_execute_query(mongoc_client_t* client, const char* namespace, zval* zquery, zval* options, uint32_t server_id, zval* return_value) /* {{{ */
+{
+ const php_phongo_query_t* query;
+ bson_t opts = BSON_INITIALIZER;
+ mongoc_cursor_t* cursor;
+ char* dbname;
+ char* collname;
+ mongoc_collection_t* collection;
+ zval* zreadPreference = NULL;
+ zval* zsession = NULL;
+
+ if (!phongo_split_namespace(namespace, &dbname, &collname)) {
+ phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "%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);
+
+ bson_copy_to(query->opts, &opts);
+
+ if (query->read_concern) {
+ mongoc_collection_set_read_concern(collection, query->read_concern);
+ }
+
+ if (!phongo_parse_read_preference(options, &zreadPreference)) {
+ /* Exception should already have been thrown */
+ mongoc_collection_destroy(collection);
+ bson_destroy(&opts);
+ return false;
+ }
+
+ if (!phongo_parse_session(options, client, &opts, &zsession)) {
+ /* Exception should already have been thrown */
+ mongoc_collection_destroy(collection);
+ bson_destroy(&opts);
+ return false;
+ }
+
+ if (!BSON_APPEND_INT32(&opts, "serverId", server_id)) {
+ phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Error appending \"serverId\" option");
+ mongoc_collection_destroy(collection);
+ bson_destroy(&opts);
+ return false;
+ }
+
+ cursor = mongoc_collection_find_with_opts(collection, query->filter, &opts, phongo_read_preference_from_zval(zreadPreference));
+ mongoc_collection_destroy(collection);
+ bson_destroy(&opts);
+
+ /* maxAwaitTimeMS must be set before the cursor is sent */
+ if (query->max_await_time_ms) {
+ mongoc_cursor_set_max_await_time_ms(cursor, query->max_await_time_ms);
+ }
+
+ if (!phongo_cursor_advance_and_check_for_error(cursor)) {
+ mongoc_cursor_destroy(cursor);
+ return false;
+ }
+
+ phongo_cursor_init_for_query(return_value, client, cursor, namespace, zquery, zreadPreference, zsession);
+
+ return true;
+} /* }}} */
+
+static bson_t* create_wrapped_command_envelope(const char* db, bson_t* reply)
+{
+ bson_t* tmp;
+ size_t max_ns_len = strlen(db) + 5 + 1; /* db + ".$cmd" + '\0' */
+ char* ns = emalloc(max_ns_len);
+
+ snprintf(ns, max_ns_len, "%s.$cmd", db);
+ tmp = BCON_NEW("cursor", "{", "id", BCON_INT64(0), "ns", BCON_UTF8(ns), "firstBatch", "[", BCON_DOCUMENT(reply), "]", "}");
+ efree(ns);
+
+ return tmp;
+}
+
+static zval* phongo_create_implicit_session(mongoc_client_t* client) /* {{{ */
+{
+ mongoc_client_session_t* cs;
+ zval* zsession;
+
+ cs = mongoc_client_start_session(client, NULL, NULL);
+
+ if (!cs) {
+ return NULL;
+ }
+
+ zsession = ecalloc(sizeof(zval), 1);
+
+ phongo_session_init(zsession, cs);
+
+ return zsession;
+} /* }}} */
+
+bool phongo_execute_command(mongoc_client_t* client, php_phongo_command_type_t type, const char* db, zval* zcommand, zval* options, uint32_t server_id, zval* return_value) /* {{{ */
+{
+ const php_phongo_command_t* command;
+ bson_iter_t iter;
+ bson_t reply;
+ bson_error_t error = { 0 };
+ bson_t opts = BSON_INITIALIZER;
+ mongoc_cursor_t* cmd_cursor;
+ zval* zreadPreference = NULL;
+ zval* zsession = NULL;
+ bool result = false;
+ bool free_reply = false;
+ bool free_zsession = false;
+ bool is_unacknowledged_write_concern = false;
+
+ command = Z_COMMAND_OBJ_P(zcommand);
+
+ if ((type & PHONGO_OPTION_READ_CONCERN) && !phongo_parse_read_concern(options, &opts)) {
+ /* Exception should already have been thrown */
+ goto cleanup;
+ }
+
+ if ((type & PHONGO_OPTION_READ_PREFERENCE) && !phongo_parse_read_preference(options, &zreadPreference)) {
+ /* Exception should already have been thrown */
+ goto cleanup;
+ }
+
+ if (!phongo_parse_session(options, client, &opts, &zsession)) {
+ /* Exception should already have been thrown */
+ goto cleanup;
+ }
+
+ if (type & PHONGO_OPTION_WRITE_CONCERN) {
+ zval* zwriteConcern = NULL;
+
+ if (!phongo_parse_write_concern(options, &opts, &zwriteConcern)) {
+ /* Exception should already have been thrown */
+ goto cleanup;
+ }
+
+ /* Determine if the explicit or inherited write concern is
+ * unacknowledged so that we can ensure it does not conflict with an
+ * explicit or implicit session. */
+ if (zwriteConcern) {
+ is_unacknowledged_write_concern = !mongoc_write_concern_is_acknowledged(Z_WRITECONCERN_OBJ_P(zwriteConcern)->write_concern);
+ } else if (type != PHONGO_COMMAND_RAW) {
+ is_unacknowledged_write_concern = !mongoc_write_concern_is_acknowledged(mongoc_client_get_write_concern(client));
+ }
+ }
+
+ if (zsession && is_unacknowledged_write_concern) {
+ phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Cannot combine \"session\" option with an unacknowledged write concern");
+ goto cleanup;
+ }
+
+ /* If an explicit session was not provided and the effective write concern
+ * is not unacknowledged, attempt to create an implicit client session
+ * (ignoring any errors). */
+ if (!zsession && !is_unacknowledged_write_concern) {
+ zsession = phongo_create_implicit_session(client);
+
+ if (zsession) {
+ free_zsession = true;
+
+ if (!mongoc_client_session_append(Z_SESSION_OBJ_P(zsession)->client_session, &opts, NULL)) {
+ phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Error appending implicit \"sessionId\" option");
+ goto cleanup;
+ }
+ }
+ }
+
+ if (!BSON_APPEND_INT32(&opts, "serverId", server_id)) {
+ phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Error appending \"serverId\" option");
+ goto cleanup;
+ }
+
+ /* Although "opts" already always includes the serverId option, the read
+ * preference is added to the command parts, which is relevant for mongos
+ * command construction. */
+ switch (type) {
+ case PHONGO_COMMAND_RAW:
+ result = mongoc_client_command_with_opts(client, db, command->bson, phongo_read_preference_from_zval(zreadPreference), &opts, &reply, &error);
+ break;
+ case PHONGO_COMMAND_READ:
+ result = mongoc_client_read_command_with_opts(client, db, command->bson, phongo_read_preference_from_zval(zreadPreference), &opts, &reply, &error);
+ break;
+ case PHONGO_COMMAND_WRITE:
+ result = mongoc_client_write_command_with_opts(client, db, command->bson, &opts, &reply, &error);
+ break;
+ case PHONGO_COMMAND_READ_WRITE:
+ /* We can pass NULL as readPreference, as this argument was added historically, but has no function */
+ result = mongoc_client_read_write_command_with_opts(client, db, command->bson, NULL, &opts, &reply, &error);
+ break;
+ default:
+ /* Should never happen, but if it does: exception */
+ phongo_throw_exception(PHONGO_ERROR_LOGIC, "Type '%d' should never have been passed to phongo_execute_command, please file a bug report", type);
+ goto cleanup;
+ }
+
+ free_reply = true;
+
+ if (!result) {
+ phongo_throw_exception_from_bson_error_t_and_reply(&error, &reply);
+ goto cleanup;
+ }
+
+ /* According to mongoc_cursor_new_from_command_reply_with_opts(), the reply
+ * bson_t is ultimately destroyed on both success and failure. */
+ if (bson_iter_init_find(&iter, &reply, "cursor") && BSON_ITER_HOLDS_DOCUMENT(&iter)) {
+ bson_t initial_reply = BSON_INITIALIZER;
+ bson_t cursor_opts = BSON_INITIALIZER;
+ bson_error_t error = { 0 };
+
+ bson_copy_to(&reply, &initial_reply);
+
+ bson_append_int32(&cursor_opts, "serverId", -1, server_id);
+
+ if (command->max_await_time_ms) {
+ bson_append_bool(&cursor_opts, "awaitData", -1, 1);
+ bson_append_int64(&cursor_opts, "maxAwaitTimeMS", -1, command->max_await_time_ms);
+ bson_append_bool(&cursor_opts, "tailable", -1, 1);
+ }
+
+ if (command->batch_size) {
+ bson_append_int64(&cursor_opts, "batchSize", -1, command->batch_size);
+ }
+
+ if (zsession && !mongoc_client_session_append(Z_SESSION_OBJ_P(zsession)->client_session, &cursor_opts, &error)) {
+ phongo_throw_exception_from_bson_error_t(&error);
+ bson_destroy(&initial_reply);
+ bson_destroy(&cursor_opts);
+ result = false;
+ goto cleanup;
+ }
+
+ cmd_cursor = mongoc_cursor_new_from_command_reply_with_opts(client, &initial_reply, &cursor_opts);
+ bson_destroy(&cursor_opts);
+ } else {
+ bson_t cursor_opts = BSON_INITIALIZER;
+ bson_t* wrapped_reply = create_wrapped_command_envelope(db, &reply);
+
+ bson_append_int32(&cursor_opts, "serverId", -1, server_id);
+ cmd_cursor = mongoc_cursor_new_from_command_reply_with_opts(client, wrapped_reply, &cursor_opts);
+ bson_destroy(&cursor_opts);
+ }
+
+ phongo_cursor_init_for_command(return_value, client, cmd_cursor, db, zcommand, zreadPreference, zsession);
+
+cleanup:
+ bson_destroy(&opts);
+
+ if (free_reply) {
+ bson_destroy(&reply);
+ }
+
+ if (free_zsession) {
+ zval_ptr_dtor(zsession);
+ efree(zsession);
+ }
+
+ return result;
+} /* }}} */
+/* }}} */
+
+/* {{{ mongoc types from from_zval */
+const mongoc_write_concern_t* phongo_write_concern_from_zval(zval* zwrite_concern) /* {{{ */
+{
+ 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) /* {{{ */
+{
+ 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) /* {{{ */
+{
+ 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 */
+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;
+}
+
+bool 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_INIT_DEBUG_STATE(state);
+ bson_iter_document(&iter, &len, &bytes);
+ if (!php_phongo_bson_to_zval_ex(bytes, len, &state)) {
+ zval_ptr_dtor(&state.zchild);
+ return false;
+ }
+
+ ADD_ASSOC_ZVAL_EX(retval, "tags", &state.zchild);
+ }
+
+ {
+ php_phongo_bson_state state;
+
+ PHONGO_BSON_INIT_DEBUG_STATE(state);
+
+ if (!php_phongo_bson_to_zval_ex(bson_get_data(is_master), is_master->len, &state)) {
+ zval_ptr_dtor(&state.zchild);
+ return false;
+ }
+
+ ADD_ASSOC_ZVAL_EX(retval, "last_is_master", &state.zchild);
+ }
+ ADD_ASSOC_LONG_EX(retval, "round_trip_time", (zend_long) mongoc_server_description_round_trip_time(sd));
+
+ return true;
+} /* }}} */
+
+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);
+ }
+} /* }}} */
+
+/* If options is not an array, insert it as a field in a newly allocated array.
+ * This may be used to convert legacy options (e.g. ReadPreference option for
+ * an executeQuery method) into an options array.
+ *
+ * A pointer to the array zval will always be returned. If allocated is set to
+ * true, php_phongo_prep_legacy_option_free() should be used to free the array
+ * zval later. */
+zval* php_phongo_prep_legacy_option(zval* options, const char* key, bool* allocated) /* {{{ */
+{
+ *allocated = false;
+
+ if (options && Z_TYPE_P(options) != IS_ARRAY) {
+ zval* new_options = ecalloc(sizeof(zval), 1);
+
+ array_init_size(new_options, 1);
+ add_assoc_zval(new_options, key, options);
+ Z_ADDREF_P(options);
+ *allocated = true;
+
+ return new_options;
+ }
+
+ return options;
+} /* }}} */
+
+void php_phongo_prep_legacy_option_free(zval* options) /* {{{ */
+{
+ zval_ptr_dtor(options);
+ efree(options);
+} /* }}} */
+
+/* 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) /* {{{ */
+{
+ HashTable* ht_data;
+ zval* tagSet;
+
+ if (Z_TYPE_P(tagSets) != IS_ARRAY) {
+ return;
+ }
+
+ ht_data = HASH_OF(tagSets);
+
+ ZEND_HASH_FOREACH_VAL_IND(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();
+} /* }}} */
+
+/* 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_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 int64_t wtimeout = mongoc_write_concern_get_wtimeout_int64(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) {
+#if SIZEOF_ZEND_LONG == 4
+ if (wtimeout > INT32_MAX || wtimeout < INT32_MIN) {
+ ADD_ASSOC_INT64_AS_STRING(&retval, "wtimeout", wtimeout);
+ } else {
+ ADD_ASSOC_LONG_EX(retval, "wtimeout", wtimeout);
+ }
+#else
+ ADD_ASSOC_LONG_EX(retval, "wtimeout", wtimeout);
+#endif
+ }
+} /* }}} */
+/* }}} */
+
+static mongoc_uri_t* php_phongo_make_uri(const char* uri_string) /* {{{ */
+{
+ mongoc_uri_t* uri;
+ bson_error_t error = { 0 };
+
+ uri = mongoc_uri_new_with_error(uri_string, &error);
+ MONGOC_DEBUG("Connection string: '%s'", uri_string);
+
+ if (!uri) {
+ phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Failed to parse MongoDB URI: '%s'. %s.", uri_string, error.message);
+ return NULL;
+ }
+
+ return uri;
+} /* }}} */
+
+static const char* php_phongo_bson_type_to_string(bson_type_t type) /* {{{ */
+{
+ switch (type) {
+ case BSON_TYPE_EOD:
+ return "EOD";
+ case BSON_TYPE_DOUBLE:
+ return "double";
+ case BSON_TYPE_UTF8:
+ return "string";
+ case BSON_TYPE_DOCUMENT:
+ return "document";
+ case BSON_TYPE_ARRAY:
+ return "array";
+ case BSON_TYPE_BINARY:
+ return "Binary";
+ case BSON_TYPE_UNDEFINED:
+ return "undefined";
+ case BSON_TYPE_OID:
+ return "ObjectId";
+ case BSON_TYPE_BOOL:
+ return "boolean";
+ case BSON_TYPE_DATE_TIME:
+ return "UTCDateTime";
+ case BSON_TYPE_NULL:
+ return "null";
+ case BSON_TYPE_REGEX:
+ return "Regex";
+ case BSON_TYPE_DBPOINTER:
+ return "DBPointer";
+ case BSON_TYPE_CODE:
+ return "Javascript";
+ case BSON_TYPE_SYMBOL:
+ return "symbol";
+ case BSON_TYPE_CODEWSCOPE:
+ return "Javascript with scope";
+ case BSON_TYPE_INT32:
+ return "32-bit integer";
+ case BSON_TYPE_TIMESTAMP:
+ return "Timestamp";
+ case BSON_TYPE_INT64:
+ return "64-bit integer";
+ case BSON_TYPE_DECIMAL128:
+ return "Decimal128";
+ case BSON_TYPE_MAXKEY:
+ return "MaxKey";
+ case BSON_TYPE_MINKEY:
+ return "MinKey";
+ default:
+ return "unknown";
+ }
+} /* }}} */
+
+#define PHONGO_URI_INVALID_TYPE(iter, expected) \
+ phongo_throw_exception( \
+ PHONGO_ERROR_INVALID_ARGUMENT, \
+ "Expected %s for \"%s\" URI option, %s given", \
+ (expected), \
+ bson_iter_key(&(iter)), \
+ php_phongo_bson_type_to_string(bson_iter_type(&(iter))))
+
+static bool php_phongo_uri_finalize_auth(mongoc_uri_t* uri) /* {{{ */
+{
+ const bson_t* credentials = mongoc_uri_get_credentials(uri);
+ bson_iter_t iter;
+ const char* source = NULL;
+ const char* username = mongoc_uri_get_username(uri);
+ bool require_auth = username != NULL;
+
+ if (bson_iter_init_find_case(&iter, credentials, MONGOC_URI_AUTHSOURCE)) {
+ source = bson_iter_utf8(&iter, NULL);
+ require_auth = true;
+ }
+
+ /* authSource with GSSAPI or X509 should always be external */
+ if (mongoc_uri_get_auth_mechanism(uri)) {
+ if (!strcasecmp(mongoc_uri_get_auth_mechanism(uri), "GSSAPI") ||
+ !strcasecmp(mongoc_uri_get_auth_mechanism(uri), "MONGODB-X509")) {
+
+ if (source) {
+ if (strcasecmp(source, "$external")) {
+ phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Failed to parse URI options: GSSAPI and X509 require \"$external\" authSource.");
+ return false;
+ }
+ } else {
+ mongoc_uri_set_auth_source(uri, "$external");
+ }
+ }
+
+ /* Mechanisms other than MONGODB-X509 and MONGODB-AWS require a username */
+ if (strcasecmp(mongoc_uri_get_auth_mechanism(uri), "MONGODB-X509") &&
+ strcasecmp(mongoc_uri_get_auth_mechanism(uri), "MONGODB-AWS")) {
+ if (!mongoc_uri_get_username(uri) ||
+ !strcmp(mongoc_uri_get_username(uri), "")) {
+ phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Failed to parse URI options: '%s' authentication mechanism requires username.", mongoc_uri_get_auth_mechanism(uri));
+ return false;
+ }
+ }
+
+ /* MONGODB-X509 errors if a password is supplied. */
+ if (!strcasecmp(mongoc_uri_get_auth_mechanism(uri), "MONGODB-X509")) {
+ if (mongoc_uri_get_password(uri)) {
+ phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Failed to parse URI options: X509 authentication mechanism does not accept a password.");
+ return false;
+ }
+ }
+ } else if (require_auth) {
+ if (source && strcmp(source, "$external") != 0 && (!username || strcmp(username, "") == 0)) {
+ phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Failed to parse URI options: Default authentication mechanism requires username.");
+ return false;
+ }
+ }
+
+ return true;
+} /* }}} */
+
+static bool php_phongo_uri_finalize_directconnection(mongoc_uri_t* uri) /* {{{ */
+{
+ const mongoc_host_list_t* hosts;
+
+ if (!mongoc_uri_get_option_as_bool(uri, MONGOC_URI_DIRECTCONNECTION, false)) {
+ return true;
+ }
+
+ /* Per the URI options spec, directConnection conflicts with multiple hosts
+ * and SRV URIs, which may resolve to multiple hosts. */
+ if (!strncmp(mongoc_uri_get_string(uri), "mongodb+srv://", 14)) {
+ phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Failed to parse URI options: SRV URI not allowed with directConnection option.");
+ return false;
+ }
+
+ hosts = mongoc_uri_get_hosts(uri);
+
+ if (hosts && hosts->next) {
+ phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Failed to parse URI options: Multiple seeds not allowed with directConnection option.");
+ return false;
+ }
+
+ return true;
+} /* }}} */
+
+static bool php_phongo_uri_finalize_tls(mongoc_uri_t* uri) /* {{{ */
+{
+ const bson_t* options;
+ bson_iter_t iter;
+
+ if (!(options = mongoc_uri_get_options(uri))) {
+ return true;
+ }
+
+ if (bson_iter_init_find_case(&iter, options, MONGOC_URI_TLSINSECURE) &&
+ (bson_iter_init_find_case(&iter, options, MONGOC_URI_TLSALLOWINVALIDCERTIFICATES) ||
+ bson_iter_init_find_case(&iter, options, MONGOC_URI_TLSALLOWINVALIDHOSTNAMES) ||
+ bson_iter_init_find_case(&iter, options, MONGOC_URI_TLSDISABLEOCSPENDPOINTCHECK) ||
+ bson_iter_init_find_case(&iter, options, MONGOC_URI_TLSDISABLECERTIFICATEREVOCATIONCHECK))) {
+ phongo_throw_exception(
+ PHONGO_ERROR_INVALID_ARGUMENT,
+ "Failed to parse URI options: %s may not be combined with %s, %s, %s, or %s.",
+ MONGOC_URI_TLSINSECURE,
+ MONGOC_URI_TLSALLOWINVALIDCERTIFICATES,
+ MONGOC_URI_TLSALLOWINVALIDHOSTNAMES,
+ MONGOC_URI_TLSDISABLEOCSPENDPOINTCHECK,
+ MONGOC_URI_TLSDISABLECERTIFICATEREVOCATIONCHECK);
+ return false;
+ }
+
+ if (bson_iter_init_find_case(&iter, options, MONGOC_URI_TLSALLOWINVALIDCERTIFICATES) &&
+ (bson_iter_init_find_case(&iter, options, MONGOC_URI_TLSDISABLEOCSPENDPOINTCHECK) ||
+ bson_iter_init_find_case(&iter, options, MONGOC_URI_TLSDISABLECERTIFICATEREVOCATIONCHECK))) {
+ phongo_throw_exception(
+ PHONGO_ERROR_INVALID_ARGUMENT,
+ "Failed to parse URI options: %s may not be combined with %s or %s.",
+ MONGOC_URI_TLSALLOWINVALIDCERTIFICATES,
+ MONGOC_URI_TLSDISABLEOCSPENDPOINTCHECK,
+ MONGOC_URI_TLSDISABLECERTIFICATEREVOCATIONCHECK);
+ return false;
+ }
+
+ return true;
+} /* }}} */
+
+static bool php_phongo_apply_options_to_uri(mongoc_uri_t* uri, bson_t* options) /* {{{ */
+{
+ bson_iter_t iter;
+
+ /* Return early if there are no options to apply */
+ if (bson_empty0(options) || !bson_iter_init(&iter, options)) {
+ return true;
+ }
+
+ while (bson_iter_next(&iter)) {
+ const char* key = bson_iter_key(&iter);
+
+ /* Skip read preference, read concern, and write concern options, as
+ * those will be processed by other functions. */
+ if (!strcasecmp(key, MONGOC_URI_JOURNAL) ||
+ !strcasecmp(key, MONGOC_URI_MAXSTALENESSSECONDS) ||
+ !strcasecmp(key, MONGOC_URI_READCONCERNLEVEL) ||
+ !strcasecmp(key, MONGOC_URI_READPREFERENCE) ||
+ !strcasecmp(key, MONGOC_URI_READPREFERENCETAGS) ||
+ !strcasecmp(key, MONGOC_URI_SAFE) ||
+ !strcasecmp(key, MONGOC_URI_SLAVEOK) ||
+ !strcasecmp(key, MONGOC_URI_W) ||
+ !strcasecmp(key, MONGOC_URI_WTIMEOUTMS)) {
+
+ continue;
+ }
+
+ if (mongoc_uri_option_is_bool(key)) {
+ /* The option's type is not validated because bson_iter_as_bool() is
+ * used to cast the value to a boolean. Validation may be introduced
+ * in PHPC-990. */
+ if (!mongoc_uri_set_option_as_bool(uri, key, bson_iter_as_bool(&iter))) {
+ phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Failed to parse \"%s\" URI option", key);
+ return false;
+ }
+
+ continue;
+ }
+
+ if (mongoc_uri_option_is_int32(key)) {
+ if (!BSON_ITER_HOLDS_INT32(&iter)) {
+ PHONGO_URI_INVALID_TYPE(iter, "32-bit integer");
+ return false;
+ }
+
+ if (!mongoc_uri_set_option_as_int32(uri, key, bson_iter_int32(&iter))) {
+ phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Failed to parse \"%s\" URI option", key);
+ return false;
+ }
+
+ continue;
+ }
+
+ if (mongoc_uri_option_is_utf8(key)) {
+ if (!BSON_ITER_HOLDS_UTF8(&iter)) {
+ PHONGO_URI_INVALID_TYPE(iter, "string");
+ return false;
+ }
+
+ if (!strcasecmp(key, MONGOC_URI_REPLICASET) && !strcmp("", bson_iter_utf8(&iter, NULL))) {
+ phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Value for URI option \"%s\" cannot be empty string.", key);
+ return false;
+ }
+
+ if (!mongoc_uri_set_option_as_utf8(uri, key, bson_iter_utf8(&iter, NULL))) {
+ /* Assignment uses mongoc_uri_set_appname() for the "appname"
+ * option, which validates length in addition to UTF-8 encoding.
+ * For BC, we report the invalid string to the user. */
+ if (!strcasecmp(key, MONGOC_URI_APPNAME)) {
+ phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Invalid appname value: '%s'", bson_iter_utf8(&iter, NULL));
+ } else {
+ phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Failed to parse \"%s\" URI option", key);
+ }
+ return false;
+ }
+
+ continue;
+ }
+
+ if (!strcasecmp(key, "username")) {
+ if (!BSON_ITER_HOLDS_UTF8(&iter)) {
+ PHONGO_URI_INVALID_TYPE(iter, "string");
+ return false;
+ }
+
+ if (!mongoc_uri_set_username(uri, bson_iter_utf8(&iter, NULL))) {
+ phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Failed to parse \"%s\" URI option", key);
+ return false;
+ }
+
+ continue;
+ }
+
+ if (!strcasecmp(key, "password")) {
+ if (!BSON_ITER_HOLDS_UTF8(&iter)) {
+ PHONGO_URI_INVALID_TYPE(iter, "string");
+ return false;
+ }
+
+ if (!mongoc_uri_set_password(uri, bson_iter_utf8(&iter, NULL))) {
+ phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Failed to parse \"%s\" URI option", key);
+ return false;
+ }
+
+ continue;
+ }
+
+ if (!strcasecmp(key, MONGOC_URI_AUTHMECHANISM)) {
+ if (!BSON_ITER_HOLDS_UTF8(&iter)) {
+ PHONGO_URI_INVALID_TYPE(iter, "string");
+ return false;
+ }
+
+ if (!mongoc_uri_set_auth_mechanism(uri, bson_iter_utf8(&iter, NULL))) {
+ phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Failed to parse \"%s\" URI option", key);
+ return false;
+ }
+
+ continue;
+ }
+
+ if (!strcasecmp(key, MONGOC_URI_AUTHSOURCE)) {
+ if (!BSON_ITER_HOLDS_UTF8(&iter)) {
+ PHONGO_URI_INVALID_TYPE(iter, "string");
+ return false;
+ }
+
+ if (!mongoc_uri_set_auth_source(uri, bson_iter_utf8(&iter, NULL))) {
+ phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Failed to parse \"%s\" URI option", key);
+ return false;
+ }
+
+ continue;
+ }
+
+ if (!strcasecmp(key, MONGOC_URI_AUTHMECHANISMPROPERTIES)) {
+ bson_t properties;
+ uint32_t len;
+ const uint8_t* data;
+
+ if (!BSON_ITER_HOLDS_DOCUMENT(&iter)) {
+ PHONGO_URI_INVALID_TYPE(iter, "array or object");
+ return false;
+ }
+
+ bson_iter_document(&iter, &len, &data);
+
+ if (!bson_init_static(&properties, data, len)) {
+ phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Could not initialize BSON structure for auth mechanism properties");
+ return false;
+ }
+
+ if (!mongoc_uri_set_mechanism_properties(uri, &properties)) {
+ phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Failed to parse \"%s\" URI option", key);
+ return false;
+ }
+
+ continue;
+ }
+
+ if (!strcasecmp(key, MONGOC_URI_GSSAPISERVICENAME)) {
+ bson_t unused, properties = BSON_INITIALIZER;
+
+ if (mongoc_uri_get_mechanism_properties(uri, &unused)) {
+ phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "authMechanismProperties SERVICE_NAME already set, ignoring \"%s\"", key);
+ return false;
+ }
+
+ if (!BSON_ITER_HOLDS_UTF8(&iter)) {
+ PHONGO_URI_INVALID_TYPE(iter, "string");
+ return false;
+ }
+
+ bson_append_utf8(&properties, "SERVICE_NAME", -1, bson_iter_utf8(&iter, NULL), -1);
+
+ if (!mongoc_uri_set_mechanism_properties(uri, &properties)) {
+ phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Failed to parse \"%s\" URI option", key);
+ bson_destroy(&properties);
+ return false;
+ }
+
+ bson_destroy(&properties);
+
+ continue;
+ }
+
+ if (!strcasecmp(key, MONGOC_URI_COMPRESSORS)) {
+ if (!BSON_ITER_HOLDS_UTF8(&iter)) {
+ PHONGO_URI_INVALID_TYPE(iter, "string");
+ return false;
+ }
+
+ if (!mongoc_uri_set_compressors(uri, bson_iter_utf8(&iter, NULL))) {
+ phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Failed to parse \"%s\" URI option", key);
+ return false;
+ }
+
+ continue;
+ }
+ }
+
+ /* Validate any interactions between URI options */
+ if (!php_phongo_uri_finalize_auth(uri)) {
+ /* Exception should already have been thrown */
+ return false;
+ }
+
+ if (!php_phongo_uri_finalize_directconnection(uri)) {
+ /* Exception should already have been thrown */
+ return false;
+ }
+
+ return true;
+} /* }}} */
+
+static bool php_phongo_apply_rc_options_to_uri(mongoc_uri_t* uri, bson_t* options) /* {{{ */
+{
+ 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, "mongoc_uri_t does not have a read concern");
+
+ return false;
+ }
+
+ /* Return early if there are no options to apply */
+ if (bson_empty0(options) || !bson_iter_init(&iter, options)) {
+ return true;
+ }
+
+ new_rc = mongoc_read_concern_copy(old_rc);
+
+ while (bson_iter_next(&iter)) {
+ const char* key = bson_iter_key(&iter);
+
+ if (!strcasecmp(key, MONGOC_URI_READCONCERNLEVEL)) {
+ if (!BSON_ITER_HOLDS_UTF8(&iter)) {
+ PHONGO_URI_INVALID_TYPE(iter, "string");
+ mongoc_read_concern_destroy(new_rc);
+
+ return false;
+ }
+
+ mongoc_read_concern_set_level(new_rc, bson_iter_utf8(&iter, NULL));
+ }
+ }
+
+ 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) /* {{{ */
+{
+ bson_iter_t iter;
+ mongoc_read_prefs_t* new_rp;
+ const mongoc_read_prefs_t* old_rp;
+ bool ignore_slaveok = false;
+
+ if (!(old_rp = mongoc_uri_get_read_prefs_t(uri))) {
+ phongo_throw_exception(PHONGO_ERROR_MONGOC_FAILED, "mongoc_uri_t does not have a read preference");
+
+ return false;
+ }
+
+ /* Return early if there are no options to apply */
+ if (bson_empty0(options) || !bson_iter_init(&iter, options)) {
+ return true;
+ }
+
+ new_rp = mongoc_read_prefs_copy(old_rp);
+
+ while (bson_iter_next(&iter)) {
+ const char* key = bson_iter_key(&iter);
+
+ if (!ignore_slaveok && !strcasecmp(key, MONGOC_URI_SLAVEOK)) {
+ if (!BSON_ITER_HOLDS_BOOL(&iter)) {
+ PHONGO_URI_INVALID_TYPE(iter, "boolean");
+ mongoc_read_prefs_destroy(new_rp);
+
+ return false;
+ }
+
+ if (bson_iter_bool(&iter)) {
+ mongoc_read_prefs_set_mode(new_rp, MONGOC_READ_SECONDARY_PREFERRED);
+ }
+ }
+
+ if (!strcasecmp(key, MONGOC_URI_READPREFERENCE)) {
+ const char* str;
+
+ if (!BSON_ITER_HOLDS_UTF8(&iter)) {
+ PHONGO_URI_INVALID_TYPE(iter, "string");
+ mongoc_read_prefs_destroy(new_rp);
+
+ return false;
+ }
+
+ 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, "Unsupported %s value: '%s'", bson_iter_key(&iter), str);
+ mongoc_read_prefs_destroy(new_rp);
+
+ return false;
+ }
+
+ ignore_slaveok = true;
+ }
+
+ if (!strcasecmp(key, MONGOC_URI_READPREFERENCETAGS)) {
+ bson_t tags;
+ uint32_t len;
+ const uint8_t* data;
+
+ if (!BSON_ITER_HOLDS_ARRAY(&iter)) {
+ PHONGO_URI_INVALID_TYPE(iter, "array");
+ mongoc_read_prefs_destroy(new_rp);
+
+ return false;
+ }
+
+ bson_iter_array(&iter, &len, &data);
+
+ if (!bson_init_static(&tags, data, len)) {
+ phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "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, "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 (!strcasecmp(key, MONGOC_URI_MAXSTALENESSSECONDS)) {
+ int64_t max_staleness_seconds;
+
+ if (!BSON_ITER_HOLDS_INT(&iter)) {
+ PHONGO_URI_INVALID_TYPE(iter, "integer");
+ mongoc_read_prefs_destroy(new_rp);
+
+ return false;
+ }
+
+ max_staleness_seconds = bson_iter_as_int64(&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, "Expected maxStalenessSeconds to be >= %d, %" PRId64 " given", MONGOC_SMALLEST_MAX_STALENESS_SECONDS, max_staleness_seconds);
+ mongoc_read_prefs_destroy(new_rp);
+
+ return false;
+ }
+
+ if (max_staleness_seconds > INT32_MAX) {
+ phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Expected maxStalenessSeconds to be <= %d, %" PRId64 " given", INT32_MAX, max_staleness_seconds);
+ mongoc_read_prefs_destroy(new_rp);
+
+ return false;
+ }
+
+ if (mongoc_read_prefs_get_mode(new_rp) == MONGOC_READ_PRIMARY) {
+ phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "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);
+ }
+ }
+
+ 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, "Primary read preference mode conflicts with tags");
+ mongoc_read_prefs_destroy(new_rp);
+
+ return false;
+ }
+
+ /* Make sure maxStalenessSeconds is not combined with primary readPreference */
+ if (mongoc_read_prefs_get_mode(new_rp) == MONGOC_READ_PRIMARY &&
+ mongoc_read_prefs_get_max_staleness_seconds(new_rp) != MONGOC_NO_MAX_STALENESS) {
+ phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Primary read preference mode conflicts with maxStalenessSeconds");
+ mongoc_read_prefs_destroy(new_rp);
+
+ return false;
+ }
+
+ /* This may be redundant in light of the previous checks (primary with tags
+ * or maxStalenessSeconds), 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, "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) /* {{{ */
+{
+ bson_iter_t iter;
+ mongoc_write_concern_t* new_wc;
+ const mongoc_write_concern_t* old_wc;
+ bool ignore_safe = false;
+
+ if (!(old_wc = mongoc_uri_get_write_concern(uri))) {
+ phongo_throw_exception(PHONGO_ERROR_MONGOC_FAILED, "mongoc_uri_t does not have a write concern");
+
+ return false;
+ }
+
+ /* Return early if there are no options to apply */
+ if (bson_empty0(options) || !bson_iter_init(&iter, options)) {
+ return true;
+ }
+
+ new_wc = mongoc_write_concern_copy(old_wc);
+
+ while (bson_iter_next(&iter)) {
+ const char* key = bson_iter_key(&iter);
+
+ if (!ignore_safe && !strcasecmp(key, MONGOC_URI_SAFE)) {
+ if (!BSON_ITER_HOLDS_BOOL(&iter)) {
+ PHONGO_URI_INVALID_TYPE(iter, "boolean");
+ mongoc_write_concern_destroy(new_wc);
+
+ return false;
+ }
+
+ mongoc_write_concern_set_w(new_wc, bson_iter_bool(&iter) ? 1 : MONGOC_WRITE_CONCERN_W_UNACKNOWLEDGED);
+ }
+
+ if (!strcasecmp(key, MONGOC_URI_WTIMEOUTMS)) {
+ int64_t wtimeout;
+
+ if (!BSON_ITER_HOLDS_INT(&iter)) {
+ PHONGO_URI_INVALID_TYPE(iter, "integer");
+ mongoc_write_concern_destroy(new_wc);
+
+ return false;
+ }
+
+ wtimeout = bson_iter_as_int64(&iter);
+
+ if (wtimeout < 0) {
+ phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Expected wtimeoutMS to be >= 0, %" PRId64 " given", wtimeout);
+ mongoc_write_concern_destroy(new_wc);
+
+ return false;
+ }
+
+ mongoc_write_concern_set_wtimeout_int64(new_wc, wtimeout);
+ }
+
+ if (!strcasecmp(key, MONGOC_URI_JOURNAL)) {
+ if (!BSON_ITER_HOLDS_BOOL(&iter)) {
+ PHONGO_URI_INVALID_TYPE(iter, "boolean");
+ mongoc_write_concern_destroy(new_wc);
+
+ return false;
+ }
+
+ mongoc_write_concern_set_journal(new_wc, bson_iter_bool(&iter));
+ }
+
+ if (!strcasecmp(key, MONGOC_URI_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, "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_w(new_wc, MONGOC_WRITE_CONCERN_W_MAJORITY);
+ } else {
+ mongoc_write_concern_set_wtag(new_wc, str);
+ }
+ } else {
+ PHONGO_URI_INVALID_TYPE(iter, "32-bit integer or string");
+ mongoc_write_concern_destroy(new_wc);
+
+ return false;
+ }
+
+ ignore_safe = true;
+ }
+ }
+
+ 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, "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, "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;
+} /* }}} */
+
+#ifdef MONGOC_ENABLE_SSL
+
+static void php_phongo_mongoc_ssl_opts_from_uri(mongoc_ssl_opt_t* ssl_opt, mongoc_uri_t* uri, bool* any_ssl_option_set)
+{
+ bool insecure = mongoc_uri_get_option_as_bool(uri, MONGOC_URI_TLSINSECURE, false);
+ const char* pem_file = mongoc_uri_get_option_as_utf8(uri, MONGOC_URI_TLSCERTIFICATEKEYFILE, NULL);
+ const char* pem_pwd = mongoc_uri_get_option_as_utf8(uri, MONGOC_URI_TLSCERTIFICATEKEYFILEPASSWORD, NULL);
+ const char* ca_file = mongoc_uri_get_option_as_utf8(uri, MONGOC_URI_TLSCAFILE, NULL);
+
+ ssl_opt->pem_file = pem_file ? estrdup(pem_file) : NULL;
+ ssl_opt->pem_pwd = pem_pwd ? estrdup(pem_pwd) : NULL;
+ ssl_opt->ca_file = ca_file ? estrdup(ca_file) : NULL;
+ ssl_opt->weak_cert_validation = mongoc_uri_get_option_as_bool(uri, MONGOC_URI_TLSALLOWINVALIDCERTIFICATES, insecure);
+ ssl_opt->allow_invalid_hostname = mongoc_uri_get_option_as_bool(uri, MONGOC_URI_TLSALLOWINVALIDHOSTNAMES, insecure);
+
+ /* Boolean options default to false, so we cannot consider them for
+ * any_ssl_option_set. This isn't actually a problem as libmongoc will
+ * already have assigned them when creating the client, enabling SSL, and
+ * assigning SSL options. Therefore, we only need to check for non-defaults
+ * (i.e. non-NULL strings, true booleans). */
+ if (pem_file || pem_pwd || ca_file || ssl_opt->weak_cert_validation || ssl_opt->allow_invalid_hostname) {
+ *any_ssl_option_set = true;
+ }
+}
+
+static inline char* php_phongo_fetch_ssl_opt_string(zval* zoptions, const char* key)
+{
+ int plen;
+ zend_bool pfree;
+ char* pval;
+ char* value;
+
+ pval = php_array_fetch_string(zoptions, key, &plen, &pfree);
+ value = pfree ? pval : estrndup(pval, plen);
+
+ return value;
+}
+
+static mongoc_ssl_opt_t* php_phongo_make_ssl_opt(mongoc_uri_t* uri, zval* zoptions)
+{
+ mongoc_ssl_opt_t* ssl_opt;
+ bool any_ssl_option_set = false;
+
+ 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, "\"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, "\"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, "\"crl_file\" option is not supported by LibreSSL and Secure Transport");
+ return NULL;
+ }
+#endif
+
+ ssl_opt = ecalloc(1, sizeof(mongoc_ssl_opt_t));
+
+ /* If SSL options are set in the URL, we need to read them and set them on
+ * the options struct so we can merge potential options from passed in
+ * driverOptions (zoptions) */
+ if (mongoc_uri_get_tls(uri)) {
+ php_phongo_mongoc_ssl_opts_from_uri(ssl_opt, uri, &any_ssl_option_set);
+ }
+
+#define PHONGO_SSL_OPTION_SWAP_STRING(o, n) \
+ if ((o)) { \
+ efree((char*) (o)); \
+ } \
+ (o) = php_phongo_fetch_ssl_opt_string(zoptions, n);
+
+ /* Apply driver options that don't have a corresponding URI option. These
+ * are set directly on the SSL options struct. */
+ if (php_array_existsc(zoptions, "ca_dir")) {
+ PHONGO_SSL_OPTION_SWAP_STRING(ssl_opt->ca_dir, "ca_dir");
+ any_ssl_option_set = true;
+ } else if (php_array_existsc(zoptions, "capath")) {
+ PHONGO_SSL_OPTION_SWAP_STRING(ssl_opt->ca_dir, "capath");
+ any_ssl_option_set = true;
+
+ php_error_docref(NULL, E_DEPRECATED, "The \"capath\" context driver option is deprecated. Please use the \"ca_dir\" driver option instead.");
+ }
+
+ if (php_array_existsc(zoptions, "crl_file")) {
+ PHONGO_SSL_OPTION_SWAP_STRING(ssl_opt->crl_file, "crl_file");
+ any_ssl_option_set = true;
+ }
+
+#undef PHONGO_SSL_OPTION_SWAP_STRING
+
+ if (!any_ssl_option_set) {
+ efree(ssl_opt);
+ return NULL;
+ }
+
+ return ssl_opt;
+}
+
+static void php_phongo_free_ssl_opt(mongoc_ssl_opt_t* ssl_opt)
+{
+ if (ssl_opt->pem_file) {
+ efree((char*) ssl_opt->pem_file);
+ }
+
+ if (ssl_opt->pem_pwd) {
+ efree((char*) ssl_opt->pem_pwd);
+ }
+
+ if (ssl_opt->ca_file) {
+ efree((char*) ssl_opt->ca_file);
+ }
+
+ if (ssl_opt->ca_dir) {
+ efree((char*) ssl_opt->ca_dir);
+ }
+
+ if (ssl_opt->crl_file) {
+ efree((char*) ssl_opt->crl_file);
+ }
+
+ efree(ssl_opt);
+}
+
+static inline bool php_phongo_apply_driver_option_to_uri(mongoc_uri_t* uri, zval* zoptions, const char* driverOptionKey, const char* optionKey)
+{
+ bool ret;
+ char* value;
+
+ value = php_phongo_fetch_ssl_opt_string(zoptions, driverOptionKey);
+ ret = mongoc_uri_set_option_as_utf8(uri, optionKey, value);
+ efree(value);
+
+ return ret;
+}
+
+static bool php_phongo_apply_driver_options_to_uri(mongoc_uri_t* uri, zval* zoptions)
+{
+ if (!zoptions) {
+ return true;
+ }
+
+ /* Map TLS driver options to the canonical tls options in the URI. */
+ if (php_array_existsc(zoptions, "allow_invalid_hostname")) {
+ if (!mongoc_uri_set_option_as_bool(uri, MONGOC_URI_TLSALLOWINVALIDHOSTNAMES, php_array_fetchc_bool(zoptions, "allow_invalid_hostname"))) {
+ phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Failed to parse \"%s\" driver option", "allow_invalid_hostname");
+
+ return false;
+ }
+
+ php_error_docref(NULL, E_DEPRECATED, "The \"allow_invalid_hostname\" driver option is deprecated. Please use the \"tlsAllowInvalidHostnames\" URI option instead.");
+ }
+
+ if (php_array_existsc(zoptions, "weak_cert_validation")) {
+ if (!mongoc_uri_set_option_as_bool(uri, MONGOC_URI_TLSALLOWINVALIDCERTIFICATES, php_array_fetchc_bool(zoptions, "weak_cert_validation"))) {
+ phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Failed to parse \"%s\" driver option", "weak_cert_validation");
+
+ return false;
+ }
+
+ php_error_docref(NULL, E_DEPRECATED, "The \"weak_cert_validation\" driver option is deprecated. Please use the \"tlsAllowInvalidCertificates\" URI option instead.");
+ } else if (php_array_existsc(zoptions, "allow_self_signed")) {
+ if (!mongoc_uri_set_option_as_bool(uri, MONGOC_URI_TLSALLOWINVALIDCERTIFICATES, php_array_fetchc_bool(zoptions, "allow_self_signed"))) {
+ phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Failed to parse \"%s\" driver option", "allow_self_signed");
+
+ return false;
+ }
+
+ php_error_docref(NULL, E_DEPRECATED, "The \"allow_self_signed\" context driver option is deprecated. Please use the \"tlsAllowInvalidCertificates\" URI option instead.");
+ }
+
+ if (php_array_existsc(zoptions, "pem_file")) {
+ if (!php_phongo_apply_driver_option_to_uri(uri, zoptions, "pem_file", MONGOC_URI_TLSCERTIFICATEKEYFILE)) {
+ phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Failed to parse \"%s\" driver option", "pem_file");
+
+ return false;
+ }
+
+ php_error_docref(NULL, E_DEPRECATED, "The \"pem_file\" driver option is deprecated. Please use the \"tlsCertificateKeyFile\" URI option instead.");
+ } else if (php_array_existsc(zoptions, "local_cert")) {
+ if (!php_phongo_apply_driver_option_to_uri(uri, zoptions, "local_cert", MONGOC_URI_TLSCERTIFICATEKEYFILE)) {
+ phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Failed to parse \"%s\" driver option", "local_cert");
+
+ return false;
+ }
+
+ php_error_docref(NULL, E_DEPRECATED, "The \"local_cert\" context driver option is deprecated. Please use the \"tlsCertificateKeyFile\" URI option instead.");
+ }
+
+ if (php_array_existsc(zoptions, "pem_pwd")) {
+ if (!php_phongo_apply_driver_option_to_uri(uri, zoptions, "pem_pwd", MONGOC_URI_TLSCERTIFICATEKEYFILEPASSWORD)) {
+ phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Failed to parse \"%s\" driver option", "pem_pwd");
+
+ return false;
+ }
+
+ php_error_docref(NULL, E_DEPRECATED, "The \"pem_pwd\" driver option is deprecated. Please use the \"tlsCertificateKeyFilePassword\" URI option instead.");
+ } else if (php_array_existsc(zoptions, "passphrase")) {
+ if (!php_phongo_apply_driver_option_to_uri(uri, zoptions, "passphrase", MONGOC_URI_TLSCERTIFICATEKEYFILEPASSWORD)) {
+ phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Failed to parse \"%s\" driver option", "passphrase");
+
+ return false;
+ }
+
+ php_error_docref(NULL, E_DEPRECATED, "The \"passphrase\" context driver option is deprecated. Please use the \"tlsCertificateKeyFilePassword\" URI option instead.");
+ }
+
+ if (php_array_existsc(zoptions, "ca_file")) {
+ if (!php_phongo_apply_driver_option_to_uri(uri, zoptions, "ca_file", MONGOC_URI_TLSCAFILE)) {
+ phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Failed to parse \"%s\" driver option", "ca_file");
+
+ return false;
+ }
+
+ php_error_docref(NULL, E_DEPRECATED, "The \"ca_file\" driver option is deprecated. Please use the \"tlsCAFile\" URI option instead.");
+ } else if (php_array_existsc(zoptions, "cafile")) {
+ if (!php_phongo_apply_driver_option_to_uri(uri, zoptions, "cafile", MONGOC_URI_TLSCAFILE)) {
+ phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Failed to parse \"%s\" driver option", "cafile");
+
+ return false;
+ }
+
+ php_error_docref(NULL, E_DEPRECATED, "The \"cafile\" context driver option is deprecated. Please use the \"tlsCAFile\" URI option instead.");
+ }
+
+ return true;
+}
+#endif
+
+/* APM callbacks */
+static void php_phongo_dispatch_handlers(const char* name, zval* z_event)
+{
+ zval* value;
+
+ ZEND_HASH_FOREACH_VAL_IND(MONGODB_G(subscribers), value)
+ {
+ if (EG(exception)) {
+ break;
+ }
+ /* We can't use the zend_call_method_with_1_params macro here, as it
+ * does a sizeof() on the name argument, which does only work with
+ * constant names, but not with parameterized ones as it does
+ * "sizeof(char*)" in that case. */
+ zend_call_method(PHONGO_COMPAT_OBJ_P(value), NULL, NULL, name, strlen(name), NULL, 1, z_event, NULL);
+ }
+ ZEND_HASH_FOREACH_END();
+}
+
+static void php_phongo_command_started(const mongoc_apm_command_started_t* event)
+{
+ php_phongo_commandstartedevent_t* p_event;
+ zval z_event;
+
+ /* Return early if there are no APM subscribers to notify */
+ if (!MONGODB_G(subscribers) || zend_hash_num_elements(MONGODB_G(subscribers)) == 0) {
+ return;
+ }
+
+ object_init_ex(&z_event, php_phongo_commandstartedevent_ce);
+ p_event = Z_COMMANDSTARTEDEVENT_OBJ_P(&z_event);
+
+ p_event->client = mongoc_apm_command_started_get_context(event);
+ p_event->command_name = estrdup(mongoc_apm_command_started_get_command_name(event));
+ p_event->server_id = mongoc_apm_command_started_get_server_id(event);
+ p_event->operation_id = mongoc_apm_command_started_get_operation_id(event);
+ p_event->request_id = mongoc_apm_command_started_get_request_id(event);
+ p_event->command = bson_copy(mongoc_apm_command_started_get_command(event));
+ p_event->database_name = estrdup(mongoc_apm_command_started_get_database_name(event));
+
+ php_phongo_dispatch_handlers("commandStarted", &z_event);
+ zval_ptr_dtor(&z_event);
+}
+
+static void php_phongo_command_succeeded(const mongoc_apm_command_succeeded_t* event)
+{
+ php_phongo_commandsucceededevent_t* p_event;
+ zval z_event;
+
+ /* Return early if there are no APM subscribers to notify */
+ if (!MONGODB_G(subscribers) || zend_hash_num_elements(MONGODB_G(subscribers)) == 0) {
+ return;
+ }
+
+ object_init_ex(&z_event, php_phongo_commandsucceededevent_ce);
+ p_event = Z_COMMANDSUCCEEDEDEVENT_OBJ_P(&z_event);
+
+ p_event->client = mongoc_apm_command_succeeded_get_context(event);
+ p_event->command_name = estrdup(mongoc_apm_command_succeeded_get_command_name(event));
+ p_event->server_id = mongoc_apm_command_succeeded_get_server_id(event);
+ p_event->operation_id = mongoc_apm_command_succeeded_get_operation_id(event);
+ p_event->request_id = mongoc_apm_command_succeeded_get_request_id(event);
+ p_event->duration_micros = mongoc_apm_command_succeeded_get_duration(event);
+ p_event->reply = bson_copy(mongoc_apm_command_succeeded_get_reply(event));
+
+ php_phongo_dispatch_handlers("commandSucceeded", &z_event);
+ zval_ptr_dtor(&z_event);
+}
+
+static void php_phongo_command_failed(const mongoc_apm_command_failed_t* event)
+{
+ php_phongo_commandfailedevent_t* p_event;
+ zval z_event;
+ bson_error_t tmp_error = { 0 };
+ zend_class_entry* default_exception_ce;
+
+ default_exception_ce = zend_exception_get_default();
+
+ /* Return early if there are no APM subscribers to notify */
+ if (!MONGODB_G(subscribers) || zend_hash_num_elements(MONGODB_G(subscribers)) == 0) {
+ return;
+ }
+
+ object_init_ex(&z_event, php_phongo_commandfailedevent_ce);
+ p_event = Z_COMMANDFAILEDEVENT_OBJ_P(&z_event);
+
+ p_event->client = mongoc_apm_command_failed_get_context(event);
+ p_event->command_name = estrdup(mongoc_apm_command_failed_get_command_name(event));
+ p_event->server_id = mongoc_apm_command_failed_get_server_id(event);
+ p_event->operation_id = mongoc_apm_command_failed_get_operation_id(event);
+ p_event->request_id = mongoc_apm_command_failed_get_request_id(event);
+ p_event->duration_micros = mongoc_apm_command_failed_get_duration(event);
+ p_event->reply = bson_copy(mongoc_apm_command_failed_get_reply(event));
+
+ /* We need to process and convert the error right here, otherwise
+ * debug_info will turn into a recursive loop, and with the wrong trace
+ * locations */
+ mongoc_apm_command_failed_get_error(event, &tmp_error);
+
+ object_init_ex(&p_event->z_error, phongo_exception_from_mongoc_domain(tmp_error.domain, tmp_error.code));
+ zend_update_property_string(default_exception_ce, PHONGO_COMPAT_OBJ_P(&p_event->z_error), ZEND_STRL("message"), tmp_error.message);
+ zend_update_property_long(default_exception_ce, PHONGO_COMPAT_OBJ_P(&p_event->z_error), ZEND_STRL("code"), tmp_error.code);
+
+ php_phongo_dispatch_handlers("commandFailed", &z_event);
+ zval_ptr_dtor(&z_event);
+}
+
+/* Sets the callbacks for APM */
+int php_phongo_set_monitoring_callbacks(mongoc_client_t* client)
+{
+ int retval;
+
+ mongoc_apm_callbacks_t* callbacks = mongoc_apm_callbacks_new();
+
+ mongoc_apm_set_command_started_cb(callbacks, php_phongo_command_started);
+ mongoc_apm_set_command_succeeded_cb(callbacks, php_phongo_command_succeeded);
+ mongoc_apm_set_command_failed_cb(callbacks, php_phongo_command_failed);
+ retval = mongoc_client_set_apm_callbacks(client, callbacks, client);
+
+ mongoc_apm_callbacks_destroy(callbacks);
+
+ return retval;
+}
+
+static zval* php_phongo_manager_prepare_manager_for_hash(zval* driverOptions, bool* free)
+{
+ php_phongo_manager_t* manager;
+ zval* autoEncryptionOpts = NULL;
+ zval* keyVaultClient = NULL;
+ zval* driverOptionsClone = NULL;
+ zval* autoEncryptionOptsClone = NULL;
+ zval stackAutoEncryptionOptsClone;
+
+ *free = false;
+
+ if (!driverOptions) {
+ return NULL;
+ }
+
+ if (!php_array_existsc(driverOptions, "autoEncryption")) {
+ goto ref;
+ }
+
+ autoEncryptionOpts = php_array_fetchc(driverOptions, "autoEncryption");
+ if (Z_TYPE_P(autoEncryptionOpts) != IS_ARRAY) {
+ goto ref;
+ }
+
+ if (!php_array_existsc(autoEncryptionOpts, "keyVaultClient")) {
+ goto ref;
+ }
+
+ keyVaultClient = php_array_fetchc(autoEncryptionOpts, "keyVaultClient");
+ if (Z_TYPE_P(keyVaultClient) != IS_OBJECT || !instanceof_function(Z_OBJCE_P(keyVaultClient), php_phongo_manager_ce)) {
+ goto ref;
+ }
+
+ *free = true;
+
+ manager = Z_MANAGER_OBJ_P(keyVaultClient);
+
+ driverOptionsClone = ecalloc(sizeof(zval), 1);
+ autoEncryptionOptsClone = &stackAutoEncryptionOptsClone;
+
+ ZVAL_DUP(autoEncryptionOptsClone, autoEncryptionOpts);
+ ADD_ASSOC_STRINGL(autoEncryptionOptsClone, "keyVaultClient", manager->client_hash, manager->client_hash_len);
+
+ ZVAL_DUP(driverOptionsClone, driverOptions);
+ ADD_ASSOC_ZVAL_EX(driverOptionsClone, "autoEncryption", autoEncryptionOptsClone);
+
+ return driverOptionsClone;
+
+ref:
+ Z_ADDREF_P(driverOptions);
+ return driverOptions;
+}
+
+/* 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)
+{
+ char* hash = NULL;
+ smart_str var_buf = { 0 };
+ php_serialize_data_t var_hash;
+ zval* serializable_driver_options = NULL;
+ bool free_driver_options = false;
+
+ zval args;
+
+ 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) {
+ serializable_driver_options = php_phongo_manager_prepare_manager_for_hash(driverOptions, &free_driver_options);
+ ADD_ASSOC_ZVAL_EX(&args, "driverOptions", serializable_driver_options);
+ } 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 = estrndup(ZSTR_VAL(var_buf.s), *hash_len);
+ }
+
+ zval_ptr_dtor(&args);
+
+ if (free_driver_options) {
+ efree(serializable_driver_options);
+ }
+
+ smart_str_free(&var_buf);
+
+ return hash;
+}
+
+static bool php_phongo_extract_handshake_data(zval* driver, const char* key, char** value, size_t* value_len)
+{
+ zval* zvalue;
+
+ if (!php_array_exists(driver, key)) {
+ *value = NULL;
+ *value_len = 0;
+
+ return true;
+ }
+
+ zvalue = php_array_fetch(driver, key);
+
+ if (Z_TYPE_P(zvalue) != IS_STRING) {
+ phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Expected \"%s\" handshake option to be a string, %s given", key, PHONGO_ZVAL_CLASS_OR_TYPE_NAME_P(zvalue));
+ return false;
+ }
+
+ *value = estrdup(Z_STRVAL_P(zvalue));
+ *value_len = Z_STRLEN_P(zvalue);
+
+ return true;
+}
+
+static char* php_phongo_concat_handshake_data(const char* default_value, const char* custom_value, size_t custom_value_len)
+{
+ char* ret;
+ /* Length of the returned value needs to include the trailing null byte */
+ size_t ret_len = strlen(default_value) + 1;
+
+ if (custom_value) {
+ /* Increase the length by that of the custom value as well as one byte for the separator */
+ ret_len += custom_value_len + PHONGO_METADATA_SEPARATOR_LEN;
+ }
+
+ ret = ecalloc(sizeof(char*), ret_len);
+
+ if (custom_value) {
+ snprintf(ret, ret_len, "%s%s%s", default_value, PHONGO_METADATA_SEPARATOR, custom_value);
+ } else {
+ snprintf(ret, ret_len, "%s", default_value);
+ }
+
+ return ret;
+}
+
+static void php_phongo_handshake_data_append(const char* name, size_t name_len, const char* version, size_t version_len, const char* platform, size_t platform_len)
+{
+ char* php_version_string;
+ size_t php_version_string_len;
+ char* driver_name;
+ char* driver_version;
+ char* full_platform;
+
+ php_version_string_len = strlen(PHP_VERSION);
+ php_version_string = ecalloc(sizeof(char*), 4 + php_version_string_len);
+ snprintf(php_version_string, 4 + php_version_string_len, "PHP %s", PHP_VERSION);
+
+ driver_name = php_phongo_concat_handshake_data("ext-mongodb:PHP", name, name_len);
+ driver_version = php_phongo_concat_handshake_data(PHP_MONGODB_VERSION, version, version_len);
+ full_platform = php_phongo_concat_handshake_data(php_version_string, platform, platform_len);
+
+ MONGOC_DEBUG(
+ "Setting driver handshake data: name %s, version %s, platform %s",
+ driver_name,
+ driver_version,
+ full_platform);
+
+ mongoc_handshake_data_append(driver_name, driver_version, full_platform);
+
+ efree(php_version_string);
+ efree(driver_name);
+ efree(driver_version);
+ efree(full_platform);
+}
+
+static void php_phongo_set_handshake_data(zval* driverOptions)
+{
+ char* name = NULL;
+ size_t name_len = 0;
+ char* version = NULL;
+ size_t version_len = 0;
+ char* platform = NULL;
+ size_t platform_len = 0;
+
+ if (driverOptions && php_array_existsc(driverOptions, "driver")) {
+ zval* driver = php_array_fetchc(driverOptions, "driver");
+
+ if (Z_TYPE_P(driver) != IS_ARRAY) {
+ phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Expected \"driver\" driver option to be an array, %s given", PHONGO_ZVAL_CLASS_OR_TYPE_NAME_P(driver));
+ return;
+ }
+
+ if (!php_phongo_extract_handshake_data(driver, "name", &name, &name_len)) {
+ /* Exception already thrown */
+ goto cleanup;
+ }
+
+ if (!php_phongo_extract_handshake_data(driver, "version", &version, &version_len)) {
+ /* Exception already thrown */
+ goto cleanup;
+ }
+
+ if (!php_phongo_extract_handshake_data(driver, "platform", &platform, &platform_len)) {
+ /* Exception already thrown */
+ goto cleanup;
+ }
+ }
+
+ php_phongo_handshake_data_append(name, name_len, version, version_len, platform, platform_len);
+
+cleanup:
+ if (name) {
+ efree(name);
+ }
+ if (version) {
+ efree(version);
+ }
+ if (platform) {
+ efree(platform);
+ }
+}
+
+static mongoc_client_t* php_phongo_make_mongo_client(const mongoc_uri_t* uri, zval* driverOptions) /* {{{ */
+{
+ const char *mongoc_version, *bson_version;
+
+#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",
+ PHP_MONGODB_VERSION,
+ PHP_MONGODB_STABILITY,
+ MONGOC_VERSION_S,
+ mongoc_version,
+ BSON_VERSION_S,
+ bson_version,
+ PHP_VERSION);
+
+ php_phongo_set_handshake_data(driverOptions);
+
+ return mongoc_client_new_from_uri(uri);
+} /* }}} */
+
+static void php_phongo_persist_client(const char* hash, size_t hash_len, mongoc_client_t* client)
+{
+ php_phongo_pclient_t* pclient = (php_phongo_pclient_t*) pecalloc(1, sizeof(php_phongo_pclient_t), 1);
+
+ pclient->created_by_pid = (int) getpid();
+ pclient->client = client;
+
+ zend_hash_str_update_ptr(&MONGODB_G(pclients), hash, hash_len, pclient);
+}
+
+static mongoc_client_t* php_phongo_find_client(const char* hash, size_t hash_len)
+{
+ php_phongo_pclient_t* pclient;
+
+ if ((pclient = zend_hash_str_find_ptr(&MONGODB_G(pclients), hash, hash_len)) != NULL) {
+ return pclient->client;
+ }
+
+ return NULL;
+}
+
+#ifdef MONGOC_ENABLE_CLIENT_SIDE_ENCRYPTION
+static bool phongo_manager_set_auto_encryption_opts(php_phongo_manager_t* manager, zval* driverOptions) /* {{{ */
+{
+ zval* zAutoEncryptionOpts;
+ bson_error_t error = { 0 };
+ mongoc_auto_encryption_opts_t* auto_encryption_opts = NULL;
+ bool retval = false;
+
+ if (!driverOptions || !php_array_existsc(driverOptions, "autoEncryption")) {
+ return true;
+ }
+
+ zAutoEncryptionOpts = php_array_fetch(driverOptions, "autoEncryption");
+
+ if (Z_TYPE_P(zAutoEncryptionOpts) != IS_ARRAY) {
+ phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Expected \"autoEncryption\" driver option to be array, %s given", PHONGO_ZVAL_CLASS_OR_TYPE_NAME_P(zAutoEncryptionOpts));
+ return false;
+ }
+
+ auto_encryption_opts = mongoc_auto_encryption_opts_new();
+
+ if (php_array_existsc(zAutoEncryptionOpts, "keyVaultClient")) {
+ zval* key_vault_client = php_array_fetch(zAutoEncryptionOpts, "keyVaultClient");
+
+ if (Z_TYPE_P(key_vault_client) != IS_OBJECT || !instanceof_function(Z_OBJCE_P(key_vault_client), php_phongo_manager_ce)) {
+ phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Expected \"keyVaultClient\" encryption option to be %s, %s given", ZSTR_VAL(php_phongo_manager_ce->name), PHONGO_ZVAL_CLASS_OR_TYPE_NAME_P(key_vault_client));
+ goto cleanup;
+ }
+
+ mongoc_auto_encryption_opts_set_keyvault_client(auto_encryption_opts, Z_MANAGER_OBJ_P(key_vault_client)->client);
+ }
+
+ if (php_array_existsc(zAutoEncryptionOpts, "keyVaultNamespace")) {
+ char* key_vault_ns;
+ char* db_name;
+ char* coll_name;
+ int plen;
+ zend_bool pfree;
+
+ key_vault_ns = php_array_fetch_string(zAutoEncryptionOpts, "keyVaultNamespace", &plen, &pfree);
+
+ if (!phongo_split_namespace(key_vault_ns, &db_name, &coll_name)) {
+ phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Expected \"keyVaultNamespace\" encryption option to contain a full collection name");
+
+ if (pfree) {
+ efree(key_vault_ns);
+ }
+
+ goto cleanup;
+ }
+
+ mongoc_auto_encryption_opts_set_keyvault_namespace(auto_encryption_opts, db_name, coll_name);
+
+ efree(db_name);
+ efree(coll_name);
+
+ if (pfree) {
+ efree(key_vault_ns);
+ }
+ }
+
+ if (php_array_existsc(zAutoEncryptionOpts, "kmsProviders")) {
+ zval* kms_providers = php_array_fetch(zAutoEncryptionOpts, "kmsProviders");
+ bson_t bson_providers = BSON_INITIALIZER;
+
+ if (Z_TYPE_P(kms_providers) != IS_OBJECT && Z_TYPE_P(kms_providers) != IS_ARRAY) {
+ phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Expected \"kmsProviders\" encryption option to be an array or object");
+ goto cleanup;
+ }
+
+ php_phongo_zval_to_bson(kms_providers, PHONGO_BSON_NONE, &bson_providers, NULL);
+ if (EG(exception)) {
+ goto cleanup;
+ }
+
+ mongoc_auto_encryption_opts_set_kms_providers(auto_encryption_opts, &bson_providers);
+
+ bson_destroy(&bson_providers);
+ }
+
+ if (php_array_existsc(zAutoEncryptionOpts, "schemaMap")) {
+ zval* schema_map = php_array_fetch(zAutoEncryptionOpts, "schemaMap");
+ bson_t bson_map = BSON_INITIALIZER;
+
+ if (Z_TYPE_P(schema_map) != IS_OBJECT && Z_TYPE_P(schema_map) != IS_ARRAY) {
+ phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Expected \"schemaMap\" encryption option to be an array or object");
+ goto cleanup;
+ }
+
+ php_phongo_zval_to_bson(schema_map, PHONGO_BSON_NONE, &bson_map, NULL);
+ if (EG(exception)) {
+ goto cleanup;
+ }
+
+ mongoc_auto_encryption_opts_set_schema_map(auto_encryption_opts, &bson_map);
+
+ bson_destroy(&bson_map);
+ }
+
+ if (php_array_existsc(zAutoEncryptionOpts, "bypassAutoEncryption")) {
+ zend_bool bypass_auto_encryption = php_array_fetch_bool(zAutoEncryptionOpts, "bypassAutoEncryption");
+
+ mongoc_auto_encryption_opts_set_bypass_auto_encryption(auto_encryption_opts, bypass_auto_encryption);
+ }
+
+ if (php_array_existsc(zAutoEncryptionOpts, "extraOptions")) {
+ zval* extra_options = php_array_fetch(zAutoEncryptionOpts, "extraOptions");
+ bson_t bson_options = BSON_INITIALIZER;
+
+ php_phongo_zval_to_bson(extra_options, PHONGO_BSON_NONE, &bson_options, NULL);
+ if (EG(exception)) {
+ goto cleanup;
+ }
+
+ mongoc_auto_encryption_opts_set_extra(auto_encryption_opts, &bson_options);
+
+ bson_destroy(&bson_options);
+ }
+
+ if (!mongoc_client_enable_auto_encryption(manager->client, auto_encryption_opts, &error)) {
+ phongo_throw_exception_from_bson_error_t(&error);
+ goto cleanup;
+ }
+
+ retval = true;
+
+cleanup:
+ mongoc_auto_encryption_opts_destroy(auto_encryption_opts);
+ return retval;
+}
+/* }}} */
+
+static mongoc_client_encryption_opts_t* phongo_clientencryption_opts_from_zval(mongoc_client_t* defaultKeyVaultClient, zval* options) /* {{{ */
+{
+ mongoc_client_encryption_opts_t* opts;
+
+ opts = mongoc_client_encryption_opts_new();
+
+ if (!options || Z_TYPE_P(options) != IS_ARRAY) {
+ return opts;
+ }
+
+ if (php_array_existsc(options, "keyVaultClient")) {
+ zval* key_vault_client = php_array_fetch(options, "keyVaultClient");
+
+ if (Z_TYPE_P(key_vault_client) != IS_OBJECT || !instanceof_function(Z_OBJCE_P(key_vault_client), php_phongo_manager_ce)) {
+ phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Expected \"keyVaultClient\" encryption option to be %s, %s given", ZSTR_VAL(php_phongo_manager_ce->name), PHONGO_ZVAL_CLASS_OR_TYPE_NAME_P(key_vault_client));
+ goto cleanup;
+ }
+
+ mongoc_client_encryption_opts_set_keyvault_client(opts, Z_MANAGER_OBJ_P(key_vault_client)->client);
+ } else {
+ mongoc_client_encryption_opts_set_keyvault_client(opts, defaultKeyVaultClient);
+ }
+
+ if (php_array_existsc(options, "keyVaultNamespace")) {
+ char* keyvault_namespace;
+ char* db_name;
+ char* coll_name;
+ int plen;
+ zend_bool pfree;
+
+ keyvault_namespace = php_array_fetchc_string(options, "keyVaultNamespace", &plen, &pfree);
+
+ if (!phongo_split_namespace(keyvault_namespace, &db_name, &coll_name)) {
+ phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Expected \"keyVaultNamespace\" encryption option to contain a full collection name");
+
+ if (pfree) {
+ efree(keyvault_namespace);
+ }
+
+ goto cleanup;
+ }
+
+ mongoc_client_encryption_opts_set_keyvault_namespace(opts, db_name, coll_name);
+ efree(db_name);
+ efree(coll_name);
+
+ if (pfree) {
+ efree(keyvault_namespace);
+ }
+ }
+
+ if (php_array_existsc(options, "kmsProviders")) {
+ zval* kms_providers = php_array_fetchc(options, "kmsProviders");
+ bson_t bson_providers = BSON_INITIALIZER;
+
+ if (Z_TYPE_P(kms_providers) != IS_ARRAY && Z_TYPE_P(kms_providers) != IS_OBJECT) {
+ phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Expected \"kmsProviders\" encryption option to be an array or object");
+ goto cleanup;
+ }
+
+ php_phongo_zval_to_bson(kms_providers, PHONGO_BSON_NONE, &bson_providers, NULL);
+ if (EG(exception)) {
+ goto cleanup;
+ }
+
+ mongoc_client_encryption_opts_set_kms_providers(opts, &bson_providers);
+ bson_destroy(&bson_providers);
+ }
+
+ return opts;
+
+cleanup:
+ if (opts) {
+ mongoc_client_encryption_opts_destroy(opts);
+ }
+
+ return NULL;
+} /* }}} */
+
+void phongo_clientencryption_init(php_phongo_clientencryption_t* clientencryption, mongoc_client_t* client, zval* options) /* {{{ */
+{
+ mongoc_client_encryption_t* ce;
+ mongoc_client_encryption_opts_t* opts;
+ bson_error_t error = { 0 };
+
+ opts = phongo_clientencryption_opts_from_zval(client, options);
+ if (!opts) {
+ /* Exception already thrown */
+ goto cleanup;
+ }
+
+ ce = mongoc_client_encryption_new(opts, &error);
+ if (!ce) {
+ phongo_throw_exception_from_bson_error_t(&error);
+
+ goto cleanup;
+ }
+
+ clientencryption->client_encryption = ce;
+
+cleanup:
+ if (opts) {
+ mongoc_client_encryption_opts_destroy(opts);
+ }
+} /* }}} */
+
+static mongoc_client_encryption_datakey_opts_t* phongo_clientencryption_datakey_opts_from_zval(zval* options) /* {{{ */
+{
+ mongoc_client_encryption_datakey_opts_t* opts;
+
+ opts = mongoc_client_encryption_datakey_opts_new();
+
+ if (!options || Z_TYPE_P(options) != IS_ARRAY) {
+ return opts;
+ }
+
+ if (php_array_existsc(options, "keyAltNames")) {
+ zval* zkeyaltnames = php_array_fetchc(options, "keyAltNames");
+ HashTable* ht_data;
+ uint32_t keyaltnames_count;
+ char** keyaltnames;
+ uint32_t i = 0;
+ uint32_t j = 0;
+ bool failed = false;
+
+ if (!zkeyaltnames || Z_TYPE_P(zkeyaltnames) != IS_ARRAY) {
+ phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Expected keyAltNames to be array, %s given", PHONGO_ZVAL_CLASS_OR_TYPE_NAME_P(zkeyaltnames));
+ goto cleanup;
+ }
+
+ ht_data = HASH_OF(zkeyaltnames);
+ keyaltnames_count = ht_data ? zend_hash_num_elements(ht_data) : 0;
+ keyaltnames = ecalloc(keyaltnames_count, sizeof(char*));
+
+ {
+ zend_string* string_key = NULL;
+ zend_ulong num_key = 0;
+ zval* keyaltname;
+
+ ZEND_HASH_FOREACH_KEY_VAL(ht_data, num_key, string_key, keyaltname)
+ {
+ if (i >= keyaltnames_count) {
+ phongo_throw_exception(PHONGO_ERROR_LOGIC, "Iterating over too many keyAltNames. Please file a bug report");
+ failed = true;
+ break;
+ }
+
+ if (Z_TYPE_P(keyaltname) != IS_STRING) {
+ if (string_key) {
+ phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Expected keyAltName with index \"%s\" to be string, %s given", ZSTR_VAL(string_key), PHONGO_ZVAL_CLASS_OR_TYPE_NAME_P(keyaltname));
+ } else {
+ phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Expected keyAltName with index \"%lu\" to be string, %s given", num_key, PHONGO_ZVAL_CLASS_OR_TYPE_NAME_P(keyaltname));
+ }
+
+ failed = true;
+ break;
+ }
+
+ keyaltnames[i] = estrdup(Z_STRVAL_P(keyaltname));
+ i++;
+ }
+ ZEND_HASH_FOREACH_END();
+ }
+
+ if (!failed) {
+ mongoc_client_encryption_datakey_opts_set_keyaltnames(opts, keyaltnames, keyaltnames_count);
+ }
+
+ for (j = 0; j < i; j++) {
+ efree(keyaltnames[j]);
+ }
+ efree(keyaltnames);
+
+ if (failed) {
+ goto cleanup;
+ }
+ }
+
+ if (php_array_existsc(options, "masterKey")) {
+ bson_t masterkey = BSON_INITIALIZER;
+
+ php_phongo_zval_to_bson(php_array_fetchc(options, "masterKey"), PHONGO_BSON_NONE, &masterkey, NULL);
+ if (EG(exception)) {
+ goto cleanup;
+ }
+
+ mongoc_client_encryption_datakey_opts_set_masterkey(opts, &masterkey);
+ }
+
+ return opts;
+
+cleanup:
+ if (opts) {
+ mongoc_client_encryption_datakey_opts_destroy(opts);
+ }
+
+ return NULL;
+} /* }}} */
+
+void phongo_clientencryption_create_datakey(php_phongo_clientencryption_t* clientencryption, zval* return_value, char* kms_provider, zval* options) /* {{{ */
+{
+ mongoc_client_encryption_datakey_opts_t* opts;
+ bson_value_t keyid;
+ bson_error_t error = { 0 };
+
+ opts = phongo_clientencryption_datakey_opts_from_zval(options);
+ if (!opts) {
+ /* Exception already thrown */
+ goto cleanup;
+ }
+
+ if (!mongoc_client_encryption_create_datakey(clientencryption->client_encryption, kms_provider, opts, &keyid, &error)) {
+ phongo_throw_exception_from_bson_error_t(&error);
+ goto cleanup;
+ }
+
+ if (!php_phongo_bson_value_to_zval(&keyid, return_value)) {
+ /* Exception already thrown */
+ goto cleanup;
+ }
+
+cleanup:
+ if (opts) {
+ mongoc_client_encryption_datakey_opts_destroy(opts);
+ }
+} /* }}} */
+
+static mongoc_client_encryption_encrypt_opts_t* phongo_clientencryption_encrypt_opts_from_zval(zval* options) /* {{{ */
+{
+ mongoc_client_encryption_encrypt_opts_t* opts;
+
+ opts = mongoc_client_encryption_encrypt_opts_new();
+
+ if (!options || Z_TYPE_P(options) != IS_ARRAY) {
+ return opts;
+ }
+
+ if (php_array_existsc(options, "keyId")) {
+ bson_value_t keyid;
+
+ php_phongo_zval_to_bson_value(php_array_fetchc(options, "keyId"), PHONGO_BSON_NONE, &keyid);
+ if (EG(exception)) {
+ goto cleanup;
+ }
+
+ mongoc_client_encryption_encrypt_opts_set_keyid(opts, &keyid);
+ }
+
+ if (php_array_existsc(options, "keyAltName")) {
+ char* keyaltname;
+ int plen;
+ zend_bool pfree;
+
+ keyaltname = php_array_fetch_string(options, "keyAltName", &plen, &pfree);
+ mongoc_client_encryption_encrypt_opts_set_keyaltname(opts, keyaltname);
+
+ if (pfree) {
+ efree(keyaltname);
+ }
+ }
+
+ if (php_array_existsc(options, "algorithm")) {
+ char* algorithm;
+ int plen;
+ zend_bool pfree;
+
+ algorithm = php_array_fetch_string(options, "algorithm", &plen, &pfree);
+ mongoc_client_encryption_encrypt_opts_set_algorithm(opts, algorithm);
+
+ if (pfree) {
+ efree(algorithm);
+ }
+ }
+
+ return opts;
+
+cleanup:
+ if (opts) {
+ mongoc_client_encryption_encrypt_opts_destroy(opts);
+ }
+
+ return NULL;
+} /* }}} */
+
+void phongo_clientencryption_encrypt(php_phongo_clientencryption_t* clientencryption, zval* zvalue, zval* zciphertext, zval* options) /* {{{ */
+{
+ mongoc_client_encryption_encrypt_opts_t* opts;
+ bson_value_t ciphertext, value;
+ bson_error_t error = { 0 };
+
+ php_phongo_zval_to_bson_value(zvalue, PHONGO_BSON_NONE, &value);
+
+ opts = phongo_clientencryption_encrypt_opts_from_zval(options);
+ if (!opts) {
+ /* Exception already thrown */
+ goto cleanup;
+ }
+
+ if (!mongoc_client_encryption_encrypt(clientencryption->client_encryption, &value, opts, &ciphertext, &error)) {
+ phongo_throw_exception_from_bson_error_t(&error);
+ goto cleanup;
+ }
+
+ if (!php_phongo_bson_value_to_zval(&ciphertext, zciphertext)) {
+ /* Exception already thrown */
+ goto cleanup;
+ }
+
+cleanup:
+ if (opts) {
+ mongoc_client_encryption_encrypt_opts_destroy(opts);
+ }
+} /* }}} */
+
+void phongo_clientencryption_decrypt(php_phongo_clientencryption_t* clientencryption, zval* zciphertext, zval* zvalue) /* {{{ */
+{
+ bson_value_t ciphertext, value;
+ bson_error_t error = { 0 };
+
+ php_phongo_zval_to_bson_value(zciphertext, PHONGO_BSON_NONE, &ciphertext);
+
+ if (!mongoc_client_encryption_decrypt(clientencryption->client_encryption, &ciphertext, &value, &error)) {
+ phongo_throw_exception_from_bson_error_t(&error);
+ return;
+ }
+
+ if (!php_phongo_bson_value_to_zval(&value, zvalue)) {
+ /* Exception already thrown */
+ return;
+ }
+}
+/* }}} */
+#else /* MONGOC_ENABLE_CLIENT_SIDE_ENCRYPTION */
+static void phongo_throw_exception_no_cse(php_phongo_error_domain_t domain, const char* message) /* {{{ */
+{
+ phongo_throw_exception(domain, "%s Please recompile with support for libmongocrypt using the with-mongodb-client-side-encryption configure switch.", message);
+}
+/* }}} */
+
+static bool phongo_manager_set_auto_encryption_opts(php_phongo_manager_t* manager, zval* driverOptions) /* {{{ */
+{
+ if (!driverOptions || !php_array_existsc(driverOptions, "autoEncryption")) {
+ return true;
+ }
+
+ phongo_throw_exception_no_cse(PHONGO_ERROR_INVALID_ARGUMENT, "Cannot enable automatic field-level encryption.");
+
+ return false;
+}
+/* }}} */
+
+void phongo_clientencryption_init(php_phongo_clientencryption_t* clientencryption, mongoc_client_t* client, zval* options) /* {{{ */
+{
+ phongo_throw_exception_no_cse(PHONGO_ERROR_RUNTIME, "Cannot configure clientEncryption object.");
+}
+/* }}} */
+
+void phongo_clientencryption_create_datakey(php_phongo_clientencryption_t* clientencryption, zval* return_value, char* kms_provider, zval* options) /* {{{ */
+{
+ phongo_throw_exception_no_cse(PHONGO_ERROR_RUNTIME, "Cannot create encryption key.");
+}
+/* }}} */
+
+void phongo_clientencryption_encrypt(php_phongo_clientencryption_t* clientencryption, zval* zvalue, zval* zciphertext, zval* options) /* {{{ */
+{
+ phongo_throw_exception_no_cse(PHONGO_ERROR_RUNTIME, "Cannot encrypt value.");
+}
+/* }}} */
+
+void phongo_clientencryption_decrypt(php_phongo_clientencryption_t* clientencryption, zval* zciphertext, zval* zvalue) /* {{{ */
+{
+ phongo_throw_exception_no_cse(PHONGO_ERROR_RUNTIME, "Cannot decrypt value.");
+}
+/* }}} */
+#endif
+
+void phongo_manager_init(php_phongo_manager_t* manager, const char* uri_string, zval* options, zval* driverOptions) /* {{{ */
+{
+ bson_t bson_options = BSON_INITIALIZER;
+ mongoc_uri_t* uri = NULL;
+#ifdef MONGOC_ENABLE_SSL
+ mongoc_ssl_opt_t* ssl_opt = NULL;
+#endif
+
+ if (!(manager->client_hash = php_phongo_manager_make_client_hash(uri_string, options, driverOptions, &manager->client_hash_len))) {
+ /* Exception should already have been thrown and there is nothing to free */
+ return;
+ }
+
+ if ((manager->client = php_phongo_find_client(manager->client_hash, manager->client_hash_len))) {
+ MONGOC_DEBUG("Found client for hash: %s\n", manager->client_hash);
+ goto cleanup;
+ }
+
+ if (options) {
+ php_phongo_zval_to_bson(options, PHONGO_BSON_NONE, &bson_options, NULL);
+ }
+
+ /* An exception may be thrown during BSON conversion */
+ if (EG(exception)) {
+ goto cleanup;
+ }
+
+ if (!(uri = php_phongo_make_uri(uri_string))) {
+ /* Exception should already have been thrown */
+ goto cleanup;
+ }
+
+ if (!php_phongo_apply_options_to_uri(uri, &bson_options) ||
+ !php_phongo_apply_rc_options_to_uri(uri, &bson_options) ||
+ !php_phongo_apply_rp_options_to_uri(uri, &bson_options) ||
+ !php_phongo_apply_wc_options_to_uri(uri, &bson_options)) {
+ /* Exception should already have been thrown */
+ goto cleanup;
+ }
+
+#ifdef MONGOC_ENABLE_SSL
+ if (!php_phongo_apply_driver_options_to_uri(uri, driverOptions)) {
+ /* Exception should already have been thrown */
+ goto cleanup;
+ }
+
+ ssl_opt = php_phongo_make_ssl_opt(uri, driverOptions);
+
+ /* An exception may be thrown during SSL option creation */
+ if (EG(exception)) {
+ goto cleanup;
+ }
+
+ if (!php_phongo_uri_finalize_tls(uri)) {
+ /* Exception should already have been thrown */
+ goto cleanup;
+ }
+#else
+ if (mongoc_uri_get_tls(uri)) {
+ phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Cannot create SSL client. SSL is not enabled in this build.");
+ goto cleanup;
+ }
+#endif
+
+ manager->client = php_phongo_make_mongo_client(uri, driverOptions);
+ mongoc_client_set_error_api(manager->client, MONGOC_ERROR_API_VERSION_2);
+
+ if (!manager->client) {
+ phongo_throw_exception(PHONGO_ERROR_RUNTIME, "Failed to create Manager from URI: '%s'", uri_string);
+ goto cleanup;
+ }
+
+#ifdef MONGOC_ENABLE_SSL
+ if (ssl_opt) {
+ mongoc_client_set_ssl_opts(manager->client, ssl_opt);
+ }
+#endif
+
+ if (!phongo_manager_set_auto_encryption_opts(manager, driverOptions)) {
+ /* Exception should already have been thrown */
+ goto cleanup;
+ }
+
+ MONGOC_DEBUG("Created client hash: %s\n", manager->client_hash);
+ php_phongo_persist_client(manager->client_hash, manager->client_hash_len, manager->client);
+
+cleanup:
+ bson_destroy(&bson_options);
+
+ if (uri) {
+ mongoc_uri_destroy(uri);
+ }
+
+#ifdef MONGOC_ENABLE_SSL
+ if (ssl_opt) {
+ php_phongo_free_ssl_opt(ssl_opt);
+ }
+#endif
+} /* }}} */
+
+bool php_phongo_parse_int64(int64_t* retval, const char* data, size_t data_len) /* {{{ */
+{
+ int64_t value;
+ char* endptr = NULL;
+
+ /* bson_ascii_strtoll() sets errno if conversion fails. If conversion
+ * succeeds, we still want to ensure that the entire string was parsed. */
+ value = bson_ascii_strtoll(data, &endptr, 10);
+
+ if (errno || (endptr && endptr != ((const char*) data + data_len))) {
+ return false;
+ }
+
+ *retval = value;
+
+ return true;
+} /* }}} */
+
+/* {{{ 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);
+ }
+} /* }}} */
+
+/* }}} */
+
+/* {{{ M[INIT|SHUTDOWN] R[INIT|SHUTDOWN] G[INIT|SHUTDOWN] MINFO INI */
+
+ZEND_INI_MH(OnUpdateDebug)
+{
+ void*** ctx = NULL;
+ char* tmp_dir = NULL;
+
+ /* 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);
+
+ return OnUpdateString(entry, new_value, mh_arg1, mh_arg2, mh_arg3, stage);
+ }
+
+ 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;
+ zend_string* filename;
+
+ time(&t);
+ len = spprintf(&prefix, 0, "PHONGO-%ld", t);
+
+ fd = php_open_temporary_fd(tmp_dir, prefix, &filename);
+ 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);
+
+ return OnUpdateString(entry, new_value, mh_arg1, mh_arg2, mh_arg3, stage);
+}
+
+/* {{{ INI entries */
+PHP_INI_BEGIN()
+ STD_PHP_INI_ENTRY(PHONGO_DEBUG_INI, PHONGO_DEBUG_INI_DEFAULT, PHP_INI_ALL, OnUpdateDebug, debug, zend_mongodb_globals, mongodb_globals)
+PHP_INI_END()
+/* }}} */
+
+static void phongo_pclient_reset_once(php_phongo_pclient_t* pclient, int pid)
+{
+ if (pclient->last_reset_by_pid != pid) {
+ mongoc_client_reset(pclient->client);
+ pclient->last_reset_by_pid = pid;
+ }
+}
+
+/* Resets the libmongoc client if it has not already been reset for the current
+ * PID (based on information in the hash table of persisted libmongoc clients).
+ * This ensures that we do not reset a client multiple times from the same child
+ * process. */
+void php_phongo_client_reset_once(mongoc_client_t* client, int pid)
+{
+ HashTable* pclients;
+ zval* z_ptr;
+ php_phongo_pclient_t* pclient;
+
+ pclients = &MONGODB_G(pclients);
+
+ ZEND_HASH_FOREACH_VAL(pclients, z_ptr)
+ {
+ if ((Z_TYPE_P(z_ptr) != IS_PTR)) {
+ continue;
+ }
+
+ pclient = (php_phongo_pclient_t*) Z_PTR_P(z_ptr);
+
+ if (pclient->client == client) {
+ phongo_pclient_reset_once(pclient, pid);
+ return;
+ }
+ }
+ ZEND_HASH_FOREACH_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->created_by_pid == getpid()) {
+ mongoc_client_destroy(pclient->client);
+ }
+
+ pefree(pclient, 1);
+}
+
+/* {{{ PHP_RINIT_FUNCTION */
+PHP_RINIT_FUNCTION(mongodb)
+{
+ /* Initialize HashTable for APM subscribers, which is initialized to NULL in
+ * GINIT and destroyed and reset to NULL in RSHUTDOWN. */
+ if (MONGODB_G(subscribers) == NULL) {
+ ALLOC_HASHTABLE(MONGODB_G(subscribers));
+ zend_hash_init(MONGODB_G(subscribers), 0, NULL, ZVAL_PTR_DTOR, 0);
+ }
+
+ return SUCCESS;
+}
+/* }}} */
+
+/* {{{ 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 defined(COMPILE_DL_MONGODB) && defined(ZTS)
+ ZEND_TSRMLS_CACHE_UPDATE();
+#endif
+ memset(mongodb_globals, 0, sizeof(zend_mongodb_globals));
+ mongodb_globals->bsonMemVTable = bsonMemVTable;
+
+ /* Initialize HashTable for persistent clients */
+ zend_hash_init(&mongodb_globals->pclients, 0, NULL, NULL, 1);
+}
+/* }}} */
+
+static zend_class_entry* php_phongo_fetch_internal_class(const char* class_name, size_t class_name_len)
+{
+ zend_class_entry* pce;
+
+ if ((pce = zend_hash_str_find_ptr(CG(class_table), class_name, class_name_len))) {
+ return pce;
+ }
+
+ return NULL;
+}
+
+static HashTable* php_phongo_std_get_gc(phongo_compat_object_handler_type* object, zval** table, int* n) /* {{{ */
+{
+ *table = NULL;
+ *n = 0;
+ return zend_std_get_properties(object);
+} /* }}} */
+
+/* {{{ PHP_MINIT_FUNCTION */
+PHP_MINIT_FUNCTION(mongodb)
+{
+ (void) type; /* We don't care if we are loaded via dl() or extension= */
+
+ REGISTER_INI_ENTRIES();
+
+ /* Initialize libmongoc */
+ mongoc_init();
+
+ /* 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));
+ /* Disable cloning by default. Individual classes can opt in if they need to
+ * support this (e.g. BSON objects). */
+ phongo_std_object_handlers.clone_obj = NULL;
+ /* Ensure that get_gc delegates to zend_std_get_properties directly in case
+ * our class defines a get_properties handler for debugging purposes. */
+ phongo_std_object_handlers.get_gc = php_phongo_std_get_gc;
+
+ /* 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"));
+ php_phongo_json_serializable_ce = php_phongo_fetch_internal_class(ZEND_STRL("jsonserializable"));
+
+ 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;
+ }
+
+ /* Register base BSON classes first */
+ php_phongo_type_init_ce(INIT_FUNC_ARGS_PASSTHRU);
+ php_phongo_serializable_init_ce(INIT_FUNC_ARGS_PASSTHRU);
+ php_phongo_unserializable_init_ce(INIT_FUNC_ARGS_PASSTHRU);
+
+ php_phongo_binary_interface_init_ce(INIT_FUNC_ARGS_PASSTHRU);
+ php_phongo_decimal128_interface_init_ce(INIT_FUNC_ARGS_PASSTHRU);
+ php_phongo_javascript_interface_init_ce(INIT_FUNC_ARGS_PASSTHRU);
+ php_phongo_maxkey_interface_init_ce(INIT_FUNC_ARGS_PASSTHRU);
+ php_phongo_minkey_interface_init_ce(INIT_FUNC_ARGS_PASSTHRU);
+ php_phongo_objectid_interface_init_ce(INIT_FUNC_ARGS_PASSTHRU);
+ php_phongo_regex_interface_init_ce(INIT_FUNC_ARGS_PASSTHRU);
+ php_phongo_timestamp_interface_init_ce(INIT_FUNC_ARGS_PASSTHRU);
+ php_phongo_utcdatetime_interface_init_ce(INIT_FUNC_ARGS_PASSTHRU);
+
+ php_phongo_binary_init_ce(INIT_FUNC_ARGS_PASSTHRU);
+ php_phongo_dbpointer_init_ce(INIT_FUNC_ARGS_PASSTHRU);
+ php_phongo_decimal128_init_ce(INIT_FUNC_ARGS_PASSTHRU);
+ php_phongo_int64_init_ce(INIT_FUNC_ARGS_PASSTHRU);
+ php_phongo_javascript_init_ce(INIT_FUNC_ARGS_PASSTHRU);
+ php_phongo_maxkey_init_ce(INIT_FUNC_ARGS_PASSTHRU);
+ php_phongo_minkey_init_ce(INIT_FUNC_ARGS_PASSTHRU);
+ php_phongo_objectid_init_ce(INIT_FUNC_ARGS_PASSTHRU);
+ php_phongo_persistable_init_ce(INIT_FUNC_ARGS_PASSTHRU);
+ php_phongo_regex_init_ce(INIT_FUNC_ARGS_PASSTHRU);
+ php_phongo_symbol_init_ce(INIT_FUNC_ARGS_PASSTHRU);
+ php_phongo_timestamp_init_ce(INIT_FUNC_ARGS_PASSTHRU);
+ php_phongo_undefined_init_ce(INIT_FUNC_ARGS_PASSTHRU);
+ php_phongo_utcdatetime_init_ce(INIT_FUNC_ARGS_PASSTHRU);
+
+ php_phongo_cursor_interface_init_ce(INIT_FUNC_ARGS_PASSTHRU);
+
+ php_phongo_bulkwrite_init_ce(INIT_FUNC_ARGS_PASSTHRU);
+ php_phongo_clientencryption_init_ce(INIT_FUNC_ARGS_PASSTHRU);
+ php_phongo_command_init_ce(INIT_FUNC_ARGS_PASSTHRU);
+ php_phongo_cursor_init_ce(INIT_FUNC_ARGS_PASSTHRU);
+ php_phongo_cursorid_init_ce(INIT_FUNC_ARGS_PASSTHRU);
+ php_phongo_manager_init_ce(INIT_FUNC_ARGS_PASSTHRU);
+ php_phongo_query_init_ce(INIT_FUNC_ARGS_PASSTHRU);
+ php_phongo_readconcern_init_ce(INIT_FUNC_ARGS_PASSTHRU);
+ php_phongo_readpreference_init_ce(INIT_FUNC_ARGS_PASSTHRU);
+ php_phongo_server_init_ce(INIT_FUNC_ARGS_PASSTHRU);
+ php_phongo_session_init_ce(INIT_FUNC_ARGS_PASSTHRU);
+ php_phongo_writeconcern_init_ce(INIT_FUNC_ARGS_PASSTHRU);
+ php_phongo_writeconcernerror_init_ce(INIT_FUNC_ARGS_PASSTHRU);
+ php_phongo_writeerror_init_ce(INIT_FUNC_ARGS_PASSTHRU);
+ php_phongo_writeresult_init_ce(INIT_FUNC_ARGS_PASSTHRU);
+
+ /* Register base exception classes first */
+ php_phongo_exception_init_ce(INIT_FUNC_ARGS_PASSTHRU);
+ php_phongo_runtimeexception_init_ce(INIT_FUNC_ARGS_PASSTHRU);
+ php_phongo_serverexception_init_ce(INIT_FUNC_ARGS_PASSTHRU);
+ php_phongo_connectionexception_init_ce(INIT_FUNC_ARGS_PASSTHRU);
+ php_phongo_writeexception_init_ce(INIT_FUNC_ARGS_PASSTHRU);
+
+ php_phongo_authenticationexception_init_ce(INIT_FUNC_ARGS_PASSTHRU);
+ php_phongo_bulkwriteexception_init_ce(INIT_FUNC_ARGS_PASSTHRU);
+ php_phongo_commandexception_init_ce(INIT_FUNC_ARGS_PASSTHRU);
+ php_phongo_connectiontimeoutexception_init_ce(INIT_FUNC_ARGS_PASSTHRU);
+ php_phongo_encryptionexception_init_ce(INIT_FUNC_ARGS_PASSTHRU);
+ php_phongo_executiontimeoutexception_init_ce(INIT_FUNC_ARGS_PASSTHRU);
+ php_phongo_invalidargumentexception_init_ce(INIT_FUNC_ARGS_PASSTHRU);
+ php_phongo_logicexception_init_ce(INIT_FUNC_ARGS_PASSTHRU);
+ php_phongo_sslconnectionexception_init_ce(INIT_FUNC_ARGS_PASSTHRU);
+ php_phongo_unexpectedvalueexception_init_ce(INIT_FUNC_ARGS_PASSTHRU);
+
+ /* Register base APM classes first */
+ php_phongo_subscriber_init_ce(INIT_FUNC_ARGS_PASSTHRU);
+ php_phongo_commandsubscriber_init_ce(INIT_FUNC_ARGS_PASSTHRU);
+ php_phongo_commandfailedevent_init_ce(INIT_FUNC_ARGS_PASSTHRU);
+ php_phongo_commandstartedevent_init_ce(INIT_FUNC_ARGS_PASSTHRU);
+ php_phongo_commandsucceededevent_init_ce(INIT_FUNC_ARGS_PASSTHRU);
+
+ 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)
+{
+ HashTable* pclients = &MONGODB_G(pclients);
+ zval* z_ptr;
+ (void) type; /* We don't care if we are loaded via dl() or extension= */
+
+ /* Destroy mongoc_client_t objects in reverse order. This is necessary to
+ * prevent segmentation faults as clients may reference other clients in
+ * encryption settings. */
+ ZEND_HASH_REVERSE_FOREACH_VAL(pclients, z_ptr)
+ {
+ if ((Z_TYPE_P(z_ptr) != IS_PTR)) {
+ continue;
+ }
+
+ php_phongo_pclient_destroy((php_phongo_pclient_t*) Z_PTR_P(z_ptr));
+ }
+ ZEND_HASH_FOREACH_END();
+
+ /* Destroy HashTable for persistent clients. mongoc_client_t objects have been destroyed earlier. */
+ zend_hash_destroy(&MONGODB_G(pclients));
+
+ bson_mem_restore_vtable();
+ /* Cleanup after libmongoc */
+ mongoc_cleanup();
+
+ UNREGISTER_INI_ENTRIES();
+
+ return SUCCESS;
+}
+/* }}} */
+
+/* {{{ PHP_RSHUTDOWN_FUNCTION */
+PHP_RSHUTDOWN_FUNCTION(mongodb)
+{
+ /* Destroy HashTable for APM subscribers, which was initialized in RINIT */
+ if (MONGODB_G(subscribers)) {
+ zend_hash_destroy(MONGODB_G(subscribers));
+ FREE_HASHTABLE(MONGODB_G(subscribers));
+ MONGODB_G(subscribers) = NULL;
+ }
+
+ 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", 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 /* MONGOC_ENABLE_SSL */
+ 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 /* MONGOC_ENABLE_CRYPTO */
+ 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
+
+#ifdef MONGOC_ENABLE_ICU
+ php_info_print_table_row(2, "libmongoc ICU", "enabled");
+#else
+ php_info_print_table_row(2, "libmongoc ICU", "disabled");
+#endif
+
+#ifdef MONGOC_ENABLE_COMPRESSION
+ php_info_print_table_row(2, "libmongoc compression", "enabled");
+#ifdef MONGOC_ENABLE_COMPRESSION_SNAPPY
+ php_info_print_table_row(2, "libmongoc compression snappy", "enabled");
+#else
+ php_info_print_table_row(2, "libmongoc compression snappy", "disabled");
+#endif
+#ifdef MONGOC_ENABLE_COMPRESSION_ZLIB
+ php_info_print_table_row(2, "libmongoc compression zlib", "enabled");
+#else
+ php_info_print_table_row(2, "libmongoc compression zlib", "disabled");
+#endif
+#ifdef MONGOC_ENABLE_COMPRESSION_ZSTD
+ php_info_print_table_row(2, "libmongoc compression zstd", "enabled");
+#else
+ php_info_print_table_row(2, "libmongoc compression zstd", "disabled");
+#endif
+#else /* MONGOC_ENABLE_COMPRESSION */
+ php_info_print_table_row(2, "libmongoc compression", "disabled");
+#endif
+
+#ifdef MONGOC_ENABLE_CLIENT_SIDE_ENCRYPTION
+#ifdef HAVE_SYSTEM_LIBMONGOCRYPT
+ php_info_print_table_row(2, "libmongocrypt headers version", MONGOCRYPT_VERSION);
+ php_info_print_table_row(2, "libmongocrypt library version", mongocrypt_version(NULL));
+#else
+ php_info_print_table_row(2, "libmongocrypt bundled version", MONGOCRYPT_VERSION);
+#endif
+
+#ifdef MONGOCRYPT_ENABLE_CRYPTO
+ php_info_print_table_row(2, "libmongocrypt crypto", "enabled");
+
+#if defined(MONGOCRYPT_ENABLE_CRYPTO_LIBCRYPTO)
+ php_info_print_table_row(2, "libmongocrypt crypto library", "libcrypto");
+#elif defined(MONGOCRYPT_ENABLE_CRYPTO_COMMON_CRYPTO)
+ php_info_print_table_row(2, "libmongocrypt crypto library", "Common Crypto");
+#elif defined(MONGOCRYPT_ENABLE_CRYPTO_CNG)
+ php_info_print_table_row(2, "libmongocrypt crypto library", "CNG");
+#else
+ php_info_print_table_row(2, "libmongocrypt crypto library", "unknown");
+#endif
+#else /* MONGOCRYPT_ENABLE_CRYPTO */
+ php_info_print_table_row(2, "libmongocrypt crypto", "disabled");
+#endif
+#else /* MONGOC_ENABLE_CLIENT_SIDE_ENCRYPTION */
+ php_info_print_table_row(2, "libmongocrypt", "disabled");
+#endif
+
+ php_info_print_table_end();
+
+ DISPLAY_INI_ENTRIES();
+}
+/* }}} */
+/* }}} */
+
+/* {{{ Shared function entries for disabling constructors and unserialize() */
+PHP_FUNCTION(MongoDB_disabled___construct) /* {{{ */
+{
+ phongo_throw_exception(PHONGO_ERROR_RUNTIME, "Accessing private constructor");
+} /* }}} */
+
+PHP_FUNCTION(MongoDB_disabled___wakeup) /* {{{ */
+{
+ zend_error_handling error_handling;
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters_none() == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ phongo_throw_exception(PHONGO_ERROR_RUNTIME, "%s", "MongoDB\\Driver objects cannot be serialized");
+} /* }}} */
+ /* }}} */
+
+/* {{{ 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_ARG_ARRAY_INFO(0, typemap, 0)
+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();
+
+ZEND_BEGIN_ARG_INFO_EX(ai_mongodb_driver_monitoring_subscriber, 0, 0, 1)
+ ZEND_ARG_OBJ_INFO(0, subscriber, MongoDB\\Driver\\Monitoring\\Subscriber, 0)
+ZEND_END_ARG_INFO();
+
+static const zend_function_entry mongodb_functions[] = {
+ ZEND_NS_NAMED_FE("MongoDB\\BSON", fromPHP, PHP_FN(MongoDB_BSON_fromPHP), ai_bson_fromPHP)
+ ZEND_NS_NAMED_FE("MongoDB\\BSON", toPHP, PHP_FN(MongoDB_BSON_toPHP), ai_bson_toPHP)
+ ZEND_NS_NAMED_FE("MongoDB\\BSON", toJSON, PHP_FN(MongoDB_BSON_toJSON), ai_bson_toJSON)
+ ZEND_NS_NAMED_FE("MongoDB\\BSON", toCanonicalExtendedJSON, PHP_FN(MongoDB_BSON_toCanonicalExtendedJSON), ai_bson_toJSON)
+ ZEND_NS_NAMED_FE("MongoDB\\BSON", toRelaxedExtendedJSON, PHP_FN(MongoDB_BSON_toRelaxedExtendedJSON), ai_bson_toJSON)
+ ZEND_NS_NAMED_FE("MongoDB\\BSON", fromJSON, PHP_FN(MongoDB_BSON_fromJSON), ai_bson_fromJSON)
+ ZEND_NS_NAMED_FE("MongoDB\\Driver\\Monitoring", addSubscriber, PHP_FN(MongoDB_Driver_Monitoring_addSubscriber), ai_mongodb_driver_monitoring_subscriber)
+ ZEND_NS_NAMED_FE("MongoDB\\Driver\\Monitoring", removeSubscriber, PHP_FN(MongoDB_Driver_Monitoring_removeSubscriber), ai_mongodb_driver_monitoring_subscriber)
+ 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),
+ PHP_RINIT(mongodb),
+ PHP_RSHUTDOWN(mongodb),
+ PHP_MINFO(mongodb),
+ 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.8.1/php_phongo.h b/mongodb-1.9.0/php_phongo.h
similarity index 100%
rename from mongodb-1.8.1/php_phongo.h
rename to mongodb-1.9.0/php_phongo.h
diff --git a/mongodb-1.9.0/php_phongo_classes.h b/mongodb-1.9.0/php_phongo_classes.h
new file mode 100644
index 00000000..ee8b3cef
--- /dev/null
+++ b/mongodb-1.9.0/php_phongo_classes.h
@@ -0,0 +1,364 @@
+/*
+ * 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_CLASSES_H
+#define PHONGO_CLASSES_H
+
+#include "php_phongo_structs.h"
+
+/* Export zend_class_entry dependencies, which are initialized in MINIT */
+extern zend_class_entry* php_phongo_date_immutable_ce;
+extern zend_class_entry* php_phongo_json_serializable_ce;
+
+static inline php_phongo_bulkwrite_t* php_bulkwrite_fetch_object(zend_object* obj)
+{
+ return (php_phongo_bulkwrite_t*) ((char*) obj - XtOffsetOf(php_phongo_bulkwrite_t, std));
+}
+static inline php_phongo_clientencryption_t* php_clientencryption_fetch_object(zend_object* obj)
+{
+ return (php_phongo_clientencryption_t*) ((char*) obj - XtOffsetOf(php_phongo_clientencryption_t, std));
+}
+static inline php_phongo_command_t* php_command_fetch_object(zend_object* obj)
+{
+ return (php_phongo_command_t*) ((char*) obj - XtOffsetOf(php_phongo_command_t, std));
+}
+static inline php_phongo_cursor_t* php_cursor_fetch_object(zend_object* obj)
+{
+ return (php_phongo_cursor_t*) ((char*) obj - XtOffsetOf(php_phongo_cursor_t, std));
+}
+static inline php_phongo_cursorid_t* php_cursorid_fetch_object(zend_object* obj)
+{
+ return (php_phongo_cursorid_t*) ((char*) obj - XtOffsetOf(php_phongo_cursorid_t, std));
+}
+static inline php_phongo_manager_t* php_manager_fetch_object(zend_object* obj)
+{
+ return (php_phongo_manager_t*) ((char*) obj - XtOffsetOf(php_phongo_manager_t, std));
+}
+static inline php_phongo_query_t* php_query_fetch_object(zend_object* obj)
+{
+ return (php_phongo_query_t*) ((char*) obj - XtOffsetOf(php_phongo_query_t, std));
+}
+static inline php_phongo_readconcern_t* php_readconcern_fetch_object(zend_object* obj)
+{
+ return (php_phongo_readconcern_t*) ((char*) obj - XtOffsetOf(php_phongo_readconcern_t, std));
+}
+static inline php_phongo_readpreference_t* php_readpreference_fetch_object(zend_object* obj)
+{
+ return (php_phongo_readpreference_t*) ((char*) obj - XtOffsetOf(php_phongo_readpreference_t, std));
+}
+static inline php_phongo_server_t* php_server_fetch_object(zend_object* obj)
+{
+ return (php_phongo_server_t*) ((char*) obj - XtOffsetOf(php_phongo_server_t, std));
+}
+static inline php_phongo_session_t* php_session_fetch_object(zend_object* obj)
+{
+ return (php_phongo_session_t*) ((char*) obj - XtOffsetOf(php_phongo_session_t, std));
+}
+static inline php_phongo_writeconcern_t* php_writeconcern_fetch_object(zend_object* obj)
+{
+ return (php_phongo_writeconcern_t*) ((char*) obj - XtOffsetOf(php_phongo_writeconcern_t, std));
+}
+static inline php_phongo_writeconcernerror_t* php_writeconcernerror_fetch_object(zend_object* obj)
+{
+ return (php_phongo_writeconcernerror_t*) ((char*) obj - XtOffsetOf(php_phongo_writeconcernerror_t, std));
+}
+static inline php_phongo_writeerror_t* php_writeerror_fetch_object(zend_object* obj)
+{
+ return (php_phongo_writeerror_t*) ((char*) obj - XtOffsetOf(php_phongo_writeerror_t, std));
+}
+static inline php_phongo_writeresult_t* php_writeresult_fetch_object(zend_object* obj)
+{
+ return (php_phongo_writeresult_t*) ((char*) obj - XtOffsetOf(php_phongo_writeresult_t, std));
+}
+static inline php_phongo_binary_t* php_binary_fetch_object(zend_object* obj)
+{
+ return (php_phongo_binary_t*) ((char*) obj - XtOffsetOf(php_phongo_binary_t, std));
+}
+static inline php_phongo_dbpointer_t* php_dbpointer_fetch_object(zend_object* obj)
+{
+ return (php_phongo_dbpointer_t*) ((char*) obj - XtOffsetOf(php_phongo_dbpointer_t, std));
+}
+static inline php_phongo_decimal128_t* php_decimal128_fetch_object(zend_object* obj)
+{
+ return (php_phongo_decimal128_t*) ((char*) obj - XtOffsetOf(php_phongo_decimal128_t, std));
+}
+static inline php_phongo_int64_t* php_int64_fetch_object(zend_object* obj)
+{
+ return (php_phongo_int64_t*) ((char*) obj - XtOffsetOf(php_phongo_int64_t, std));
+}
+static inline php_phongo_javascript_t* php_javascript_fetch_object(zend_object* obj)
+{
+ return (php_phongo_javascript_t*) ((char*) obj - XtOffsetOf(php_phongo_javascript_t, std));
+}
+static inline php_phongo_maxkey_t* php_maxkey_fetch_object(zend_object* obj)
+{
+ return (php_phongo_maxkey_t*) ((char*) obj - XtOffsetOf(php_phongo_maxkey_t, std));
+}
+static inline php_phongo_minkey_t* php_minkey_fetch_object(zend_object* obj)
+{
+ return (php_phongo_minkey_t*) ((char*) obj - XtOffsetOf(php_phongo_minkey_t, std));
+}
+static inline php_phongo_objectid_t* php_objectid_fetch_object(zend_object* obj)
+{
+ return (php_phongo_objectid_t*) ((char*) obj - XtOffsetOf(php_phongo_objectid_t, std));
+}
+static inline php_phongo_regex_t* php_regex_fetch_object(zend_object* obj)
+{
+ return (php_phongo_regex_t*) ((char*) obj - XtOffsetOf(php_phongo_regex_t, std));
+}
+static inline php_phongo_symbol_t* php_symbol_fetch_object(zend_object* obj)
+{
+ return (php_phongo_symbol_t*) ((char*) obj - XtOffsetOf(php_phongo_symbol_t, std));
+}
+static inline php_phongo_timestamp_t* php_timestamp_fetch_object(zend_object* obj)
+{
+ return (php_phongo_timestamp_t*) ((char*) obj - XtOffsetOf(php_phongo_timestamp_t, std));
+}
+static inline php_phongo_undefined_t* php_undefined_fetch_object(zend_object* obj)
+{
+ return (php_phongo_undefined_t*) ((char*) obj - XtOffsetOf(php_phongo_undefined_t, std));
+}
+static inline php_phongo_utcdatetime_t* php_utcdatetime_fetch_object(zend_object* obj)
+{
+ return (php_phongo_utcdatetime_t*) ((char*) obj - XtOffsetOf(php_phongo_utcdatetime_t, std));
+}
+static inline php_phongo_commandfailedevent_t* php_commandfailedevent_fetch_object(zend_object* obj)
+{
+ return (php_phongo_commandfailedevent_t*) ((char*) obj - XtOffsetOf(php_phongo_commandfailedevent_t, std));
+}
+static inline php_phongo_commandstartedevent_t* php_commandstartedevent_fetch_object(zend_object* obj)
+{
+ return (php_phongo_commandstartedevent_t*) ((char*) obj - XtOffsetOf(php_phongo_commandstartedevent_t, std));
+}
+static inline php_phongo_commandsucceededevent_t* php_commandsucceededevent_fetch_object(zend_object* obj)
+{
+ return (php_phongo_commandsucceededevent_t*) ((char*) obj - XtOffsetOf(php_phongo_commandsucceededevent_t, std));
+}
+
+#define Z_CLIENTENCRYPTION_OBJ_P(zv) (php_clientencryption_fetch_object(Z_OBJ_P(zv)))
+#define Z_COMMAND_OBJ_P(zv) (php_command_fetch_object(Z_OBJ_P(zv)))
+#define Z_CURSOR_OBJ_P(zv) (php_cursor_fetch_object(Z_OBJ_P(zv)))
+#define Z_CURSORID_OBJ_P(zv) (php_cursorid_fetch_object(Z_OBJ_P(zv)))
+#define Z_MANAGER_OBJ_P(zv) (php_manager_fetch_object(Z_OBJ_P(zv)))
+#define Z_QUERY_OBJ_P(zv) (php_query_fetch_object(Z_OBJ_P(zv)))
+#define Z_READCONCERN_OBJ_P(zv) (php_readconcern_fetch_object(Z_OBJ_P(zv)))
+#define Z_READPREFERENCE_OBJ_P(zv) (php_readpreference_fetch_object(Z_OBJ_P(zv)))
+#define Z_SERVER_OBJ_P(zv) (php_server_fetch_object(Z_OBJ_P(zv)))
+#define Z_SESSION_OBJ_P(zv) (php_session_fetch_object(Z_OBJ_P(zv)))
+#define Z_BULKWRITE_OBJ_P(zv) (php_bulkwrite_fetch_object(Z_OBJ_P(zv)))
+#define Z_WRITECONCERN_OBJ_P(zv) (php_writeconcern_fetch_object(Z_OBJ_P(zv)))
+#define Z_WRITECONCERNERROR_OBJ_P(zv) (php_writeconcernerror_fetch_object(Z_OBJ_P(zv)))
+#define Z_WRITEERROR_OBJ_P(zv) (php_writeerror_fetch_object(Z_OBJ_P(zv)))
+#define Z_WRITERESULT_OBJ_P(zv) (php_writeresult_fetch_object(Z_OBJ_P(zv)))
+#define Z_BINARY_OBJ_P(zv) (php_binary_fetch_object(Z_OBJ_P(zv)))
+#define Z_DBPOINTER_OBJ_P(zv) (php_dbpointer_fetch_object(Z_OBJ_P(zv)))
+#define Z_DECIMAL128_OBJ_P(zv) (php_decimal128_fetch_object(Z_OBJ_P(zv)))
+#define Z_INT64_OBJ_P(zv) (php_int64_fetch_object(Z_OBJ_P(zv)))
+#define Z_JAVASCRIPT_OBJ_P(zv) (php_javascript_fetch_object(Z_OBJ_P(zv)))
+#define Z_MAXKEY_OBJ_P(zv) (php_maxkey_fetch_object(Z_OBJ_P(zv)))
+#define Z_MINKEY_OBJ_P(zv) (php_minkey_fetch_object(Z_OBJ_P(zv)))
+#define Z_OBJECTID_OBJ_P(zv) (php_objectid_fetch_object(Z_OBJ_P(zv)))
+#define Z_REGEX_OBJ_P(zv) (php_regex_fetch_object(Z_OBJ_P(zv)))
+#define Z_SYMBOL_OBJ_P(zv) (php_symbol_fetch_object(Z_OBJ_P(zv)))
+#define Z_TIMESTAMP_OBJ_P(zv) (php_timestamp_fetch_object(Z_OBJ_P(zv)))
+#define Z_UNDEFINED_OBJ_P(zv) (php_undefined_fetch_object(Z_OBJ_P(zv)))
+#define Z_UTCDATETIME_OBJ_P(zv) (php_utcdatetime_fetch_object(Z_OBJ_P(zv)))
+#define Z_COMMANDFAILEDEVENT_OBJ_P(zv) (php_commandfailedevent_fetch_object(Z_OBJ_P(zv)))
+#define Z_COMMANDSTARTEDEVENT_OBJ_P(zv) (php_commandstartedevent_fetch_object(Z_OBJ_P(zv)))
+#define Z_COMMANDSUCCEEDEDEVENT_OBJ_P(zv) (php_commandsucceededevent_fetch_object(Z_OBJ_P(zv)))
+
+#define Z_OBJ_CLIENTENCRYPTION(zo) (php_clientencryption_fetch_object(zo))
+#define Z_OBJ_COMMAND(zo) (php_command_fetch_object(zo))
+#define Z_OBJ_CURSOR(zo) (php_cursor_fetch_object(zo))
+#define Z_OBJ_CURSORID(zo) (php_cursorid_fetch_object(zo))
+#define Z_OBJ_MANAGER(zo) (php_manager_fetch_object(zo))
+#define Z_OBJ_QUERY(zo) (php_query_fetch_object(zo))
+#define Z_OBJ_READCONCERN(zo) (php_readconcern_fetch_object(zo))
+#define Z_OBJ_READPREFERENCE(zo) (php_readpreference_fetch_object(zo))
+#define Z_OBJ_SERVER(zo) (php_server_fetch_object(zo))
+#define Z_OBJ_SESSION(zo) (php_session_fetch_object(zo))
+#define Z_OBJ_BULKWRITE(zo) (php_bulkwrite_fetch_object(zo))
+#define Z_OBJ_WRITECONCERN(zo) (php_writeconcern_fetch_object(zo))
+#define Z_OBJ_WRITECONCERNERROR(zo) (php_writeconcernerror_fetch_object(zo))
+#define Z_OBJ_WRITEERROR(zo) (php_writeerror_fetch_object(zo))
+#define Z_OBJ_WRITERESULT(zo) (php_writeresult_fetch_object(zo))
+#define Z_OBJ_BINARY(zo) (php_binary_fetch_object(zo))
+#define Z_OBJ_DBPOINTER(zo) (php_dbpointer_fetch_object(zo))
+#define Z_OBJ_DECIMAL128(zo) (php_decimal128_fetch_object(zo))
+#define Z_OBJ_INT64(zo) (php_int64_fetch_object(zo))
+#define Z_OBJ_JAVASCRIPT(zo) (php_javascript_fetch_object(zo))
+#define Z_OBJ_MAXKEY(zo) (php_maxkey_fetch_object(zo))
+#define Z_OBJ_MINKEY(zo) (php_minkey_fetch_object(zo))
+#define Z_OBJ_OBJECTID(zo) (php_objectid_fetch_object(zo))
+#define Z_OBJ_REGEX(zo) (php_regex_fetch_object(zo))
+#define Z_OBJ_SYMBOL(zo) (php_symbol_fetch_object(zo))
+#define Z_OBJ_TIMESTAMP(zo) (php_timestamp_fetch_object(zo))
+#define Z_OBJ_UNDEFINED(zo) (php_undefined_fetch_object(zo))
+#define Z_OBJ_UTCDATETIME(zo) (php_utcdatetime_fetch_object(zo))
+#define Z_OBJ_COMMANDFAILEDEVENT(zo) (php_commandfailedevent_fetch_object(zo))
+#define Z_OBJ_COMMANDSTARTEDEVENT(zo) (php_commandstartedevent_fetch_object(zo))
+#define Z_OBJ_COMMANDSUCCEEDEDEVENT(zo) (php_commandsucceededevent_fetch_object(zo))
+
+extern zend_class_entry* php_phongo_clientencryption_ce;
+extern zend_class_entry* php_phongo_command_ce;
+extern zend_class_entry* php_phongo_cursor_ce;
+extern zend_class_entry* php_phongo_cursorid_ce;
+extern zend_class_entry* php_phongo_manager_ce;
+extern zend_class_entry* php_phongo_query_ce;
+extern zend_class_entry* php_phongo_readconcern_ce;
+extern zend_class_entry* php_phongo_readpreference_ce;
+extern zend_class_entry* php_phongo_server_ce;
+extern zend_class_entry* php_phongo_session_ce;
+extern zend_class_entry* php_phongo_bulkwrite_ce;
+extern zend_class_entry* php_phongo_writeconcern_ce;
+extern zend_class_entry* php_phongo_writeconcernerror_ce;
+extern zend_class_entry* php_phongo_writeerror_ce;
+extern zend_class_entry* php_phongo_writeresult_ce;
+
+extern zend_class_entry* php_phongo_cursor_interface_ce;
+
+extern zend_class_entry* php_phongo_exception_ce;
+extern zend_class_entry* php_phongo_logicexception_ce;
+extern zend_class_entry* php_phongo_runtimeexception_ce;
+extern zend_class_entry* php_phongo_serverexception_ce;
+extern zend_class_entry* php_phongo_commandexception_ce;
+extern zend_class_entry* php_phongo_unexpectedvalueexception_ce;
+extern zend_class_entry* php_phongo_invalidargumentexception_ce;
+extern zend_class_entry* php_phongo_connectionexception_ce;
+extern zend_class_entry* php_phongo_authenticationexception_ce;
+extern zend_class_entry* php_phongo_sslconnectionexception_ce;
+extern zend_class_entry* php_phongo_encryptionexception_ce;
+extern zend_class_entry* php_phongo_executiontimeoutexception_ce;
+extern zend_class_entry* php_phongo_connectiontimeoutexception_ce;
+extern zend_class_entry* php_phongo_writeexception_ce;
+extern zend_class_entry* php_phongo_bulkwriteexception_ce;
+
+extern zend_class_entry* php_phongo_type_ce;
+extern zend_class_entry* php_phongo_persistable_ce;
+extern zend_class_entry* php_phongo_unserializable_ce;
+extern zend_class_entry* php_phongo_serializable_ce;
+extern zend_class_entry* php_phongo_binary_ce;
+extern zend_class_entry* php_phongo_dbpointer_ce;
+extern zend_class_entry* php_phongo_decimal128_ce;
+extern zend_class_entry* php_phongo_int64_ce;
+extern zend_class_entry* php_phongo_javascript_ce;
+extern zend_class_entry* php_phongo_maxkey_ce;
+extern zend_class_entry* php_phongo_minkey_ce;
+extern zend_class_entry* php_phongo_objectid_ce;
+extern zend_class_entry* php_phongo_regex_ce;
+extern zend_class_entry* php_phongo_symbol_ce;
+extern zend_class_entry* php_phongo_timestamp_ce;
+extern zend_class_entry* php_phongo_undefined_ce;
+extern zend_class_entry* php_phongo_utcdatetime_ce;
+
+extern zend_class_entry* php_phongo_binary_interface_ce;
+extern zend_class_entry* php_phongo_decimal128_interface_ce;
+extern zend_class_entry* php_phongo_javascript_interface_ce;
+extern zend_class_entry* php_phongo_maxkey_interface_ce;
+extern zend_class_entry* php_phongo_minkey_interface_ce;
+extern zend_class_entry* php_phongo_objectid_interface_ce;
+extern zend_class_entry* php_phongo_regex_interface_ce;
+extern zend_class_entry* php_phongo_timestamp_interface_ce;
+extern zend_class_entry* php_phongo_utcdatetime_interface_ce;
+
+extern zend_class_entry* php_phongo_commandfailedevent_ce;
+extern zend_class_entry* php_phongo_commandstartedevent_ce;
+extern zend_class_entry* php_phongo_commandsubscriber_ce;
+extern zend_class_entry* php_phongo_commandsucceededevent_ce;
+extern zend_class_entry* php_phongo_subscriber_ce;
+
+extern void php_phongo_binary_init_ce(INIT_FUNC_ARGS);
+extern void php_phongo_dbpointer_init_ce(INIT_FUNC_ARGS);
+extern void php_phongo_decimal128_init_ce(INIT_FUNC_ARGS);
+extern void php_phongo_int64_init_ce(INIT_FUNC_ARGS);
+extern void php_phongo_javascript_init_ce(INIT_FUNC_ARGS);
+extern void php_phongo_maxkey_init_ce(INIT_FUNC_ARGS);
+extern void php_phongo_minkey_init_ce(INIT_FUNC_ARGS);
+extern void php_phongo_objectid_init_ce(INIT_FUNC_ARGS);
+extern void php_phongo_persistable_init_ce(INIT_FUNC_ARGS);
+extern void php_phongo_regex_init_ce(INIT_FUNC_ARGS);
+extern void php_phongo_serializable_init_ce(INIT_FUNC_ARGS);
+extern void php_phongo_symbol_init_ce(INIT_FUNC_ARGS);
+extern void php_phongo_timestamp_init_ce(INIT_FUNC_ARGS);
+extern void php_phongo_type_init_ce(INIT_FUNC_ARGS);
+extern void php_phongo_undefined_init_ce(INIT_FUNC_ARGS);
+extern void php_phongo_unserializable_init_ce(INIT_FUNC_ARGS);
+extern void php_phongo_utcdatetime_init_ce(INIT_FUNC_ARGS);
+
+extern void php_phongo_binary_interface_init_ce(INIT_FUNC_ARGS);
+extern void php_phongo_decimal128_interface_init_ce(INIT_FUNC_ARGS);
+extern void php_phongo_javascript_interface_init_ce(INIT_FUNC_ARGS);
+extern void php_phongo_maxkey_interface_init_ce(INIT_FUNC_ARGS);
+extern void php_phongo_minkey_interface_init_ce(INIT_FUNC_ARGS);
+extern void php_phongo_objectid_interface_init_ce(INIT_FUNC_ARGS);
+extern void php_phongo_regex_interface_init_ce(INIT_FUNC_ARGS);
+extern void php_phongo_timestamp_interface_init_ce(INIT_FUNC_ARGS);
+extern void php_phongo_utcdatetime_interface_init_ce(INIT_FUNC_ARGS);
+
+extern void php_phongo_bulkwrite_init_ce(INIT_FUNC_ARGS);
+extern void php_phongo_clientencryption_init_ce(INIT_FUNC_ARGS);
+extern void php_phongo_command_init_ce(INIT_FUNC_ARGS);
+extern void php_phongo_cursor_init_ce(INIT_FUNC_ARGS);
+extern void php_phongo_cursorid_init_ce(INIT_FUNC_ARGS);
+extern void php_phongo_manager_init_ce(INIT_FUNC_ARGS);
+extern void php_phongo_query_init_ce(INIT_FUNC_ARGS);
+extern void php_phongo_readconcern_init_ce(INIT_FUNC_ARGS);
+extern void php_phongo_readpreference_init_ce(INIT_FUNC_ARGS);
+extern void php_phongo_server_init_ce(INIT_FUNC_ARGS);
+extern void php_phongo_session_init_ce(INIT_FUNC_ARGS);
+extern void php_phongo_writeconcern_init_ce(INIT_FUNC_ARGS);
+extern void php_phongo_writeconcernerror_init_ce(INIT_FUNC_ARGS);
+extern void php_phongo_writeerror_init_ce(INIT_FUNC_ARGS);
+extern void php_phongo_writeresult_init_ce(INIT_FUNC_ARGS);
+
+extern void php_phongo_cursor_interface_init_ce(INIT_FUNC_ARGS);
+
+extern void php_phongo_authenticationexception_init_ce(INIT_FUNC_ARGS);
+extern void php_phongo_bulkwriteexception_init_ce(INIT_FUNC_ARGS);
+extern void php_phongo_commandexception_init_ce(INIT_FUNC_ARGS);
+extern void php_phongo_connectionexception_init_ce(INIT_FUNC_ARGS);
+extern void php_phongo_connectiontimeoutexception_init_ce(INIT_FUNC_ARGS);
+extern void php_phongo_encryptionexception_init_ce(INIT_FUNC_ARGS);
+extern void php_phongo_exception_init_ce(INIT_FUNC_ARGS);
+extern void php_phongo_executiontimeoutexception_init_ce(INIT_FUNC_ARGS);
+extern void php_phongo_invalidargumentexception_init_ce(INIT_FUNC_ARGS);
+extern void php_phongo_logicexception_init_ce(INIT_FUNC_ARGS);
+extern void php_phongo_runtimeexception_init_ce(INIT_FUNC_ARGS);
+extern void php_phongo_serverexception_init_ce(INIT_FUNC_ARGS);
+extern void php_phongo_sslconnectionexception_init_ce(INIT_FUNC_ARGS);
+extern void php_phongo_unexpectedvalueexception_init_ce(INIT_FUNC_ARGS);
+extern void php_phongo_writeexception_init_ce(INIT_FUNC_ARGS);
+
+extern void php_phongo_commandfailedevent_init_ce(INIT_FUNC_ARGS);
+extern void php_phongo_commandstartedevent_init_ce(INIT_FUNC_ARGS);
+extern void php_phongo_commandsubscriber_init_ce(INIT_FUNC_ARGS);
+extern void php_phongo_commandsucceededevent_init_ce(INIT_FUNC_ARGS);
+extern void php_phongo_subscriber_init_ce(INIT_FUNC_ARGS);
+
+/* Shared function entries for disabling constructors and unserialize() */
+PHP_FUNCTION(MongoDB_disabled___construct);
+PHP_FUNCTION(MongoDB_disabled___wakeup);
+
+#endif /* PHONGO_CLASSES_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.9.0/php_phongo_structs.h b/mongodb-1.9.0/php_phongo_structs.h
new file mode 100644
index 00000000..77604cc5
--- /dev/null
+++ b/mongodb-1.9.0/php_phongo_structs.h
@@ -0,0 +1,272 @@
+/*
+ * 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_STRUCTS_H
+#define PHONGO_STRUCTS_H
+
+#include <php.h>
+
+#include "php_bson.h"
+
+typedef struct {
+ mongoc_bulk_operation_t* bulk;
+ size_t num_ops;
+ bool ordered;
+ int bypass;
+ char* database;
+ char* collection;
+ bool executed;
+ zval session;
+ zend_object std;
+} php_phongo_bulkwrite_t;
+
+typedef struct {
+ mongoc_client_encryption_t* client_encryption;
+ zend_object std;
+} php_phongo_clientencryption_t;
+
+typedef struct {
+ bson_t* bson;
+ uint32_t max_await_time_ms;
+ uint32_t batch_size;
+ zend_object std;
+} php_phongo_command_t;
+
+typedef struct {
+ mongoc_cursor_t* cursor;
+ mongoc_client_t* client;
+ int created_by_pid;
+ uint32_t server_id;
+ bool advanced;
+ php_phongo_bson_state visitor_data;
+ long current;
+ char* database;
+ char* collection;
+ zval query;
+ zval command;
+ zval read_preference;
+ zval session;
+ zend_object std;
+} php_phongo_cursor_t;
+
+typedef struct {
+ int64_t id;
+ zend_object std;
+} php_phongo_cursorid_t;
+
+typedef struct {
+ mongoc_client_t* client;
+ int created_by_pid;
+ char* client_hash;
+ size_t client_hash_len;
+ zend_object std;
+} php_phongo_manager_t;
+
+typedef struct {
+ bson_t* filter;
+ bson_t* opts;
+ mongoc_read_concern_t* read_concern;
+ uint32_t max_await_time_ms;
+ zend_object std;
+} php_phongo_query_t;
+
+typedef struct {
+ mongoc_read_concern_t* read_concern;
+ HashTable* properties;
+ zend_object std;
+} php_phongo_readconcern_t;
+
+typedef struct {
+ mongoc_read_prefs_t* read_preference;
+ HashTable* properties;
+ zend_object std;
+} php_phongo_readpreference_t;
+
+typedef struct {
+ mongoc_client_t* client;
+ int created_by_pid;
+ uint32_t server_id;
+ zend_object std;
+} php_phongo_server_t;
+
+typedef struct {
+ mongoc_client_session_t* client_session;
+ mongoc_client_t* client;
+ int created_by_pid;
+ zend_object std;
+} php_phongo_session_t;
+
+typedef struct {
+ HashTable* properties;
+ mongoc_write_concern_t* write_concern;
+ zend_object std;
+} php_phongo_writeconcern_t;
+
+typedef struct {
+ int code;
+ char* message;
+ zval info;
+ zend_object std;
+} php_phongo_writeconcernerror_t;
+
+typedef struct {
+ int code;
+ char* message;
+ zval info;
+ uint32_t index;
+ zend_object std;
+} php_phongo_writeerror_t;
+
+typedef struct {
+ mongoc_write_concern_t* write_concern;
+ bson_t* reply;
+ mongoc_client_t* client;
+ uint32_t server_id;
+ zend_object std;
+} php_phongo_writeresult_t;
+
+typedef struct {
+ char* data;
+ int data_len;
+ uint8_t type;
+ HashTable* properties;
+ zend_object std;
+} php_phongo_binary_t;
+
+typedef struct {
+ char* ref;
+ size_t ref_len;
+ char id[25];
+ HashTable* properties;
+ zend_object std;
+} php_phongo_dbpointer_t;
+
+typedef struct {
+ bool initialized;
+ bson_decimal128_t decimal;
+ HashTable* properties;
+ zend_object std;
+} php_phongo_decimal128_t;
+
+typedef struct {
+ bool initialized;
+ int64_t integer;
+ HashTable* properties;
+ zend_object std;
+} php_phongo_int64_t;
+
+typedef struct {
+ char* code;
+ size_t code_len;
+ bson_t* scope;
+ HashTable* properties;
+ zend_object std;
+} php_phongo_javascript_t;
+
+typedef struct {
+ zend_object std;
+} php_phongo_maxkey_t;
+
+typedef struct {
+ zend_object std;
+} php_phongo_minkey_t;
+
+typedef struct {
+ bool initialized;
+ char oid[25];
+ HashTable* properties;
+ zend_object std;
+} php_phongo_objectid_t;
+
+typedef struct {
+ char* pattern;
+ int pattern_len;
+ char* flags;
+ int flags_len;
+ HashTable* properties;
+ zend_object std;
+} php_phongo_regex_t;
+
+typedef struct {
+ char* symbol;
+ size_t symbol_len;
+ HashTable* properties;
+ zend_object std;
+} php_phongo_symbol_t;
+
+typedef struct {
+ bool initialized;
+ uint32_t increment;
+ uint32_t timestamp;
+ HashTable* properties;
+ zend_object std;
+} php_phongo_timestamp_t;
+
+typedef struct {
+ zend_object std;
+} php_phongo_undefined_t;
+
+typedef struct {
+ bool initialized;
+ int64_t milliseconds;
+ HashTable* properties;
+ zend_object std;
+} php_phongo_utcdatetime_t;
+
+typedef struct {
+ mongoc_client_t* client;
+ char* command_name;
+ uint32_t server_id;
+ uint64_t operation_id;
+ uint64_t request_id;
+ uint64_t duration_micros;
+ bson_t* reply;
+ zval z_error;
+ zend_object std;
+} php_phongo_commandfailedevent_t;
+
+typedef struct {
+ mongoc_client_t* client;
+ char* command_name;
+ uint32_t server_id;
+ uint64_t operation_id;
+ uint64_t request_id;
+ bson_t* command;
+ char* database_name;
+ zend_object std;
+} php_phongo_commandstartedevent_t;
+
+typedef struct {
+ mongoc_client_t* client;
+ char* command_name;
+ uint32_t server_id;
+ uint64_t operation_id;
+ uint64_t request_id;
+ uint64_t duration_micros;
+ bson_t* reply;
+ zend_object std;
+} php_phongo_commandsucceededevent_t;
+
+#endif /* PHONGO_STRUCTS */
+
+/*
+ * 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.8.1/scripts/autotools/CheckCompiler.m4 b/mongodb-1.9.0/scripts/autotools/CheckCompiler.m4
similarity index 100%
rename from mongodb-1.8.1/scripts/autotools/CheckCompiler.m4
rename to mongodb-1.9.0/scripts/autotools/CheckCompiler.m4
diff --git a/mongodb-1.9.0/scripts/autotools/CheckHost.m4 b/mongodb-1.9.0/scripts/autotools/CheckHost.m4
new file mode 100644
index 00000000..e33ebce1
--- /dev/null
+++ b/mongodb-1.9.0/scripts/autotools/CheckHost.m4
@@ -0,0 +1,59 @@
+AC_CANONICAL_HOST
+
+os_win32=no
+os_netbsd=no
+os_freebsd=no
+os_openbsd=no
+os_hpux=no
+os_linux=no
+os_solaris=no
+os_darwin=no
+os_gnu=no
+os_aix=no
+
+case "$host" in
+ *-mingw*|*-*-cygwin*)
+ os_win32=yes
+ TARGET_OS=windows
+ ;;
+ *-*-*netbsd*)
+ os_netbsd=yes
+ TARGET_OS=unix
+ ;;
+ *-*-*freebsd*)
+ os_freebsd=yes
+ TARGET_OS=unix
+ ;;
+ *-*-*openbsd*)
+ os_openbsd=yes
+ TARGET_OS=unix
+ ;;
+ *-*-hpux*)
+ os_hpux=yes
+ TARGET_OS=unix
+ ;;
+ *-*-linux*)
+ os_linux=yes
+ os_gnu=yes
+ TARGET_OS=unix
+ ;;
+ *-*-solaris*)
+ os_solaris=yes
+ TARGET_OS=unix
+ ;;
+ *-*-darwin*)
+ os_darwin=yes
+ TARGET_OS=unix
+ ;;
+ *-*-aix*|*-*-os400*)
+ os_aix=yes
+ TARGET_OS=unix
+ ;;
+ gnu*|k*bsd*-gnu*)
+ os_gnu=yes
+ TARGET_OS=unix
+ ;;
+ *)
+ AC_MSG_WARN([*** Please add $host to configure.ac checks!])
+ ;;
+esac
diff --git a/mongodb-1.8.1/scripts/autotools/libbson/CheckAtomics.m4 b/mongodb-1.9.0/scripts/autotools/libbson/CheckAtomics.m4
similarity index 100%
rename from mongodb-1.8.1/scripts/autotools/libbson/CheckAtomics.m4
rename to mongodb-1.9.0/scripts/autotools/libbson/CheckAtomics.m4
diff --git a/mongodb-1.8.1/scripts/autotools/libbson/CheckHeaders.m4 b/mongodb-1.9.0/scripts/autotools/libbson/CheckHeaders.m4
similarity index 100%
rename from mongodb-1.8.1/scripts/autotools/libbson/CheckHeaders.m4
rename to mongodb-1.9.0/scripts/autotools/libbson/CheckHeaders.m4
diff --git a/mongodb-1.8.1/scripts/autotools/libbson/Endian.m4 b/mongodb-1.9.0/scripts/autotools/libbson/Endian.m4
similarity index 100%
rename from mongodb-1.8.1/scripts/autotools/libbson/Endian.m4
rename to mongodb-1.9.0/scripts/autotools/libbson/Endian.m4
diff --git a/mongodb-1.8.1/scripts/autotools/libbson/FindDependencies.m4 b/mongodb-1.9.0/scripts/autotools/libbson/FindDependencies.m4
similarity index 100%
rename from mongodb-1.8.1/scripts/autotools/libbson/FindDependencies.m4
rename to mongodb-1.9.0/scripts/autotools/libbson/FindDependencies.m4
diff --git a/mongodb-1.8.1/scripts/autotools/libbson/Versions.m4 b/mongodb-1.9.0/scripts/autotools/libbson/Versions.m4
similarity index 100%
rename from mongodb-1.8.1/scripts/autotools/libbson/Versions.m4
rename to mongodb-1.9.0/scripts/autotools/libbson/Versions.m4
diff --git a/mongodb-1.8.1/scripts/autotools/libmongoc/CheckCompression.m4 b/mongodb-1.9.0/scripts/autotools/libmongoc/CheckCompression.m4
similarity index 100%
rename from mongodb-1.8.1/scripts/autotools/libmongoc/CheckCompression.m4
rename to mongodb-1.9.0/scripts/autotools/libmongoc/CheckCompression.m4
diff --git a/mongodb-1.8.1/scripts/autotools/libmongoc/CheckICU.m4 b/mongodb-1.9.0/scripts/autotools/libmongoc/CheckICU.m4
similarity index 100%
rename from mongodb-1.8.1/scripts/autotools/libmongoc/CheckICU.m4
rename to mongodb-1.9.0/scripts/autotools/libmongoc/CheckICU.m4
diff --git a/mongodb-1.9.0/scripts/autotools/libmongoc/CheckResolv.m4 b/mongodb-1.9.0/scripts/autotools/libmongoc/CheckResolv.m4
new file mode 100644
index 00000000..c44da842
--- /dev/null
+++ b/mongodb-1.9.0/scripts/autotools/libmongoc/CheckResolv.m4
@@ -0,0 +1,98 @@
+dnl Disable Windows DNSAPI
+AC_SUBST(MONGOC_HAVE_DNSAPI, 0)
+
+need_libresolv="no"
+
+old_LIBS="$LIBS"
+dnl On AIX, resolv functions are in libc.
+if test "x$os_aix" = "xno"; then
+ LIBS="$LIBS -lresolv"
+fi
+
+dnl Thread-safe DNS query function for _mongoc_client_get_srv.
+dnl Could be a macro, not a function, so check with AC_LINK_IFELSE.
+AC_MSG_CHECKING([for res_nsearch])
+AC_LINK_IFELSE([AC_LANG_PROGRAM([[
+ #include <sys/types.h>
+ #include <netinet/in.h>
+ #include <arpa/nameser.h>
+ #include <resolv.h>
+]], [[
+ int len;
+ unsigned char reply[1024];
+ res_state statep;
+ len = res_nsearch(
+ statep, "example.com", ns_c_in, ns_t_srv, reply, sizeof(reply));
+]])], [
+ AC_MSG_RESULT([yes])
+ AC_SUBST(MONGOC_HAVE_RES_SEARCH, 0)
+ AC_SUBST(MONGOC_HAVE_RES_NSEARCH, 1)
+
+ dnl We have res_nsearch. Call res_ndestroy (BSD/Mac) or res_nclose (Linux)?
+ AC_MSG_CHECKING([for res_ndestroy])
+ AC_LINK_IFELSE([AC_LANG_PROGRAM([[
+ #include <sys/types.h>
+ #include <netinet/in.h>
+ #include <arpa/nameser.h>
+ #include <resolv.h>
+ ]], [[
+ res_state statep;
+ res_ndestroy(statep);
+ ]])], [
+ AC_MSG_RESULT([yes])
+ AC_SUBST(MONGOC_HAVE_RES_NDESTROY, 1)
+ AC_SUBST(MONGOC_HAVE_RES_NCLOSE, 0)
+ ], [
+ AC_MSG_RESULT([no])
+ AC_SUBST(MONGOC_HAVE_RES_NDESTROY, 0)
+ AC_MSG_CHECKING([for res_nclose])
+ AC_LINK_IFELSE([AC_LANG_PROGRAM([[
+ #include <sys/types.h>
+ #include <netinet/in.h>
+ #include <arpa/nameser.h>
+ #include <resolv.h>
+ ]], [[
+ res_state statep;
+ res_nclose(statep);
+ ]])], [
+ AC_MSG_RESULT([yes])
+ AC_SUBST(MONGOC_HAVE_RES_NCLOSE, 1)
+ ], [
+ AC_MSG_RESULT([no])
+ AC_SUBST(MONGOC_HAVE_RES_NCLOSE, 0)
+ ])
+ ])
+],[
+ AC_MSG_RESULT([no])
+ AC_SUBST(MONGOC_HAVE_RES_NSEARCH, 0)
+ AC_SUBST(MONGOC_HAVE_RES_NDESTROY, 0)
+ AC_SUBST(MONGOC_HAVE_RES_NCLOSE, 0)
+
+ dnl Thread-unsafe function.
+ AC_MSG_CHECKING([for res_search])
+ AC_LINK_IFELSE([AC_LANG_PROGRAM([[
+ #include <sys/types.h>
+ #include <netinet/in.h>
+ #include <arpa/nameser.h>
+ #include <resolv.h>
+ ]], [[
+ int len;
+ unsigned char reply[1024];
+ len = res_search("example.com", ns_c_in, ns_t_srv, reply, sizeof(reply));
+ ]])], [
+ AC_MSG_RESULT([yes])
+ AC_SUBST(MONGOC_HAVE_RES_SEARCH, 1)
+ if test "x$os_aix" = "xno"; then
+ need_libresolv="yes"
+ fi
+ ], [
+ AC_MSG_RESULT([no])
+ AC_SUBST(MONGOC_HAVE_RES_SEARCH, 0)
+ ])
+])
+
+LIBS="$old_LIBS"
+
+AS_IF([test "$need_libresolv" = "yes"],[
+ PHP_ADD_LIBRARY([resolv],,[MONGODB_SHARED_LIBADD])
+])
diff --git a/mongodb-1.8.1/scripts/autotools/libmongoc/CheckSSL.m4 b/mongodb-1.9.0/scripts/autotools/libmongoc/CheckSSL.m4
similarity index 100%
rename from mongodb-1.8.1/scripts/autotools/libmongoc/CheckSSL.m4
rename to mongodb-1.9.0/scripts/autotools/libmongoc/CheckSSL.m4
diff --git a/mongodb-1.8.1/scripts/autotools/libmongoc/CheckSasl.m4 b/mongodb-1.9.0/scripts/autotools/libmongoc/CheckSasl.m4
similarity index 100%
rename from mongodb-1.8.1/scripts/autotools/libmongoc/CheckSasl.m4
rename to mongodb-1.9.0/scripts/autotools/libmongoc/CheckSasl.m4
diff --git a/mongodb-1.9.0/scripts/autotools/libmongoc/FindDependencies.m4 b/mongodb-1.9.0/scripts/autotools/libmongoc/FindDependencies.m4
new file mode 100644
index 00000000..0f50fc27
--- /dev/null
+++ b/mongodb-1.9.0/scripts/autotools/libmongoc/FindDependencies.m4
@@ -0,0 +1,45 @@
+# Solaris needs to link against socket libs
+if test "$os_solaris" = "yes"; then
+ PHP_MONGODB_BUNDLED_CFLAGS="$PHP_MONGODB_BUNDLED_CFLAGS -D__EXTENSIONS__"
+ PHP_MONGODB_BUNDLED_CFLAGS="$PHP_MONGODB_BUNDLED_CFLAGS -D_XOPEN_SOURCE=1"
+ PHP_MONGODB_BUNDLED_CFLAGS="$PHP_MONGODB_BUNDLED_CFLAGS -D_XOPEN_SOURCE_EXTENDED=1"
+ PHP_ADD_LIBRARY([socket],,[MONGODB_SHARED_LIBADD])
+ PHP_ADD_LIBRARY([nsl],,[MONGODB_SHARED_LIBADD])
+fi
+
+# Check for shm functions
+AC_CHECK_FUNCS([shm_open],[],[
+ AC_CHECK_LIB([rt],
+ [shm_open],
+ [PHP_ADD_LIBRARY([rt],,[MONGODB_SHARED_LIBADD])],
+ [])
+])
+
+# Check for sched_getcpu
+AC_CHECK_FUNC([sched_getcpu],
+ [AC_SUBST(MONGOC_HAVE_SCHED_GETCPU, 1)],
+ [AC_SUBST(MONGOC_HAVE_SCHED_GETCPU, 0)])
+
+AC_CHECK_TYPE([socklen_t],
+ [AC_SUBST(MONGOC_HAVE_SOCKLEN, 1)],
+ [AC_SUBST(MONGOC_HAVE_SOCKLEN, 0)],
+ [#include <sys/socket.h>])
+
+AC_CHECK_MEMBER([struct sockaddr_storage.ss_family],
+ [AC_SUBST(MONGOC_HAVE_SS_FAMILY, 1)],
+ [AC_SUBST(MONGOC_HAVE_SS_FAMILY, 0)],
+ [#include <sys/socket.h>])
+
+# Check for pthreads. libmongoc's original FindDependencies.m4 script did not
+# require pthreads, but it does appear to be necessary on non-Windows platforms
+# based on mongoc-openssl.c and mongoc-thread-private.h.
+AX_PTHREAD([
+ PHP_MONGODB_BUNDLED_CFLAGS="$PHP_MONGODB_BUNDLED_CFLAGS $PTHREAD_CFLAGS"
+ PHP_EVAL_LIBLINE([$PTHREAD_LIBS],[MONGODB_SHARED_LIBADD])
+
+ # PTHREAD_CFLAGS may come back as "-pthread", which should also be used when
+ # linking. We can trust PHP_EVAL_LIBLINE to ignore other values.
+ PHP_EVAL_LIBLINE([$PTHREAD_CFLAGS],[MONGODB_SHARED_LIBADD])
+],[
+ AC_MSG_ERROR([libmongoc requires pthreads on non-Windows platforms.])
+])
diff --git a/mongodb-1.8.1/scripts/autotools/libmongoc/PlatformFlags.m4 b/mongodb-1.9.0/scripts/autotools/libmongoc/PlatformFlags.m4
similarity index 100%
rename from mongodb-1.8.1/scripts/autotools/libmongoc/PlatformFlags.m4
rename to mongodb-1.9.0/scripts/autotools/libmongoc/PlatformFlags.m4
diff --git a/mongodb-1.8.1/scripts/autotools/libmongoc/Versions.m4 b/mongodb-1.9.0/scripts/autotools/libmongoc/Versions.m4
similarity index 100%
rename from mongodb-1.8.1/scripts/autotools/libmongoc/Versions.m4
rename to mongodb-1.9.0/scripts/autotools/libmongoc/Versions.m4
diff --git a/mongodb-1.8.1/scripts/autotools/libmongoc/WeakSymbols.m4 b/mongodb-1.9.0/scripts/autotools/libmongoc/WeakSymbols.m4
similarity index 100%
rename from mongodb-1.8.1/scripts/autotools/libmongoc/WeakSymbols.m4
rename to mongodb-1.9.0/scripts/autotools/libmongoc/WeakSymbols.m4
diff --git a/mongodb-1.8.1/scripts/autotools/libmongocrypt/CheckSSL.m4 b/mongodb-1.9.0/scripts/autotools/libmongocrypt/CheckSSL.m4
similarity index 100%
rename from mongodb-1.8.1/scripts/autotools/libmongocrypt/CheckSSL.m4
rename to mongodb-1.9.0/scripts/autotools/libmongocrypt/CheckSSL.m4
diff --git a/mongodb-1.8.1/scripts/autotools/libmongocrypt/Version.m4 b/mongodb-1.9.0/scripts/autotools/libmongocrypt/Version.m4
similarity index 100%
rename from mongodb-1.8.1/scripts/autotools/libmongocrypt/Version.m4
rename to mongodb-1.9.0/scripts/autotools/libmongocrypt/Version.m4
diff --git a/mongodb-1.8.1/scripts/autotools/m4/as_var_copy.m4 b/mongodb-1.9.0/scripts/autotools/m4/as_var_copy.m4
similarity index 100%
rename from mongodb-1.8.1/scripts/autotools/m4/as_var_copy.m4
rename to mongodb-1.9.0/scripts/autotools/m4/as_var_copy.m4
diff --git a/mongodb-1.8.1/scripts/autotools/m4/ax_check_compile_flag.m4 b/mongodb-1.9.0/scripts/autotools/m4/ax_check_compile_flag.m4
similarity index 100%
rename from mongodb-1.8.1/scripts/autotools/m4/ax_check_compile_flag.m4
rename to mongodb-1.9.0/scripts/autotools/m4/ax_check_compile_flag.m4
diff --git a/mongodb-1.8.1/scripts/autotools/m4/ax_prototype.m4 b/mongodb-1.9.0/scripts/autotools/m4/ax_prototype.m4
similarity index 100%
rename from mongodb-1.8.1/scripts/autotools/m4/ax_prototype.m4
rename to mongodb-1.9.0/scripts/autotools/m4/ax_prototype.m4
diff --git a/mongodb-1.8.1/scripts/autotools/m4/ax_pthread.m4 b/mongodb-1.9.0/scripts/autotools/m4/ax_pthread.m4
similarity index 100%
rename from mongodb-1.8.1/scripts/autotools/m4/ax_pthread.m4
rename to mongodb-1.9.0/scripts/autotools/m4/ax_pthread.m4
diff --git a/mongodb-1.8.1/scripts/autotools/m4/php_mongodb.m4 b/mongodb-1.9.0/scripts/autotools/m4/php_mongodb.m4
similarity index 100%
rename from mongodb-1.8.1/scripts/autotools/m4/php_mongodb.m4
rename to mongodb-1.9.0/scripts/autotools/m4/php_mongodb.m4
diff --git a/mongodb-1.8.1/scripts/autotools/m4/pkg.m4 b/mongodb-1.9.0/scripts/autotools/m4/pkg.m4
similarity index 100%
rename from mongodb-1.8.1/scripts/autotools/m4/pkg.m4
rename to mongodb-1.9.0/scripts/autotools/m4/pkg.m4
diff --git a/mongodb-1.8.1/scripts/centos/essentials.sh b/mongodb-1.9.0/scripts/centos/essentials.sh
similarity index 100%
rename from mongodb-1.8.1/scripts/centos/essentials.sh
rename to mongodb-1.9.0/scripts/centos/essentials.sh
diff --git a/mongodb-1.8.1/scripts/centos/ldap/Domain.ldif b/mongodb-1.9.0/scripts/centos/ldap/Domain.ldif
similarity index 100%
rename from mongodb-1.8.1/scripts/centos/ldap/Domain.ldif
rename to mongodb-1.9.0/scripts/centos/ldap/Domain.ldif
diff --git a/mongodb-1.8.1/scripts/centos/ldap/Users.ldif b/mongodb-1.9.0/scripts/centos/ldap/Users.ldif
similarity index 100%
rename from mongodb-1.8.1/scripts/centos/ldap/Users.ldif
rename to mongodb-1.9.0/scripts/centos/ldap/Users.ldif
diff --git a/mongodb-1.8.1/scripts/centos/ldap/basics.ldif b/mongodb-1.9.0/scripts/centos/ldap/basics.ldif
similarity index 100%
rename from mongodb-1.8.1/scripts/centos/ldap/basics.ldif
rename to mongodb-1.9.0/scripts/centos/ldap/basics.ldif
diff --git a/mongodb-1.8.1/scripts/centos/ldap/install.sh b/mongodb-1.9.0/scripts/centos/ldap/install.sh
similarity index 100%
rename from mongodb-1.8.1/scripts/centos/ldap/install.sh
rename to mongodb-1.9.0/scripts/centos/ldap/install.sh
diff --git a/mongodb-1.8.1/scripts/centos/ldap/ldapconfig.py b/mongodb-1.9.0/scripts/centos/ldap/ldapconfig.py
similarity index 100%
rename from mongodb-1.8.1/scripts/centos/ldap/ldapconfig.py
rename to mongodb-1.9.0/scripts/centos/ldap/ldapconfig.py
diff --git a/mongodb-1.8.1/scripts/centos/ldap/mongod.ldif b/mongodb-1.9.0/scripts/centos/ldap/mongod.ldif
similarity index 100%
rename from mongodb-1.8.1/scripts/centos/ldap/mongod.ldif
rename to mongodb-1.9.0/scripts/centos/ldap/mongod.ldif
diff --git a/mongodb-1.8.1/scripts/centos/ldap/pw.ldif b/mongodb-1.9.0/scripts/centos/ldap/pw.ldif
similarity index 100%
rename from mongodb-1.8.1/scripts/centos/ldap/pw.ldif
rename to mongodb-1.9.0/scripts/centos/ldap/pw.ldif
diff --git a/mongodb-1.8.1/scripts/centos/ldap/saslauthd.conf b/mongodb-1.9.0/scripts/centos/ldap/saslauthd.conf
similarity index 100%
rename from mongodb-1.8.1/scripts/centos/ldap/saslauthd.conf
rename to mongodb-1.9.0/scripts/centos/ldap/saslauthd.conf
diff --git a/mongodb-1.8.1/scripts/centos/ldap/users b/mongodb-1.9.0/scripts/centos/ldap/users
similarity index 100%
rename from mongodb-1.8.1/scripts/centos/ldap/users
rename to mongodb-1.9.0/scripts/centos/ldap/users
diff --git a/mongodb-1.8.1/scripts/clang-format.sh b/mongodb-1.9.0/scripts/clang-format.sh
similarity index 100%
rename from mongodb-1.8.1/scripts/clang-format.sh
rename to mongodb-1.9.0/scripts/clang-format.sh
diff --git a/mongodb-1.9.0/scripts/convert-bson-corpus-tests.php b/mongodb-1.9.0/scripts/convert-bson-corpus-tests.php
new file mode 100644
index 00000000..e68f3067
--- /dev/null
+++ b/mongodb-1.9.0/scripts/convert-bson-corpus-tests.php
@@ -0,0 +1,303 @@
+<?php
+
+require_once __DIR__ . '/../tests/utils/tools.php';
+
+$expectedFailures = [
+ 'Int64 type: -1' => 'PHP encodes integers as 32-bit if range allows',
+ 'Int64 type: 0' => 'PHP encodes integers as 32-bit if range allows',
+ 'Int64 type: 1' => 'PHP encodes integers as 32-bit if range allows',
+ 'Javascript Code with Scope: Unicode and embedded null in code string, empty scope' => 'Embedded null in code string is not supported in libbson (CDRIVER-1879)',
+ 'Multiple types within the same document: All BSON types' => 'PHP encodes integers as 32-bit if range allows',
+ 'Top-level document validity: Bad $date (number, not string or hash)' => 'Legacy extended JSON $date syntax uses numbers (CDRIVER-2223)',
+];
+
+$for64bitOnly = [
+ /* Note: Although 64-bit integers be represented by the Int64 class, these
+ * tests fail on 32-bit platforms due to json_canonicalize() roundtripping
+ * values through PHP, which converts large integers to floats. */
+ 'Int64 type: MinValue' => "Can't represent 64-bit ints on a 32-bit platform",
+ 'Int64 type: MaxValue' => "Can't represent 64-bit ints on a 32-bit platform",
+];
+
+$outputPath = realpath(__DIR__ . '/../tests') . '/bson-corpus/';
+
+if ( ! is_dir($outputPath) && ! mkdir($outputPath, 0755, true)) {
+ printf("Error creating output path: %s\n", $outputPath);
+}
+
+foreach (array_slice($argv, 1) as $inputFile) {
+ if ( ! is_readable($inputFile) || ! is_file($inputFile)) {
+ printf("Error reading %s\n", $inputFile);
+ continue;
+ }
+
+ $test = json_decode(file_get_contents($inputFile), true);
+
+ if (json_last_error() !== JSON_ERROR_NONE) {
+ printf("Error decoding %s: %s\n", $inputFile, json_last_error_msg());
+ continue;
+ }
+
+ if ( ! isset($test['description'])) {
+ printf("Skipping test file without \"description\" field: %s\n", $inputFile);
+ continue;
+ }
+
+ if ( ! empty($test['valid'])) {
+ foreach ($test['valid'] as $i => $case) {
+ $outputFile = sprintf('%s-valid-%03d.phpt', pathinfo($inputFile, PATHINFO_FILENAME), $i + 1);
+ try {
+ $output = renderPhpt(getParamsForValid($test, $case), $expectedFailures, $for64bitOnly);
+ } catch (Exception $e) {
+ printf("Error processing valid[%d] in %s: %s\n", $i, $inputFile, $e->getMessage());
+ continue;
+ }
+
+ if (false === file_put_contents($outputPath . '/' . $outputFile, $output)) {
+ printf("Error writing valid[%d] in %s\n", $i, $inputFile);
+ continue;
+ }
+ }
+ }
+
+ if ( ! empty($test['decodeErrors'])) {
+ foreach ($test['decodeErrors'] as $i => $case) {
+ $outputFile = sprintf('%s-decodeError-%03d.phpt', pathinfo($inputFile, PATHINFO_FILENAME), $i + 1);
+ try {
+ $output = renderPhpt(getParamsForDecodeError($test, $case), $expectedFailures, $for64bitOnly);
+ } catch (Exception $e) {
+ printf("Error processing decodeErrors[%d] in %s: %s\n", $i, $inputFile, $e->getMessage());
+ continue;
+ }
+
+ if (false === file_put_contents($outputPath . '/' . $outputFile, $output)) {
+ printf("Error writing decodeErrors[%d] in %s\n", $i, $inputFile);
+ continue;
+ }
+ }
+ }
+
+ if ( ! empty($test['parseErrors'])) {
+ foreach ($test['parseErrors'] as $i => $case) {
+ $outputFile = sprintf('%s-parseError-%03d.phpt', pathinfo($inputFile, PATHINFO_FILENAME), $i + 1);
+ try {
+ $output = renderPhpt(getParamsForParseError($test, $case), $expectedFailures, $for64bitOnly);
+ } catch (Exception $e) {
+ printf("Error processing parseErrors[%d] in %s: %s\n", $i, $inputFile, $e->getMessage());
+ continue;
+ }
+
+ if (false === file_put_contents($outputPath . '/' . $outputFile, $output)) {
+ printf("Error writing parseErrors[%d] in %s\n", $i, $inputFile);
+ continue;
+ }
+ }
+ }
+}
+
+function getParamsForValid(array $test, array $case)
+{
+ foreach (['description', 'canonical_bson', 'canonical_extjson'] as $field) {
+ if (!isset($case[$field])) {
+ throw new InvalidArgumentException(sprintf('Missing "%s" field', $field));
+ }
+ }
+
+ $code = '';
+ $expect = '';
+
+ $lossy = isset($case['lossy']) ? (boolean) $case['lossy'] : false;
+
+ $canonicalBson = $case['canonical_bson'];
+ $expectedCanonicalBson = strtolower($canonicalBson);
+ $code .= sprintf('$canonicalBson = hex2bin(%s);', var_export($canonicalBson, true)) . "\n";
+
+ if (isset($case['degenerate_bson'])) {
+ $degenerateBson = $case['degenerate_bson'];
+ $expectedDegenerateBson = strtolower($degenerateBson);
+ $code .= sprintf('$degenerateBson = hex2bin(%s);', var_export($degenerateBson, true)) . "\n";
+ }
+
+ if (isset($case['converted_bson'])) {
+ $convertedBson = $case['converted_bson'];
+ $expectedConvertedBson = strtolower($convertedBson);
+ $code .= sprintf('$convertedBson = hex2bin(%s);', var_export($convertedBson, true)) . "\n";
+ }
+
+ $canonicalExtJson = $case['canonical_extjson'];
+ $expectedCanonicalExtJson = json_canonicalize($canonicalExtJson);
+ $code .= sprintf('$canonicalExtJson = %s;', var_export($canonicalExtJson, true)) . "\n";
+
+ if (isset($case['relaxed_extjson'])) {
+ $relaxedExtJson = $case['relaxed_extjson'];
+ $expectedRelaxedExtJson = json_canonicalize($relaxedExtJson);
+ $code .= sprintf('$relaxedExtJson = %s;', var_export($relaxedExtJson, true)) . "\n";
+ }
+
+ if (isset($case['degenerate_extjson'])) {
+ $degenerateExtJson = $case['degenerate_extjson'];
+ $expectedDegenerateExtJson = json_canonicalize($degenerateExtJson);
+ $code .= sprintf('$degenerateExtJson = %s;', var_export($degenerateExtJson, true)) . "\n";
+ }
+
+ if (isset($case['converted_extjson'])) {
+ $convertedExtJson = $case['converted_extjson'];
+ $expectedConvertedExtJson = json_canonicalize($convertedExtJson);
+ $code .= sprintf('$convertedExtJson = %s;', var_export($convertedExtJson, true)) . "\n";
+ }
+
+ $code .= "\n// Canonical BSON -> Native -> Canonical BSON\n";
+ $code .= 'echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";' . "\n";
+ $expect .= $expectedCanonicalBson . "\n";
+
+ $code .= "\n// Canonical BSON -> Canonical extJSON\n";
+ $code .= 'echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";' . "\n";;
+ $expect .= $expectedCanonicalExtJson . "\n";
+
+ if (isset($relaxedExtJson)) {
+ $code .= "\n// Canonical BSON -> Relaxed extJSON\n";
+ $code .= 'echo json_canonicalize(toRelaxedExtendedJSON($canonicalBson)), "\n";' . "\n";;
+ $expect .= $expectedRelaxedExtJson . "\n";
+ }
+
+ if (!$lossy) {
+ $code .= "\n// Canonical extJSON -> Canonical BSON\n";
+ $code .= 'echo bin2hex(fromJSON($canonicalExtJson)), "\n";' . "\n";
+ $expect .= $expectedCanonicalBson . "\n";
+ }
+
+ if (isset($degenerateBson)) {
+ $code .= "\n// Degenerate BSON -> Native -> Canonical BSON\n";
+ $code .= 'echo bin2hex(fromPHP(toPHP($degenerateBson))), "\n";' . "\n";
+ $expect .= $expectedCanonicalBson . "\n";
+
+ $code .= "\n// Degenerate BSON -> Canonical extJSON\n";
+ $code .= 'echo json_canonicalize(toCanonicalExtendedJSON($degenerateBson)), "\n";' . "\n";;
+ $expect .= $expectedCanonicalExtJson . "\n";
+
+ if (isset($relaxedExtJson)) {
+ $code .= "\n// Degenerate BSON -> Relaxed extJSON\n";
+ $code .= 'echo json_canonicalize(toRelaxedExtendedJSON($degenerateBson)), "\n";' . "\n";;
+ $expect .= $expectedRelaxedExtJson . "\n";
+ }
+ }
+
+ if (isset($degenerateExtJson) && !$lossy) {
+ $code .= "\n// Degenerate extJSON -> Canonical BSON\n";
+ $code .= 'echo bin2hex(fromJSON($degenerateExtJson)), "\n";' . "\n";
+ $expect .= $expectedCanonicalBson . "\n";
+ }
+
+ if (isset($relaxedExtJson)) {
+ $code .= "\n// Relaxed extJSON -> BSON -> Relaxed extJSON\n";
+ $code .= 'echo json_canonicalize(toRelaxedExtendedJSON(fromJSON($relaxedExtJson))), "\n";' . "\n";
+ $expect .= $expectedRelaxedExtJson . "\n";
+ }
+
+ return [
+ '%NAME%' => sprintf('%s: %s', trim($test['description']), trim($case['description'])),
+ '%CODE%' => trim($code),
+ '%EXPECT%' => trim($expect),
+ ];
+}
+
+function getParamsForDecodeError(array $test, array $case)
+{
+ foreach (['description', 'bson'] as $field) {
+ if (!isset($case[$field])) {
+ throw new InvalidArgumentException(sprintf('Missing "%s" field', $field));
+ }
+ }
+
+ $code = sprintf('$bson = hex2bin(%s);', var_export($case['bson'], true)) . "\n\n";
+ $code .= "throws(function() use (\$bson) {\n";
+ $code .= " var_dump(toPHP(\$bson));\n";
+ $code .= "}, 'MongoDB\Driver\Exception\UnexpectedValueException');";
+
+ /* We do not test for the exception message, since that may differ based on
+ * the nature of the decoding error. */
+ $expect = "OK: Got MongoDB\Driver\Exception\UnexpectedValueException";
+
+ return [
+ '%NAME%' => sprintf('%s: %s', trim($test['description']), trim($case['description'])),
+ '%CODE%' => trim($code),
+ '%EXPECT%' => trim($expect),
+ ];
+}
+
+function getParamsForParseError(array $test, array $case)
+{
+ foreach (['description', 'string'] as $field) {
+ if (!isset($case[$field])) {
+ throw new InvalidArgumentException(sprintf('Missing "%s" field', $field));
+ }
+ }
+
+ $code = '';
+ $expect = '';
+
+ switch ($test['bson_type']) {
+ case '0x00': // Top-level document
+ $code = "throws(function() {\n";
+ $code .= sprintf(" fromJSON(%s);\n", var_export($case['string'], true));
+ $code .= "}, 'MongoDB\Driver\Exception\UnexpectedValueException');";
+
+ /* We do not test for the exception message, since that may differ
+ * based on the nature of the parse error. */
+ $expect = "OK: Got MongoDB\Driver\Exception\UnexpectedValueException";
+ break;
+
+ case '0x13': // Decimal128
+ $code = "throws(function() {\n";
+ $code .= sprintf(" new MongoDB\BSON\Decimal128(%s);\n", var_export($case['string'], true));
+ $code .= "}, 'MongoDB\Driver\Exception\InvalidArgumentException');";
+
+ /* We do not test for the exception message, since that may differ
+ * based on the nature of the parse error. */
+ $expect = "OK: Got MongoDB\Driver\Exception\InvalidArgumentException";
+ break;
+
+ default:
+ throw new UnexpectedValueException(sprintf("Parse errors not supported for BSON type: %s", $test['bson_type']));
+ }
+
+ return [
+ '%NAME%' => sprintf('%s: %s', trim($test['description']), trim($case['description'])),
+ '%CODE%' => trim($code),
+ '%EXPECT%' => trim($expect),
+ ];
+}
+
+function renderPhpt(array $params, array $expectedFailures, array $for64bitOnly)
+{
+ $params['%XFAIL%'] = isset($expectedFailures[$params['%NAME%']])
+ ? "--XFAIL--\n" . $expectedFailures[$params['%NAME%']] . "\n"
+ : '';
+ $params['%SKIPIF%'] = isset($for64bitOnly[$params['%NAME%']])
+ ? "--SKIPIF--\n" . "<?php if (PHP_INT_SIZE !== 8) { die(\"skip {$for64bitOnly[$params['%NAME%']]}\"); } ?>" . "\n"
+ : '';
+
+ $template = <<< 'TEMPLATE'
+--TEST--
+%NAME%
+%XFAIL%%SKIPIF%--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+%CODE%
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+%EXPECT%
+===DONE===
+TEMPLATE;
+
+ return str_replace(array_keys($params), array_values($params), $template);
+}
diff --git a/mongodb-1.8.1/scripts/freebsd/essentials.sh b/mongodb-1.9.0/scripts/freebsd/essentials.sh
similarity index 100%
rename from mongodb-1.8.1/scripts/freebsd/essentials.sh
rename to mongodb-1.9.0/scripts/freebsd/essentials.sh
diff --git a/mongodb-1.8.1/scripts/freebsd/phongo.sh b/mongodb-1.9.0/scripts/freebsd/phongo.sh
similarity index 100%
rename from mongodb-1.8.1/scripts/freebsd/phongo.sh
rename to mongodb-1.9.0/scripts/freebsd/phongo.sh
diff --git a/mongodb-1.8.1/scripts/list-servers.php b/mongodb-1.9.0/scripts/list-servers.php
similarity index 100%
rename from mongodb-1.8.1/scripts/list-servers.php
rename to mongodb-1.9.0/scripts/list-servers.php
diff --git a/mongodb-1.8.1/scripts/presets/replicaset-30.json b/mongodb-1.9.0/scripts/presets/replicaset-30.json
similarity index 100%
rename from mongodb-1.8.1/scripts/presets/replicaset-30.json
rename to mongodb-1.9.0/scripts/presets/replicaset-30.json
diff --git a/mongodb-1.8.1/scripts/presets/replicaset-dns.json b/mongodb-1.9.0/scripts/presets/replicaset-dns.json
similarity index 100%
rename from mongodb-1.8.1/scripts/presets/replicaset-dns.json
rename to mongodb-1.9.0/scripts/presets/replicaset-dns.json
diff --git a/mongodb-1.8.1/scripts/presets/replicaset.json b/mongodb-1.9.0/scripts/presets/replicaset.json
similarity index 100%
rename from mongodb-1.8.1/scripts/presets/replicaset.json
rename to mongodb-1.9.0/scripts/presets/replicaset.json
diff --git a/mongodb-1.8.1/scripts/presets/standalone-30.json b/mongodb-1.9.0/scripts/presets/standalone-30.json
similarity index 100%
rename from mongodb-1.8.1/scripts/presets/standalone-30.json
rename to mongodb-1.9.0/scripts/presets/standalone-30.json
diff --git a/mongodb-1.8.1/scripts/presets/standalone-auth.json b/mongodb-1.9.0/scripts/presets/standalone-auth.json
similarity index 100%
rename from mongodb-1.8.1/scripts/presets/standalone-auth.json
rename to mongodb-1.9.0/scripts/presets/standalone-auth.json
diff --git a/mongodb-1.8.1/scripts/presets/standalone-plain.json b/mongodb-1.9.0/scripts/presets/standalone-plain.json
similarity index 100%
rename from mongodb-1.8.1/scripts/presets/standalone-plain.json
rename to mongodb-1.9.0/scripts/presets/standalone-plain.json
diff --git a/mongodb-1.8.1/scripts/presets/standalone-ssl.json b/mongodb-1.9.0/scripts/presets/standalone-ssl.json
similarity index 100%
rename from mongodb-1.8.1/scripts/presets/standalone-ssl.json
rename to mongodb-1.9.0/scripts/presets/standalone-ssl.json
diff --git a/mongodb-1.8.1/scripts/presets/standalone-x509.json b/mongodb-1.9.0/scripts/presets/standalone-x509.json
similarity index 100%
rename from mongodb-1.8.1/scripts/presets/standalone-x509.json
rename to mongodb-1.9.0/scripts/presets/standalone-x509.json
diff --git a/mongodb-1.8.1/scripts/presets/standalone.json b/mongodb-1.9.0/scripts/presets/standalone.json
similarity index 100%
rename from mongodb-1.8.1/scripts/presets/standalone.json
rename to mongodb-1.9.0/scripts/presets/standalone.json
diff --git a/mongodb-1.8.1/scripts/run-tests-on.sh b/mongodb-1.9.0/scripts/run-tests-on.sh
similarity index 100%
rename from mongodb-1.8.1/scripts/run-tests-on.sh
rename to mongodb-1.9.0/scripts/run-tests-on.sh
diff --git a/mongodb-1.8.1/scripts/ssl/ca.pem b/mongodb-1.9.0/scripts/ssl/ca.pem
similarity index 100%
rename from mongodb-1.8.1/scripts/ssl/ca.pem
rename to mongodb-1.9.0/scripts/ssl/ca.pem
diff --git a/mongodb-1.8.1/scripts/ssl/client.pem b/mongodb-1.9.0/scripts/ssl/client.pem
similarity index 100%
rename from mongodb-1.8.1/scripts/ssl/client.pem
rename to mongodb-1.9.0/scripts/ssl/client.pem
diff --git a/mongodb-1.8.1/scripts/ssl/crl.pem b/mongodb-1.9.0/scripts/ssl/crl.pem
similarity index 100%
rename from mongodb-1.8.1/scripts/ssl/crl.pem
rename to mongodb-1.9.0/scripts/ssl/crl.pem
diff --git a/mongodb-1.8.1/scripts/ssl/server.pem b/mongodb-1.9.0/scripts/ssl/server.pem
similarity index 100%
rename from mongodb-1.8.1/scripts/ssl/server.pem
rename to mongodb-1.9.0/scripts/ssl/server.pem
diff --git a/mongodb-1.8.1/scripts/start-servers.php b/mongodb-1.9.0/scripts/start-servers.php
similarity index 100%
rename from mongodb-1.8.1/scripts/start-servers.php
rename to mongodb-1.9.0/scripts/start-servers.php
diff --git a/mongodb-1.8.1/scripts/ubuntu/essentials.sh b/mongodb-1.9.0/scripts/ubuntu/essentials.sh
similarity index 100%
rename from mongodb-1.8.1/scripts/ubuntu/essentials.sh
rename to mongodb-1.9.0/scripts/ubuntu/essentials.sh
diff --git a/mongodb-1.8.1/scripts/ubuntu/ldap/install.sh b/mongodb-1.9.0/scripts/ubuntu/ldap/install.sh
similarity index 100%
rename from mongodb-1.8.1/scripts/ubuntu/ldap/install.sh
rename to mongodb-1.9.0/scripts/ubuntu/ldap/install.sh
diff --git a/mongodb-1.8.1/scripts/ubuntu/ldap/saslauthd.conf b/mongodb-1.9.0/scripts/ubuntu/ldap/saslauthd.conf
similarity index 100%
rename from mongodb-1.8.1/scripts/ubuntu/ldap/saslauthd.conf
rename to mongodb-1.9.0/scripts/ubuntu/ldap/saslauthd.conf
diff --git a/mongodb-1.8.1/scripts/ubuntu/mongo-orchestration.sh b/mongodb-1.9.0/scripts/ubuntu/mongo-orchestration.sh
similarity index 100%
rename from mongodb-1.8.1/scripts/ubuntu/mongo-orchestration.sh
rename to mongodb-1.9.0/scripts/ubuntu/mongo-orchestration.sh
diff --git a/mongodb-1.8.1/scripts/ubuntu/phongo.sh b/mongodb-1.9.0/scripts/ubuntu/phongo.sh
similarity index 100%
rename from mongodb-1.8.1/scripts/ubuntu/phongo.sh
rename to mongodb-1.9.0/scripts/ubuntu/phongo.sh
diff --git a/mongodb-1.8.1/scripts/vmware/kernel.sh b/mongodb-1.9.0/scripts/vmware/kernel.sh
similarity index 100%
rename from mongodb-1.8.1/scripts/vmware/kernel.sh
rename to mongodb-1.9.0/scripts/vmware/kernel.sh
diff --git a/mongodb-1.9.0/src/BSON/Binary.c b/mongodb-1.9.0/src/BSON/Binary.c
new file mode 100644
index 00000000..3fc426bf
--- /dev/null
+++ b/mongodb-1.9.0/src/BSON/Binary.c
@@ -0,0 +1,454 @@
+/*
+ * 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.
+ */
+
+#include <php.h>
+#include <ext/standard/base64.h>
+#include <Zend/zend_interfaces.h>
+#include <Zend/zend_operators.h>
+#include <ext/standard/php_var.h>
+#include <zend_smart_str.h>
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "phongo_compat.h"
+#include "php_phongo.h"
+
+#define PHONGO_BINARY_UUID_SIZE 16
+
+zend_class_entry* php_phongo_binary_ce;
+
+/* 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, size_t data_len, zend_long type) /* {{{ */
+{
+ if (type < 0 || type > UINT8_MAX) {
+ phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Expected type to be an unsigned 8-bit integer, %" PHONGO_LONG_FORMAT " given", type);
+ return false;
+ }
+
+ if ((type == BSON_SUBTYPE_UUID_DEPRECATED || type == BSON_SUBTYPE_UUID) && data_len != PHONGO_BINARY_UUID_SIZE) {
+ phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Expected UUID length to be %d bytes, %d given", PHONGO_BINARY_UUID_SIZE, data_len);
+ 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) /* {{{ */
+{
+ 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));
+ }
+
+ phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "%s initialization requires \"data\" string and \"type\" integer fields", ZSTR_VAL(php_phongo_binary_ce->name));
+ return false;
+} /* }}} */
+
+/* {{{ proto void MongoDB\BSON\Binary::__construct(string $data, int $type)
+ Construct a new BSON binary type */
+static PHP_METHOD(Binary, __construct)
+{
+ zend_error_handling error_handling;
+ php_phongo_binary_t* intern;
+ char* data;
+ size_t data_len;
+ zend_long type;
+
+ intern = Z_BINARY_OBJ_P(getThis());
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "sl", &data, &data_len, &type) == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ php_phongo_binary_init(intern, data, data_len, type);
+} /* }}} */
+
+/* {{{ proto void MongoDB\BSON\Binary::__set_state(array $properties)
+*/
+static PHP_METHOD(Binary, __set_state)
+{
+ zend_error_handling error_handling;
+ php_phongo_binary_t* intern;
+ HashTable* props;
+ zval* array;
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "a", &array) == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ 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);
+} /* }}} */
+
+/* {{{ proto string MongoDB\BSON\Binary::__toString()
+ Return the Binary's data string. */
+static PHP_METHOD(Binary, __toString)
+{
+ zend_error_handling error_handling;
+ php_phongo_binary_t* intern;
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters_none() == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ intern = Z_BINARY_OBJ_P(getThis());
+
+ RETURN_STRINGL(intern->data, intern->data_len);
+} /* }}} */
+
+/* {{{ proto string MongoDB\BSON\Binary::getData()
+*/
+static PHP_METHOD(Binary, getData)
+{
+ zend_error_handling error_handling;
+ php_phongo_binary_t* intern;
+
+ intern = Z_BINARY_OBJ_P(getThis());
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters_none() == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ RETURN_STRINGL(intern->data, intern->data_len);
+} /* }}} */
+
+/* {{{ proto integer MongoDB\BSON\Binary::getType()
+*/
+static PHP_METHOD(Binary, getType)
+{
+ zend_error_handling error_handling;
+ php_phongo_binary_t* intern;
+
+ intern = Z_BINARY_OBJ_P(getThis());
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters_none() == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ RETURN_LONG(intern->type);
+} /* }}} */
+
+/* {{{ proto array MongoDB\BSON\Binary::jsonSerialize()
+*/
+static PHP_METHOD(Binary, jsonSerialize)
+{
+ zend_error_handling error_handling;
+ php_phongo_binary_t* intern;
+ char type[3];
+ int type_len;
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters_none() == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ intern = Z_BINARY_OBJ_P(getThis());
+
+ array_init_size(return_value, 2);
+
+ {
+ 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);
+ }
+
+ type_len = snprintf(type, sizeof(type), "%02x", intern->type);
+ ADD_ASSOC_STRINGL(return_value, "$type", type, type_len);
+} /* }}} */
+
+/* {{{ proto string MongoDB\BSON\Binary::serialize()
+*/
+static PHP_METHOD(Binary, serialize)
+{
+ zend_error_handling error_handling;
+ php_phongo_binary_t* intern;
+ zval retval;
+ php_serialize_data_t var_hash;
+ smart_str buf = { 0 };
+
+ intern = Z_BINARY_OBJ_P(getThis());
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters_none() == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ array_init_size(&retval, 2);
+ ADD_ASSOC_STRINGL(&retval, "data", intern->data, intern->data_len);
+ ADD_ASSOC_LONG_EX(&retval, "type", intern->type);
+
+ PHP_VAR_SERIALIZE_INIT(var_hash);
+ php_var_serialize(&buf, &retval, &var_hash);
+ smart_str_0(&buf);
+ PHP_VAR_SERIALIZE_DESTROY(var_hash);
+
+ PHONGO_RETVAL_SMART_STR(buf);
+
+ smart_str_free(&buf);
+ zval_ptr_dtor(&retval);
+} /* }}} */
+
+/* {{{ proto void MongoDB\BSON\Binary::unserialize(string $serialized)
+*/
+static PHP_METHOD(Binary, unserialize)
+{
+ zend_error_handling error_handling;
+ php_phongo_binary_t* intern;
+ char* serialized;
+ size_t serialized_len;
+ zval props;
+ 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);
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &serialized, &serialized_len) == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ PHP_VAR_UNSERIALIZE_INIT(var_hash);
+ if (!php_var_unserialize(&props, (const unsigned char**) &serialized, (unsigned char*) serialized + serialized_len, &var_hash)) {
+ zval_ptr_dtor(&props);
+ phongo_throw_exception(PHONGO_ERROR_UNEXPECTED_VALUE, "%s unserialization failed", ZSTR_VAL(php_phongo_binary_ce->name));
+
+ PHP_VAR_UNSERIALIZE_DESTROY(var_hash);
+ return;
+ }
+ PHP_VAR_UNSERIALIZE_DESTROY(var_hash);
+
+ php_phongo_binary_init_from_hash(intern, HASH_OF(&props));
+ zval_ptr_dtor(&props);
+} /* }}} */
+
+/* {{{ MongoDB\BSON\Binary function entries */
+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[] = {
+ /* clang-format off */
+ 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
+ /* clang-format on */
+};
+/* }}} */
+
+/* {{{ MongoDB\BSON\Binary object handlers */
+static zend_object_handlers php_phongo_handler_binary;
+
+static void php_phongo_binary_free_object(zend_object* object) /* {{{ */
+{
+ php_phongo_binary_t* intern = Z_OBJ_BINARY(object);
+
+ zend_object_std_dtor(&intern->std);
+
+ if (intern->data) {
+ efree(intern->data);
+ }
+
+ if (intern->properties) {
+ zend_hash_destroy(intern->properties);
+ FREE_HASHTABLE(intern->properties);
+ }
+} /* }}} */
+
+static zend_object* php_phongo_binary_create_object(zend_class_entry* class_type) /* {{{ */
+{
+ 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);
+ object_properties_init(&intern->std, class_type);
+
+ intern->std.handlers = &php_phongo_handler_binary;
+
+ return &intern->std;
+} /* }}} */
+
+static zend_object* php_phongo_binary_clone_object(phongo_compat_object_handler_type* object) /* {{{ */
+{
+ php_phongo_binary_t* intern;
+ php_phongo_binary_t* new_intern;
+ zend_object* new_object;
+
+ intern = Z_OBJ_BINARY(PHONGO_COMPAT_GET_OBJ(object));
+ new_object = php_phongo_binary_create_object(PHONGO_COMPAT_GET_OBJ(object)->ce);
+
+ new_intern = Z_OBJ_BINARY(new_object);
+ zend_objects_clone_members(&new_intern->std, &intern->std);
+
+ php_phongo_binary_init(new_intern, intern->data, intern->data_len, intern->type);
+
+ return new_object;
+} /* }}} */
+
+static int php_phongo_binary_compare_objects(zval* o1, zval* o2) /* {{{ */
+{
+ php_phongo_binary_t *intern1, *intern2;
+
+ ZEND_COMPARE_OBJECTS_FALLBACK(o1, o2);
+
+ 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_properties_hash(phongo_compat_object_handler_type* object, bool is_debug) /* {{{ */
+{
+ php_phongo_binary_t* intern;
+ HashTable* props;
+
+ intern = Z_OBJ_BINARY(PHONGO_COMPAT_GET_OBJ(object));
+
+ PHONGO_GET_PROPERTY_HASH_INIT_PROPS(is_debug, intern, props, 2);
+
+ if (!intern->data) {
+ return props;
+ }
+
+ {
+ 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);
+ }
+
+ return props;
+} /* }}} */
+
+static HashTable* php_phongo_binary_get_debug_info(phongo_compat_object_handler_type* object, int* is_temp) /* {{{ */
+{
+ *is_temp = 1;
+ return php_phongo_binary_get_properties_hash(object, true);
+} /* }}} */
+
+static HashTable* php_phongo_binary_get_properties(phongo_compat_object_handler_type* object) /* {{{ */
+{
+ return php_phongo_binary_get_properties_hash(object, false);
+} /* }}} */
+/* }}} */
+
+void php_phongo_binary_init_ce(INIT_FUNC_ARGS) /* {{{ */
+{
+ zend_class_entry ce;
+
+ INIT_NS_CLASS_ENTRY(ce, "MongoDB\\BSON", "Binary", php_phongo_binary_me);
+ php_phongo_binary_ce = zend_register_internal_class(&ce);
+ 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, 1, php_phongo_binary_interface_ce);
+ zend_class_implements(php_phongo_binary_ce, 1, php_phongo_json_serializable_ce);
+ zend_class_implements(php_phongo_binary_ce, 1, php_phongo_type_ce);
+ zend_class_implements(php_phongo_binary_ce, 1, zend_ce_serializable);
+
+ memcpy(&php_phongo_handler_binary, phongo_get_std_object_handlers(), sizeof(zend_object_handlers));
+ PHONGO_COMPAT_SET_COMPARE_OBJECTS_HANDLER(binary);
+ php_phongo_handler_binary.clone_obj = php_phongo_binary_clone_object;
+ php_phongo_handler_binary.get_debug_info = php_phongo_binary_get_debug_info;
+ php_phongo_handler_binary.get_properties = php_phongo_binary_get_properties;
+ php_phongo_handler_binary.free_obj = php_phongo_binary_free_object;
+ php_phongo_handler_binary.offset = XtOffsetOf(php_phongo_binary_t, std);
+
+ zend_declare_class_constant_long(php_phongo_binary_ce, ZEND_STRL("TYPE_GENERIC"), BSON_SUBTYPE_BINARY);
+ zend_declare_class_constant_long(php_phongo_binary_ce, ZEND_STRL("TYPE_FUNCTION"), BSON_SUBTYPE_FUNCTION);
+ zend_declare_class_constant_long(php_phongo_binary_ce, ZEND_STRL("TYPE_OLD_BINARY"), BSON_SUBTYPE_BINARY_DEPRECATED);
+ zend_declare_class_constant_long(php_phongo_binary_ce, ZEND_STRL("TYPE_OLD_UUID"), BSON_SUBTYPE_UUID_DEPRECATED);
+ zend_declare_class_constant_long(php_phongo_binary_ce, ZEND_STRL("TYPE_UUID"), BSON_SUBTYPE_UUID);
+ zend_declare_class_constant_long(php_phongo_binary_ce, ZEND_STRL("TYPE_MD5"), BSON_SUBTYPE_MD5);
+ zend_declare_class_constant_long(php_phongo_binary_ce, ZEND_STRL("TYPE_ENCRYPTED"), BSON_SUBTYPE_ENCRYPTED);
+ zend_declare_class_constant_long(php_phongo_binary_ce, ZEND_STRL("TYPE_USER_DEFINED"), BSON_SUBTYPE_USER);
+} /* }}} */
+
+/*
+ * 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.8.1/src/BSON/BinaryInterface.c b/mongodb-1.9.0/src/BSON/BinaryInterface.c
similarity index 100%
rename from mongodb-1.8.1/src/BSON/BinaryInterface.c
rename to mongodb-1.9.0/src/BSON/BinaryInterface.c
diff --git a/mongodb-1.9.0/src/BSON/DBPointer.c b/mongodb-1.9.0/src/BSON/DBPointer.c
new file mode 100644
index 00000000..eb1b8082
--- /dev/null
+++ b/mongodb-1.9.0/src/BSON/DBPointer.c
@@ -0,0 +1,344 @@
+/*
+ * 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.
+ */
+
+#include <php.h>
+#include <Zend/zend_interfaces.h>
+#include <ext/standard/php_var.h>
+#include <zend_smart_str.h>
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "phongo_compat.h"
+#include "php_phongo.h"
+#include "php_bson.h"
+
+zend_class_entry* php_phongo_dbpointer_ce;
+
+/* Initialize the object and return whether it was successful. An exception will
+ * be thrown on error. */
+static bool php_phongo_dbpointer_init(php_phongo_dbpointer_t* intern, const char* ref, size_t ref_len, const char* id, size_t id_len) /* {{{ */
+{
+ if (strlen(ref) != (size_t) ref_len) {
+ phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Ref cannot contain null bytes");
+ return false;
+ }
+
+ if (!bson_oid_is_valid(id, id_len)) {
+ phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Error parsing ObjectId string: %s", id);
+ return false;
+ }
+
+ intern->ref = estrndup(ref, ref_len);
+ intern->ref_len = ref_len;
+
+ strncpy(intern->id, id, sizeof(intern->id));
+
+ 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_dbpointer_init_from_hash(php_phongo_dbpointer_t* intern, HashTable* props) /* {{{ */
+{
+ zval *ref, *id;
+
+ if ((ref = zend_hash_str_find(props, "ref", sizeof("ref") - 1)) && Z_TYPE_P(ref) == IS_STRING &&
+ (id = zend_hash_str_find(props, "id", sizeof("id") - 1)) && Z_TYPE_P(id) == IS_STRING) {
+
+ return php_phongo_dbpointer_init(intern, Z_STRVAL_P(ref), Z_STRLEN_P(ref), Z_STRVAL_P(id), Z_STRLEN_P(id));
+ }
+
+ phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "%s initialization requires \"ref\" and \"id\" string fields", ZSTR_VAL(php_phongo_dbpointer_ce->name));
+ return false;
+} /* }}} */
+
+/* {{{ proto string MongoDB\BSON\DBPointer::__toString()
+ Return the DBPointer's namespace string and ObjectId. */
+static PHP_METHOD(DBPointer, __toString)
+{
+ zend_error_handling error_handling;
+ php_phongo_dbpointer_t* intern;
+ char* retval;
+ int retval_len;
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters_none() == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ intern = Z_DBPOINTER_OBJ_P(getThis());
+
+ retval_len = spprintf(&retval, 0, "[%s/%s]", intern->ref, intern->id);
+ RETVAL_STRINGL(retval, retval_len);
+ efree(retval);
+} /* }}} */
+
+/* {{{ proto array MongoDB\BSON\Symbol::jsonSerialize()
+*/
+static PHP_METHOD(DBPointer, jsonSerialize)
+{
+ zend_error_handling error_handling;
+ php_phongo_dbpointer_t* intern;
+ zval zdb_pointer;
+ zval zoid;
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters_none() == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ intern = Z_DBPOINTER_OBJ_P(getThis());
+
+ array_init_size(&zdb_pointer, 2);
+ array_init_size(&zoid, 1);
+ ADD_ASSOC_STRINGL(&zdb_pointer, "$ref", intern->ref, intern->ref_len);
+ ADD_ASSOC_STRING(&zoid, "$oid", intern->id);
+ ADD_ASSOC_ZVAL(&zdb_pointer, "$id", &zoid);
+
+ array_init_size(return_value, 1);
+ ADD_ASSOC_ZVAL(return_value, "$dbPointer", &zdb_pointer);
+} /* }}} */
+
+/* {{{ proto string MongoDB\BSON\DBPointer::serialize()
+*/
+static PHP_METHOD(DBPointer, serialize)
+{
+ zend_error_handling error_handling;
+ php_phongo_dbpointer_t* intern;
+ zval retval;
+ php_serialize_data_t var_hash;
+ smart_str buf = { 0 };
+
+ intern = Z_DBPOINTER_OBJ_P(getThis());
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters_none() == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ array_init_size(&retval, 2);
+ ADD_ASSOC_STRINGL(&retval, "ref", intern->ref, intern->ref_len);
+ ADD_ASSOC_STRING(&retval, "id", intern->id);
+
+ PHP_VAR_SERIALIZE_INIT(var_hash);
+ php_var_serialize(&buf, &retval, &var_hash);
+ smart_str_0(&buf);
+ PHP_VAR_SERIALIZE_DESTROY(var_hash);
+
+ PHONGO_RETVAL_SMART_STR(buf);
+
+ smart_str_free(&buf);
+ zval_ptr_dtor(&retval);
+} /* }}} */
+
+/* {{{ proto void MongoDB\BSON\DBPointer::unserialize(string $serialized)
+*/
+static PHP_METHOD(DBPointer, unserialize)
+{
+ zend_error_handling error_handling;
+ php_phongo_dbpointer_t* intern;
+ char* serialized;
+ size_t serialized_len;
+ zval props;
+ php_unserialize_data_t var_hash;
+
+ intern = Z_DBPOINTER_OBJ_P(getThis());
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &serialized, &serialized_len) == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ PHP_VAR_UNSERIALIZE_INIT(var_hash);
+ if (!php_var_unserialize(&props, (const unsigned char**) &serialized, (unsigned char*) serialized + serialized_len, &var_hash)) {
+ zval_ptr_dtor(&props);
+ phongo_throw_exception(PHONGO_ERROR_UNEXPECTED_VALUE, "%s unserialization failed", ZSTR_VAL(php_phongo_dbpointer_ce->name));
+
+ PHP_VAR_UNSERIALIZE_DESTROY(var_hash);
+ return;
+ }
+ PHP_VAR_UNSERIALIZE_DESTROY(var_hash);
+
+ php_phongo_dbpointer_init_from_hash(intern, HASH_OF(&props));
+ zval_ptr_dtor(&props);
+} /* }}} */
+
+/* {{{ MongoDB\BSON\DBPointer function entries */
+ZEND_BEGIN_ARG_INFO_EX(ai_DBPointer_unserialize, 0, 0, 1)
+ ZEND_ARG_INFO(0, serialized)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(ai_DBPointer_void, 0, 0, 0)
+ZEND_END_ARG_INFO()
+
+static zend_function_entry php_phongo_dbpointer_me[] = {
+ /* clang-format off */
+ /* __set_state intentionally missing */
+ PHP_ME(DBPointer, __toString, ai_DBPointer_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
+ PHP_ME(DBPointer, jsonSerialize, ai_DBPointer_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
+ PHP_ME(DBPointer, serialize, ai_DBPointer_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
+ PHP_ME(DBPointer, unserialize, ai_DBPointer_unserialize, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
+ ZEND_NAMED_ME(__construct, PHP_FN(MongoDB_disabled___construct), ai_DBPointer_void, ZEND_ACC_PRIVATE | ZEND_ACC_FINAL)
+ PHP_FE_END
+ /* clang-format on */
+};
+/* }}} */
+
+/* {{{ MongoDB\BSON\DBPointer object handlers */
+static zend_object_handlers php_phongo_handler_dbpointer;
+
+static void php_phongo_dbpointer_free_object(zend_object* object) /* {{{ */
+{
+ php_phongo_dbpointer_t* intern = Z_OBJ_DBPOINTER(object);
+
+ zend_object_std_dtor(&intern->std);
+
+ if (intern->ref) {
+ efree(intern->ref);
+ }
+
+ if (intern->properties) {
+ zend_hash_destroy(intern->properties);
+ FREE_HASHTABLE(intern->properties);
+ }
+} /* }}} */
+
+zend_object* php_phongo_dbpointer_create_object(zend_class_entry* class_type) /* {{{ */
+{
+ php_phongo_dbpointer_t* intern = NULL;
+
+ intern = PHONGO_ALLOC_OBJECT_T(php_phongo_dbpointer_t, class_type);
+ zend_object_std_init(&intern->std, class_type);
+ object_properties_init(&intern->std, class_type);
+
+ intern->std.handlers = &php_phongo_handler_dbpointer;
+
+ return &intern->std;
+} /* }}} */
+
+static zend_object* php_phongo_dbpointer_clone_object(phongo_compat_object_handler_type* object) /* {{{ */
+{
+ php_phongo_dbpointer_t* intern;
+ php_phongo_dbpointer_t* new_intern;
+ zend_object* new_object;
+
+ intern = Z_OBJ_DBPOINTER(PHONGO_COMPAT_GET_OBJ(object));
+ new_object = php_phongo_dbpointer_create_object(PHONGO_COMPAT_GET_OBJ(object)->ce);
+
+ new_intern = Z_OBJ_DBPOINTER(new_object);
+ zend_objects_clone_members(&new_intern->std, &intern->std);
+
+ php_phongo_dbpointer_init(new_intern, intern->ref, intern->ref_len, intern->id, 24);
+
+ return new_object;
+} /* }}} */
+
+static int php_phongo_dbpointer_compare_objects(zval* o1, zval* o2) /* {{{ */
+{
+ php_phongo_dbpointer_t *intern1, *intern2;
+ int retval;
+
+ ZEND_COMPARE_OBJECTS_FALLBACK(o1, o2);
+
+ intern1 = Z_DBPOINTER_OBJ_P(o1);
+ intern2 = Z_DBPOINTER_OBJ_P(o2);
+
+ retval = strcmp(intern1->ref, intern2->ref);
+
+ if (retval != 0) {
+ return retval;
+ }
+
+ return strcmp(intern1->id, intern2->id);
+} /* }}} */
+
+HashTable* php_phongo_dbpointer_get_properties_hash(phongo_compat_object_handler_type* object, bool is_debug) /* {{{ */
+{
+ php_phongo_dbpointer_t* intern;
+ HashTable* props;
+
+ intern = Z_OBJ_DBPOINTER(PHONGO_COMPAT_GET_OBJ(object));
+
+ PHONGO_GET_PROPERTY_HASH_INIT_PROPS(is_debug, intern, props, 2);
+
+ if (!intern->ref) {
+ return props;
+ }
+
+ {
+ zval ref, id;
+
+ ZVAL_STRING(&ref, intern->ref);
+ ZVAL_STRING(&id, intern->id);
+ zend_hash_str_update(props, "ref", sizeof("ref") - 1, &ref);
+ zend_hash_str_update(props, "id", sizeof("id") - 1, &id);
+ }
+
+ return props;
+} /* }}} */
+
+static HashTable* php_phongo_dbpointer_get_debug_info(phongo_compat_object_handler_type* object, int* is_temp) /* {{{ */
+{
+ *is_temp = 1;
+ return php_phongo_dbpointer_get_properties_hash(object, true);
+} /* }}} */
+
+static HashTable* php_phongo_dbpointer_get_properties(phongo_compat_object_handler_type* object) /* {{{ */
+{
+ return php_phongo_dbpointer_get_properties_hash(object, false);
+} /* }}} */
+/* }}} */
+
+void php_phongo_dbpointer_init_ce(INIT_FUNC_ARGS) /* {{{ */
+{
+ zend_class_entry ce;
+
+ INIT_NS_CLASS_ENTRY(ce, "MongoDB\\BSON", "DBPointer", php_phongo_dbpointer_me);
+ php_phongo_dbpointer_ce = zend_register_internal_class(&ce);
+ php_phongo_dbpointer_ce->create_object = php_phongo_dbpointer_create_object;
+ PHONGO_CE_FINAL(php_phongo_dbpointer_ce);
+
+ zend_class_implements(php_phongo_dbpointer_ce, 1, php_phongo_json_serializable_ce);
+ zend_class_implements(php_phongo_dbpointer_ce, 1, php_phongo_type_ce);
+ zend_class_implements(php_phongo_dbpointer_ce, 1, zend_ce_serializable);
+
+ memcpy(&php_phongo_handler_dbpointer, phongo_get_std_object_handlers(), sizeof(zend_object_handlers));
+ PHONGO_COMPAT_SET_COMPARE_OBJECTS_HANDLER(dbpointer);
+ php_phongo_handler_dbpointer.clone_obj = php_phongo_dbpointer_clone_object;
+ php_phongo_handler_dbpointer.get_debug_info = php_phongo_dbpointer_get_debug_info;
+ php_phongo_handler_dbpointer.get_properties = php_phongo_dbpointer_get_properties;
+ php_phongo_handler_dbpointer.free_obj = php_phongo_dbpointer_free_object;
+ php_phongo_handler_dbpointer.offset = XtOffsetOf(php_phongo_dbpointer_t, std);
+} /* }}} */
+
+/*
+ * 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.9.0/src/BSON/Decimal128.c b/mongodb-1.9.0/src/BSON/Decimal128.c
new file mode 100644
index 00000000..d5d75c7c
--- /dev/null
+++ b/mongodb-1.9.0/src/BSON/Decimal128.c
@@ -0,0 +1,361 @@
+/*
+ * 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.
+ */
+
+#include <php.h>
+#include <Zend/zend_interfaces.h>
+#include <ext/standard/php_var.h>
+#include <zend_smart_str.h>
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "phongo_compat.h"
+#include "php_phongo.h"
+
+zend_class_entry* php_phongo_decimal128_ce;
+
+/* 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) /* {{{ */
+{
+ if (!bson_decimal128_from_string(value, &intern->decimal)) {
+ phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "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) /* {{{ */
+{
+ 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));
+ }
+
+ phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "%s initialization requires \"dec\" string field", ZSTR_VAL(php_phongo_decimal128_ce->name));
+ return false;
+} /* }}} */
+
+/* {{{ proto void MongoDB\BSON\Decimal128::__construct(string $value)
+ Construct a new BSON Decimal128 type */
+static PHP_METHOD(Decimal128, __construct)
+{
+ zend_error_handling error_handling;
+ php_phongo_decimal128_t* intern;
+ char* value;
+ size_t value_len;
+
+ intern = Z_DECIMAL128_OBJ_P(getThis());
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &value, &value_len) == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ php_phongo_decimal128_init(intern, value);
+} /* }}} */
+
+/* {{{ proto void MongoDB\BSON\Decimal128::__set_state(array $properties)
+*/
+static PHP_METHOD(Decimal128, __set_state)
+{
+ zend_error_handling error_handling;
+ php_phongo_decimal128_t* intern;
+ HashTable* props;
+ zval* array;
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "a", &array) == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ 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);
+} /* }}} */
+
+/* {{{ proto string MongoDB\BSON\Decimal128::__toString()
+*/
+static PHP_METHOD(Decimal128, __toString)
+{
+ zend_error_handling error_handling;
+ php_phongo_decimal128_t* intern;
+ char outbuf[BSON_DECIMAL128_STRING];
+
+ intern = Z_DECIMAL128_OBJ_P(getThis());
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters_none() == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ bson_decimal128_to_string(&intern->decimal, outbuf);
+
+ RETURN_STRING(outbuf);
+} /* }}} */
+
+/* {{{ proto array MongoDB\BSON\Decimal128::jsonSerialize()
+*/
+static PHP_METHOD(Decimal128, jsonSerialize)
+{
+ zend_error_handling error_handling;
+ php_phongo_decimal128_t* intern;
+ char outbuf[BSON_DECIMAL128_STRING] = "";
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters_none() == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ 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 MongoDB\BSON\Decimal128::serialize()
+*/
+static PHP_METHOD(Decimal128, serialize)
+{
+ zend_error_handling error_handling;
+ php_phongo_decimal128_t* intern;
+ zval retval;
+ php_serialize_data_t var_hash;
+ smart_str buf = { 0 };
+ char outbuf[BSON_DECIMAL128_STRING];
+
+ intern = Z_DECIMAL128_OBJ_P(getThis());
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters_none() == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ bson_decimal128_to_string(&intern->decimal, outbuf);
+ array_init_size(&retval, 1);
+ ADD_ASSOC_STRING(&retval, "dec", outbuf);
+
+ PHP_VAR_SERIALIZE_INIT(var_hash);
+ php_var_serialize(&buf, &retval, &var_hash);
+ smart_str_0(&buf);
+ PHP_VAR_SERIALIZE_DESTROY(var_hash);
+
+ PHONGO_RETVAL_SMART_STR(buf);
+
+ smart_str_free(&buf);
+ zval_ptr_dtor(&retval);
+} /* }}} */
+
+/* {{{ proto void MongoDB\BSON\Decimal128::unserialize(string $serialized)
+*/
+static PHP_METHOD(Decimal128, unserialize)
+{
+ zend_error_handling error_handling;
+ php_phongo_decimal128_t* intern;
+ char* serialized;
+ size_t serialized_len;
+ zval props;
+ 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);
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &serialized, &serialized_len) == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ PHP_VAR_UNSERIALIZE_INIT(var_hash);
+ if (!php_var_unserialize(&props, (const unsigned char**) &serialized, (unsigned char*) serialized + serialized_len, &var_hash)) {
+ zval_ptr_dtor(&props);
+ phongo_throw_exception(PHONGO_ERROR_UNEXPECTED_VALUE, "%s unserialization failed", ZSTR_VAL(php_phongo_decimal128_ce->name));
+
+ PHP_VAR_UNSERIALIZE_DESTROY(var_hash);
+ return;
+ }
+ PHP_VAR_UNSERIALIZE_DESTROY(var_hash);
+
+ php_phongo_decimal128_init_from_hash(intern, HASH_OF(&props));
+ zval_ptr_dtor(&props);
+} /* }}} */
+
+/* {{{ MongoDB\BSON\Decimal128 function entries */
+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[] = {
+ /* clang-format off */
+ 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
+ /* clang-format on */
+};
+/* }}} */
+
+/* {{{ MongoDB\BSON\Decimal128 object handlers */
+static zend_object_handlers php_phongo_handler_decimal128;
+
+static void php_phongo_decimal128_free_object(zend_object* object) /* {{{ */
+{
+ php_phongo_decimal128_t* intern = Z_OBJ_DECIMAL128(object);
+
+ zend_object_std_dtor(&intern->std);
+
+ if (intern->properties) {
+ zend_hash_destroy(intern->properties);
+ FREE_HASHTABLE(intern->properties);
+ }
+} /* }}} */
+
+static zend_object* php_phongo_decimal128_create_object(zend_class_entry* class_type) /* {{{ */
+{
+ 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);
+ object_properties_init(&intern->std, class_type);
+
+ intern->std.handlers = &php_phongo_handler_decimal128;
+
+ return &intern->std;
+} /* }}} */
+
+static zend_object* php_phongo_decimal128_clone_object(phongo_compat_object_handler_type* object) /* {{{ */
+{
+ php_phongo_decimal128_t* intern;
+ php_phongo_decimal128_t* new_intern;
+ zend_object* new_object;
+
+ intern = Z_OBJ_DECIMAL128(PHONGO_COMPAT_GET_OBJ(object));
+ new_object = php_phongo_decimal128_create_object(PHONGO_COMPAT_GET_OBJ(object)->ce);
+
+ new_intern = Z_OBJ_DECIMAL128(new_object);
+ zend_objects_clone_members(&new_intern->std, &intern->std);
+
+ // Use memcpy to copy bson value to avoid converting to string and back
+ memcpy(&new_intern->decimal, &intern->decimal, sizeof(bson_decimal128_t));
+ new_intern->initialized = true;
+
+ return new_object;
+} /* }}} */
+
+static HashTable* php_phongo_decimal128_get_properties_hash(phongo_compat_object_handler_type* object, bool is_debug) /* {{{ */
+{
+ php_phongo_decimal128_t* intern;
+ HashTable* props;
+ char outbuf[BSON_DECIMAL128_STRING] = "";
+
+ intern = Z_OBJ_DECIMAL128(PHONGO_COMPAT_GET_OBJ(object));
+
+ PHONGO_GET_PROPERTY_HASH_INIT_PROPS(is_debug, intern, props, 1);
+
+ if (!intern->initialized) {
+ return props;
+ }
+
+ bson_decimal128_to_string(&intern->decimal, outbuf);
+
+ {
+ zval dec;
+
+ ZVAL_STRING(&dec, outbuf);
+ zend_hash_str_update(props, "dec", sizeof("dec") - 1, &dec);
+ }
+
+ return props;
+} /* }}} */
+
+static HashTable* php_phongo_decimal128_get_debug_info(phongo_compat_object_handler_type* object, int* is_temp) /* {{{ */
+{
+ *is_temp = 1;
+ return php_phongo_decimal128_get_properties_hash(object, true);
+} /* }}} */
+
+static HashTable* php_phongo_decimal128_get_properties(phongo_compat_object_handler_type* object) /* {{{ */
+{
+ return php_phongo_decimal128_get_properties_hash(object, false);
+} /* }}} */
+/* }}} */
+
+void php_phongo_decimal128_init_ce(INIT_FUNC_ARGS) /* {{{ */
+{
+ zend_class_entry ce;
+
+ INIT_NS_CLASS_ENTRY(ce, "MongoDB\\BSON", "Decimal128", php_phongo_decimal128_me);
+ php_phongo_decimal128_ce = zend_register_internal_class(&ce);
+ 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, 1, php_phongo_decimal128_interface_ce);
+ zend_class_implements(php_phongo_decimal128_ce, 1, php_phongo_json_serializable_ce);
+ zend_class_implements(php_phongo_decimal128_ce, 1, php_phongo_type_ce);
+ zend_class_implements(php_phongo_decimal128_ce, 1, zend_ce_serializable);
+
+ memcpy(&php_phongo_handler_decimal128, phongo_get_std_object_handlers(), sizeof(zend_object_handlers));
+ php_phongo_handler_decimal128.clone_obj = php_phongo_decimal128_clone_object;
+ php_phongo_handler_decimal128.get_debug_info = php_phongo_decimal128_get_debug_info;
+ php_phongo_handler_decimal128.get_properties = php_phongo_decimal128_get_properties;
+ php_phongo_handler_decimal128.free_obj = php_phongo_decimal128_free_object;
+ php_phongo_handler_decimal128.offset = XtOffsetOf(php_phongo_decimal128_t, std);
+} /* }}} */
+
+/*
+ * 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.8.1/src/BSON/Decimal128Interface.c b/mongodb-1.9.0/src/BSON/Decimal128Interface.c
similarity index 100%
rename from mongodb-1.8.1/src/BSON/Decimal128Interface.c
rename to mongodb-1.9.0/src/BSON/Decimal128Interface.c
diff --git a/mongodb-1.9.0/src/BSON/Int64.c b/mongodb-1.9.0/src/BSON/Int64.c
new file mode 100644
index 00000000..2ef0af86
--- /dev/null
+++ b/mongodb-1.9.0/src/BSON/Int64.c
@@ -0,0 +1,322 @@
+/*
+ * Copyright 2018-present 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 <php.h>
+#include <Zend/zend_interfaces.h>
+#include <ext/standard/php_var.h>
+#include <zend_smart_str.h>
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "phongo_compat.h"
+#include "php_phongo.h"
+#include "php_bson.h"
+
+zend_class_entry* php_phongo_int64_ce;
+
+/* Initialize the object and return whether it was successful. */
+static bool php_phongo_int64_init(php_phongo_int64_t* intern, int64_t integer) /* {{{ */
+{
+ intern->integer = integer;
+ 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_int64_init_from_string(php_phongo_int64_t* intern, const char* s_integer, size_t s_integer_len) /* {{{ */
+{
+ int64_t integer;
+
+ if (!php_phongo_parse_int64(&integer, s_integer, s_integer_len)) {
+ phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Error parsing \"%s\" as 64-bit integer for %s initialization", s_integer, ZSTR_VAL(php_phongo_int64_ce->name));
+ return false;
+ }
+
+ return php_phongo_int64_init(intern, integer);
+} /* }}} */
+
+/* Initialize the object from a HashTable and return whether it was successful.
+ * An exception will be thrown on error. */
+static bool php_phongo_int64_init_from_hash(php_phongo_int64_t* intern, HashTable* props) /* {{{ */
+{
+ zval* value;
+
+ if ((value = zend_hash_str_find(props, "integer", sizeof("integer") - 1)) && Z_TYPE_P(value) == IS_STRING) {
+ return php_phongo_int64_init_from_string(intern, Z_STRVAL_P(value), Z_STRLEN_P(value));
+ }
+
+ phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "%s initialization requires \"integer\" string field", ZSTR_VAL(php_phongo_int64_ce->name));
+ return false;
+} /* }}} */
+
+/* {{{ proto string MongoDB\BSON\Int64::__toString()
+ Return the Int64's value as a string. */
+static PHP_METHOD(Int64, __toString)
+{
+ zend_error_handling error_handling;
+ php_phongo_int64_t* intern;
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters_none() == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ intern = Z_INT64_OBJ_P(getThis());
+
+ ZVAL_INT64_STRING(return_value, intern->integer);
+} /* }}} */
+
+/* {{{ proto array MongoDB\BSON\Int64::jsonSerialize()
+*/
+static PHP_METHOD(Int64, jsonSerialize)
+{
+ zend_error_handling error_handling;
+ php_phongo_int64_t* intern;
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters_none() == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ intern = Z_INT64_OBJ_P(getThis());
+
+ array_init_size(return_value, 1);
+
+ ADD_ASSOC_INT64_AS_STRING(return_value, "$numberLong", intern->integer);
+} /* }}} */
+
+/* {{{ proto string MongoDB\BSON\Int64::serialize()
+*/
+static PHP_METHOD(Int64, serialize)
+{
+ zend_error_handling error_handling;
+ php_phongo_int64_t* intern;
+ zval retval;
+ php_serialize_data_t var_hash;
+ smart_str buf = { 0 };
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters_none() == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ intern = Z_INT64_OBJ_P(getThis());
+
+ array_init_size(&retval, 1);
+ ADD_ASSOC_INT64_AS_STRING(&retval, "integer", intern->integer);
+
+ PHP_VAR_SERIALIZE_INIT(var_hash);
+ php_var_serialize(&buf, &retval, &var_hash);
+ smart_str_0(&buf);
+ PHP_VAR_SERIALIZE_DESTROY(var_hash);
+
+ PHONGO_RETVAL_SMART_STR(buf);
+
+ smart_str_free(&buf);
+ zval_ptr_dtor(&retval);
+} /* }}} */
+
+/* {{{ proto void MongoDB\BSON\Int64::unserialize(string $serialized)
+*/
+static PHP_METHOD(Int64, unserialize)
+{
+ zend_error_handling error_handling;
+ php_phongo_int64_t* intern;
+ char* serialized;
+ size_t serialized_len;
+ zval props;
+ php_unserialize_data_t var_hash;
+
+ intern = Z_INT64_OBJ_P(getThis());
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &serialized, &serialized_len) == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ PHP_VAR_UNSERIALIZE_INIT(var_hash);
+ if (!php_var_unserialize(&props, (const unsigned char**) &serialized, (unsigned char*) serialized + serialized_len, &var_hash)) {
+ zval_ptr_dtor(&props);
+ phongo_throw_exception(PHONGO_ERROR_UNEXPECTED_VALUE, "%s unserialization failed", ZSTR_VAL(php_phongo_int64_ce->name));
+
+ PHP_VAR_UNSERIALIZE_DESTROY(var_hash);
+ return;
+ }
+ PHP_VAR_UNSERIALIZE_DESTROY(var_hash);
+
+ php_phongo_int64_init_from_hash(intern, HASH_OF(&props));
+ zval_ptr_dtor(&props);
+} /* }}} */
+
+/* {{{ MongoDB\BSON\Int64 function entries */
+ZEND_BEGIN_ARG_INFO_EX(ai_Int64_unserialize, 0, 0, 1)
+ ZEND_ARG_INFO(0, serialized)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(ai_Int64_void, 0, 0, 0)
+ZEND_END_ARG_INFO()
+
+static zend_function_entry php_phongo_int64_me[] = {
+ /* clang-format off */
+ /* __set_state intentionally missing */
+ PHP_ME(Int64, __toString, ai_Int64_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
+ PHP_ME(Int64, jsonSerialize, ai_Int64_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
+ PHP_ME(Int64, serialize, ai_Int64_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
+ PHP_ME(Int64, unserialize, ai_Int64_unserialize, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
+ ZEND_NAMED_ME(__construct, PHP_FN(MongoDB_disabled___construct), ai_Int64_void, ZEND_ACC_PRIVATE | ZEND_ACC_FINAL)
+ PHP_FE_END
+ /* clang-format on */
+};
+/* }}} */
+
+/* {{{ MongoDB\BSON\Int64 object handlers */
+static zend_object_handlers php_phongo_handler_int64;
+
+static void php_phongo_int64_free_object(zend_object* object) /* {{{ */
+{
+ php_phongo_int64_t* intern = Z_OBJ_INT64(object);
+
+ zend_object_std_dtor(&intern->std);
+
+ if (intern->properties) {
+ zend_hash_destroy(intern->properties);
+ FREE_HASHTABLE(intern->properties);
+ }
+} /* }}} */
+
+zend_object* php_phongo_int64_create_object(zend_class_entry* class_type) /* {{{ */
+{
+ php_phongo_int64_t* intern = NULL;
+
+ intern = PHONGO_ALLOC_OBJECT_T(php_phongo_int64_t, class_type);
+ zend_object_std_init(&intern->std, class_type);
+ object_properties_init(&intern->std, class_type);
+
+ intern->std.handlers = &php_phongo_handler_int64;
+
+ return &intern->std;
+} /* }}} */
+
+static zend_object* php_phongo_int64_clone_object(phongo_compat_object_handler_type* object) /* {{{ */
+{
+ php_phongo_int64_t* intern;
+ php_phongo_int64_t* new_intern;
+ zend_object* new_object;
+
+ intern = Z_OBJ_INT64(PHONGO_COMPAT_GET_OBJ(object));
+ new_object = php_phongo_int64_create_object(PHONGO_COMPAT_GET_OBJ(object)->ce);
+
+ new_intern = Z_OBJ_INT64(new_object);
+ zend_objects_clone_members(&new_intern->std, &intern->std);
+
+ php_phongo_int64_init(new_intern, intern->integer);
+
+ return new_object;
+} /* }}} */
+
+static int php_phongo_int64_compare_objects(zval* o1, zval* o2) /* {{{ */
+{
+ php_phongo_int64_t *intern1, *intern2;
+
+ ZEND_COMPARE_OBJECTS_FALLBACK(o1, o2);
+
+ intern1 = Z_INT64_OBJ_P(o1);
+ intern2 = Z_INT64_OBJ_P(o2);
+
+ if (intern1->integer != intern2->integer) {
+ return intern1->integer < intern2->integer ? -1 : 1;
+ }
+
+ return 0;
+} /* }}} */
+
+HashTable* php_phongo_int64_get_properties_hash(phongo_compat_object_handler_type* object, bool is_debug) /* {{{ */
+{
+ php_phongo_int64_t* intern;
+ HashTable* props;
+
+ intern = Z_OBJ_INT64(PHONGO_COMPAT_GET_OBJ(object));
+
+ PHONGO_GET_PROPERTY_HASH_INIT_PROPS(is_debug, intern, props, 2);
+
+ if (!intern->initialized) {
+ return props;
+ }
+
+ {
+ zval value;
+
+ ZVAL_INT64_STRING(&value, intern->integer);
+ zend_hash_str_update(props, "integer", sizeof("integer") - 1, &value);
+ }
+
+ return props;
+} /* }}} */
+
+static HashTable* php_phongo_int64_get_debug_info(phongo_compat_object_handler_type* object, int* is_temp) /* {{{ */
+{
+ *is_temp = 1;
+ return php_phongo_int64_get_properties_hash(object, true);
+} /* }}} */
+
+static HashTable* php_phongo_int64_get_properties(phongo_compat_object_handler_type* object) /* {{{ */
+{
+ return php_phongo_int64_get_properties_hash(object, false);
+} /* }}} */
+/* }}} */
+
+void php_phongo_int64_init_ce(INIT_FUNC_ARGS) /* {{{ */
+{
+ zend_class_entry ce;
+
+ INIT_NS_CLASS_ENTRY(ce, "MongoDB\\BSON", "Int64", php_phongo_int64_me);
+ php_phongo_int64_ce = zend_register_internal_class(&ce);
+ php_phongo_int64_ce->create_object = php_phongo_int64_create_object;
+ PHONGO_CE_FINAL(php_phongo_int64_ce);
+
+ zend_class_implements(php_phongo_int64_ce, 1, php_phongo_json_serializable_ce);
+ zend_class_implements(php_phongo_int64_ce, 1, php_phongo_type_ce);
+ zend_class_implements(php_phongo_int64_ce, 1, zend_ce_serializable);
+
+ memcpy(&php_phongo_handler_int64, phongo_get_std_object_handlers(), sizeof(zend_object_handlers));
+ PHONGO_COMPAT_SET_COMPARE_OBJECTS_HANDLER(int64);
+ php_phongo_handler_int64.clone_obj = php_phongo_int64_clone_object;
+ php_phongo_handler_int64.get_debug_info = php_phongo_int64_get_debug_info;
+ php_phongo_handler_int64.get_properties = php_phongo_int64_get_properties;
+ php_phongo_handler_int64.free_obj = php_phongo_int64_free_object;
+ php_phongo_handler_int64.offset = XtOffsetOf(php_phongo_int64_t, std);
+} /* }}} */
+
+/*
+ * 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.9.0/src/BSON/Javascript.c b/mongodb-1.9.0/src/BSON/Javascript.c
new file mode 100644
index 00000000..1b6bfd87
--- /dev/null
+++ b/mongodb-1.9.0/src/BSON/Javascript.c
@@ -0,0 +1,494 @@
+/*
+ * 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.
+ */
+
+#include <php.h>
+#include <Zend/zend_interfaces.h>
+#include <ext/standard/php_var.h>
+#include <zend_smart_str.h>
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "phongo_compat.h"
+#include "php_phongo.h"
+#include "php_bson.h"
+
+zend_class_entry* php_phongo_javascript_ce;
+
+/* 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, size_t code_len, zval* scope) /* {{{ */
+{
+ 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, "Expected scope to be array or object, %s given", zend_get_type_by_const(Z_TYPE_P(scope)));
+ return false;
+ }
+
+ if (strlen(code) != (size_t) code_len) {
+ phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "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();
+ php_phongo_zval_to_bson(scope, PHONGO_BSON_NONE, intern->scope, NULL);
+ } 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) /* {{{ */
+{
+ 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);
+ }
+
+ phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "%s initialization requires \"code\" string field", ZSTR_VAL(php_phongo_javascript_ce->name));
+ return false;
+} /* }}} */
+
+/* {{{ proto void MongoDB\BSON\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. */
+static PHP_METHOD(Javascript, __construct)
+{
+ zend_error_handling error_handling;
+ php_phongo_javascript_t* intern;
+ char* code;
+ size_t code_len;
+ zval* scope = NULL;
+
+ intern = Z_JAVASCRIPT_OBJ_P(getThis());
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|A!", &code, &code_len, &scope) == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ php_phongo_javascript_init(intern, code, code_len, scope);
+} /* }}} */
+
+/* {{{ proto void MongoDB\BSON\Javascript::__set_state(array $properties)
+*/
+static PHP_METHOD(Javascript, __set_state)
+{
+ zend_error_handling error_handling;
+ php_phongo_javascript_t* intern;
+ HashTable* props;
+ zval* array;
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "a", &array) == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ 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);
+} /* }}} */
+
+/* {{{ proto string MongoDB\BSON\Javascript::__toString()
+ Return the Javascript's code string. */
+static PHP_METHOD(Javascript, __toString)
+{
+ zend_error_handling error_handling;
+ php_phongo_javascript_t* intern;
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters_none() == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ intern = Z_JAVASCRIPT_OBJ_P(getThis());
+
+ RETURN_STRINGL(intern->code, intern->code_len);
+} /* }}} */
+
+/* {{{ proto string MongoDB\BSON\Javascript::getCode()
+*/
+static PHP_METHOD(Javascript, getCode)
+{
+ zend_error_handling error_handling;
+ php_phongo_javascript_t* intern;
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters_none() == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ intern = Z_JAVASCRIPT_OBJ_P(getThis());
+
+ RETURN_STRINGL(intern->code, intern->code_len);
+} /* }}} */
+
+/* {{{ proto object|null MongoDB\BSON\Javascript::getScope()
+*/
+static PHP_METHOD(Javascript, getScope)
+{
+ zend_error_handling error_handling;
+ php_phongo_javascript_t* intern;
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters_none() == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ intern = Z_JAVASCRIPT_OBJ_P(getThis());
+
+ if (!intern->scope) {
+ RETURN_NULL();
+ }
+
+ if (intern->scope->len) {
+ php_phongo_bson_state state;
+
+ PHONGO_BSON_INIT_STATE(state);
+
+ if (!php_phongo_bson_to_zval_ex(bson_get_data(intern->scope), intern->scope->len, &state)) {
+ zval_ptr_dtor(&state.zchild);
+ return;
+ }
+
+ RETURN_ZVAL(&state.zchild, 0, 1);
+ } else {
+ RETURN_NULL();
+ }
+} /* }}} */
+
+/* {{{ proto array MongoDB\BSON\Javascript::jsonSerialize()
+*/
+static PHP_METHOD(Javascript, jsonSerialize)
+{
+ zend_error_handling error_handling;
+ php_phongo_javascript_t* intern;
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters_none() == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ 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_INIT_STATE(state);
+ if (!php_phongo_bson_to_zval_ex(bson_get_data(intern->scope), intern->scope->len, &state)) {
+ zval_ptr_dtor(&state.zchild);
+ return;
+ }
+
+ ADD_ASSOC_ZVAL_EX(return_value, "$scope", &state.zchild);
+ }
+} /* }}} */
+
+/* {{{ proto string MongoDB\BSON\Javascript::serialize()
+*/
+static PHP_METHOD(Javascript, serialize)
+{
+ zend_error_handling error_handling;
+ php_phongo_javascript_t* intern;
+ zval retval;
+ php_phongo_bson_state state;
+ php_serialize_data_t var_hash;
+ smart_str buf = { 0 };
+
+ PHONGO_BSON_INIT_STATE(state);
+
+ intern = Z_JAVASCRIPT_OBJ_P(getThis());
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters_none() == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ if (intern->scope && intern->scope->len) {
+ if (!php_phongo_bson_to_zval_ex(bson_get_data(intern->scope), intern->scope->len, &state)) {
+ zval_ptr_dtor(&state.zchild);
+ return;
+ }
+ } else {
+ ZVAL_NULL(&state.zchild);
+ }
+
+ array_init_size(&retval, 2);
+ ADD_ASSOC_STRINGL(&retval, "code", intern->code, intern->code_len);
+ ADD_ASSOC_ZVAL(&retval, "scope", &state.zchild);
+
+ PHP_VAR_SERIALIZE_INIT(var_hash);
+ php_var_serialize(&buf, &retval, &var_hash);
+ smart_str_0(&buf);
+ PHP_VAR_SERIALIZE_DESTROY(var_hash);
+
+ PHONGO_RETVAL_SMART_STR(buf);
+
+ smart_str_free(&buf);
+ zval_ptr_dtor(&retval);
+} /* }}} */
+
+/* {{{ proto void MongoDB\BSON\Javascript::unserialize(string $serialized)
+*/
+static PHP_METHOD(Javascript, unserialize)
+{
+ zend_error_handling error_handling;
+ php_phongo_javascript_t* intern;
+ char* serialized;
+ size_t serialized_len;
+ zval props;
+ 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);
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &serialized, &serialized_len) == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ PHP_VAR_UNSERIALIZE_INIT(var_hash);
+ if (!php_var_unserialize(&props, (const unsigned char**) &serialized, (unsigned char*) serialized + serialized_len, &var_hash)) {
+ zval_ptr_dtor(&props);
+ phongo_throw_exception(PHONGO_ERROR_UNEXPECTED_VALUE, "%s unserialization failed", ZSTR_VAL(php_phongo_javascript_ce->name));
+
+ PHP_VAR_UNSERIALIZE_DESTROY(var_hash);
+ return;
+ }
+ PHP_VAR_UNSERIALIZE_DESTROY(var_hash);
+
+ php_phongo_javascript_init_from_hash(intern, HASH_OF(&props));
+ zval_ptr_dtor(&props);
+} /* }}} */
+
+/* {{{ MongoDB\BSON\Javascript function entries */
+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[] = {
+ /* clang-format off */
+ 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
+ /* clang-format on */
+};
+/* }}} */
+
+/* {{{ MongoDB\BSON\Javascript object handlers */
+static zend_object_handlers php_phongo_handler_javascript;
+
+static void php_phongo_javascript_free_object(zend_object* object) /* {{{ */
+{
+ php_phongo_javascript_t* intern = Z_OBJ_JAVASCRIPT(object);
+
+ zend_object_std_dtor(&intern->std);
+
+ if (intern->code) {
+ efree(intern->code);
+ }
+ if (intern->scope) {
+ bson_destroy(intern->scope);
+ intern->scope = NULL;
+ }
+
+ if (intern->properties) {
+ zend_hash_destroy(intern->properties);
+ FREE_HASHTABLE(intern->properties);
+ }
+} /* }}} */
+
+zend_object* php_phongo_javascript_create_object(zend_class_entry* class_type) /* {{{ */
+{
+ 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);
+ object_properties_init(&intern->std, class_type);
+
+ intern->std.handlers = &php_phongo_handler_javascript;
+
+ return &intern->std;
+} /* }}} */
+
+static zend_object* php_phongo_javascript_clone_object(phongo_compat_object_handler_type* object) /* {{{ */
+{
+ php_phongo_javascript_t* intern;
+ php_phongo_javascript_t* new_intern;
+ zend_object* new_object;
+
+ intern = Z_OBJ_JAVASCRIPT(PHONGO_COMPAT_GET_OBJ(object));
+ new_object = php_phongo_javascript_create_object(PHONGO_COMPAT_GET_OBJ(object)->ce);
+
+ new_intern = Z_OBJ_JAVASCRIPT(new_object);
+ zend_objects_clone_members(&new_intern->std, &intern->std);
+
+ php_phongo_javascript_init(new_intern, intern->code, intern->code_len, NULL);
+ new_intern->scope = bson_copy(intern->scope);
+
+ return new_object;
+} /* }}} */
+
+static int php_phongo_javascript_compare_objects(zval* o1, zval* o2) /* {{{ */
+{
+ php_phongo_javascript_t *intern1, *intern2;
+
+ ZEND_COMPARE_OBJECTS_FALLBACK(o1, o2);
+
+ 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);
+} /* }}} */
+
+HashTable* php_phongo_javascript_get_properties_hash(phongo_compat_object_handler_type* object, bool is_debug) /* {{{ */
+{
+ php_phongo_javascript_t* intern;
+ HashTable* props;
+
+ intern = Z_OBJ_JAVASCRIPT(PHONGO_COMPAT_GET_OBJ(object));
+
+ PHONGO_GET_PROPERTY_HASH_INIT_PROPS(is_debug, intern, props, 2);
+
+ if (!intern->code) {
+ return props;
+ }
+
+ {
+ 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_INIT_STATE(state);
+ if (!php_phongo_bson_to_zval_ex(bson_get_data(intern->scope), intern->scope->len, &state)) {
+ zval_ptr_dtor(&state.zchild);
+ goto failure;
+ }
+
+ 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);
+ }
+ }
+
+ return props;
+
+failure:
+ PHONGO_GET_PROPERTY_HASH_FREE_PROPS(is_debug, props);
+ return NULL;
+} /* }}} */
+
+static HashTable* php_phongo_javascript_get_debug_info(phongo_compat_object_handler_type* object, int* is_temp) /* {{{ */
+{
+ *is_temp = 1;
+ return php_phongo_javascript_get_properties_hash(object, true);
+} /* }}} */
+
+static HashTable* php_phongo_javascript_get_properties(phongo_compat_object_handler_type* object) /* {{{ */
+{
+ return php_phongo_javascript_get_properties_hash(object, false);
+} /* }}} */
+/* }}} */
+
+void php_phongo_javascript_init_ce(INIT_FUNC_ARGS) /* {{{ */
+{
+ zend_class_entry ce;
+
+ INIT_NS_CLASS_ENTRY(ce, "MongoDB\\BSON", "Javascript", php_phongo_javascript_me);
+ php_phongo_javascript_ce = zend_register_internal_class(&ce);
+ 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, 1, php_phongo_javascript_interface_ce);
+ zend_class_implements(php_phongo_javascript_ce, 1, php_phongo_json_serializable_ce);
+ zend_class_implements(php_phongo_javascript_ce, 1, php_phongo_type_ce);
+ zend_class_implements(php_phongo_javascript_ce, 1, zend_ce_serializable);
+
+ memcpy(&php_phongo_handler_javascript, phongo_get_std_object_handlers(), sizeof(zend_object_handlers));
+ PHONGO_COMPAT_SET_COMPARE_OBJECTS_HANDLER(javascript);
+ php_phongo_handler_javascript.clone_obj = php_phongo_javascript_clone_object;
+ php_phongo_handler_javascript.get_debug_info = php_phongo_javascript_get_debug_info;
+ php_phongo_handler_javascript.get_properties = php_phongo_javascript_get_properties;
+ php_phongo_handler_javascript.free_obj = php_phongo_javascript_free_object;
+ php_phongo_handler_javascript.offset = XtOffsetOf(php_phongo_javascript_t, std);
+} /* }}} */
+
+/*
+ * 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.8.1/src/BSON/JavascriptInterface.c b/mongodb-1.9.0/src/BSON/JavascriptInterface.c
similarity index 100%
rename from mongodb-1.8.1/src/BSON/JavascriptInterface.c
rename to mongodb-1.9.0/src/BSON/JavascriptInterface.c
diff --git a/mongodb-1.9.0/src/BSON/MaxKey.c b/mongodb-1.9.0/src/BSON/MaxKey.c
new file mode 100644
index 00000000..7e20867e
--- /dev/null
+++ b/mongodb-1.9.0/src/BSON/MaxKey.c
@@ -0,0 +1,172 @@
+/*
+ * 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.
+ */
+
+#include <php.h>
+#include <Zend/zend_interfaces.h>
+#include <ext/standard/php_var.h>
+#include <zend_smart_str.h>
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "phongo_compat.h"
+#include "php_phongo.h"
+
+zend_class_entry* php_phongo_maxkey_ce;
+
+/* {{{ proto void MongoDB\BSON\MaxKey::__set_state(array $properties)
+*/
+static PHP_METHOD(MaxKey, __set_state)
+{
+ zend_error_handling error_handling;
+ zval* array;
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "a", &array) == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ object_init_ex(return_value, php_phongo_maxkey_ce);
+} /* }}} */
+
+/* {{{ proto array MongoDB\BSON\MaxKey::jsonSerialize()
+*/
+static PHP_METHOD(MaxKey, jsonSerialize)
+{
+ zend_error_handling error_handling;
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters_none() == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ array_init_size(return_value, 1);
+ ADD_ASSOC_LONG_EX(return_value, "$maxKey", 1);
+} /* }}} */
+
+/* {{{ proto string MongoDB\BSON\MaxKey::serialize()
+*/
+static PHP_METHOD(MaxKey, serialize)
+{
+ zend_error_handling error_handling;
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters_none() == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ RETURN_STRING("");
+} /* }}} */
+
+/* {{{ proto void MongoDB\BSON\MaxKey::unserialize(string $serialized)
+*/
+static PHP_METHOD(MaxKey, unserialize)
+{
+ zend_error_handling error_handling;
+ char* serialized;
+ size_t serialized_len;
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &serialized, &serialized_len) == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+} /* }}} */
+
+/* {{{ MongoDB\BSON\MaxKey function entries */
+ZEND_BEGIN_ARG_INFO_EX(ai_MaxKey___set_state, 0, 0, 1)
+ ZEND_ARG_ARRAY_INFO(0, properties, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(ai_MaxKey_unserialize, 0, 0, 1)
+ ZEND_ARG_INFO(0, serialized)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(ai_MaxKey_void, 0, 0, 0)
+ZEND_END_ARG_INFO()
+
+static zend_function_entry php_phongo_maxkey_me[] = {
+ /* clang-format off */
+ PHP_ME(MaxKey, __set_state, ai_MaxKey___set_state, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
+ PHP_ME(MaxKey, jsonSerialize, ai_MaxKey_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
+ PHP_ME(MaxKey, serialize, ai_MaxKey_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
+ PHP_ME(MaxKey, unserialize, ai_MaxKey_unserialize, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
+ PHP_FE_END
+ /* clang-format on */
+};
+/* }}} */
+
+/* {{{ MongoDB\BSON\MaxKey object handlers */
+static zend_object_handlers php_phongo_handler_maxkey;
+
+static void php_phongo_maxkey_free_object(zend_object* object) /* {{{ */
+{
+ php_phongo_maxkey_t* intern = Z_OBJ_MAXKEY(object);
+
+ zend_object_std_dtor(&intern->std);
+} /* }}} */
+
+static zend_object* php_phongo_maxkey_create_object(zend_class_entry* class_type) /* {{{ */
+{
+ php_phongo_maxkey_t* intern = NULL;
+
+ intern = PHONGO_ALLOC_OBJECT_T(php_phongo_maxkey_t, class_type);
+ zend_object_std_init(&intern->std, class_type);
+ object_properties_init(&intern->std, class_type);
+
+ intern->std.handlers = &php_phongo_handler_maxkey;
+
+ return &intern->std;
+} /* }}} */
+/* }}} */
+
+void php_phongo_maxkey_init_ce(INIT_FUNC_ARGS) /* {{{ */
+{
+ zend_class_entry ce;
+
+ INIT_NS_CLASS_ENTRY(ce, "MongoDB\\BSON", "MaxKey", php_phongo_maxkey_me);
+ php_phongo_maxkey_ce = zend_register_internal_class(&ce);
+ php_phongo_maxkey_ce->create_object = php_phongo_maxkey_create_object;
+ PHONGO_CE_FINAL(php_phongo_maxkey_ce);
+
+ zend_class_implements(php_phongo_maxkey_ce, 1, php_phongo_maxkey_interface_ce);
+ zend_class_implements(php_phongo_maxkey_ce, 1, php_phongo_json_serializable_ce);
+ zend_class_implements(php_phongo_maxkey_ce, 1, php_phongo_type_ce);
+ zend_class_implements(php_phongo_maxkey_ce, 1, zend_ce_serializable);
+
+ memcpy(&php_phongo_handler_maxkey, phongo_get_std_object_handlers(), sizeof(zend_object_handlers));
+ /* Re-assign default handler previously removed in php_phongo.c */
+ php_phongo_handler_maxkey.clone_obj = zend_objects_clone_obj;
+ php_phongo_handler_maxkey.free_obj = php_phongo_maxkey_free_object;
+ php_phongo_handler_maxkey.offset = XtOffsetOf(php_phongo_maxkey_t, std);
+} /* }}} */
+
+/*
+ * 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.8.1/src/BSON/MaxKeyInterface.c b/mongodb-1.9.0/src/BSON/MaxKeyInterface.c
similarity index 100%
rename from mongodb-1.8.1/src/BSON/MaxKeyInterface.c
rename to mongodb-1.9.0/src/BSON/MaxKeyInterface.c
diff --git a/mongodb-1.9.0/src/BSON/MinKey.c b/mongodb-1.9.0/src/BSON/MinKey.c
new file mode 100644
index 00000000..cfcee384
--- /dev/null
+++ b/mongodb-1.9.0/src/BSON/MinKey.c
@@ -0,0 +1,173 @@
+/*
+ * 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.
+ */
+
+#include <php.h>
+#include <Zend/zend_interfaces.h>
+#include <ext/standard/php_var.h>
+#include <zend_smart_str.h>
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "phongo_compat.h"
+#include "php_phongo.h"
+
+zend_class_entry* php_phongo_minkey_ce;
+
+/* {{{ proto void MongoDB\BSON\MinKey::__set_state(array $properties)
+*/
+static PHP_METHOD(MinKey, __set_state)
+{
+ zend_error_handling error_handling;
+ zval* array;
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "a", &array) == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ object_init_ex(return_value, php_phongo_minkey_ce);
+} /* }}} */
+
+/* {{{ proto array MongoDB\BSON\MinKey::jsonSerialize()
+*/
+static PHP_METHOD(MinKey, jsonSerialize)
+{
+ zend_error_handling error_handling;
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters_none() == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ array_init_size(return_value, 1);
+ ADD_ASSOC_LONG_EX(return_value, "$minKey", 1);
+} /* }}} */
+
+/* {{{ proto string MongoDB\BSON\MinKey::serialize()
+*/
+static PHP_METHOD(MinKey, serialize)
+{
+ zend_error_handling error_handling;
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters_none() == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ RETURN_STRING("");
+} /* }}} */
+
+/* {{{ proto void MongoDB\BSON\MinKey::unserialize(string $serialized)
+*/
+static PHP_METHOD(MinKey, unserialize)
+{
+ zend_error_handling error_handling;
+ char* serialized;
+ size_t serialized_len;
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &serialized, &serialized_len) == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+} /* }}} */
+
+/* {{{ MongoDB\BSON\MinKey function entries */
+ZEND_BEGIN_ARG_INFO_EX(ai_MinKey___set_state, 0, 0, 1)
+ ZEND_ARG_ARRAY_INFO(0, properties, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(ai_MinKey_unserialize, 0, 0, 1)
+ ZEND_ARG_INFO(0, serialized)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(ai_MinKey_void, 0, 0, 0)
+ZEND_END_ARG_INFO()
+
+static zend_function_entry php_phongo_minkey_me[] = {
+ /* clang-format off */
+ PHP_ME(MinKey, __set_state, ai_MinKey___set_state, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
+ PHP_ME(MinKey, jsonSerialize, ai_MinKey_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
+ PHP_ME(MinKey, serialize, ai_MinKey_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
+ PHP_ME(MinKey, unserialize, ai_MinKey_unserialize, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
+ PHP_FE_END
+ /* clang-format on */
+};
+/* }}} */
+
+/* {{{ MongoDB\BSON\MinKey object handlers */
+static zend_object_handlers php_phongo_handler_minkey;
+
+static void php_phongo_minkey_free_object(zend_object* object) /* {{{ */
+{
+ php_phongo_minkey_t* intern = Z_OBJ_MINKEY(object);
+
+ zend_object_std_dtor(&intern->std);
+} /* }}} */
+
+static zend_object* php_phongo_minkey_create_object(zend_class_entry* class_type) /* {{{ */
+{
+ php_phongo_minkey_t* intern = NULL;
+
+ intern = PHONGO_ALLOC_OBJECT_T(php_phongo_minkey_t, class_type);
+
+ zend_object_std_init(&intern->std, class_type);
+ object_properties_init(&intern->std, class_type);
+
+ intern->std.handlers = &php_phongo_handler_minkey;
+
+ return &intern->std;
+} /* }}} */
+/* }}} */
+
+void php_phongo_minkey_init_ce(INIT_FUNC_ARGS) /* {{{ */
+{
+ zend_class_entry ce;
+
+ INIT_NS_CLASS_ENTRY(ce, "MongoDB\\BSON", "MinKey", php_phongo_minkey_me);
+ php_phongo_minkey_ce = zend_register_internal_class(&ce);
+ php_phongo_minkey_ce->create_object = php_phongo_minkey_create_object;
+ PHONGO_CE_FINAL(php_phongo_minkey_ce);
+
+ zend_class_implements(php_phongo_minkey_ce, 1, php_phongo_minkey_interface_ce);
+ zend_class_implements(php_phongo_minkey_ce, 1, php_phongo_json_serializable_ce);
+ zend_class_implements(php_phongo_minkey_ce, 1, php_phongo_type_ce);
+ zend_class_implements(php_phongo_minkey_ce, 1, zend_ce_serializable);
+
+ memcpy(&php_phongo_handler_minkey, phongo_get_std_object_handlers(), sizeof(zend_object_handlers));
+ /* Re-assign default handler previously removed in php_phongo.c */
+ php_phongo_handler_minkey.clone_obj = zend_objects_clone_obj;
+ php_phongo_handler_minkey.free_obj = php_phongo_minkey_free_object;
+ php_phongo_handler_minkey.offset = XtOffsetOf(php_phongo_minkey_t, std);
+} /* }}} */
+
+/*
+ * 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.8.1/src/BSON/MinKeyInterface.c b/mongodb-1.9.0/src/BSON/MinKeyInterface.c
similarity index 100%
rename from mongodb-1.8.1/src/BSON/MinKeyInterface.c
rename to mongodb-1.9.0/src/BSON/MinKeyInterface.c
diff --git a/mongodb-1.9.0/src/BSON/ObjectId.c b/mongodb-1.9.0/src/BSON/ObjectId.c
new file mode 100644
index 00000000..78a7ebd6
--- /dev/null
+++ b/mongodb-1.9.0/src/BSON/ObjectId.c
@@ -0,0 +1,415 @@
+/*
+ * 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.
+ */
+
+#include <php.h>
+#include <Zend/zend_interfaces.h>
+#include <ext/standard/php_var.h>
+#include <zend_smart_str.h>
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "phongo_compat.h"
+#include "php_phongo.h"
+
+#define PHONGO_OID_SIZE sizeof(((php_phongo_objectid_t*) 0)->oid)
+#define PHONGO_OID_LEN (PHONGO_OID_SIZE - 1)
+
+zend_class_entry* php_phongo_objectid_ce;
+
+/* 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* hex, size_t hex_len) /* {{{ */
+{
+ if (bson_oid_is_valid(hex, hex_len)) {
+ bson_oid_t oid;
+
+ bson_oid_init_from_string(&oid, hex);
+ bson_oid_to_string(&oid, intern->oid);
+ intern->initialized = true;
+
+ return true;
+ }
+
+ phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Error parsing ObjectId string: %s", hex);
+
+ 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) /* {{{ */
+{
+ 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));
+ }
+
+ phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "%s initialization requires \"oid\" string field", ZSTR_VAL(php_phongo_objectid_ce->name));
+ return false;
+} /* }}} */
+
+/* {{{ proto void MongoDB\BSON\ObjectId::__construct([string $id])
+ Constructs a new BSON ObjectId type, optionally from a hex string. */
+static PHP_METHOD(ObjectId, __construct)
+{
+ zend_error_handling error_handling;
+ php_phongo_objectid_t* intern;
+ char* id = NULL;
+ size_t id_len;
+
+ intern = Z_OBJECTID_OBJ_P(getThis());
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "|s!", &id, &id_len) == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ if (id) {
+ php_phongo_objectid_init_from_hex_string(intern, id, id_len);
+ } else {
+ php_phongo_objectid_init(intern);
+ }
+} /* }}} */
+
+/* {{{ proto integer MongoDB\BSON\ObjectId::getTimestamp()
+*/
+static PHP_METHOD(ObjectId, getTimestamp)
+{
+ zend_error_handling error_handling;
+ php_phongo_objectid_t* intern;
+ bson_oid_t tmp_oid;
+
+ intern = Z_OBJECTID_OBJ_P(getThis());
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters_none() == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ bson_oid_init_from_string(&tmp_oid, intern->oid);
+ RETVAL_LONG(bson_oid_get_time_t(&tmp_oid));
+} /* }}} */
+
+/* {{{ proto MongoDB\BSON\ObjectId::__set_state(array $properties)
+*/
+static PHP_METHOD(ObjectId, __set_state)
+{
+ zend_error_handling error_handling;
+ php_phongo_objectid_t* intern;
+ HashTable* props;
+ zval* array;
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "a", &array) == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ 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);
+} /* }}} */
+
+/* {{{ proto string MongoDB\BSON\ObjectId::__toString()
+*/
+static PHP_METHOD(ObjectId, __toString)
+{
+ zend_error_handling error_handling;
+ php_phongo_objectid_t* intern;
+
+ intern = Z_OBJECTID_OBJ_P(getThis());
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters_none() == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ RETURN_STRINGL(intern->oid, PHONGO_OID_LEN);
+} /* }}} */
+
+/* {{{ proto array MongoDB\BSON\ObjectId::jsonSerialize()
+*/
+static PHP_METHOD(ObjectId, jsonSerialize)
+{
+ zend_error_handling error_handling;
+ php_phongo_objectid_t* intern;
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters_none() == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ intern = Z_OBJECTID_OBJ_P(getThis());
+
+ array_init_size(return_value, 1);
+ ADD_ASSOC_STRINGL(return_value, "$oid", intern->oid, PHONGO_OID_LEN);
+} /* }}} */
+
+/* {{{ proto string MongoDB\BSON\ObjectId::serialize()
+*/
+static PHP_METHOD(ObjectId, serialize)
+{
+ zend_error_handling error_handling;
+ php_phongo_objectid_t* intern;
+ zval retval;
+ php_serialize_data_t var_hash;
+ smart_str buf = { 0 };
+
+ intern = Z_OBJECTID_OBJ_P(getThis());
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters_none() == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ array_init_size(&retval, 1);
+ ADD_ASSOC_STRINGL(&retval, "oid", intern->oid, PHONGO_OID_LEN);
+
+ PHP_VAR_SERIALIZE_INIT(var_hash);
+ php_var_serialize(&buf, &retval, &var_hash);
+ smart_str_0(&buf);
+ PHP_VAR_SERIALIZE_DESTROY(var_hash);
+
+ PHONGO_RETVAL_SMART_STR(buf);
+
+ smart_str_free(&buf);
+ zval_ptr_dtor(&retval);
+} /* }}} */
+
+/* {{{ proto void MongoDB\BSON\ObjectId::unserialize(string $serialized)
+*/
+static PHP_METHOD(ObjectId, unserialize)
+{
+ zend_error_handling error_handling;
+ php_phongo_objectid_t* intern;
+ char* serialized;
+ size_t serialized_len;
+ zval props;
+ 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);
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &serialized, &serialized_len) == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ PHP_VAR_UNSERIALIZE_INIT(var_hash);
+ if (!php_var_unserialize(&props, (const unsigned char**) &serialized, (unsigned char*) serialized + serialized_len, &var_hash)) {
+ zval_ptr_dtor(&props);
+ phongo_throw_exception(PHONGO_ERROR_UNEXPECTED_VALUE, "%s unserialization failed", ZSTR_VAL(php_phongo_objectid_ce->name));
+
+ PHP_VAR_UNSERIALIZE_DESTROY(var_hash);
+ return;
+ }
+ PHP_VAR_UNSERIALIZE_DESTROY(var_hash);
+
+ php_phongo_objectid_init_from_hash(intern, HASH_OF(&props));
+ zval_ptr_dtor(&props);
+} /* }}} */
+
+/* {{{ MongoDB\BSON\ObjectId function entries */
+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[] = {
+ /* clang-format off */
+ 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
+ /* clang-format on */
+};
+/* }}} */
+
+/* {{{ MongoDB\BSON\ObjectId object handlers */
+static zend_object_handlers php_phongo_handler_objectid;
+
+static void php_phongo_objectid_free_object(zend_object* object) /* {{{ */
+{
+ php_phongo_objectid_t* intern = Z_OBJ_OBJECTID(object);
+
+ zend_object_std_dtor(&intern->std);
+
+ if (intern->properties) {
+ zend_hash_destroy(intern->properties);
+ FREE_HASHTABLE(intern->properties);
+ }
+} /* }}} */
+
+static zend_object* php_phongo_objectid_create_object(zend_class_entry* class_type) /* {{{ */
+{
+ 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);
+ object_properties_init(&intern->std, class_type);
+
+ intern->std.handlers = &php_phongo_handler_objectid;
+
+ return &intern->std;
+} /* }}} */
+
+static zend_object* php_phongo_objectid_clone_object(phongo_compat_object_handler_type* object) /* {{{ */
+{
+ php_phongo_objectid_t* intern;
+ php_phongo_objectid_t* new_intern;
+ zend_object* new_object;
+
+ intern = Z_OBJ_OBJECTID(PHONGO_COMPAT_GET_OBJ(object));
+ new_object = php_phongo_objectid_create_object(PHONGO_COMPAT_GET_OBJ(object)->ce);
+
+ new_intern = Z_OBJ_OBJECTID(new_object);
+ zend_objects_clone_members(&new_intern->std, &intern->std);
+
+ // Use memcpy to copy bson value to avoid converting to string and back
+ memcpy(&new_intern->oid, &intern->oid, PHONGO_OID_SIZE);
+ new_intern->initialized = true;
+
+ return new_object;
+} /* }}} */
+
+static int php_phongo_objectid_compare_objects(zval* o1, zval* o2) /* {{{ */
+{
+ php_phongo_objectid_t* intern1;
+ php_phongo_objectid_t* intern2;
+
+ ZEND_COMPARE_OBJECTS_FALLBACK(o1, o2);
+
+ intern1 = Z_OBJECTID_OBJ_P(o1);
+ intern2 = Z_OBJECTID_OBJ_P(o2);
+
+ return strcmp(intern1->oid, intern2->oid);
+} /* }}} */
+
+static HashTable* php_phongo_objectid_get_properties_hash(phongo_compat_object_handler_type* object, bool is_debug) /* {{{ */
+{
+ php_phongo_objectid_t* intern;
+ HashTable* props;
+
+ intern = Z_OBJ_OBJECTID(PHONGO_COMPAT_GET_OBJ(object));
+
+ PHONGO_GET_PROPERTY_HASH_INIT_PROPS(is_debug, intern, props, 1);
+
+ if (!intern->initialized) {
+ return props;
+ }
+
+ {
+ zval zv;
+
+ ZVAL_STRING(&zv, intern->oid);
+ zend_hash_str_update(props, "oid", sizeof("oid") - 1, &zv);
+ }
+
+ return props;
+} /* }}} */
+
+static HashTable* php_phongo_objectid_get_debug_info(phongo_compat_object_handler_type* object, int* is_temp) /* {{{ */
+{
+ *is_temp = 1;
+ return php_phongo_objectid_get_properties_hash(object, true);
+} /* }}} */
+
+static HashTable* php_phongo_objectid_get_properties(phongo_compat_object_handler_type* object) /* {{{ */
+{
+ return php_phongo_objectid_get_properties_hash(object, false);
+} /* }}} */
+/* }}} */
+
+void php_phongo_objectid_init_ce(INIT_FUNC_ARGS) /* {{{ */
+{
+ zend_class_entry ce;
+
+ INIT_NS_CLASS_ENTRY(ce, "MongoDB\\BSON", "ObjectId", php_phongo_objectid_me);
+ php_phongo_objectid_ce = zend_register_internal_class(&ce);
+ 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, 1, php_phongo_objectid_interface_ce);
+ zend_class_implements(php_phongo_objectid_ce, 1, php_phongo_json_serializable_ce);
+ zend_class_implements(php_phongo_objectid_ce, 1, php_phongo_type_ce);
+ zend_class_implements(php_phongo_objectid_ce, 1, zend_ce_serializable);
+
+ memcpy(&php_phongo_handler_objectid, phongo_get_std_object_handlers(), sizeof(zend_object_handlers));
+ PHONGO_COMPAT_SET_COMPARE_OBJECTS_HANDLER(objectid);
+ php_phongo_handler_objectid.clone_obj = php_phongo_objectid_clone_object;
+ php_phongo_handler_objectid.get_debug_info = php_phongo_objectid_get_debug_info;
+ php_phongo_handler_objectid.get_properties = php_phongo_objectid_get_properties;
+ php_phongo_handler_objectid.free_obj = php_phongo_objectid_free_object;
+ php_phongo_handler_objectid.offset = XtOffsetOf(php_phongo_objectid_t, std);
+} /* }}} */
+
+/*
+ * 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.8.1/src/BSON/ObjectIdInterface.c b/mongodb-1.9.0/src/BSON/ObjectIdInterface.c
similarity index 100%
rename from mongodb-1.8.1/src/BSON/ObjectIdInterface.c
rename to mongodb-1.9.0/src/BSON/ObjectIdInterface.c
diff --git a/mongodb-1.8.1/src/BSON/Persistable.c b/mongodb-1.9.0/src/BSON/Persistable.c
similarity index 100%
rename from mongodb-1.8.1/src/BSON/Persistable.c
rename to mongodb-1.9.0/src/BSON/Persistable.c
diff --git a/mongodb-1.9.0/src/BSON/Regex.c b/mongodb-1.9.0/src/BSON/Regex.c
new file mode 100644
index 00000000..7db77f7f
--- /dev/null
+++ b/mongodb-1.9.0/src/BSON/Regex.c
@@ -0,0 +1,456 @@
+/*
+ * 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.
+ */
+
+#include <php.h>
+#include <Zend/zend_interfaces.h>
+#include <ext/standard/php_var.h>
+#include <zend_smart_str.h>
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "phongo_compat.h"
+#include "php_phongo.h"
+
+zend_class_entry* php_phongo_regex_ce;
+
+/* 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, size_t pattern_len, const char* flags, size_t flags_len) /* {{{ */
+{
+ if (strlen(pattern) != (size_t) pattern_len) {
+ phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Pattern cannot contain null bytes");
+ return false;
+ }
+ intern->pattern = estrndup(pattern, pattern_len);
+ intern->pattern_len = pattern_len;
+
+ if (flags) {
+ if (strlen(flags) != (size_t) flags_len) {
+ phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "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) /* {{{ */
+{
+ 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));
+ }
+
+ phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "%s initialization requires \"pattern\" and \"flags\" string fields", ZSTR_VAL(php_phongo_regex_ce->name));
+ return false;
+} /* }}} */
+
+/* {{{ proto void MongoDB\BSON\Regex::__construct(string $pattern [, string $flags])
+ Constructs a new BSON regular expression type. */
+static PHP_METHOD(Regex, __construct)
+{
+ zend_error_handling error_handling;
+ php_phongo_regex_t* intern;
+ char* pattern;
+ size_t pattern_len;
+ char* flags = NULL;
+ size_t flags_len = 0;
+
+ intern = Z_REGEX_OBJ_P(getThis());
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|s", &pattern, &pattern_len, &flags, &flags_len) == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ php_phongo_regex_init(intern, pattern, pattern_len, flags, flags_len);
+} /* }}} */
+
+/* {{{ proto string MongoDB\BSON\Regex::getPattern()
+*/
+static PHP_METHOD(Regex, getPattern)
+{
+ zend_error_handling error_handling;
+ php_phongo_regex_t* intern;
+
+ intern = Z_REGEX_OBJ_P(getThis());
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters_none() == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ RETURN_STRINGL(intern->pattern, intern->pattern_len);
+} /* }}} */
+
+/* {{{ proto string MongoDB\BSON\Regex::getFlags()
+*/
+static PHP_METHOD(Regex, getFlags)
+{
+ zend_error_handling error_handling;
+ php_phongo_regex_t* intern;
+
+ intern = Z_REGEX_OBJ_P(getThis());
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters_none() == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ RETURN_STRINGL(intern->flags, intern->flags_len);
+} /* }}} */
+
+/* {{{ proto void MongoDB\BSON\Regex::__set_state(array $properties)
+*/
+static PHP_METHOD(Regex, __set_state)
+{
+ zend_error_handling error_handling;
+ php_phongo_regex_t* intern;
+ HashTable* props;
+ zval* array;
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "a", &array) == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ 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);
+} /* }}} */
+
+/* {{{ proto string MongoDB\BSON\Regex::__toString()
+ Returns a string in the form: /pattern/flags */
+static PHP_METHOD(Regex, __toString)
+{
+ zend_error_handling error_handling;
+ php_phongo_regex_t* intern;
+ char* regex;
+ int regex_len;
+
+ intern = Z_REGEX_OBJ_P(getThis());
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters_none() == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ regex_len = spprintf(&regex, 0, "/%s/%s", intern->pattern, intern->flags);
+ RETVAL_STRINGL(regex, regex_len);
+ efree(regex);
+} /* }}} */
+
+/* {{{ proto array MongoDB\BSON\Regex::jsonSerialize()
+*/
+static PHP_METHOD(Regex, jsonSerialize)
+{
+ zend_error_handling error_handling;
+ php_phongo_regex_t* intern;
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters_none() == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ 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 MongoDB\BSON\Regex::serialize()
+*/
+static PHP_METHOD(Regex, serialize)
+{
+ zend_error_handling error_handling;
+ php_phongo_regex_t* intern;
+ zval retval;
+ php_serialize_data_t var_hash;
+ smart_str buf = { 0 };
+
+ intern = Z_REGEX_OBJ_P(getThis());
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters_none() == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ 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);
+
+ PHP_VAR_SERIALIZE_INIT(var_hash);
+ php_var_serialize(&buf, &retval, &var_hash);
+ smart_str_0(&buf);
+ PHP_VAR_SERIALIZE_DESTROY(var_hash);
+
+ PHONGO_RETVAL_SMART_STR(buf);
+
+ smart_str_free(&buf);
+ zval_ptr_dtor(&retval);
+} /* }}} */
+
+/* {{{ proto void MongoDB\BSON\Regex::unserialize(string $serialized)
+*/
+static PHP_METHOD(Regex, unserialize)
+{
+ zend_error_handling error_handling;
+ php_phongo_regex_t* intern;
+ char* serialized;
+ size_t serialized_len;
+ zval props;
+ 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);
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &serialized, &serialized_len) == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ PHP_VAR_UNSERIALIZE_INIT(var_hash);
+ if (!php_var_unserialize(&props, (const unsigned char**) &serialized, (unsigned char*) serialized + serialized_len, &var_hash)) {
+ zval_ptr_dtor(&props);
+ phongo_throw_exception(PHONGO_ERROR_UNEXPECTED_VALUE, "%s unserialization failed", ZSTR_VAL(php_phongo_regex_ce->name));
+
+ PHP_VAR_UNSERIALIZE_DESTROY(var_hash);
+ return;
+ }
+ PHP_VAR_UNSERIALIZE_DESTROY(var_hash);
+
+ php_phongo_regex_init_from_hash(intern, HASH_OF(&props));
+ zval_ptr_dtor(&props);
+} /* }}} */
+
+/* {{{ MongoDB\BSON\Regex function entries */
+ZEND_BEGIN_ARG_INFO_EX(ai_Regex___construct, 0, 0, 1)
+ 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[] = {
+ /* clang-format off */
+ 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
+ /* clang-format on */
+};
+/* }}} */
+
+/* {{{ MongoDB\BSON\Regex object handlers */
+static zend_object_handlers php_phongo_handler_regex;
+
+static void php_phongo_regex_free_object(zend_object* object) /* {{{ */
+{
+ php_phongo_regex_t* intern = Z_OBJ_REGEX(object);
+
+ zend_object_std_dtor(&intern->std);
+
+ if (intern->pattern) {
+ efree(intern->pattern);
+ }
+
+ if (intern->flags) {
+ efree(intern->flags);
+ }
+
+ if (intern->properties) {
+ zend_hash_destroy(intern->properties);
+ FREE_HASHTABLE(intern->properties);
+ }
+} /* }}} */
+
+static zend_object* php_phongo_regex_create_object(zend_class_entry* class_type) /* {{{ */
+{
+ 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);
+ object_properties_init(&intern->std, class_type);
+
+ intern->std.handlers = &php_phongo_handler_regex;
+
+ return &intern->std;
+} /* }}} */
+
+static zend_object* php_phongo_regex_clone_object(phongo_compat_object_handler_type* object) /* {{{ */
+{
+ php_phongo_regex_t* intern;
+ php_phongo_regex_t* new_intern;
+ zend_object* new_object;
+
+ intern = Z_OBJ_REGEX(PHONGO_COMPAT_GET_OBJ(object));
+ new_object = php_phongo_regex_create_object(PHONGO_COMPAT_GET_OBJ(object)->ce);
+
+ new_intern = Z_OBJ_REGEX(new_object);
+ zend_objects_clone_members(&new_intern->std, &intern->std);
+
+ php_phongo_regex_init(new_intern, intern->pattern, intern->pattern_len, intern->flags, intern->flags_len);
+
+ return new_object;
+} /* }}} */
+
+static int php_phongo_regex_compare_objects(zval* o1, zval* o2) /* {{{ */
+{
+ php_phongo_regex_t *intern1, *intern2;
+ int retval;
+
+ ZEND_COMPARE_OBJECTS_FALLBACK(o1, o2);
+
+ 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_properties_hash(phongo_compat_object_handler_type* object, bool is_debug) /* {{{ */
+{
+ php_phongo_regex_t* intern;
+ HashTable* props;
+
+ intern = Z_OBJ_REGEX(PHONGO_COMPAT_GET_OBJ(object));
+
+ PHONGO_GET_PROPERTY_HASH_INIT_PROPS(is_debug, intern, props, 2);
+
+ if (!intern->pattern) {
+ return props;
+ }
+
+ {
+ 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);
+ }
+
+ return props;
+} /* }}} */
+
+static HashTable* php_phongo_regex_get_debug_info(phongo_compat_object_handler_type* object, int* is_temp) /* {{{ */
+{
+ *is_temp = 1;
+ return php_phongo_regex_get_properties_hash(object, true);
+} /* }}} */
+
+static HashTable* php_phongo_regex_get_properties(phongo_compat_object_handler_type* object) /* {{{ */
+{
+ return php_phongo_regex_get_properties_hash(object, false);
+} /* }}} */
+/* }}} */
+
+void php_phongo_regex_init_ce(INIT_FUNC_ARGS) /* {{{ */
+{
+ zend_class_entry ce;
+
+ INIT_NS_CLASS_ENTRY(ce, "MongoDB\\BSON", "Regex", php_phongo_regex_me);
+ php_phongo_regex_ce = zend_register_internal_class(&ce);
+ 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, 1, php_phongo_regex_interface_ce);
+ zend_class_implements(php_phongo_regex_ce, 1, php_phongo_type_ce);
+ zend_class_implements(php_phongo_regex_ce, 1, zend_ce_serializable);
+ zend_class_implements(php_phongo_regex_ce, 1, php_phongo_json_serializable_ce);
+
+ memcpy(&php_phongo_handler_regex, phongo_get_std_object_handlers(), sizeof(zend_object_handlers));
+ PHONGO_COMPAT_SET_COMPARE_OBJECTS_HANDLER(regex);
+ php_phongo_handler_regex.clone_obj = php_phongo_regex_clone_object;
+ php_phongo_handler_regex.get_debug_info = php_phongo_regex_get_debug_info;
+ php_phongo_handler_regex.get_properties = php_phongo_regex_get_properties;
+ php_phongo_handler_regex.free_obj = php_phongo_regex_free_object;
+ php_phongo_handler_regex.offset = XtOffsetOf(php_phongo_regex_t, std);
+} /* }}} */
+
+/*
+ * 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.8.1/src/BSON/RegexInterface.c b/mongodb-1.9.0/src/BSON/RegexInterface.c
similarity index 100%
rename from mongodb-1.8.1/src/BSON/RegexInterface.c
rename to mongodb-1.9.0/src/BSON/RegexInterface.c
diff --git a/mongodb-1.8.1/src/BSON/Serializable.c b/mongodb-1.9.0/src/BSON/Serializable.c
similarity index 100%
rename from mongodb-1.8.1/src/BSON/Serializable.c
rename to mongodb-1.9.0/src/BSON/Serializable.c
diff --git a/mongodb-1.9.0/src/BSON/Symbol.c b/mongodb-1.9.0/src/BSON/Symbol.c
new file mode 100644
index 00000000..0409fc63
--- /dev/null
+++ b/mongodb-1.9.0/src/BSON/Symbol.c
@@ -0,0 +1,313 @@
+/*
+ * 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.
+ */
+
+#include <php.h>
+#include <Zend/zend_interfaces.h>
+#include <ext/standard/php_var.h>
+#include <zend_smart_str.h>
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "phongo_compat.h"
+#include "php_phongo.h"
+#include "php_bson.h"
+
+zend_class_entry* php_phongo_symbol_ce;
+
+/* Initialize the object and return whether it was successful. An exception will
+ * be thrown on error. */
+static bool php_phongo_symbol_init(php_phongo_symbol_t* intern, const char* symbol, size_t symbol_len) /* {{{ */
+{
+ if (strlen(symbol) != (size_t) symbol_len) {
+ phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Symbol cannot contain null bytes");
+ return false;
+ }
+
+ intern->symbol = estrndup(symbol, symbol_len);
+ intern->symbol_len = symbol_len;
+
+ 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_symbol_init_from_hash(php_phongo_symbol_t* intern, HashTable* props) /* {{{ */
+{
+ zval* symbol;
+
+ if ((symbol = zend_hash_str_find(props, "symbol", sizeof("symbol") - 1)) && Z_TYPE_P(symbol) == IS_STRING) {
+ return php_phongo_symbol_init(intern, Z_STRVAL_P(symbol), Z_STRLEN_P(symbol));
+ }
+
+ phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "%s initialization requires \"symbol\" string field", ZSTR_VAL(php_phongo_symbol_ce->name));
+ return false;
+} /* }}} */
+
+/* {{{ proto string MongoDB\BSON\Symbol::__toString()
+ Return the Symbol's symbol string. */
+static PHP_METHOD(Symbol, __toString)
+{
+ zend_error_handling error_handling;
+ php_phongo_symbol_t* intern;
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters_none() == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ intern = Z_SYMBOL_OBJ_P(getThis());
+
+ RETURN_STRINGL(intern->symbol, intern->symbol_len);
+} /* }}} */
+
+/* {{{ proto array MongoDB\BSON\Symbol::jsonSerialize()
+*/
+static PHP_METHOD(Symbol, jsonSerialize)
+{
+ zend_error_handling error_handling;
+ php_phongo_symbol_t* intern;
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters_none() == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ intern = Z_SYMBOL_OBJ_P(getThis());
+
+ array_init_size(return_value, 1);
+ ADD_ASSOC_STRINGL(return_value, "$symbol", intern->symbol, intern->symbol_len);
+} /* }}} */
+
+/* {{{ proto string MongoDB\BSON\Symbol::serialize()
+*/
+static PHP_METHOD(Symbol, serialize)
+{
+ zend_error_handling error_handling;
+ php_phongo_symbol_t* intern;
+ zval retval;
+ php_serialize_data_t var_hash;
+ smart_str buf = { 0 };
+
+ intern = Z_SYMBOL_OBJ_P(getThis());
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters_none() == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ array_init_size(&retval, 1);
+ ADD_ASSOC_STRINGL(&retval, "symbol", intern->symbol, intern->symbol_len);
+
+ PHP_VAR_SERIALIZE_INIT(var_hash);
+ php_var_serialize(&buf, &retval, &var_hash);
+ smart_str_0(&buf);
+ PHP_VAR_SERIALIZE_DESTROY(var_hash);
+
+ PHONGO_RETVAL_SMART_STR(buf);
+
+ smart_str_free(&buf);
+ zval_ptr_dtor(&retval);
+} /* }}} */
+
+/* {{{ proto void MongoDB\BSON\Symbol::unserialize(string $serialized)
+*/
+static PHP_METHOD(Symbol, unserialize)
+{
+ zend_error_handling error_handling;
+ php_phongo_symbol_t* intern;
+ char* serialized;
+ size_t serialized_len;
+ zval props;
+ php_unserialize_data_t var_hash;
+
+ intern = Z_SYMBOL_OBJ_P(getThis());
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &serialized, &serialized_len) == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ PHP_VAR_UNSERIALIZE_INIT(var_hash);
+ if (!php_var_unserialize(&props, (const unsigned char**) &serialized, (unsigned char*) serialized + serialized_len, &var_hash)) {
+ zval_ptr_dtor(&props);
+ phongo_throw_exception(PHONGO_ERROR_UNEXPECTED_VALUE, "%s unserialization failed", ZSTR_VAL(php_phongo_symbol_ce->name));
+
+ PHP_VAR_UNSERIALIZE_DESTROY(var_hash);
+ return;
+ }
+ PHP_VAR_UNSERIALIZE_DESTROY(var_hash);
+
+ php_phongo_symbol_init_from_hash(intern, HASH_OF(&props));
+ zval_ptr_dtor(&props);
+} /* }}} */
+
+/* {{{ MongoDB\BSON\Symbol function entries */
+ZEND_BEGIN_ARG_INFO_EX(ai_Symbol_unserialize, 0, 0, 1)
+ ZEND_ARG_INFO(0, serialized)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(ai_Symbol_void, 0, 0, 0)
+ZEND_END_ARG_INFO()
+
+static zend_function_entry php_phongo_symbol_me[] = {
+ /* clang-format off */
+ /* __set_state intentionally missing */
+ PHP_ME(Symbol, __toString, ai_Symbol_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
+ PHP_ME(Symbol, jsonSerialize, ai_Symbol_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
+ PHP_ME(Symbol, serialize, ai_Symbol_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
+ PHP_ME(Symbol, unserialize, ai_Symbol_unserialize, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
+ ZEND_NAMED_ME(__construct, PHP_FN(MongoDB_disabled___construct), ai_Symbol_void, ZEND_ACC_PRIVATE | ZEND_ACC_FINAL)
+ PHP_FE_END
+ /* clang-format on */
+};
+/* }}} */
+
+/* {{{ MongoDB\BSON\Symbol object handlers */
+static zend_object_handlers php_phongo_handler_symbol;
+
+static void php_phongo_symbol_free_object(zend_object* object) /* {{{ */
+{
+ php_phongo_symbol_t* intern = Z_OBJ_SYMBOL(object);
+
+ zend_object_std_dtor(&intern->std);
+
+ if (intern->symbol) {
+ efree(intern->symbol);
+ }
+
+ if (intern->properties) {
+ zend_hash_destroy(intern->properties);
+ FREE_HASHTABLE(intern->properties);
+ }
+} /* }}} */
+
+zend_object* php_phongo_symbol_create_object(zend_class_entry* class_type) /* {{{ */
+{
+ php_phongo_symbol_t* intern = NULL;
+
+ intern = PHONGO_ALLOC_OBJECT_T(php_phongo_symbol_t, class_type);
+ zend_object_std_init(&intern->std, class_type);
+ object_properties_init(&intern->std, class_type);
+
+ intern->std.handlers = &php_phongo_handler_symbol;
+
+ return &intern->std;
+} /* }}} */
+
+static zend_object* php_phongo_symbol_clone_object(phongo_compat_object_handler_type* object) /* {{{ */
+{
+ php_phongo_symbol_t* intern;
+ php_phongo_symbol_t* new_intern;
+ zend_object* new_object;
+
+ intern = Z_OBJ_SYMBOL(PHONGO_COMPAT_GET_OBJ(object));
+ new_object = php_phongo_symbol_create_object(PHONGO_COMPAT_GET_OBJ(object)->ce);
+
+ new_intern = Z_OBJ_SYMBOL(new_object);
+ zend_objects_clone_members(&new_intern->std, &intern->std);
+
+ php_phongo_symbol_init(new_intern, intern->symbol, intern->symbol_len);
+
+ return new_object;
+} /* }}} */
+
+static int php_phongo_symbol_compare_objects(zval* o1, zval* o2) /* {{{ */
+{
+ php_phongo_symbol_t *intern1, *intern2;
+
+ ZEND_COMPARE_OBJECTS_FALLBACK(o1, o2);
+
+ intern1 = Z_SYMBOL_OBJ_P(o1);
+ intern2 = Z_SYMBOL_OBJ_P(o2);
+
+ return strcmp(intern1->symbol, intern2->symbol);
+} /* }}} */
+
+HashTable* php_phongo_symbol_get_properties_hash(phongo_compat_object_handler_type* object, bool is_debug) /* {{{ */
+{
+ php_phongo_symbol_t* intern;
+ HashTable* props;
+
+ intern = Z_OBJ_SYMBOL(PHONGO_COMPAT_GET_OBJ(object));
+
+ PHONGO_GET_PROPERTY_HASH_INIT_PROPS(is_debug, intern, props, 2);
+
+ if (!intern->symbol) {
+ return props;
+ }
+
+ {
+ zval symbol;
+
+ ZVAL_STRING(&symbol, intern->symbol);
+ zend_hash_str_update(props, "symbol", sizeof("symbol") - 1, &symbol);
+ }
+
+ return props;
+} /* }}} */
+
+static HashTable* php_phongo_symbol_get_debug_info(phongo_compat_object_handler_type* object, int* is_temp) /* {{{ */
+{
+ *is_temp = 1;
+ return php_phongo_symbol_get_properties_hash(object, true);
+} /* }}} */
+
+static HashTable* php_phongo_symbol_get_properties(phongo_compat_object_handler_type* object) /* {{{ */
+{
+ return php_phongo_symbol_get_properties_hash(object, false);
+} /* }}} */
+/* }}} */
+
+void php_phongo_symbol_init_ce(INIT_FUNC_ARGS) /* {{{ */
+{
+ zend_class_entry ce;
+
+ INIT_NS_CLASS_ENTRY(ce, "MongoDB\\BSON", "Symbol", php_phongo_symbol_me);
+ php_phongo_symbol_ce = zend_register_internal_class(&ce);
+ php_phongo_symbol_ce->create_object = php_phongo_symbol_create_object;
+ PHONGO_CE_FINAL(php_phongo_symbol_ce);
+
+ zend_class_implements(php_phongo_symbol_ce, 1, php_phongo_json_serializable_ce);
+ zend_class_implements(php_phongo_symbol_ce, 1, php_phongo_type_ce);
+ zend_class_implements(php_phongo_symbol_ce, 1, zend_ce_serializable);
+
+ memcpy(&php_phongo_handler_symbol, phongo_get_std_object_handlers(), sizeof(zend_object_handlers));
+ PHONGO_COMPAT_SET_COMPARE_OBJECTS_HANDLER(symbol);
+ php_phongo_handler_symbol.clone_obj = php_phongo_symbol_clone_object;
+ php_phongo_handler_symbol.get_debug_info = php_phongo_symbol_get_debug_info;
+ php_phongo_handler_symbol.get_properties = php_phongo_symbol_get_properties;
+ php_phongo_handler_symbol.free_obj = php_phongo_symbol_free_object;
+ php_phongo_handler_symbol.offset = XtOffsetOf(php_phongo_symbol_t, std);
+} /* }}} */
+
+/*
+ * 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.9.0/src/BSON/Timestamp.c b/mongodb-1.9.0/src/BSON/Timestamp.c
new file mode 100644
index 00000000..a0f90236
--- /dev/null
+++ b/mongodb-1.9.0/src/BSON/Timestamp.c
@@ -0,0 +1,498 @@
+/*
+ * 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.
+ */
+
+#include <php.h>
+#include <Zend/zend_interfaces.h>
+#include <ext/standard/php_var.h>
+#include <zend_smart_str.h>
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "phongo_compat.h"
+#include "php_phongo.h"
+
+zend_class_entry* php_phongo_timestamp_ce;
+
+/* 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) /* {{{ */
+{
+ if (increment < 0 || increment > UINT32_MAX) {
+ phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Expected increment to be an unsigned 32-bit integer, %" PRId64 " given", increment);
+ return false;
+ }
+
+ if (timestamp < 0 || timestamp > UINT32_MAX) {
+ phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Expected timestamp to be an unsigned 32-bit integer, %" PRId64 " 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, size_t s_increment_len, const char* s_timestamp, size_t s_timestamp_len) /* {{{ */
+{
+ int64_t increment, timestamp;
+
+ if (!php_phongo_parse_int64(&increment, s_increment, s_increment_len)) {
+ phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Error parsing \"%s\" as 64-bit integer increment for %s initialization", s_increment, ZSTR_VAL(php_phongo_timestamp_ce->name));
+ return false;
+ }
+
+ if (!php_phongo_parse_int64(&timestamp, s_timestamp, s_timestamp_len)) {
+ phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "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);
+} /* }}} */
+
+/* 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) /* {{{ */
+{
+ 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));
+ }
+ 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));
+ }
+
+ phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "%s initialization requires \"increment\" and \"timestamp\" integer or numeric string fields", ZSTR_VAL(php_phongo_timestamp_ce->name));
+ return false;
+} /* }}} */
+
+/* {{{ proto void MongoDB\BSON\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. */
+static PHP_METHOD(Timestamp, __construct)
+{
+ zend_error_handling error_handling;
+ php_phongo_timestamp_t* intern;
+ zval * increment = NULL, *timestamp = NULL;
+
+ intern = Z_TIMESTAMP_OBJ_P(getThis());
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "zz", &increment, &timestamp) == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ 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));
+ 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, "Expected increment to be an unsigned 32-bit integer or string, %s given", PHONGO_ZVAL_CLASS_OR_TYPE_NAME_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, "Expected timestamp to be an unsigned 32-bit integer or string, %s given", PHONGO_ZVAL_CLASS_OR_TYPE_NAME_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));
+} /* }}} */
+
+/* {{{ proto integer MongoDB\BSON\Timestamp::getIncrement()
+*/
+static PHP_METHOD(Timestamp, getIncrement)
+{
+ zend_error_handling error_handling;
+ php_phongo_timestamp_t* intern;
+
+ intern = Z_TIMESTAMP_OBJ_P(getThis());
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters_none() == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ RETVAL_LONG(intern->increment);
+} /* }}} */
+
+/* {{{ proto integer MongoDB\BSON\Timestamp::getTimestamp()
+*/
+static PHP_METHOD(Timestamp, getTimestamp)
+{
+ zend_error_handling error_handling;
+ php_phongo_timestamp_t* intern;
+
+ intern = Z_TIMESTAMP_OBJ_P(getThis());
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters_none() == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ RETVAL_LONG(intern->timestamp);
+} /* }}} */
+
+/* {{{ proto void MongoDB\BSON\Timestamp::__set_state(array $properties)
+*/
+static PHP_METHOD(Timestamp, __set_state)
+{
+ zend_error_handling error_handling;
+ php_phongo_timestamp_t* intern;
+ HashTable* props;
+ zval* array;
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "a", &array) == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ 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);
+} /* }}} */
+
+/* {{{ proto string MongoDB\BSON\Timestamp::__toString()
+ Returns a string in the form: [increment:timestamp] */
+static PHP_METHOD(Timestamp, __toString)
+{
+ zend_error_handling error_handling;
+ php_phongo_timestamp_t* intern;
+ char* retval;
+ int retval_len;
+
+ intern = Z_TIMESTAMP_OBJ_P(getThis());
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters_none() == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ retval_len = spprintf(&retval, 0, "[%" PRIu32 ":%" PRIu32 "]", intern->increment, intern->timestamp);
+ RETVAL_STRINGL(retval, retval_len);
+ efree(retval);
+} /* }}} */
+
+/* {{{ proto array MongoDB\BSON\Timestamp::jsonSerialize()
+*/
+static PHP_METHOD(Timestamp, jsonSerialize)
+{
+ zend_error_handling error_handling;
+ php_phongo_timestamp_t* intern;
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters_none() == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ intern = Z_TIMESTAMP_OBJ_P(getThis());
+
+ array_init_size(return_value, 1);
+
+ {
+ 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);
+ }
+} /* }}} */
+
+/* {{{ proto string MongoDB\BSON\Timestamp::serialize()
+*/
+static PHP_METHOD(Timestamp, serialize)
+{
+ zend_error_handling error_handling;
+ php_phongo_timestamp_t* intern;
+ zval retval;
+ 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());
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters_none() == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ s_increment_len = snprintf(s_increment, sizeof(s_increment), "%" PRIu32, intern->increment);
+ s_timestamp_len = snprintf(s_timestamp, sizeof(s_timestamp), "%" PRIu32, intern->timestamp);
+
+ 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);
+
+ PHP_VAR_SERIALIZE_INIT(var_hash);
+ php_var_serialize(&buf, &retval, &var_hash);
+ smart_str_0(&buf);
+ PHP_VAR_SERIALIZE_DESTROY(var_hash);
+
+ PHONGO_RETVAL_SMART_STR(buf);
+
+ smart_str_free(&buf);
+ zval_ptr_dtor(&retval);
+} /* }}} */
+
+/* {{{ proto void MongoDB\BSON\Timestamp::unserialize(string $serialized)
+*/
+static PHP_METHOD(Timestamp, unserialize)
+{
+ zend_error_handling error_handling;
+ php_phongo_timestamp_t* intern;
+ char* serialized;
+ size_t serialized_len;
+ zval props;
+ 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);
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &serialized, &serialized_len) == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ PHP_VAR_UNSERIALIZE_INIT(var_hash);
+ if (!php_var_unserialize(&props, (const unsigned char**) &serialized, (unsigned char*) serialized + serialized_len, &var_hash)) {
+ zval_ptr_dtor(&props);
+ phongo_throw_exception(PHONGO_ERROR_UNEXPECTED_VALUE, "%s unserialization failed", ZSTR_VAL(php_phongo_timestamp_ce->name));
+
+ PHP_VAR_UNSERIALIZE_DESTROY(var_hash);
+ return;
+ }
+ PHP_VAR_UNSERIALIZE_DESTROY(var_hash);
+
+ php_phongo_timestamp_init_from_hash(intern, HASH_OF(&props));
+ zval_ptr_dtor(&props);
+} /* }}} */
+
+/* {{{ MongoDB\BSON\Timestamp function entries */
+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[] = {
+ /* clang-format off */
+ 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_ME(Timestamp, getIncrement, ai_Timestamp_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
+ PHP_ME(Timestamp, getTimestamp, ai_Timestamp_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
+ PHP_FE_END
+ /* clang-format on */
+};
+/* }}} */
+
+/* {{{ MongoDB\BSON\Timestamp object handlers */
+static zend_object_handlers php_phongo_handler_timestamp;
+
+static void php_phongo_timestamp_free_object(zend_object* object) /* {{{ */
+{
+ php_phongo_timestamp_t* intern = Z_OBJ_TIMESTAMP(object);
+
+ zend_object_std_dtor(&intern->std);
+
+ if (intern->properties) {
+ zend_hash_destroy(intern->properties);
+ FREE_HASHTABLE(intern->properties);
+ }
+} /* }}} */
+
+static zend_object* php_phongo_timestamp_create_object(zend_class_entry* class_type) /* {{{ */
+{
+ 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);
+ object_properties_init(&intern->std, class_type);
+
+ intern->std.handlers = &php_phongo_handler_timestamp;
+
+ return &intern->std;
+} /* }}} */
+
+static zend_object* php_phongo_timestamp_clone_object(phongo_compat_object_handler_type* object) /* {{{ */
+{
+ php_phongo_timestamp_t* intern;
+ php_phongo_timestamp_t* new_intern;
+ zend_object* new_object;
+
+ intern = Z_OBJ_TIMESTAMP(PHONGO_COMPAT_GET_OBJ(object));
+ new_object = php_phongo_timestamp_create_object(PHONGO_COMPAT_GET_OBJ(object)->ce);
+
+ new_intern = Z_OBJ_TIMESTAMP(new_object);
+ zend_objects_clone_members(&new_intern->std, &intern->std);
+
+ php_phongo_timestamp_init(new_intern, intern->increment, intern->timestamp);
+
+ return new_object;
+} /* }}} */
+
+static int php_phongo_timestamp_compare_objects(zval* o1, zval* o2) /* {{{ */
+{
+ php_phongo_timestamp_t *intern1, *intern2;
+
+ ZEND_COMPARE_OBJECTS_FALLBACK(o1, o2);
+
+ 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_properties_hash(phongo_compat_object_handler_type* object, bool is_debug) /* {{{ */
+{
+ 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_OBJ_TIMESTAMP(PHONGO_COMPAT_GET_OBJ(object));
+
+ PHONGO_GET_PROPERTY_HASH_INIT_PROPS(is_debug, intern, props, 2);
+
+ 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);
+
+ {
+ 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);
+ }
+
+ return props;
+} /* }}} */
+
+static HashTable* php_phongo_timestamp_get_debug_info(phongo_compat_object_handler_type* object, int* is_temp) /* {{{ */
+{
+ *is_temp = 1;
+ return php_phongo_timestamp_get_properties_hash(object, true);
+} /* }}} */
+
+static HashTable* php_phongo_timestamp_get_properties(phongo_compat_object_handler_type* object) /* {{{ */
+{
+ return php_phongo_timestamp_get_properties_hash(object, false);
+} /* }}} */
+/* }}} */
+
+void php_phongo_timestamp_init_ce(INIT_FUNC_ARGS) /* {{{ */
+{
+ zend_class_entry ce;
+
+ INIT_NS_CLASS_ENTRY(ce, "MongoDB\\BSON", "Timestamp", php_phongo_timestamp_me);
+ php_phongo_timestamp_ce = zend_register_internal_class(&ce);
+ 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, 1, php_phongo_timestamp_interface_ce);
+ zend_class_implements(php_phongo_timestamp_ce, 1, php_phongo_json_serializable_ce);
+ zend_class_implements(php_phongo_timestamp_ce, 1, php_phongo_type_ce);
+ zend_class_implements(php_phongo_timestamp_ce, 1, zend_ce_serializable);
+
+ memcpy(&php_phongo_handler_timestamp, phongo_get_std_object_handlers(), sizeof(zend_object_handlers));
+ PHONGO_COMPAT_SET_COMPARE_OBJECTS_HANDLER(timestamp);
+ php_phongo_handler_timestamp.clone_obj = php_phongo_timestamp_clone_object;
+ php_phongo_handler_timestamp.get_debug_info = php_phongo_timestamp_get_debug_info;
+ php_phongo_handler_timestamp.get_properties = php_phongo_timestamp_get_properties;
+ php_phongo_handler_timestamp.free_obj = php_phongo_timestamp_free_object;
+ php_phongo_handler_timestamp.offset = XtOffsetOf(php_phongo_timestamp_t, std);
+} /* }}} */
+
+/*
+ * 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.8.1/src/BSON/TimestampInterface.c b/mongodb-1.9.0/src/BSON/TimestampInterface.c
similarity index 100%
rename from mongodb-1.8.1/src/BSON/TimestampInterface.c
rename to mongodb-1.9.0/src/BSON/TimestampInterface.c
diff --git a/mongodb-1.8.1/src/BSON/Type.c b/mongodb-1.9.0/src/BSON/Type.c
similarity index 100%
rename from mongodb-1.8.1/src/BSON/Type.c
rename to mongodb-1.9.0/src/BSON/Type.c
diff --git a/mongodb-1.9.0/src/BSON/UTCDateTime.c b/mongodb-1.9.0/src/BSON/UTCDateTime.c
new file mode 100644
index 00000000..fa721c7c
--- /dev/null
+++ b/mongodb-1.9.0/src/BSON/UTCDateTime.c
@@ -0,0 +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.
+ */
+
+#include <math.h>
+
+#include <php.h>
+#include <Zend/zend_interfaces.h>
+#include <ext/date/php_date.h>
+#include <ext/standard/php_var.h>
+#include <zend_smart_str.h>
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#ifdef PHP_WIN32
+#include "win32/time.h"
+#endif
+#include "phongo_compat.h"
+#include "php_phongo.h"
+
+zend_class_entry* php_phongo_utcdatetime_ce;
+
+/* 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, size_t s_milliseconds_len) /* {{{ */
+{
+ int64_t milliseconds;
+
+ if (!php_phongo_parse_int64(&milliseconds, s_milliseconds, s_milliseconds_len)) {
+ phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "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) /* {{{ */
+{
+ 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));
+ }
+
+ phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "%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;
+#if PHP_VERSION_ID >= 70200
+ usec = (int64_t) floor(datetime_obj->time->us);
+#else
+ usec = (int64_t) floor(datetime_obj->time->f * 1000000 + 0.5);
+#endif
+
+ intern->milliseconds = (sec * 1000) + (usec / 1000);
+ intern->initialized = true;
+
+ return true;
+} /* }}} */
+
+/* {{{ proto void MongoDB\BSON\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. */
+static PHP_METHOD(UTCDateTime, __construct)
+{
+ zend_error_handling error_handling;
+ php_phongo_utcdatetime_t* intern;
+ zval* milliseconds = NULL;
+
+ intern = Z_UTCDATETIME_OBJ_P(getThis());
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "|z!", &milliseconds) == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ 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()) ||
+ (php_phongo_date_immutable_ce && instanceof_function(Z_OBJCE_P(milliseconds), php_phongo_date_immutable_ce))) {
+
+ php_phongo_utcdatetime_init_from_date(intern, Z_PHPDATE_P(milliseconds));
+ } else {
+ phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "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);
+ return;
+ }
+
+ if (Z_TYPE_P(milliseconds) != IS_STRING) {
+ phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Expected integer or string, %s given", PHONGO_ZVAL_CLASS_OR_TYPE_NAME_P(milliseconds));
+ return;
+ }
+
+ php_phongo_utcdatetime_init_from_string(intern, Z_STRVAL_P(milliseconds), Z_STRLEN_P(milliseconds));
+} /* }}} */
+
+/* {{{ proto void MongoDB\BSON\UTCDateTime::__set_state(array $properties)
+*/
+static PHP_METHOD(UTCDateTime, __set_state)
+{
+ zend_error_handling error_handling;
+ php_phongo_utcdatetime_t* intern;
+ HashTable* props;
+ zval* array;
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "a", &array) == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ 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);
+} /* }}} */
+
+/* {{{ proto string MongoDB\BSON\UTCDateTime::__toString()
+ Returns the UTCDateTime's milliseconds as a string */
+static PHP_METHOD(UTCDateTime, __toString)
+{
+ zend_error_handling error_handling;
+ php_phongo_utcdatetime_t* intern;
+
+ intern = Z_UTCDATETIME_OBJ_P(getThis());
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters_none() == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ ZVAL_INT64_STRING(return_value, intern->milliseconds);
+} /* }}} */
+
+/* {{{ proto DateTime MongoDB\BSON\UTCDateTime::toDateTime()
+ Returns a DateTime object representing this UTCDateTime */
+static PHP_METHOD(UTCDateTime, toDateTime)
+{
+ zend_error_handling error_handling;
+ php_phongo_utcdatetime_t* intern;
+ php_date_obj* datetime_obj;
+ char* sec;
+ size_t sec_len;
+
+ intern = Z_UTCDATETIME_OBJ_P(getThis());
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters_none() == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ 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);
+ efree(sec);
+
+#if PHP_VERSION_ID >= 70200
+ datetime_obj->time->us = (intern->milliseconds % 1000) * 1000;
+#else
+ datetime_obj->time->f = (double) (intern->milliseconds % 1000) / 1000;
+#endif
+}
+/* }}} */
+
+/* {{{ proto array MongoDB\BSON\UTCDateTime::jsonSerialize()
+*/
+static PHP_METHOD(UTCDateTime, jsonSerialize)
+{
+ zend_error_handling error_handling;
+ php_phongo_utcdatetime_t* intern;
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters_none() == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ intern = Z_UTCDATETIME_OBJ_P(getThis());
+
+ array_init_size(return_value, 1);
+
+ {
+ zval udt;
+
+ array_init_size(&udt, 1);
+ ADD_ASSOC_INT64_AS_STRING(&udt, "$numberLong", intern->milliseconds);
+ ADD_ASSOC_ZVAL_EX(return_value, "$date", &udt);
+ }
+} /* }}} */
+
+/* {{{ proto string MongoDB\BSON\UTCDateTime::serialize()
+*/
+static PHP_METHOD(UTCDateTime, serialize)
+{
+ zend_error_handling error_handling;
+ php_phongo_utcdatetime_t* intern;
+ zval retval;
+ php_serialize_data_t var_hash;
+ smart_str buf = { 0 };
+
+ intern = Z_UTCDATETIME_OBJ_P(getThis());
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters_none() == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ array_init_size(&retval, 1);
+ ADD_ASSOC_INT64_AS_STRING(&retval, "milliseconds", intern->milliseconds);
+
+ PHP_VAR_SERIALIZE_INIT(var_hash);
+ php_var_serialize(&buf, &retval, &var_hash);
+ smart_str_0(&buf);
+ PHP_VAR_SERIALIZE_DESTROY(var_hash);
+
+ PHONGO_RETVAL_SMART_STR(buf);
+
+ smart_str_free(&buf);
+ zval_ptr_dtor(&retval);
+} /* }}} */
+
+/* {{{ proto void MongoDB\BSON\UTCDateTime::unserialize(string $serialized)
+*/
+static PHP_METHOD(UTCDateTime, unserialize)
+{
+ zend_error_handling error_handling;
+ php_phongo_utcdatetime_t* intern;
+ char* serialized;
+ size_t serialized_len;
+ zval props;
+ 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);
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &serialized, &serialized_len) == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ PHP_VAR_UNSERIALIZE_INIT(var_hash);
+ if (!php_var_unserialize(&props, (const unsigned char**) &serialized, (unsigned char*) serialized + serialized_len, &var_hash)) {
+ zval_ptr_dtor(&props);
+ phongo_throw_exception(PHONGO_ERROR_UNEXPECTED_VALUE, "%s unserialization failed", ZSTR_VAL(php_phongo_utcdatetime_ce->name));
+
+ PHP_VAR_UNSERIALIZE_DESTROY(var_hash);
+ return;
+ }
+ PHP_VAR_UNSERIALIZE_DESTROY(var_hash);
+
+ php_phongo_utcdatetime_init_from_hash(intern, HASH_OF(&props));
+ zval_ptr_dtor(&props);
+} /* }}} */
+
+/* {{{ MongoDB\BSON\UTCDateTime function entries */
+ZEND_BEGIN_ARG_INFO_EX(ai_UTCDateTime___construct, 0, 0, 0)
+ 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[] = {
+ /* clang-format off */
+ 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
+ /* clang-format on */
+};
+/* }}} */
+
+/* {{{ MongoDB\BSON\UTCDateTime object handlers */
+static zend_object_handlers php_phongo_handler_utcdatetime;
+
+static void php_phongo_utcdatetime_free_object(zend_object* object) /* {{{ */
+{
+ php_phongo_utcdatetime_t* intern = Z_OBJ_UTCDATETIME(object);
+
+ zend_object_std_dtor(&intern->std);
+
+ if (intern->properties) {
+ zend_hash_destroy(intern->properties);
+ FREE_HASHTABLE(intern->properties);
+ }
+} /* }}} */
+
+static zend_object* php_phongo_utcdatetime_create_object(zend_class_entry* class_type) /* {{{ */
+{
+ 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);
+ object_properties_init(&intern->std, class_type);
+
+ intern->std.handlers = &php_phongo_handler_utcdatetime;
+
+ return &intern->std;
+} /* }}} */
+
+static zend_object* php_phongo_utcdatetime_clone_object(phongo_compat_object_handler_type* object) /* {{{ */
+{
+ php_phongo_utcdatetime_t* intern;
+ php_phongo_utcdatetime_t* new_intern;
+ zend_object* new_object;
+
+ intern = Z_OBJ_UTCDATETIME(PHONGO_COMPAT_GET_OBJ(object));
+ new_object = php_phongo_utcdatetime_create_object(PHONGO_COMPAT_GET_OBJ(object)->ce);
+
+ new_intern = Z_OBJ_UTCDATETIME(new_object);
+ zend_objects_clone_members(&new_intern->std, &intern->std);
+
+ php_phongo_utcdatetime_init(new_intern, intern->milliseconds);
+
+ return new_object;
+} /* }}} */
+
+static int php_phongo_utcdatetime_compare_objects(zval* o1, zval* o2) /* {{{ */
+{
+ php_phongo_utcdatetime_t *intern1, *intern2;
+
+ ZEND_COMPARE_OBJECTS_FALLBACK(o1, o2);
+
+ 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_properties_hash(phongo_compat_object_handler_type* object, bool is_debug) /* {{{ */
+{
+ php_phongo_utcdatetime_t* intern;
+ HashTable* props;
+
+ intern = Z_OBJ_UTCDATETIME(PHONGO_COMPAT_GET_OBJ(object));
+
+ PHONGO_GET_PROPERTY_HASH_INIT_PROPS(is_debug, intern, props, 1);
+
+ if (!intern->initialized) {
+ return props;
+ }
+
+ {
+ zval milliseconds;
+
+ ZVAL_INT64_STRING(&milliseconds, intern->milliseconds);
+ zend_hash_str_update(props, "milliseconds", sizeof("milliseconds") - 1, &milliseconds);
+ }
+
+ return props;
+} /* }}} */
+
+static HashTable* php_phongo_utcdatetime_get_debug_info(phongo_compat_object_handler_type* object, int* is_temp) /* {{{ */
+{
+ *is_temp = 1;
+ return php_phongo_utcdatetime_get_properties_hash(object, true);
+} /* }}} */
+
+static HashTable* php_phongo_utcdatetime_get_properties(phongo_compat_object_handler_type* object) /* {{{ */
+{
+ return php_phongo_utcdatetime_get_properties_hash(object, false);
+} /* }}} */
+/* }}} */
+
+void php_phongo_utcdatetime_init_ce(INIT_FUNC_ARGS) /* {{{ */
+{
+ zend_class_entry ce;
+
+ INIT_NS_CLASS_ENTRY(ce, "MongoDB\\BSON", "UTCDateTime", php_phongo_utcdatetime_me);
+ php_phongo_utcdatetime_ce = zend_register_internal_class(&ce);
+ 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, 1, php_phongo_utcdatetime_interface_ce);
+ zend_class_implements(php_phongo_utcdatetime_ce, 1, php_phongo_json_serializable_ce);
+ zend_class_implements(php_phongo_utcdatetime_ce, 1, php_phongo_type_ce);
+ zend_class_implements(php_phongo_utcdatetime_ce, 1, zend_ce_serializable);
+
+ memcpy(&php_phongo_handler_utcdatetime, phongo_get_std_object_handlers(), sizeof(zend_object_handlers));
+ PHONGO_COMPAT_SET_COMPARE_OBJECTS_HANDLER(utcdatetime);
+ php_phongo_handler_utcdatetime.clone_obj = php_phongo_utcdatetime_clone_object;
+ php_phongo_handler_utcdatetime.get_debug_info = php_phongo_utcdatetime_get_debug_info;
+ php_phongo_handler_utcdatetime.get_properties = php_phongo_utcdatetime_get_properties;
+ php_phongo_handler_utcdatetime.free_obj = php_phongo_utcdatetime_free_object;
+ php_phongo_handler_utcdatetime.offset = XtOffsetOf(php_phongo_utcdatetime_t, std);
+} /* }}} */
+
+/*
+ * 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.8.1/src/BSON/UTCDateTimeInterface.c b/mongodb-1.9.0/src/BSON/UTCDateTimeInterface.c
similarity index 100%
rename from mongodb-1.8.1/src/BSON/UTCDateTimeInterface.c
rename to mongodb-1.9.0/src/BSON/UTCDateTimeInterface.c
diff --git a/mongodb-1.9.0/src/BSON/Undefined.c b/mongodb-1.9.0/src/BSON/Undefined.c
new file mode 100644
index 00000000..527e0ec2
--- /dev/null
+++ b/mongodb-1.9.0/src/BSON/Undefined.c
@@ -0,0 +1,168 @@
+/*
+ * 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.
+ */
+
+#include <php.h>
+#include <Zend/zend_interfaces.h>
+#include <ext/standard/php_var.h>
+#include <zend_smart_str.h>
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "phongo_compat.h"
+#include "php_phongo.h"
+
+zend_class_entry* php_phongo_undefined_ce;
+
+/* {{{ proto string MongoDB\BSON\Undefined::__toString()
+ Return the empty string. */
+static PHP_METHOD(Undefined, __toString)
+{
+ zend_error_handling error_handling;
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters_none() == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ RETURN_STRINGL("", 0);
+} /* }}} */
+
+/* {{{ proto array MongoDB\BSON\Undefined::jsonSerialize()
+*/
+static PHP_METHOD(Undefined, jsonSerialize)
+{
+ zend_error_handling error_handling;
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters_none() == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ array_init_size(return_value, 1);
+ ADD_ASSOC_BOOL_EX(return_value, "$undefined", 1);
+} /* }}} */
+
+/* {{{ proto string MongoDB\BSON\Undefined::serialize()
+*/
+static PHP_METHOD(Undefined, serialize)
+{
+ zend_error_handling error_handling;
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters_none() == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ RETURN_STRING("");
+} /* }}} */
+
+/* {{{ proto void MongoDB\BSON\Undefined::unserialize(string $serialized)
+*/
+static PHP_METHOD(Undefined, unserialize)
+{
+ zend_error_handling error_handling;
+ char* serialized;
+ size_t serialized_len;
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &serialized, &serialized_len) == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+} /* }}} */
+
+/* {{{ MongoDB\BSON\Undefined function entries */
+ZEND_BEGIN_ARG_INFO_EX(ai_Undefined_unserialize, 0, 0, 1)
+ ZEND_ARG_INFO(0, serialized)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(ai_Undefined_void, 0, 0, 0)
+ZEND_END_ARG_INFO()
+
+static zend_function_entry php_phongo_undefined_me[] = {
+ /* clang-format off */
+ /* __set_state intentionally missing */
+ PHP_ME(Undefined, __toString, ai_Undefined_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
+ PHP_ME(Undefined, jsonSerialize, ai_Undefined_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
+ PHP_ME(Undefined, serialize, ai_Undefined_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
+ PHP_ME(Undefined, unserialize, ai_Undefined_unserialize, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
+ ZEND_NAMED_ME(__construct, PHP_FN(MongoDB_disabled___construct), ai_Undefined_void, ZEND_ACC_PRIVATE | ZEND_ACC_FINAL)
+ PHP_FE_END
+ /* clang-format on */
+};
+/* }}} */
+
+/* {{{ MongoDB\BSON\Undefined object handlers */
+static zend_object_handlers php_phongo_handler_undefined;
+
+static void php_phongo_undefined_free_object(zend_object* object) /* {{{ */
+{
+ php_phongo_undefined_t* intern = Z_OBJ_UNDEFINED(object);
+
+ zend_object_std_dtor(&intern->std);
+} /* }}} */
+
+static zend_object* php_phongo_undefined_create_object(zend_class_entry* class_type) /* {{{ */
+{
+ php_phongo_undefined_t* intern = NULL;
+
+ intern = PHONGO_ALLOC_OBJECT_T(php_phongo_undefined_t, class_type);
+ zend_object_std_init(&intern->std, class_type);
+ object_properties_init(&intern->std, class_type);
+
+ intern->std.handlers = &php_phongo_handler_undefined;
+
+ return &intern->std;
+} /* }}} */
+/* }}} */
+
+void php_phongo_undefined_init_ce(INIT_FUNC_ARGS) /* {{{ */
+{
+ zend_class_entry ce;
+
+ INIT_NS_CLASS_ENTRY(ce, "MongoDB\\BSON", "Undefined", php_phongo_undefined_me);
+ php_phongo_undefined_ce = zend_register_internal_class(&ce);
+ php_phongo_undefined_ce->create_object = php_phongo_undefined_create_object;
+ PHONGO_CE_FINAL(php_phongo_undefined_ce);
+
+ zend_class_implements(php_phongo_undefined_ce, 1, php_phongo_json_serializable_ce);
+ zend_class_implements(php_phongo_undefined_ce, 1, php_phongo_type_ce);
+ zend_class_implements(php_phongo_undefined_ce, 1, zend_ce_serializable);
+
+ memcpy(&php_phongo_handler_undefined, phongo_get_std_object_handlers(), sizeof(zend_object_handlers));
+ /* Re-assign default handler previously removed in php_phongo.c */
+ php_phongo_handler_undefined.clone_obj = zend_objects_clone_obj;
+ php_phongo_handler_undefined.free_obj = php_phongo_undefined_free_object;
+ php_phongo_handler_undefined.offset = XtOffsetOf(php_phongo_undefined_t, std);
+} /* }}} */
+
+/*
+ * 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.8.1/src/BSON/Unserializable.c b/mongodb-1.9.0/src/BSON/Unserializable.c
similarity index 100%
rename from mongodb-1.8.1/src/BSON/Unserializable.c
rename to mongodb-1.9.0/src/BSON/Unserializable.c
diff --git a/mongodb-1.9.0/src/BSON/functions.c b/mongodb-1.9.0/src/BSON/functions.c
new file mode 100644
index 00000000..2420f576
--- /dev/null
+++ b/mongodb-1.9.0/src/BSON/functions.c
@@ -0,0 +1,193 @@
+/*
+ * 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.
+ */
+
+#include <php.h>
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "phongo_compat.h"
+#include "php_phongo.h"
+#include "php_bson.h"
+
+typedef enum {
+ PHONGO_JSON_MODE_LEGACY,
+ PHONGO_JSON_MODE_CANONICAL,
+ PHONGO_JSON_MODE_RELAXED,
+} php_phongo_json_mode_t;
+
+/* {{{ proto string MongoDB\BSON\fromPHP(array|object $value)
+ Returns the BSON representation of a PHP value */
+PHP_FUNCTION(MongoDB_BSON_fromPHP)
+{
+ zend_error_handling error_handling;
+ zval* data;
+ bson_t* bson;
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "A", &data) == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ bson = bson_new();
+ php_phongo_zval_to_bson(data, PHONGO_BSON_NONE, bson, NULL);
+
+ RETVAL_STRINGL((const char*) bson_get_data(bson), bson->len);
+ bson_destroy(bson);
+} /* }}} */
+
+/* {{{ proto array|object MongoDB\BSON\toPHP(string $bson [, array $typemap = array()])
+ Returns the PHP representation of a BSON value, optionally converting it into a custom class */
+PHP_FUNCTION(MongoDB_BSON_toPHP)
+{
+ zend_error_handling error_handling;
+ char* data;
+ size_t data_len;
+ zval* typemap = NULL;
+ php_phongo_bson_state state;
+
+ PHONGO_BSON_INIT_STATE(state);
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|a!", &data, &data_len, &typemap) == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ if (!php_phongo_bson_typemap_to_state(typemap, &state.map)) {
+ return;
+ }
+
+ if (!php_phongo_bson_to_zval_ex((const unsigned char*) data, data_len, &state)) {
+ zval_ptr_dtor(&state.zchild);
+ php_phongo_bson_typemap_dtor(&state.map);
+ RETURN_NULL();
+ }
+
+ php_phongo_bson_typemap_dtor(&state.map);
+
+ RETURN_ZVAL(&state.zchild, 0, 1);
+} /* }}} */
+
+/* {{{ proto string MongoDB\BSON\fromJSON(string $json)
+ Returns the BSON representation of a JSON value */
+PHP_FUNCTION(MongoDB_BSON_fromJSON)
+{
+ zend_error_handling error_handling;
+ char* json;
+ size_t json_len;
+ bson_t bson = BSON_INITIALIZER;
+ bson_error_t error = { 0 };
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &json, &json_len) == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ if (bson_init_from_json(&bson, (const char*) json, json_len, &error)) {
+ RETVAL_STRINGL((const char*) bson_get_data(&bson), bson.len);
+ bson_destroy(&bson);
+ } else {
+ phongo_throw_exception(PHONGO_ERROR_UNEXPECTED_VALUE, "%s", error.domain == BSON_ERROR_JSON ? error.message : "Error parsing JSON");
+ }
+} /* }}} */
+
+static void phongo_bson_to_json(INTERNAL_FUNCTION_PARAMETERS, php_phongo_json_mode_t mode)
+{
+ zend_error_handling error_handling;
+ char* data;
+ size_t data_len;
+ const bson_t* bson;
+ bool eof = false;
+ bson_reader_t* reader;
+ char* json = NULL;
+ size_t json_len;
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &data, &data_len) == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ reader = bson_reader_new_from_data((const unsigned char*) data, data_len);
+ bson = bson_reader_read(reader, NULL);
+
+ if (!bson) {
+ phongo_throw_exception(PHONGO_ERROR_UNEXPECTED_VALUE, "Could not read document from BSON reader");
+ bson_reader_destroy(reader);
+ return;
+ }
+
+ if (mode == PHONGO_JSON_MODE_LEGACY) {
+ json = bson_as_json(bson, &json_len);
+ } else if (mode == PHONGO_JSON_MODE_CANONICAL) {
+ json = bson_as_canonical_extended_json(bson, &json_len);
+ } else if (mode == PHONGO_JSON_MODE_RELAXED) {
+ json = bson_as_relaxed_extended_json(bson, &json_len);
+ }
+
+ if (!json) {
+ phongo_throw_exception(PHONGO_ERROR_UNEXPECTED_VALUE, "Could not convert BSON document to a JSON string");
+ bson_reader_destroy(reader);
+ return;
+ }
+
+ RETVAL_STRINGL(json, json_len);
+ bson_free(json);
+
+ if (bson_reader_read(reader, &eof) || !eof) {
+ phongo_throw_exception(PHONGO_ERROR_UNEXPECTED_VALUE, "Reading document did not exhaust input buffer");
+ }
+
+ bson_reader_destroy(reader);
+} /* }}} */
+
+/* {{{ proto string MongoDB\BSON\toJSON(string $bson)
+ Returns the legacy extended JSON representation of a BSON value */
+PHP_FUNCTION(MongoDB_BSON_toJSON)
+{
+ phongo_bson_to_json(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHONGO_JSON_MODE_LEGACY);
+} /* }}} */
+
+/* {{{ proto string MongoDB\BSON\toCanonicalExtendedJSON(string $bson)
+ Returns the canonical extended JSON representation of a BSON value */
+PHP_FUNCTION(MongoDB_BSON_toCanonicalExtendedJSON)
+{
+ phongo_bson_to_json(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHONGO_JSON_MODE_CANONICAL);
+} /* }}} */
+
+/* {{{ proto string MongoDB\BSON\toRelaxedExtendedJSON(string $bson)
+ Returns the relaxed extended JSON representation of a BSON value */
+PHP_FUNCTION(MongoDB_BSON_toRelaxedExtendedJSON)
+{
+ phongo_bson_to_json(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHONGO_JSON_MODE_RELAXED);
+} /* }}} */
+
+/*
+ * 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.8.1/src/BSON/functions.h b/mongodb-1.9.0/src/BSON/functions.h
similarity index 100%
rename from mongodb-1.8.1/src/BSON/functions.h
rename to mongodb-1.9.0/src/BSON/functions.h
diff --git a/mongodb-1.8.1/src/LIBMONGOCRYPT_VERSION_CURRENT b/mongodb-1.9.0/src/LIBMONGOCRYPT_VERSION_CURRENT
similarity index 100%
rename from mongodb-1.8.1/src/LIBMONGOCRYPT_VERSION_CURRENT
rename to mongodb-1.9.0/src/LIBMONGOCRYPT_VERSION_CURRENT
diff --git a/mongodb-1.9.0/src/LIBMONGOC_VERSION_CURRENT b/mongodb-1.9.0/src/LIBMONGOC_VERSION_CURRENT
new file mode 100644
index 00000000..06fb41b6
--- /dev/null
+++ b/mongodb-1.9.0/src/LIBMONGOC_VERSION_CURRENT
@@ -0,0 +1 @@
+1.17.2
diff --git a/mongodb-1.9.0/src/MongoDB/BulkWrite.c b/mongodb-1.9.0/src/MongoDB/BulkWrite.c
new file mode 100644
index 00000000..490dee32
--- /dev/null
+++ b/mongodb-1.9.0/src/MongoDB/BulkWrite.c
@@ -0,0 +1,682 @@
+/*
+ * 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.
+ */
+
+#include <php.h>
+#include <Zend/zend_interfaces.h>
+#include <ext/spl/spl_iterators.h>
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "php_array_api.h"
+#include "phongo_compat.h"
+#include "php_phongo.h"
+#include "php_bson.h"
+
+#define PHONGO_BULKWRITE_BYPASS_UNSET -1
+
+zend_class_entry* php_phongo_bulkwrite_ce;
+
+/* Extracts the "_id" field of a BSON document into a return value. */
+static void php_phongo_bulkwrite_extract_id(bson_t* doc, zval** return_value) /* {{{ */
+{
+ zval* id = NULL;
+ php_phongo_bson_state state;
+
+ PHONGO_BSON_INIT_STATE(state);
+ state.map.root_type = PHONGO_TYPEMAP_NATIVE_ARRAY;
+
+ if (!php_phongo_bson_to_zval_ex(bson_get_data(doc), doc->len, &state)) {
+ goto cleanup;
+ }
+
+ id = php_array_fetchc(&state.zchild, "_id");
+
+ if (id) {
+ ZVAL_ZVAL(*return_value, id, 1, 0);
+ }
+
+cleanup:
+ zval_ptr_dtor(&state.zchild);
+} /* }}} */
+
+/* Returns whether any top-level field names in the document contain a "$". */
+static inline bool php_phongo_bulkwrite_update_has_operators(bson_t* bupdate) /* {{{ */
+{
+ bson_iter_t iter;
+
+ if (bson_iter_init(&iter, bupdate)) {
+ while (bson_iter_next(&iter)) {
+ if (strchr(bson_iter_key(&iter), '$')) {
+ return true;
+ }
+ }
+ }
+
+ return false;
+} /* }}} */
+
+/* Returns whether the update document is considered an aggregation pipeline */
+static inline bool php_phongo_bulkwrite_update_is_pipeline(bson_t* bupdate) /* {{{ */
+{
+ bson_iter_t iter;
+ bson_iter_t child;
+ const char* key;
+ int i = 0;
+ char* i_str;
+
+ if (!bson_iter_init(&iter, bupdate)) {
+ return false;
+ }
+
+ while (bson_iter_next(&iter)) {
+ key = bson_iter_key(&iter);
+ i_str = bson_strdup_printf("%d", i++);
+
+ if (strcmp(key, i_str)) {
+ bson_free(i_str);
+ return false;
+ }
+
+ bson_free(i_str);
+
+ if (BSON_ITER_HOLDS_DOCUMENT(&iter)) {
+ if (!bson_iter_recurse(&iter, &child)) {
+ return false;
+ }
+ if (!bson_iter_next(&child)) {
+ return false;
+ }
+ key = bson_iter_key(&child);
+ if (key[0] != '$') {
+ return false;
+ }
+ } else {
+ return false;
+ }
+ }
+
+ /* should return false when the document is empty */
+ return i != 0;
+} /* }}} */
+
+/* Returns whether the BSON array's keys are a sequence of integer strings
+ * starting with "0". BSON_APPEND_ARRAY considers it the caller's responsibility
+ * to ensure that the array's keys are properly formatted. */
+static inline bool php_phongo_bulkwrite_bson_array_has_valid_keys(bson_t* array) /* {{{ */
+{
+ bson_iter_t iter;
+
+ if (bson_empty(array)) {
+ return true;
+ }
+
+ if (bson_iter_init(&iter, array)) {
+ char key[12];
+ int count = 0;
+
+ while (bson_iter_next(&iter)) {
+ bson_snprintf(key, sizeof(key), "%d", count);
+
+ if (0 != strcmp(key, bson_iter_key(&iter))) {
+ return false;
+ }
+
+ count++;
+ }
+ }
+
+ return true;
+} /* }}} */
+
+/* Appends an array field for the given opts document and key. Returns true on
+ * success; otherwise, false is returned and an exception is thrown. */
+static bool php_phongo_bulkwrite_opts_append_array(bson_t* opts, const char* key, zval* zarr) /* {{{ */
+{
+ zval* value = php_array_fetch(zarr, key);
+ bson_t b = BSON_INITIALIZER;
+
+ if (Z_TYPE_P(value) != IS_OBJECT && Z_TYPE_P(value) != IS_ARRAY) {
+ phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Expected \"%s\" option to be array or object, %s given", key, zend_get_type_by_const(Z_TYPE_P(value)));
+ return false;
+ }
+
+ php_phongo_zval_to_bson(value, PHONGO_BSON_NONE, &b, NULL);
+
+ if (EG(exception)) {
+ bson_destroy(&b);
+ return false;
+ }
+
+ if (!php_phongo_bulkwrite_bson_array_has_valid_keys(&b)) {
+ phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "\"%s\" option has invalid keys for a BSON array", key);
+ bson_destroy(&b);
+ return false;
+ }
+
+ if (!BSON_APPEND_ARRAY(opts, key, &b)) {
+ phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Error appending \"%s\" option", key);
+ bson_destroy(&b);
+ return false;
+ }
+
+ bson_destroy(&b);
+ return true;
+} /* }}} */
+
+/* Appends a document field for the given opts document and key. Returns true on
+ * success; otherwise, false is returned and an exception is thrown. */
+static bool php_phongo_bulkwrite_opts_append_document(bson_t* opts, const char* key, zval* zarr) /* {{{ */
+{
+ zval* value = php_array_fetch(zarr, key);
+ bson_t b = BSON_INITIALIZER;
+
+ if (Z_TYPE_P(value) != IS_OBJECT && Z_TYPE_P(value) != IS_ARRAY) {
+ phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Expected \"%s\" option to be array or object, %s given", key, zend_get_type_by_const(Z_TYPE_P(value)));
+ return false;
+ }
+
+ php_phongo_zval_to_bson(value, PHONGO_BSON_NONE, &b, NULL);
+
+ if (EG(exception)) {
+ bson_destroy(&b);
+ return false;
+ }
+
+ if (!BSON_APPEND_DOCUMENT(opts, key, &b)) {
+ phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Error appending \"%s\" option", key);
+ bson_destroy(&b);
+ return false;
+ }
+
+ bson_destroy(&b);
+ return true;
+} /* }}} */
+
+#define PHONGO_BULKWRITE_APPEND_BOOL(opt, value) \
+ if (!BSON_APPEND_BOOL(boptions, (opt), (value))) { \
+ phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Error appending \"%s\" option", (opt)); \
+ return false; \
+ }
+
+#define PHONGO_BULKWRITE_APPEND_INT32(opt, value) \
+ if (!BSON_APPEND_INT32(boptions, (opt), (value))) { \
+ phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Error appending \"%s\" option", (opt)); \
+ return false; \
+ }
+
+#define PHONGO_BULKWRITE_OPT_ARRAY(opt) \
+ if (zoptions && php_array_existsc(zoptions, (opt))) { \
+ if (!php_phongo_bulkwrite_opts_append_array(boptions, (opt), zoptions)) { \
+ return false; \
+ } \
+ }
+
+#define PHONGO_BULKWRITE_OPT_DOCUMENT(opt) \
+ if (zoptions && php_array_existsc(zoptions, (opt))) { \
+ if (!php_phongo_bulkwrite_opts_append_document(boptions, (opt), zoptions)) { \
+ return false; \
+ } \
+ }
+
+/* Initialize the "hint" option. Returns true on success; otherwise, false is
+ * returned and an exception is thrown.
+ *
+ * The "hint" option must be a string or document. Check for both types and
+ * merge into BSON options accordingly. */
+static bool php_phongo_bulkwrite_opt_hint(bson_t* boptions, zval* zoptions) /* {{{ */
+{
+ /* The "hint" option (or "$hint" modifier) must be a string or document.
+ * Check for both types and merge into BSON options accordingly. */
+ if (zoptions && php_array_existsc(zoptions, "hint")) {
+ zend_uchar type = Z_TYPE_P(php_array_fetchc(zoptions, "hint"));
+
+ if (type == IS_STRING) {
+ zval* value = php_array_fetchc(zoptions, "hint");
+
+ if (!bson_append_utf8(boptions, "hint", 4, Z_STRVAL_P(value), Z_STRLEN_P(value))) {
+ phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Error appending \"hint\" option");
+ return false;
+ }
+ } else if (type == IS_OBJECT || type == IS_ARRAY) {
+ PHONGO_BULKWRITE_OPT_DOCUMENT("hint");
+ } else {
+ phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Expected \"hint\" option to be string, array, or object, %s given", zend_get_type_by_const(type));
+ return false;
+ }
+ }
+
+ return true;
+} /* }}} */
+
+/* Applies options (including defaults) for an update operation. */
+static bool php_phongo_bulkwrite_update_apply_options(bson_t* boptions, zval* zoptions) /* {{{ */
+{
+ bool multi = false, upsert = false;
+
+ if (zoptions) {
+ multi = php_array_fetchc_bool(zoptions, "multi");
+ upsert = php_array_fetchc_bool(zoptions, "upsert");
+ }
+
+ PHONGO_BULKWRITE_APPEND_BOOL("multi", multi);
+ PHONGO_BULKWRITE_APPEND_BOOL("upsert", upsert);
+ PHONGO_BULKWRITE_OPT_ARRAY("arrayFilters");
+ PHONGO_BULKWRITE_OPT_DOCUMENT("collation");
+
+ if (!php_phongo_bulkwrite_opt_hint(boptions, zoptions)) {
+ return false;
+ }
+
+ return true;
+} /* }}} */
+
+/* Applies options (including defaults) for an delete operation. */
+static bool php_phongo_bulkwrite_delete_apply_options(bson_t* boptions, zval* zoptions) /* {{{ */
+{
+ int32_t limit = 0;
+
+ if (zoptions) {
+ limit = php_array_fetchc_bool(zoptions, "limit") ? 1 : 0;
+ }
+
+ PHONGO_BULKWRITE_APPEND_INT32("limit", limit);
+ PHONGO_BULKWRITE_OPT_DOCUMENT("collation");
+
+ if (!php_phongo_bulkwrite_opt_hint(boptions, zoptions)) {
+ return false;
+ }
+
+ return true;
+} /* }}} */
+
+#undef PHONGO_BULKWRITE_APPEND_BOOL
+#undef PHONGO_BULKWRITE_APPEND_INT32
+#undef PHONGO_BULKWRITE_OPT_DOCUMENT
+
+/* {{{ proto void MongoDB\Driver\BulkWrite::__construct([array $options = array()])
+ Constructs a new BulkWrite */
+static PHP_METHOD(BulkWrite, __construct)
+{
+ zend_error_handling error_handling;
+ php_phongo_bulkwrite_t* intern;
+ zval* options = NULL;
+ zend_bool ordered = 1;
+
+ intern = Z_BULKWRITE_OBJ_P(getThis());
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "|a!", &options) == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ if (options && php_array_existsc(options, "ordered")) {
+ ordered = php_array_fetchc_bool(options, "ordered");
+ }
+
+ intern->bulk = mongoc_bulk_operation_new(ordered);
+ intern->ordered = ordered;
+ intern->bypass = PHONGO_BULKWRITE_BYPASS_UNSET;
+ intern->num_ops = 0;
+ intern->executed = false;
+
+ if (options && php_array_existsc(options, "bypassDocumentValidation")) {
+ zend_bool bypass = php_array_fetchc_bool(options, "bypassDocumentValidation");
+ mongoc_bulk_operation_set_bypass_document_validation(intern->bulk, bypass);
+ intern->bypass = bypass;
+ }
+} /* }}} */
+
+/* {{{ proto mixed MongoDB\Driver\BulkWrite::insert(array|object $document)
+ Adds an insert operation to the BulkWrite */
+static PHP_METHOD(BulkWrite, insert)
+{
+ zend_error_handling error_handling;
+ php_phongo_bulkwrite_t* intern;
+ zval* zdocument;
+ bson_t bdocument = BSON_INITIALIZER, boptions = BSON_INITIALIZER;
+ bson_t* bson_out = NULL;
+ int bson_flags = PHONGO_BSON_ADD_ID;
+ bson_error_t error = { 0 };
+
+ intern = Z_BULKWRITE_OBJ_P(getThis());
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "A", &zdocument) == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ bson_flags |= PHONGO_BSON_RETURN_ID;
+
+ php_phongo_zval_to_bson(zdocument, bson_flags, &bdocument, &bson_out);
+
+ if (EG(exception)) {
+ goto cleanup;
+ }
+
+ if (!mongoc_bulk_operation_insert_with_opts(intern->bulk, &bdocument, &boptions, &error)) {
+ phongo_throw_exception_from_bson_error_t(&error);
+ goto cleanup;
+ }
+
+ intern->num_ops++;
+
+ if (!bson_out) {
+ phongo_throw_exception(PHONGO_ERROR_LOGIC, "Did not receive result from bulk write. Please file a bug report.");
+ goto cleanup;
+ }
+
+ php_phongo_bulkwrite_extract_id(bson_out, &return_value);
+
+cleanup:
+ bson_destroy(&bdocument);
+ bson_destroy(&boptions);
+ bson_clear(&bson_out);
+} /* }}} */
+
+/* {{{ proto void MongoDB\Driver\BulkWrite::update(array|object $query, array|object $newObj[, array $updateOptions = array()])
+ Adds an update operation to the BulkWrite */
+static PHP_METHOD(BulkWrite, update)
+{
+ zend_error_handling error_handling;
+ php_phongo_bulkwrite_t* intern;
+ zval * zquery, *zupdate, *zoptions = NULL;
+ bson_t bquery = BSON_INITIALIZER, bupdate = BSON_INITIALIZER, boptions = BSON_INITIALIZER;
+ bson_error_t error = { 0 };
+
+ intern = Z_BULKWRITE_OBJ_P(getThis());
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "AA|a!", &zquery, &zupdate, &zoptions) == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ php_phongo_zval_to_bson(zquery, PHONGO_BSON_NONE, &bquery, NULL);
+
+ if (EG(exception)) {
+ goto cleanup;
+ }
+
+ php_phongo_zval_to_bson(zupdate, PHONGO_BSON_NONE, &bupdate, NULL);
+
+ if (EG(exception)) {
+ goto cleanup;
+ }
+
+ if (!php_phongo_bulkwrite_update_apply_options(&boptions, zoptions)) {
+ goto cleanup;
+ }
+
+ if (php_phongo_bulkwrite_update_has_operators(&bupdate) || php_phongo_bulkwrite_update_is_pipeline(&bupdate)) {
+ if (zoptions && php_array_fetchc_bool(zoptions, "multi")) {
+ if (!mongoc_bulk_operation_update_many_with_opts(intern->bulk, &bquery, &bupdate, &boptions, &error)) {
+ phongo_throw_exception_from_bson_error_t(&error);
+ goto cleanup;
+ }
+ } else {
+ if (!mongoc_bulk_operation_update_one_with_opts(intern->bulk, &bquery, &bupdate, &boptions, &error)) {
+ phongo_throw_exception_from_bson_error_t(&error);
+ goto cleanup;
+ }
+ }
+ } else {
+ if (zoptions && php_array_fetchc_bool(zoptions, "multi")) {
+ phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Replacement document conflicts with true \"multi\" option");
+ goto cleanup;
+ }
+
+ if (!mongoc_bulk_operation_replace_one_with_opts(intern->bulk, &bquery, &bupdate, &boptions, &error)) {
+ phongo_throw_exception_from_bson_error_t(&error);
+ goto cleanup;
+ }
+ }
+
+ intern->num_ops++;
+
+cleanup:
+ bson_destroy(&bquery);
+ bson_destroy(&bupdate);
+ bson_destroy(&boptions);
+} /* }}} */
+
+/* {{{ proto void MongoDB\Driver\BulkWrite::delete(array|object $query[, array $deleteOptions = array()])
+ Adds a delete operation to the BulkWrite */
+static PHP_METHOD(BulkWrite, delete)
+{
+ zend_error_handling error_handling;
+ php_phongo_bulkwrite_t* intern;
+ zval * zquery, *zoptions = NULL;
+ bson_t bquery = BSON_INITIALIZER, boptions = BSON_INITIALIZER;
+ bson_error_t error = { 0 };
+
+ intern = Z_BULKWRITE_OBJ_P(getThis());
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "A|a!", &zquery, &zoptions) == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ php_phongo_zval_to_bson(zquery, PHONGO_BSON_NONE, &bquery, NULL);
+
+ if (EG(exception)) {
+ goto cleanup;
+ }
+
+ if (!php_phongo_bulkwrite_delete_apply_options(&boptions, zoptions)) {
+ goto cleanup;
+ }
+
+ if (zoptions && php_array_fetchc_bool(zoptions, "limit")) {
+ if (!mongoc_bulk_operation_remove_one_with_opts(intern->bulk, &bquery, &boptions, &error)) {
+ phongo_throw_exception_from_bson_error_t(&error);
+ goto cleanup;
+ }
+ } else {
+ if (!mongoc_bulk_operation_remove_many_with_opts(intern->bulk, &bquery, &boptions, &error)) {
+ phongo_throw_exception_from_bson_error_t(&error);
+ goto cleanup;
+ }
+ }
+
+ intern->num_ops++;
+
+cleanup:
+ bson_destroy(&bquery);
+ bson_destroy(&boptions);
+} /* }}} */
+
+/* {{{ proto integer MongoDB\Driver\BulkWrite::count()
+ Returns the number of operations that have been added to the BulkWrite */
+static PHP_METHOD(BulkWrite, count)
+{
+ zend_error_handling error_handling;
+ php_phongo_bulkwrite_t* intern;
+
+ intern = Z_BULKWRITE_OBJ_P(getThis());
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters_none() == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ RETURN_LONG(intern->num_ops);
+} /* }}} */
+
+/* {{{ MongoDB\Driver\BulkWrite function entries */
+ZEND_BEGIN_ARG_INFO_EX(ai_BulkWrite___construct, 0, 0, 0)
+ ZEND_ARG_ARRAY_INFO(0, options, 1)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(ai_BulkWrite_insert, 0, 0, 1)
+ ZEND_ARG_INFO(0, document)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(ai_BulkWrite_update, 0, 0, 2)
+ ZEND_ARG_INFO(0, query)
+ ZEND_ARG_INFO(0, newObj)
+ ZEND_ARG_ARRAY_INFO(0, updateOptions, 1)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(ai_BulkWrite_delete, 0, 0, 1)
+ ZEND_ARG_INFO(0, query)
+ ZEND_ARG_ARRAY_INFO(0, deleteOptions, 1)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(ai_BulkWrite_void, 0, 0, 0)
+ZEND_END_ARG_INFO()
+
+static zend_function_entry php_phongo_bulkwrite_me[] = {
+ /* clang-format off */
+ PHP_ME(BulkWrite, __construct, ai_BulkWrite___construct, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
+ PHP_ME(BulkWrite, insert, ai_BulkWrite_insert, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
+ PHP_ME(BulkWrite, update, ai_BulkWrite_update, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
+ PHP_ME(BulkWrite, delete, ai_BulkWrite_delete, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
+ PHP_ME(BulkWrite, count, ai_BulkWrite_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
+ ZEND_NAMED_ME(__wakeup, PHP_FN(MongoDB_disabled___wakeup), ai_BulkWrite_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
+ PHP_FE_END
+ /* clang-format on */
+};
+/* }}} */
+
+/* {{{ MongoDB\Driver\BulkWrite object handlers */
+static zend_object_handlers php_phongo_handler_bulkwrite;
+
+static void php_phongo_bulkwrite_free_object(zend_object* object) /* {{{ */
+{
+ php_phongo_bulkwrite_t* intern = Z_OBJ_BULKWRITE(object);
+
+ zend_object_std_dtor(&intern->std);
+
+ if (intern->bulk) {
+ mongoc_bulk_operation_destroy(intern->bulk);
+ }
+
+ if (intern->database) {
+ efree(intern->database);
+ }
+
+ if (intern->collection) {
+ efree(intern->collection);
+ }
+
+ if (!Z_ISUNDEF(intern->session)) {
+ zval_ptr_dtor(&intern->session);
+ }
+} /* }}} */
+
+static zend_object* php_phongo_bulkwrite_create_object(zend_class_entry* class_type) /* {{{ */
+{
+ php_phongo_bulkwrite_t* intern = NULL;
+
+ intern = PHONGO_ALLOC_OBJECT_T(php_phongo_bulkwrite_t, class_type);
+
+ zend_object_std_init(&intern->std, class_type);
+ object_properties_init(&intern->std, class_type);
+
+ intern->std.handlers = &php_phongo_handler_bulkwrite;
+
+ return &intern->std;
+} /* }}} */
+
+static HashTable* php_phongo_bulkwrite_get_debug_info(phongo_compat_object_handler_type* object, int* is_temp) /* {{{ */
+{
+ zval retval = ZVAL_STATIC_INIT;
+ php_phongo_bulkwrite_t* intern = NULL;
+
+ *is_temp = 1;
+ intern = Z_OBJ_BULKWRITE(PHONGO_COMPAT_GET_OBJ(object));
+ array_init(&retval);
+
+ 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");
+ }
+
+ ADD_ASSOC_BOOL_EX(&retval, "ordered", intern->ordered);
+
+ if (intern->bypass != PHONGO_BULKWRITE_BYPASS_UNSET) {
+ ADD_ASSOC_BOOL_EX(&retval, "bypassDocumentValidation", intern->bypass);
+ } else {
+ ADD_ASSOC_NULL_EX(&retval, "bypassDocumentValidation");
+ }
+
+ ADD_ASSOC_BOOL_EX(&retval, "executed", intern->executed);
+ ADD_ASSOC_LONG_EX(&retval, "server_id", mongoc_bulk_operation_get_hint(intern->bulk));
+
+ if (!Z_ISUNDEF(intern->session)) {
+ ADD_ASSOC_ZVAL_EX(&retval, "session", &intern->session);
+ Z_ADDREF(intern->session);
+ } else {
+ ADD_ASSOC_NULL_EX(&retval, "session");
+ }
+
+ if (mongoc_bulk_operation_get_write_concern(intern->bulk)) {
+ zval write_concern;
+
+ php_phongo_write_concern_to_zval(&write_concern, mongoc_bulk_operation_get_write_concern(intern->bulk));
+ ADD_ASSOC_ZVAL_EX(&retval, "write_concern", &write_concern);
+ } else {
+ ADD_ASSOC_NULL_EX(&retval, "write_concern");
+ }
+
+ return Z_ARRVAL(retval);
+} /* }}} */
+/* }}} */
+
+void php_phongo_bulkwrite_init_ce(INIT_FUNC_ARGS) /* {{{ */
+{
+ zend_class_entry ce;
+
+ INIT_NS_CLASS_ENTRY(ce, "MongoDB\\Driver", "BulkWrite", php_phongo_bulkwrite_me);
+ php_phongo_bulkwrite_ce = zend_register_internal_class(&ce);
+ php_phongo_bulkwrite_ce->create_object = php_phongo_bulkwrite_create_object;
+ PHONGO_CE_FINAL(php_phongo_bulkwrite_ce);
+ PHONGO_CE_DISABLE_SERIALIZATION(php_phongo_bulkwrite_ce);
+
+ memcpy(&php_phongo_handler_bulkwrite, phongo_get_std_object_handlers(), sizeof(zend_object_handlers));
+ php_phongo_handler_bulkwrite.get_debug_info = php_phongo_bulkwrite_get_debug_info;
+ php_phongo_handler_bulkwrite.free_obj = php_phongo_bulkwrite_free_object;
+ php_phongo_handler_bulkwrite.offset = XtOffsetOf(php_phongo_bulkwrite_t, std);
+
+ zend_class_implements(php_phongo_bulkwrite_ce, 1, spl_ce_Countable);
+} /* }}} */
+
+/*
+ * 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.9.0/src/MongoDB/ClientEncryption.c b/mongodb-1.9.0/src/MongoDB/ClientEncryption.c
new file mode 100644
index 00000000..ef8703a7
--- /dev/null
+++ b/mongodb-1.9.0/src/MongoDB/ClientEncryption.c
@@ -0,0 +1,189 @@
+/*
+ * Copyright 2019 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 <php.h>
+#include <Zend/zend_interfaces.h>
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "phongo_compat.h"
+#include "php_phongo.h"
+
+zend_class_entry* php_phongo_clientencryption_ce;
+
+/* {{{ proto MongoDB\BSON\Binary MongoDB\Driver\ClientEncryption::createDataKey(string $kmsProvider[, array $options])
+ Creates a new key document and inserts into the key vault collection. */
+static PHP_METHOD(ClientEncryption, createDataKey)
+{
+ char* kms_provider = NULL;
+ size_t kms_provider_len = 0;
+ zval* options = NULL;
+ zend_error_handling error_handling;
+ php_phongo_clientencryption_t* intern;
+
+ intern = Z_CLIENTENCRYPTION_OBJ_P(getThis());
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|a!", &kms_provider, &kms_provider_len, &options) == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+
+ zend_restore_error_handling(&error_handling);
+
+ phongo_clientencryption_create_datakey(intern, return_value, kms_provider, options);
+} /* }}} */
+
+/* {{{ proto MongoDB\BSON\Binary MongoDB\Driver\ClientEncryption::encrypt(mixed $value[, array $options])
+ Encrypts a value with a given key and algorithm */
+static PHP_METHOD(ClientEncryption, encrypt)
+{
+ zval* value = NULL;
+ zval* options = NULL;
+ zend_error_handling error_handling;
+ php_phongo_clientencryption_t* intern;
+
+ intern = Z_CLIENTENCRYPTION_OBJ_P(getThis());
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "z|a!", &value, &options) == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+
+ zend_restore_error_handling(&error_handling);
+
+ phongo_clientencryption_encrypt(intern, value, return_value, options);
+} /* }}} */
+
+/* {{{ proto mixed MongoDB\Driver\ClientEncryption::decrypt(MongoDB\BSON\BinaryInterface $value)
+ Decrypts an encrypted value (BSON binary of subtype 6). Returns the original BSON value */
+static PHP_METHOD(ClientEncryption, decrypt)
+{
+ zval* ciphertext;
+ zend_error_handling error_handling;
+ php_phongo_clientencryption_t* intern;
+
+ intern = Z_CLIENTENCRYPTION_OBJ_P(getThis());
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "O", &ciphertext, php_phongo_binary_interface_ce) == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+
+ zend_restore_error_handling(&error_handling);
+
+ phongo_clientencryption_decrypt(intern, ciphertext, return_value);
+} /* }}} */
+
+ZEND_BEGIN_ARG_INFO_EX(ai_ClientEncryption_createDataKey, 0, 0, 1)
+ ZEND_ARG_INFO(0, kmsProvider)
+ ZEND_ARG_ARRAY_INFO(0, options, 1)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(ai_ClientEncryption_encrypt, 0, 0, 1)
+ ZEND_ARG_INFO(0, value)
+ ZEND_ARG_ARRAY_INFO(0, options, 1)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(ai_ClientEncryption_decrypt, 0, 0, 1)
+ ZEND_ARG_OBJ_INFO(0, keyVaultClient, MongoDB\\BSON\\BinaryInterface, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(ai_ClientEncryption_void, 0, 0, 0)
+ZEND_END_ARG_INFO()
+
+static zend_function_entry php_phongo_clientencryption_me[] = {
+ /* clang-format off */
+ PHP_ME(ClientEncryption, createDataKey, ai_ClientEncryption_createDataKey, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
+ PHP_ME(ClientEncryption, encrypt, ai_ClientEncryption_encrypt, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
+ PHP_ME(ClientEncryption, decrypt, ai_ClientEncryption_decrypt, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
+ ZEND_NAMED_ME(__construct, PHP_FN(MongoDB_disabled___construct), ai_ClientEncryption_void, ZEND_ACC_PRIVATE | ZEND_ACC_FINAL)
+ ZEND_NAMED_ME(__wakeup, PHP_FN(MongoDB_disabled___wakeup), ai_ClientEncryption_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
+ PHP_FE_END
+ /* clang-format on */
+};
+/* }}} */
+
+/* {{{ MongoDB\Driver\ClientEncryption object handlers */
+static zend_object_handlers php_phongo_handler_clientencryption;
+
+static void php_phongo_clientencryption_free_object(zend_object* object) /* {{{ */
+{
+ php_phongo_clientencryption_t* intern = Z_OBJ_CLIENTENCRYPTION(object);
+
+ zend_object_std_dtor(&intern->std);
+
+ if (intern->client_encryption) {
+ mongoc_client_encryption_destroy(intern->client_encryption);
+ }
+} /* }}} */
+
+static zend_object* php_phongo_clientencryption_create_object(zend_class_entry* class_type) /* {{{ */
+{
+ php_phongo_clientencryption_t* intern = NULL;
+
+ intern = PHONGO_ALLOC_OBJECT_T(php_phongo_clientencryption_t, class_type);
+
+ zend_object_std_init(&intern->std, class_type);
+ object_properties_init(&intern->std, class_type);
+
+ intern->std.handlers = &php_phongo_handler_clientencryption;
+
+ return &intern->std;
+} /* }}} */
+
+static HashTable* php_phongo_clientencryption_get_debug_info(phongo_compat_object_handler_type* object, int* is_temp) /* {{{ */
+{
+ php_phongo_clientencryption_t* intern = NULL;
+ zval retval = ZVAL_STATIC_INIT;
+
+ *is_temp = 1;
+ intern = Z_OBJ_CLIENTENCRYPTION(PHONGO_COMPAT_GET_OBJ(object));
+
+ array_init(&retval);
+
+ return Z_ARRVAL(retval);
+} /* }}} */
+/* }}} */
+
+void php_phongo_clientencryption_init_ce(INIT_FUNC_ARGS) /* {{{ */
+{
+ zend_class_entry ce;
+
+ INIT_NS_CLASS_ENTRY(ce, "MongoDB\\Driver", "ClientEncryption", php_phongo_clientencryption_me);
+ php_phongo_clientencryption_ce = zend_register_internal_class(&ce);
+ php_phongo_clientencryption_ce->create_object = php_phongo_clientencryption_create_object;
+ PHONGO_CE_FINAL(php_phongo_clientencryption_ce);
+ PHONGO_CE_DISABLE_SERIALIZATION(php_phongo_clientencryption_ce);
+
+ memcpy(&php_phongo_handler_clientencryption, phongo_get_std_object_handlers(), sizeof(zend_object_handlers));
+ php_phongo_handler_clientencryption.get_debug_info = php_phongo_clientencryption_get_debug_info;
+ php_phongo_handler_clientencryption.free_obj = php_phongo_clientencryption_free_object;
+ php_phongo_handler_clientencryption.offset = XtOffsetOf(php_phongo_clientencryption_t, std);
+
+ zend_declare_class_constant_string(php_phongo_clientencryption_ce, ZEND_STRL("AEAD_AES_256_CBC_HMAC_SHA_512_DETERMINISTIC"), MONGOC_AEAD_AES_256_CBC_HMAC_SHA_512_DETERMINISTIC);
+ zend_declare_class_constant_string(php_phongo_clientencryption_ce, ZEND_STRL("AEAD_AES_256_CBC_HMAC_SHA_512_RANDOM"), MONGOC_AEAD_AES_256_CBC_HMAC_SHA_512_RANDOM);
+} /* }}} */
+
+/*
+ * 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.9.0/src/MongoDB/Command.c b/mongodb-1.9.0/src/MongoDB/Command.c
new file mode 100644
index 00000000..5401a06a
--- /dev/null
+++ b/mongodb-1.9.0/src/MongoDB/Command.c
@@ -0,0 +1,219 @@
+/*
+ * 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.
+ */
+
+#include <php.h>
+#include <Zend/zend_interfaces.h>
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "php_array_api.h"
+#include "phongo_compat.h"
+#include "php_phongo.h"
+#include "php_bson.h"
+
+zend_class_entry* php_phongo_command_ce;
+
+/* Initialize the "maxAwaitTimeMS" option. Returns true on success; otherwise,
+ * false is returned and an exception is thrown.
+ *
+ * The "maxAwaitTimeMS" option is assigned to the cursor after query execution
+ * via mongoc_cursor_set_max_await_time_ms(). */
+static bool php_phongo_command_init_max_await_time_ms(php_phongo_command_t* intern, zval* options) /* {{{ */
+{
+ int64_t max_await_time_ms;
+
+ if (!php_array_existsc(options, "maxAwaitTimeMS")) {
+ return true;
+ }
+
+ max_await_time_ms = php_array_fetchc_long(options, "maxAwaitTimeMS");
+
+ if (max_await_time_ms < 0) {
+ phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Expected \"maxAwaitTimeMS\" option to be >= 0, %" PRId64 " given", max_await_time_ms);
+ return false;
+ }
+
+ if (max_await_time_ms > UINT32_MAX) {
+ phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Expected \"maxAwaitTimeMS\" option to be <= %" PRIu32 ", %" PRId64 " given", UINT32_MAX, max_await_time_ms);
+ return false;
+ }
+
+ intern->max_await_time_ms = (uint32_t) max_await_time_ms;
+
+ return true;
+} /* }}} */
+
+/* Initializes the php_phongo_command_init from options argument. This
+ * function will fall back to a modifier in the absence of a top-level option
+ * (where applicable). */
+static bool php_phongo_command_init(php_phongo_command_t* intern, zval* filter, zval* options) /* {{{ */
+{
+ bson_iter_t iter;
+ bson_iter_t sub_iter;
+
+ intern->bson = bson_new();
+ intern->batch_size = 0;
+ intern->max_await_time_ms = 0;
+
+ php_phongo_zval_to_bson(filter, PHONGO_BSON_NONE, intern->bson, NULL);
+
+ /* Note: if any exceptions are thrown, we can simply return as PHP will
+ * invoke php_phongo_query_free_object to destruct the object. */
+ if (EG(exception)) {
+ return false;
+ }
+
+ if (bson_iter_init(&iter, intern->bson) && bson_iter_find_descendant(&iter, "cursor.batchSize", &sub_iter) && BSON_ITER_HOLDS_INT(&sub_iter)) {
+ int64_t batch_size = bson_iter_as_int64(&sub_iter);
+
+ if (batch_size >= 0 && batch_size <= UINT32_MAX) {
+ intern->batch_size = (uint32_t) batch_size;
+ }
+ }
+
+ if (!options) {
+ return true;
+ }
+
+ if (!php_phongo_command_init_max_await_time_ms(intern, options)) {
+ return false;
+ }
+
+ return true;
+} /* }}} */
+
+/* {{{ proto void MongoDB\Driver\Command::__construct(array|object $document[, array $options = array()])
+ Constructs a new Command */
+static PHP_METHOD(Command, __construct)
+{
+ zend_error_handling error_handling;
+ php_phongo_command_t* intern;
+ zval* document;
+ zval* options = NULL;
+
+ intern = Z_COMMAND_OBJ_P(getThis());
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "A|a!", &document, &options) == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ php_phongo_command_init(intern, document, options);
+} /* }}} */
+
+/* {{{ MongoDB\Driver\Command function entries */
+ZEND_BEGIN_ARG_INFO_EX(ai_Command___construct, 0, 0, 1)
+ ZEND_ARG_INFO(0, document)
+ ZEND_ARG_ARRAY_INFO(0, options, 1)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(ai_Command_void, 0, 0, 0)
+ZEND_END_ARG_INFO()
+
+static zend_function_entry php_phongo_command_me[] = {
+ /* clang-format off */
+ PHP_ME(Command, __construct, ai_Command___construct, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
+ ZEND_NAMED_ME(__wakeup, PHP_FN(MongoDB_disabled___wakeup), ai_Command_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
+ PHP_FE_END
+ /* clang-format on */
+};
+/* }}} */
+
+/* {{{ MongoDB\Driver\Command object handlers */
+static zend_object_handlers php_phongo_handler_command;
+
+static void php_phongo_command_free_object(zend_object* object) /* {{{ */
+{
+ php_phongo_command_t* intern = Z_OBJ_COMMAND(object);
+
+ zend_object_std_dtor(&intern->std);
+
+ if (intern->bson) {
+ bson_clear(&intern->bson);
+ }
+} /* }}} */
+
+static zend_object* php_phongo_command_create_object(zend_class_entry* class_type) /* {{{ */
+{
+ php_phongo_command_t* intern = NULL;
+
+ intern = PHONGO_ALLOC_OBJECT_T(php_phongo_command_t, class_type);
+
+ zend_object_std_init(&intern->std, class_type);
+ object_properties_init(&intern->std, class_type);
+
+ intern->std.handlers = &php_phongo_handler_command;
+
+ return &intern->std;
+} /* }}} */
+
+static HashTable* php_phongo_command_get_debug_info(phongo_compat_object_handler_type* object, int* is_temp) /* {{{ */
+{
+ php_phongo_command_t* intern;
+ zval retval = ZVAL_STATIC_INIT;
+
+ *is_temp = 1;
+ intern = Z_OBJ_COMMAND(PHONGO_COMPAT_GET_OBJ(object));
+
+ array_init_size(&retval, 1);
+
+ if (intern->bson) {
+ zval zv;
+
+ if (!php_phongo_bson_to_zval(bson_get_data(intern->bson), intern->bson->len, &zv)) {
+ zval_ptr_dtor(&zv);
+ goto done;
+ }
+
+ ADD_ASSOC_ZVAL_EX(&retval, "command", &zv);
+ } else {
+ ADD_ASSOC_NULL_EX(&retval, "command");
+ }
+
+done:
+ return Z_ARRVAL(retval);
+
+} /* }}} */
+/* }}} */
+
+void php_phongo_command_init_ce(INIT_FUNC_ARGS) /* {{{ */
+{
+ zend_class_entry ce;
+
+ INIT_NS_CLASS_ENTRY(ce, "MongoDB\\Driver", "Command", php_phongo_command_me);
+ php_phongo_command_ce = zend_register_internal_class(&ce);
+ php_phongo_command_ce->create_object = php_phongo_command_create_object;
+ PHONGO_CE_FINAL(php_phongo_command_ce);
+ PHONGO_CE_DISABLE_SERIALIZATION(php_phongo_command_ce);
+
+ memcpy(&php_phongo_handler_command, phongo_get_std_object_handlers(), sizeof(zend_object_handlers));
+ php_phongo_handler_command.get_debug_info = php_phongo_command_get_debug_info;
+ php_phongo_handler_command.free_obj = php_phongo_command_free_object;
+ php_phongo_handler_command.offset = XtOffsetOf(php_phongo_command_t, std);
+} /* }}} */
+
+/*
+ * 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.9.0/src/MongoDB/Cursor.c b/mongodb-1.9.0/src/MongoDB/Cursor.c
new file mode 100644
index 00000000..78ccfb7b
--- /dev/null
+++ b/mongodb-1.9.0/src/MongoDB/Cursor.c
@@ -0,0 +1,570 @@
+/*
+ * 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.
+ */
+
+#include <php.h>
+#include <Zend/zend_interfaces.h>
+#include <ext/spl/spl_iterators.h>
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "phongo_compat.h"
+#include "php_phongo.h"
+#include "php_bson.h"
+
+zend_class_entry* php_phongo_cursor_ce;
+
+/* Check if the cursor is exhausted (i.e. ID is zero) and free any reference to
+ * the session. Calling this function during iteration will allow an implicit
+ * session to return to the pool immediately after a getMore indicates that the
+ * server has no more results to return. */
+static void php_phongo_cursor_free_session_if_exhausted(php_phongo_cursor_t* cursor) /* {{{ */
+{
+ if (mongoc_cursor_get_id(cursor->cursor)) {
+ return;
+ }
+
+ if (!Z_ISUNDEF(cursor->session)) {
+ zval_ptr_dtor(&cursor->session);
+ ZVAL_UNDEF(&cursor->session);
+ }
+} /* }}} */
+
+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);
+ ZVAL_UNDEF(&cursor->visitor_data.zchild);
+ }
+} /* }}} */
+
+/* {{{ MongoDB\Driver\Cursor iterator handlers */
+static int php_phongo_cursor_valid(php_phongo_cursor_t* cursor) /* {{{ */
+{
+ if (!Z_ISUNDEF(cursor->visitor_data.zchild)) {
+ return SUCCESS;
+ }
+
+ return FAILURE;
+} /* }}} */
+
+static void php_phongo_cursor_get_current_key(php_phongo_cursor_t* cursor, zval* key) /* {{{ */
+{
+ ZVAL_LONG(key, cursor->current);
+} /* }}} */
+
+static zval* php_phongo_cursor_get_current_data(php_phongo_cursor_t* cursor) /* {{{ */
+{
+ return &cursor->visitor_data.zchild;
+} /* }}} */
+
+static void php_phongo_cursor_move_forward(php_phongo_cursor_t* cursor) /* {{{ */
+{
+ const bson_t* doc;
+
+ php_phongo_cursor_free_current(cursor);
+
+ /* If the cursor has already advanced, increment its position. Otherwise,
+ * the first call to mongoc_cursor_next() will be made below and we should
+ * leave its position at zero. */
+ if (cursor->advanced) {
+ cursor->current++;
+ } else {
+ cursor->advanced = true;
+ }
+
+ if (mongoc_cursor_next(cursor->cursor, &doc)) {
+ if (!php_phongo_bson_to_zval_ex(bson_get_data(doc), doc->len, &cursor->visitor_data)) {
+ /* Free invalid result, but don't return as we want to free the
+ * session if the cursor is exhausted. */
+ php_phongo_cursor_free_current(cursor);
+ }
+ } else {
+ bson_error_t error = { 0 };
+ const bson_t* doc = NULL;
+
+ if (mongoc_cursor_error_document(cursor->cursor, &error, &doc)) {
+ /* Intentionally not destroying the cursor as it will happen
+ * naturally now that there are no more results */
+ phongo_throw_exception_from_bson_error_t_and_reply(&error, doc);
+ }
+ }
+
+ php_phongo_cursor_free_session_if_exhausted(cursor);
+} /* }}} */
+
+static void php_phongo_cursor_rewind(php_phongo_cursor_t* cursor) /* {{{ */
+{
+ const bson_t* doc;
+
+ /* If the cursor was never advanced (e.g. command cursor), do so now */
+ if (!cursor->advanced) {
+ cursor->advanced = true;
+
+ if (!phongo_cursor_advance_and_check_for_error(cursor->cursor)) {
+ /* Exception should already have been thrown */
+ return;
+ }
+ }
+
+ if (cursor->current > 0) {
+ phongo_throw_exception(PHONGO_ERROR_LOGIC, "Cursors cannot rewind after starting iteration");
+ return;
+ }
+
+ php_phongo_cursor_free_current(cursor);
+
+ doc = mongoc_cursor_current(cursor->cursor);
+
+ if (doc) {
+ if (!php_phongo_bson_to_zval_ex(bson_get_data(doc), doc->len, &cursor->visitor_data)) {
+ /* Free invalid result, but don't return as we want to free the
+ * session if the cursor is exhausted. */
+ php_phongo_cursor_free_current(cursor);
+ }
+ }
+
+ php_phongo_cursor_free_session_if_exhausted(cursor);
+} /* }}} */
+/* }}} */
+
+/* {{{ proto void MongoDB\Driver\Cursor::setTypeMap(array $typemap)
+ Sets a type map to use for BSON unserialization */
+static PHP_METHOD(Cursor, setTypeMap)
+{
+ zend_error_handling error_handling;
+ php_phongo_cursor_t* intern;
+ php_phongo_bson_state state;
+ zval* typemap = NULL;
+ bool restore_current_element = false;
+
+ PHONGO_BSON_INIT_STATE(state);
+
+ intern = Z_CURSOR_OBJ_P(getThis());
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "a!", &typemap) == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ if (!php_phongo_bson_typemap_to_state(typemap, &state.map)) {
+ 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;
+ }
+
+ php_phongo_bson_typemap_dtor(&intern->visitor_data.map);
+
+ 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 (restore_current_element && mongoc_cursor_current(intern->cursor)) {
+ const bson_t* doc = mongoc_cursor_current(intern->cursor);
+
+ if (!php_phongo_bson_to_zval_ex(bson_get_data(doc), doc->len, &intern->visitor_data)) {
+ php_phongo_cursor_free_current(intern);
+ }
+ }
+} /* }}} */
+
+static int php_phongo_cursor_to_array_apply(zend_object_iterator* iter, void* puser) /* {{{ */
+{
+ zval* data;
+ zval* return_value = (zval*) puser;
+
+ data = iter->funcs->get_current_data(iter);
+
+ 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);
+
+ return ZEND_HASH_APPLY_KEEP;
+} /* }}} */
+
+static void php_phongo_cursor_id_new_from_id(zval* object, int64_t cursorid) /* {{{ */
+{
+ php_phongo_cursorid_t* intern;
+
+ object_init_ex(object, php_phongo_cursorid_ce);
+
+ intern = Z_CURSORID_OBJ_P(object);
+ intern->id = cursorid;
+} /* }}} */
+
+/* {{{ proto array MongoDB\Driver\Cursor::toArray()
+ Returns an array of all result documents for this cursor */
+static PHP_METHOD(Cursor, toArray)
+{
+ zend_error_handling error_handling;
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters_none() == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ array_init(return_value);
+
+ if (spl_iterator_apply(getThis(), php_phongo_cursor_to_array_apply, (void*) return_value) != SUCCESS) {
+ zval_dtor(return_value);
+ RETURN_NULL();
+ }
+} /* }}} */
+
+/* {{{ proto MongoDB\Driver\CursorId MongoDB\Driver\Cursor::getId()
+ Returns the CursorId for this cursor */
+static PHP_METHOD(Cursor, getId)
+{
+ zend_error_handling error_handling;
+ php_phongo_cursor_t* intern;
+
+ intern = Z_CURSOR_OBJ_P(getThis());
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters_none() == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ php_phongo_cursor_id_new_from_id(return_value, mongoc_cursor_get_id(intern->cursor));
+} /* }}} */
+
+/* {{{ proto MongoDB\Driver\Server MongoDB\Driver\Cursor::getServer()
+ Returns the Server object to which this cursor is attached */
+static PHP_METHOD(Cursor, getServer)
+{
+ zend_error_handling error_handling;
+ php_phongo_cursor_t* intern;
+
+ intern = Z_CURSOR_OBJ_P(getThis());
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters_none() == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ phongo_server_init(return_value, intern->client, intern->server_id);
+} /* }}} */
+
+/* {{{ proto boolean MongoDB\Driver\Cursor::isDead()
+ Checks if a cursor is still alive */
+static PHP_METHOD(Cursor, isDead)
+{
+ zend_error_handling error_handling;
+ php_phongo_cursor_t* intern;
+
+ intern = Z_CURSOR_OBJ_P(getThis());
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters_none() == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ RETURN_BOOL(!mongoc_cursor_more(intern->cursor));
+} /* }}} */
+
+PHP_METHOD(Cursor, current)
+{
+ zend_error_handling error_handling;
+ php_phongo_cursor_t* intern = Z_CURSOR_OBJ_P(getThis());
+ zval* data;
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters_none() == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ data = php_phongo_cursor_get_current_data(intern);
+
+ if (data) {
+ ZVAL_COPY_DEREF(return_value, data);
+ }
+}
+
+PHP_METHOD(Cursor, key)
+{
+ zend_error_handling error_handling;
+ php_phongo_cursor_t* intern = Z_CURSOR_OBJ_P(getThis());
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters_none() == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ php_phongo_cursor_get_current_key(intern, return_value);
+}
+
+PHP_METHOD(Cursor, next)
+{
+ zend_error_handling error_handling;
+ php_phongo_cursor_t* intern = Z_CURSOR_OBJ_P(getThis());
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters_none() == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ php_phongo_cursor_move_forward(intern);
+}
+
+PHP_METHOD(Cursor, valid)
+{
+ zend_error_handling error_handling;
+ php_phongo_cursor_t* intern = Z_CURSOR_OBJ_P(getThis());
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters_none() == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ RETURN_BOOL(php_phongo_cursor_valid(intern) == SUCCESS);
+}
+
+PHP_METHOD(Cursor, rewind)
+{
+ zend_error_handling error_handling;
+ php_phongo_cursor_t* intern = Z_CURSOR_OBJ_P(getThis());
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters_none() == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ php_phongo_cursor_rewind(intern);
+}
+
+/* {{{ MongoDB\Driver\Cursor function entries */
+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[] = {
+ /* clang-format off */
+ 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(Cursor, current, ai_Cursor_void, ZEND_ACC_PUBLIC)
+ PHP_ME(Cursor, key, ai_Cursor_void, ZEND_ACC_PUBLIC)
+ PHP_ME(Cursor, next, ai_Cursor_void, ZEND_ACC_PUBLIC)
+ PHP_ME(Cursor, valid, ai_Cursor_void, ZEND_ACC_PUBLIC)
+ PHP_ME(Cursor, rewind, ai_Cursor_void, ZEND_ACC_PUBLIC)
+
+ ZEND_NAMED_ME(__construct, PHP_FN(MongoDB_disabled___construct), ai_Cursor_void, ZEND_ACC_PRIVATE | ZEND_ACC_FINAL)
+ ZEND_NAMED_ME(__wakeup, PHP_FN(MongoDB_disabled___wakeup), ai_Cursor_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
+ PHP_FE_END
+ /* clang-format on */
+};
+/* }}} */
+
+/* {{{ MongoDB\Driver\Cursor object handlers */
+static zend_object_handlers php_phongo_handler_cursor;
+
+static void php_phongo_cursor_free_object(zend_object* object) /* {{{ */
+{
+ php_phongo_cursor_t* intern = Z_OBJ_CURSOR(object);
+
+ zend_object_std_dtor(&intern->std);
+
+ /* If this Cursor was created in a different process, reset the client so
+ * that mongoc_cursor_destroy does not issue a killCursors command for an
+ * active cursor owned by a parent process. */
+ PHONGO_RESET_CLIENT_IF_PID_DIFFERS(intern);
+
+ 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);
+ }
+
+ if (!Z_ISUNDEF(intern->session)) {
+ zval_ptr_dtor(&intern->session);
+ }
+
+ php_phongo_bson_typemap_dtor(&intern->visitor_data.map);
+
+ php_phongo_cursor_free_current(intern);
+} /* }}} */
+
+static zend_object* php_phongo_cursor_create_object(zend_class_entry* class_type) /* {{{ */
+{
+ 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);
+ object_properties_init(&intern->std, class_type);
+
+ PHONGO_SET_CREATED_BY_PID(intern);
+
+ intern->std.handlers = &php_phongo_handler_cursor;
+
+ return &intern->std;
+} /* }}} */
+
+static HashTable* php_phongo_cursor_get_debug_info(phongo_compat_object_handler_type* object, int* is_temp) /* {{{ */
+{
+ php_phongo_cursor_t* intern;
+ zval retval = ZVAL_STATIC_INIT;
+
+ *is_temp = 1;
+ intern = Z_OBJ_CURSOR(PHONGO_COMPAT_GET_OBJ(object));
+
+ array_init_size(&retval, 10);
+
+ 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)) {
+ ADD_ASSOC_ZVAL_EX(&retval, "query", &intern->query);
+ Z_ADDREF(intern->query);
+ } else {
+ ADD_ASSOC_NULL_EX(&retval, "query");
+ }
+
+ if (!Z_ISUNDEF(intern->command)) {
+ ADD_ASSOC_ZVAL_EX(&retval, "command", &intern->command);
+ Z_ADDREF(intern->command);
+ } else {
+ ADD_ASSOC_NULL_EX(&retval, "command");
+ }
+
+ if (!Z_ISUNDEF(intern->read_preference)) {
+ ADD_ASSOC_ZVAL_EX(&retval, "readPreference", &intern->read_preference);
+ Z_ADDREF(intern->read_preference);
+ } else {
+ ADD_ASSOC_NULL_EX(&retval, "readPreference");
+ }
+
+ if (!Z_ISUNDEF(intern->session)) {
+ ADD_ASSOC_ZVAL_EX(&retval, "session", &intern->session);
+ Z_ADDREF(intern->session);
+ } else {
+ ADD_ASSOC_NULL_EX(&retval, "session");
+ }
+
+ ADD_ASSOC_BOOL_EX(&retval, "isDead", !mongoc_cursor_more(intern->cursor));
+
+ ADD_ASSOC_LONG_EX(&retval, "currentIndex", intern->current);
+
+ if (!Z_ISUNDEF(intern->visitor_data.zchild)) {
+ ADD_ASSOC_ZVAL_EX(&retval, "currentDocument", &intern->visitor_data.zchild);
+ Z_ADDREF(intern->visitor_data.zchild);
+ } else {
+ ADD_ASSOC_NULL_EX(&retval, "currentDocument");
+ }
+
+ {
+ zval server;
+
+ phongo_server_init(&server, intern->client, intern->server_id);
+ ADD_ASSOC_ZVAL_EX(&retval, "server", &server);
+ }
+
+ return Z_ARRVAL(retval);
+
+} /* }}} */
+/* }}} */
+
+void php_phongo_cursor_init_ce(INIT_FUNC_ARGS) /* {{{ */
+{
+ zend_class_entry ce;
+
+ INIT_NS_CLASS_ENTRY(ce, "MongoDB\\Driver", "Cursor", php_phongo_cursor_me);
+ php_phongo_cursor_ce = zend_register_internal_class(&ce);
+ 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);
+
+ zend_class_implements(php_phongo_cursor_ce, 1, zend_ce_iterator);
+ zend_class_implements(php_phongo_cursor_ce, 1, php_phongo_cursor_interface_ce);
+
+ 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;
+ php_phongo_handler_cursor.free_obj = php_phongo_cursor_free_object;
+ php_phongo_handler_cursor.offset = XtOffsetOf(php_phongo_cursor_t, std);
+} /* }}} */
+
+/*
+ * 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.9.0/src/MongoDB/CursorId.c b/mongodb-1.9.0/src/MongoDB/CursorId.c
new file mode 100644
index 00000000..9342d57b
--- /dev/null
+++ b/mongodb-1.9.0/src/MongoDB/CursorId.c
@@ -0,0 +1,238 @@
+/*
+ * 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.
+ */
+
+#include <php.h>
+#include <Zend/zend_interfaces.h>
+#include <ext/standard/php_var.h>
+#include <zend_smart_str.h>
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "phongo_compat.h"
+#include "php_phongo.h"
+
+zend_class_entry* php_phongo_cursorid_ce;
+
+/* Initialize the object from a numeric string and return whether it was
+ * successful. An exception will be thrown on error. */
+static bool php_phongo_cursorid_init_from_string(php_phongo_cursorid_t* intern, const char* s_id, size_t s_id_len) /* {{{ */
+{
+ int64_t id;
+
+ if (!php_phongo_parse_int64(&id, s_id, s_id_len)) {
+ phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Error parsing \"%s\" as 64-bit id for %s initialization", s_id, ZSTR_VAL(php_phongo_cursorid_ce->name));
+ return false;
+ }
+
+ intern->id = id;
+ 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_cursorid_init_from_hash(php_phongo_cursorid_t* intern, HashTable* props) /* {{{ */
+{
+ zval* value;
+
+ if ((value = zend_hash_str_find(props, "id", sizeof("id") - 1)) && Z_TYPE_P(value) == IS_STRING) {
+ return php_phongo_cursorid_init_from_string(intern, Z_STRVAL_P(value), Z_STRLEN_P(value));
+ }
+
+ phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "%s initialization requires \"id\" string field", ZSTR_VAL(php_phongo_cursorid_ce->name));
+ return false;
+} /* }}} */
+
+/* {{{ proto string MongoDB\Driver\CursorId::__toString()
+ Returns the string representation of the CursorId */
+static PHP_METHOD(CursorId, __toString)
+{
+ zend_error_handling error_handling;
+ php_phongo_cursorid_t* intern;
+ char* tmp;
+ int tmp_len;
+
+ intern = Z_CURSORID_OBJ_P(getThis());
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters_none() == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ tmp_len = spprintf(&tmp, 0, "%" PRId64, intern->id);
+ RETVAL_STRINGL(tmp, tmp_len);
+ efree(tmp);
+} /* }}} */
+
+/* {{{ proto string MongoDB\Driver\CursorId::serialize()
+*/
+static PHP_METHOD(CursorId, serialize)
+{
+ zend_error_handling error_handling;
+ php_phongo_cursorid_t* intern;
+ zval retval;
+ php_serialize_data_t var_hash;
+ smart_str buf = { 0 };
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters_none() == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ intern = Z_CURSORID_OBJ_P(getThis());
+
+ array_init_size(&retval, 1);
+ ADD_ASSOC_INT64_AS_STRING(&retval, "id", intern->id);
+
+ PHP_VAR_SERIALIZE_INIT(var_hash);
+ php_var_serialize(&buf, &retval, &var_hash);
+ smart_str_0(&buf);
+ PHP_VAR_SERIALIZE_DESTROY(var_hash);
+
+ PHONGO_RETVAL_SMART_STR(buf);
+
+ smart_str_free(&buf);
+ zval_ptr_dtor(&retval);
+} /* }}} */
+
+/* {{{ proto void MongoDB\Driver\CursorId::unserialize(string $serialized)
+*/
+static PHP_METHOD(CursorId, unserialize)
+{
+ zend_error_handling error_handling;
+ php_phongo_cursorid_t* intern;
+ char* serialized;
+ size_t serialized_len;
+ zval props;
+ php_unserialize_data_t var_hash;
+
+ intern = Z_CURSORID_OBJ_P(getThis());
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &serialized, &serialized_len) == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ PHP_VAR_UNSERIALIZE_INIT(var_hash);
+ if (!php_var_unserialize(&props, (const unsigned char**) &serialized, (unsigned char*) serialized + serialized_len, &var_hash)) {
+ zval_ptr_dtor(&props);
+ phongo_throw_exception(PHONGO_ERROR_UNEXPECTED_VALUE, "%s unserialization failed", ZSTR_VAL(php_phongo_cursorid_ce->name));
+
+ PHP_VAR_UNSERIALIZE_DESTROY(var_hash);
+ return;
+ }
+ PHP_VAR_UNSERIALIZE_DESTROY(var_hash);
+
+ php_phongo_cursorid_init_from_hash(intern, HASH_OF(&props));
+ zval_ptr_dtor(&props);
+} /* }}} */
+
+/* {{{ MongoDB\Driver\CursorId function entries */
+ZEND_BEGIN_ARG_INFO_EX(ai_CursorId_unserialize, 0, 0, 1)
+ ZEND_ARG_INFO(0, serialized)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(ai_CursorId_void, 0, 0, 0)
+ZEND_END_ARG_INFO()
+
+static zend_function_entry php_phongo_cursorid_me[] = {
+ /* clang-format off */
+ PHP_ME(CursorId, __toString, ai_CursorId_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
+ PHP_ME(CursorId, serialize, ai_CursorId_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
+ PHP_ME(CursorId, unserialize, ai_CursorId_unserialize, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
+ ZEND_NAMED_ME(__construct, PHP_FN(MongoDB_disabled___construct), ai_CursorId_void, ZEND_ACC_PRIVATE | ZEND_ACC_FINAL)
+ ZEND_NAMED_ME(__wakeup, PHP_FN(MongoDB_disabled___wakeup), ai_CursorId_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
+ PHP_FE_END
+ /* clang-format on */
+};
+/* }}} */
+
+/* {{{ MongoDB\Driver\CursorId object handlers */
+static zend_object_handlers php_phongo_handler_cursorid;
+
+static void php_phongo_cursorid_free_object(zend_object* object) /* {{{ */
+{
+ php_phongo_cursorid_t* intern = Z_OBJ_CURSORID(object);
+
+ zend_object_std_dtor(&intern->std);
+} /* }}} */
+
+static zend_object* php_phongo_cursorid_create_object(zend_class_entry* class_type) /* {{{ */
+{
+ php_phongo_cursorid_t* intern = NULL;
+
+ intern = PHONGO_ALLOC_OBJECT_T(php_phongo_cursorid_t, class_type);
+
+ zend_object_std_init(&intern->std, class_type);
+ object_properties_init(&intern->std, class_type);
+
+ intern->std.handlers = &php_phongo_handler_cursorid;
+
+ return &intern->std;
+} /* }}} */
+
+static HashTable* php_phongo_cursorid_get_debug_info(phongo_compat_object_handler_type* object, int* is_temp) /* {{{ */
+{
+ php_phongo_cursorid_t* intern;
+ zval retval = ZVAL_STATIC_INIT;
+
+ *is_temp = 1;
+ intern = Z_OBJ_CURSORID(PHONGO_COMPAT_GET_OBJ(object));
+
+ array_init(&retval);
+
+#if SIZEOF_ZEND_LONG == 4
+ ADD_ASSOC_INT64_AS_STRING(&retval, "id", intern->id);
+#else
+ ADD_ASSOC_LONG_EX(&retval, "id", intern->id);
+#endif
+
+ return Z_ARRVAL(retval);
+} /* }}} */
+/* }}} */
+
+void php_phongo_cursorid_init_ce(INIT_FUNC_ARGS) /* {{{ */
+{
+ zend_class_entry ce;
+
+ INIT_NS_CLASS_ENTRY(ce, "MongoDB\\Driver", "CursorId", php_phongo_cursorid_me);
+ php_phongo_cursorid_ce = zend_register_internal_class(&ce);
+ php_phongo_cursorid_ce->create_object = php_phongo_cursorid_create_object;
+ PHONGO_CE_FINAL(php_phongo_cursorid_ce);
+
+ zend_class_implements(php_phongo_cursorid_ce, 1, zend_ce_serializable);
+
+ memcpy(&php_phongo_handler_cursorid, phongo_get_std_object_handlers(), sizeof(zend_object_handlers));
+ php_phongo_handler_cursorid.get_debug_info = php_phongo_cursorid_get_debug_info;
+ php_phongo_handler_cursorid.free_obj = php_phongo_cursorid_free_object;
+ php_phongo_handler_cursorid.offset = XtOffsetOf(php_phongo_cursorid_t, std);
+} /* }}} */
+
+/*
+ * 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.8.1/src/MongoDB/CursorInterface.c b/mongodb-1.9.0/src/MongoDB/CursorInterface.c
similarity index 100%
rename from mongodb-1.8.1/src/MongoDB/CursorInterface.c
rename to mongodb-1.9.0/src/MongoDB/CursorInterface.c
diff --git a/mongodb-1.8.1/src/MongoDB/Exception/AuthenticationException.c b/mongodb-1.9.0/src/MongoDB/Exception/AuthenticationException.c
similarity index 100%
rename from mongodb-1.8.1/src/MongoDB/Exception/AuthenticationException.c
rename to mongodb-1.9.0/src/MongoDB/Exception/AuthenticationException.c
diff --git a/mongodb-1.8.1/src/MongoDB/Exception/BulkWriteException.c b/mongodb-1.9.0/src/MongoDB/Exception/BulkWriteException.c
similarity index 100%
rename from mongodb-1.8.1/src/MongoDB/Exception/BulkWriteException.c
rename to mongodb-1.9.0/src/MongoDB/Exception/BulkWriteException.c
diff --git a/mongodb-1.9.0/src/MongoDB/Exception/CommandException.c b/mongodb-1.9.0/src/MongoDB/Exception/CommandException.c
new file mode 100644
index 00000000..4345e386
--- /dev/null
+++ b/mongodb-1.9.0/src/MongoDB/Exception/CommandException.c
@@ -0,0 +1,77 @@
+/*
+ * Copyright 2018 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 <php.h>
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "phongo_compat.h"
+#include "php_phongo.h"
+
+zend_class_entry* php_phongo_commandexception_ce;
+
+/* {{{ proto document MongoDB\Driver\Exception\CommandException::getResultDocument()
+ Returns the result document from the failed command. */
+static PHP_METHOD(CommandException, getResultDocument)
+{
+ zend_error_handling error_handling;
+ zval* resultdocument;
+ zval rv;
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters_none() == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ resultdocument = zend_read_property(php_phongo_commandexception_ce, PHONGO_COMPAT_OBJ_P(getThis()), ZEND_STRL("resultDocument"), 0, &rv);
+
+ RETURN_ZVAL(resultdocument, 1, 0);
+} /* }}} */
+
+/* {{{ MongoDB\Driver\Exception\CommandException function entries */
+ZEND_BEGIN_ARG_INFO_EX(ai_CommandException_void, 0, 0, 0)
+ZEND_END_ARG_INFO()
+
+static zend_function_entry php_phongo_commandexception_me[] = {
+ /* clang-format off */
+ PHP_ME(CommandException, getResultDocument, ai_CommandException_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
+ PHP_FE_END
+ /* clang-format on */
+};
+/* }}} */
+
+void php_phongo_commandexception_init_ce(INIT_FUNC_ARGS) /* {{{ */
+{
+ zend_class_entry ce;
+
+ INIT_NS_CLASS_ENTRY(ce, "MongoDB\\Driver\\Exception", "CommandException", php_phongo_commandexception_me);
+ php_phongo_commandexception_ce = zend_register_internal_class_ex(&ce, php_phongo_serverexception_ce);
+
+ zend_declare_property_null(php_phongo_commandexception_ce, ZEND_STRL("resultDocument"), ZEND_ACC_PROTECTED);
+} /* }}} */
+
+/*
+ * 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.8.1/src/MongoDB/Exception/ConnectionException.c b/mongodb-1.9.0/src/MongoDB/Exception/ConnectionException.c
similarity index 100%
rename from mongodb-1.8.1/src/MongoDB/Exception/ConnectionException.c
rename to mongodb-1.9.0/src/MongoDB/Exception/ConnectionException.c
diff --git a/mongodb-1.8.1/src/MongoDB/Exception/ConnectionTimeoutException.c b/mongodb-1.9.0/src/MongoDB/Exception/ConnectionTimeoutException.c
similarity index 100%
rename from mongodb-1.8.1/src/MongoDB/Exception/ConnectionTimeoutException.c
rename to mongodb-1.9.0/src/MongoDB/Exception/ConnectionTimeoutException.c
diff --git a/mongodb-1.8.1/src/MongoDB/Exception/EncryptionException.c b/mongodb-1.9.0/src/MongoDB/Exception/EncryptionException.c
similarity index 100%
rename from mongodb-1.8.1/src/MongoDB/Exception/EncryptionException.c
rename to mongodb-1.9.0/src/MongoDB/Exception/EncryptionException.c
diff --git a/mongodb-1.8.1/src/MongoDB/Exception/Exception.c b/mongodb-1.9.0/src/MongoDB/Exception/Exception.c
similarity index 100%
rename from mongodb-1.8.1/src/MongoDB/Exception/Exception.c
rename to mongodb-1.9.0/src/MongoDB/Exception/Exception.c
diff --git a/mongodb-1.8.1/src/MongoDB/Exception/ExecutionTimeoutException.c b/mongodb-1.9.0/src/MongoDB/Exception/ExecutionTimeoutException.c
similarity index 100%
rename from mongodb-1.8.1/src/MongoDB/Exception/ExecutionTimeoutException.c
rename to mongodb-1.9.0/src/MongoDB/Exception/ExecutionTimeoutException.c
diff --git a/mongodb-1.8.1/src/MongoDB/Exception/InvalidArgumentException.c b/mongodb-1.9.0/src/MongoDB/Exception/InvalidArgumentException.c
similarity index 100%
rename from mongodb-1.8.1/src/MongoDB/Exception/InvalidArgumentException.c
rename to mongodb-1.9.0/src/MongoDB/Exception/InvalidArgumentException.c
diff --git a/mongodb-1.8.1/src/MongoDB/Exception/LogicException.c b/mongodb-1.9.0/src/MongoDB/Exception/LogicException.c
similarity index 100%
rename from mongodb-1.8.1/src/MongoDB/Exception/LogicException.c
rename to mongodb-1.9.0/src/MongoDB/Exception/LogicException.c
diff --git a/mongodb-1.9.0/src/MongoDB/Exception/RuntimeException.c b/mongodb-1.9.0/src/MongoDB/Exception/RuntimeException.c
new file mode 100644
index 00000000..c99936a4
--- /dev/null
+++ b/mongodb-1.9.0/src/MongoDB/Exception/RuntimeException.c
@@ -0,0 +1,108 @@
+/*
+ * 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.
+ */
+
+#include <php.h>
+#include <ext/spl/spl_exceptions.h>
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "phongo_compat.h"
+#include "php_phongo.h"
+#include "php_array_api.h"
+
+zend_class_entry* php_phongo_runtimeexception_ce;
+
+static bool php_phongo_has_string_array_element(zval* labels, char* label)
+{
+ HashTable* ht_data;
+
+ if (Z_TYPE_P(labels) != IS_ARRAY) {
+ return false;
+ }
+
+ ht_data = HASH_OF(labels);
+
+ {
+ zval* z_label;
+
+ ZEND_HASH_FOREACH_VAL_IND(ht_data, z_label)
+ {
+ if ((Z_TYPE_P(z_label) == IS_STRING) && (strcmp(Z_STRVAL_P(z_label), label) == 0)) {
+ return true;
+ }
+ }
+ ZEND_HASH_FOREACH_END();
+ }
+
+ return false;
+}
+
+/* {{{ proto bool MongoDB\Driver\Exception\RuntimeException::hasErrorLabel(string $label)
+ Returns whether a specific error label has been set */
+static PHP_METHOD(RuntimeException, hasErrorLabel)
+{
+ zend_error_handling error_handling;
+ char* label;
+ size_t label_len;
+ zval* error_labels;
+ zval rv;
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &label, &label_len) == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ error_labels = zend_read_property(php_phongo_runtimeexception_ce, PHONGO_COMPAT_OBJ_P(getThis()), ZEND_STRL("errorLabels"), 0, &rv);
+
+ RETURN_BOOL(php_phongo_has_string_array_element(error_labels, label));
+} /* }}} */
+
+ZEND_BEGIN_ARG_INFO_EX(ai_RuntimeException_hasErrorLabel, 0, 0, 1)
+ ZEND_ARG_INFO(0, label)
+ZEND_END_ARG_INFO()
+
+/* {{{ MongoDB\Driver\Exception\RuntimeException function entries */
+static zend_function_entry php_phongo_runtimeexception_me[] = {
+ /* clang-format off */
+ PHP_ME(RuntimeException, hasErrorLabel, ai_RuntimeException_hasErrorLabel, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
+ PHP_FE_END
+ /* clang-format on */
+};
+/* }}} */
+
+void php_phongo_runtimeexception_init_ce(INIT_FUNC_ARGS) /* {{{ */
+{
+ zend_class_entry ce;
+
+ INIT_NS_CLASS_ENTRY(ce, "MongoDB\\Driver\\Exception", "RuntimeException", php_phongo_runtimeexception_me);
+ php_phongo_runtimeexception_ce = zend_register_internal_class_ex(&ce, spl_ce_RuntimeException);
+ zend_class_implements(php_phongo_runtimeexception_ce, 1, php_phongo_exception_ce);
+
+ zend_declare_property_null(php_phongo_runtimeexception_ce, ZEND_STRL("errorLabels"), ZEND_ACC_PROTECTED);
+} /* }}} */
+
+/*
+ * 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.8.1/src/MongoDB/Exception/SSLConnectionException.c b/mongodb-1.9.0/src/MongoDB/Exception/SSLConnectionException.c
similarity index 100%
rename from mongodb-1.8.1/src/MongoDB/Exception/SSLConnectionException.c
rename to mongodb-1.9.0/src/MongoDB/Exception/SSLConnectionException.c
diff --git a/mongodb-1.8.1/src/MongoDB/Exception/ServerException.c b/mongodb-1.9.0/src/MongoDB/Exception/ServerException.c
similarity index 100%
rename from mongodb-1.8.1/src/MongoDB/Exception/ServerException.c
rename to mongodb-1.9.0/src/MongoDB/Exception/ServerException.c
diff --git a/mongodb-1.8.1/src/MongoDB/Exception/UnexpectedValueException.c b/mongodb-1.9.0/src/MongoDB/Exception/UnexpectedValueException.c
similarity index 100%
rename from mongodb-1.8.1/src/MongoDB/Exception/UnexpectedValueException.c
rename to mongodb-1.9.0/src/MongoDB/Exception/UnexpectedValueException.c
diff --git a/mongodb-1.9.0/src/MongoDB/Exception/WriteException.c b/mongodb-1.9.0/src/MongoDB/Exception/WriteException.c
new file mode 100644
index 00000000..5a644306
--- /dev/null
+++ b/mongodb-1.9.0/src/MongoDB/Exception/WriteException.c
@@ -0,0 +1,78 @@
+/*
+ * 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.
+ */
+
+#include <php.h>
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "phongo_compat.h"
+#include "php_phongo.h"
+
+zend_class_entry* php_phongo_writeexception_ce;
+
+/* {{{ proto MongoDB\Driver\WriteResult MongoDB\Driver\Exception\WriteException::getWriteResult()
+ Returns the WriteResult from the failed write operation. */
+static PHP_METHOD(WriteException, getWriteResult)
+{
+ zend_error_handling error_handling;
+ zval* writeresult;
+ zval rv;
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters_none() == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ writeresult = zend_read_property(php_phongo_writeexception_ce, PHONGO_COMPAT_OBJ_P(getThis()), ZEND_STRL("writeResult"), 0, &rv);
+
+ RETURN_ZVAL(writeresult, 1, 0);
+} /* }}} */
+
+/* {{{ MongoDB\Driver\Exception\WriteException function entries */
+ZEND_BEGIN_ARG_INFO_EX(ai_WriteException_void, 0, 0, 0)
+ZEND_END_ARG_INFO()
+
+static zend_function_entry php_phongo_writeexception_me[] = {
+ /* clang-format off */
+ PHP_ME(WriteException, getWriteResult, ai_WriteException_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
+ PHP_FE_END
+ /* clang-format on */
+};
+/* }}} */
+
+void php_phongo_writeexception_init_ce(INIT_FUNC_ARGS) /* {{{ */
+{
+ zend_class_entry ce;
+
+ INIT_NS_CLASS_ENTRY(ce, "MongoDB\\Driver\\Exception", "WriteException", php_phongo_writeexception_me);
+ php_phongo_writeexception_ce = zend_register_internal_class_ex(&ce, php_phongo_serverexception_ce);
+ php_phongo_writeexception_ce->ce_flags |= ZEND_ACC_EXPLICIT_ABSTRACT_CLASS;
+
+ zend_declare_property_null(php_phongo_writeexception_ce, ZEND_STRL("writeResult"), ZEND_ACC_PROTECTED);
+} /* }}} */
+
+/*
+ * 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.9.0/src/MongoDB/Manager.c b/mongodb-1.9.0/src/MongoDB/Manager.c
new file mode 100644
index 00000000..248e62da
--- /dev/null
+++ b/mongodb-1.9.0/src/MongoDB/Manager.c
@@ -0,0 +1,941 @@
+/*
+ * 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.
+ */
+
+#include <php.h>
+#include <Zend/zend_hash.h>
+#include <Zend/zend_interfaces.h>
+#include <ext/standard/file.h>
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "php_array_api.h"
+#include "phongo_compat.h"
+#include "php_phongo.h"
+#include "Session.h"
+
+#define PHONGO_MANAGER_URI_DEFAULT "mongodb://127.0.0.1/"
+
+/**
+ * Manager abstracts a cluster of Server objects (i.e. socket connections).
+ *
+ * Typically, users will connect to a cluster using a URI, and the Manager will
+ * perform tasks such as replica set discovery and create the necessary Server
+ * objects. That said, it is also possible to create a Manager with an arbitrary
+ * collection of Server objects using the static factory method (this can be
+ * useful for testing or administration).
+ *
+ * Operation methods do not take socket-level options (e.g. socketTimeoutMS).
+ * Those options should be specified during construction.
+ */
+zend_class_entry* php_phongo_manager_ce;
+
+/* Checks if driverOptions contains a stream context resource in the "context"
+ * key and incorporates any of its SSL options into the base array that did not
+ * already exist (i.e. array union). The "context" key is then unset from the
+ * base array.
+ *
+ * This handles the merging of any legacy SSL context options and also makes
+ * driverOptions suitable for serialization by removing the resource zval. */
+static bool php_phongo_manager_merge_context_options(zval* zdriverOptions) /* {{{ */
+{
+ php_stream_context* context;
+ zval * zcontext, *zcontextOptions;
+
+ if (!php_array_existsc(zdriverOptions, "context")) {
+ return true;
+ }
+
+ zcontext = php_array_fetchc(zdriverOptions, "context");
+ context = php_stream_context_from_zval(zcontext, 1);
+
+ if (!context) {
+ phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "\"context\" driver option is not a valid Stream-Context resource");
+ return false;
+ }
+
+ zcontextOptions = php_array_fetchc_array(&context->options, "ssl");
+
+ if (!zcontextOptions) {
+ phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Stream-Context resource does not contain \"ssl\" options array");
+ return false;
+ }
+
+ /* When running PHP in debug mode, php_error_docref duplicates the current
+ * scope, leading to a COW violation in zend_hash_merge and
+ * zend_symtable_str_del (called by php_array_unsetc). This macro allows
+ * that violation in debug mode and is a NOOP when in non-debug. */
+#if PHP_VERSION_ID >= 70200
+ HT_ALLOW_COW_VIOLATION(Z_ARRVAL_P(zdriverOptions));
+#endif
+
+ php_error_docref(NULL, E_DEPRECATED, "The \"context\" driver option is deprecated.");
+
+ /* Perform array union (see: add_function() in zend_operators.c) */
+ zend_hash_merge(Z_ARRVAL_P(zdriverOptions), Z_ARRVAL_P(zcontextOptions), zval_add_ref, 0);
+
+ php_array_unsetc(zdriverOptions, "context");
+
+ return true;
+} /* }}} */
+
+/* Prepare authMechanismProperties for BSON encoding by converting a boolean
+ * value for the "CANONICALIZE_HOST_NAME" option to a string.
+ *
+ * Note: URI options are case-insensitive, so we must iterate through the
+ * HashTable in order to detect options. */
+static void php_phongo_manager_prep_authmechanismproperties(zval* properties) /* {{{ */
+{
+ HashTable* ht_data;
+
+ if (Z_TYPE_P(properties) != IS_ARRAY && Z_TYPE_P(properties) != IS_OBJECT) {
+ return;
+ }
+
+ ht_data = HASH_OF(properties);
+
+ {
+ zend_string* string_key = NULL;
+ zend_ulong num_key = 0;
+ zval* property;
+
+ ZEND_HASH_FOREACH_KEY_VAL_IND(ht_data, num_key, string_key, property)
+ {
+ if (!string_key) {
+ continue;
+ }
+
+ /* URI options are case-insensitive */
+ if (!strcasecmp(ZSTR_VAL(string_key), "CANONICALIZE_HOST_NAME")) {
+ ZVAL_DEREF(property);
+ if (Z_TYPE_P(property) != IS_STRING && zend_is_true(property)) {
+ SEPARATE_ZVAL_NOREF(property);
+ ZVAL_NEW_STR(property, zend_string_init(ZEND_STRL("true"), 0));
+ }
+ }
+ }
+ ZEND_HASH_FOREACH_END();
+ }
+} /* }}} */
+
+/* Prepare URI options for BSON encoding.
+ *
+ * Read preference tag sets must be an array of documents. In order to ensure
+ * that empty arrays serialize as empty documents, array elements will be
+ * converted to objects. php_phongo_read_preference_tags_are_valid() handles
+ * actual validation of the tag set structure.
+ *
+ * Auth mechanism properties must have string values, so a boolean true value
+ * for the "CANONICALIZE_HOST_NAME" property will be converted to "true".
+ *
+ * Note: URI options are case-insensitive, so we must iterate through the
+ * HashTable in order to detect options. */
+static void php_phongo_manager_prep_uri_options(zval* options) /* {{{ */
+{
+ HashTable* ht_data;
+
+ if (Z_TYPE_P(options) != IS_ARRAY) {
+ return;
+ }
+
+ ht_data = HASH_OF(options);
+
+ {
+ zend_string* string_key = NULL;
+ zend_ulong num_key = 0;
+ zval* option;
+
+ ZEND_HASH_FOREACH_KEY_VAL_IND(ht_data, num_key, string_key, option)
+ {
+ if (!string_key) {
+ continue;
+ }
+
+ if (!strcasecmp(ZSTR_VAL(string_key), MONGOC_URI_READPREFERENCETAGS)) {
+ ZVAL_DEREF(option);
+ SEPARATE_ZVAL_NOREF(option);
+ php_phongo_read_preference_prep_tagsets(option);
+ continue;
+ }
+
+ if (!strcasecmp(ZSTR_VAL(string_key), MONGOC_URI_AUTHMECHANISMPROPERTIES)) {
+ ZVAL_DEREF(option);
+ SEPARATE_ZVAL_NOREF(option);
+ php_phongo_manager_prep_authmechanismproperties(option);
+ continue;
+ }
+ }
+ ZEND_HASH_FOREACH_END();
+ }
+} /* }}} */
+
+/* Selects a server for an execute method. If "for_writes" is true, a primary
+ * will be selected. Otherwise, a read preference will be used to select the
+ * server. If zreadPreference is NULL, the client's read preference will be
+ * used. If zsession is a session object in a sharded transaction, the session
+ * will be checked whether it is pinned to a server. If so, that server will be
+ * selected. Otherwise, server selection
+ *
+ * On success, server_id will be set and the function will return true;
+ * otherwise, false is returned and an exception is thrown. */
+static bool php_phongo_manager_select_server(bool for_writes, bool inherit_read_preference, zval* zreadPreference, zval* zsession, mongoc_client_t* client, uint32_t* server_id) /* {{{ */
+{
+ mongoc_server_description_t* selected_server;
+ const mongoc_read_prefs_t* read_preference = NULL;
+ bson_error_t error = { 0 };
+
+ if (zsession) {
+ const mongoc_client_session_t* session = Z_SESSION_OBJ_P(zsession)->client_session;
+
+ /* Attempt to fetch server pinned to session */
+ if (mongoc_client_session_get_server_id(session) > 0) {
+ *server_id = mongoc_client_session_get_server_id(session);
+
+ return true;
+ }
+ }
+
+ if (!for_writes) {
+ if (zreadPreference) {
+ read_preference = phongo_read_preference_from_zval(zreadPreference);
+ } else if (inherit_read_preference) {
+ read_preference = mongoc_client_get_read_prefs(client);
+ }
+ }
+
+ selected_server = mongoc_client_select_server(client, for_writes, read_preference, &error);
+
+ if (selected_server) {
+ *server_id = mongoc_server_description_id(selected_server);
+ mongoc_server_description_destroy(selected_server);
+
+ return true;
+ }
+
+ /* Check for connection related exceptions */
+ if (!EG(exception)) {
+ phongo_throw_exception_from_bson_error_t(&error);
+ }
+
+ return false;
+} /* }}} */
+
+/* {{{ proto void MongoDB\Driver\Manager::__construct([string $uri = "mongodb://127.0.0.1/"[, array $options = array()[, array $driverOptions = array()]]])
+ Constructs a new Manager */
+static PHP_METHOD(Manager, __construct)
+{
+ zend_error_handling error_handling;
+ php_phongo_manager_t* intern;
+ char* uri_string = NULL;
+ size_t uri_string_len = 0;
+ zval* options = NULL;
+ zval* driverOptions = NULL;
+
+ intern = Z_MANAGER_OBJ_P(getThis());
+
+ /* Separate the options and driverOptions zvals, since we may end up
+ * modifying them in php_phongo_manager_prep_uri_options() and
+ * php_phongo_manager_merge_context_options() below, respectively. */
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "|s!a/!a/!", &uri_string, &uri_string_len, &options, &driverOptions) == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ if (options) {
+ php_phongo_manager_prep_uri_options(options);
+ }
+
+ if (driverOptions && !php_phongo_manager_merge_context_options(driverOptions)) {
+ /* Exception should already have been thrown */
+ return;
+ }
+
+ phongo_manager_init(intern, uri_string ? uri_string : PHONGO_MANAGER_URI_DEFAULT, options, driverOptions);
+
+ if (intern->client) {
+ php_phongo_set_monitoring_callbacks(intern->client);
+ }
+} /* }}} */
+
+/* {{{ proto MongoDB\Driver\ClientEncryption MongoDB\Driver\Manager::createClientEncryption(array $options)
+ Return a ClientEncryption instance */
+static PHP_METHOD(Manager, createClientEncryption)
+{
+ zend_error_handling error_handling;
+ php_phongo_manager_t* intern;
+ php_phongo_clientencryption_t* clientencryption;
+ zval* options;
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "a", &options) == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ intern = Z_MANAGER_OBJ_P(getThis());
+
+ object_init_ex(return_value, php_phongo_clientencryption_ce);
+ clientencryption = Z_CLIENTENCRYPTION_OBJ_P(return_value);
+
+ phongo_clientencryption_init(clientencryption, intern->client, options);
+} /* }}} */
+
+/* {{{ proto MongoDB\Driver\Cursor MongoDB\Driver\Manager::executeCommand(string $db, MongoDB\Driver\Command $command[, array $options = null])
+ Execute a Command */
+static PHP_METHOD(Manager, executeCommand)
+{
+ zend_error_handling error_handling;
+ php_phongo_manager_t* intern;
+ char* db;
+ size_t db_len;
+ zval* command;
+ zval* options = NULL;
+ bool free_options = false;
+ zval* zreadPreference = NULL;
+ zval* zsession = NULL;
+ uint32_t server_id = 0;
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "sO|z!", &db, &db_len, &command, php_phongo_command_ce, &options) == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ intern = Z_MANAGER_OBJ_P(getThis());
+
+ options = php_phongo_prep_legacy_option(options, "readPreference", &free_options);
+
+ if (!phongo_parse_session(options, intern->client, NULL, &zsession)) {
+ /* Exception should already have been thrown */
+ goto cleanup;
+ }
+
+ if (!phongo_parse_read_preference(options, &zreadPreference)) {
+ /* Exception should already have been thrown */
+ goto cleanup;
+ }
+
+ if (!php_phongo_manager_select_server(false, false, zreadPreference, zsession, intern->client, &server_id)) {
+ /* Exception should already have been thrown */
+ goto cleanup;
+ }
+
+ /* If the Manager was created in a different process, reset the client so
+ * that cursors created by this process can be differentiated and its
+ * session pool is cleared. */
+ PHONGO_RESET_CLIENT_IF_PID_DIFFERS(intern);
+
+ phongo_execute_command(intern->client, PHONGO_COMMAND_RAW, db, command, options, server_id, return_value);
+
+cleanup:
+ if (free_options) {
+ php_phongo_prep_legacy_option_free(options);
+ }
+} /* }}} */
+
+/* {{{ proto MongoDB\Driver\Cursor MongoDB\Driver\Manager::executeReadCommand(string $db, MongoDB\Driver\Command $command[, array $options = null])
+ Execute a ReadCommand */
+static PHP_METHOD(Manager, executeReadCommand)
+{
+ zend_error_handling error_handling;
+ php_phongo_manager_t* intern;
+ char* db;
+ size_t db_len;
+ zval* command;
+ zval* options = NULL;
+ zval* zreadPreference = NULL;
+ uint32_t server_id = 0;
+ zval* zsession = NULL;
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "sO|a!", &db, &db_len, &command, php_phongo_command_ce, &options) == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ intern = Z_MANAGER_OBJ_P(getThis());
+
+ if (!phongo_parse_session(options, intern->client, NULL, &zsession)) {
+ /* Exception should already have been thrown */
+ return;
+ }
+
+ if (!phongo_parse_read_preference(options, &zreadPreference)) {
+ /* Exception should already have been thrown */
+ return;
+ }
+
+ if (!php_phongo_manager_select_server(false, true, zreadPreference, zsession, intern->client, &server_id)) {
+ /* Exception should already have been thrown */
+ return;
+ }
+
+ /* If the Manager was created in a different process, reset the client so
+ * that cursors created by this process can be differentiated and its
+ * session pool is cleared. */
+ PHONGO_RESET_CLIENT_IF_PID_DIFFERS(intern);
+
+ phongo_execute_command(intern->client, PHONGO_COMMAND_READ, db, command, options, server_id, return_value);
+} /* }}} */
+
+/* {{{ proto MongoDB\Driver\Cursor MongoDB\Driver\Manager::executeWriteCommand(string $db, MongoDB\Driver\Command $command[, array $options = null])
+ Execute a WriteCommand */
+static PHP_METHOD(Manager, executeWriteCommand)
+{
+ zend_error_handling error_handling;
+ php_phongo_manager_t* intern;
+ char* db;
+ size_t db_len;
+ zval* command;
+ zval* options = NULL;
+ uint32_t server_id = 0;
+ zval* zsession = NULL;
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "sO|a!", &db, &db_len, &command, php_phongo_command_ce, &options) == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ intern = Z_MANAGER_OBJ_P(getThis());
+
+ if (!phongo_parse_session(options, intern->client, NULL, &zsession)) {
+ /* Exception should already have been thrown */
+ return;
+ }
+
+ if (!php_phongo_manager_select_server(true, false, NULL, zsession, intern->client, &server_id)) {
+ /* Exception should already have been thrown */
+ return;
+ }
+
+ /* If the Manager was created in a different process, reset the client so
+ * that cursors created by this process can be differentiated and its
+ * session pool is cleared. */
+ PHONGO_RESET_CLIENT_IF_PID_DIFFERS(intern);
+
+ phongo_execute_command(intern->client, PHONGO_COMMAND_WRITE, db, command, options, server_id, return_value);
+} /* }}} */
+
+/* {{{ proto MongoDB\Driver\Cursor MongoDB\Driver\Manager::executeReadWriteCommand(string $db, MongoDB\Driver\Command $command[, array $options = null])
+ Execute a ReadWriteCommand */
+static PHP_METHOD(Manager, executeReadWriteCommand)
+{
+ zend_error_handling error_handling;
+ php_phongo_manager_t* intern;
+ char* db;
+ size_t db_len;
+ zval* command;
+ zval* options = NULL;
+ uint32_t server_id = 0;
+ zval* zsession = NULL;
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "sO|a!", &db, &db_len, &command, php_phongo_command_ce, &options) == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ intern = Z_MANAGER_OBJ_P(getThis());
+
+ if (!phongo_parse_session(options, intern->client, NULL, &zsession)) {
+ /* Exception should already have been thrown */
+ return;
+ }
+
+ if (!php_phongo_manager_select_server(true, false, NULL, zsession, intern->client, &server_id)) {
+ /* Exception should already have been thrown */
+ return;
+ }
+
+ /* If the Manager was created in a different process, reset the client so
+ * that cursors created by this process can be differentiated and its
+ * session pool is cleared. */
+ PHONGO_RESET_CLIENT_IF_PID_DIFFERS(intern);
+
+ phongo_execute_command(intern->client, PHONGO_COMMAND_READ_WRITE, db, command, options, server_id, return_value);
+} /* }}} */
+
+/* {{{ proto MongoDB\Driver\Cursor MongoDB\Driver\Manager::executeQuery(string $namespace, MongoDB\Driver\Query $query[, array $options = null])
+ Execute a Query */
+static PHP_METHOD(Manager, executeQuery)
+{
+ zend_error_handling error_handling;
+ php_phongo_manager_t* intern;
+ char* namespace;
+ size_t namespace_len;
+ zval* query;
+ zval* options = NULL;
+ bool free_options = false;
+ zval* zreadPreference = NULL;
+ uint32_t server_id = 0;
+ zval* zsession = NULL;
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "sO|z!", &namespace, &namespace_len, &query, php_phongo_query_ce, &options) == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ intern = Z_MANAGER_OBJ_P(getThis());
+
+ options = php_phongo_prep_legacy_option(options, "readPreference", &free_options);
+
+ if (!phongo_parse_session(options, intern->client, NULL, &zsession)) {
+ /* Exception should already have been thrown */
+ goto cleanup;
+ }
+
+ if (!phongo_parse_read_preference(options, &zreadPreference)) {
+ /* Exception should already have been thrown */
+ goto cleanup;
+ }
+
+ if (!php_phongo_manager_select_server(false, true, zreadPreference, zsession, intern->client, &server_id)) {
+ /* Exception should already have been thrown */
+ goto cleanup;
+ }
+
+ /* If the Manager was created in a different process, reset the client so
+ * that cursors created by this process can be differentiated and its
+ * session pool is cleared. */
+ PHONGO_RESET_CLIENT_IF_PID_DIFFERS(intern);
+
+ phongo_execute_query(intern->client, namespace, query, options, server_id, return_value);
+
+cleanup:
+ if (free_options) {
+ php_phongo_prep_legacy_option_free(options);
+ }
+} /* }}} */
+
+/* {{{ proto MongoDB\Driver\WriteResult MongoDB\Driver\Manager::executeBulkWrite(string $namespace, MongoDB\Driver\BulkWrite $zbulk[, array $options = null])
+ Executes a BulkWrite (i.e. any number of insert, update, and delete ops) */
+static PHP_METHOD(Manager, executeBulkWrite)
+{
+ zend_error_handling error_handling;
+ php_phongo_manager_t* intern;
+ char* namespace;
+ size_t namespace_len;
+ zval* zbulk;
+ php_phongo_bulkwrite_t* bulk;
+ zval* options = NULL;
+ bool free_options = false;
+ uint32_t server_id = 0;
+ zval* zsession = NULL;
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "sO|z!", &namespace, &namespace_len, &zbulk, php_phongo_bulkwrite_ce, &options) == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ intern = Z_MANAGER_OBJ_P(getThis());
+ bulk = Z_BULKWRITE_OBJ_P(zbulk);
+
+ options = php_phongo_prep_legacy_option(options, "writeConcern", &free_options);
+
+ if (!phongo_parse_session(options, intern->client, NULL, &zsession)) {
+ /* Exception should already have been thrown */
+ return;
+ }
+
+ if (!php_phongo_manager_select_server(true, false, NULL, zsession, intern->client, &server_id)) {
+ /* Exception should already have been thrown */
+ goto cleanup;
+ }
+
+ /* If the Server was created in a different process, reset the client so
+ * that its session pool is cleared. */
+ PHONGO_RESET_CLIENT_IF_PID_DIFFERS(intern);
+
+ phongo_execute_bulk_write(intern->client, namespace, bulk, options, server_id, return_value);
+
+cleanup:
+ if (free_options) {
+ php_phongo_prep_legacy_option_free(options);
+ }
+} /* }}} */
+
+/* {{{ proto MongoDB\Driver\ReadConcern MongoDB\Driver\Manager::getReadConcern()
+ Returns the ReadConcern associated with this Manager */
+static PHP_METHOD(Manager, getReadConcern)
+{
+ zend_error_handling error_handling;
+ php_phongo_manager_t* intern;
+
+ intern = Z_MANAGER_OBJ_P(getThis());
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters_none() == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ phongo_readconcern_init(return_value, mongoc_client_get_read_concern(intern->client));
+} /* }}} */
+
+/* {{{ proto MongoDB\Driver\ReadPreference MongoDB\Driver\Manager::getReadPreference()
+ Returns the ReadPreference associated with this Manager */
+static PHP_METHOD(Manager, getReadPreference)
+{
+ zend_error_handling error_handling;
+ php_phongo_manager_t* intern;
+
+ intern = Z_MANAGER_OBJ_P(getThis());
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters_none() == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ phongo_readpreference_init(return_value, mongoc_client_get_read_prefs(intern->client));
+} /* }}} */
+
+/* {{{ proto MongoDB\Driver\Server[] MongoDB\Driver\Manager::getServers()
+ Returns the Servers associated with this Manager */
+static PHP_METHOD(Manager, getServers)
+{
+ zend_error_handling error_handling;
+ php_phongo_manager_t* intern;
+ mongoc_server_description_t** sds;
+ size_t i, n = 0;
+
+ intern = Z_MANAGER_OBJ_P(getThis());
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters_none() == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ sds = mongoc_client_get_server_descriptions(intern->client, &n);
+ array_init_size(return_value, n);
+
+ for (i = 0; i < n; i++) {
+ zval obj;
+
+ phongo_server_init(&obj, intern->client, mongoc_server_description_id(sds[i]));
+ add_next_index_zval(return_value, &obj);
+ }
+
+ mongoc_server_descriptions_destroy_all(sds, n);
+} /* }}} */
+
+/* {{{ proto MongoDB\Driver\WriteConcern MongoDB\Driver\Manager::getWriteConcern()
+ Returns the WriteConcern associated with this Manager */
+static PHP_METHOD(Manager, getWriteConcern)
+{
+ zend_error_handling error_handling;
+ php_phongo_manager_t* intern;
+
+ intern = Z_MANAGER_OBJ_P(getThis());
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters_none() == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ phongo_writeconcern_init(return_value, mongoc_client_get_write_concern(intern->client));
+} /* }}} */
+
+/* {{{ proto MongoDB\Driver\Server MongoDB\Driver\Manager::selectServers(MongoDB\Driver\ReadPreference $readPreference)
+ Returns a suitable Server for the given ReadPreference */
+static PHP_METHOD(Manager, selectServer)
+{
+ zend_error_handling error_handling;
+ php_phongo_manager_t* intern;
+ zval* zreadPreference = NULL;
+ uint32_t server_id = 0;
+
+ intern = Z_MANAGER_OBJ_P(getThis());
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "O", &zreadPreference, php_phongo_readpreference_ce) == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ if (!php_phongo_manager_select_server(false, true, zreadPreference, NULL, intern->client, &server_id)) {
+ /* Exception should already have been thrown */
+ return;
+ }
+
+ phongo_server_init(return_value, intern->client, server_id);
+} /* }}} */
+
+/* {{{ proto MongoDB\Driver\Session MongoDB\Driver\Manager::startSession([array $options = null])
+ Returns a new client session */
+static PHP_METHOD(Manager, startSession)
+{
+ zend_error_handling error_handling;
+ php_phongo_manager_t* intern;
+ zval* options = NULL;
+ mongoc_session_opt_t* cs_opts = NULL;
+ mongoc_client_session_t* cs;
+ bson_error_t error = { 0 };
+ mongoc_transaction_opt_t* txn_opts = NULL;
+
+ intern = Z_MANAGER_OBJ_P(getThis());
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "|a!", &options) == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ if (options && php_array_existsc(options, "causalConsistency")) {
+ cs_opts = mongoc_session_opts_new();
+ mongoc_session_opts_set_causal_consistency(cs_opts, php_array_fetchc_bool(options, "causalConsistency"));
+ }
+
+ if (options && php_array_existsc(options, "defaultTransactionOptions")) {
+ zval* txn_options = php_array_fetchc(options, "defaultTransactionOptions");
+
+ /* Thrown exception and return if the defaultTransactionOptions is not an array */
+ if (Z_TYPE_P(txn_options) != IS_ARRAY) {
+ phongo_throw_exception(
+ PHONGO_ERROR_INVALID_ARGUMENT,
+ "Expected \"defaultTransactionOptions\" option to be an array, %s given",
+ PHONGO_ZVAL_CLASS_OR_TYPE_NAME_P(txn_options));
+ goto cleanup;
+ }
+
+ /* Parse transaction options */
+ txn_opts = php_mongodb_session_parse_transaction_options(txn_options);
+
+ /* If an exception is thrown while parsing, the txn_opts struct is also
+ * NULL, so no need to free it here */
+ if (EG(exception)) {
+ goto cleanup;
+ }
+
+ /* If the options are non-empty, add them to the client session opts struct */
+ if (txn_opts) {
+ if (!cs_opts) {
+ cs_opts = mongoc_session_opts_new();
+ }
+
+ mongoc_session_opts_set_default_transaction_opts(cs_opts, txn_opts);
+ mongoc_transaction_opts_destroy(txn_opts);
+ }
+ }
+
+ /* If the Manager was created in a different process, reset the client so
+ * that its session pool is cleared. This will ensure that we do not re-use
+ * a server session (i.e. LSID) created by a parent process. */
+ PHONGO_RESET_CLIENT_IF_PID_DIFFERS(intern);
+
+ cs = mongoc_client_start_session(intern->client, cs_opts, &error);
+
+ if (cs) {
+ phongo_session_init(return_value, cs);
+ } else {
+ phongo_throw_exception_from_bson_error_t(&error);
+ }
+
+cleanup:
+ if (cs_opts) {
+ mongoc_session_opts_destroy(cs_opts);
+ }
+} /* }}} */
+
+/* {{{ MongoDB\Driver\Manager function entries */
+ZEND_BEGIN_ARG_INFO_EX(ai_Manager___construct, 0, 0, 0)
+ ZEND_ARG_INFO(0, uri)
+ ZEND_ARG_ARRAY_INFO(0, options, 0)
+ ZEND_ARG_ARRAY_INFO(0, driverOptions, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(ai_Manager_createClientEncryption, 0, 0, 1)
+ ZEND_ARG_ARRAY_INFO(0, options, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(ai_Manager_executeCommand, 0, 0, 2)
+ ZEND_ARG_INFO(0, db)
+ ZEND_ARG_OBJ_INFO(0, command, MongoDB\\Driver\\Command, 0)
+ ZEND_ARG_INFO(0, options)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(ai_Manager_executeRWCommand, 0, 0, 2)
+ ZEND_ARG_INFO(0, db)
+ ZEND_ARG_OBJ_INFO(0, command, MongoDB\\Driver\\Command, 0)
+ ZEND_ARG_ARRAY_INFO(0, options, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(ai_Manager_executeQuery, 0, 0, 2)
+ ZEND_ARG_INFO(0, namespace)
+ ZEND_ARG_OBJ_INFO(0, zquery, MongoDB\\Driver\\Query, 0)
+ ZEND_ARG_INFO(0, options)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(ai_Manager_executeBulkWrite, 0, 0, 2)
+ ZEND_ARG_INFO(0, namespace)
+ ZEND_ARG_OBJ_INFO(0, zbulk, MongoDB\\Driver\\BulkWrite, 0)
+ ZEND_ARG_INFO(0, options)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(ai_Manager_selectServer, 0, 0, 1)
+ ZEND_ARG_OBJ_INFO(0, readPreference, MongoDB\\Driver\\ReadPreference, 1)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(ai_Manager_startSession, 0, 0, 0)
+ ZEND_ARG_ARRAY_INFO(0, options, 1)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(ai_Manager_void, 0, 0, 0)
+ZEND_END_ARG_INFO()
+
+static zend_function_entry php_phongo_manager_me[] = {
+ /* clang-format off */
+ PHP_ME(Manager, __construct, ai_Manager___construct, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
+ PHP_ME(Manager, createClientEncryption, ai_Manager_createClientEncryption, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
+ PHP_ME(Manager, executeCommand, ai_Manager_executeCommand, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
+ PHP_ME(Manager, executeReadCommand, ai_Manager_executeRWCommand, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
+ PHP_ME(Manager, executeWriteCommand, ai_Manager_executeRWCommand, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
+ PHP_ME(Manager, executeReadWriteCommand, ai_Manager_executeCommand, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
+ PHP_ME(Manager, executeQuery, ai_Manager_executeQuery, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
+ PHP_ME(Manager, executeBulkWrite, ai_Manager_executeBulkWrite, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
+ PHP_ME(Manager, getReadConcern, ai_Manager_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
+ PHP_ME(Manager, getReadPreference, ai_Manager_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
+ PHP_ME(Manager, getServers, ai_Manager_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
+ PHP_ME(Manager, getWriteConcern, ai_Manager_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
+ PHP_ME(Manager, selectServer, ai_Manager_selectServer, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
+ PHP_ME(Manager, startSession, ai_Manager_startSession, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
+ ZEND_NAMED_ME(__wakeup, PHP_FN(MongoDB_disabled___wakeup), ai_Manager_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
+ PHP_FE_END
+ /* clang-format on */
+};
+/* }}} */
+
+/* {{{ MongoDB\Driver\Manager object handlers */
+static zend_object_handlers php_phongo_handler_manager;
+
+static void php_phongo_manager_free_object(zend_object* object) /* {{{ */
+{
+ php_phongo_manager_t* intern = Z_OBJ_MANAGER(object);
+
+ zend_object_std_dtor(&intern->std);
+
+ if (intern->client) {
+ MONGOC_DEBUG("Not destroying persistent client for Manager");
+ intern->client = NULL;
+ }
+
+ if (intern->client_hash) {
+ efree(intern->client_hash);
+ }
+} /* }}} */
+
+static zend_object* php_phongo_manager_create_object(zend_class_entry* class_type) /* {{{ */
+{
+ php_phongo_manager_t* intern = NULL;
+
+ intern = PHONGO_ALLOC_OBJECT_T(php_phongo_manager_t, class_type);
+
+ zend_object_std_init(&intern->std, class_type);
+ object_properties_init(&intern->std, class_type);
+
+ PHONGO_SET_CREATED_BY_PID(intern);
+
+ intern->std.handlers = &php_phongo_handler_manager;
+
+ return &intern->std;
+} /* }}} */
+
+static HashTable* php_phongo_manager_get_debug_info(phongo_compat_object_handler_type* object, int* is_temp) /* {{{ */
+{
+ php_phongo_manager_t* intern;
+ mongoc_server_description_t** sds;
+ size_t i, n = 0;
+ zval retval = ZVAL_STATIC_INIT;
+ zval cluster;
+
+ *is_temp = 1;
+ intern = Z_OBJ_MANAGER(PHONGO_COMPAT_GET_OBJ(object));
+
+ array_init_size(&retval, 2);
+
+ ADD_ASSOC_STRING(&retval, "uri", mongoc_uri_get_string(mongoc_client_get_uri(intern->client)));
+
+ sds = mongoc_client_get_server_descriptions(intern->client, &n);
+
+ array_init_size(&cluster, n);
+
+ for (i = 0; i < n; i++) {
+ zval obj;
+
+ if (!php_phongo_server_to_zval(&obj, sds[i])) {
+ /* Exception already thrown */
+ zval_ptr_dtor(&obj);
+ zval_ptr_dtor(&cluster);
+ goto done;
+ }
+
+ add_next_index_zval(&cluster, &obj);
+ }
+
+ ADD_ASSOC_ZVAL_EX(&retval, "cluster", &cluster);
+
+done:
+ mongoc_server_descriptions_destroy_all(sds, n);
+
+ return Z_ARRVAL(retval);
+} /* }}} */
+/* }}} */
+
+void php_phongo_manager_init_ce(INIT_FUNC_ARGS) /* {{{ */
+{
+ zend_class_entry ce;
+
+ INIT_NS_CLASS_ENTRY(ce, "MongoDB\\Driver", "Manager", php_phongo_manager_me);
+ php_phongo_manager_ce = zend_register_internal_class(&ce);
+ php_phongo_manager_ce->create_object = php_phongo_manager_create_object;
+ PHONGO_CE_FINAL(php_phongo_manager_ce);
+ PHONGO_CE_DISABLE_SERIALIZATION(php_phongo_manager_ce);
+
+ memcpy(&php_phongo_handler_manager, phongo_get_std_object_handlers(), sizeof(zend_object_handlers));
+ php_phongo_handler_manager.get_debug_info = php_phongo_manager_get_debug_info;
+ php_phongo_handler_manager.free_obj = php_phongo_manager_free_object;
+ php_phongo_handler_manager.offset = XtOffsetOf(php_phongo_manager_t, std);
+} /* }}} */
+
+/*
+ * 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.9.0/src/MongoDB/Monitoring/CommandFailedEvent.c b/mongodb-1.9.0/src/MongoDB/Monitoring/CommandFailedEvent.c
new file mode 100644
index 00000000..487aac35
--- /dev/null
+++ b/mongodb-1.9.0/src/MongoDB/Monitoring/CommandFailedEvent.c
@@ -0,0 +1,305 @@
+/*
+ * Copyright 2016-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.
+ */
+
+#include <php.h>
+#include <Zend/zend_interfaces.h>
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "phongo_compat.h"
+#include "php_phongo.h"
+
+zend_class_entry* php_phongo_commandfailedevent_ce;
+
+/* {{{ proto string CommandFailedEvent::getCommandName()
+ Returns the command name for this event */
+PHP_METHOD(CommandFailedEvent, getCommandName)
+{
+ zend_error_handling error_handling;
+ php_phongo_commandfailedevent_t* intern;
+
+ intern = Z_COMMANDFAILEDEVENT_OBJ_P(getThis());
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters_none() == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ RETVAL_STRING(intern->command_name);
+} /* }}} */
+
+/* {{{ proto int CommandFailedEvent::getDurationMicros()
+ Returns the event's duration in microseconds */
+PHP_METHOD(CommandFailedEvent, getDurationMicros)
+{
+ zend_error_handling error_handling;
+ php_phongo_commandfailedevent_t* intern;
+
+ intern = Z_COMMANDFAILEDEVENT_OBJ_P(getThis());
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters_none() == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ RETURN_LONG(intern->duration_micros);
+} /* }}} */
+
+/* {{{ proto Exception CommandFailedEvent::getError()
+ Returns the error document associated with the event */
+PHP_METHOD(CommandFailedEvent, getError)
+{
+ zend_error_handling error_handling;
+ php_phongo_commandfailedevent_t* intern;
+
+ intern = Z_COMMANDFAILEDEVENT_OBJ_P(getThis());
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters_none() == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ RETURN_ZVAL(&intern->z_error, 1, 0);
+} /* }}} */
+
+/* {{{ proto string CommandFailedEvent::getOperationId()
+ Returns the event's operation ID */
+PHP_METHOD(CommandFailedEvent, getOperationId)
+{
+ zend_error_handling error_handling;
+ php_phongo_commandfailedevent_t* intern;
+ char int_as_string[20];
+
+ intern = Z_COMMANDFAILEDEVENT_OBJ_P(getThis());
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters_none() == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ sprintf(int_as_string, "%" PRIu64, intern->operation_id);
+ RETVAL_STRING(int_as_string);
+} /* }}} */
+
+/* {{{ proto stdClass CommandFailedEvent::getReply()
+ Returns the reply document associated with the event */
+PHP_METHOD(CommandFailedEvent, getReply)
+{
+ zend_error_handling error_handling;
+ php_phongo_commandfailedevent_t* intern;
+ php_phongo_bson_state state;
+
+ PHONGO_BSON_INIT_STATE(state);
+
+ intern = Z_COMMANDFAILEDEVENT_OBJ_P(getThis());
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters_none() == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ if (!php_phongo_bson_to_zval_ex(bson_get_data(intern->reply), intern->reply->len, &state)) {
+ zval_ptr_dtor(&state.zchild);
+ return;
+ }
+
+ RETURN_ZVAL(&state.zchild, 0, 1);
+} /* }}} */
+
+/* {{{ proto string CommandFailedEvent::getRequestId()
+ Returns the event's request ID */
+PHP_METHOD(CommandFailedEvent, getRequestId)
+{
+ zend_error_handling error_handling;
+ php_phongo_commandfailedevent_t* intern;
+ char int_as_string[20];
+
+ intern = Z_COMMANDFAILEDEVENT_OBJ_P(getThis());
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters_none() == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ sprintf(int_as_string, "%" PRIu64, intern->request_id);
+ RETVAL_STRING(int_as_string);
+} /* }}} */
+
+/* {{{ proto MongoDB\Driver\Server CommandFailedEvent::getServer()
+ Returns the Server from which the event originated */
+PHP_METHOD(CommandFailedEvent, getServer)
+{
+ zend_error_handling error_handling;
+ php_phongo_commandfailedevent_t* intern;
+
+ intern = Z_COMMANDFAILEDEVENT_OBJ_P(getThis());
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters_none() == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ phongo_server_init(return_value, intern->client, intern->server_id);
+} /* }}} */
+
+/**
+ * Event thrown when a command has failed to execute.
+ *
+ * This class is only constructed internally.
+ */
+
+/* {{{ MongoDB\Driver\Monitoring\CommandFailedEvent function entries */
+ZEND_BEGIN_ARG_INFO_EX(ai_CommandFailedEvent_void, 0, 0, 0)
+ZEND_END_ARG_INFO()
+
+static zend_function_entry php_phongo_commandfailedevent_me[] = {
+ /* clang-format off */
+ ZEND_NAMED_ME(__construct, PHP_FN(MongoDB_disabled___construct), ai_CommandFailedEvent_void, ZEND_ACC_PRIVATE | ZEND_ACC_FINAL)
+ PHP_ME(CommandFailedEvent, getCommandName, ai_CommandFailedEvent_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
+ PHP_ME(CommandFailedEvent, getError, ai_CommandFailedEvent_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
+ PHP_ME(CommandFailedEvent, getDurationMicros, ai_CommandFailedEvent_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
+ PHP_ME(CommandFailedEvent, getOperationId, ai_CommandFailedEvent_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
+ PHP_ME(CommandFailedEvent, getReply, ai_CommandFailedEvent_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
+ PHP_ME(CommandFailedEvent, getRequestId, ai_CommandFailedEvent_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
+ PHP_ME(CommandFailedEvent, getServer, ai_CommandFailedEvent_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
+ ZEND_NAMED_ME(__wakeup, PHP_FN(MongoDB_disabled___wakeup), ai_CommandFailedEvent_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
+ PHP_FE_END
+ /* clang-format on */
+};
+/* }}} */
+
+/* {{{ MongoDB\Driver\Monitoring\CommandFailedEvent object handlers */
+static zend_object_handlers php_phongo_handler_commandfailedevent;
+
+static void php_phongo_commandfailedevent_free_object(zend_object* object) /* {{{ */
+{
+ php_phongo_commandfailedevent_t* intern = Z_OBJ_COMMANDFAILEDEVENT(object);
+
+ zend_object_std_dtor(&intern->std);
+
+ if (!Z_ISUNDEF(intern->z_error)) {
+ zval_ptr_dtor(&intern->z_error);
+ }
+
+ if (intern->reply) {
+ bson_destroy(intern->reply);
+ }
+
+ if (intern->command_name) {
+ efree(intern->command_name);
+ }
+} /* }}} */
+
+static zend_object* php_phongo_commandfailedevent_create_object(zend_class_entry* class_type) /* {{{ */
+{
+ php_phongo_commandfailedevent_t* intern = NULL;
+
+ intern = PHONGO_ALLOC_OBJECT_T(php_phongo_commandfailedevent_t, class_type);
+
+ zend_object_std_init(&intern->std, class_type);
+ object_properties_init(&intern->std, class_type);
+
+ intern->std.handlers = &php_phongo_handler_commandfailedevent;
+
+ return &intern->std;
+} /* }}} */
+
+static HashTable* php_phongo_commandfailedevent_get_debug_info(phongo_compat_object_handler_type* object, int* is_temp) /* {{{ */
+{
+ php_phongo_commandfailedevent_t* intern;
+ zval retval = ZVAL_STATIC_INIT;
+ char operation_id[20], request_id[20];
+ php_phongo_bson_state reply_state;
+
+ PHONGO_BSON_INIT_STATE(reply_state);
+
+ intern = Z_OBJ_COMMANDFAILEDEVENT(PHONGO_COMPAT_GET_OBJ(object));
+ *is_temp = 1;
+ array_init_size(&retval, 6);
+
+ ADD_ASSOC_STRING(&retval, "commandName", intern->command_name);
+ ADD_ASSOC_INT64(&retval, "durationMicros", (int64_t) intern->duration_micros);
+
+ ADD_ASSOC_ZVAL_EX(&retval, "error", &intern->z_error);
+ Z_ADDREF(intern->z_error);
+
+ sprintf(operation_id, "%" PRIu64, intern->operation_id);
+ ADD_ASSOC_STRING(&retval, "operationId", operation_id);
+
+ if (!php_phongo_bson_to_zval_ex(bson_get_data(intern->reply), intern->reply->len, &reply_state)) {
+ zval_ptr_dtor(&reply_state.zchild);
+ goto done;
+ }
+
+ ADD_ASSOC_ZVAL(&retval, "reply", &reply_state.zchild);
+
+ sprintf(request_id, "%" PRIu64, intern->request_id);
+ ADD_ASSOC_STRING(&retval, "requestId", request_id);
+
+ {
+ zval server;
+
+ phongo_server_init(&server, intern->client, intern->server_id);
+ ADD_ASSOC_ZVAL_EX(&retval, "server", &server);
+ }
+
+done:
+ return Z_ARRVAL(retval);
+} /* }}} */
+/* }}} */
+
+void php_phongo_commandfailedevent_init_ce(INIT_FUNC_ARGS) /* {{{ */
+{
+ zend_class_entry ce;
+ (void) type;
+ (void) module_number;
+
+ INIT_NS_CLASS_ENTRY(ce, "MongoDB\\Driver\\Monitoring", "CommandFailedEvent", php_phongo_commandfailedevent_me);
+ php_phongo_commandfailedevent_ce = zend_register_internal_class(&ce);
+ php_phongo_commandfailedevent_ce->create_object = php_phongo_commandfailedevent_create_object;
+ PHONGO_CE_FINAL(php_phongo_commandfailedevent_ce);
+ PHONGO_CE_DISABLE_SERIALIZATION(php_phongo_commandfailedevent_ce);
+
+ memcpy(&php_phongo_handler_commandfailedevent, phongo_get_std_object_handlers(), sizeof(zend_object_handlers));
+ php_phongo_handler_commandfailedevent.get_debug_info = php_phongo_commandfailedevent_get_debug_info;
+ php_phongo_handler_commandfailedevent.free_obj = php_phongo_commandfailedevent_free_object;
+ php_phongo_handler_commandfailedevent.offset = XtOffsetOf(php_phongo_commandfailedevent_t, std);
+} /* }}} */
+
+/*
+ * 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.9.0/src/MongoDB/Monitoring/CommandStartedEvent.c b/mongodb-1.9.0/src/MongoDB/Monitoring/CommandStartedEvent.c
new file mode 100644
index 00000000..3084af3e
--- /dev/null
+++ b/mongodb-1.9.0/src/MongoDB/Monitoring/CommandStartedEvent.c
@@ -0,0 +1,282 @@
+/*
+ * Copyright 2016-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.
+ */
+
+#include <php.h>
+#include <Zend/zend_interfaces.h>
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "phongo_compat.h"
+#include "php_phongo.h"
+
+zend_class_entry* php_phongo_commandstartedevent_ce;
+
+/* {{{ proto stdClass CommandStartedEvent::getCommand()
+ Returns the command document associated with the event */
+PHP_METHOD(CommandStartedEvent, getCommand)
+{
+ zend_error_handling error_handling;
+ php_phongo_commandstartedevent_t* intern;
+ php_phongo_bson_state state;
+
+ PHONGO_BSON_INIT_STATE(state);
+
+ intern = Z_COMMANDSTARTEDEVENT_OBJ_P(getThis());
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters_none() == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ if (!php_phongo_bson_to_zval_ex(bson_get_data(intern->command), intern->command->len, &state)) {
+ zval_ptr_dtor(&state.zchild);
+ return;
+ }
+
+ RETURN_ZVAL(&state.zchild, 0, 1);
+} /* }}} */
+
+/* {{{ proto string CommandStartedEvent::getCommandName()
+ Returns the command name for this event */
+PHP_METHOD(CommandStartedEvent, getCommandName)
+{
+ zend_error_handling error_handling;
+ php_phongo_commandstartedevent_t* intern;
+
+ intern = Z_COMMANDSTARTEDEVENT_OBJ_P(getThis());
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters_none() == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ RETVAL_STRING(intern->command_name);
+} /* }}} */
+
+/* {{{ proto string CommandStartedEvent::getDatabaseName()
+ Returns the database name for this event */
+PHP_METHOD(CommandStartedEvent, getDatabaseName)
+{
+ zend_error_handling error_handling;
+ php_phongo_commandstartedevent_t* intern;
+
+ intern = Z_COMMANDSTARTEDEVENT_OBJ_P(getThis());
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters_none() == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ RETVAL_STRING(intern->database_name);
+} /* }}} */
+
+/* {{{ proto string CommandStartedEvent::getOperationId()
+ Returns the event's operation ID */
+PHP_METHOD(CommandStartedEvent, getOperationId)
+{
+ zend_error_handling error_handling;
+ php_phongo_commandstartedevent_t* intern;
+ char int_as_string[20];
+
+ intern = Z_COMMANDSTARTEDEVENT_OBJ_P(getThis());
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters_none() == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ sprintf(int_as_string, "%" PRIu64, intern->operation_id);
+ RETVAL_STRING(int_as_string);
+} /* }}} */
+
+/* {{{ proto string CommandStartedEvent::getRequestId()
+ Returns the event's request ID */
+PHP_METHOD(CommandStartedEvent, getRequestId)
+{
+ zend_error_handling error_handling;
+ php_phongo_commandstartedevent_t* intern;
+ char int_as_string[20];
+
+ intern = Z_COMMANDSTARTEDEVENT_OBJ_P(getThis());
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters_none() == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ sprintf(int_as_string, "%" PRIu64, intern->request_id);
+ RETVAL_STRING(int_as_string);
+} /* }}} */
+
+/* {{{ proto MongoDB\Driver\Server CommandStartedEvent::getServer()
+ Returns the Server from which the event originated */
+PHP_METHOD(CommandStartedEvent, getServer)
+{
+ zend_error_handling error_handling;
+ php_phongo_commandstartedevent_t* intern;
+
+ intern = Z_COMMANDSTARTEDEVENT_OBJ_P(getThis());
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters_none() == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ phongo_server_init(return_value, intern->client, intern->server_id);
+} /* }}} */
+
+/**
+ * Event thrown when a command has started to execute.
+ *
+ * This class is only constructed internally.
+ */
+
+/* {{{ MongoDB\Driver\Monitoring\CommandStartedEvent function entries */
+ZEND_BEGIN_ARG_INFO_EX(ai_CommandStartedEvent_void, 0, 0, 0)
+ZEND_END_ARG_INFO()
+
+static zend_function_entry php_phongo_commandstartedevent_me[] = {
+ /* clang-format off */
+ ZEND_NAMED_ME(__construct, PHP_FN(MongoDB_disabled___construct), ai_CommandStartedEvent_void, ZEND_ACC_PRIVATE | ZEND_ACC_FINAL)
+ PHP_ME(CommandStartedEvent, getCommand, ai_CommandStartedEvent_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
+ PHP_ME(CommandStartedEvent, getCommandName, ai_CommandStartedEvent_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
+ PHP_ME(CommandStartedEvent, getDatabaseName, ai_CommandStartedEvent_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
+ PHP_ME(CommandStartedEvent, getOperationId, ai_CommandStartedEvent_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
+ PHP_ME(CommandStartedEvent, getRequestId, ai_CommandStartedEvent_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
+ PHP_ME(CommandStartedEvent, getServer, ai_CommandStartedEvent_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
+ ZEND_NAMED_ME(__wakeup, PHP_FN(MongoDB_disabled___wakeup), ai_CommandStartedEvent_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
+ PHP_FE_END
+ /* clang-format on */
+};
+/* }}} */
+
+/* {{{ MongoDB\Driver\Monitoring\CommandStartedEvent object handlers */
+static zend_object_handlers php_phongo_handler_commandstartedevent;
+
+static void php_phongo_commandstartedevent_free_object(zend_object* object) /* {{{ */
+{
+ php_phongo_commandstartedevent_t* intern = Z_OBJ_COMMANDSTARTEDEVENT(object);
+
+ zend_object_std_dtor(&intern->std);
+
+ if (intern->command) {
+ bson_destroy(intern->command);
+ }
+ if (intern->command_name) {
+ efree(intern->command_name);
+ }
+ if (intern->database_name) {
+ efree(intern->database_name);
+ }
+} /* }}} */
+
+static zend_object* php_phongo_commandstartedevent_create_object(zend_class_entry* class_type) /* {{{ */
+{
+ php_phongo_commandstartedevent_t* intern = NULL;
+
+ intern = PHONGO_ALLOC_OBJECT_T(php_phongo_commandstartedevent_t, class_type);
+
+ zend_object_std_init(&intern->std, class_type);
+ object_properties_init(&intern->std, class_type);
+
+ intern->std.handlers = &php_phongo_handler_commandstartedevent;
+
+ return &intern->std;
+} /* }}} */
+
+static HashTable* php_phongo_commandstartedevent_get_debug_info(phongo_compat_object_handler_type* object, int* is_temp) /* {{{ */
+{
+ php_phongo_commandstartedevent_t* intern;
+ zval retval = ZVAL_STATIC_INIT;
+ char operation_id[20], request_id[20];
+ php_phongo_bson_state command_state;
+
+ PHONGO_BSON_INIT_STATE(command_state);
+
+ intern = Z_OBJ_COMMANDSTARTEDEVENT(PHONGO_COMPAT_GET_OBJ(object));
+ *is_temp = 1;
+ array_init_size(&retval, 6);
+
+ if (!php_phongo_bson_to_zval_ex(bson_get_data(intern->command), intern->command->len, &command_state)) {
+ zval_ptr_dtor(&command_state.zchild);
+ goto done;
+ }
+
+ ADD_ASSOC_ZVAL(&retval, "command", &command_state.zchild);
+
+ ADD_ASSOC_STRING(&retval, "commandName", intern->command_name);
+ ADD_ASSOC_STRING(&retval, "databaseName", intern->database_name);
+
+ sprintf(operation_id, "%" PRIu64, intern->operation_id);
+ ADD_ASSOC_STRING(&retval, "operationId", operation_id);
+
+ sprintf(request_id, "%" PRIu64, intern->request_id);
+ ADD_ASSOC_STRING(&retval, "requestId", request_id);
+
+ {
+ zval server;
+
+ phongo_server_init(&server, intern->client, intern->server_id);
+ ADD_ASSOC_ZVAL_EX(&retval, "server", &server);
+ }
+
+done:
+ return Z_ARRVAL(retval);
+} /* }}} */
+/* }}} */
+
+void php_phongo_commandstartedevent_init_ce(INIT_FUNC_ARGS) /* {{{ */
+{
+ zend_class_entry ce;
+ (void) type;
+ (void) module_number;
+
+ INIT_NS_CLASS_ENTRY(ce, "MongoDB\\Driver\\Monitoring", "CommandStartedEvent", php_phongo_commandstartedevent_me);
+ php_phongo_commandstartedevent_ce = zend_register_internal_class(&ce);
+ php_phongo_commandstartedevent_ce->create_object = php_phongo_commandstartedevent_create_object;
+ PHONGO_CE_FINAL(php_phongo_commandstartedevent_ce);
+ PHONGO_CE_DISABLE_SERIALIZATION(php_phongo_commandstartedevent_ce);
+
+ memcpy(&php_phongo_handler_commandstartedevent, phongo_get_std_object_handlers(), sizeof(zend_object_handlers));
+ php_phongo_handler_commandstartedevent.get_debug_info = php_phongo_commandstartedevent_get_debug_info;
+ php_phongo_handler_commandstartedevent.free_obj = php_phongo_commandstartedevent_free_object;
+ php_phongo_handler_commandstartedevent.offset = XtOffsetOf(php_phongo_commandstartedevent_t, std);
+
+ return;
+} /* }}} */
+
+/*
+ * 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.8.1/src/MongoDB/Monitoring/CommandSubscriber.c b/mongodb-1.9.0/src/MongoDB/Monitoring/CommandSubscriber.c
similarity index 100%
rename from mongodb-1.8.1/src/MongoDB/Monitoring/CommandSubscriber.c
rename to mongodb-1.9.0/src/MongoDB/Monitoring/CommandSubscriber.c
diff --git a/mongodb-1.9.0/src/MongoDB/Monitoring/CommandSucceededEvent.c b/mongodb-1.9.0/src/MongoDB/Monitoring/CommandSucceededEvent.c
new file mode 100644
index 00000000..622e156c
--- /dev/null
+++ b/mongodb-1.9.0/src/MongoDB/Monitoring/CommandSucceededEvent.c
@@ -0,0 +1,279 @@
+/*
+ * Copyright 2016-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.
+ */
+
+#include <php.h>
+#include <Zend/zend_interfaces.h>
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "phongo_compat.h"
+#include "php_phongo.h"
+
+zend_class_entry* php_phongo_commandsucceededevent_ce;
+
+/* {{{ proto string CommandSucceededEvent::getCommandName()
+ Returns the command name for this event */
+PHP_METHOD(CommandSucceededEvent, getCommandName)
+{
+ zend_error_handling error_handling;
+ php_phongo_commandsucceededevent_t* intern;
+
+ intern = Z_COMMANDSUCCEEDEDEVENT_OBJ_P(getThis());
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters_none() == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ RETVAL_STRING(intern->command_name);
+} /* }}} */
+
+/* {{{ proto int CommandSucceededEvent::getDurationMicros()
+ Returns the event's duration in microseconds */
+PHP_METHOD(CommandSucceededEvent, getDurationMicros)
+{
+ zend_error_handling error_handling;
+ php_phongo_commandsucceededevent_t* intern;
+
+ intern = Z_COMMANDSUCCEEDEDEVENT_OBJ_P(getThis());
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters_none() == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ RETURN_LONG(intern->duration_micros);
+} /* }}} */
+
+/* {{{ proto string CommandSucceededEvent::getOperationId()
+ Returns the event's operation ID */
+PHP_METHOD(CommandSucceededEvent, getOperationId)
+{
+ zend_error_handling error_handling;
+ php_phongo_commandsucceededevent_t* intern;
+ char int_as_string[20];
+
+ intern = Z_COMMANDSUCCEEDEDEVENT_OBJ_P(getThis());
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters_none() == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ sprintf(int_as_string, "%" PRIu64, intern->operation_id);
+ RETVAL_STRING(int_as_string);
+} /* }}} */
+
+/* {{{ proto stdClass CommandSucceededEvent::getReply()
+ Returns the reply document associated with the event */
+PHP_METHOD(CommandSucceededEvent, getReply)
+{
+ zend_error_handling error_handling;
+ php_phongo_commandsucceededevent_t* intern;
+ php_phongo_bson_state state;
+
+ PHONGO_BSON_INIT_STATE(state);
+
+ intern = Z_COMMANDSUCCEEDEDEVENT_OBJ_P(getThis());
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters_none() == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ if (!php_phongo_bson_to_zval_ex(bson_get_data(intern->reply), intern->reply->len, &state)) {
+ zval_ptr_dtor(&state.zchild);
+ return;
+ }
+
+ RETURN_ZVAL(&state.zchild, 0, 1);
+} /* }}} */
+
+/* {{{ proto string CommandsucceededEvent::getRequestId()
+ Returns the event's request ID */
+PHP_METHOD(CommandSucceededEvent, getRequestId)
+{
+ zend_error_handling error_handling;
+ php_phongo_commandsucceededevent_t* intern;
+ char int_as_string[20];
+
+ intern = Z_COMMANDSUCCEEDEDEVENT_OBJ_P(getThis());
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters_none() == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ sprintf(int_as_string, "%" PRIu64, intern->request_id);
+ RETVAL_STRING(int_as_string);
+} /* }}} */
+
+/* {{{ proto MongoDB\Driver\Server CommandSucceededEvent::getServer()
+ Returns the Server from which the event originated */
+PHP_METHOD(CommandSucceededEvent, getServer)
+{
+ zend_error_handling error_handling;
+ php_phongo_commandsucceededevent_t* intern;
+
+ intern = Z_COMMANDSUCCEEDEDEVENT_OBJ_P(getThis());
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters_none() == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ phongo_server_init(return_value, intern->client, intern->server_id);
+} /* }}} */
+
+/**
+ * Event thrown when a command has succeeded to execute.
+ *
+ * This class is only constructed internally.
+ */
+
+/* {{{ MongoDB\Driver\Monitoring\CommandSucceededEvent function entries */
+ZEND_BEGIN_ARG_INFO_EX(ai_CommandSucceededEvent_void, 0, 0, 0)
+ZEND_END_ARG_INFO()
+
+static zend_function_entry php_phongo_commandsucceededevent_me[] = {
+ /* clang-format off */
+ ZEND_NAMED_ME(__construct, PHP_FN(MongoDB_disabled___construct), ai_CommandSucceededEvent_void, ZEND_ACC_PRIVATE | ZEND_ACC_FINAL)
+ PHP_ME(CommandSucceededEvent, getCommandName, ai_CommandSucceededEvent_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
+ PHP_ME(CommandSucceededEvent, getDurationMicros, ai_CommandSucceededEvent_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
+ PHP_ME(CommandSucceededEvent, getOperationId, ai_CommandSucceededEvent_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
+ PHP_ME(CommandSucceededEvent, getReply, ai_CommandSucceededEvent_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
+ PHP_ME(CommandSucceededEvent, getRequestId, ai_CommandSucceededEvent_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
+ PHP_ME(CommandSucceededEvent, getServer, ai_CommandSucceededEvent_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
+ ZEND_NAMED_ME(__wakeup, PHP_FN(MongoDB_disabled___wakeup), ai_CommandSucceededEvent_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
+ PHP_FE_END
+ /* clang-format on */
+};
+/* }}} */
+
+/* {{{ MongoDB\Driver\Monitoring\CommandSucceededEvent object handlers */
+static zend_object_handlers php_phongo_handler_commandsucceededevent;
+
+static void php_phongo_commandsucceededevent_free_object(zend_object* object) /* {{{ */
+{
+ php_phongo_commandsucceededevent_t* intern = Z_OBJ_COMMANDSUCCEEDEDEVENT(object);
+
+ zend_object_std_dtor(&intern->std);
+
+ if (intern->reply) {
+ bson_destroy(intern->reply);
+ }
+ if (intern->command_name) {
+ efree(intern->command_name);
+ }
+} /* }}} */
+
+static zend_object* php_phongo_commandsucceededevent_create_object(zend_class_entry* class_type) /* {{{ */
+{
+ php_phongo_commandsucceededevent_t* intern = NULL;
+
+ intern = PHONGO_ALLOC_OBJECT_T(php_phongo_commandsucceededevent_t, class_type);
+
+ zend_object_std_init(&intern->std, class_type);
+ object_properties_init(&intern->std, class_type);
+
+ intern->std.handlers = &php_phongo_handler_commandsucceededevent;
+
+ return &intern->std;
+} /* }}} */
+
+static HashTable* php_phongo_commandsucceededevent_get_debug_info(phongo_compat_object_handler_type* object, int* is_temp) /* {{{ */
+{
+ php_phongo_commandsucceededevent_t* intern;
+ zval retval = ZVAL_STATIC_INIT;
+ char operation_id[20], request_id[20];
+ php_phongo_bson_state reply_state;
+
+ PHONGO_BSON_INIT_STATE(reply_state);
+
+ intern = Z_OBJ_COMMANDSUCCEEDEDEVENT(PHONGO_COMPAT_GET_OBJ(object));
+ *is_temp = 1;
+ array_init_size(&retval, 6);
+
+ ADD_ASSOC_STRING(&retval, "commandName", intern->command_name);
+ ADD_ASSOC_INT64(&retval, "durationMicros", (int64_t) intern->duration_micros);
+
+ sprintf(operation_id, "%" PRIu64, intern->operation_id);
+ ADD_ASSOC_STRING(&retval, "operationId", operation_id);
+
+ if (php_phongo_bson_to_zval_ex(bson_get_data(intern->reply), intern->reply->len, &reply_state)) {
+ zval_ptr_dtor(&reply_state.zchild);
+ goto done;
+ }
+
+ ADD_ASSOC_ZVAL(&retval, "reply", &reply_state.zchild);
+
+ sprintf(request_id, "%" PRIu64, intern->request_id);
+ ADD_ASSOC_STRING(&retval, "requestId", request_id);
+
+ {
+ zval server;
+
+ phongo_server_init(&server, intern->client, intern->server_id);
+ ADD_ASSOC_ZVAL_EX(&retval, "server", &server);
+ }
+
+done:
+ return Z_ARRVAL(retval);
+} /* }}} */
+/* }}} */
+
+void php_phongo_commandsucceededevent_init_ce(INIT_FUNC_ARGS) /* {{{ */
+{
+ zend_class_entry ce;
+ (void) type;
+ (void) module_number;
+
+ INIT_NS_CLASS_ENTRY(ce, "MongoDB\\Driver\\Monitoring", "CommandSucceededEvent", php_phongo_commandsucceededevent_me);
+ php_phongo_commandsucceededevent_ce = zend_register_internal_class(&ce);
+ php_phongo_commandsucceededevent_ce->create_object = php_phongo_commandsucceededevent_create_object;
+ PHONGO_CE_FINAL(php_phongo_commandsucceededevent_ce);
+ PHONGO_CE_DISABLE_SERIALIZATION(php_phongo_commandsucceededevent_ce);
+
+ memcpy(&php_phongo_handler_commandsucceededevent, phongo_get_std_object_handlers(), sizeof(zend_object_handlers));
+ php_phongo_handler_commandsucceededevent.get_debug_info = php_phongo_commandsucceededevent_get_debug_info;
+ php_phongo_handler_commandsucceededevent.free_obj = php_phongo_commandsucceededevent_free_object;
+ php_phongo_handler_commandsucceededevent.offset = XtOffsetOf(php_phongo_commandsucceededevent_t, std);
+
+ return;
+} /* }}} */
+
+/*
+ * 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.8.1/src/MongoDB/Monitoring/Subscriber.c b/mongodb-1.9.0/src/MongoDB/Monitoring/Subscriber.c
similarity index 100%
rename from mongodb-1.8.1/src/MongoDB/Monitoring/Subscriber.c
rename to mongodb-1.9.0/src/MongoDB/Monitoring/Subscriber.c
diff --git a/mongodb-1.9.0/src/MongoDB/Monitoring/functions.c b/mongodb-1.9.0/src/MongoDB/Monitoring/functions.c
new file mode 100644
index 00000000..bdb72217
--- /dev/null
+++ b/mongodb-1.9.0/src/MongoDB/Monitoring/functions.c
@@ -0,0 +1,108 @@
+/*
+ * Copyright 2016-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.
+ */
+
+#include <php.h>
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "phongo_compat.h"
+#include "php_phongo.h"
+
+ZEND_EXTERN_MODULE_GLOBALS(mongodb)
+
+static char* php_phongo_make_subscriber_hash(zval* subscriber)
+{
+ char* hash;
+ int hash_len;
+
+ hash_len = spprintf(&hash, 0, "SUBS-%09d", Z_OBJ_HANDLE_P(subscriber));
+
+ return hash;
+}
+
+/* {{{ proto void MongoDB\Driver\Monitoring\addSubscriber(MongoDB\Driver\Monitoring\Subscriber $subscriber)
+ Adds a monitoring subscriber to the set of subscribers */
+PHP_FUNCTION(MongoDB_Driver_Monitoring_addSubscriber)
+{
+ zend_error_handling error_handling;
+ zval* zSubscriber = NULL;
+ char* hash;
+ zval* subscriber;
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "O", &zSubscriber, php_phongo_subscriber_ce) == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ /* The HashTable should never be NULL, as it's initialized during RINIT and
+ * destroyed during RSHUTDOWN. This is simply a defensive guard. */
+ if (!MONGODB_G(subscribers)) {
+ return;
+ }
+
+ hash = php_phongo_make_subscriber_hash(zSubscriber);
+
+ /* If we have already stored the subscriber, bail out. Otherwise, add
+ * subscriber to list */
+ if ((subscriber = zend_hash_str_find(MONGODB_G(subscribers), hash, strlen(hash)))) {
+ efree(hash);
+ return;
+ }
+
+ zend_hash_str_update(MONGODB_G(subscribers), hash, strlen(hash), zSubscriber);
+ Z_ADDREF_P(zSubscriber);
+ efree(hash);
+} /* }}} */
+
+/* {{{ proto void MongoDB\Driver\Monitoring\removeSubscriber(MongoDB\Driver\Monitoring\Subscriber $subscriber)
+ Removes a monitoring subscriber from the set of subscribers */
+PHP_FUNCTION(MongoDB_Driver_Monitoring_removeSubscriber)
+{
+ zend_error_handling error_handling;
+ zval* zSubscriber = NULL;
+ char* hash;
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "O", &zSubscriber, php_phongo_subscriber_ce) == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ /* The HashTable should never be NULL, as it's initialized during RINIT and
+ * destroyed during RSHUTDOWN. This is simply a defensive guard. */
+ if (!MONGODB_G(subscribers)) {
+ return;
+ }
+
+ hash = php_phongo_make_subscriber_hash(zSubscriber);
+
+ zend_hash_str_del(MONGODB_G(subscribers), hash, strlen(hash));
+ efree(hash);
+} /* }}} */
+
+/*
+ * 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.8.1/src/MongoDB/Monitoring/functions.h b/mongodb-1.9.0/src/MongoDB/Monitoring/functions.h
similarity index 100%
rename from mongodb-1.8.1/src/MongoDB/Monitoring/functions.h
rename to mongodb-1.9.0/src/MongoDB/Monitoring/functions.h
diff --git a/mongodb-1.9.0/src/MongoDB/Query.c b/mongodb-1.9.0/src/MongoDB/Query.c
new file mode 100644
index 00000000..fde9d775
--- /dev/null
+++ b/mongodb-1.9.0/src/MongoDB/Query.c
@@ -0,0 +1,502 @@
+/*
+ * 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.
+ */
+
+#include <php.h>
+#include <Zend/zend_interfaces.h>
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "php_array_api.h"
+#include "phongo_compat.h"
+#include "php_phongo.h"
+#include "php_bson.h"
+
+zend_class_entry* php_phongo_query_ce;
+
+/* Appends a string field into the BSON options. Returns true on success;
+ * otherwise, false is returned and an exception is thrown. */
+static bool php_phongo_query_opts_append_string(bson_t* opts, const char* opts_key, zval* zarr, const char* zarr_key) /* {{{ */
+{
+ zval* value = php_array_fetch(zarr, zarr_key);
+
+ if (Z_TYPE_P(value) != IS_STRING) {
+ phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Expected \"%s\" %s to be string, %s given", zarr_key, zarr_key[0] == '$' ? "modifier" : "option", PHONGO_ZVAL_CLASS_OR_TYPE_NAME_P(value));
+ return false;
+ }
+
+ if (!bson_append_utf8(opts, opts_key, strlen(opts_key), Z_STRVAL_P(value), Z_STRLEN_P(value))) {
+ phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Error appending \"%s\" option", opts_key);
+ return false;
+ }
+
+ return true;
+} /* }}} */
+
+/* Appends a document field for the given opts document and key. Returns true on
+ * success; otherwise, false is returned and an exception is thrown. */
+static bool php_phongo_query_opts_append_document(bson_t* opts, const char* opts_key, zval* zarr, const char* zarr_key) /* {{{ */
+{
+ zval* value = php_array_fetch(zarr, zarr_key);
+ bson_t b = BSON_INITIALIZER;
+
+ if (Z_TYPE_P(value) != IS_OBJECT && Z_TYPE_P(value) != IS_ARRAY) {
+ phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Expected \"%s\" %s to be array or object, %s given", zarr_key, zarr_key[0] == '$' ? "modifier" : "option", PHONGO_ZVAL_CLASS_OR_TYPE_NAME_P(value));
+ return false;
+ }
+
+ php_phongo_zval_to_bson(value, PHONGO_BSON_NONE, &b, NULL);
+
+ if (EG(exception)) {
+ bson_destroy(&b);
+ return false;
+ }
+
+ if (!bson_validate(&b, BSON_VALIDATE_EMPTY_KEYS, NULL)) {
+ phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Cannot use empty keys in \"%s\" %s", zarr_key, zarr_key[0] == '$' ? "modifier" : "option");
+ bson_destroy(&b);
+ return false;
+ }
+
+ if (!BSON_APPEND_DOCUMENT(opts, opts_key, &b)) {
+ phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Error appending \"%s\" option", opts_key);
+ bson_destroy(&b);
+ return false;
+ }
+
+ bson_destroy(&b);
+ return true;
+} /* }}} */
+
+#define PHONGO_QUERY_OPT_BOOL_EX(opt, zarr, key, deprecated) \
+ if ((zarr) && php_array_existsc((zarr), (key))) { \
+ if ((deprecated)) { \
+ php_error_docref(NULL, E_DEPRECATED, "The \"%s\" option is deprecated and will be removed in a future release", key); \
+ } \
+ if (!BSON_APPEND_BOOL(intern->opts, (opt), php_array_fetchc_bool((zarr), (key)))) { \
+ phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Error appending \"%s\" option", (opt)); \
+ return false; \
+ } \
+ }
+
+#define PHONGO_QUERY_OPT_BOOL(opt, zarr, key) PHONGO_QUERY_OPT_BOOL_EX((opt), (zarr), (key), 0)
+#define PHONGO_QUERY_OPT_BOOL_DEPRECATED(opt, zarr, key) PHONGO_QUERY_OPT_BOOL_EX((opt), (zarr), (key), 1)
+
+#define PHONGO_QUERY_OPT_DOCUMENT(opt, zarr, key) \
+ if ((zarr) && php_array_existsc((zarr), (key))) { \
+ if (!php_phongo_query_opts_append_document(intern->opts, (opt), (zarr), (key))) { \
+ return false; \
+ } \
+ }
+
+/* Note: handling of integer options will depend on SIZEOF_ZEND_LONG and we
+ * are not converting strings to 64-bit integers for 32-bit platforms. */
+
+#define PHONGO_QUERY_OPT_INT64_EX(opt, zarr, key, deprecated) \
+ if ((zarr) && php_array_existsc((zarr), (key))) { \
+ if ((deprecated)) { \
+ php_error_docref(NULL, E_DEPRECATED, "The \"%s\" option is deprecated and will be removed in a future release", key); \
+ } \
+ if (!BSON_APPEND_INT64(intern->opts, (opt), php_array_fetchc_long((zarr), (key)))) { \
+ phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Error appending \"%s\" option", (opt)); \
+ return false; \
+ } \
+ }
+
+#define PHONGO_QUERY_OPT_INT64(opt, zarr, key) PHONGO_QUERY_OPT_INT64_EX((opt), (zarr), (key), 0)
+#define PHONGO_QUERY_OPT_INT64_DEPRECATED(opt, zarr, key) PHONGO_QUERY_OPT_INT64_EX((opt), (zarr), (key), 1)
+
+#define PHONGO_QUERY_OPT_STRING(opt, zarr, key) \
+ if ((zarr) && php_array_existsc((zarr), (key))) { \
+ if (!php_phongo_query_opts_append_string(intern->opts, (opt), (zarr), (key))) { \
+ return false; \
+ } \
+ }
+
+/* Initialize the "hint" option. Returns true on success; otherwise, false is
+ * returned and an exception is thrown.
+ *
+ * The "hint" option (or "$hint" modifier) must be a string or document. Check
+ * for both types and merge into BSON options accordingly. */
+static bool php_phongo_query_init_hint(php_phongo_query_t* intern, zval* options, zval* modifiers) /* {{{ */
+{
+ /* The "hint" option (or "$hint" modifier) must be a string or document.
+ * Check for both types and merge into BSON options accordingly. */
+ if (php_array_existsc(options, "hint")) {
+ zend_uchar type = Z_TYPE_P(php_array_fetchc(options, "hint"));
+
+ if (type == IS_STRING) {
+ PHONGO_QUERY_OPT_STRING("hint", options, "hint");
+ } else if (type == IS_OBJECT || type == IS_ARRAY) {
+ PHONGO_QUERY_OPT_DOCUMENT("hint", options, "hint");
+ } else {
+ phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Expected \"hint\" option to be string, array, or object, %s given", zend_get_type_by_const(type));
+ return false;
+ }
+ } else if (modifiers && php_array_existsc(modifiers, "$hint")) {
+ zend_uchar type = Z_TYPE_P(php_array_fetchc(modifiers, "$hint"));
+
+ if (type == IS_STRING) {
+ PHONGO_QUERY_OPT_STRING("hint", modifiers, "$hint");
+ } else if (type == IS_OBJECT || type == IS_ARRAY) {
+ PHONGO_QUERY_OPT_DOCUMENT("hint", modifiers, "$hint");
+ } else {
+ phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Expected \"$hint\" modifier to be string, array, or object, %s given", zend_get_type_by_const(type));
+ return false;
+ }
+ }
+
+ return true;
+} /* }}} */
+
+/* Initialize the "limit" and "singleBatch" options. Returns true on success;
+ * otherwise, false is returned and an exception is thrown.
+ *
+ * mongoc_collection_find_with_opts() requires a non-negative limit. For
+ * backwards compatibility, a negative limit should be set as a positive value
+ * and default singleBatch to true. */
+static bool php_phongo_query_init_limit_and_singlebatch(php_phongo_query_t* intern, zval* options) /* {{{ */
+{
+ if (php_array_fetchc_long(options, "limit") < 0) {
+ zend_long limit = php_array_fetchc_long(options, "limit");
+
+ if (!BSON_APPEND_INT64(intern->opts, "limit", -limit)) {
+ phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Error appending \"limit\" option");
+ return false;
+ }
+
+ if (php_array_existsc(options, "singleBatch") && !php_array_fetchc_bool(options, "singleBatch")) {
+ phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Negative \"limit\" option conflicts with false \"singleBatch\" option");
+ return false;
+ } else {
+ if (!BSON_APPEND_BOOL(intern->opts, "singleBatch", true)) {
+ phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Error appending \"singleBatch\" option");
+ return false;
+ }
+ }
+ } else {
+ PHONGO_QUERY_OPT_INT64("limit", options, "limit");
+ PHONGO_QUERY_OPT_BOOL("singleBatch", options, "singleBatch");
+ }
+
+ return true;
+} /* }}} */
+
+/* Initialize the "readConcern" option. Returns true on success; otherwise,
+ * false is returned and an exception is thrown.
+ *
+ * The "readConcern" option should be a MongoDB\Driver\ReadConcern instance,
+ * which must be converted to a mongoc_read_concern_t. */
+static bool php_phongo_query_init_readconcern(php_phongo_query_t* intern, zval* options) /* {{{ */
+{
+ zval* read_concern;
+
+ if (!php_array_existsc(options, "readConcern")) {
+ return true;
+ }
+
+ read_concern = php_array_fetchc(options, "readConcern");
+
+ if (Z_TYPE_P(read_concern) != IS_OBJECT || !instanceof_function(Z_OBJCE_P(read_concern), php_phongo_readconcern_ce)) {
+ phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Expected \"readConcern\" option to be %s, %s given", ZSTR_VAL(php_phongo_readconcern_ce->name), PHONGO_ZVAL_CLASS_OR_TYPE_NAME_P(read_concern));
+ return false;
+ }
+
+ intern->read_concern = mongoc_read_concern_copy(phongo_read_concern_from_zval(read_concern));
+
+ return true;
+} /* }}} */
+
+/* Initialize the "maxAwaitTimeMS" option. Returns true on success; otherwise,
+ * false is returned and an exception is thrown.
+ *
+ * The "maxAwaitTimeMS" option is assigned to the cursor after query execution
+ * via mongoc_cursor_set_max_await_time_ms(). */
+static bool php_phongo_query_init_max_await_time_ms(php_phongo_query_t* intern, zval* options) /* {{{ */
+{
+ int64_t max_await_time_ms;
+
+ if (!php_array_existsc(options, "maxAwaitTimeMS")) {
+ return true;
+ }
+
+ max_await_time_ms = php_array_fetchc_long(options, "maxAwaitTimeMS");
+
+ if (max_await_time_ms < 0) {
+ phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Expected \"maxAwaitTimeMS\" option to be >= 0, %" PRId64 " given", max_await_time_ms);
+ return false;
+ }
+
+ if (max_await_time_ms > UINT32_MAX) {
+ phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Expected \"maxAwaitTimeMS\" option to be <= %" PRIu32 ", %" PRId64 " given", UINT32_MAX, max_await_time_ms);
+ return false;
+ }
+
+ intern->max_await_time_ms = (uint32_t) max_await_time_ms;
+
+ return true;
+} /* }}} */
+
+/* Initializes the php_phongo_query_t from filter and options arguments. This
+ * function will fall back to a modifier in the absence of a top-level option
+ * (where applicable). */
+static bool php_phongo_query_init(php_phongo_query_t* intern, zval* filter, zval* options) /* {{{ */
+{
+ zval* modifiers = NULL;
+
+ intern->filter = bson_new();
+ intern->opts = bson_new();
+ intern->max_await_time_ms = 0;
+
+ php_phongo_zval_to_bson(filter, PHONGO_BSON_NONE, intern->filter, NULL);
+
+ /* Note: if any exceptions are thrown, we can simply return as PHP will
+ * invoke php_phongo_query_free_object to destruct the object. */
+ if (EG(exception)) {
+ return false;
+ }
+
+ if (!bson_validate(intern->filter, BSON_VALIDATE_EMPTY_KEYS, NULL)) {
+ phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Cannot use empty keys in filter document");
+ return false;
+ }
+
+ if (!options) {
+ return true;
+ }
+
+ if (php_array_existsc(options, "modifiers")) {
+ modifiers = php_array_fetchc(options, "modifiers");
+
+ if (Z_TYPE_P(modifiers) != IS_ARRAY) {
+ phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Expected \"modifiers\" option to be array, %s given", PHONGO_ZVAL_CLASS_OR_TYPE_NAME_P(modifiers));
+ return false;
+ }
+ }
+
+ PHONGO_QUERY_OPT_BOOL("allowDiskUse", options, "allowDiskUse")
+ PHONGO_QUERY_OPT_BOOL("allowPartialResults", options, "allowPartialResults")
+ else PHONGO_QUERY_OPT_BOOL("allowPartialResults", options, "partial");
+ PHONGO_QUERY_OPT_BOOL("awaitData", options, "awaitData");
+ PHONGO_QUERY_OPT_INT64("batchSize", options, "batchSize");
+ PHONGO_QUERY_OPT_DOCUMENT("collation", options, "collation");
+ PHONGO_QUERY_OPT_STRING("comment", options, "comment")
+ else PHONGO_QUERY_OPT_STRING("comment", modifiers, "$comment");
+ PHONGO_QUERY_OPT_BOOL("exhaust", options, "exhaust");
+ PHONGO_QUERY_OPT_DOCUMENT("max", options, "max")
+ else PHONGO_QUERY_OPT_DOCUMENT("max", modifiers, "$max");
+ PHONGO_QUERY_OPT_INT64_DEPRECATED("maxScan", options, "maxScan")
+ else PHONGO_QUERY_OPT_INT64_DEPRECATED("maxScan", modifiers, "$maxScan");
+ PHONGO_QUERY_OPT_INT64("maxTimeMS", options, "maxTimeMS")
+ else PHONGO_QUERY_OPT_INT64("maxTimeMS", modifiers, "$maxTimeMS");
+ PHONGO_QUERY_OPT_DOCUMENT("min", options, "min")
+ else PHONGO_QUERY_OPT_DOCUMENT("min", modifiers, "$min");
+ PHONGO_QUERY_OPT_BOOL("noCursorTimeout", options, "noCursorTimeout");
+ PHONGO_QUERY_OPT_BOOL_DEPRECATED("oplogReplay", options, "oplogReplay");
+ PHONGO_QUERY_OPT_DOCUMENT("projection", options, "projection");
+ PHONGO_QUERY_OPT_BOOL("returnKey", options, "returnKey")
+ else PHONGO_QUERY_OPT_BOOL("returnKey", modifiers, "$returnKey");
+ PHONGO_QUERY_OPT_BOOL("showRecordId", options, "showRecordId")
+ else PHONGO_QUERY_OPT_BOOL("showRecordId", modifiers, "$showDiskLoc");
+ PHONGO_QUERY_OPT_INT64("skip", options, "skip");
+ PHONGO_QUERY_OPT_DOCUMENT("sort", options, "sort")
+ else PHONGO_QUERY_OPT_DOCUMENT("sort", modifiers, "$orderby");
+ PHONGO_QUERY_OPT_BOOL_DEPRECATED("snapshot", options, "snapshot")
+ else PHONGO_QUERY_OPT_BOOL_DEPRECATED("snapshot", modifiers, "$snapshot");
+ PHONGO_QUERY_OPT_BOOL("tailable", options, "tailable");
+
+ /* The "$explain" modifier should be converted to an "explain" option, which
+ * libmongoc will later convert back to a modifier for the OP_QUERY code
+ * path. This modifier will be ignored for the find command code path. */
+ PHONGO_QUERY_OPT_BOOL("explain", modifiers, "$explain");
+
+ if (!php_phongo_query_init_hint(intern, options, modifiers)) {
+ return false;
+ }
+
+ if (!php_phongo_query_init_limit_and_singlebatch(intern, options)) {
+ return false;
+ }
+
+ if (!php_phongo_query_init_readconcern(intern, options)) {
+ return false;
+ }
+
+ if (!php_phongo_query_init_max_await_time_ms(intern, options)) {
+ return false;
+ }
+
+ return true;
+} /* }}} */
+
+#undef PHONGO_QUERY_OPT_BOOL
+#undef PHONGO_QUERY_OPT_DOCUMENT
+#undef PHONGO_QUERY_OPT_INT64
+#undef PHONGO_QUERY_OPT_STRING
+
+/* {{{ proto void MongoDB\Driver\Query::__construct(array|object $filter[, array $options = array()])
+ Constructs a new Query */
+static PHP_METHOD(Query, __construct)
+{
+ zend_error_handling error_handling;
+ php_phongo_query_t* intern;
+ zval* filter;
+ zval* options = NULL;
+
+ intern = Z_QUERY_OBJ_P(getThis());
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "A|a!", &filter, &options) == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ php_phongo_query_init(intern, filter, options);
+} /* }}} */
+
+/* {{{ MongoDB\Driver\Query function entries */
+ZEND_BEGIN_ARG_INFO_EX(ai_Query___construct, 0, 0, 1)
+ ZEND_ARG_INFO(0, filter)
+ ZEND_ARG_ARRAY_INFO(0, options, 1)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(ai_Query_void, 0, 0, 0)
+ZEND_END_ARG_INFO()
+
+static zend_function_entry php_phongo_query_me[] = {
+ /* clang-format off */
+ PHP_ME(Query, __construct, ai_Query___construct, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
+ ZEND_NAMED_ME(__wakeup, PHP_FN(MongoDB_disabled___wakeup), ai_Query_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
+ PHP_FE_END
+ /* clang-format on */
+};
+/* }}} */
+
+/* {{{ MongoDB\Driver\Query object handlers */
+static zend_object_handlers php_phongo_handler_query;
+
+static void php_phongo_query_free_object(zend_object* object) /* {{{ */
+{
+ php_phongo_query_t* intern = Z_OBJ_QUERY(object);
+
+ zend_object_std_dtor(&intern->std);
+
+ if (intern->filter) {
+ bson_clear(&intern->filter);
+ }
+
+ if (intern->opts) {
+ bson_clear(&intern->opts);
+ }
+
+ if (intern->read_concern) {
+ mongoc_read_concern_destroy(intern->read_concern);
+ }
+} /* }}} */
+
+static zend_object* php_phongo_query_create_object(zend_class_entry* class_type) /* {{{ */
+{
+ php_phongo_query_t* intern = NULL;
+
+ intern = PHONGO_ALLOC_OBJECT_T(php_phongo_query_t, class_type);
+
+ zend_object_std_init(&intern->std, class_type);
+ object_properties_init(&intern->std, class_type);
+
+ intern->std.handlers = &php_phongo_handler_query;
+
+ return &intern->std;
+} /* }}} */
+
+static HashTable* php_phongo_query_get_debug_info(phongo_compat_object_handler_type* object, int* is_temp) /* {{{ */
+{
+ php_phongo_query_t* intern;
+ zval retval = ZVAL_STATIC_INIT;
+
+ *is_temp = 1;
+ intern = Z_OBJ_QUERY(PHONGO_COMPAT_GET_OBJ(object));
+
+ array_init_size(&retval, 3);
+
+ /* Avoid using PHONGO_TYPEMAP_NATIVE_ARRAY for decoding filter and opts
+ * documents so that users can differentiate BSON arrays and documents. */
+ if (intern->filter) {
+ zval zv;
+
+ if (!php_phongo_bson_to_zval(bson_get_data(intern->filter), intern->filter->len, &zv)) {
+ zval_ptr_dtor(&zv);
+ goto done;
+ }
+
+ ADD_ASSOC_ZVAL_EX(&retval, "filter", &zv);
+ } else {
+ ADD_ASSOC_NULL_EX(&retval, "filter");
+ }
+
+ if (intern->opts) {
+ zval zv;
+
+ if (!php_phongo_bson_to_zval(bson_get_data(intern->opts), intern->opts->len, &zv)) {
+ zval_ptr_dtor(&zv);
+ goto done;
+ }
+
+ ADD_ASSOC_ZVAL_EX(&retval, "options", &zv);
+ } else {
+ ADD_ASSOC_NULL_EX(&retval, "options");
+ }
+
+ if (intern->read_concern) {
+ zval read_concern;
+
+ php_phongo_read_concern_to_zval(&read_concern, intern->read_concern);
+ ADD_ASSOC_ZVAL_EX(&retval, "readConcern", &read_concern);
+ } else {
+ ADD_ASSOC_NULL_EX(&retval, "readConcern");
+ }
+
+done:
+ return Z_ARRVAL(retval);
+
+} /* }}} */
+/* }}} */
+
+void php_phongo_query_init_ce(INIT_FUNC_ARGS) /* {{{ */
+{
+ zend_class_entry ce;
+
+ INIT_NS_CLASS_ENTRY(ce, "MongoDB\\Driver", "Query", php_phongo_query_me);
+ php_phongo_query_ce = zend_register_internal_class(&ce);
+ php_phongo_query_ce->create_object = php_phongo_query_create_object;
+ PHONGO_CE_FINAL(php_phongo_query_ce);
+ PHONGO_CE_DISABLE_SERIALIZATION(php_phongo_query_ce);
+
+ memcpy(&php_phongo_handler_query, phongo_get_std_object_handlers(), sizeof(zend_object_handlers));
+ php_phongo_handler_query.get_debug_info = php_phongo_query_get_debug_info;
+ php_phongo_handler_query.free_obj = php_phongo_query_free_object;
+ php_phongo_handler_query.offset = XtOffsetOf(php_phongo_query_t, std);
+} /* }}} */
+
+/*
+ * 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.9.0/src/MongoDB/ReadConcern.c b/mongodb-1.9.0/src/MongoDB/ReadConcern.c
new file mode 100644
index 00000000..fe8cafbf
--- /dev/null
+++ b/mongodb-1.9.0/src/MongoDB/ReadConcern.c
@@ -0,0 +1,382 @@
+/*
+ * 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.
+ */
+
+#include <php.h>
+#include <Zend/zend_interfaces.h>
+#include <ext/standard/php_var.h>
+#include <zend_smart_str.h>
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "phongo_compat.h"
+#include "php_phongo.h"
+
+zend_class_entry* php_phongo_readconcern_ce;
+
+/* Initialize the object from a HashTable and return whether it was successful.
+ * An exception will be thrown on error. */
+static bool php_phongo_readconcern_init_from_hash(php_phongo_readconcern_t* intern, HashTable* props) /* {{{ */
+{
+ zval* level;
+
+ intern->read_concern = mongoc_read_concern_new();
+
+ if ((level = zend_hash_str_find(props, "level", sizeof("level") - 1))) {
+ if (Z_TYPE_P(level) == IS_STRING) {
+ mongoc_read_concern_set_level(intern->read_concern, Z_STRVAL_P(level));
+ return true;
+ }
+
+ phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "%s initialization requires \"level\" string field", ZSTR_VAL(php_phongo_readconcern_ce->name));
+ goto failure;
+ }
+
+ return true;
+
+failure:
+ mongoc_read_concern_destroy(intern->read_concern);
+ intern->read_concern = NULL;
+ return false;
+} /* }}} */
+
+/* {{{ proto void MongoDB\Driver\ReadConcern::__construct([string $level])
+ Constructs a new ReadConcern */
+static PHP_METHOD(ReadConcern, __construct)
+{
+ zend_error_handling error_handling;
+ php_phongo_readconcern_t* intern;
+ char* level = NULL;
+ size_t level_len = 0;
+
+ intern = Z_READCONCERN_OBJ_P(getThis());
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "|s!", &level, &level_len) == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ intern->read_concern = mongoc_read_concern_new();
+
+ if (level) {
+ mongoc_read_concern_set_level(intern->read_concern, level);
+ }
+} /* }}} */
+
+/* {{{ proto void MongoDB\BSON\ReadConcern::__set_state(array $properties)
+*/
+static PHP_METHOD(ReadConcern, __set_state)
+{
+ zend_error_handling error_handling;
+ php_phongo_readconcern_t* intern;
+ HashTable* props;
+ zval* array;
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "a", &array) == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ object_init_ex(return_value, php_phongo_readconcern_ce);
+
+ intern = Z_READCONCERN_OBJ_P(return_value);
+ props = Z_ARRVAL_P(array);
+
+ php_phongo_readconcern_init_from_hash(intern, props);
+} /* }}} */
+
+/* {{{ proto string|null MongoDB\Driver\ReadConcern::getLevel()
+ Returns the ReadConcern "level" option */
+static PHP_METHOD(ReadConcern, getLevel)
+{
+ zend_error_handling error_handling;
+ php_phongo_readconcern_t* intern;
+ const char* level;
+
+ intern = Z_READCONCERN_OBJ_P(getThis());
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters_none() == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ level = mongoc_read_concern_get_level(intern->read_concern);
+
+ if (level) {
+ RETURN_STRING(level);
+ }
+
+ RETURN_NULL();
+} /* }}} */
+
+/* {{{ proto boolean MongoDB\Driver\ReadConcern::isDefault()
+ Returns whether the read concern has not been modified (i.e. constructed
+ without a level or from a Manager with no read concern URI options). */
+static PHP_METHOD(ReadConcern, isDefault)
+{
+ zend_error_handling error_handling;
+ php_phongo_readconcern_t* intern;
+
+ intern = Z_READCONCERN_OBJ_P(getThis());
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters_none() == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ RETURN_BOOL(mongoc_read_concern_is_default(intern->read_concern));
+} /* }}} */
+
+static HashTable* php_phongo_read_concern_get_properties_hash(phongo_compat_object_handler_type* object, bool is_debug) /* {{{ */
+{
+ php_phongo_readconcern_t* intern;
+ HashTable* props;
+ const char* level;
+
+ intern = Z_OBJ_READCONCERN(PHONGO_COMPAT_GET_OBJ(object));
+
+ PHONGO_GET_PROPERTY_HASH_INIT_PROPS(is_debug, intern, props, 1);
+
+ if (!intern->read_concern) {
+ return props;
+ }
+
+ level = mongoc_read_concern_get_level(intern->read_concern);
+
+ if (level) {
+ zval z_level;
+
+ ZVAL_STRING(&z_level, level);
+ zend_hash_str_update(props, "level", sizeof("level") - 1, &z_level);
+ }
+
+ return props;
+} /* }}} */
+
+/* {{{ proto array MongoDB\Driver\ReadConcern::bsonSerialize()
+*/
+static PHP_METHOD(ReadConcern, bsonSerialize)
+{
+ zend_error_handling error_handling;
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters_none() == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ ZVAL_ARR(return_value, php_phongo_read_concern_get_properties_hash(PHONGO_COMPAT_OBJ_P(getThis()), true));
+ convert_to_object(return_value);
+} /* }}} */
+
+/* {{{ proto string MongoDB\Driver\ReadConcern::serialize()
+*/
+static PHP_METHOD(ReadConcern, serialize)
+{
+ zend_error_handling error_handling;
+ php_phongo_readconcern_t* intern;
+ zval retval;
+ php_serialize_data_t var_hash;
+ smart_str buf = { 0 };
+ const char* level;
+
+ intern = Z_READCONCERN_OBJ_P(getThis());
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters_none() == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ if (!intern->read_concern) {
+ return;
+ }
+
+ level = mongoc_read_concern_get_level(intern->read_concern);
+
+ if (!level) {
+ RETURN_STRING("");
+ }
+
+ array_init_size(&retval, 1);
+ ADD_ASSOC_STRING(&retval, "level", level);
+
+ PHP_VAR_SERIALIZE_INIT(var_hash);
+ php_var_serialize(&buf, &retval, &var_hash);
+ smart_str_0(&buf);
+ PHP_VAR_SERIALIZE_DESTROY(var_hash);
+
+ PHONGO_RETVAL_SMART_STR(buf);
+
+ smart_str_free(&buf);
+ zval_ptr_dtor(&retval);
+} /* }}} */
+
+/* {{{ proto void MongoDB\Driver\ReadConcern::unserialize(string $serialized)
+*/
+static PHP_METHOD(ReadConcern, unserialize)
+{
+ zend_error_handling error_handling;
+ php_phongo_readconcern_t* intern;
+ char* serialized;
+ size_t serialized_len;
+ zval props;
+ php_unserialize_data_t var_hash;
+
+ intern = Z_READCONCERN_OBJ_P(getThis());
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &serialized, &serialized_len) == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ if (!serialized_len) {
+ return;
+ }
+
+ PHP_VAR_UNSERIALIZE_INIT(var_hash);
+ if (!php_var_unserialize(&props, (const unsigned char**) &serialized, (unsigned char*) serialized + serialized_len, &var_hash)) {
+ zval_ptr_dtor(&props);
+ phongo_throw_exception(PHONGO_ERROR_UNEXPECTED_VALUE, "%s unserialization failed", ZSTR_VAL(php_phongo_readconcern_ce->name));
+
+ PHP_VAR_UNSERIALIZE_DESTROY(var_hash);
+ return;
+ }
+ PHP_VAR_UNSERIALIZE_DESTROY(var_hash);
+
+ php_phongo_readconcern_init_from_hash(intern, HASH_OF(&props));
+ zval_ptr_dtor(&props);
+} /* }}} */
+
+/* {{{ MongoDB\Driver\ReadConcern function entries */
+ZEND_BEGIN_ARG_INFO_EX(ai_ReadConcern___construct, 0, 0, 0)
+ ZEND_ARG_INFO(0, level)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(ai_ReadConcern___set_state, 0, 0, 1)
+ ZEND_ARG_ARRAY_INFO(0, properties, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(ai_ReadConcern_unserialize, 0, 0, 1)
+ ZEND_ARG_INFO(0, serialized)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(ai_ReadConcern_void, 0, 0, 0)
+ZEND_END_ARG_INFO()
+
+static zend_function_entry php_phongo_readconcern_me[] = {
+ /* clang-format off */
+ PHP_ME(ReadConcern, __construct, ai_ReadConcern___construct, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
+ PHP_ME(ReadConcern, __set_state, ai_ReadConcern___set_state, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
+ PHP_ME(ReadConcern, getLevel, ai_ReadConcern_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
+ PHP_ME(ReadConcern, isDefault, ai_ReadConcern_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
+ PHP_ME(ReadConcern, bsonSerialize, ai_ReadConcern_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
+ PHP_ME(ReadConcern, serialize, ai_ReadConcern_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
+ PHP_ME(ReadConcern, unserialize, ai_ReadConcern_unserialize, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
+ PHP_FE_END
+ /* clang-format on */
+};
+/* }}} */
+
+/* {{{ MongoDB\Driver\ReadConcern object handlers */
+static zend_object_handlers php_phongo_handler_readconcern;
+
+static void php_phongo_readconcern_free_object(zend_object* object) /* {{{ */
+{
+ php_phongo_readconcern_t* intern = Z_OBJ_READCONCERN(object);
+
+ zend_object_std_dtor(&intern->std);
+
+ if (intern->properties) {
+ zend_hash_destroy(intern->properties);
+ FREE_HASHTABLE(intern->properties);
+ }
+
+ if (intern->read_concern) {
+ mongoc_read_concern_destroy(intern->read_concern);
+ }
+}
+
+static zend_object* php_phongo_readconcern_create_object(zend_class_entry* class_type) /* {{{ */
+{
+ php_phongo_readconcern_t* intern = NULL;
+
+ intern = PHONGO_ALLOC_OBJECT_T(php_phongo_readconcern_t, class_type);
+
+ zend_object_std_init(&intern->std, class_type);
+ object_properties_init(&intern->std, class_type);
+
+ intern->std.handlers = &php_phongo_handler_readconcern;
+
+ return &intern->std;
+} /* }}} */
+
+static HashTable* php_phongo_readconcern_get_debug_info(phongo_compat_object_handler_type* object, int* is_temp) /* {{{ */
+{
+ *is_temp = 1;
+ return php_phongo_read_concern_get_properties_hash(object, true);
+} /* }}} */
+
+static HashTable* php_phongo_readconcern_get_properties(phongo_compat_object_handler_type* object) /* {{{ */
+{
+ return php_phongo_read_concern_get_properties_hash(object, false);
+} /* }}} */
+
+void php_phongo_readconcern_init_ce(INIT_FUNC_ARGS) /* {{{ */
+{
+ zend_class_entry ce;
+
+ INIT_NS_CLASS_ENTRY(ce, "MongoDB\\Driver", "ReadConcern", php_phongo_readconcern_me);
+ php_phongo_readconcern_ce = zend_register_internal_class(&ce);
+ php_phongo_readconcern_ce->create_object = php_phongo_readconcern_create_object;
+ PHONGO_CE_FINAL(php_phongo_readconcern_ce);
+
+ zend_class_implements(php_phongo_readconcern_ce, 1, php_phongo_serializable_ce);
+ zend_class_implements(php_phongo_readconcern_ce, 1, zend_ce_serializable);
+
+ memcpy(&php_phongo_handler_readconcern, phongo_get_std_object_handlers(), sizeof(zend_object_handlers));
+ php_phongo_handler_readconcern.get_debug_info = php_phongo_readconcern_get_debug_info;
+ php_phongo_handler_readconcern.get_properties = php_phongo_readconcern_get_properties;
+ php_phongo_handler_readconcern.free_obj = php_phongo_readconcern_free_object;
+ php_phongo_handler_readconcern.offset = XtOffsetOf(php_phongo_readconcern_t, std);
+
+ zend_declare_class_constant_stringl(php_phongo_readconcern_ce, ZEND_STRL("LOCAL"), ZEND_STRL(MONGOC_READ_CONCERN_LEVEL_LOCAL));
+ zend_declare_class_constant_stringl(php_phongo_readconcern_ce, ZEND_STRL("MAJORITY"), ZEND_STRL(MONGOC_READ_CONCERN_LEVEL_MAJORITY));
+ zend_declare_class_constant_stringl(php_phongo_readconcern_ce, ZEND_STRL("LINEARIZABLE"), ZEND_STRL(MONGOC_READ_CONCERN_LEVEL_LINEARIZABLE));
+ zend_declare_class_constant_stringl(php_phongo_readconcern_ce, ZEND_STRL("AVAILABLE"), ZEND_STRL(MONGOC_READ_CONCERN_LEVEL_AVAILABLE));
+} /* }}} */
+
+/*
+ * 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.9.0/src/MongoDB/ReadPreference.c b/mongodb-1.9.0/src/MongoDB/ReadPreference.c
new file mode 100644
index 00000000..c23f9c21
--- /dev/null
+++ b/mongodb-1.9.0/src/MongoDB/ReadPreference.c
@@ -0,0 +1,798 @@
+/*
+ * 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.
+ */
+
+#include <php.h>
+#include <Zend/zend_interfaces.h>
+#include <ext/standard/php_var.h>
+#include <zend_smart_str.h>
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "php_array_api.h"
+#include "phongo_compat.h"
+#include "php_phongo.h"
+#include "php_bson.h"
+
+zend_class_entry* php_phongo_readpreference_ce;
+
+#define PHONGO_READ_PRIMARY "primary"
+#define PHONGO_READ_PRIMARY_PREFERRED "primaryPreferred"
+#define PHONGO_READ_SECONDARY "secondary"
+#define PHONGO_READ_SECONDARY_PREFERRED "secondaryPreferred"
+#define PHONGO_READ_NEAREST "nearest"
+
+/* Initialize the object from a HashTable and return whether it was successful.
+ * An exception will be thrown on error. */
+static bool php_phongo_readpreference_init_from_hash(php_phongo_readpreference_t* intern, HashTable* props) /* {{{ */
+{
+ zval *mode, *tagSets, *maxStalenessSeconds, *hedge;
+
+ if ((mode = zend_hash_str_find(props, "mode", sizeof("mode") - 1)) && Z_TYPE_P(mode) == IS_STRING) {
+ if (strcasecmp(Z_STRVAL_P(mode), PHONGO_READ_PRIMARY) == 0) {
+ intern->read_preference = mongoc_read_prefs_new(MONGOC_READ_PRIMARY);
+ } else if (strcasecmp(Z_STRVAL_P(mode), PHONGO_READ_PRIMARY_PREFERRED) == 0) {
+ intern->read_preference = mongoc_read_prefs_new(MONGOC_READ_PRIMARY_PREFERRED);
+ } else if (strcasecmp(Z_STRVAL_P(mode), PHONGO_READ_SECONDARY) == 0) {
+ intern->read_preference = mongoc_read_prefs_new(MONGOC_READ_SECONDARY);
+ } else if (strcasecmp(Z_STRVAL_P(mode), PHONGO_READ_SECONDARY_PREFERRED) == 0) {
+ intern->read_preference = mongoc_read_prefs_new(MONGOC_READ_SECONDARY_PREFERRED);
+ } else if (strcasecmp(Z_STRVAL_P(mode), PHONGO_READ_NEAREST) == 0) {
+ intern->read_preference = mongoc_read_prefs_new(MONGOC_READ_NEAREST);
+ } else {
+ phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "%s initialization requires specific values for \"mode\" string field", ZSTR_VAL(php_phongo_readpreference_ce->name));
+ return false;
+ }
+ } else {
+ phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "%s initialization requires \"mode\" field to be string", ZSTR_VAL(php_phongo_readpreference_ce->name));
+ return false;
+ }
+
+ if ((tagSets = zend_hash_str_find(props, "tags", sizeof("tags") - 1))) {
+ ZVAL_DEREF(tagSets);
+ if (Z_TYPE_P(tagSets) == IS_ARRAY) {
+ bson_t* tags = bson_new();
+
+ /* Separate tagSets as php_phongo_read_preference_prep_tagsets may
+ * modify these tags. */
+ SEPARATE_ZVAL_NOREF(tagSets);
+
+ php_phongo_read_preference_prep_tagsets(tagSets);
+ php_phongo_zval_to_bson(tagSets, PHONGO_BSON_NONE, (bson_t*) tags, NULL);
+
+ if (!php_phongo_read_preference_tags_are_valid(tags)) {
+ phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "%s initialization requires \"tags\" array field to have zero or more documents", ZSTR_VAL(php_phongo_readpreference_ce->name));
+ bson_destroy(tags);
+ goto failure;
+ }
+
+ if (!bson_empty(tags) && (mongoc_read_prefs_get_mode(intern->read_preference) == MONGOC_READ_PRIMARY)) {
+ phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "%s initialization requires \"tags\" array field to not be present with \"primary\" mode", ZSTR_VAL(php_phongo_readpreference_ce->name));
+ bson_destroy(tags);
+ goto failure;
+ }
+
+ mongoc_read_prefs_set_tags(intern->read_preference, tags);
+ bson_destroy(tags);
+ } else {
+ phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "%s initialization requires \"tags\" field to be array", ZSTR_VAL(php_phongo_readpreference_ce->name));
+ goto failure;
+ }
+ }
+
+ if ((maxStalenessSeconds = zend_hash_str_find(props, "maxStalenessSeconds", sizeof("maxStalenessSeconds") - 1))) {
+ if (Z_TYPE_P(maxStalenessSeconds) == IS_LONG) {
+ if (Z_LVAL_P(maxStalenessSeconds) != MONGOC_NO_MAX_STALENESS) {
+ if (mongoc_read_prefs_get_mode(intern->read_preference) == MONGOC_READ_PRIMARY) {
+ phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "%s initialization requires \"maxStalenessSeconds\" field to not be present with \"primary\" mode", ZSTR_VAL(php_phongo_readpreference_ce->name));
+ goto failure;
+ }
+ if (Z_LVAL_P(maxStalenessSeconds) < MONGOC_SMALLEST_MAX_STALENESS_SECONDS) {
+ phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "%s initialization requires \"maxStalenessSeconds\" integer field to be >= %d", ZSTR_VAL(php_phongo_readpreference_ce->name), MONGOC_SMALLEST_MAX_STALENESS_SECONDS);
+ goto failure;
+ }
+ if (Z_LVAL_P(maxStalenessSeconds) > INT32_MAX) {
+ phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "%s initialization requires \"maxStalenessSeconds\" integer field to be <= %" PRId32, ZSTR_VAL(php_phongo_readpreference_ce->name), INT32_MAX);
+ goto failure;
+ }
+ }
+
+ mongoc_read_prefs_set_max_staleness_seconds(intern->read_preference, Z_LVAL_P(maxStalenessSeconds));
+ } else {
+ phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "%s initialization requires \"maxStalenessSeconds\" field to be integer", ZSTR_VAL(php_phongo_readpreference_ce->name));
+ goto failure;
+ }
+ }
+
+ if ((hedge = zend_hash_str_find(props, "hedge", sizeof("hedge") - 1))) {
+ if (Z_TYPE_P(hedge) == IS_ARRAY || Z_TYPE_P(hedge) == IS_OBJECT) {
+ bson_t* hedge_doc = bson_new();
+
+ if (mongoc_read_prefs_get_mode(intern->read_preference) == MONGOC_READ_PRIMARY) {
+ phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "%s initialization requires \"hedge\" field to not be present with \"primary\" mode", ZSTR_VAL(php_phongo_readpreference_ce->name));
+ bson_destroy(hedge_doc);
+ goto failure;
+ }
+
+ php_phongo_zval_to_bson(hedge, PHONGO_BSON_NONE, hedge_doc, NULL);
+
+ if (EG(exception)) {
+ bson_destroy(hedge_doc);
+ goto failure;
+ }
+
+ mongoc_read_prefs_set_hedge(intern->read_preference, hedge_doc);
+ bson_destroy(hedge_doc);
+ } else {
+ phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "%s initialization requires \"hedge\" field to be an array or object", ZSTR_VAL(php_phongo_readpreference_ce->name));
+ goto failure;
+ }
+ }
+
+ if (!mongoc_read_prefs_is_valid(intern->read_preference)) {
+ phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Read preference is not valid");
+ goto failure;
+ }
+
+ return true;
+
+failure:
+ mongoc_read_prefs_destroy(intern->read_preference);
+ intern->read_preference = NULL;
+ return false;
+} /* }}} */
+
+static const char* php_phongo_readpreference_get_mode_string(mongoc_read_mode_t mode) /* {{{ */
+{
+ switch (mode) {
+ case MONGOC_READ_PRIMARY:
+ return PHONGO_READ_PRIMARY;
+ case MONGOC_READ_PRIMARY_PREFERRED:
+ return PHONGO_READ_PRIMARY_PREFERRED;
+ case MONGOC_READ_SECONDARY:
+ return PHONGO_READ_SECONDARY;
+ case MONGOC_READ_SECONDARY_PREFERRED:
+ return PHONGO_READ_SECONDARY_PREFERRED;
+ case MONGOC_READ_NEAREST:
+ return PHONGO_READ_NEAREST;
+ default:
+ /* Should never happen, but if it does: exception */
+ phongo_throw_exception(PHONGO_ERROR_LOGIC, "Mode '%d' should never have been passed to php_phongo_readpreference_get_mode_string, please file a bug report", mode);
+ break;
+ }
+
+ return NULL;
+} /* }}} */
+
+/* {{{ proto void MongoDB\Driver\ReadPreference::__construct(int|string $mode[, array $tagSets = array()[, array $options = array()]])
+ Constructs a new ReadPreference */
+static PHP_METHOD(ReadPreference, __construct)
+{
+ zend_error_handling error_handling;
+ php_phongo_readpreference_t* intern;
+ zval* mode;
+ zval* tagSets = NULL;
+ zval* options = NULL;
+
+ intern = Z_READPREFERENCE_OBJ_P(getThis());
+
+ /* Separate the tagSets zval, since we may end up modifying it in
+ * php_phongo_read_preference_prep_tagsets() below. */
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "z|a/!a!", &mode, &tagSets, &options) == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ if (Z_TYPE_P(mode) == IS_LONG) {
+ switch (Z_LVAL_P(mode)) {
+ case MONGOC_READ_PRIMARY:
+ case MONGOC_READ_SECONDARY:
+ case MONGOC_READ_PRIMARY_PREFERRED:
+ case MONGOC_READ_SECONDARY_PREFERRED:
+ case MONGOC_READ_NEAREST:
+ intern->read_preference = mongoc_read_prefs_new(Z_LVAL_P(mode));
+ break;
+ default:
+ phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Invalid mode: %" PHONGO_LONG_FORMAT, Z_LVAL_P(mode));
+ return;
+ }
+ } else if (Z_TYPE_P(mode) == IS_STRING) {
+ if (strcasecmp(Z_STRVAL_P(mode), PHONGO_READ_PRIMARY) == 0) {
+ intern->read_preference = mongoc_read_prefs_new(MONGOC_READ_PRIMARY);
+ } else if (strcasecmp(Z_STRVAL_P(mode), PHONGO_READ_PRIMARY_PREFERRED) == 0) {
+ intern->read_preference = mongoc_read_prefs_new(MONGOC_READ_PRIMARY_PREFERRED);
+ } else if (strcasecmp(Z_STRVAL_P(mode), PHONGO_READ_SECONDARY) == 0) {
+ intern->read_preference = mongoc_read_prefs_new(MONGOC_READ_SECONDARY);
+ } else if (strcasecmp(Z_STRVAL_P(mode), PHONGO_READ_SECONDARY_PREFERRED) == 0) {
+ intern->read_preference = mongoc_read_prefs_new(MONGOC_READ_SECONDARY_PREFERRED);
+ } else if (strcasecmp(Z_STRVAL_P(mode), PHONGO_READ_NEAREST) == 0) {
+ intern->read_preference = mongoc_read_prefs_new(MONGOC_READ_NEAREST);
+ } else {
+ phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Invalid mode: '%s'", Z_STRVAL_P(mode));
+ return;
+ }
+ } else {
+ phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Expected mode to be integer or string, %s given", PHONGO_ZVAL_CLASS_OR_TYPE_NAME_P(mode));
+ return;
+ }
+
+ if (tagSets) {
+ bson_t* tags = bson_new();
+
+ php_phongo_read_preference_prep_tagsets(tagSets);
+ php_phongo_zval_to_bson(tagSets, PHONGO_BSON_NONE, (bson_t*) tags, NULL);
+
+ if (!php_phongo_read_preference_tags_are_valid(tags)) {
+ phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "tagSets must be an array of zero or more documents");
+ bson_destroy(tags);
+ return;
+ }
+
+ if (!bson_empty(tags) && (mongoc_read_prefs_get_mode(intern->read_preference) == MONGOC_READ_PRIMARY)) {
+ phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "tagSets may not be used with primary mode");
+ bson_destroy(tags);
+ return;
+ }
+
+ mongoc_read_prefs_set_tags(intern->read_preference, tags);
+ bson_destroy(tags);
+ }
+
+ if (options && php_array_exists(options, "maxStalenessSeconds")) {
+ zend_long maxStalenessSeconds = php_array_fetchc_long(options, "maxStalenessSeconds");
+
+ if (maxStalenessSeconds != MONGOC_NO_MAX_STALENESS) {
+ if (maxStalenessSeconds < MONGOC_SMALLEST_MAX_STALENESS_SECONDS) {
+ phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Expected maxStalenessSeconds to be >= %d, %" PHONGO_LONG_FORMAT " given", MONGOC_SMALLEST_MAX_STALENESS_SECONDS, maxStalenessSeconds);
+ return;
+ }
+ if (maxStalenessSeconds > INT32_MAX) {
+ phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Expected maxStalenessSeconds to be <= %" PRId32 ", %" PHONGO_LONG_FORMAT " given", INT32_MAX, maxStalenessSeconds);
+ return;
+ }
+ if (mongoc_read_prefs_get_mode(intern->read_preference) == MONGOC_READ_PRIMARY) {
+ phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "maxStalenessSeconds may not be used with primary mode");
+ return;
+ }
+ }
+
+ mongoc_read_prefs_set_max_staleness_seconds(intern->read_preference, maxStalenessSeconds);
+ }
+
+ if (options && php_array_exists(options, "hedge")) {
+ zval* hedge = php_array_fetchc(options, "hedge");
+
+ if (Z_TYPE_P(hedge) == IS_ARRAY || Z_TYPE_P(hedge) == IS_OBJECT) {
+ bson_t* hedge_doc = bson_new();
+
+ if (mongoc_read_prefs_get_mode(intern->read_preference) == MONGOC_READ_PRIMARY) {
+ phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "hedge may not be used with primary mode");
+ bson_destroy(hedge_doc);
+ return;
+ }
+
+ php_phongo_zval_to_bson(hedge, PHONGO_BSON_NONE, hedge_doc, NULL);
+
+ if (EG(exception)) {
+ bson_destroy(hedge_doc);
+ return;
+ }
+
+ mongoc_read_prefs_set_hedge(intern->read_preference, hedge_doc);
+ bson_destroy(hedge_doc);
+ } else {
+ phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "%s initialization requires \"hedge\" field to be an array or object", ZSTR_VAL(php_phongo_readpreference_ce->name));
+ return;
+ }
+ }
+
+ if (!mongoc_read_prefs_is_valid(intern->read_preference)) {
+ phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Read preference is not valid");
+ return;
+ }
+} /* }}} */
+
+/* {{{ proto void MongoDB\BSON\ReadPreference::__set_state(array $properties)
+*/
+static PHP_METHOD(ReadPreference, __set_state)
+{
+ zend_error_handling error_handling;
+ php_phongo_readpreference_t* intern;
+ HashTable* props;
+ zval* array;
+
+ /* Separate the zval, since we may end up modifying the "tags" element in
+ * php_phongo_read_preference_prep_tagsets(), which is called from
+ * php_phongo_readpreference_init_from_hash. */
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "a/", &array) == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ object_init_ex(return_value, php_phongo_readpreference_ce);
+
+ intern = Z_READPREFERENCE_OBJ_P(return_value);
+ props = Z_ARRVAL_P(array);
+
+ php_phongo_readpreference_init_from_hash(intern, props);
+} /* }}} */
+
+/* {{{ proto array|null MongoDB\Driver\ReadPreference::getHedge()
+ Returns the ReadPreference hedge document */
+static PHP_METHOD(ReadPreference, getHedge)
+{
+ zend_error_handling error_handling;
+ php_phongo_readpreference_t* intern;
+ const bson_t* hedge;
+
+ intern = Z_READPREFERENCE_OBJ_P(getThis());
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters_none() == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ hedge = mongoc_read_prefs_get_hedge(intern->read_preference);
+
+ if (!bson_empty0(hedge)) {
+ php_phongo_bson_state state;
+
+ PHONGO_BSON_INIT_STATE(state);
+
+ if (!php_phongo_bson_to_zval_ex(bson_get_data(hedge), hedge->len, &state)) {
+ zval_ptr_dtor(&state.zchild);
+ return;
+ }
+
+ RETURN_ZVAL(&state.zchild, 0, 1);
+ } else {
+ RETURN_NULL();
+ }
+} /* }}} */
+
+/* {{{ proto integer MongoDB\Driver\ReadPreference::getMaxStalenessSeconds()
+ Returns the ReadPreference maxStalenessSeconds value */
+static PHP_METHOD(ReadPreference, getMaxStalenessSeconds)
+{
+ zend_error_handling error_handling;
+ php_phongo_readpreference_t* intern;
+
+ intern = Z_READPREFERENCE_OBJ_P(getThis());
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters_none() == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ RETURN_LONG(mongoc_read_prefs_get_max_staleness_seconds(intern->read_preference));
+} /* }}} */
+
+/* {{{ proto integer MongoDB\Driver\ReadPreference::getMode()
+ Returns the ReadPreference mode */
+static PHP_METHOD(ReadPreference, getMode)
+{
+ zend_error_handling error_handling;
+ php_phongo_readpreference_t* intern;
+
+ intern = Z_READPREFERENCE_OBJ_P(getThis());
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters_none() == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ RETURN_LONG(mongoc_read_prefs_get_mode(intern->read_preference));
+} /* }}} */
+
+/* {{{ proto string MongoDB\Driver\ReadPreference::getModeString()
+ Returns the ReadPreference mode as string */
+static PHP_METHOD(ReadPreference, getModeString)
+{
+ zend_error_handling error_handling;
+ php_phongo_readpreference_t* intern;
+ const char* mode_string;
+
+ intern = Z_READPREFERENCE_OBJ_P(getThis());
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters_none() == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ mode_string = php_phongo_readpreference_get_mode_string(mongoc_read_prefs_get_mode(intern->read_preference));
+ if (!mode_string) {
+ /* Exception already thrown */
+ return;
+ }
+
+ RETURN_STRING(mode_string);
+} /* }}} */
+
+/* {{{ proto array MongoDB\Driver\ReadPreference::getTagSets()
+ Returns the ReadPreference tag sets */
+static PHP_METHOD(ReadPreference, getTagSets)
+{
+ zend_error_handling error_handling;
+ php_phongo_readpreference_t* intern;
+ const bson_t* tags;
+
+ intern = Z_READPREFERENCE_OBJ_P(getThis());
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters_none() == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ tags = mongoc_read_prefs_get_tags(intern->read_preference);
+
+ if (tags->len) {
+ php_phongo_bson_state state;
+
+ PHONGO_BSON_INIT_DEBUG_STATE(state);
+
+ if (!php_phongo_bson_to_zval_ex(bson_get_data(tags), tags->len, &state)) {
+ zval_ptr_dtor(&state.zchild);
+ return;
+ }
+
+ RETURN_ZVAL(&state.zchild, 0, 1);
+ } else {
+ RETURN_NULL();
+ }
+} /* }}} */
+
+static HashTable* php_phongo_readpreference_get_properties_hash(phongo_compat_object_handler_type* object, bool is_debug) /* {{{ */
+{
+ php_phongo_readpreference_t* intern;
+ HashTable* props;
+ const char* modeString = NULL;
+ const bson_t* tags;
+ const bson_t* hedge;
+ mongoc_read_mode_t mode;
+
+ intern = Z_OBJ_READPREFERENCE(PHONGO_COMPAT_GET_OBJ(object));
+
+ PHONGO_GET_PROPERTY_HASH_INIT_PROPS(is_debug, intern, props, 4);
+
+ if (!intern->read_preference) {
+ return props;
+ }
+
+ tags = mongoc_read_prefs_get_tags(intern->read_preference);
+ mode = mongoc_read_prefs_get_mode(intern->read_preference);
+ modeString = php_phongo_readpreference_get_mode_string(mode);
+ hedge = mongoc_read_prefs_get_hedge(intern->read_preference);
+
+ if (modeString) {
+ zval z_mode;
+
+ ZVAL_STRING(&z_mode, modeString);
+ zend_hash_str_update(props, "mode", sizeof("mode") - 1, &z_mode);
+ }
+
+ if (!bson_empty0(tags)) {
+ php_phongo_bson_state state;
+
+ /* Use PHONGO_TYPEMAP_NATIVE_ARRAY for the root type since tags is an
+ * array; however, inner documents and arrays can use the default. */
+ PHONGO_BSON_INIT_STATE(state);
+ state.map.root_type = PHONGO_TYPEMAP_NATIVE_ARRAY;
+
+ if (!php_phongo_bson_to_zval_ex(bson_get_data(tags), tags->len, &state)) {
+ zval_ptr_dtor(&state.zchild);
+ goto done;
+ }
+
+ zend_hash_str_update(props, "tags", sizeof("tags") - 1, &state.zchild);
+ }
+
+ if (mongoc_read_prefs_get_max_staleness_seconds(intern->read_preference) != MONGOC_NO_MAX_STALENESS) {
+ long maxStalenessSeconds = mongoc_read_prefs_get_max_staleness_seconds(intern->read_preference);
+ zval z_max_ss;
+
+ ZVAL_LONG(&z_max_ss, maxStalenessSeconds);
+ zend_hash_str_update(props, "maxStalenessSeconds", sizeof("maxStalenessSeconds") - 1, &z_max_ss);
+ }
+
+ if (!bson_empty0(hedge)) {
+ php_phongo_bson_state state;
+
+ PHONGO_BSON_INIT_STATE(state);
+
+ if (!php_phongo_bson_to_zval_ex(bson_get_data(hedge), hedge->len, &state)) {
+ zval_ptr_dtor(&state.zchild);
+ goto done;
+ }
+
+ zend_hash_str_update(props, "hedge", sizeof("hedge") - 1, &state.zchild);
+ }
+
+done:
+ return props;
+} /* }}} */
+
+/* {{{ proto array MongoDB\Driver\ReadPreference::bsonSerialize()
+*/
+static PHP_METHOD(ReadPreference, bsonSerialize)
+{
+ zend_error_handling error_handling;
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters_none() == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ ZVAL_ARR(return_value, php_phongo_readpreference_get_properties_hash(PHONGO_COMPAT_OBJ_P(getThis()), true));
+ convert_to_object(return_value);
+} /* }}} */
+
+/* {{{ proto string MongoDB\Driver\ReadPreference::serialize()
+*/
+static PHP_METHOD(ReadPreference, serialize)
+{
+ zend_error_handling error_handling;
+ php_phongo_readpreference_t* intern;
+ zval retval;
+ php_serialize_data_t var_hash;
+ smart_str buf = { 0 };
+ const char* modeString = NULL;
+ const bson_t* tags;
+ const bson_t* hedge;
+ int64_t maxStalenessSeconds;
+ mongoc_read_mode_t mode;
+
+ intern = Z_READPREFERENCE_OBJ_P(getThis());
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters_none() == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ if (!intern->read_preference) {
+ return;
+ }
+
+ tags = mongoc_read_prefs_get_tags(intern->read_preference);
+ mode = mongoc_read_prefs_get_mode(intern->read_preference);
+ modeString = php_phongo_readpreference_get_mode_string(mode);
+ maxStalenessSeconds = mongoc_read_prefs_get_max_staleness_seconds(intern->read_preference);
+ hedge = mongoc_read_prefs_get_hedge(intern->read_preference);
+
+ array_init_size(&retval, 4);
+
+ if (modeString) {
+ ADD_ASSOC_STRING(&retval, "mode", modeString);
+ }
+
+ if (!bson_empty0(tags)) {
+ php_phongo_bson_state state;
+
+ PHONGO_BSON_INIT_DEBUG_STATE(state);
+
+ if (!php_phongo_bson_to_zval_ex(bson_get_data(tags), tags->len, &state)) {
+ zval_ptr_dtor(&state.zchild);
+ return;
+ }
+
+ ADD_ASSOC_ZVAL_EX(&retval, "tags", &state.zchild);
+ }
+
+ if (maxStalenessSeconds != MONGOC_NO_MAX_STALENESS) {
+ ADD_ASSOC_LONG_EX(&retval, "maxStalenessSeconds", maxStalenessSeconds);
+ }
+
+ if (!bson_empty0(hedge)) {
+ php_phongo_bson_state state;
+
+ PHONGO_BSON_INIT_STATE(state);
+
+ if (!php_phongo_bson_to_zval_ex(bson_get_data(hedge), hedge->len, &state)) {
+ zval_ptr_dtor(&state.zchild);
+ return;
+ }
+
+ ADD_ASSOC_ZVAL_EX(&retval, "hedge", &state.zchild);
+ }
+
+ PHP_VAR_SERIALIZE_INIT(var_hash);
+ php_var_serialize(&buf, &retval, &var_hash);
+ smart_str_0(&buf);
+ PHP_VAR_SERIALIZE_DESTROY(var_hash);
+
+ PHONGO_RETVAL_SMART_STR(buf);
+
+ smart_str_free(&buf);
+ zval_ptr_dtor(&retval);
+} /* }}} */
+
+/* {{{ proto void MongoDB\Driver\ReadPreference::unserialize(string $serialized)
+*/
+static PHP_METHOD(ReadPreference, unserialize)
+{
+ zend_error_handling error_handling;
+ php_phongo_readpreference_t* intern;
+ char* serialized;
+ size_t serialized_len;
+ zval props;
+ php_unserialize_data_t var_hash;
+
+ intern = Z_READPREFERENCE_OBJ_P(getThis());
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &serialized, &serialized_len) == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ if (!serialized_len) {
+ return;
+ }
+
+ PHP_VAR_UNSERIALIZE_INIT(var_hash);
+ if (!php_var_unserialize(&props, (const unsigned char**) &serialized, (unsigned char*) serialized + serialized_len, &var_hash)) {
+ zval_ptr_dtor(&props);
+ phongo_throw_exception(PHONGO_ERROR_UNEXPECTED_VALUE, "%s unserialization failed", ZSTR_VAL(php_phongo_readpreference_ce->name));
+
+ PHP_VAR_UNSERIALIZE_DESTROY(var_hash);
+ return;
+ }
+ PHP_VAR_UNSERIALIZE_DESTROY(var_hash);
+
+ php_phongo_readpreference_init_from_hash(intern, HASH_OF(&props));
+ zval_ptr_dtor(&props);
+} /* }}} */
+
+/* {{{ MongoDB\Driver\ReadPreference function entries */
+ZEND_BEGIN_ARG_INFO_EX(ai_ReadPreference___construct, 0, 0, 1)
+ ZEND_ARG_INFO(0, mode)
+ ZEND_ARG_ARRAY_INFO(0, tagSets, 1)
+ ZEND_ARG_ARRAY_INFO(0, options, 1)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(ai_ReadPreference___set_state, 0, 0, 1)
+ ZEND_ARG_ARRAY_INFO(0, properties, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(ai_ReadPreference_unserialize, 0, 0, 1)
+ ZEND_ARG_INFO(0, serialized)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(ai_ReadPreference_void, 0, 0, 0)
+ZEND_END_ARG_INFO()
+
+static zend_function_entry php_phongo_readpreference_me[] = {
+ /* clang-format off */
+ PHP_ME(ReadPreference, __construct, ai_ReadPreference___construct, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
+ PHP_ME(ReadPreference, __set_state, ai_ReadPreference___set_state, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
+ PHP_ME(ReadPreference, getHedge, ai_ReadPreference_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
+ PHP_ME(ReadPreference, getMaxStalenessSeconds, ai_ReadPreference_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
+ PHP_ME(ReadPreference, getMode, ai_ReadPreference_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
+ PHP_ME(ReadPreference, getModeString, ai_ReadPreference_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
+ PHP_ME(ReadPreference, getTagSets, ai_ReadPreference_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
+ PHP_ME(ReadPreference, bsonSerialize, ai_ReadPreference_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
+ PHP_ME(ReadPreference, serialize, ai_ReadPreference_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
+ PHP_ME(ReadPreference, unserialize, ai_ReadPreference_unserialize, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
+ PHP_FE_END
+ /* clang-format on */
+};
+/* }}} */
+
+/* {{{ MongoDB\Driver\ReadPreference object handlers */
+static zend_object_handlers php_phongo_handler_readpreference;
+
+static void php_phongo_readpreference_free_object(zend_object* object) /* {{{ */
+{
+ php_phongo_readpreference_t* intern = Z_OBJ_READPREFERENCE(object);
+
+ zend_object_std_dtor(&intern->std);
+
+ if (intern->properties) {
+ zend_hash_destroy(intern->properties);
+ FREE_HASHTABLE(intern->properties);
+ }
+
+ if (intern->read_preference) {
+ mongoc_read_prefs_destroy(intern->read_preference);
+ }
+} /* }}} */
+
+static zend_object* php_phongo_readpreference_create_object(zend_class_entry* class_type) /* {{{ */
+{
+ php_phongo_readpreference_t* intern = NULL;
+
+ intern = PHONGO_ALLOC_OBJECT_T(php_phongo_readpreference_t, class_type);
+
+ zend_object_std_init(&intern->std, class_type);
+ object_properties_init(&intern->std, class_type);
+
+ intern->std.handlers = &php_phongo_handler_readpreference;
+
+ return &intern->std;
+} /* }}} */
+
+static HashTable* php_phongo_readpreference_get_debug_info(phongo_compat_object_handler_type* object, int* is_temp) /* {{{ */
+{
+ *is_temp = 1;
+ return php_phongo_readpreference_get_properties_hash(object, true);
+} /* }}} */
+
+static HashTable* php_phongo_readpreference_get_properties(phongo_compat_object_handler_type* object) /* {{{ */
+{
+ return php_phongo_readpreference_get_properties_hash(object, false);
+} /* }}} */
+/* }}} */
+
+void php_phongo_readpreference_init_ce(INIT_FUNC_ARGS) /* {{{ */
+{
+ zend_class_entry ce;
+
+ INIT_NS_CLASS_ENTRY(ce, "MongoDB\\Driver", "ReadPreference", php_phongo_readpreference_me);
+ php_phongo_readpreference_ce = zend_register_internal_class(&ce);
+ php_phongo_readpreference_ce->create_object = php_phongo_readpreference_create_object;
+ PHONGO_CE_FINAL(php_phongo_readpreference_ce);
+
+ zend_class_implements(php_phongo_readpreference_ce, 1, php_phongo_serializable_ce);
+ zend_class_implements(php_phongo_readpreference_ce, 1, zend_ce_serializable);
+
+ memcpy(&php_phongo_handler_readpreference, phongo_get_std_object_handlers(), sizeof(zend_object_handlers));
+ php_phongo_handler_readpreference.get_debug_info = php_phongo_readpreference_get_debug_info;
+ php_phongo_handler_readpreference.get_properties = php_phongo_readpreference_get_properties;
+ php_phongo_handler_readpreference.free_obj = php_phongo_readpreference_free_object;
+ php_phongo_handler_readpreference.offset = XtOffsetOf(php_phongo_readpreference_t, std);
+
+ zend_declare_class_constant_long(php_phongo_readpreference_ce, ZEND_STRL("RP_PRIMARY"), MONGOC_READ_PRIMARY);
+ zend_declare_class_constant_long(php_phongo_readpreference_ce, ZEND_STRL("RP_PRIMARY_PREFERRED"), MONGOC_READ_PRIMARY_PREFERRED);
+ zend_declare_class_constant_long(php_phongo_readpreference_ce, ZEND_STRL("RP_SECONDARY"), MONGOC_READ_SECONDARY);
+ zend_declare_class_constant_long(php_phongo_readpreference_ce, ZEND_STRL("RP_SECONDARY_PREFERRED"), MONGOC_READ_SECONDARY_PREFERRED);
+ zend_declare_class_constant_long(php_phongo_readpreference_ce, ZEND_STRL("RP_NEAREST"), MONGOC_READ_NEAREST);
+ zend_declare_class_constant_long(php_phongo_readpreference_ce, ZEND_STRL("NO_MAX_STALENESS"), MONGOC_NO_MAX_STALENESS);
+ zend_declare_class_constant_long(php_phongo_readpreference_ce, ZEND_STRL("SMALLEST_MAX_STALENESS_SECONDS"), MONGOC_SMALLEST_MAX_STALENESS_SECONDS);
+
+ zend_declare_class_constant_string(php_phongo_readpreference_ce, ZEND_STRL("PRIMARY"), PHONGO_READ_PRIMARY);
+ zend_declare_class_constant_string(php_phongo_readpreference_ce, ZEND_STRL("PRIMARY_PREFERRED"), PHONGO_READ_PRIMARY_PREFERRED);
+ zend_declare_class_constant_string(php_phongo_readpreference_ce, ZEND_STRL("SECONDARY"), PHONGO_READ_SECONDARY);
+ zend_declare_class_constant_string(php_phongo_readpreference_ce, ZEND_STRL("SECONDARY_PREFERRED"), PHONGO_READ_SECONDARY_PREFERRED);
+ zend_declare_class_constant_string(php_phongo_readpreference_ce, ZEND_STRL("NEAREST"), PHONGO_READ_NEAREST);
+} /* }}} */
+
+/*
+ * 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.9.0/src/MongoDB/Server.c b/mongodb-1.9.0/src/MongoDB/Server.c
new file mode 100644
index 00000000..76714e69
--- /dev/null
+++ b/mongodb-1.9.0/src/MongoDB/Server.c
@@ -0,0 +1,714 @@
+/*
+ * 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.
+ */
+
+#include <php.h>
+#include <Zend/zend_interfaces.h>
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "phongo_compat.h"
+#include "php_phongo.h"
+#include "php_bson.h"
+
+zend_class_entry* php_phongo_server_ce;
+
+/* {{{ proto MongoDB\Driver\Cursor MongoDB\Driver\Server::executeCommand(string $db, MongoDB\Driver\Command $command[, array $options = null]))
+ Executes a Command on this Server */
+static PHP_METHOD(Server, executeCommand)
+{
+ zend_error_handling error_handling;
+ php_phongo_server_t* intern;
+ char* db;
+ size_t db_len;
+ zval* command;
+ zval* options = NULL;
+ bool free_options = false;
+
+ intern = Z_SERVER_OBJ_P(getThis());
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "sO|z!", &db, &db_len, &command, php_phongo_command_ce, &options) == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ options = php_phongo_prep_legacy_option(options, "readPreference", &free_options);
+
+ /* If the Server was created in a different process, reset the client so
+ * that cursors created by this process can be differentiated and its
+ * session pool is cleared. */
+ PHONGO_RESET_CLIENT_IF_PID_DIFFERS(intern);
+
+ phongo_execute_command(intern->client, PHONGO_COMMAND_RAW, db, command, options, intern->server_id, return_value);
+
+ if (free_options) {
+ php_phongo_prep_legacy_option_free(options);
+ }
+} /* }}} */
+
+/* {{{ proto MongoDB\Driver\Cursor MongoDB\Driver\Server::executeReadCommand(string $db, MongoDB\Driver\Command $command[, array $options = null]))
+ Executes a ReadCommand on this Server */
+static PHP_METHOD(Server, executeReadCommand)
+{
+ zend_error_handling error_handling;
+ php_phongo_server_t* intern;
+ char* db;
+ size_t db_len;
+ zval* command;
+ zval* options = NULL;
+
+ intern = Z_SERVER_OBJ_P(getThis());
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "sO|a!", &db, &db_len, &command, php_phongo_command_ce, &options) == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ /* If the Server was created in a different process, reset the client so
+ * that cursors created by this process can be differentiated and its
+ * session pool is cleared. */
+ PHONGO_RESET_CLIENT_IF_PID_DIFFERS(intern);
+
+ phongo_execute_command(intern->client, PHONGO_COMMAND_READ, db, command, options, intern->server_id, return_value);
+} /* }}} */
+
+/* {{{ proto MongoDB\Driver\Cursor MongoDB\Driver\Server::executeWriteCommand(string $db, MongoDB\Driver\Command $command[, array $options = null]))
+ Executes a WriteCommand on this Server */
+static PHP_METHOD(Server, executeWriteCommand)
+{
+ zend_error_handling error_handling;
+ php_phongo_server_t* intern;
+ char* db;
+ size_t db_len;
+ zval* command;
+ zval* options = NULL;
+
+ intern = Z_SERVER_OBJ_P(getThis());
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "sO|a!", &db, &db_len, &command, php_phongo_command_ce, &options) == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ /* If the Server was created in a different process, reset the client so
+ * that cursors created by this process can be differentiated. and its
+ * session pool is cleared. */
+ PHONGO_RESET_CLIENT_IF_PID_DIFFERS(intern);
+
+ phongo_execute_command(intern->client, PHONGO_COMMAND_WRITE, db, command, options, intern->server_id, return_value);
+} /* }}} */
+
+/* {{{ proto MongoDB\Driver\Cursor MongoDB\Driver\Server::executeReadWriteCommand(string $db, MongoDB\Driver\Command $command[, array $options = null]))
+ Executes a ReadWriteCommand on this Server */
+static PHP_METHOD(Server, executeReadWriteCommand)
+{
+ zend_error_handling error_handling;
+ php_phongo_server_t* intern;
+ char* db;
+ size_t db_len;
+ zval* command;
+ zval* options = NULL;
+
+ intern = Z_SERVER_OBJ_P(getThis());
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "sO|a!", &db, &db_len, &command, php_phongo_command_ce, &options) == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ /* If the Server was created in a different process, reset the client so
+ * that cursors created by this process can be differentiated and its
+ * session pool is cleared. */
+ PHONGO_RESET_CLIENT_IF_PID_DIFFERS(intern);
+
+ phongo_execute_command(intern->client, PHONGO_COMMAND_READ_WRITE, db, command, options, intern->server_id, return_value);
+} /* }}} */
+
+/* {{{ proto MongoDB\Driver\Cursor MongoDB\Driver\Server::executeQuery(string $namespace, MongoDB\Driver\Query $query[, array $options = null]))
+ Executes a Query on this Server */
+static PHP_METHOD(Server, executeQuery)
+{
+ zend_error_handling error_handling;
+ php_phongo_server_t* intern;
+ char* namespace;
+ size_t namespace_len;
+ zval* query;
+ zval* options = NULL;
+ bool free_options = false;
+
+ intern = Z_SERVER_OBJ_P(getThis());
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "sO|z!", &namespace, &namespace_len, &query, php_phongo_query_ce, &options) == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ options = php_phongo_prep_legacy_option(options, "readPreference", &free_options);
+
+ /* If the Server was created in a different process, reset the client so
+ * that cursors created by this process can be differentiated and its
+ * session pool is cleared. */
+ PHONGO_RESET_CLIENT_IF_PID_DIFFERS(intern);
+
+ phongo_execute_query(intern->client, namespace, query, options, intern->server_id, return_value);
+
+ if (free_options) {
+ php_phongo_prep_legacy_option_free(options);
+ }
+} /* }}} */
+
+/* {{{ proto MongoDB\Driver\WriteResult MongoDB\Driver\Server::executeBulkWrite(string $namespace, MongoDB\Driver\BulkWrite $zbulk[, array $options = null])
+ Executes a BulkWrite (i.e. any number of insert, update, and delete ops) on
+ this Server */
+static PHP_METHOD(Server, executeBulkWrite)
+{
+ zend_error_handling error_handling;
+ php_phongo_server_t* intern;
+ char* namespace;
+ size_t namespace_len;
+ zval* zbulk;
+ php_phongo_bulkwrite_t* bulk;
+ zval* options = NULL;
+ bool free_options = false;
+
+ intern = Z_SERVER_OBJ_P(getThis());
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "sO|z!", &namespace, &namespace_len, &zbulk, php_phongo_bulkwrite_ce, &options, php_phongo_writeconcern_ce) == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ bulk = Z_BULKWRITE_OBJ_P(zbulk);
+
+ options = php_phongo_prep_legacy_option(options, "writeConcern", &free_options);
+
+ /* If the Server was created in a different process, reset the client so
+ * that its session pool is cleared. */
+ PHONGO_RESET_CLIENT_IF_PID_DIFFERS(intern);
+
+ phongo_execute_bulk_write(intern->client, namespace, bulk, options, intern->server_id, return_value);
+
+ if (free_options) {
+ php_phongo_prep_legacy_option_free(options);
+ }
+} /* }}} */
+
+/* {{{ proto string MongoDB\Driver\Server::getHost()
+ Returns the hostname for this Server */
+static PHP_METHOD(Server, getHost)
+{
+ zend_error_handling error_handling;
+ php_phongo_server_t* intern;
+ mongoc_server_description_t* sd;
+
+ intern = Z_SERVER_OBJ_P(getThis());
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters_none() == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ if ((sd = mongoc_client_get_server_description(intern->client, intern->server_id))) {
+ RETVAL_STRING(mongoc_server_description_host(sd)->host);
+ mongoc_server_description_destroy(sd);
+ return;
+ }
+
+ phongo_throw_exception(PHONGO_ERROR_RUNTIME, "Failed to get server description");
+} /* }}} */
+
+/* {{{ proto array MongoDB\Driver\Server::getTags()
+ Returns the currently configured tags for this Server */
+static PHP_METHOD(Server, getTags)
+{
+ zend_error_handling error_handling;
+ php_phongo_server_t* intern;
+ mongoc_server_description_t* sd;
+
+ intern = Z_SERVER_OBJ_P(getThis());
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters_none() == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ if ((sd = mongoc_client_get_server_description(intern->client, intern->server_id))) {
+ const bson_t* is_master = mongoc_server_description_ismaster(sd);
+ bson_iter_t 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_INIT_DEBUG_STATE(state);
+ bson_iter_document(&iter, &len, &bytes);
+
+ if (!php_phongo_bson_to_zval_ex(bytes, len, &state)) {
+ /* Exception should already have been thrown */
+ zval_ptr_dtor(&state.zchild);
+ mongoc_server_description_destroy(sd);
+ return;
+ }
+
+ mongoc_server_description_destroy(sd);
+
+ RETURN_ZVAL(&state.zchild, 0, 1);
+ }
+
+ array_init(return_value);
+ mongoc_server_description_destroy(sd);
+ return;
+ }
+
+ phongo_throw_exception(PHONGO_ERROR_RUNTIME, "Failed to get server description");
+} /* }}} */
+
+/* {{{ proto array MongoDB\Driver\Server::getInfo()
+ Returns the last isMaster result document for this Server */
+static PHP_METHOD(Server, getInfo)
+{
+ zend_error_handling error_handling;
+ php_phongo_server_t* intern;
+ mongoc_server_description_t* sd;
+
+ intern = Z_SERVER_OBJ_P(getThis());
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters_none() == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ if ((sd = mongoc_client_get_server_description(intern->client, intern->server_id))) {
+ const bson_t* is_master = mongoc_server_description_ismaster(sd);
+ php_phongo_bson_state state;
+
+ PHONGO_BSON_INIT_DEBUG_STATE(state);
+
+ if (!php_phongo_bson_to_zval_ex(bson_get_data(is_master), is_master->len, &state)) {
+ /* Exception should already have been thrown */
+ zval_ptr_dtor(&state.zchild);
+ mongoc_server_description_destroy(sd);
+ return;
+ }
+
+ mongoc_server_description_destroy(sd);
+
+ RETURN_ZVAL(&state.zchild, 0, 1);
+ }
+
+ phongo_throw_exception(PHONGO_ERROR_RUNTIME, "Failed to get server description");
+} /* }}} */
+
+/* {{{ proto integer MongoDB\Driver\Server::getLatency()
+ Returns the last measured latency for this Server */
+static PHP_METHOD(Server, getLatency)
+{
+ zend_error_handling error_handling;
+ php_phongo_server_t* intern;
+ mongoc_server_description_t* sd;
+
+ intern = Z_SERVER_OBJ_P(getThis());
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters_none() == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ if ((sd = mongoc_client_get_server_description(intern->client, intern->server_id))) {
+ RETVAL_LONG((zend_long) mongoc_server_description_round_trip_time(sd));
+ mongoc_server_description_destroy(sd);
+ return;
+ }
+
+ phongo_throw_exception(PHONGO_ERROR_RUNTIME, "Failed to get server description");
+} /* }}} */
+
+/* {{{ proto integer MongoDB\Driver\Server::getPort()
+ Returns the port for this Server */
+static PHP_METHOD(Server, getPort)
+{
+ zend_error_handling error_handling;
+ php_phongo_server_t* intern;
+ mongoc_server_description_t* sd;
+
+ intern = Z_SERVER_OBJ_P(getThis());
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters_none() == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ if ((sd = mongoc_client_get_server_description(intern->client, intern->server_id))) {
+ RETVAL_LONG(mongoc_server_description_host(sd)->port);
+ mongoc_server_description_destroy(sd);
+ return;
+ }
+
+ phongo_throw_exception(PHONGO_ERROR_RUNTIME, "Failed to get server description");
+} /* }}} */
+
+/* {{{ proto integer MongoDB\Driver\Server::getType()
+ Returns the node type of this Server */
+static PHP_METHOD(Server, getType)
+{
+ zend_error_handling error_handling;
+ php_phongo_server_t* intern;
+ mongoc_server_description_t* sd;
+
+ intern = Z_SERVER_OBJ_P(getThis());
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters_none() == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ if ((sd = mongoc_client_get_server_description(intern->client, intern->server_id))) {
+ RETVAL_LONG(php_phongo_server_description_type(sd));
+ mongoc_server_description_destroy(sd);
+ return;
+ }
+
+ phongo_throw_exception(PHONGO_ERROR_RUNTIME, "Failed to get server description");
+} /* }}} */
+
+/* {{{ proto boolean MongoDB\Driver\Server::isPrimary()
+ Returns whether this Server is a primary member of a replica set */
+static PHP_METHOD(Server, isPrimary)
+{
+ zend_error_handling error_handling;
+ php_phongo_server_t* intern;
+ mongoc_server_description_t* sd;
+
+ intern = Z_SERVER_OBJ_P(getThis());
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters_none() == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ if ((sd = mongoc_client_get_server_description(intern->client, intern->server_id))) {
+ RETVAL_BOOL(!strcmp(mongoc_server_description_type(sd), php_phongo_server_description_type_map[PHONGO_SERVER_RS_PRIMARY].name));
+ mongoc_server_description_destroy(sd);
+ return;
+ }
+
+ phongo_throw_exception(PHONGO_ERROR_RUNTIME, "Failed to get server description");
+} /* }}} */
+
+/* {{{ proto boolean MongoDB\Driver\Server::isSecondary()
+ Returns whether this Server is a secondary member of a replica set */
+static PHP_METHOD(Server, isSecondary)
+{
+ zend_error_handling error_handling;
+ php_phongo_server_t* intern;
+ mongoc_server_description_t* sd;
+
+ intern = Z_SERVER_OBJ_P(getThis());
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters_none() == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ if ((sd = mongoc_client_get_server_description(intern->client, intern->server_id))) {
+ RETVAL_BOOL(!strcmp(mongoc_server_description_type(sd), php_phongo_server_description_type_map[PHONGO_SERVER_RS_SECONDARY].name));
+ mongoc_server_description_destroy(sd);
+ return;
+ }
+
+ phongo_throw_exception(PHONGO_ERROR_RUNTIME, "Failed to get server description");
+} /* }}} */
+
+/* {{{ proto boolean MongoDB\Driver\Server::isArbiter()
+ Returns whether this Server is an arbiter member of a replica set */
+static PHP_METHOD(Server, isArbiter)
+{
+ zend_error_handling error_handling;
+ php_phongo_server_t* intern;
+ mongoc_server_description_t* sd;
+
+ intern = Z_SERVER_OBJ_P(getThis());
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters_none() == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ if ((sd = mongoc_client_get_server_description(intern->client, intern->server_id))) {
+ RETVAL_BOOL(!strcmp(mongoc_server_description_type(sd), php_phongo_server_description_type_map[PHONGO_SERVER_RS_ARBITER].name));
+ mongoc_server_description_destroy(sd);
+ return;
+ }
+
+ phongo_throw_exception(PHONGO_ERROR_RUNTIME, "Failed to get server description");
+} /* }}} */
+
+/* {{{ proto boolean MongoDB\Driver\Server::isHidden()
+ Returns whether this Server is a hidden member of a replica set */
+static PHP_METHOD(Server, isHidden)
+{
+ zend_error_handling error_handling;
+ php_phongo_server_t* intern;
+ mongoc_server_description_t* sd;
+
+ intern = Z_SERVER_OBJ_P(getThis());
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters_none() == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ if ((sd = mongoc_client_get_server_description(intern->client, intern->server_id))) {
+ bson_iter_t iter;
+
+ RETVAL_BOOL(bson_iter_init_find_case(&iter, mongoc_server_description_ismaster(sd), "hidden") && bson_iter_as_bool(&iter));
+ mongoc_server_description_destroy(sd);
+ return;
+ }
+
+ phongo_throw_exception(PHONGO_ERROR_RUNTIME, "Failed to get server description");
+} /* }}} */
+
+/* {{{ proto boolean MongoDB\Driver\Server::isPassive()
+ Returns whether this Server is a passive member of a replica set */
+static PHP_METHOD(Server, isPassive)
+{
+ zend_error_handling error_handling;
+ php_phongo_server_t* intern;
+ mongoc_server_description_t* sd;
+
+ intern = Z_SERVER_OBJ_P(getThis());
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters_none() == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ if ((sd = mongoc_client_get_server_description(intern->client, intern->server_id))) {
+ bson_iter_t iter;
+
+ RETVAL_BOOL(bson_iter_init_find_case(&iter, mongoc_server_description_ismaster(sd), "passive") && bson_iter_as_bool(&iter));
+ mongoc_server_description_destroy(sd);
+ return;
+ }
+
+ phongo_throw_exception(PHONGO_ERROR_RUNTIME, "Failed to get server description");
+} /* }}} */
+
+/* {{{ MongoDB\Driver\Server function entries */
+ZEND_BEGIN_ARG_INFO_EX(ai_Server_executeCommand, 0, 0, 2)
+ ZEND_ARG_INFO(0, db)
+ ZEND_ARG_OBJ_INFO(0, command, MongoDB\\Driver\\Command, 0)
+ ZEND_ARG_INFO(0, options)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(ai_Server_executeRWCommand, 0, 0, 2)
+ ZEND_ARG_INFO(0, db)
+ ZEND_ARG_OBJ_INFO(0, command, MongoDB\\Driver\\Command, 0)
+ ZEND_ARG_ARRAY_INFO(0, options, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(ai_Server_executeQuery, 0, 0, 2)
+ ZEND_ARG_INFO(0, namespace)
+ ZEND_ARG_OBJ_INFO(0, zquery, MongoDB\\Driver\\Query, 0)
+ ZEND_ARG_INFO(0, options)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(ai_Server_executeBulkWrite, 0, 0, 2)
+ ZEND_ARG_INFO(0, namespace)
+ ZEND_ARG_OBJ_INFO(0, zbulk, MongoDB\\Driver\\BulkWrite, 0)
+ ZEND_ARG_INFO(0, options)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(ai_Server_void, 0, 0, 0)
+ZEND_END_ARG_INFO()
+
+static zend_function_entry php_phongo_server_me[] = {
+ /* clang-format off */
+ PHP_ME(Server, executeCommand, ai_Server_executeCommand, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
+ PHP_ME(Server, executeReadCommand, ai_Server_executeRWCommand, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
+ PHP_ME(Server, executeWriteCommand, ai_Server_executeRWCommand, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
+ PHP_ME(Server, executeReadWriteCommand, ai_Server_executeRWCommand, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
+ PHP_ME(Server, executeQuery, ai_Server_executeQuery, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
+ PHP_ME(Server, executeBulkWrite, ai_Server_executeBulkWrite, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
+ PHP_ME(Server, getHost, ai_Server_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
+ PHP_ME(Server, getTags, ai_Server_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
+ PHP_ME(Server, getInfo, ai_Server_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
+ PHP_ME(Server, getLatency, ai_Server_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
+ PHP_ME(Server, getPort, ai_Server_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
+ PHP_ME(Server, getType, ai_Server_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
+ PHP_ME(Server, isPrimary, ai_Server_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
+ PHP_ME(Server, isSecondary, ai_Server_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
+ PHP_ME(Server, isArbiter, ai_Server_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
+ PHP_ME(Server, isHidden, ai_Server_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
+ PHP_ME(Server, isPassive, ai_Server_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
+ ZEND_NAMED_ME(__construct, PHP_FN(MongoDB_disabled___construct), ai_Server_void, ZEND_ACC_PRIVATE | ZEND_ACC_FINAL)
+ ZEND_NAMED_ME(__wakeup, PHP_FN(MongoDB_disabled___wakeup), ai_Server_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
+ PHP_FE_END
+ /* clang-format on */
+};
+/* }}} */
+
+/* {{{ MongoDB\Driver\Server object handlers */
+static zend_object_handlers php_phongo_handler_server;
+
+static int php_phongo_server_compare_objects(zval* o1, zval* o2) /* {{{ */
+{
+ php_phongo_server_t* intern1;
+ php_phongo_server_t* intern2;
+ mongoc_server_description_t *sd1, *sd2;
+ int retval = 0;
+
+ ZEND_COMPARE_OBJECTS_FALLBACK(o1, o2);
+
+ intern1 = Z_SERVER_OBJ_P(o1);
+ intern2 = Z_SERVER_OBJ_P(o2);
+
+ sd1 = mongoc_client_get_server_description(intern1->client, intern1->server_id);
+ sd2 = mongoc_client_get_server_description(intern2->client, intern2->server_id);
+
+ if (sd1 && sd2) {
+ retval = strcasecmp(mongoc_server_description_host(sd1)->host_and_port, mongoc_server_description_host(sd2)->host_and_port);
+ } else {
+ phongo_throw_exception(PHONGO_ERROR_RUNTIME, "Failed to get server description(s)");
+ }
+
+ if (sd1) {
+ mongoc_server_description_destroy(sd1);
+ }
+
+ if (sd2) {
+ mongoc_server_description_destroy(sd2);
+ }
+
+ return retval;
+} /* }}} */
+
+static void php_phongo_server_free_object(zend_object* object) /* {{{ */
+{
+ php_phongo_server_t* intern = Z_OBJ_SERVER(object);
+
+ zend_object_std_dtor(&intern->std);
+} /* }}} */
+
+static zend_object* php_phongo_server_create_object(zend_class_entry* class_type) /* {{{ */
+{
+ php_phongo_server_t* intern = NULL;
+
+ intern = PHONGO_ALLOC_OBJECT_T(php_phongo_server_t, class_type);
+
+ zend_object_std_init(&intern->std, class_type);
+ object_properties_init(&intern->std, class_type);
+
+ PHONGO_SET_CREATED_BY_PID(intern);
+
+ intern->std.handlers = &php_phongo_handler_server;
+
+ return &intern->std;
+} /* }}} */
+
+static HashTable* php_phongo_server_get_debug_info(phongo_compat_object_handler_type* object, int* is_temp) /* {{{ */
+{
+ php_phongo_server_t* intern = NULL;
+ zval retval = ZVAL_STATIC_INIT;
+ mongoc_server_description_t* sd;
+
+ *is_temp = 1;
+ intern = Z_OBJ_SERVER(PHONGO_COMPAT_GET_OBJ(object));
+
+ if (!(sd = mongoc_client_get_server_description(intern->client, intern->server_id))) {
+ phongo_throw_exception(PHONGO_ERROR_RUNTIME, "Failed to get server description");
+ return NULL;
+ }
+
+ php_phongo_server_to_zval(&retval, sd);
+ mongoc_server_description_destroy(sd);
+
+ return Z_ARRVAL(retval);
+} /* }}} */
+/* }}} */
+
+void php_phongo_server_init_ce(INIT_FUNC_ARGS) /* {{{ */
+{
+ zend_class_entry ce;
+
+ INIT_NS_CLASS_ENTRY(ce, "MongoDB\\Driver", "Server", php_phongo_server_me);
+ php_phongo_server_ce = zend_register_internal_class(&ce);
+ php_phongo_server_ce->create_object = php_phongo_server_create_object;
+ PHONGO_CE_FINAL(php_phongo_server_ce);
+ PHONGO_CE_DISABLE_SERIALIZATION(php_phongo_server_ce);
+
+ memcpy(&php_phongo_handler_server, phongo_get_std_object_handlers(), sizeof(zend_object_handlers));
+ PHONGO_COMPAT_SET_COMPARE_OBJECTS_HANDLER(server);
+ php_phongo_handler_server.get_debug_info = php_phongo_server_get_debug_info;
+ php_phongo_handler_server.free_obj = php_phongo_server_free_object;
+ php_phongo_handler_server.offset = XtOffsetOf(php_phongo_server_t, std);
+
+ zend_declare_class_constant_long(php_phongo_server_ce, ZEND_STRL("TYPE_UNKNOWN"), PHONGO_SERVER_UNKNOWN);
+ zend_declare_class_constant_long(php_phongo_server_ce, ZEND_STRL("TYPE_STANDALONE"), PHONGO_SERVER_STANDALONE);
+ zend_declare_class_constant_long(php_phongo_server_ce, ZEND_STRL("TYPE_MONGOS"), PHONGO_SERVER_MONGOS);
+ zend_declare_class_constant_long(php_phongo_server_ce, ZEND_STRL("TYPE_POSSIBLE_PRIMARY"), PHONGO_SERVER_POSSIBLE_PRIMARY);
+ zend_declare_class_constant_long(php_phongo_server_ce, ZEND_STRL("TYPE_RS_PRIMARY"), PHONGO_SERVER_RS_PRIMARY);
+ zend_declare_class_constant_long(php_phongo_server_ce, ZEND_STRL("TYPE_RS_SECONDARY"), PHONGO_SERVER_RS_SECONDARY);
+ zend_declare_class_constant_long(php_phongo_server_ce, ZEND_STRL("TYPE_RS_ARBITER"), PHONGO_SERVER_RS_ARBITER);
+ zend_declare_class_constant_long(php_phongo_server_ce, ZEND_STRL("TYPE_RS_OTHER"), PHONGO_SERVER_RS_OTHER);
+ zend_declare_class_constant_long(php_phongo_server_ce, ZEND_STRL("TYPE_RS_GHOST"), PHONGO_SERVER_RS_GHOST);
+} /* }}} */
+
+/*
+ * 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.9.0/src/MongoDB/Session.c b/mongodb-1.9.0/src/MongoDB/Session.c
new file mode 100644
index 00000000..cf074171
--- /dev/null
+++ b/mongodb-1.9.0/src/MongoDB/Session.c
@@ -0,0 +1,797 @@
+/*
+ * Copyright 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.
+ */
+
+#include <php.h>
+#include <Zend/zend_interfaces.h>
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "phongo_compat.h"
+#include "php_phongo.h"
+#include "php_bson.h"
+#include "php_array_api.h"
+#include "Session.h"
+
+zend_class_entry* php_phongo_session_ce;
+
+#define PHONGO_TRANSACTION_NONE "none"
+#define PHONGO_TRANSACTION_STARTING "starting"
+#define PHONGO_TRANSACTION_IN_PROGRESS "in_progress"
+#define PHONGO_TRANSACTION_COMMITTED "committed"
+#define PHONGO_TRANSACTION_ABORTED "aborted"
+
+#define SESSION_CHECK_LIVELINESS(i, m) \
+ if (!(i)->client_session) { \
+ phongo_throw_exception( \
+ PHONGO_ERROR_LOGIC, \
+ "Cannot call '%s', as the session has already been ended.", \
+ (m)); \
+ return; \
+ }
+
+static bool php_phongo_session_get_timestamp_parts(zval* obj, uint32_t* timestamp, uint32_t* increment)
+{
+ bool retval = false;
+ zval ztimestamp = ZVAL_STATIC_INIT;
+ zval zincrement = ZVAL_STATIC_INIT;
+
+ zend_call_method_with_0_params(PHONGO_COMPAT_OBJ_P(obj), NULL, NULL, "getTimestamp", &ztimestamp);
+
+ if (Z_ISUNDEF(ztimestamp) || EG(exception)) {
+ goto cleanup;
+ }
+
+ zend_call_method_with_0_params(PHONGO_COMPAT_OBJ_P(obj), NULL, NULL, "getIncrement", &zincrement);
+
+ if (Z_ISUNDEF(zincrement) || EG(exception)) {
+ goto cleanup;
+ }
+
+ *timestamp = Z_LVAL(ztimestamp);
+ *increment = Z_LVAL(zincrement);
+
+ retval = true;
+
+cleanup:
+ if (!Z_ISUNDEF(ztimestamp)) {
+ zval_ptr_dtor(&ztimestamp);
+ }
+
+ if (!Z_ISUNDEF(zincrement)) {
+ zval_ptr_dtor(&zincrement);
+ }
+
+ return retval;
+}
+
+static const char* php_phongo_get_transaction_state_string(mongoc_transaction_state_t state)
+{
+ switch (state) {
+ case MONGOC_TRANSACTION_NONE:
+ return PHONGO_TRANSACTION_NONE;
+ case MONGOC_TRANSACTION_STARTING:
+ return PHONGO_TRANSACTION_STARTING;
+ case MONGOC_TRANSACTION_IN_PROGRESS:
+ return PHONGO_TRANSACTION_IN_PROGRESS;
+ case MONGOC_TRANSACTION_COMMITTED:
+ return PHONGO_TRANSACTION_COMMITTED;
+ case MONGOC_TRANSACTION_ABORTED:
+ return PHONGO_TRANSACTION_ABORTED;
+ default:
+ phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Invalid transaction state %d given", (int) state);
+ return NULL;
+ }
+}
+
+/* {{{ proto void MongoDB\Driver\Session::advanceClusterTime(array|object $clusterTime)
+ Advances the cluster time for this Session */
+static PHP_METHOD(Session, advanceClusterTime)
+{
+ zend_error_handling error_handling;
+ php_phongo_session_t* intern;
+ zval* zcluster_time;
+ bson_t cluster_time = BSON_INITIALIZER;
+
+ intern = Z_SESSION_OBJ_P(getThis());
+ SESSION_CHECK_LIVELINESS(intern, "advanceClusterTime")
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "A", &zcluster_time) == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ php_phongo_zval_to_bson(zcluster_time, PHONGO_BSON_NONE, &cluster_time, NULL);
+
+ /* An exception may be thrown during BSON conversion */
+ if (EG(exception)) {
+ goto cleanup;
+ }
+
+ mongoc_client_session_advance_cluster_time(intern->client_session, &cluster_time);
+
+cleanup:
+ bson_destroy(&cluster_time);
+} /* }}} */
+
+/* {{{ proto void MongoDB\Driver\Session::advanceOperationTime(MongoDB\BSON\TimestampInterface $timestamp)
+ Advances the operation time for this Session */
+static PHP_METHOD(Session, advanceOperationTime)
+{
+ zend_error_handling error_handling;
+ php_phongo_session_t* intern;
+ zval* ztimestamp;
+ uint32_t timestamp = 0;
+ uint32_t increment = 0;
+
+ intern = Z_SESSION_OBJ_P(getThis());
+ SESSION_CHECK_LIVELINESS(intern, "advanceOperationTime")
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "O", &ztimestamp, php_phongo_timestamp_interface_ce) == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ if (!php_phongo_session_get_timestamp_parts(ztimestamp, &timestamp, &increment)) {
+ return;
+ }
+
+ mongoc_client_session_advance_operation_time(intern->client_session, timestamp, increment);
+} /* }}} */
+
+/* {{{ proto object|null MongoDB\Driver\Session::getClusterTime()
+ Returns the cluster time for this Session */
+static PHP_METHOD(Session, getClusterTime)
+{
+ zend_error_handling error_handling;
+ php_phongo_session_t* intern;
+ const bson_t* cluster_time;
+ php_phongo_bson_state state;
+
+ PHONGO_BSON_INIT_STATE(state);
+
+ intern = Z_SESSION_OBJ_P(getThis());
+ SESSION_CHECK_LIVELINESS(intern, "getClusterTime")
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters_none() == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ cluster_time = mongoc_client_session_get_cluster_time(intern->client_session);
+
+ if (!cluster_time) {
+ RETURN_NULL();
+ }
+
+ if (!php_phongo_bson_to_zval_ex(bson_get_data(cluster_time), cluster_time->len, &state)) {
+ /* Exception should already have been thrown */
+ zval_ptr_dtor(&state.zchild);
+ return;
+ }
+
+ RETURN_ZVAL(&state.zchild, 0, 1);
+} /* }}} */
+
+/* {{{ proto object MongoDB\Driver\Session::getLogicalSessionId()
+ Returns the logical session ID for this Session */
+static PHP_METHOD(Session, getLogicalSessionId)
+{
+ zend_error_handling error_handling;
+ php_phongo_session_t* intern;
+ const bson_t* lsid;
+ php_phongo_bson_state state;
+
+ PHONGO_BSON_INIT_STATE(state);
+
+ intern = Z_SESSION_OBJ_P(getThis());
+ SESSION_CHECK_LIVELINESS(intern, "getLogicalSessionId")
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters_none() == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ lsid = mongoc_client_session_get_lsid(intern->client_session);
+
+ if (!php_phongo_bson_to_zval_ex(bson_get_data(lsid), lsid->len, &state)) {
+ /* Exception should already have been thrown */
+ zval_ptr_dtor(&state.zchild);
+ return;
+ }
+
+ RETURN_ZVAL(&state.zchild, 0, 1);
+} /* }}} */
+
+/* {{{ proto MongoDB\BSON\Timestamp|null MongoDB\Driver\Session::getOperationTime()
+ Returns the operation time for this Session */
+static PHP_METHOD(Session, getOperationTime)
+{
+ zend_error_handling error_handling;
+ php_phongo_session_t* intern;
+ uint32_t timestamp, increment;
+
+ intern = Z_SESSION_OBJ_P(getThis());
+ SESSION_CHECK_LIVELINESS(intern, "getOperationTime")
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters_none() == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ mongoc_client_session_get_operation_time(intern->client_session, &timestamp, &increment);
+
+ /* mongoc_client_session_get_operation_time() returns 0 for both parts if
+ * the session has not been used. According to the causal consistency spec,
+ * the operation time for an unused session is null. */
+ if (timestamp == 0 && increment == 0) {
+ RETURN_NULL();
+ }
+
+ php_phongo_bson_new_timestamp_from_increment_and_timestamp(return_value, increment, timestamp);
+} /* }}} */
+
+/* {{{ proto MongoDB\Driver\Server|null MongoDB\Driver\Session::getServer()
+ Returns the server this session is pinned to */
+static PHP_METHOD(Session, getServer)
+{
+ zend_error_handling error_handling;
+ php_phongo_session_t* intern;
+ uint32_t server_id = 0;
+
+ intern = Z_SESSION_OBJ_P(getThis());
+ SESSION_CHECK_LIVELINESS(intern, "getServer")
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters_none() == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ server_id = mongoc_client_session_get_server_id(intern->client_session);
+
+ /* For sessions without a pinned server, 0 is returned. */
+ if (!server_id) {
+ RETURN_NULL();
+ }
+
+ phongo_server_init(return_value, intern->client, server_id);
+} /* }}} */
+
+/* {{{ proto array|null MongoDB\Driver\Session::getTransactionOptions()
+ Returns options for the currently running transaction */
+static PHP_METHOD(Session, getTransactionOptions)
+{
+ zend_error_handling error_handling;
+ php_phongo_session_t* intern;
+ mongoc_transaction_opt_t* opts;
+ int64_t max_commit_time_ms;
+ const mongoc_read_concern_t* read_concern;
+ const mongoc_read_prefs_t* read_preference;
+ const mongoc_write_concern_t* write_concern;
+
+ intern = Z_SESSION_OBJ_P(getThis());
+ SESSION_CHECK_LIVELINESS(intern, "getTransactionOptions")
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters_none() == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ opts = mongoc_session_opts_get_transaction_opts(intern->client_session);
+
+ if (!opts) {
+ return;
+ }
+
+ max_commit_time_ms = mongoc_transaction_opts_get_max_commit_time_ms(opts);
+ read_concern = mongoc_transaction_opts_get_read_concern(opts);
+ read_preference = mongoc_transaction_opts_get_read_prefs(opts);
+ write_concern = mongoc_transaction_opts_get_write_concern(opts);
+
+ array_init_size(return_value, 4);
+
+ if (max_commit_time_ms) {
+ ADD_ASSOC_LONG_EX(return_value, "maxCommitTimeMS", max_commit_time_ms);
+ }
+
+ if (!mongoc_read_concern_is_default(read_concern)) {
+ zval zread_concern;
+
+ phongo_readconcern_init(&zread_concern, read_concern);
+ ADD_ASSOC_ZVAL_EX(return_value, "readConcern", &zread_concern);
+ }
+
+ if (read_preference) {
+ zval zread_preference;
+
+ phongo_readpreference_init(&zread_preference, read_preference);
+ ADD_ASSOC_ZVAL_EX(return_value, "readPreference", &zread_preference);
+ }
+
+ if (!mongoc_write_concern_is_default(write_concern)) {
+ zval zwrite_concern;
+
+ phongo_writeconcern_init(&zwrite_concern, write_concern);
+ ADD_ASSOC_ZVAL_EX(return_value, "writeConcern", &zwrite_concern);
+ }
+} /* }}} */
+
+/* {{{ proto string MongoDB\Driver\Session::getTransactionState()
+ Returns the current transaction state for this session */
+static PHP_METHOD(Session, getTransactionState)
+{
+ zend_error_handling error_handling;
+ php_phongo_session_t* intern;
+ const char* state;
+
+ intern = Z_SESSION_OBJ_P(getThis());
+ SESSION_CHECK_LIVELINESS(intern, "getTransactionState")
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters_none() == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ state = php_phongo_get_transaction_state_string(mongoc_client_session_get_transaction_state(intern->client_session));
+ if (!state) {
+ /* Exception already thrown */
+ return;
+ }
+
+ RETURN_STRING(state);
+} /* }}} */
+
+/* Creates a opts structure from an array optionally containing an RP, RC,
+ * WC object, and/or maxCommitTimeMS int. Returns NULL if no options were found,
+ * or there was an invalid option. If there was an invalid option or structure,
+ * an exception will be thrown too. */
+mongoc_transaction_opt_t* php_mongodb_session_parse_transaction_options(zval* options)
+{
+ mongoc_transaction_opt_t* opts = NULL;
+
+ if (php_array_existsc(options, "maxCommitTimeMS")) {
+ int64_t max_commit_time_ms = php_array_fetchc_long(options, "maxCommitTimeMS");
+
+ if (max_commit_time_ms < 0) {
+ phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Expected \"maxCommitTimeMS\" option to be >= 0, %" PRId64 " given", max_commit_time_ms);
+ /* Freeing opts is not needed here, as it can't be set yet. The
+ * code is here to keep it consistent with the others in case more
+ * options are added before this one. */
+ if (opts) {
+ mongoc_transaction_opts_destroy(opts);
+ }
+ return NULL;
+ }
+
+ if (max_commit_time_ms > UINT32_MAX) {
+ phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Expected \"maxCommitTimeMS\" option to be <= %" PRIu32 ", %" PRId64 " given", UINT32_MAX, max_commit_time_ms);
+ /* Freeing opts is not needed here, as it can't be set yet. The
+ * code is here to keep it consistent with the others in case more
+ * options are added before this one. */
+ if (opts) {
+ mongoc_transaction_opts_destroy(opts);
+ }
+ return NULL;
+ }
+
+ if (!opts) {
+ opts = mongoc_transaction_opts_new();
+ }
+
+ mongoc_transaction_opts_set_max_commit_time_ms(opts, max_commit_time_ms);
+ }
+
+ if (php_array_existsc(options, "readConcern")) {
+ zval* read_concern = php_array_fetchc(options, "readConcern");
+
+ if (Z_TYPE_P(read_concern) != IS_OBJECT || !instanceof_function(Z_OBJCE_P(read_concern), php_phongo_readconcern_ce)) {
+ phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Expected \"readConcern\" option to be %s, %s given", ZSTR_VAL(php_phongo_readconcern_ce->name), PHONGO_ZVAL_CLASS_OR_TYPE_NAME_P(read_concern));
+ if (opts) {
+ mongoc_transaction_opts_destroy(opts);
+ }
+ return NULL;
+ }
+
+ if (!opts) {
+ opts = mongoc_transaction_opts_new();
+ }
+
+ mongoc_transaction_opts_set_read_concern(opts, phongo_read_concern_from_zval(read_concern));
+ }
+
+ if (php_array_existsc(options, "readPreference")) {
+ zval* read_preference = php_array_fetchc(options, "readPreference");
+
+ if (Z_TYPE_P(read_preference) != IS_OBJECT || !instanceof_function(Z_OBJCE_P(read_preference), php_phongo_readpreference_ce)) {
+ phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Expected \"readPreference\" option to be %s, %s given", ZSTR_VAL(php_phongo_readpreference_ce->name), PHONGO_ZVAL_CLASS_OR_TYPE_NAME_P(read_preference));
+ if (opts) {
+ mongoc_transaction_opts_destroy(opts);
+ }
+ return NULL;
+ }
+
+ if (!opts) {
+ opts = mongoc_transaction_opts_new();
+ }
+
+ mongoc_transaction_opts_set_read_prefs(opts, phongo_read_preference_from_zval(read_preference));
+ }
+
+ if (php_array_existsc(options, "writeConcern")) {
+ zval* write_concern = php_array_fetchc(options, "writeConcern");
+
+ if (Z_TYPE_P(write_concern) != IS_OBJECT || !instanceof_function(Z_OBJCE_P(write_concern), php_phongo_writeconcern_ce)) {
+ phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Expected \"writeConcern\" option to be %s, %s given", ZSTR_VAL(php_phongo_writeconcern_ce->name), PHONGO_ZVAL_CLASS_OR_TYPE_NAME_P(write_concern));
+ if (opts) {
+ mongoc_transaction_opts_destroy(opts);
+ }
+ return NULL;
+ }
+
+ if (!opts) {
+ opts = mongoc_transaction_opts_new();
+ }
+
+ mongoc_transaction_opts_set_write_concern(opts, phongo_write_concern_from_zval(write_concern));
+ }
+
+ return opts;
+}
+
+/* {{{ proto void MongoDB\Driver\Session::startTransaction([array $options = null])
+ Starts a new transaction */
+static PHP_METHOD(Session, startTransaction)
+{
+ zend_error_handling error_handling;
+ php_phongo_session_t* intern;
+ zval* options = NULL;
+ mongoc_transaction_opt_t* txn_options = NULL;
+ bson_error_t error;
+
+ intern = Z_SESSION_OBJ_P(getThis());
+ SESSION_CHECK_LIVELINESS(intern, "startTransaction")
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "|a!", &options) == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ if (options) {
+ txn_options = php_mongodb_session_parse_transaction_options(options);
+ }
+ if (EG(exception)) {
+ return;
+ }
+
+ if (!mongoc_client_session_start_transaction(intern->client_session, txn_options, &error)) {
+ phongo_throw_exception_from_bson_error_t(&error);
+ }
+
+ if (txn_options) {
+ mongoc_transaction_opts_destroy(txn_options);
+ }
+} /* }}} */
+
+/* {{{ proto void MongoDB\Driver\Session::commitTransaction(void)
+ Commits an existing transaction */
+static PHP_METHOD(Session, commitTransaction)
+{
+ zend_error_handling error_handling;
+ php_phongo_session_t* intern;
+ bson_error_t error;
+ bson_t reply;
+
+ intern = Z_SESSION_OBJ_P(getThis());
+ SESSION_CHECK_LIVELINESS(intern, "commitTransaction")
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters_none() == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ if (!mongoc_client_session_commit_transaction(intern->client_session, &reply, &error)) {
+ phongo_throw_exception_from_bson_error_t_and_reply(&error, &reply);
+ }
+
+ bson_destroy(&reply);
+} /* }}} */
+
+/* {{{ proto void MongoDB\Driver\Session::abortTransaction(void)
+ Aborts (rolls back) an existing transaction */
+static PHP_METHOD(Session, abortTransaction)
+{
+ zend_error_handling error_handling;
+ php_phongo_session_t* intern;
+ bson_error_t error;
+
+ intern = Z_SESSION_OBJ_P(getThis());
+ SESSION_CHECK_LIVELINESS(intern, "abortTransaction")
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters_none() == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ if (!mongoc_client_session_abort_transaction(intern->client_session, &error)) {
+ phongo_throw_exception_from_bson_error_t(&error);
+ }
+} /* }}} */
+
+/* {{{ proto void MongoDB\Driver\Session::endSession(void)
+ Ends the session, and a running transaction if active */
+static PHP_METHOD(Session, endSession)
+{
+ zend_error_handling error_handling;
+ php_phongo_session_t* intern;
+
+ intern = Z_SESSION_OBJ_P(getThis());
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters_none() == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ mongoc_client_session_destroy(intern->client_session);
+ intern->client_session = NULL;
+} /* }}} */
+
+/* {{{ proto void MongoDB\Driver\Session::isInTransaction(void)
+ Returns whether a multi-document transaction is in progress */
+static PHP_METHOD(Session, isInTransaction)
+{
+ zend_error_handling error_handling;
+ php_phongo_session_t* intern;
+
+ intern = Z_SESSION_OBJ_P(getThis());
+ SESSION_CHECK_LIVELINESS(intern, "isInTransaction")
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters_none() == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ RETURN_BOOL(mongoc_client_session_in_transaction(intern->client_session));
+} /* }}} */
+
+/* {{{ MongoDB\Driver\Session function entries */
+ZEND_BEGIN_ARG_INFO_EX(ai_Session_advanceClusterTime, 0, 0, 1)
+ ZEND_ARG_INFO(0, clusterTime)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(ai_Session_advanceOperationTime, 0, 0, 1)
+ ZEND_ARG_INFO(0, timestamp)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(ai_Session_startTransaction, 0, 0, 0)
+ ZEND_ARG_ARRAY_INFO(0, options, 1)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(ai_Session_void, 0, 0, 0)
+ZEND_END_ARG_INFO()
+
+static zend_function_entry php_phongo_session_me[] = {
+ /* clang-format off */
+ PHP_ME(Session, abortTransaction, ai_Session_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
+ PHP_ME(Session, advanceClusterTime, ai_Session_advanceClusterTime, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
+ PHP_ME(Session, advanceOperationTime, ai_Session_advanceOperationTime, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
+ PHP_ME(Session, commitTransaction, ai_Session_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
+ PHP_ME(Session, endSession, ai_Session_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
+ PHP_ME(Session, getClusterTime, ai_Session_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
+ PHP_ME(Session, getLogicalSessionId, ai_Session_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
+ PHP_ME(Session, getOperationTime, ai_Session_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
+ PHP_ME(Session, getServer, ai_Session_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
+ PHP_ME(Session, getTransactionOptions, ai_Session_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
+ PHP_ME(Session, getTransactionState, ai_Session_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
+ PHP_ME(Session, isInTransaction, ai_Session_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
+ PHP_ME(Session, startTransaction, ai_Session_startTransaction, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
+ ZEND_NAMED_ME(__construct, PHP_FN(MongoDB_disabled___construct), ai_Session_void, ZEND_ACC_PRIVATE | ZEND_ACC_FINAL)
+ ZEND_NAMED_ME(__wakeup, PHP_FN(MongoDB_disabled___wakeup), ai_Session_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
+ PHP_FE_END
+ /* clang-format on */
+};
+/* }}} */
+
+/* {{{ MongoDB\Driver\Session object handlers */
+static zend_object_handlers php_phongo_handler_session;
+
+static void php_phongo_session_free_object(zend_object* object) /* {{{ */
+{
+ php_phongo_session_t* intern = Z_OBJ_SESSION(object);
+
+ zend_object_std_dtor(&intern->std);
+
+ /* If this Session was created in a different process, reset the client so
+ * that its session pool is cleared and mongoc_client_session_destroy will
+ * destroy the corresponding server session rather than return it to the
+ * now-empty pool. This will ensure that we do not re-use a server session
+ * (i.e. LSID) created by a parent process. */
+ PHONGO_RESET_CLIENT_IF_PID_DIFFERS(intern);
+
+ if (intern->client_session) {
+ mongoc_client_session_destroy(intern->client_session);
+ }
+} /* }}} */
+
+static zend_object* php_phongo_session_create_object(zend_class_entry* class_type) /* {{{ */
+{
+ php_phongo_session_t* intern = NULL;
+
+ intern = PHONGO_ALLOC_OBJECT_T(php_phongo_session_t, class_type);
+
+ zend_object_std_init(&intern->std, class_type);
+ object_properties_init(&intern->std, class_type);
+
+ PHONGO_SET_CREATED_BY_PID(intern);
+
+ intern->std.handlers = &php_phongo_handler_session;
+
+ return &intern->std;
+} /* }}} */
+
+static HashTable* php_phongo_session_get_debug_info(phongo_compat_object_handler_type* object, int* is_temp) /* {{{ */
+{
+ php_phongo_session_t* intern = NULL;
+ const mongoc_session_opt_t* cs_opts;
+ zval retval = ZVAL_STATIC_INIT;
+
+ *is_temp = 1;
+ intern = Z_OBJ_SESSION(PHONGO_COMPAT_GET_OBJ(object));
+
+ array_init(&retval);
+
+ if (intern->client_session) {
+ const bson_t* lsid;
+ php_phongo_bson_state state;
+
+ PHONGO_BSON_INIT_DEBUG_STATE(state);
+
+ lsid = mongoc_client_session_get_lsid(intern->client_session);
+
+ if (!php_phongo_bson_to_zval_ex(bson_get_data(lsid), lsid->len, &state)) {
+ zval_ptr_dtor(&state.zchild);
+ goto done;
+ }
+
+ ADD_ASSOC_ZVAL_EX(&retval, "logicalSessionId", &state.zchild);
+ } else {
+ ADD_ASSOC_NULL_EX(&retval, "logicalSessionId");
+ }
+
+ if (intern->client_session) {
+ const bson_t* cluster_time;
+
+ cluster_time = mongoc_client_session_get_cluster_time(intern->client_session);
+
+ if (cluster_time) {
+ php_phongo_bson_state state;
+
+ PHONGO_BSON_INIT_DEBUG_STATE(state);
+
+ if (!php_phongo_bson_to_zval_ex(bson_get_data(cluster_time), cluster_time->len, &state)) {
+ zval_ptr_dtor(&state.zchild);
+ goto done;
+ }
+
+ ADD_ASSOC_ZVAL_EX(&retval, "clusterTime", &state.zchild);
+ } else {
+ ADD_ASSOC_NULL_EX(&retval, "clusterTime");
+ }
+ } else {
+ ADD_ASSOC_NULL_EX(&retval, "clusterTime");
+ }
+
+ if (intern->client_session) {
+ cs_opts = mongoc_client_session_get_opts(intern->client_session);
+ ADD_ASSOC_BOOL_EX(&retval, "causalConsistency", mongoc_session_opts_get_causal_consistency(cs_opts));
+ } else {
+ ADD_ASSOC_NULL_EX(&retval, "causalConsistency");
+ }
+
+ if (intern->client_session) {
+ uint32_t timestamp, increment;
+
+ mongoc_client_session_get_operation_time(intern->client_session, &timestamp, &increment);
+
+ if (timestamp && increment) {
+ zval ztimestamp;
+
+ php_phongo_bson_new_timestamp_from_increment_and_timestamp(&ztimestamp, increment, timestamp);
+ ADD_ASSOC_ZVAL_EX(&retval, "operationTime", &ztimestamp);
+ } else {
+ ADD_ASSOC_NULL_EX(&retval, "operationTime");
+ }
+ } else {
+ ADD_ASSOC_NULL_EX(&retval, "operationTime");
+ }
+
+ if (intern->client_session) {
+ uint32_t server_id = mongoc_client_session_get_server_id(intern->client_session);
+
+ if (server_id) {
+
+ zval server;
+
+ phongo_server_init(&server, intern->client, server_id);
+ ADD_ASSOC_ZVAL_EX(&retval, "server", &server);
+ } else {
+ ADD_ASSOC_NULL_EX(&retval, "server");
+ }
+ } else {
+ ADD_ASSOC_NULL_EX(&retval, "server");
+ }
+
+done:
+ return Z_ARRVAL(retval);
+} /* }}} */
+/* }}} */
+
+void php_phongo_session_init_ce(INIT_FUNC_ARGS) /* {{{ */
+{
+ zend_class_entry ce;
+
+ INIT_NS_CLASS_ENTRY(ce, "MongoDB\\Driver", "Session", php_phongo_session_me);
+ php_phongo_session_ce = zend_register_internal_class(&ce);
+ php_phongo_session_ce->create_object = php_phongo_session_create_object;
+ PHONGO_CE_FINAL(php_phongo_session_ce);
+ PHONGO_CE_DISABLE_SERIALIZATION(php_phongo_session_ce);
+
+ memcpy(&php_phongo_handler_session, phongo_get_std_object_handlers(), sizeof(zend_object_handlers));
+ php_phongo_handler_session.get_debug_info = php_phongo_session_get_debug_info;
+ php_phongo_handler_session.free_obj = php_phongo_session_free_object;
+ php_phongo_handler_session.offset = XtOffsetOf(php_phongo_session_t, std);
+
+ zend_declare_class_constant_string(php_phongo_session_ce, ZEND_STRL("TRANSACTION_NONE"), PHONGO_TRANSACTION_NONE);
+ zend_declare_class_constant_string(php_phongo_session_ce, ZEND_STRL("TRANSACTION_STARTING"), PHONGO_TRANSACTION_STARTING);
+ zend_declare_class_constant_string(php_phongo_session_ce, ZEND_STRL("TRANSACTION_IN_PROGRESS"), PHONGO_TRANSACTION_IN_PROGRESS);
+ zend_declare_class_constant_string(php_phongo_session_ce, ZEND_STRL("TRANSACTION_COMMITTED"), PHONGO_TRANSACTION_COMMITTED);
+ zend_declare_class_constant_string(php_phongo_session_ce, ZEND_STRL("TRANSACTION_ABORTED"), PHONGO_TRANSACTION_ABORTED);
+} /* }}} */
+
+/*
+ * 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.8.1/src/MongoDB/Session.h b/mongodb-1.9.0/src/MongoDB/Session.h
similarity index 100%
rename from mongodb-1.8.1/src/MongoDB/Session.h
rename to mongodb-1.9.0/src/MongoDB/Session.h
diff --git a/mongodb-1.9.0/src/MongoDB/WriteConcern.c b/mongodb-1.9.0/src/MongoDB/WriteConcern.c
new file mode 100644
index 00000000..84fa8b95
--- /dev/null
+++ b/mongodb-1.9.0/src/MongoDB/WriteConcern.c
@@ -0,0 +1,590 @@
+/*
+ * 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.
+ */
+
+#include <php.h>
+#include <Zend/zend_interfaces.h>
+#include <ext/standard/php_var.h>
+#include <zend_smart_str.h>
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "phongo_compat.h"
+#include "php_phongo.h"
+
+zend_class_entry* php_phongo_writeconcern_ce;
+
+/* Initialize the object from a HashTable and return whether it was successful.
+ * An exception will be thrown on error. */
+static bool php_phongo_writeconcern_init_from_hash(php_phongo_writeconcern_t* intern, HashTable* props) /* {{{ */
+{
+ zval *w, *wtimeout, *j;
+
+ intern->write_concern = mongoc_write_concern_new();
+
+ if ((w = zend_hash_str_find(props, "w", sizeof("w") - 1))) {
+ if (Z_TYPE_P(w) == IS_LONG) {
+ if (Z_LVAL_P(w) < -3) {
+ phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "%s initialization requires \"w\" integer field to be >= -3", ZSTR_VAL(php_phongo_writeconcern_ce->name));
+ goto failure;
+ }
+ mongoc_write_concern_set_w(intern->write_concern, Z_LVAL_P(w));
+ } else if (Z_TYPE_P(w) == IS_STRING) {
+ if (strcmp(Z_STRVAL_P(w), PHONGO_WRITE_CONCERN_W_MAJORITY) == 0) {
+ mongoc_write_concern_set_w(intern->write_concern, MONGOC_WRITE_CONCERN_W_MAJORITY);
+ } else {
+ mongoc_write_concern_set_wtag(intern->write_concern, Z_STRVAL_P(w));
+ }
+ } else {
+ phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "%s initialization requires \"w\" field to be integer or string", ZSTR_VAL(php_phongo_writeconcern_ce->name));
+ goto failure;
+ }
+ }
+
+ if ((wtimeout = zend_hash_str_find(props, "wtimeout", sizeof("wtimeout") - 1))) {
+ if (Z_TYPE_P(wtimeout) == IS_LONG) {
+ if (Z_LVAL_P(wtimeout) < 0) {
+ phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "%s initialization requires \"wtimeout\" integer field to be >= 0", ZSTR_VAL(php_phongo_writeconcern_ce->name));
+ goto failure;
+ }
+
+ mongoc_write_concern_set_wtimeout_int64(intern->write_concern, (int64_t) Z_LVAL_P(wtimeout));
+ } else if (Z_TYPE_P(wtimeout) == IS_STRING) {
+ int64_t timeout;
+
+ if (!php_phongo_parse_int64(&timeout, Z_STRVAL_P(wtimeout), Z_STRLEN_P(wtimeout))) {
+ phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Error parsing \"%s\" as 64-bit value for %s initialization", Z_STRVAL_P(wtimeout), ZSTR_VAL(php_phongo_writeconcern_ce->name));
+ return false;
+ }
+
+ mongoc_write_concern_set_wtimeout_int64(intern->write_concern, timeout);
+ } else {
+ phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "%s initialization requires \"wtimeout\" field to be integer or string", ZSTR_VAL(php_phongo_writeconcern_ce->name));
+ goto failure;
+ }
+ }
+
+ if ((j = zend_hash_str_find(props, "j", sizeof("j") - 1))) {
+ if (Z_TYPE_P(j) == IS_TRUE || Z_TYPE_P(j) == IS_FALSE) {
+ if (zend_is_true(j) && (mongoc_write_concern_get_w(intern->write_concern) == MONGOC_WRITE_CONCERN_W_UNACKNOWLEDGED || mongoc_write_concern_get_w(intern->write_concern) == MONGOC_WRITE_CONCERN_W_ERRORS_IGNORED)) {
+ phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Cannot enable journaling when using w = 0");
+ goto failure;
+ }
+
+ mongoc_write_concern_set_journal(intern->write_concern, zend_is_true(j));
+ } else {
+ phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "%s initialization requires \"j\" field to be boolean", ZSTR_VAL(php_phongo_writeconcern_ce->name));
+ goto failure;
+ }
+ }
+
+ if (!mongoc_write_concern_is_valid(intern->write_concern)) {
+ phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Write concern is not valid");
+ goto failure;
+ }
+
+ return true;
+
+failure:
+ mongoc_write_concern_destroy(intern->write_concern);
+ intern->write_concern = NULL;
+ return false;
+} /* }}} */
+
+/* {{{ proto void MongoDB\Driver\WriteConcern::__construct(integer|string $w[, integer $wtimeout[, boolean $journal]])
+ Constructs a new WriteConcern */
+static PHP_METHOD(WriteConcern, __construct)
+{
+ zend_error_handling error_handling;
+ php_phongo_writeconcern_t* intern;
+ zval * w, *journal;
+ zend_long wtimeout = 0;
+
+ intern = Z_WRITECONCERN_OBJ_P(getThis());
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "z|lz", &w, &wtimeout, &journal) == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ intern->write_concern = mongoc_write_concern_new();
+
+ if (Z_TYPE_P(w) == IS_LONG) {
+ if (Z_LVAL_P(w) < -3) {
+ phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Expected w to be >= -3, %ld given", Z_LVAL_P(w));
+ return;
+ }
+ mongoc_write_concern_set_w(intern->write_concern, Z_LVAL_P(w));
+ } else if (Z_TYPE_P(w) == IS_STRING) {
+ if (strcmp(Z_STRVAL_P(w), PHONGO_WRITE_CONCERN_W_MAJORITY) == 0) {
+ mongoc_write_concern_set_w(intern->write_concern, MONGOC_WRITE_CONCERN_W_MAJORITY);
+ } else {
+ mongoc_write_concern_set_wtag(intern->write_concern, Z_STRVAL_P(w));
+ }
+ } else {
+ phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Expected w to be integer or string, %s given", PHONGO_ZVAL_CLASS_OR_TYPE_NAME_P(w));
+ return;
+ }
+
+ switch (ZEND_NUM_ARGS()) {
+ case 3:
+ if (Z_TYPE_P(journal) != IS_NULL) {
+ if (zend_is_true(journal) && (mongoc_write_concern_get_w(intern->write_concern) == MONGOC_WRITE_CONCERN_W_UNACKNOWLEDGED || mongoc_write_concern_get_w(intern->write_concern) == MONGOC_WRITE_CONCERN_W_ERRORS_IGNORED)) {
+ phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Cannot enable journaling when using w = 0");
+ return;
+ }
+
+ mongoc_write_concern_set_journal(intern->write_concern, zend_is_true(journal));
+ }
+ PHONGO_BREAK_INTENTIONALLY_MISSING
+
+ case 2:
+ if (wtimeout < 0) {
+ phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Expected wtimeout to be >= 0, %" PHONGO_LONG_FORMAT " given", wtimeout);
+ return;
+ }
+
+ mongoc_write_concern_set_wtimeout_int64(intern->write_concern, (int64_t) wtimeout);
+ }
+
+ if (!mongoc_write_concern_is_valid(intern->write_concern)) {
+ phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Write concern is not valid");
+ return;
+ }
+} /* }}} */
+
+/* {{{ proto void MongoDB\BSON\WriteConcern::__set_state(array $properties)
+*/
+static PHP_METHOD(WriteConcern, __set_state)
+{
+ zend_error_handling error_handling;
+ php_phongo_writeconcern_t* intern;
+ HashTable* props;
+ zval* array;
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "a", &array) == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ object_init_ex(return_value, php_phongo_writeconcern_ce);
+
+ intern = Z_WRITECONCERN_OBJ_P(return_value);
+ props = Z_ARRVAL_P(array);
+
+ php_phongo_writeconcern_init_from_hash(intern, props);
+} /* }}} */
+
+/* {{{ proto string|integer|null MongoDB\Driver\WriteConcern::getW()
+ Returns the WriteConcern "w" option */
+static PHP_METHOD(WriteConcern, getW)
+{
+ zend_error_handling error_handling;
+ php_phongo_writeconcern_t* intern;
+ const char* wtag;
+
+ intern = Z_WRITECONCERN_OBJ_P(getThis());
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters_none() == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ wtag = mongoc_write_concern_get_wtag(intern->write_concern);
+
+ if (wtag) {
+ RETURN_STRING(wtag);
+ }
+
+ if (mongoc_write_concern_get_wmajority(intern->write_concern)) {
+ RETURN_STRING(PHONGO_WRITE_CONCERN_W_MAJORITY);
+ }
+
+ if (mongoc_write_concern_get_w(intern->write_concern) != MONGOC_WRITE_CONCERN_W_DEFAULT) {
+ RETURN_LONG(mongoc_write_concern_get_w(intern->write_concern));
+ }
+
+ RETURN_NULL();
+} /* }}} */
+
+/* {{{ proto integer MongoDB\Driver\WriteConcern::getWtimeout()
+ Returns the WriteConcern "wtimeout" option */
+static PHP_METHOD(WriteConcern, getWtimeout)
+{
+ zend_error_handling error_handling;
+ php_phongo_writeconcern_t* intern;
+ int64_t wtimeout;
+
+ intern = Z_WRITECONCERN_OBJ_P(getThis());
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters_none() == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ wtimeout = mongoc_write_concern_get_wtimeout_int64(intern->write_concern);
+
+#if SIZEOF_ZEND_LONG == 4
+ if (wtimeout > INT32_MAX || wtimeout < INT32_MIN) {
+ zend_error(E_WARNING, "Truncating 64-bit value for wTimeoutMS");
+ }
+#endif
+
+ RETURN_LONG(wtimeout);
+} /* }}} */
+
+/* {{{ proto null|boolean MongoDB\Driver\WriteConcern::getJournal()
+ Returns the WriteConcern "journal" option */
+static PHP_METHOD(WriteConcern, getJournal)
+{
+ zend_error_handling error_handling;
+ php_phongo_writeconcern_t* intern;
+
+ intern = Z_WRITECONCERN_OBJ_P(getThis());
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters_none() == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ if (mongoc_write_concern_journal_is_set(intern->write_concern)) {
+ RETURN_BOOL(mongoc_write_concern_get_journal(intern->write_concern));
+ }
+
+ RETURN_NULL();
+} /* }}} */
+
+/* {{{ proto boolean MongoDB\Driver\WriteConcern::isDefault()
+ Returns whether the write concern has not been modified (i.e. from a Manager
+ with no write concern URI options). */
+static PHP_METHOD(WriteConcern, isDefault)
+{
+ zend_error_handling error_handling;
+ php_phongo_writeconcern_t* intern;
+
+ intern = Z_WRITECONCERN_OBJ_P(getThis());
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters_none() == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ RETURN_BOOL(mongoc_write_concern_is_default(intern->write_concern));
+} /* }}} */
+
+static HashTable* php_phongo_write_concern_get_properties_hash(phongo_compat_object_handler_type* object, bool is_debug, bool is_bson) /* {{{ */
+{
+ php_phongo_writeconcern_t* intern;
+ HashTable* props;
+ const char* wtag;
+ int32_t w;
+ int64_t wtimeout;
+
+ intern = Z_OBJ_WRITECONCERN(PHONGO_COMPAT_GET_OBJ(object));
+
+ PHONGO_GET_PROPERTY_HASH_INIT_PROPS(is_debug, intern, props, 4);
+
+ if (!intern->write_concern) {
+ return props;
+ }
+
+ wtag = mongoc_write_concern_get_wtag(intern->write_concern);
+ w = mongoc_write_concern_get_w(intern->write_concern);
+ wtimeout = mongoc_write_concern_get_wtimeout_int64(intern->write_concern);
+
+ {
+ zval z_w;
+
+ if (wtag) {
+ ZVAL_STRING(&z_w, wtag);
+ zend_hash_str_update(props, "w", sizeof("w") - 1, &z_w);
+ } else if (mongoc_write_concern_get_wmajority(intern->write_concern)) {
+ ZVAL_STRING(&z_w, PHONGO_WRITE_CONCERN_W_MAJORITY);
+ zend_hash_str_update(props, "w", sizeof("w") - 1, &z_w);
+ } else if (w != MONGOC_WRITE_CONCERN_W_DEFAULT) {
+ ZVAL_LONG(&z_w, w);
+ zend_hash_str_update(props, "w", sizeof("w") - 1, &z_w);
+ }
+
+ if (mongoc_write_concern_journal_is_set(intern->write_concern)) {
+ zval z_j;
+
+ ZVAL_BOOL(&z_j, mongoc_write_concern_get_journal(intern->write_concern));
+ zend_hash_str_update(props, "j", sizeof("j") - 1, &z_j);
+ }
+
+ if (wtimeout != 0) {
+ zval z_wtimeout;
+
+ if (is_bson) {
+ ZVAL_INT64(&z_wtimeout, wtimeout);
+ } else {
+#if SIZEOF_ZEND_LONG == 4
+ if (wtimeout > INT32_MAX || wtimeout < INT32_MIN) {
+ ZVAL_INT64_STRING(&z_wtimeout, wtimeout);
+ } else {
+ ZVAL_LONG(&z_wtimeout, wtimeout);
+ }
+#else
+ ZVAL_LONG(&z_wtimeout, wtimeout);
+#endif
+ }
+
+ zend_hash_str_update(props, "wtimeout", sizeof("wtimeout") - 1, &z_wtimeout);
+ }
+ }
+
+ return props;
+} /* }}} */
+
+/* {{{ proto array MongoDB\Driver\WriteConcern::bsonSerialize()
+*/
+static PHP_METHOD(WriteConcern, bsonSerialize)
+{
+ zend_error_handling error_handling;
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters_none() == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ ZVAL_ARR(return_value, php_phongo_write_concern_get_properties_hash(PHONGO_COMPAT_OBJ_P(getThis()), true, true));
+ convert_to_object(return_value);
+} /* }}} */
+
+/* {{{ proto string MongoDB\Driver\WriteConcern::serialize()
+*/
+static PHP_METHOD(WriteConcern, serialize)
+{
+ zend_error_handling error_handling;
+ php_phongo_writeconcern_t* intern;
+ zval retval;
+ php_serialize_data_t var_hash;
+ smart_str buf = { 0 };
+ const char* wtag;
+ int32_t w;
+ int64_t wtimeout;
+
+ intern = Z_WRITECONCERN_OBJ_P(getThis());
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters_none() == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ if (!intern->write_concern) {
+ return;
+ }
+
+ wtag = mongoc_write_concern_get_wtag(intern->write_concern);
+ w = mongoc_write_concern_get_w(intern->write_concern);
+ wtimeout = mongoc_write_concern_get_wtimeout_int64(intern->write_concern);
+
+ array_init_size(&retval, 3);
+
+ if (wtag) {
+ ADD_ASSOC_STRING(&retval, "w", wtag);
+ } else if (mongoc_write_concern_get_wmajority(intern->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(intern->write_concern)) {
+ ADD_ASSOC_BOOL_EX(&retval, "j", mongoc_write_concern_get_journal(intern->write_concern));
+ }
+
+ if (wtimeout != 0) {
+ if (wtimeout > INT32_MAX || wtimeout < INT32_MIN) {
+ ADD_ASSOC_INT64_AS_STRING(&retval, "wtimeout", wtimeout);
+ } else {
+ ADD_ASSOC_LONG_EX(&retval, "wtimeout", wtimeout);
+ }
+ }
+
+ PHP_VAR_SERIALIZE_INIT(var_hash);
+ php_var_serialize(&buf, &retval, &var_hash);
+ smart_str_0(&buf);
+ PHP_VAR_SERIALIZE_DESTROY(var_hash);
+
+ PHONGO_RETVAL_SMART_STR(buf);
+
+ smart_str_free(&buf);
+ zval_ptr_dtor(&retval);
+} /* }}} */
+
+/* {{{ proto void MongoDB\Driver\WriteConcern::unserialize(string $serialized)
+*/
+static PHP_METHOD(WriteConcern, unserialize)
+{
+ zend_error_handling error_handling;
+ php_phongo_writeconcern_t* intern;
+ char* serialized;
+ size_t serialized_len;
+ zval props;
+ php_unserialize_data_t var_hash;
+
+ intern = Z_WRITECONCERN_OBJ_P(getThis());
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &serialized, &serialized_len) == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ if (!serialized_len) {
+ return;
+ }
+
+ PHP_VAR_UNSERIALIZE_INIT(var_hash);
+ if (!php_var_unserialize(&props, (const unsigned char**) &serialized, (unsigned char*) serialized + serialized_len, &var_hash)) {
+ zval_ptr_dtor(&props);
+ phongo_throw_exception(PHONGO_ERROR_UNEXPECTED_VALUE, "%s unserialization failed", ZSTR_VAL(php_phongo_writeconcern_ce->name));
+
+ PHP_VAR_UNSERIALIZE_DESTROY(var_hash);
+ return;
+ }
+ PHP_VAR_UNSERIALIZE_DESTROY(var_hash);
+
+ php_phongo_writeconcern_init_from_hash(intern, HASH_OF(&props));
+ zval_ptr_dtor(&props);
+} /* }}} */
+
+/* {{{ MongoDB\Driver\WriteConcern function entries */
+ZEND_BEGIN_ARG_INFO_EX(ai_WriteConcern___construct, 0, 0, 1)
+ ZEND_ARG_INFO(0, w)
+ ZEND_ARG_INFO(0, wtimeout)
+ ZEND_ARG_INFO(0, journal)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(ai_WriteConcern___set_state, 0, 0, 1)
+ ZEND_ARG_ARRAY_INFO(0, properties, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(ai_WriteConcern_unserialize, 0, 0, 1)
+ ZEND_ARG_INFO(0, serialized)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(ai_WriteConcern_void, 0, 0, 0)
+ZEND_END_ARG_INFO()
+
+static zend_function_entry php_phongo_writeconcern_me[] = {
+ /* clang-format off */
+ PHP_ME(WriteConcern, __construct, ai_WriteConcern___construct, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
+ PHP_ME(WriteConcern, __set_state, ai_WriteConcern___set_state, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
+ PHP_ME(WriteConcern, getW, ai_WriteConcern_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
+ PHP_ME(WriteConcern, getWtimeout, ai_WriteConcern_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
+ PHP_ME(WriteConcern, getJournal, ai_WriteConcern_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
+ PHP_ME(WriteConcern, isDefault, ai_WriteConcern_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
+ PHP_ME(WriteConcern, bsonSerialize, ai_WriteConcern_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
+ PHP_ME(WriteConcern, serialize, ai_WriteConcern_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
+ PHP_ME(WriteConcern, unserialize, ai_WriteConcern_unserialize, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
+ PHP_FE_END
+ /* clang-format on */
+};
+/* }}} */
+
+/* {{{ MongoDB\Driver\WriteConcern object handlers */
+static zend_object_handlers php_phongo_handler_writeconcern;
+
+static void php_phongo_writeconcern_free_object(zend_object* object) /* {{{ */
+{
+ php_phongo_writeconcern_t* intern = Z_OBJ_WRITECONCERN(object);
+
+ zend_object_std_dtor(&intern->std);
+
+ if (intern->properties) {
+ zend_hash_destroy(intern->properties);
+ FREE_HASHTABLE(intern->properties);
+ }
+
+ if (intern->write_concern) {
+ mongoc_write_concern_destroy(intern->write_concern);
+ }
+} /* }}} */
+
+static zend_object* php_phongo_writeconcern_create_object(zend_class_entry* class_type) /* {{{ */
+{
+ php_phongo_writeconcern_t* intern = NULL;
+
+ intern = PHONGO_ALLOC_OBJECT_T(php_phongo_writeconcern_t, class_type);
+
+ zend_object_std_init(&intern->std, class_type);
+ object_properties_init(&intern->std, class_type);
+
+ intern->std.handlers = &php_phongo_handler_writeconcern;
+
+ return &intern->std;
+} /* }}} */
+
+static HashTable* php_phongo_writeconcern_get_debug_info(phongo_compat_object_handler_type* object, int* is_temp) /* {{{ */
+{
+ *is_temp = 1;
+ return php_phongo_write_concern_get_properties_hash(object, true, false);
+} /* }}} */
+
+static HashTable* php_phongo_writeconcern_get_properties(phongo_compat_object_handler_type* object) /* {{{ */
+{
+ return php_phongo_write_concern_get_properties_hash(object, false, false);
+} /* }}} */
+
+void php_phongo_writeconcern_init_ce(INIT_FUNC_ARGS) /* {{{ */
+{
+ zend_class_entry ce;
+
+ INIT_NS_CLASS_ENTRY(ce, "MongoDB\\Driver", "WriteConcern", php_phongo_writeconcern_me);
+ php_phongo_writeconcern_ce = zend_register_internal_class(&ce);
+ php_phongo_writeconcern_ce->create_object = php_phongo_writeconcern_create_object;
+ PHONGO_CE_FINAL(php_phongo_writeconcern_ce);
+
+ zend_class_implements(php_phongo_writeconcern_ce, 1, php_phongo_serializable_ce);
+ zend_class_implements(php_phongo_writeconcern_ce, 1, zend_ce_serializable);
+
+ memcpy(&php_phongo_handler_writeconcern, phongo_get_std_object_handlers(), sizeof(zend_object_handlers));
+ php_phongo_handler_writeconcern.get_debug_info = php_phongo_writeconcern_get_debug_info;
+ php_phongo_handler_writeconcern.get_properties = php_phongo_writeconcern_get_properties;
+ php_phongo_handler_writeconcern.free_obj = php_phongo_writeconcern_free_object;
+ php_phongo_handler_writeconcern.offset = XtOffsetOf(php_phongo_writeconcern_t, std);
+
+ zend_declare_class_constant_stringl(php_phongo_writeconcern_ce, ZEND_STRL("MAJORITY"), ZEND_STRL(PHONGO_WRITE_CONCERN_W_MAJORITY));
+} /* }}} */
+
+/*
+ * 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.9.0/src/MongoDB/WriteConcernError.c b/mongodb-1.9.0/src/MongoDB/WriteConcernError.c
new file mode 100644
index 00000000..52adc56a
--- /dev/null
+++ b/mongodb-1.9.0/src/MongoDB/WriteConcernError.c
@@ -0,0 +1,181 @@
+/*
+ * 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.
+ */
+
+#include <php.h>
+#include <Zend/zend_interfaces.h>
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "phongo_compat.h"
+#include "php_phongo.h"
+
+zend_class_entry* php_phongo_writeconcernerror_ce;
+
+/* {{{ proto integer MongoDB\Driver\WriteConcernError::getCode()
+ Returns the MongoDB error code */
+static PHP_METHOD(WriteConcernError, getCode)
+{
+ zend_error_handling error_handling;
+ php_phongo_writeconcernerror_t* intern;
+
+ intern = Z_WRITECONCERNERROR_OBJ_P(getThis());
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters_none() == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ RETURN_LONG(intern->code);
+} /* }}} */
+
+/* {{{ proto object|null MongoDB\Driver\WriteConcernError::getInfo()
+ Returns additional metadata for the error */
+static PHP_METHOD(WriteConcernError, getInfo)
+{
+ zend_error_handling error_handling;
+ php_phongo_writeconcernerror_t* intern;
+
+ intern = Z_WRITECONCERNERROR_OBJ_P(getThis());
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters_none() == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ if (!Z_ISUNDEF(intern->info)) {
+ RETURN_ZVAL(&intern->info, 1, 0);
+ }
+} /* }}} */
+
+/* {{{ proto string MongoDB\Driver\WriteConcernError::getMessage()
+ Returns the actual error message from the server */
+static PHP_METHOD(WriteConcernError, getMessage)
+{
+ zend_error_handling error_handling;
+ php_phongo_writeconcernerror_t* intern;
+
+ intern = Z_WRITECONCERNERROR_OBJ_P(getThis());
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters_none() == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ RETURN_STRING(intern->message);
+} /* }}} */
+
+/* {{{ MongoDB\Driver\WriteConcernError function entries */
+ZEND_BEGIN_ARG_INFO_EX(ai_WriteConcernError_void, 0, 0, 0)
+ZEND_END_ARG_INFO()
+
+static zend_function_entry php_phongo_writeconcernerror_me[] = {
+ /* clang-format off */
+ PHP_ME(WriteConcernError, getCode, ai_WriteConcernError_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
+ PHP_ME(WriteConcernError, getInfo, ai_WriteConcernError_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
+ PHP_ME(WriteConcernError, getMessage, ai_WriteConcernError_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
+ ZEND_NAMED_ME(__construct, PHP_FN(MongoDB_disabled___construct), ai_WriteConcernError_void, ZEND_ACC_PRIVATE | ZEND_ACC_FINAL)
+ ZEND_NAMED_ME(__wakeup, PHP_FN(MongoDB_disabled___wakeup), ai_WriteConcernError_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
+ PHP_FE_END
+ /* clang-format on */
+};
+/* }}} */
+
+/* {{{ MongoDB\Driver\WriteConcernError object handlers */
+static zend_object_handlers php_phongo_handler_writeconcernerror;
+
+static void php_phongo_writeconcernerror_free_object(zend_object* object) /* {{{ */
+{
+ php_phongo_writeconcernerror_t* intern = Z_OBJ_WRITECONCERNERROR(object);
+
+ zend_object_std_dtor(&intern->std);
+
+ if (intern->message) {
+ efree(intern->message);
+ }
+
+ if (!Z_ISUNDEF(intern->info)) {
+ zval_ptr_dtor(&intern->info);
+ }
+} /* }}} */
+
+static zend_object* php_phongo_writeconcernerror_create_object(zend_class_entry* class_type) /* {{{ */
+{
+ php_phongo_writeconcernerror_t* intern = NULL;
+
+ intern = PHONGO_ALLOC_OBJECT_T(php_phongo_writeconcernerror_t, class_type);
+
+ zend_object_std_init(&intern->std, class_type);
+ object_properties_init(&intern->std, class_type);
+
+ intern->std.handlers = &php_phongo_handler_writeconcernerror;
+
+ return &intern->std;
+} /* }}} */
+
+static HashTable* php_phongo_writeconcernerror_get_debug_info(phongo_compat_object_handler_type* object, int* is_temp) /* {{{ */
+{
+ php_phongo_writeconcernerror_t* intern;
+ zval retval = ZVAL_STATIC_INIT;
+
+ *is_temp = 1;
+ intern = Z_OBJ_WRITECONCERNERROR(PHONGO_COMPAT_GET_OBJ(object));
+
+ array_init_size(&retval, 3);
+ ADD_ASSOC_STRING(&retval, "message", intern->message);
+ ADD_ASSOC_LONG_EX(&retval, "code", intern->code);
+ if (!Z_ISUNDEF(intern->info)) {
+ Z_ADDREF(intern->info);
+ ADD_ASSOC_ZVAL_EX(&retval, "info", &intern->info);
+ } else {
+ ADD_ASSOC_NULL_EX(&retval, "info");
+ }
+
+ return Z_ARRVAL(retval);
+} /* }}} */
+/* }}} */
+
+void php_phongo_writeconcernerror_init_ce(INIT_FUNC_ARGS) /* {{{ */
+{
+ zend_class_entry ce;
+
+ INIT_NS_CLASS_ENTRY(ce, "MongoDB\\Driver", "WriteConcernError", php_phongo_writeconcernerror_me);
+ php_phongo_writeconcernerror_ce = zend_register_internal_class(&ce);
+ php_phongo_writeconcernerror_ce->create_object = php_phongo_writeconcernerror_create_object;
+ PHONGO_CE_FINAL(php_phongo_writeconcernerror_ce);
+ PHONGO_CE_DISABLE_SERIALIZATION(php_phongo_writeconcernerror_ce);
+
+ memcpy(&php_phongo_handler_writeconcernerror, phongo_get_std_object_handlers(), sizeof(zend_object_handlers));
+ php_phongo_handler_writeconcernerror.get_debug_info = php_phongo_writeconcernerror_get_debug_info;
+ php_phongo_handler_writeconcernerror.free_obj = php_phongo_writeconcernerror_free_object;
+ php_phongo_handler_writeconcernerror.offset = XtOffsetOf(php_phongo_writeconcernerror_t, std);
+} /* }}} */
+
+/*
+ * 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.9.0/src/MongoDB/WriteError.c b/mongodb-1.9.0/src/MongoDB/WriteError.c
new file mode 100644
index 00000000..b9191672
--- /dev/null
+++ b/mongodb-1.9.0/src/MongoDB/WriteError.c
@@ -0,0 +1,203 @@
+/*
+ * 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.
+ */
+
+#include <php.h>
+#include <Zend/zend_interfaces.h>
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "phongo_compat.h"
+#include "php_phongo.h"
+
+zend_class_entry* php_phongo_writeerror_ce;
+
+/* {{{ proto integer MongoDB\Driver\WriteError::getCode()
+ Returns the MongoDB error code */
+static PHP_METHOD(WriteError, getCode)
+{
+ zend_error_handling error_handling;
+ php_phongo_writeerror_t* intern;
+
+ intern = Z_WRITEERROR_OBJ_P(getThis());
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters_none() == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ RETURN_LONG(intern->code);
+} /* }}} */
+
+/* {{{ proto integer MongoDB\Driver\WriteError::getIndex()
+ Returns the index of the operation in the BulkWrite to which this WriteError
+ corresponds. */
+static PHP_METHOD(WriteError, getIndex)
+{
+ zend_error_handling error_handling;
+ php_phongo_writeerror_t* intern;
+
+ intern = Z_WRITEERROR_OBJ_P(getThis());
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters_none() == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ RETURN_LONG(intern->index);
+} /* }}} */
+
+/* {{{ proto string MongoDB\Driver\WriteError::getMessage()
+ Returns the actual error message from the server */
+static PHP_METHOD(WriteError, getMessage)
+{
+ zend_error_handling error_handling;
+ php_phongo_writeerror_t* intern;
+
+ intern = Z_WRITEERROR_OBJ_P(getThis());
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters_none() == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ RETURN_STRING(intern->message);
+} /* }}} */
+
+/* {{{ proto object|null MongoDB\Driver\WriteError::getInfo()
+ Returns additional metadata for the error */
+static PHP_METHOD(WriteError, getInfo)
+{
+ zend_error_handling error_handling;
+ php_phongo_writeerror_t* intern;
+
+ intern = Z_WRITEERROR_OBJ_P(getThis());
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters_none() == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ if (!Z_ISUNDEF(intern->info)) {
+ RETURN_ZVAL(&intern->info, 1, 0);
+ }
+} /* }}} */
+
+/* {{{ MongoDB\Driver\WriteError function entries */
+ZEND_BEGIN_ARG_INFO_EX(ai_WriteError_void, 0, 0, 0)
+ZEND_END_ARG_INFO()
+
+static zend_function_entry php_phongo_writeerror_me[] = {
+ /* clang-format off */
+ PHP_ME(WriteError, getCode, ai_WriteError_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
+ PHP_ME(WriteError, getIndex, ai_WriteError_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
+ PHP_ME(WriteError, getMessage, ai_WriteError_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
+ PHP_ME(WriteError, getInfo, ai_WriteError_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
+ ZEND_NAMED_ME(__construct, PHP_FN(MongoDB_disabled___construct), ai_WriteError_void, ZEND_ACC_PRIVATE | ZEND_ACC_FINAL)
+ ZEND_NAMED_ME(__wakeup, PHP_FN(MongoDB_disabled___wakeup), ai_WriteError_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
+ PHP_FE_END
+ /* clang-format on */
+};
+/* }}} */
+
+/* {{{ MongoDB\Driver\WriteError object handlers */
+static zend_object_handlers php_phongo_handler_writeerror;
+
+static void php_phongo_writeerror_free_object(zend_object* object) /* {{{ */
+{
+ php_phongo_writeerror_t* intern = Z_OBJ_WRITEERROR(object);
+
+ zend_object_std_dtor(&intern->std);
+
+ if (intern->message) {
+ efree(intern->message);
+ }
+
+ if (!Z_ISUNDEF(intern->info)) {
+ zval_ptr_dtor(&intern->info);
+ }
+} /* }}} */
+
+static zend_object* php_phongo_writeerror_create_object(zend_class_entry* class_type) /* {{{ */
+{
+ php_phongo_writeerror_t* intern = NULL;
+
+ intern = PHONGO_ALLOC_OBJECT_T(php_phongo_writeerror_t, class_type);
+
+ zend_object_std_init(&intern->std, class_type);
+ object_properties_init(&intern->std, class_type);
+
+ intern->std.handlers = &php_phongo_handler_writeerror;
+
+ return &intern->std;
+} /* }}} */
+
+static HashTable* php_phongo_writeerror_get_debug_info(phongo_compat_object_handler_type* object, int* is_temp) /* {{{ */
+{
+ php_phongo_writeerror_t* intern;
+ zval retval = ZVAL_STATIC_INIT;
+
+ *is_temp = 1;
+ intern = Z_OBJ_WRITEERROR(PHONGO_COMPAT_GET_OBJ(object));
+
+ array_init_size(&retval, 3);
+ ADD_ASSOC_STRING(&retval, "message", intern->message);
+ ADD_ASSOC_LONG_EX(&retval, "code", intern->code);
+ ADD_ASSOC_LONG_EX(&retval, "index", intern->index);
+ if (!Z_ISUNDEF(intern->info)) {
+ Z_ADDREF(intern->info);
+ ADD_ASSOC_ZVAL_EX(&retval, "info", &intern->info);
+ } else {
+ ADD_ASSOC_NULL_EX(&retval, "info");
+ }
+
+ return Z_ARRVAL(retval);
+} /* }}} */
+/* }}} */
+
+void php_phongo_writeerror_init_ce(INIT_FUNC_ARGS) /* {{{ */
+{
+ zend_class_entry ce;
+
+ INIT_NS_CLASS_ENTRY(ce, "MongoDB\\Driver", "WriteError", php_phongo_writeerror_me);
+ php_phongo_writeerror_ce = zend_register_internal_class(&ce);
+ php_phongo_writeerror_ce->create_object = php_phongo_writeerror_create_object;
+ PHONGO_CE_FINAL(php_phongo_writeerror_ce);
+ PHONGO_CE_DISABLE_SERIALIZATION(php_phongo_writeerror_ce);
+
+ memcpy(&php_phongo_handler_writeerror, phongo_get_std_object_handlers(), sizeof(zend_object_handlers));
+ php_phongo_handler_writeerror.get_debug_info = php_phongo_writeerror_get_debug_info;
+ php_phongo_handler_writeerror.free_obj = php_phongo_writeerror_free_object;
+ php_phongo_handler_writeerror.offset = XtOffsetOf(php_phongo_writeerror_t, std);
+} /* }}} */
+
+/*
+ * 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.9.0/src/MongoDB/WriteResult.c b/mongodb-1.9.0/src/MongoDB/WriteResult.c
new file mode 100644
index 00000000..111508f1
--- /dev/null
+++ b/mongodb-1.9.0/src/MongoDB/WriteResult.c
@@ -0,0 +1,481 @@
+/*
+ * 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.
+ */
+
+#include <php.h>
+#include <Zend/zend_interfaces.h>
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "php_array_api.h"
+#include "phongo_compat.h"
+#include "php_phongo.h"
+#include "php_bson.h"
+
+#define PHONGO_WRITERESULT_RETURN_LONG_FROM_BSON_INT32(iter, bson, key) \
+ if (bson_iter_init_find((iter), (bson), (key)) && BSON_ITER_HOLDS_INT32((iter))) { \
+ RETURN_LONG(bson_iter_int32((iter))); \
+ }
+
+zend_class_entry* php_phongo_writeresult_ce;
+
+static bool php_phongo_writeresult_get_writeconcernerror(php_phongo_writeresult_t* intern, zval* return_value) /* {{{ */
+{
+ bson_iter_t iter, child;
+ zval writeconcernerror;
+
+ ZVAL_NULL(return_value);
+
+ if (bson_iter_init_find(&iter, intern->reply, "writeConcernErrors") && BSON_ITER_HOLDS_ARRAY(&iter) && bson_iter_recurse(&iter, &child)) {
+ while (bson_iter_next(&child)) {
+ bson_t cbson;
+ uint32_t len;
+ const uint8_t* data;
+
+ if (!BSON_ITER_HOLDS_DOCUMENT(&child)) {
+ continue;
+ }
+
+ bson_iter_document(&child, &len, &data);
+
+ if (!bson_init_static(&cbson, data, len)) {
+ continue;
+ }
+
+ if (!phongo_writeconcernerror_init(&writeconcernerror, &cbson)) {
+ zval_ptr_dtor(&writeconcernerror);
+ return false;
+ }
+
+ ZVAL_ZVAL(return_value, &writeconcernerror, 1, 1);
+
+ return true;
+ }
+ }
+
+ return true;
+} /* }}} */
+
+static bool php_phongo_writeresult_get_writeerrors(php_phongo_writeresult_t* intern, zval* return_value) /* {{{ */
+{
+ bson_iter_t iter, child;
+
+ array_init(return_value);
+
+ if (bson_iter_init_find(&iter, intern->reply, "writeErrors") && BSON_ITER_HOLDS_ARRAY(&iter) && bson_iter_recurse(&iter, &child)) {
+ while (bson_iter_next(&child)) {
+ bson_t cbson;
+ uint32_t len;
+ const uint8_t* data;
+ zval writeerror;
+
+ if (!BSON_ITER_HOLDS_DOCUMENT(&child)) {
+ continue;
+ }
+
+ bson_iter_document(&child, &len, &data);
+
+ if (!bson_init_static(&cbson, data, len)) {
+ continue;
+ }
+
+ if (!phongo_writeerror_init(&writeerror, &cbson)) {
+ zval_ptr_dtor(&writeerror);
+ continue;
+ }
+
+ add_next_index_zval(return_value, &writeerror);
+ }
+ }
+
+ return true;
+} /* }}} */
+
+/* {{{ proto integer|null MongoDB\Driver\WriteResult::getInsertedCount()
+ Returns the number of documents that were inserted */
+static PHP_METHOD(WriteResult, getInsertedCount)
+{
+ zend_error_handling error_handling;
+ bson_iter_t iter;
+ php_phongo_writeresult_t* intern;
+
+ intern = Z_WRITERESULT_OBJ_P(getThis());
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters_none() == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ PHONGO_WRITERESULT_RETURN_LONG_FROM_BSON_INT32(&iter, intern->reply, "nInserted");
+} /* }}} */
+
+/* {{{ proto integer|null MongoDB\Driver\WriteResult::getMatchedCount()
+ Returns the number of documents that matched the update criteria */
+static PHP_METHOD(WriteResult, getMatchedCount)
+{
+ zend_error_handling error_handling;
+ bson_iter_t iter;
+ php_phongo_writeresult_t* intern;
+
+ intern = Z_WRITERESULT_OBJ_P(getThis());
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters_none() == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ PHONGO_WRITERESULT_RETURN_LONG_FROM_BSON_INT32(&iter, intern->reply, "nMatched");
+} /* }}} */
+
+/* {{{ proto integer|null MongoDB\Driver\WriteResult::getModifiedCount()
+ Returns the number of documents that were actually modified by an update */
+static PHP_METHOD(WriteResult, getModifiedCount)
+{
+ zend_error_handling error_handling;
+ bson_iter_t iter;
+ php_phongo_writeresult_t* intern;
+
+ intern = Z_WRITERESULT_OBJ_P(getThis());
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters_none() == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ PHONGO_WRITERESULT_RETURN_LONG_FROM_BSON_INT32(&iter, intern->reply, "nModified");
+} /* }}} */
+
+/* {{{ proto integer|null MongoDB\Driver\WriteResult::getDeletedCount()
+ Returns the number of documents that were deleted */
+static PHP_METHOD(WriteResult, getDeletedCount)
+{
+ zend_error_handling error_handling;
+ bson_iter_t iter;
+ php_phongo_writeresult_t* intern;
+
+ intern = Z_WRITERESULT_OBJ_P(getThis());
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters_none() == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ PHONGO_WRITERESULT_RETURN_LONG_FROM_BSON_INT32(&iter, intern->reply, "nRemoved");
+} /* }}} */
+
+/* {{{ proto integer|null MongoDB\Driver\WriteResult::getUpsertedCount()
+ Returns the number of documents that were upserted */
+static PHP_METHOD(WriteResult, getUpsertedCount)
+{
+ zend_error_handling error_handling;
+ bson_iter_t iter;
+ php_phongo_writeresult_t* intern;
+
+ intern = Z_WRITERESULT_OBJ_P(getThis());
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters_none() == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ PHONGO_WRITERESULT_RETURN_LONG_FROM_BSON_INT32(&iter, intern->reply, "nUpserted");
+} /* }}} */
+
+/* {{{ proto MongoDB\Driver\Server MongoDB\Driver\WriteResult::getServer()
+ Returns the Server from which the result originated */
+static PHP_METHOD(WriteResult, getServer)
+{
+ zend_error_handling error_handling;
+ php_phongo_writeresult_t* intern;
+
+ intern = Z_WRITERESULT_OBJ_P(getThis());
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters_none() == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ phongo_server_init(return_value, intern->client, intern->server_id);
+} /* }}} */
+
+/* {{{ proto array MongoDB\Driver\WriteResult::getUpsertedIds()
+ Returns the identifiers generated by the server for upsert operations. */
+static PHP_METHOD(WriteResult, getUpsertedIds)
+{
+ zend_error_handling error_handling;
+ bson_iter_t iter, child;
+ php_phongo_writeresult_t* intern;
+
+ intern = Z_WRITERESULT_OBJ_P(getThis());
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters_none() == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ array_init(return_value);
+
+ if (bson_iter_init_find(&iter, intern->reply, "upserted") && BSON_ITER_HOLDS_ARRAY(&iter) && bson_iter_recurse(&iter, &child)) {
+ while (bson_iter_next(&child)) {
+ uint32_t data_len;
+ const uint8_t* data = NULL;
+ php_phongo_bson_state state;
+
+ /* Use PHONGO_TYPEMAP_NATIVE_ARRAY for the root type so we can
+ * easily access the "index" and "_id" fields. */
+ PHONGO_BSON_INIT_STATE(state);
+ state.map.root_type = PHONGO_TYPEMAP_NATIVE_ARRAY;
+
+ if (!BSON_ITER_HOLDS_DOCUMENT(&child)) {
+ continue;
+ }
+
+ bson_iter_document(&child, &data_len, &data);
+
+ if (php_phongo_bson_to_zval_ex(data, data_len, &state)) {
+ zval* zid = php_array_fetchc(&state.zchild, "_id");
+ add_index_zval(return_value, php_array_fetchc_long(&state.zchild, "index"), zid);
+ zval_add_ref(zid);
+ }
+
+ zval_ptr_dtor(&state.zchild);
+ }
+ }
+} /* }}} */
+
+/* {{{ proto WriteConcernError MongoDB\Driver\WriteResult::getWriteConcernError()
+ Return any write concern error that occurred */
+static PHP_METHOD(WriteResult, getWriteConcernError)
+{
+ zend_error_handling error_handling;
+ php_phongo_writeresult_t* intern;
+
+ intern = Z_WRITERESULT_OBJ_P(getThis());
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters_none() == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ php_phongo_writeresult_get_writeconcernerror(intern, return_value);
+} /* }}} */
+
+/* {{{ proto WriteError[] MongoDB\Driver\WriteResult::getWriteErrors()
+ Returns any write errors that occurred */
+static PHP_METHOD(WriteResult, getWriteErrors)
+{
+ zend_error_handling error_handling;
+ php_phongo_writeresult_t* intern;
+
+ intern = Z_WRITERESULT_OBJ_P(getThis());
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters_none() == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ php_phongo_writeresult_get_writeerrors(intern, return_value);
+} /* }}} */
+
+/* {{{ proto boolean MongoDB\Driver\WriteResult::isAcknowledged()
+ Returns whether the write operation was acknowledged (based on the write
+ concern). */
+static PHP_METHOD(WriteResult, isAcknowledged)
+{
+ zend_error_handling error_handling;
+ php_phongo_writeresult_t* intern;
+
+ intern = Z_WRITERESULT_OBJ_P(getThis());
+
+ zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling);
+ if (zend_parse_parameters_none() == FAILURE) {
+ zend_restore_error_handling(&error_handling);
+ return;
+ }
+ zend_restore_error_handling(&error_handling);
+
+ RETURN_BOOL(mongoc_write_concern_is_acknowledged(intern->write_concern));
+} /* }}} */
+
+/* {{{ MongoDB\Driver\WriteResult function entries */
+ZEND_BEGIN_ARG_INFO_EX(ai_WriteResult_void, 0, 0, 0)
+ZEND_END_ARG_INFO()
+
+static zend_function_entry php_phongo_writeresult_me[] = {
+ /* clang-format off */
+ PHP_ME(WriteResult, getInsertedCount, ai_WriteResult_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
+ PHP_ME(WriteResult, getMatchedCount, ai_WriteResult_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
+ PHP_ME(WriteResult, getModifiedCount, ai_WriteResult_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
+ PHP_ME(WriteResult, getDeletedCount, ai_WriteResult_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
+ PHP_ME(WriteResult, getUpsertedCount, ai_WriteResult_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
+ PHP_ME(WriteResult, getServer, ai_WriteResult_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
+ PHP_ME(WriteResult, getUpsertedIds, ai_WriteResult_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
+ PHP_ME(WriteResult, getWriteConcernError, ai_WriteResult_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
+ PHP_ME(WriteResult, getWriteErrors, ai_WriteResult_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
+ PHP_ME(WriteResult, isAcknowledged, ai_WriteResult_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
+ ZEND_NAMED_ME(__construct, PHP_FN(MongoDB_disabled___construct), ai_WriteResult_void, ZEND_ACC_PRIVATE | ZEND_ACC_FINAL)
+ ZEND_NAMED_ME(__wakeup, PHP_FN(MongoDB_disabled___wakeup), ai_WriteResult_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL)
+ PHP_FE_END
+ /* clang-format on */
+};
+/* }}} */
+
+/* {{{ MongoDB\Driver\WriteResult object handlers */
+static zend_object_handlers php_phongo_handler_writeresult;
+
+static void php_phongo_writeresult_free_object(zend_object* object) /* {{{ */
+{
+ php_phongo_writeresult_t* intern = Z_OBJ_WRITERESULT(object);
+
+ zend_object_std_dtor(&intern->std);
+
+ if (intern->reply) {
+ bson_destroy(intern->reply);
+ }
+
+ if (intern->write_concern) {
+ mongoc_write_concern_destroy(intern->write_concern);
+ }
+} /* }}} */
+
+static zend_object* php_phongo_writeresult_create_object(zend_class_entry* class_type) /* {{{ */
+{
+ php_phongo_writeresult_t* intern = NULL;
+
+ intern = PHONGO_ALLOC_OBJECT_T(php_phongo_writeresult_t, class_type);
+
+ zend_object_std_init(&intern->std, class_type);
+ object_properties_init(&intern->std, class_type);
+
+ intern->std.handlers = &php_phongo_handler_writeresult;
+
+ return &intern->std;
+} /* }}} */
+
+static HashTable* php_phongo_writeresult_get_debug_info(phongo_compat_object_handler_type* object, int* is_temp) /* {{{ */
+{
+ php_phongo_writeresult_t* intern;
+ zval retval = ZVAL_STATIC_INIT;
+ bson_iter_t iter;
+
+ intern = Z_OBJ_WRITERESULT(PHONGO_COMPAT_GET_OBJ(object));
+ *is_temp = 1;
+ array_init_size(&retval, 9);
+
+#define PHONGO_WRITERESULT_SCP(field) \
+ if (bson_iter_init_find(&iter, intern->reply, (field)) && BSON_ITER_HOLDS_INT32(&iter)) { \
+ ADD_ASSOC_LONG_EX(&retval, (field), bson_iter_int32(&iter)); \
+ } else { \
+ ADD_ASSOC_NULL_EX(&retval, (field)); \
+ }
+
+ PHONGO_WRITERESULT_SCP("nInserted");
+ PHONGO_WRITERESULT_SCP("nMatched");
+ PHONGO_WRITERESULT_SCP("nModified");
+ PHONGO_WRITERESULT_SCP("nRemoved");
+ PHONGO_WRITERESULT_SCP("nUpserted");
+#undef PHONGO_WRITERESULT_SCP
+
+ if (bson_iter_init_find(&iter, intern->reply, "upserted") && BSON_ITER_HOLDS_ARRAY(&iter)) {
+ uint32_t len;
+ const uint8_t* data;
+ php_phongo_bson_state state;
+
+ PHONGO_BSON_INIT_DEBUG_STATE(state);
+ bson_iter_array(&iter, &len, &data);
+ if (!php_phongo_bson_to_zval_ex(data, len, &state)) {
+ zval_ptr_dtor(&state.zchild);
+ goto done;
+ }
+
+ ADD_ASSOC_ZVAL_EX(&retval, "upsertedIds", &state.zchild);
+ } else {
+ zval upsertedIds;
+ array_init(&upsertedIds);
+ ADD_ASSOC_ZVAL_EX(&retval, "upsertedIds", &upsertedIds);
+ }
+
+ {
+ zval writeerrors;
+
+ php_phongo_writeresult_get_writeerrors(intern, &writeerrors);
+ ADD_ASSOC_ZVAL_EX(&retval, "writeErrors", &writeerrors);
+ }
+
+ {
+ zval writeconcernerror;
+
+ php_phongo_writeresult_get_writeconcernerror(intern, &writeconcernerror);
+ ADD_ASSOC_ZVAL_EX(&retval, "writeConcernError", &writeconcernerror);
+ }
+
+ if (intern->write_concern) {
+ zval write_concern;
+
+ phongo_writeconcern_init(&write_concern, intern->write_concern);
+ ADD_ASSOC_ZVAL_EX(&retval, "writeConcern", &write_concern);
+ } else {
+ ADD_ASSOC_NULL_EX(&retval, "writeConcern");
+ }
+
+done:
+ return Z_ARRVAL(retval);
+} /* }}} */
+/* }}} */
+
+void php_phongo_writeresult_init_ce(INIT_FUNC_ARGS) /* {{{ */
+{
+ zend_class_entry ce;
+
+ INIT_NS_CLASS_ENTRY(ce, "MongoDB\\Driver", "WriteResult", php_phongo_writeresult_me);
+ php_phongo_writeresult_ce = zend_register_internal_class(&ce);
+ php_phongo_writeresult_ce->create_object = php_phongo_writeresult_create_object;
+ PHONGO_CE_FINAL(php_phongo_writeresult_ce);
+ PHONGO_CE_DISABLE_SERIALIZATION(php_phongo_writeresult_ce);
+
+ memcpy(&php_phongo_handler_writeresult, phongo_get_std_object_handlers(), sizeof(zend_object_handlers));
+ php_phongo_handler_writeresult.get_debug_info = php_phongo_writeresult_get_debug_info;
+ php_phongo_handler_writeresult.free_obj = php_phongo_writeresult_free_object;
+ php_phongo_handler_writeresult.offset = XtOffsetOf(php_phongo_writeresult_t, std);
+} /* }}} */
+
+/*
+ * 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.9.0/src/bson-encode.c b/mongodb-1.9.0/src/bson-encode.c
new file mode 100644
index 00000000..5769cb19
--- /dev/null
+++ b/mongodb-1.9.0/src/bson-encode.c
@@ -0,0 +1,530 @@
+/*
+ * 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.
+ */
+
+#include <bson/bson.h>
+
+#include <php.h>
+#include <Zend/zend_hash.h>
+#include <Zend/zend_interfaces.h>
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "php_phongo.h"
+#include "php_bson.h"
+#include "phongo_compat.h"
+
+#if SIZEOF_ZEND_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_ZEND_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"
+
+/* Forwards declarations */
+static void php_phongo_zval_to_bson_internal(zval* data, php_phongo_field_path* field_path, php_phongo_bson_flags_t flags, bson_t* bson, bson_t** bson_out);
+
+/* Determines whether the argument should be serialized as a BSON array or
+ * document. IS_ARRAY is returned if the argument's keys are a sequence of
+ * integers starting at zero; otherwise, IS_OBJECT is returned. */
+static int php_phongo_is_array_or_document(zval* val) /* {{{ */
+{
+ 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) {
+ 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 {
+ return Z_TYPE_P(val);
+ }
+
+ return IS_ARRAY;
+} /* }}} */
+
+/* Appends the array or object argument to the BSON document. If the object is
+ * an instance of MongoDB\BSON\Serializable, the return value of bsonSerialize()
+ * will be appended as an embedded document. Other MongoDB\BSON\Type instances
+ * will be appended as the appropriate BSON type. Other array or object values
+ * will be appended as an embedded document. */
+static void php_phongo_bson_append_object(bson_t* bson, php_phongo_field_path* field_path, php_phongo_bson_flags_t flags, const char* key, long key_len, zval* object) /* {{{ */
+{
+ if (Z_TYPE_P(object) == IS_OBJECT && instanceof_function(Z_OBJCE_P(object), php_phongo_cursorid_ce)) {
+ bson_append_int64(bson, key, key_len, Z_CURSORID_OBJ_P(object)->id);
+ return;
+ }
+
+ if (Z_TYPE_P(object) == IS_OBJECT && instanceof_function(Z_OBJCE_P(object), php_phongo_type_ce)) {
+ if (instanceof_function(Z_OBJCE_P(object), php_phongo_serializable_ce)) {
+ zval obj_data;
+ bson_t child;
+
+ zend_call_method_with_0_params(PHONGO_COMPAT_OBJ_P(object), NULL, NULL, BSON_SERIALIZE_FUNC_NAME, &obj_data);
+
+ if (Z_ISUNDEF(obj_data)) {
+ /* zend_call_method() failed or bsonSerialize() threw an
+ * exception. Either way, there is nothing else to do. */
+ return;
+ }
+
+ if (Z_TYPE(obj_data) != IS_ARRAY && !(Z_TYPE(obj_data) == IS_OBJECT && instanceof_function(Z_OBJCE(obj_data), zend_standard_class_def))) {
+ phongo_throw_exception(PHONGO_ERROR_UNEXPECTED_VALUE,
+ "Expected %s::%s() to return an array or stdClass, %s given",
+ ZSTR_VAL(Z_OBJCE_P(object)->name),
+ BSON_SERIALIZE_FUNC_NAME,
+ PHONGO_ZVAL_CLASS_OR_TYPE_NAME(obj_data));
+ zval_ptr_dtor(&obj_data);
+
+ return;
+ }
+
+ /* Persistable objects must always be serialized as BSON documents;
+ * otherwise, infer based on bsonSerialize()'s return value. */
+ if (instanceof_function(Z_OBJCE_P(object), php_phongo_persistable_ce) || php_phongo_is_array_or_document(&obj_data) == IS_OBJECT) {
+ bson_append_document_begin(bson, key, key_len, &child);
+ if (instanceof_function(Z_OBJCE_P(object), php_phongo_persistable_ce)) {
+ 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);
+ }
+ php_phongo_zval_to_bson_internal(&obj_data, field_path, flags, &child, NULL);
+ bson_append_document_end(bson, &child);
+ } else {
+ bson_append_array_begin(bson, key, key_len, &child);
+ php_phongo_zval_to_bson_internal(&obj_data, field_path, flags, &child, NULL);
+ bson_append_array_end(bson, &child);
+ }
+
+ zval_ptr_dtor(&obj_data);
+ return;
+ }
+
+ if (instanceof_function(Z_OBJCE_P(object), php_phongo_objectid_ce)) {
+ bson_oid_t oid;
+ php_phongo_objectid_t* intern = Z_OBJECTID_OBJ_P(object);
+
+ mongoc_log(MONGOC_LOG_LEVEL_TRACE, MONGOC_LOG_DOMAIN, "encoding ObjectId");
+ bson_oid_init_from_string(&oid, intern->oid);
+ bson_append_oid(bson, key, key_len, &oid);
+ return;
+ }
+ if (instanceof_function(Z_OBJCE_P(object), php_phongo_utcdatetime_ce)) {
+ php_phongo_utcdatetime_t* intern = Z_UTCDATETIME_OBJ_P(object);
+
+ mongoc_log(MONGOC_LOG_LEVEL_TRACE, MONGOC_LOG_DOMAIN, "encoding UTCDateTime");
+ bson_append_date_time(bson, key, key_len, intern->milliseconds);
+ return;
+ }
+ if (instanceof_function(Z_OBJCE_P(object), php_phongo_binary_ce)) {
+ php_phongo_binary_t* intern = Z_BINARY_OBJ_P(object);
+
+ mongoc_log(MONGOC_LOG_LEVEL_TRACE, MONGOC_LOG_DOMAIN, "encoding Binary");
+ bson_append_binary(bson, key, key_len, intern->type, (const uint8_t*) intern->data, (uint32_t) intern->data_len);
+ return;
+ }
+ if (instanceof_function(Z_OBJCE_P(object), php_phongo_decimal128_ce)) {
+ php_phongo_decimal128_t* intern = Z_DECIMAL128_OBJ_P(object);
+
+ mongoc_log(MONGOC_LOG_LEVEL_TRACE, MONGOC_LOG_DOMAIN, "encoding Decimal128");
+ bson_append_decimal128(bson, key, key_len, &intern->decimal);
+ return;
+ }
+ if (instanceof_function(Z_OBJCE_P(object), php_phongo_int64_ce)) {
+ php_phongo_int64_t* intern = Z_INT64_OBJ_P(object);
+
+ mongoc_log(MONGOC_LOG_LEVEL_TRACE, MONGOC_LOG_DOMAIN, "encoding Int64");
+ bson_append_int64(bson, key, key_len, intern->integer);
+ return;
+ }
+ if (instanceof_function(Z_OBJCE_P(object), php_phongo_regex_ce)) {
+ php_phongo_regex_t* intern = Z_REGEX_OBJ_P(object);
+
+ mongoc_log(MONGOC_LOG_LEVEL_TRACE, MONGOC_LOG_DOMAIN, "encoding Regex");
+ bson_append_regex(bson, key, key_len, intern->pattern, intern->flags);
+ return;
+ }
+ if (instanceof_function(Z_OBJCE_P(object), php_phongo_javascript_ce)) {
+ php_phongo_javascript_t* intern = Z_JAVASCRIPT_OBJ_P(object);
+
+ if (intern->scope) {
+ mongoc_log(MONGOC_LOG_LEVEL_TRACE, MONGOC_LOG_DOMAIN, "encoding Javascript with scope");
+ bson_append_code_with_scope(bson, key, key_len, intern->code, intern->scope);
+ } else {
+ mongoc_log(MONGOC_LOG_LEVEL_TRACE, MONGOC_LOG_DOMAIN, "encoding Javascript without scope");
+ bson_append_code(bson, key, key_len, intern->code);
+ }
+ return;
+ }
+ if (instanceof_function(Z_OBJCE_P(object), php_phongo_timestamp_ce)) {
+ php_phongo_timestamp_t* intern = Z_TIMESTAMP_OBJ_P(object);
+
+ mongoc_log(MONGOC_LOG_LEVEL_TRACE, MONGOC_LOG_DOMAIN, "encoding Timestamp");
+ bson_append_timestamp(bson, key, key_len, intern->timestamp, intern->increment);
+ return;
+ }
+ if (instanceof_function(Z_OBJCE_P(object), php_phongo_maxkey_ce)) {
+ 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)) {
+ mongoc_log(MONGOC_LOG_LEVEL_TRACE, MONGOC_LOG_DOMAIN, "encoding MinKey");
+ bson_append_minkey(bson, key, key_len);
+ return;
+ }
+
+ /* Deprecated types */
+ if (instanceof_function(Z_OBJCE_P(object), php_phongo_dbpointer_ce)) {
+ bson_oid_t oid;
+ php_phongo_dbpointer_t* intern = Z_DBPOINTER_OBJ_P(object);
+
+ mongoc_log(MONGOC_LOG_LEVEL_TRACE, MONGOC_LOG_DOMAIN, "encoding DBPointer");
+ bson_oid_init_from_string(&oid, intern->id);
+ bson_append_dbpointer(bson, key, key_len, intern->ref, &oid);
+ return;
+ }
+ if (instanceof_function(Z_OBJCE_P(object), php_phongo_symbol_ce)) {
+ php_phongo_symbol_t* intern = Z_SYMBOL_OBJ_P(object);
+
+ mongoc_log(MONGOC_LOG_LEVEL_TRACE, MONGOC_LOG_DOMAIN, "encoding Symbol");
+ bson_append_symbol(bson, key, key_len, intern->symbol, intern->symbol_len);
+ return;
+ }
+ if (instanceof_function(Z_OBJCE_P(object), php_phongo_undefined_ce)) {
+ mongoc_log(MONGOC_LOG_LEVEL_TRACE, MONGOC_LOG_DOMAIN, "encoding Undefined");
+ bson_append_undefined(bson, key, key_len);
+ return;
+ }
+
+ phongo_throw_exception(PHONGO_ERROR_UNEXPECTED_VALUE, "Unexpected %s instance: %s", ZSTR_VAL(php_phongo_type_ce->name), ZSTR_VAL(Z_OBJCE_P(object)->name));
+ return;
+ } else {
+ bson_t child;
+
+ mongoc_log(MONGOC_LOG_LEVEL_TRACE, MONGOC_LOG_DOMAIN, "encoding document");
+ bson_append_document_begin(bson, key, key_len, &child);
+ php_phongo_zval_to_bson_internal(object, field_path, flags, &child, NULL);
+ bson_append_document_end(bson, &child);
+ }
+} /* }}} */
+
+/* Appends the zval argument to the BSON document. If the argument is an object,
+ * or an array that should be serialized as an embedded document, this function
+ * will defer to php_phongo_bson_append_object(). */
+static void php_phongo_bson_append(bson_t* bson, php_phongo_field_path* field_path, php_phongo_bson_flags_t flags, const char* key, long key_len, zval* entry) /* {{{ */
+{
+ php_phongo_field_path_write_item_at_current_level(field_path, key);
+
+try_again:
+ switch (Z_TYPE_P(entry)) {
+ case IS_NULL:
+ bson_append_null(bson, key, key_len);
+ break;
+ case IS_TRUE:
+ bson_append_bool(bson, key, key_len, true);
+ break;
+
+ case IS_FALSE:
+ bson_append_bool(bson, key, key_len, false);
+ break;
+
+ 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 {
+ char* path_string = php_phongo_field_path_as_string(field_path);
+ phongo_throw_exception(PHONGO_ERROR_UNEXPECTED_VALUE, "Detected invalid UTF-8 for field path \"%s\": %s", path_string, Z_STRVAL_P(entry));
+ efree(path_string);
+ }
+ break;
+
+ case IS_ARRAY:
+ if (php_phongo_is_array_or_document(entry) == IS_ARRAY) {
+ bson_t child;
+ HashTable* tmp_ht = HASH_OF(entry);
+
+ if (!php_phongo_zend_hash_apply_protection_begin(tmp_ht)) {
+ char* path_string = php_phongo_field_path_as_string(field_path);
+ phongo_throw_exception(PHONGO_ERROR_UNEXPECTED_VALUE, "Detected recursion for field path \"%s\"", path_string);
+ efree(path_string);
+ break;
+ }
+
+ bson_append_array_begin(bson, key, key_len, &child);
+ php_phongo_field_path_write_type_at_current_level(field_path, PHONGO_FIELD_PATH_ITEM_ARRAY);
+ field_path->size++;
+ php_phongo_zval_to_bson_internal(entry, field_path, flags, &child, NULL);
+ field_path->size--;
+ bson_append_array_end(bson, &child);
+
+ php_phongo_zend_hash_apply_protection_end(tmp_ht);
+ break;
+ }
+ PHONGO_BREAK_INTENTIONALLY_MISSING
+
+ case IS_OBJECT: {
+ HashTable* tmp_ht = HASH_OF(entry);
+
+ if (!php_phongo_zend_hash_apply_protection_begin(tmp_ht)) {
+ char* path_string = php_phongo_field_path_as_string(field_path);
+ phongo_throw_exception(PHONGO_ERROR_UNEXPECTED_VALUE, "Detected recursion for field path \"%s\"", path_string);
+ efree(path_string);
+ break;
+ }
+
+ php_phongo_field_path_write_type_at_current_level(field_path, PHONGO_FIELD_PATH_ITEM_DOCUMENT);
+ field_path->size++;
+ php_phongo_bson_append_object(bson, field_path, flags, key, key_len, entry);
+ field_path->size--;
+
+ php_phongo_zend_hash_apply_protection_end(tmp_ht);
+ break;
+ }
+
+ case IS_REFERENCE:
+ ZVAL_DEREF(entry);
+ goto try_again;
+
+ default: {
+ char* path_string = php_phongo_field_path_as_string(field_path);
+ phongo_throw_exception(PHONGO_ERROR_UNEXPECTED_VALUE, "Detected unsupported PHP type for field path \"%s\": %d (%s)", path_string, Z_TYPE_P(entry), zend_get_type_by_const(Z_TYPE_P(entry)));
+ efree(path_string);
+ }
+ }
+} /* }}} */
+
+static void php_phongo_zval_to_bson_internal(zval* data, php_phongo_field_path* field_path, php_phongo_bson_flags_t flags, bson_t* bson, bson_t** bson_out) /* {{{ */
+{
+ HashTable* ht_data = NULL;
+ zval obj_data;
+
+ /* 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;
+
+ /* If the object is an instance of MongoDB\BSON\Persistable, we will need to
+ * inject the PHP class name as a BSON key and ignore any existing key in
+ * the return value of bsonSerialize(). */
+ bool skip_odm_field = false;
+
+ ZVAL_UNDEF(&obj_data);
+
+ switch (Z_TYPE_P(data)) {
+ case IS_OBJECT:
+ if (instanceof_function(Z_OBJCE_P(data), php_phongo_serializable_ce)) {
+ zend_call_method_with_0_params(PHONGO_COMPAT_OBJ_P(data), NULL, NULL, BSON_SERIALIZE_FUNC_NAME, &obj_data);
+
+ if (Z_ISUNDEF(obj_data)) {
+ /* zend_call_method() failed or bsonSerialize() threw an
+ * exception. Either way, there is nothing else to do. */
+ return;
+ }
+
+ if (Z_TYPE(obj_data) != IS_ARRAY && !(Z_TYPE(obj_data) == IS_OBJECT && instanceof_function(Z_OBJCE(obj_data), zend_standard_class_def))) {
+ phongo_throw_exception(
+ PHONGO_ERROR_UNEXPECTED_VALUE,
+ "Expected %s::%s() to return an array or stdClass, %s given",
+ ZSTR_VAL(Z_OBJCE_P(data)->name),
+ BSON_SERIALIZE_FUNC_NAME,
+ PHONGO_ZVAL_CLASS_OR_TYPE_NAME(obj_data));
+
+ goto cleanup;
+ }
+
+ ht_data = HASH_OF(&obj_data);
+
+ if (instanceof_function(Z_OBJCE_P(data), php_phongo_persistable_ce)) {
+ 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);
+ /* Ensure that we ignore an existing key with the same name
+ * if one exists in the bsonSerialize() return value. */
+ skip_odm_field = true;
+ }
+
+ break;
+ }
+
+ if (instanceof_function(Z_OBJCE_P(data), php_phongo_type_ce)) {
+ phongo_throw_exception(PHONGO_ERROR_UNEXPECTED_VALUE, "%s instance %s cannot be serialized as a root element", ZSTR_VAL(php_phongo_type_ce->name), ZSTR_VAL(Z_OBJCE_P(data)->name));
+ return;
+ }
+
+ ht_data = Z_OBJ_HT_P(data)->get_properties(PHONGO_COMPAT_OBJ_P(data));
+ ht_data_from_properties = true;
+ break;
+
+ case IS_ARRAY:
+ ht_data = HASH_OF(data);
+ break;
+
+ default:
+ return;
+ }
+
+ {
+ zend_string* string_key = NULL;
+ zend_ulong num_key = 0;
+ zval* value;
+
+ ZEND_HASH_FOREACH_KEY_VAL_IND(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) {
+ continue;
+ }
+ }
+
+ if (strlen(ZSTR_VAL(string_key)) != ZSTR_LEN(string_key)) {
+ phongo_throw_exception(PHONGO_ERROR_UNEXPECTED_VALUE, "BSON keys cannot contain null bytes. Unexpected null byte after \"%s\".", ZSTR_VAL(string_key));
+
+ goto cleanup;
+ }
+
+ if (skip_odm_field && !strcmp(ZSTR_VAL(string_key), PHONGO_ODM_FIELD_NAME)) {
+ continue;
+ }
+
+ 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);
+ }
+
+ php_phongo_bson_append(bson, field_path, flags & ~PHONGO_BSON_ADD_ID, ZSTR_VAL(string_key), strlen(ZSTR_VAL(string_key)), value);
+
+ zend_string_release(string_key);
+ }
+ ZEND_HASH_FOREACH_END();
+ }
+
+ 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 && bson_out) {
+ bson_iter_t iter;
+
+ *bson_out = bson_new();
+
+ if (bson_iter_init_find(&iter, bson, "_id") && !bson_append_iter(*bson_out, NULL, 0, &iter)) {
+ /* This should not be able to happen since we are copying from
+ * within a valid bson_t. */
+ phongo_throw_exception(PHONGO_ERROR_UNEXPECTED_VALUE, "Error copying \"_id\" field from encoded document");
+
+ goto cleanup;
+ }
+ }
+
+cleanup:
+ if (!Z_ISUNDEF(obj_data)) {
+ zval_ptr_dtor(&obj_data);
+ }
+} /* }}} */
+
+/* Converts the array or object argument to a BSON document. If the object is an
+ * instance of MongoDB\BSON\Serializable, the return value of bsonSerialize()
+ * will be used. */
+void php_phongo_zval_to_bson(zval* data, php_phongo_bson_flags_t flags, bson_t* bson, bson_t** bson_out) /* {{{ */
+{
+ php_phongo_field_path* field_path = php_phongo_field_path_alloc(false);
+
+ php_phongo_zval_to_bson_internal(data, field_path, flags, bson, bson_out);
+
+ php_phongo_field_path_free(field_path);
+} /* }}} */
+
+/* Converts the argument to a bson_value_t. If the object is an instance of
+ * MongoDB\BSON\Serializable, the return value of bsonSerialize() will be
+ * used. */
+void php_phongo_zval_to_bson_value(zval* data, php_phongo_bson_flags_t flags, bson_value_t* value) /* {{{ */
+{
+ bson_iter_t iter;
+ bson_t bson = BSON_INITIALIZER;
+
+ zval* data_object = ecalloc(sizeof(zval), 1);
+
+ array_init_size(data_object, 1);
+ add_assoc_zval(data_object, "data", data);
+
+ Z_TRY_ADDREF_P(data);
+
+ php_phongo_zval_to_bson(data_object, flags, &bson, NULL);
+
+ if (bson_iter_init_find(&iter, &bson, "data")) {
+ bson_value_copy(bson_iter_value(&iter), value);
+ }
+
+ zval_ptr_dtor(data_object);
+ efree(data_object);
+} /* }}} */
+
+/*
+ * 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.9.0/src/bson.c b/mongodb-1.9.0/src/bson.c
new file mode 100644
index 00000000..95388278
--- /dev/null
+++ b/mongodb-1.9.0/src/bson.c
@@ -0,0 +1,1378 @@
+/*
+ * 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.
+ */
+
+#include <bson/bson.h>
+
+#include <php.h>
+#include <Zend/zend_hash.h>
+#include <Zend/zend_interfaces.h>
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "php_phongo.h"
+#include "php_bson.h"
+#include "phongo_compat.h"
+#include "php_array_api.h"
+
+#define DEBUG 0
+
+#undef MONGOC_LOG_DOMAIN
+#define MONGOC_LOG_DOMAIN "PHONGO-BSON"
+
+#define PHONGO_IS_CLASS_INSTANTIATABLE(ce) \
+ (!(ce->ce_flags & (ZEND_ACC_INTERFACE | ZEND_ACC_IMPLICIT_ABSTRACT_CLASS | ZEND_ACC_EXPLICIT_ABSTRACT_CLASS)))
+
+#define PHONGO_BSON_STATE_ZCHILD(state) (&((php_phongo_bson_state*) (state))->zchild)
+
+#define PHONGO_FIELD_PATH_EXPANSION 8
+
+/* Forward declarations */
+static bool php_phongo_bson_visit_document(const bson_iter_t* iter ARG_UNUSED, const char* key, const bson_t* v_document, void* data);
+static bool php_phongo_bson_visit_array(const bson_iter_t* iter ARG_UNUSED, const char* key, const bson_t* v_document, void* data);
+
+/* Path builder */
+char* php_phongo_field_path_as_string(php_phongo_field_path* field_path)
+{
+ size_t length = 1; /* NULL character */
+ size_t i;
+ char* path;
+ char* ptr;
+
+ if (!field_path) {
+ return estrdup("");
+ }
+ if (!field_path->elements) {
+ return estrdup("");
+ }
+
+ for (i = 0; i <= field_path->size; i++) {
+ if (!field_path->elements[i]) {
+ continue;
+ }
+ length += (1 + strlen(field_path->elements[i]));
+ }
+
+ path = emalloc(length);
+ ptr = path;
+
+ for (i = 0; i <= field_path->size; i++) {
+ if (!field_path->elements[i]) {
+ continue;
+ }
+ strcpy(ptr, field_path->elements[i]);
+ ptr += strlen(field_path->elements[i]);
+ ptr[0] = '.';
+ ptr++;
+ }
+ ptr[-1] = '\0';
+
+ return path;
+}
+
+php_phongo_field_path* php_phongo_field_path_alloc(bool owns_elements)
+{
+ php_phongo_field_path* tmp = ecalloc(1, sizeof(php_phongo_field_path));
+ tmp->ref_count = 1;
+ tmp->owns_elements = owns_elements;
+
+ return tmp;
+}
+
+void php_phongo_field_path_free(php_phongo_field_path* field_path)
+{
+ if (field_path->owns_elements) {
+ size_t i;
+
+ for (i = 0; i < field_path->size; i++) {
+ efree(field_path->elements[i]);
+ }
+ }
+ if (field_path->elements) {
+ efree(field_path->elements);
+ }
+ if (field_path->element_types) {
+ efree(field_path->element_types);
+ }
+ efree(field_path);
+}
+
+static void php_phongo_field_path_ensure_allocation(php_phongo_field_path* field_path, size_t level)
+{
+ if (level >= field_path->allocated_size) {
+ size_t i;
+
+ field_path->allocated_size = field_path->size + PHONGO_FIELD_PATH_EXPANSION;
+ field_path->elements = erealloc(field_path->elements, sizeof(char*) * field_path->allocated_size);
+ field_path->element_types = erealloc(field_path->element_types, sizeof(php_phongo_bson_field_path_item_types) * field_path->allocated_size);
+
+ for (i = level; i < field_path->allocated_size; i++) {
+ field_path->elements[i] = NULL;
+ field_path->element_types[i] = PHONGO_FIELD_PATH_ITEM_NONE;
+ }
+ }
+}
+
+void php_phongo_field_path_write_item_at_current_level(php_phongo_field_path* field_path, const char* element)
+{
+ php_phongo_field_path_ensure_allocation(field_path, field_path->size);
+
+ if (field_path->owns_elements) {
+ field_path->elements[field_path->size] = estrdup(element);
+ } else {
+ field_path->elements[field_path->size] = (char*) element;
+ }
+}
+
+void php_phongo_field_path_write_type_at_current_level(php_phongo_field_path* field_path, php_phongo_bson_field_path_item_types element_type)
+{
+ php_phongo_field_path_ensure_allocation(field_path, field_path->size);
+
+ field_path->element_types[field_path->size] = element_type;
+}
+
+bool php_phongo_field_path_push(php_phongo_field_path* field_path, const char* element, php_phongo_bson_field_path_item_types element_type)
+{
+ php_phongo_field_path_write_item_at_current_level(field_path, element);
+ php_phongo_field_path_write_type_at_current_level(field_path, element_type);
+
+ field_path->size++;
+
+ return true;
+}
+
+bool php_phongo_field_path_pop(php_phongo_field_path* field_path)
+{
+ php_phongo_field_path_ensure_allocation(field_path, field_path->size);
+
+ field_path->elements[field_path->size] = NULL;
+ field_path->element_types[field_path->size] = PHONGO_FIELD_PATH_ITEM_NONE;
+
+ field_path->size--;
+
+ field_path->elements[field_path->size] = NULL;
+ field_path->element_types[field_path->size] = PHONGO_FIELD_PATH_ITEM_NONE;
+
+ return true;
+}
+
+inline static bool php_phongo_bson_state_is_initialized(php_phongo_bson_state* state)
+{
+ return state->field_path != NULL;
+}
+
+void php_phongo_bson_state_ctor(php_phongo_bson_state* state)
+{
+ state->field_path = php_phongo_field_path_alloc(false);
+}
+
+void php_phongo_bson_state_copy_ctor(php_phongo_bson_state* dst, php_phongo_bson_state* src)
+{
+ dst->map = src->map;
+ if (src->field_path) {
+ src->field_path->ref_count++;
+ }
+ dst->field_path = src->field_path;
+}
+
+void php_phongo_bson_state_dtor(php_phongo_bson_state* state)
+{
+ if (state->field_path) {
+ state->field_path->ref_count--;
+
+ if (state->field_path->ref_count < 1) {
+ php_phongo_field_path_free(state->field_path);
+ }
+ state->field_path = NULL;
+ }
+} /* }}} */
+
+static void php_phongo_bson_visit_corrupt(const bson_iter_t* iter ARG_UNUSED, void* data ARG_UNUSED) /* {{{ */
+{
+ mongoc_log(MONGOC_LOG_LEVEL_WARNING, MONGOC_LOG_DOMAIN, "Corrupt BSON data detected!");
+} /* }}} */
+
+static 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) /* {{{ */
+{
+ php_phongo_bson_state* state = (php_phongo_bson_state*) data;
+ char* path_string;
+
+ php_phongo_field_path_write_item_at_current_level(state->field_path, key);
+ path_string = php_phongo_field_path_as_string(state->field_path);
+
+ phongo_throw_exception(PHONGO_ERROR_UNEXPECTED_VALUE, "Detected unknown BSON type 0x%02hhx for field path \"%s\". Are you using the latest driver?", (unsigned char) v_type_code, path_string);
+
+ efree(path_string);
+} /* }}} */
+
+static bool php_phongo_bson_visit_double(const bson_iter_t* iter ARG_UNUSED, const char* key, double v_double, void* data) /* {{{ */
+{
+ zval* retval = PHONGO_BSON_STATE_ZCHILD(data);
+ php_phongo_bson_state* state = (php_phongo_bson_state*) data;
+
+ if (state->is_visiting_array) {
+ add_next_index_double(retval, v_double);
+ } else {
+ add_assoc_double(retval, key, v_double);
+ }
+
+ php_phongo_field_path_write_item_at_current_level(state->field_path, key);
+
+ return false;
+} /* }}} */
+
+static 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) /* {{{ */
+{
+ zval* retval = PHONGO_BSON_STATE_ZCHILD(data);
+ php_phongo_bson_state* state = (php_phongo_bson_state*) data;
+
+ if (state->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);
+ }
+
+ php_phongo_field_path_write_item_at_current_level(state->field_path, key);
+
+ return false;
+} /* }}} */
+
+static void php_phongo_bson_new_binary_from_binary_and_type(zval* object, const char* data, size_t data_len, bson_subtype_t type) /* {{{ */
+{
+ 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;
+} /* }}} */
+
+static 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) /* {{{ */
+{
+ zval* retval = PHONGO_BSON_STATE_ZCHILD(data);
+ php_phongo_bson_state* state = (php_phongo_bson_state*) data;
+
+ if (v_subtype == 0x80 && strcmp(key, PHONGO_ODM_FIELD_NAME) == 0) {
+ 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);
+ zend_string_release(zs_classname);
+
+ if (found_ce && PHONGO_IS_CLASS_INSTANTIATABLE(found_ce) && instanceof_function(found_ce, php_phongo_persistable_ce)) {
+ ((php_phongo_bson_state*) data)->odm = found_ce;
+ }
+ }
+
+ {
+ zval zchild;
+
+ php_phongo_bson_new_binary_from_binary_and_type(&zchild, (const char*) v_binary, v_binary_len, v_subtype);
+
+ if (state->is_visiting_array) {
+ add_next_index_zval(retval, &zchild);
+ } else {
+ ADD_ASSOC_ZVAL(retval, key, &zchild);
+ }
+ }
+
+ php_phongo_field_path_write_item_at_current_level(state->field_path, key);
+
+ return false;
+} /* }}} */
+
+static bool php_phongo_bson_visit_undefined(const bson_iter_t* iter, const char* key, void* data) /* {{{ */
+{
+ zval* retval = PHONGO_BSON_STATE_ZCHILD(data);
+ php_phongo_bson_state* state = (php_phongo_bson_state*) data;
+ zval zchild;
+
+ object_init_ex(&zchild, php_phongo_undefined_ce);
+
+ if (state->is_visiting_array) {
+ add_next_index_zval(retval, &zchild);
+ } else {
+ ADD_ASSOC_ZVAL(retval, key, &zchild);
+ }
+
+ php_phongo_field_path_write_item_at_current_level(state->field_path, key);
+
+ return false;
+} /* }}} */
+
+static void php_phongo_objectid_new_from_oid(zval* object, const bson_oid_t* oid) /* {{{ */
+{
+ 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;
+} /* }}} */
+
+static bool php_phongo_bson_visit_oid(const bson_iter_t* iter ARG_UNUSED, const char* key, const bson_oid_t* v_oid, void* data) /* {{{ */
+{
+ zval* retval = PHONGO_BSON_STATE_ZCHILD(data);
+ php_phongo_bson_state* state = (php_phongo_bson_state*) data;
+ zval zchild;
+
+ php_phongo_objectid_new_from_oid(&zchild, v_oid);
+
+ if (state->is_visiting_array) {
+ add_next_index_zval(retval, &zchild);
+ } else {
+ ADD_ASSOC_ZVAL(retval, key, &zchild);
+ }
+
+ php_phongo_field_path_write_item_at_current_level(state->field_path, key);
+
+ return false;
+} /* }}} */
+
+static bool php_phongo_bson_visit_bool(const bson_iter_t* iter ARG_UNUSED, const char* key, bool v_bool, void* data) /* {{{ */
+{
+ zval* retval = PHONGO_BSON_STATE_ZCHILD(data);
+ php_phongo_bson_state* state = (php_phongo_bson_state*) data;
+
+ if (state->is_visiting_array) {
+ add_next_index_bool(retval, v_bool);
+ } else {
+ add_assoc_bool(retval, key, v_bool);
+ }
+
+ php_phongo_field_path_write_item_at_current_level(state->field_path, key);
+
+ return false;
+} /* }}} */
+
+static void php_phongo_bson_new_utcdatetime_from_epoch(zval* object, int64_t msec_since_epoch) /* {{{ */
+{
+ 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;
+} /* }}} */
+
+static bool php_phongo_bson_visit_date_time(const bson_iter_t* iter ARG_UNUSED, const char* key, int64_t msec_since_epoch, void* data) /* {{{ */
+{
+ zval* retval = PHONGO_BSON_STATE_ZCHILD(data);
+ php_phongo_bson_state* state = (php_phongo_bson_state*) data;
+ zval zchild;
+
+ php_phongo_bson_new_utcdatetime_from_epoch(&zchild, msec_since_epoch);
+
+ if (state->is_visiting_array) {
+ add_next_index_zval(retval, &zchild);
+ } else {
+ ADD_ASSOC_ZVAL(retval, key, &zchild);
+ }
+
+ php_phongo_field_path_write_item_at_current_level(state->field_path, key);
+
+ return false;
+} /* }}} */
+
+static void php_phongo_bson_new_decimal128(zval* object, const bson_decimal128_t* decimal) /* {{{ */
+{
+ 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;
+} /* }}} */
+
+static bool php_phongo_bson_visit_decimal128(const bson_iter_t* iter ARG_UNUSED, const char* key, const bson_decimal128_t* decimal, void* data) /* {{{ */
+{
+ zval* retval = PHONGO_BSON_STATE_ZCHILD(data);
+ php_phongo_bson_state* state = (php_phongo_bson_state*) data;
+ zval zchild;
+
+ php_phongo_bson_new_decimal128(&zchild, decimal);
+
+ if (state->is_visiting_array) {
+ add_next_index_zval(retval, &zchild);
+ } else {
+ ADD_ASSOC_ZVAL(retval, key, &zchild);
+ }
+
+ php_phongo_field_path_write_item_at_current_level(state->field_path, key);
+
+ return false;
+} /* }}} */
+
+static bool php_phongo_bson_visit_null(const bson_iter_t* iter ARG_UNUSED, const char* key, void* data) /* {{{ */
+{
+ zval* retval = PHONGO_BSON_STATE_ZCHILD(data);
+ php_phongo_bson_state* state = (php_phongo_bson_state*) data;
+
+ if (state->is_visiting_array) {
+ add_next_index_null(retval);
+ } else {
+ add_assoc_null(retval, key);
+ }
+
+ php_phongo_field_path_write_item_at_current_level(state->field_path, key);
+
+ return false;
+} /* }}} */
+
+static void php_phongo_bson_new_regex_from_regex_and_options(zval* object, const char* pattern, const char* flags) /* {{{ */
+{
+ 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);
+} /* }}} */
+
+static 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) /* {{{ */
+{
+ zval* retval = PHONGO_BSON_STATE_ZCHILD(data);
+ php_phongo_bson_state* state = (php_phongo_bson_state*) data;
+ zval zchild;
+
+ php_phongo_bson_new_regex_from_regex_and_options(&zchild, v_regex, v_options);
+
+ if (state->is_visiting_array) {
+ add_next_index_zval(retval, &zchild);
+ } else {
+ ADD_ASSOC_ZVAL(retval, key, &zchild);
+ }
+
+ php_phongo_field_path_write_item_at_current_level(state->field_path, key);
+
+ return false;
+} /* }}} */
+
+static void php_phongo_bson_new_symbol(zval* object, const char* symbol, size_t symbol_len) /* {{{ */
+{
+ php_phongo_symbol_t* intern;
+
+ object_init_ex(object, php_phongo_symbol_ce);
+
+ intern = Z_SYMBOL_OBJ_P(object);
+ intern->symbol = estrndup(symbol, symbol_len);
+ intern->symbol_len = symbol_len;
+} /* }}} */
+
+static bool php_phongo_bson_visit_symbol(const bson_iter_t* iter, const char* key, size_t v_symbol_len, const char* v_symbol, void* data) /* {{{ */
+{
+ zval* retval = PHONGO_BSON_STATE_ZCHILD(data);
+ php_phongo_bson_state* state = (php_phongo_bson_state*) data;
+ zval zchild;
+
+ php_phongo_bson_new_symbol(&zchild, v_symbol, v_symbol_len);
+
+ if (state->is_visiting_array) {
+ add_next_index_zval(retval, &zchild);
+ } else {
+ ADD_ASSOC_ZVAL(retval, key, &zchild);
+ }
+
+ php_phongo_field_path_write_item_at_current_level(state->field_path, key);
+
+ return false;
+} /* }}} */
+
+static bool php_phongo_bson_new_javascript_from_javascript_and_scope(zval* object, const char* code, size_t code_len, const bson_t* scope) /* {{{ */
+{
+ php_phongo_javascript_t* intern;
+
+ if (scope) {
+ php_phongo_bson_state state;
+ bool valid_scope;
+
+ PHONGO_BSON_INIT_STATE(state);
+
+ valid_scope = php_phongo_bson_to_zval_ex(bson_get_data(scope), scope->len, &state);
+ zval_ptr_dtor(&state.zchild);
+
+ if (!valid_scope) {
+ return false;
+ }
+ }
+
+ 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;
+
+ return true;
+} /* }}} */
+
+static bool php_phongo_bson_new_javascript_from_javascript(zval* object, const char* code, size_t code_len) /* {{{ */
+{
+ return php_phongo_bson_new_javascript_from_javascript_and_scope(object, code, code_len, NULL);
+} /* }}} */
+
+static 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) /* {{{ */
+{
+ zval* retval = PHONGO_BSON_STATE_ZCHILD(data);
+ php_phongo_bson_state* state = (php_phongo_bson_state*) data;
+ zval zchild;
+
+ if (!php_phongo_bson_new_javascript_from_javascript(&zchild, v_code, v_code_len)) {
+ return true;
+ }
+
+ if (state->is_visiting_array) {
+ add_next_index_zval(retval, &zchild);
+ } else {
+ ADD_ASSOC_ZVAL(retval, key, &zchild);
+ }
+
+ php_phongo_field_path_write_item_at_current_level(state->field_path, key);
+
+ return false;
+} /* }}} */
+
+static void php_phongo_bson_new_dbpointer(zval* object, const char* ref, size_t ref_len, const bson_oid_t* oid) /* {{{ */
+{
+ php_phongo_dbpointer_t* intern;
+
+ object_init_ex(object, php_phongo_dbpointer_ce);
+
+ intern = Z_DBPOINTER_OBJ_P(object);
+ intern->ref = estrndup(ref, ref_len);
+ intern->ref_len = ref_len;
+ bson_oid_to_string(oid, intern->id);
+} /* }}} */
+
+static bool php_phongo_bson_visit_dbpointer(const bson_iter_t* iter, const char* key, size_t namespace_len, const char* namespace, const bson_oid_t* oid, void* data) /* {{{ */
+{
+ zval* retval = PHONGO_BSON_STATE_ZCHILD(data);
+ php_phongo_bson_state* state = (php_phongo_bson_state*) data;
+ zval zchild;
+
+ php_phongo_bson_new_dbpointer(&zchild, namespace, namespace_len, oid);
+
+ if (state->is_visiting_array) {
+ add_next_index_zval(retval, &zchild);
+ } else {
+ ADD_ASSOC_ZVAL(retval, key, &zchild);
+ }
+
+ php_phongo_field_path_write_item_at_current_level(state->field_path, key);
+
+ return false;
+} /* }}} */
+
+static 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) /* {{{ */
+{
+ zval* retval = PHONGO_BSON_STATE_ZCHILD(data);
+ php_phongo_bson_state* state = (php_phongo_bson_state*) data;
+ zval zchild;
+
+ if (!php_phongo_bson_new_javascript_from_javascript_and_scope(&zchild, v_code, v_code_len, v_scope)) {
+ return true;
+ }
+
+ if (state->is_visiting_array) {
+ add_next_index_zval(retval, &zchild);
+ } else {
+ ADD_ASSOC_ZVAL(retval, key, &zchild);
+ }
+
+ php_phongo_field_path_write_item_at_current_level(state->field_path, key);
+
+ return false;
+} /* }}} */
+
+static bool php_phongo_bson_visit_int32(const bson_iter_t* iter ARG_UNUSED, const char* key, int32_t v_int32, void* data) /* {{{ */
+{
+ zval* retval = PHONGO_BSON_STATE_ZCHILD(data);
+ php_phongo_bson_state* state = (php_phongo_bson_state*) data;
+
+ if (state->is_visiting_array) {
+ add_next_index_long(retval, v_int32);
+ } else {
+ add_assoc_long(retval, key, v_int32);
+ }
+
+ php_phongo_field_path_write_item_at_current_level(state->field_path, key);
+
+ return false;
+} /* }}} */
+
+static 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) /* {{{ */
+{
+ zval* retval = PHONGO_BSON_STATE_ZCHILD(data);
+ php_phongo_bson_state* state = (php_phongo_bson_state*) data;
+ zval zchild;
+
+ php_phongo_bson_new_timestamp_from_increment_and_timestamp(&zchild, v_increment, v_timestamp);
+
+ if (state->is_visiting_array) {
+ add_next_index_zval(retval, &zchild);
+ } else {
+ ADD_ASSOC_ZVAL(retval, key, &zchild);
+ }
+
+ php_phongo_field_path_write_item_at_current_level(state->field_path, key);
+
+ return false;
+} /* }}} */
+
+static bool php_phongo_bson_visit_int64(const bson_iter_t* iter ARG_UNUSED, const char* key, int64_t v_int64, void* data) /* {{{ */
+{
+ zval* retval = PHONGO_BSON_STATE_ZCHILD(data);
+ php_phongo_bson_state* state = (php_phongo_bson_state*) data;
+
+ php_phongo_field_path_write_item_at_current_level(state->field_path, key);
+
+ if (state->is_visiting_array) {
+ ADD_NEXT_INDEX_INT64(retval, v_int64);
+ } else {
+ ADD_ASSOC_INT64(retval, key, v_int64);
+ }
+
+ return false;
+} /* }}} */
+
+static bool php_phongo_bson_visit_maxkey(const bson_iter_t* iter ARG_UNUSED, const char* key, void* data) /* {{{ */
+{
+ zval* retval = PHONGO_BSON_STATE_ZCHILD(data);
+ php_phongo_bson_state* state = (php_phongo_bson_state*) data;
+ zval zchild;
+
+ object_init_ex(&zchild, php_phongo_maxkey_ce);
+
+ if (state->is_visiting_array) {
+ add_next_index_zval(retval, &zchild);
+ } else {
+ ADD_ASSOC_ZVAL(retval, key, &zchild);
+ }
+
+ php_phongo_field_path_write_item_at_current_level(state->field_path, key);
+
+ return false;
+} /* }}} */
+
+static bool php_phongo_bson_visit_minkey(const bson_iter_t* iter ARG_UNUSED, const char* key, void* data) /* {{{ */
+{
+ zval* retval = PHONGO_BSON_STATE_ZCHILD(data);
+ php_phongo_bson_state* state = (php_phongo_bson_state*) data;
+ zval zchild;
+
+ object_init_ex(&zchild, php_phongo_minkey_ce);
+
+ if (state->is_visiting_array) {
+ add_next_index_zval(retval, &zchild);
+ } else {
+ ADD_ASSOC_ZVAL(retval, key, &zchild);
+ }
+
+ php_phongo_field_path_write_item_at_current_level(state->field_path, key);
+
+ 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,
+ 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,
+ php_phongo_bson_visit_dbpointer,
+ php_phongo_bson_visit_code,
+ 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 }
+};
+
+static inline bool map_element_matches_field_path(php_phongo_field_path_map_element* map_element, php_phongo_field_path* current)
+{
+ size_t i;
+
+ if (map_element->entry->size != current->size) {
+ return false;
+ }
+ for (i = 0; i < current->size; i++) {
+ if (strcmp(map_element->entry->elements[i], "$") == 0) {
+ continue;
+ }
+ if (strcmp(map_element->entry->elements[i], current->elements[i]) != 0) {
+ return false;
+ }
+ }
+ return true;
+}
+
+static php_phongo_field_path_map_element* map_find_field_path_entry(php_phongo_bson_state* state)
+{
+ size_t i;
+
+ /* Loop over all field path mappings, and for each, try to see whether it matches the current path */
+ for (i = 0; i < state->map.field_paths.size; i++) {
+ if (map_element_matches_field_path(state->map.field_paths.map[i], state->field_path)) {
+ return state->map.field_paths.map[i];
+ }
+ }
+ return NULL;
+}
+
+static void php_phongo_handle_field_path_entry_for_compound_type(php_phongo_bson_state* state, php_phongo_bson_typemap_types* type, zend_class_entry** ce)
+{
+ php_phongo_field_path_map_element* entry = map_find_field_path_entry(state);
+
+ if (entry) {
+ switch (entry->node_type) {
+ case PHONGO_TYPEMAP_NATIVE_ARRAY:
+ case PHONGO_TYPEMAP_NATIVE_OBJECT:
+ *type = entry->node_type;
+ break;
+ case PHONGO_TYPEMAP_CLASS:
+ *type = entry->node_type;
+ *ce = entry->node_ce;
+ break;
+ default:
+ /* Do nothing - pacify compiler */
+ break;
+ }
+ }
+}
+
+static bool php_phongo_bson_visit_document(const bson_iter_t* iter ARG_UNUSED, const char* key, const bson_t* v_document, void* data) /* {{{ */
+{
+ zval* retval = PHONGO_BSON_STATE_ZCHILD(data);
+ bson_iter_t child;
+ php_phongo_bson_state* parent_state = (php_phongo_bson_state*) data;
+
+ php_phongo_field_path_push(parent_state->field_path, key, PHONGO_FIELD_PATH_ITEM_DOCUMENT);
+
+ if (bson_iter_init(&child, v_document)) {
+ php_phongo_bson_state state;
+
+ PHONGO_BSON_INIT_STATE(state);
+ php_phongo_bson_state_copy_ctor(&state, parent_state);
+
+ array_init(&state.zchild);
+
+ if (!bson_iter_visit_all(&child, &php_bson_visitors, &state) && !child.err_off) {
+ /* Check for entries in the fieldPath type map key, and use them to
+ * override the default ones for this type */
+ php_phongo_handle_field_path_entry_for_compound_type(&state, &state.map.document_type, &state.map.document);
+
+ /* 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_phongo_bson_state*) data)->is_visiting_array) {
+ add_next_index_zval(retval, &state.zchild);
+ } else {
+ ADD_ASSOC_ZVAL(retval, key, &state.zchild);
+ }
+ break;
+
+ case PHONGO_TYPEMAP_CLASS: {
+ zval obj;
+
+ object_init_ex(&obj, state.odm ? state.odm : state.map.document);
+ zend_call_method_with_1_params(PHONGO_COMPAT_OBJ_P(&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);
+ break;
+ }
+
+ case PHONGO_TYPEMAP_NATIVE_OBJECT:
+ default:
+ convert_to_object(&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);
+ }
+ }
+ } 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);
+ php_phongo_bson_state_dtor(&state);
+ return true;
+ }
+
+ php_phongo_bson_state_dtor(&state);
+ php_phongo_field_path_pop(parent_state->field_path);
+ }
+
+ return false;
+} /* }}} */
+
+static bool php_phongo_bson_visit_array(const bson_iter_t* iter ARG_UNUSED, const char* key, const bson_t* v_array, void* data) /* {{{ */
+{
+ zval* retval = PHONGO_BSON_STATE_ZCHILD(data);
+ bson_iter_t child;
+ php_phongo_bson_state* parent_state = (php_phongo_bson_state*) data;
+
+ php_phongo_field_path_push(parent_state->field_path, key, PHONGO_FIELD_PATH_ITEM_ARRAY);
+
+ if (bson_iter_init(&child, v_array)) {
+ php_phongo_bson_state state;
+
+ PHONGO_BSON_INIT_STATE(state);
+ php_phongo_bson_state_copy_ctor(&state, parent_state);
+
+ /* 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;
+
+ array_init(&state.zchild);
+
+ if (!bson_iter_visit_all(&child, &php_bson_visitors, &state) && !child.err_off) {
+ /* Check for entries in the fieldPath type map key, and use them to
+ * override the default ones for this type */
+ php_phongo_handle_field_path_entry_for_compound_type(&state, &state.map.array_type, &state.map.array);
+
+ switch (state.map.array_type) {
+ case PHONGO_TYPEMAP_CLASS: {
+ zval obj;
+
+ object_init_ex(&obj, state.map.array);
+ zend_call_method_with_1_params(PHONGO_COMPAT_OBJ_P(&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);
+ break;
+ }
+
+ case PHONGO_TYPEMAP_NATIVE_OBJECT:
+ convert_to_object(&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);
+ }
+ break;
+
+ case PHONGO_TYPEMAP_NATIVE_ARRAY:
+ default:
+ if (((php_phongo_bson_state*) data)->is_visiting_array) {
+ add_next_index_zval(retval, &state.zchild);
+ } else {
+ ADD_ASSOC_ZVAL(retval, key, &state.zchild);
+ }
+ 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);
+ php_phongo_bson_state_dtor(&state);
+ return true;
+ }
+
+ php_phongo_bson_state_dtor(&state);
+ php_phongo_field_path_pop(parent_state->field_path);
+ }
+
+ return false;
+} /* }}} */
+
+/* Converts a BSON document to a PHP value using the default typemap. */
+bool php_phongo_bson_to_zval(const unsigned char* data, int data_len, zval* zv) /* {{{ */
+{
+ bool retval;
+ php_phongo_bson_state state;
+
+ PHONGO_BSON_INIT_STATE(state);
+
+ retval = php_phongo_bson_to_zval_ex(data, data_len, &state);
+ ZVAL_ZVAL(zv, &state.zchild, 1, 1);
+
+ return retval;
+} /* }}} */
+
+/* Converts a BSON value to a ZVAL. */
+bool php_phongo_bson_value_to_zval(const bson_value_t* value, zval* zv) /* {{{ */
+{
+ bson_t bson = BSON_INITIALIZER;
+ php_phongo_bson_state state;
+ zval* return_value;
+ bool retval = false;
+
+ PHONGO_BSON_INIT_STATE(state);
+ state.map.root_type = PHONGO_TYPEMAP_NATIVE_ARRAY;
+
+ bson_append_value(&bson, "data", 4, value);
+ if (!php_phongo_bson_to_zval_ex(bson_get_data(&bson), bson.len, &state)) {
+ /* Exception already thrown */
+ goto cleanup;
+ }
+
+ retval = true;
+
+ return_value = php_array_fetchc(&state.zchild, "data");
+
+ if (return_value) {
+ ZVAL_ZVAL(zv, return_value, 1, 0);
+ }
+
+cleanup:
+ zval_ptr_dtor(&state.zchild);
+ return retval;
+} /* }}} */
+
+/* Converts a BSON document to a PHP value according to the typemap specified in
+ * the state argument.
+ *
+ * On success, the result will be set on the state argument and true will be
+ * returned. On error, an exception will have been thrown and false will be
+ * returned.
+ *
+ * Note: the result zval in the state argument will always be initialized for
+ * PHP 5.x so that the caller may always zval_ptr_dtor() it. The zval is left
+ * as-is on PHP 7; however, it should have the type undefined if the state
+ * was initialized to zero.
+ */
+bool php_phongo_bson_to_zval_ex(const unsigned char* data, int data_len, php_phongo_bson_state* state) /* {{{ */
+{
+ bson_reader_t* reader = NULL;
+ bson_iter_t iter;
+ const bson_t* b;
+ bool eof = false;
+ bool retval = false;
+ bool must_dtor_state = false;
+
+ if (!php_phongo_bson_state_is_initialized(state)) {
+ php_phongo_bson_state_ctor(state);
+ must_dtor_state = true;
+ }
+
+ reader = bson_reader_new_from_data(data, data_len);
+
+ if (!(b = bson_reader_read(reader, NULL))) {
+ phongo_throw_exception(PHONGO_ERROR_UNEXPECTED_VALUE, "Could not read document from BSON reader");
+
+ goto cleanup;
+ }
+
+ if (!bson_iter_init(&iter, b)) {
+ phongo_throw_exception(PHONGO_ERROR_UNEXPECTED_VALUE, "Could not initialize BSON iterator");
+
+ goto cleanup;
+ }
+
+ /* 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). */
+ array_init(&state->zchild);
+
+ 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)) {
+ char* path = php_phongo_field_path_as_string(state->field_path);
+ phongo_throw_exception(PHONGO_ERROR_UNEXPECTED_VALUE, "Detected corrupt BSON data for field path '%s' at offset %d", path, iter.err_off);
+ efree(path);
+ }
+
+ goto cleanup;
+ }
+
+ /* 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: {
+ zval obj;
+
+ object_init_ex(&obj, state->odm ? state->odm : state->map.root);
+ zend_call_method_with_1_params(PHONGO_COMPAT_OBJ_P(&obj), NULL, NULL, BSON_UNSERIALIZE_FUNC_NAME, NULL, &state->zchild);
+ zval_ptr_dtor(&state->zchild);
+ ZVAL_COPY_VALUE(&state->zchild, &obj);
+
+ break;
+ }
+
+ case PHONGO_TYPEMAP_NATIVE_OBJECT:
+ default:
+ convert_to_object(&state->zchild);
+ }
+
+ if (bson_reader_read(reader, &eof) || !eof) {
+ phongo_throw_exception(PHONGO_ERROR_UNEXPECTED_VALUE, "Reading document did not exhaust input buffer");
+
+ goto cleanup;
+ }
+
+ retval = true;
+
+cleanup:
+ if (reader) {
+ bson_reader_destroy(reader);
+ }
+ if (must_dtor_state) {
+ php_phongo_bson_state_dtor(state);
+ }
+
+ return retval;
+} /* }}} */
+
+/* Fetches a zend_class_entry for the given class name and checks that it is
+ * also instantiatable and implements a specified interface. Returns the class
+ * on success; otherwise, NULL is returned and an exception is thrown. */
+static zend_class_entry* php_phongo_bson_state_fetch_class(const char* classname, int classname_len, zend_class_entry* interface_ce) /* {{{ */
+{
+ 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);
+ zend_string_release(zs_classname);
+
+ if (!found_ce) {
+ phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Class %s does not exist", classname);
+ } else if (!PHONGO_IS_CLASS_INSTANTIATABLE(found_ce)) {
+ phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Class %s is not instantiatable", classname);
+ } else if (!instanceof_function(found_ce, interface_ce)) {
+ phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Class %s does not implement %s", classname, ZSTR_VAL(interface_ce->name));
+ } else {
+ return found_ce;
+ }
+
+ return NULL;
+} /* }}} */
+
+/* Parses a BSON type (i.e. array, document, or root). On success, the type and
+ * type_ce output arguments will be assigned and true will be returned;
+ * otherwise, false is returned and an exception is thrown. */
+static bool php_phongo_bson_state_parse_type(zval* options, const char* name, php_phongo_bson_typemap_types* type, zend_class_entry** type_ce) /* {{{ */
+{
+ char* classname;
+ int classname_len;
+ zend_bool classname_free = 0;
+ bool retval = true;
+
+ classname = php_array_fetch_string(options, name, &classname_len, &classname_free);
+
+ if (!classname_len) {
+ goto cleanup;
+ }
+
+ 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 ((*type_ce = php_phongo_bson_state_fetch_class(classname, classname_len, php_phongo_unserializable_ce))) {
+ *type = PHONGO_TYPEMAP_CLASS;
+ } else {
+ retval = false;
+ }
+ }
+
+cleanup:
+ if (classname_free) {
+ efree(classname);
+ }
+
+ return retval;
+} /* }}} */
+
+static void field_path_map_element_set_info(php_phongo_field_path_map_element* element, php_phongo_bson_typemap_types type, zend_class_entry* ce)
+{
+ element->node_type = type;
+ element->node_ce = ce;
+}
+
+static void map_add_field_path_element(php_phongo_bson_typemap* map, php_phongo_field_path_map_element* element)
+{
+ /* Make sure we have allocated enough */
+ if (map->field_paths.allocated_size < map->field_paths.size + 1) {
+ map->field_paths.allocated_size += PHONGO_FIELD_PATH_EXPANSION;
+ map->field_paths.map = erealloc(map->field_paths.map, sizeof(php_phongo_field_path_map_element) * map->field_paths.allocated_size);
+ }
+
+ map->field_paths.map[map->field_paths.size] = element;
+ map->field_paths.size++;
+}
+
+static php_phongo_field_path_map_element* field_path_map_element_alloc(void)
+{
+ php_phongo_field_path_map_element* tmp = ecalloc(1, sizeof(php_phongo_field_path_map_element));
+
+ tmp->entry = php_phongo_field_path_alloc(true);
+
+ return tmp;
+}
+
+static void field_path_map_element_dtor(php_phongo_field_path_map_element* element)
+{
+ php_phongo_field_path_free(element->entry);
+ efree(element);
+}
+
+bool php_phongo_bson_state_add_field_path(php_phongo_bson_typemap* map, char* field_path_original, php_phongo_bson_typemap_types type, zend_class_entry* ce)
+{
+ char* ptr = NULL;
+ char* segment_end = NULL;
+ php_phongo_field_path_map_element* field_path_map_element;
+
+ if (field_path_original[0] == '.') {
+ phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "A 'fieldPaths' key may not start with a '.'");
+ return false;
+ }
+
+ if (field_path_original[strlen(field_path_original) - 1] == '.') {
+ phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "A 'fieldPaths' key may not end with a '.'");
+ return false;
+ }
+
+ field_path_map_element = field_path_map_element_alloc();
+ ptr = field_path_original;
+
+ /* Loop over all the segments. A segment is delimited by a "." */
+ while ((segment_end = strchr(ptr, '.')) != NULL) {
+ char* tmp = NULL;
+
+ /* Bail out if we have an empty segment */
+ if (ptr == segment_end) {
+ field_path_map_element_dtor(field_path_map_element);
+ phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "A 'fieldPaths' key may not have an empty segment");
+ return false;
+ }
+
+ tmp = calloc(1, segment_end - ptr + 1);
+ memcpy(tmp, ptr, segment_end - ptr);
+ php_phongo_field_path_push(field_path_map_element->entry, tmp, PHONGO_FIELD_PATH_ITEM_NONE);
+ free(tmp);
+
+ ptr = segment_end + 1;
+ }
+
+ /* Add the last (or single) element */
+ php_phongo_field_path_push(field_path_map_element->entry, ptr, PHONGO_FIELD_PATH_ITEM_NONE);
+
+ field_path_map_element_set_info(field_path_map_element, type, ce);
+ map_add_field_path_element(map, field_path_map_element);
+
+ return true;
+}
+
+void php_phongo_bson_typemap_dtor(php_phongo_bson_typemap* map)
+{
+ size_t i;
+
+ if (map->field_paths.map) {
+ for (i = 0; i < map->field_paths.size; i++) {
+ field_path_map_element_dtor(map->field_paths.map[i]);
+ }
+ efree(map->field_paths.map);
+ }
+
+ map->field_paths.map = NULL;
+}
+
+/* Loops over each element in the fieldPaths array (if exists, and is an
+ * array), and then checks whether each element is a valid type mapping */
+bool php_phongo_bson_state_parse_fieldpaths(zval* typemap, php_phongo_bson_typemap* map) /* {{{ */
+{
+ zval* fieldpaths = NULL;
+ HashTable* ht_data;
+
+ if (!php_array_existsc(typemap, "fieldPaths")) {
+ return true;
+ }
+
+ fieldpaths = php_array_fetchc_array(typemap, "fieldPaths");
+
+ if (!fieldpaths) {
+ phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "The 'fieldPaths' element is not an array");
+ return false;
+ }
+
+ ht_data = HASH_OF(fieldpaths);
+
+ {
+ zend_string* string_key = NULL;
+ zend_ulong num_key = 0;
+ zval* property;
+
+ ZEND_HASH_FOREACH_KEY_VAL(ht_data, num_key, string_key, property)
+ {
+ zend_class_entry* map_ce = NULL;
+ php_phongo_bson_typemap_types map_type;
+
+ if (!string_key) {
+ phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "The 'fieldPaths' element is not an associative array");
+ return false;
+ }
+
+ if (strcmp(ZSTR_VAL(string_key), "") == 0) {
+ phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "The 'fieldPaths' element may not be an empty string");
+ return false;
+ }
+
+ if (!php_phongo_bson_state_parse_type(fieldpaths, ZSTR_VAL(string_key), &map_type, &map_ce)) {
+ return false;
+ }
+
+ if (!php_phongo_bson_state_add_field_path(map, ZSTR_VAL(string_key), map_type, map_ce)) {
+ return false;
+ }
+ }
+ ZEND_HASH_FOREACH_END();
+ }
+
+ return true;
+} /* }}} */
+
+#if DEBUG
+static void print_node_info(php_phongo_field_path_node* ptr, int level)
+{
+ printf("%*sNAME: %s\n", level * 4, "", ptr->name);
+ printf("%*s- type:", level * 4, "");
+ switch (ptr->node_type) {
+ case PHONGO_TYPEMAP_NONE:
+ printf(" none (unset)\n");
+ break;
+ case PHONGO_TYPEMAP_CLASS:
+ printf(" class (%s)\n", ZSTR_VAL(ptr->node_ce->name));
+ break;
+ case PHONGO_TYPEMAP_NATIVE_ARRAY:
+ printf(" array\n");
+ break;
+ case PHONGO_TYPEMAP_NATIVE_OBJECT:
+ printf(" stdClass\n");
+ break;
+ }
+}
+
+static void print_map_list(php_phongo_field_path_node* node, int level)
+{
+ php_phongo_field_path_node* ptr = node->children;
+
+ if (!ptr) {
+ return;
+ }
+
+ do {
+ print_node_info(ptr, level);
+ if (ptr->children) {
+ printf("%*s- children:\n", level * 4, "");
+ print_map_list(ptr, level + 1);
+ }
+ ptr = ptr->next;
+ } while (ptr);
+}
+#endif
+
+/* Applies the array argument to a typemap struct. Returns true on success;
+ * otherwise, false is returned an an exception is thrown. */
+bool php_phongo_bson_typemap_to_state(zval* typemap, php_phongo_bson_typemap* map) /* {{{ */
+{
+ if (!typemap) {
+ return true;
+ }
+
+ if (!php_phongo_bson_state_parse_type(typemap, "array", &map->array_type, &map->array) ||
+ !php_phongo_bson_state_parse_type(typemap, "document", &map->document_type, &map->document) ||
+ !php_phongo_bson_state_parse_type(typemap, "root", &map->root_type, &map->root) ||
+ !php_phongo_bson_state_parse_fieldpaths(typemap, map)) {
+
+ /* Exception should already have been thrown */
+ return false;
+ }
+#if DEBUG
+ print_map_list(&map->field_path_map, 0);
+#endif
+ return true;
+} /* }}} */
+
+void php_phongo_bson_new_timestamp_from_increment_and_timestamp(zval* object, uint32_t increment, uint32_t timestamp) /* {{{ */
+{
+ 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_bson_new_int64(zval* object, int64_t integer) /* {{{ */
+{
+ php_phongo_int64_t* intern;
+
+ object_init_ex(object, php_phongo_int64_ce);
+
+ intern = Z_INT64_OBJ_P(object);
+ intern->integer = integer;
+ intern->initialized = true;
+} /* }}} */
+
+/*
+ * 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.8.1/src/contrib/php_array_api.h b/mongodb-1.9.0/src/contrib/php_array_api.h
similarity index 100%
rename from mongodb-1.8.1/src/contrib/php_array_api.h
rename to mongodb-1.9.0/src/contrib/php_array_api.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/common/common-b64-private.h b/mongodb-1.9.0/src/libmongoc/src/common/common-b64-private.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/common/common-b64-private.h
rename to mongodb-1.9.0/src/libmongoc/src/common/common-b64-private.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/common/common-b64.c b/mongodb-1.9.0/src/libmongoc/src/common/common-b64.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/common/common-b64.c
rename to mongodb-1.9.0/src/libmongoc/src/common/common-b64.c
diff --git a/mongodb-1.8.1/src/libmongoc/src/common/common-config.h b/mongodb-1.9.0/src/libmongoc/src/common/common-config.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/common/common-config.h
rename to mongodb-1.9.0/src/libmongoc/src/common/common-config.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/common/common-md5-private.h b/mongodb-1.9.0/src/libmongoc/src/common/common-md5-private.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/common/common-md5-private.h
rename to mongodb-1.9.0/src/libmongoc/src/common/common-md5-private.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/common/common-md5.c b/mongodb-1.9.0/src/libmongoc/src/common/common-md5.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/common/common-md5.c
rename to mongodb-1.9.0/src/libmongoc/src/common/common-md5.c
diff --git a/mongodb-1.8.1/src/libmongoc/src/common/common-prelude.h b/mongodb-1.9.0/src/libmongoc/src/common/common-prelude.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/common/common-prelude.h
rename to mongodb-1.9.0/src/libmongoc/src/common/common-prelude.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/common/common-thread-private.h b/mongodb-1.9.0/src/libmongoc/src/common/common-thread-private.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/common/common-thread-private.h
rename to mongodb-1.9.0/src/libmongoc/src/common/common-thread-private.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/common/common-thread.c b/mongodb-1.9.0/src/libmongoc/src/common/common-thread.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/common/common-thread.c
rename to mongodb-1.9.0/src/libmongoc/src/common/common-thread.c
diff --git a/mongodb-1.8.1/src/libmongoc/src/kms-message/src/hexlify.c b/mongodb-1.9.0/src/libmongoc/src/kms-message/src/hexlify.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/kms-message/src/hexlify.c
rename to mongodb-1.9.0/src/libmongoc/src/kms-message/src/hexlify.c
diff --git a/mongodb-1.8.1/src/libmongoc/src/kms-message/src/hexlify.h b/mongodb-1.9.0/src/libmongoc/src/kms-message/src/hexlify.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/kms-message/src/hexlify.h
rename to mongodb-1.9.0/src/libmongoc/src/kms-message/src/hexlify.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/kms-message/src/kms_b64.c b/mongodb-1.9.0/src/libmongoc/src/kms-message/src/kms_b64.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/kms-message/src/kms_b64.c
rename to mongodb-1.9.0/src/libmongoc/src/kms-message/src/kms_b64.c
diff --git a/mongodb-1.8.1/src/libmongoc/src/kms-message/src/kms_caller_identity_request.c b/mongodb-1.9.0/src/libmongoc/src/kms-message/src/kms_caller_identity_request.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/kms-message/src/kms_caller_identity_request.c
rename to mongodb-1.9.0/src/libmongoc/src/kms-message/src/kms_caller_identity_request.c
diff --git a/mongodb-1.8.1/src/libmongoc/src/kms-message/src/kms_crypto.h b/mongodb-1.9.0/src/libmongoc/src/kms-message/src/kms_crypto.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/kms-message/src/kms_crypto.h
rename to mongodb-1.9.0/src/libmongoc/src/kms-message/src/kms_crypto.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/kms-message/src/kms_crypto_apple.c b/mongodb-1.9.0/src/libmongoc/src/kms-message/src/kms_crypto_apple.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/kms-message/src/kms_crypto_apple.c
rename to mongodb-1.9.0/src/libmongoc/src/kms-message/src/kms_crypto_apple.c
diff --git a/mongodb-1.8.1/src/libmongoc/src/kms-message/src/kms_crypto_libcrypto.c b/mongodb-1.9.0/src/libmongoc/src/kms-message/src/kms_crypto_libcrypto.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/kms-message/src/kms_crypto_libcrypto.c
rename to mongodb-1.9.0/src/libmongoc/src/kms-message/src/kms_crypto_libcrypto.c
diff --git a/mongodb-1.8.1/src/libmongoc/src/kms-message/src/kms_crypto_none.c b/mongodb-1.9.0/src/libmongoc/src/kms-message/src/kms_crypto_none.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/kms-message/src/kms_crypto_none.c
rename to mongodb-1.9.0/src/libmongoc/src/kms-message/src/kms_crypto_none.c
diff --git a/mongodb-1.8.1/src/libmongoc/src/kms-message/src/kms_crypto_windows.c b/mongodb-1.9.0/src/libmongoc/src/kms-message/src/kms_crypto_windows.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/kms-message/src/kms_crypto_windows.c
rename to mongodb-1.9.0/src/libmongoc/src/kms-message/src/kms_crypto_windows.c
diff --git a/mongodb-1.8.1/src/libmongoc/src/kms-message/src/kms_decrypt_request.c b/mongodb-1.9.0/src/libmongoc/src/kms-message/src/kms_decrypt_request.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/kms-message/src/kms_decrypt_request.c
rename to mongodb-1.9.0/src/libmongoc/src/kms-message/src/kms_decrypt_request.c
diff --git a/mongodb-1.8.1/src/libmongoc/src/kms-message/src/kms_encrypt_request.c b/mongodb-1.9.0/src/libmongoc/src/kms-message/src/kms_encrypt_request.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/kms-message/src/kms_encrypt_request.c
rename to mongodb-1.9.0/src/libmongoc/src/kms-message/src/kms_encrypt_request.c
diff --git a/mongodb-1.8.1/src/libmongoc/src/kms-message/src/kms_kv_list.c b/mongodb-1.9.0/src/libmongoc/src/kms-message/src/kms_kv_list.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/kms-message/src/kms_kv_list.c
rename to mongodb-1.9.0/src/libmongoc/src/kms-message/src/kms_kv_list.c
diff --git a/mongodb-1.8.1/src/libmongoc/src/kms-message/src/kms_kv_list.h b/mongodb-1.9.0/src/libmongoc/src/kms-message/src/kms_kv_list.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/kms-message/src/kms_kv_list.h
rename to mongodb-1.9.0/src/libmongoc/src/kms-message/src/kms_kv_list.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/kms-message/src/kms_message.c b/mongodb-1.9.0/src/libmongoc/src/kms-message/src/kms_message.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/kms-message/src/kms_message.c
rename to mongodb-1.9.0/src/libmongoc/src/kms-message/src/kms_message.c
diff --git a/mongodb-1.8.1/src/libmongoc/src/kms-message/src/kms_message/kms_b64.h b/mongodb-1.9.0/src/libmongoc/src/kms-message/src/kms_message/kms_b64.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/kms-message/src/kms_message/kms_b64.h
rename to mongodb-1.9.0/src/libmongoc/src/kms-message/src/kms_message/kms_b64.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/kms-message/src/kms_message/kms_caller_identity_request.h b/mongodb-1.9.0/src/libmongoc/src/kms-message/src/kms_message/kms_caller_identity_request.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/kms-message/src/kms_message/kms_caller_identity_request.h
rename to mongodb-1.9.0/src/libmongoc/src/kms-message/src/kms_message/kms_caller_identity_request.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/kms-message/src/kms_message/kms_decrypt_request.h b/mongodb-1.9.0/src/libmongoc/src/kms-message/src/kms_message/kms_decrypt_request.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/kms-message/src/kms_message/kms_decrypt_request.h
rename to mongodb-1.9.0/src/libmongoc/src/kms-message/src/kms_message/kms_decrypt_request.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/kms-message/src/kms_message/kms_encrypt_request.h b/mongodb-1.9.0/src/libmongoc/src/kms-message/src/kms_message/kms_encrypt_request.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/kms-message/src/kms_message/kms_encrypt_request.h
rename to mongodb-1.9.0/src/libmongoc/src/kms-message/src/kms_message/kms_encrypt_request.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/kms-message/src/kms_message/kms_message.h b/mongodb-1.9.0/src/libmongoc/src/kms-message/src/kms_message/kms_message.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/kms-message/src/kms_message/kms_message.h
rename to mongodb-1.9.0/src/libmongoc/src/kms-message/src/kms_message/kms_message.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/kms-message/src/kms_message/kms_message_defines.h b/mongodb-1.9.0/src/libmongoc/src/kms-message/src/kms_message/kms_message_defines.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/kms-message/src/kms_message/kms_message_defines.h
rename to mongodb-1.9.0/src/libmongoc/src/kms-message/src/kms_message/kms_message_defines.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/kms-message/src/kms_message/kms_request.h b/mongodb-1.9.0/src/libmongoc/src/kms-message/src/kms_message/kms_request.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/kms-message/src/kms_message/kms_request.h
rename to mongodb-1.9.0/src/libmongoc/src/kms-message/src/kms_message/kms_request.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/kms-message/src/kms_message/kms_request_opt.h b/mongodb-1.9.0/src/libmongoc/src/kms-message/src/kms_message/kms_request_opt.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/kms-message/src/kms_message/kms_request_opt.h
rename to mongodb-1.9.0/src/libmongoc/src/kms-message/src/kms_message/kms_request_opt.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/kms-message/src/kms_message/kms_response.h b/mongodb-1.9.0/src/libmongoc/src/kms-message/src/kms_message/kms_response.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/kms-message/src/kms_message/kms_response.h
rename to mongodb-1.9.0/src/libmongoc/src/kms-message/src/kms_message/kms_response.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/kms-message/src/kms_message/kms_response_parser.h b/mongodb-1.9.0/src/libmongoc/src/kms-message/src/kms_message/kms_response_parser.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/kms-message/src/kms_message/kms_response_parser.h
rename to mongodb-1.9.0/src/libmongoc/src/kms-message/src/kms_message/kms_response_parser.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/kms-message/src/kms_message_private.h b/mongodb-1.9.0/src/libmongoc/src/kms-message/src/kms_message_private.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/kms-message/src/kms_message_private.h
rename to mongodb-1.9.0/src/libmongoc/src/kms-message/src/kms_message_private.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/kms-message/src/kms_port.c b/mongodb-1.9.0/src/libmongoc/src/kms-message/src/kms_port.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/kms-message/src/kms_port.c
rename to mongodb-1.9.0/src/libmongoc/src/kms-message/src/kms_port.c
diff --git a/mongodb-1.8.1/src/libmongoc/src/kms-message/src/kms_port.h b/mongodb-1.9.0/src/libmongoc/src/kms-message/src/kms_port.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/kms-message/src/kms_port.h
rename to mongodb-1.9.0/src/libmongoc/src/kms-message/src/kms_port.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/kms-message/src/kms_request.c b/mongodb-1.9.0/src/libmongoc/src/kms-message/src/kms_request.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/kms-message/src/kms_request.c
rename to mongodb-1.9.0/src/libmongoc/src/kms-message/src/kms_request.c
diff --git a/mongodb-1.8.1/src/libmongoc/src/kms-message/src/kms_request_opt.c b/mongodb-1.9.0/src/libmongoc/src/kms-message/src/kms_request_opt.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/kms-message/src/kms_request_opt.c
rename to mongodb-1.9.0/src/libmongoc/src/kms-message/src/kms_request_opt.c
diff --git a/mongodb-1.8.1/src/libmongoc/src/kms-message/src/kms_request_opt_private.h b/mongodb-1.9.0/src/libmongoc/src/kms-message/src/kms_request_opt_private.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/kms-message/src/kms_request_opt_private.h
rename to mongodb-1.9.0/src/libmongoc/src/kms-message/src/kms_request_opt_private.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/kms-message/src/kms_request_str.c b/mongodb-1.9.0/src/libmongoc/src/kms-message/src/kms_request_str.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/kms-message/src/kms_request_str.c
rename to mongodb-1.9.0/src/libmongoc/src/kms-message/src/kms_request_str.c
diff --git a/mongodb-1.8.1/src/libmongoc/src/kms-message/src/kms_request_str.h b/mongodb-1.9.0/src/libmongoc/src/kms-message/src/kms_request_str.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/kms-message/src/kms_request_str.h
rename to mongodb-1.9.0/src/libmongoc/src/kms-message/src/kms_request_str.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/kms-message/src/kms_response.c b/mongodb-1.9.0/src/libmongoc/src/kms-message/src/kms_response.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/kms-message/src/kms_response.c
rename to mongodb-1.9.0/src/libmongoc/src/kms-message/src/kms_response.c
diff --git a/mongodb-1.8.1/src/libmongoc/src/kms-message/src/kms_response_parser.c b/mongodb-1.9.0/src/libmongoc/src/kms-message/src/kms_response_parser.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/kms-message/src/kms_response_parser.c
rename to mongodb-1.9.0/src/libmongoc/src/kms-message/src/kms_response_parser.c
diff --git a/mongodb-1.8.1/src/libmongoc/src/kms-message/src/sort.c b/mongodb-1.9.0/src/libmongoc/src/kms-message/src/sort.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/kms-message/src/sort.c
rename to mongodb-1.9.0/src/libmongoc/src/kms-message/src/sort.c
diff --git a/mongodb-1.8.1/src/libmongoc/src/kms-message/src/sort.h b/mongodb-1.9.0/src/libmongoc/src/kms-message/src/sort.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/kms-message/src/sort.h
rename to mongodb-1.9.0/src/libmongoc/src/kms-message/src/sort.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/libbson/src/bson/bcon.c b/mongodb-1.9.0/src/libmongoc/src/libbson/src/bson/bcon.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libbson/src/bson/bcon.c
rename to mongodb-1.9.0/src/libmongoc/src/libbson/src/bson/bcon.c
diff --git a/mongodb-1.8.1/src/libmongoc/src/libbson/src/bson/bcon.h b/mongodb-1.9.0/src/libmongoc/src/libbson/src/bson/bcon.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libbson/src/bson/bcon.h
rename to mongodb-1.9.0/src/libmongoc/src/libbson/src/bson/bcon.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/libbson/src/bson/bson-atomic.c b/mongodb-1.9.0/src/libmongoc/src/libbson/src/bson/bson-atomic.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libbson/src/bson/bson-atomic.c
rename to mongodb-1.9.0/src/libmongoc/src/libbson/src/bson/bson-atomic.c
diff --git a/mongodb-1.8.1/src/libmongoc/src/libbson/src/bson/bson-atomic.h b/mongodb-1.9.0/src/libmongoc/src/libbson/src/bson/bson-atomic.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libbson/src/bson/bson-atomic.h
rename to mongodb-1.9.0/src/libmongoc/src/libbson/src/bson/bson-atomic.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/libbson/src/bson/bson-clock.c b/mongodb-1.9.0/src/libmongoc/src/libbson/src/bson/bson-clock.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libbson/src/bson/bson-clock.c
rename to mongodb-1.9.0/src/libmongoc/src/libbson/src/bson/bson-clock.c
diff --git a/mongodb-1.8.1/src/libmongoc/src/libbson/src/bson/bson-clock.h b/mongodb-1.9.0/src/libmongoc/src/libbson/src/bson/bson-clock.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libbson/src/bson/bson-clock.h
rename to mongodb-1.9.0/src/libmongoc/src/libbson/src/bson/bson-clock.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/libbson/src/bson/bson-compat.h b/mongodb-1.9.0/src/libmongoc/src/libbson/src/bson/bson-compat.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libbson/src/bson/bson-compat.h
rename to mongodb-1.9.0/src/libmongoc/src/libbson/src/bson/bson-compat.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/libbson/src/bson/bson-config.h b/mongodb-1.9.0/src/libmongoc/src/libbson/src/bson/bson-config.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libbson/src/bson/bson-config.h
rename to mongodb-1.9.0/src/libmongoc/src/libbson/src/bson/bson-config.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/libbson/src/bson/bson-config.h.in b/mongodb-1.9.0/src/libmongoc/src/libbson/src/bson/bson-config.h.in
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libbson/src/bson/bson-config.h.in
rename to mongodb-1.9.0/src/libmongoc/src/libbson/src/bson/bson-config.h.in
diff --git a/mongodb-1.8.1/src/libmongoc/src/libbson/src/bson/bson-context-private.h b/mongodb-1.9.0/src/libmongoc/src/libbson/src/bson/bson-context-private.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libbson/src/bson/bson-context-private.h
rename to mongodb-1.9.0/src/libmongoc/src/libbson/src/bson/bson-context-private.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/libbson/src/bson/bson-context.c b/mongodb-1.9.0/src/libmongoc/src/libbson/src/bson/bson-context.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libbson/src/bson/bson-context.c
rename to mongodb-1.9.0/src/libmongoc/src/libbson/src/bson/bson-context.c
diff --git a/mongodb-1.8.1/src/libmongoc/src/libbson/src/bson/bson-context.h b/mongodb-1.9.0/src/libmongoc/src/libbson/src/bson/bson-context.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libbson/src/bson/bson-context.h
rename to mongodb-1.9.0/src/libmongoc/src/libbson/src/bson/bson-context.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/libbson/src/bson/bson-decimal128.c b/mongodb-1.9.0/src/libmongoc/src/libbson/src/bson/bson-decimal128.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libbson/src/bson/bson-decimal128.c
rename to mongodb-1.9.0/src/libmongoc/src/libbson/src/bson/bson-decimal128.c
diff --git a/mongodb-1.8.1/src/libmongoc/src/libbson/src/bson/bson-decimal128.h b/mongodb-1.9.0/src/libmongoc/src/libbson/src/bson/bson-decimal128.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libbson/src/bson/bson-decimal128.h
rename to mongodb-1.9.0/src/libmongoc/src/libbson/src/bson/bson-decimal128.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/libbson/src/bson/bson-endian.h b/mongodb-1.9.0/src/libmongoc/src/libbson/src/bson/bson-endian.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libbson/src/bson/bson-endian.h
rename to mongodb-1.9.0/src/libmongoc/src/libbson/src/bson/bson-endian.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/libbson/src/bson/bson-error.c b/mongodb-1.9.0/src/libmongoc/src/libbson/src/bson/bson-error.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libbson/src/bson/bson-error.c
rename to mongodb-1.9.0/src/libmongoc/src/libbson/src/bson/bson-error.c
diff --git a/mongodb-1.8.1/src/libmongoc/src/libbson/src/bson/bson-error.h b/mongodb-1.9.0/src/libmongoc/src/libbson/src/bson/bson-error.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libbson/src/bson/bson-error.h
rename to mongodb-1.9.0/src/libmongoc/src/libbson/src/bson/bson-error.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/libbson/src/bson/bson-iso8601-private.h b/mongodb-1.9.0/src/libmongoc/src/libbson/src/bson/bson-iso8601-private.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libbson/src/bson/bson-iso8601-private.h
rename to mongodb-1.9.0/src/libmongoc/src/libbson/src/bson/bson-iso8601-private.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/libbson/src/bson/bson-iso8601.c b/mongodb-1.9.0/src/libmongoc/src/libbson/src/bson/bson-iso8601.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libbson/src/bson/bson-iso8601.c
rename to mongodb-1.9.0/src/libmongoc/src/libbson/src/bson/bson-iso8601.c
diff --git a/mongodb-1.8.1/src/libmongoc/src/libbson/src/bson/bson-iter.c b/mongodb-1.9.0/src/libmongoc/src/libbson/src/bson/bson-iter.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libbson/src/bson/bson-iter.c
rename to mongodb-1.9.0/src/libmongoc/src/libbson/src/bson/bson-iter.c
diff --git a/mongodb-1.8.1/src/libmongoc/src/libbson/src/bson/bson-iter.h b/mongodb-1.9.0/src/libmongoc/src/libbson/src/bson/bson-iter.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libbson/src/bson/bson-iter.h
rename to mongodb-1.9.0/src/libmongoc/src/libbson/src/bson/bson-iter.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/libbson/src/bson/bson-json.c b/mongodb-1.9.0/src/libmongoc/src/libbson/src/bson/bson-json.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libbson/src/bson/bson-json.c
rename to mongodb-1.9.0/src/libmongoc/src/libbson/src/bson/bson-json.c
diff --git a/mongodb-1.8.1/src/libmongoc/src/libbson/src/bson/bson-json.h b/mongodb-1.9.0/src/libmongoc/src/libbson/src/bson/bson-json.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libbson/src/bson/bson-json.h
rename to mongodb-1.9.0/src/libmongoc/src/libbson/src/bson/bson-json.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/libbson/src/bson/bson-keys.c b/mongodb-1.9.0/src/libmongoc/src/libbson/src/bson/bson-keys.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libbson/src/bson/bson-keys.c
rename to mongodb-1.9.0/src/libmongoc/src/libbson/src/bson/bson-keys.c
diff --git a/mongodb-1.8.1/src/libmongoc/src/libbson/src/bson/bson-keys.h b/mongodb-1.9.0/src/libmongoc/src/libbson/src/bson/bson-keys.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libbson/src/bson/bson-keys.h
rename to mongodb-1.9.0/src/libmongoc/src/libbson/src/bson/bson-keys.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/libbson/src/bson/bson-macros.h b/mongodb-1.9.0/src/libmongoc/src/libbson/src/bson/bson-macros.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libbson/src/bson/bson-macros.h
rename to mongodb-1.9.0/src/libmongoc/src/libbson/src/bson/bson-macros.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/libbson/src/bson/bson-md5.c b/mongodb-1.9.0/src/libmongoc/src/libbson/src/bson/bson-md5.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libbson/src/bson/bson-md5.c
rename to mongodb-1.9.0/src/libmongoc/src/libbson/src/bson/bson-md5.c
diff --git a/mongodb-1.8.1/src/libmongoc/src/libbson/src/bson/bson-md5.h b/mongodb-1.9.0/src/libmongoc/src/libbson/src/bson/bson-md5.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libbson/src/bson/bson-md5.h
rename to mongodb-1.9.0/src/libmongoc/src/libbson/src/bson/bson-md5.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/libbson/src/bson/bson-memory.c b/mongodb-1.9.0/src/libmongoc/src/libbson/src/bson/bson-memory.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libbson/src/bson/bson-memory.c
rename to mongodb-1.9.0/src/libmongoc/src/libbson/src/bson/bson-memory.c
diff --git a/mongodb-1.8.1/src/libmongoc/src/libbson/src/bson/bson-memory.h b/mongodb-1.9.0/src/libmongoc/src/libbson/src/bson/bson-memory.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libbson/src/bson/bson-memory.h
rename to mongodb-1.9.0/src/libmongoc/src/libbson/src/bson/bson-memory.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/libbson/src/bson/bson-oid.c b/mongodb-1.9.0/src/libmongoc/src/libbson/src/bson/bson-oid.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libbson/src/bson/bson-oid.c
rename to mongodb-1.9.0/src/libmongoc/src/libbson/src/bson/bson-oid.c
diff --git a/mongodb-1.8.1/src/libmongoc/src/libbson/src/bson/bson-oid.h b/mongodb-1.9.0/src/libmongoc/src/libbson/src/bson/bson-oid.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libbson/src/bson/bson-oid.h
rename to mongodb-1.9.0/src/libmongoc/src/libbson/src/bson/bson-oid.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/libbson/src/bson/bson-prelude.h b/mongodb-1.9.0/src/libmongoc/src/libbson/src/bson/bson-prelude.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libbson/src/bson/bson-prelude.h
rename to mongodb-1.9.0/src/libmongoc/src/libbson/src/bson/bson-prelude.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/libbson/src/bson/bson-private.h b/mongodb-1.9.0/src/libmongoc/src/libbson/src/bson/bson-private.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libbson/src/bson/bson-private.h
rename to mongodb-1.9.0/src/libmongoc/src/libbson/src/bson/bson-private.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/libbson/src/bson/bson-reader.c b/mongodb-1.9.0/src/libmongoc/src/libbson/src/bson/bson-reader.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libbson/src/bson/bson-reader.c
rename to mongodb-1.9.0/src/libmongoc/src/libbson/src/bson/bson-reader.c
diff --git a/mongodb-1.8.1/src/libmongoc/src/libbson/src/bson/bson-reader.h b/mongodb-1.9.0/src/libmongoc/src/libbson/src/bson/bson-reader.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libbson/src/bson/bson-reader.h
rename to mongodb-1.9.0/src/libmongoc/src/libbson/src/bson/bson-reader.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/libbson/src/bson/bson-string.c b/mongodb-1.9.0/src/libmongoc/src/libbson/src/bson/bson-string.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libbson/src/bson/bson-string.c
rename to mongodb-1.9.0/src/libmongoc/src/libbson/src/bson/bson-string.c
diff --git a/mongodb-1.8.1/src/libmongoc/src/libbson/src/bson/bson-string.h b/mongodb-1.9.0/src/libmongoc/src/libbson/src/bson/bson-string.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libbson/src/bson/bson-string.h
rename to mongodb-1.9.0/src/libmongoc/src/libbson/src/bson/bson-string.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/libbson/src/bson/bson-timegm-private.h b/mongodb-1.9.0/src/libmongoc/src/libbson/src/bson/bson-timegm-private.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libbson/src/bson/bson-timegm-private.h
rename to mongodb-1.9.0/src/libmongoc/src/libbson/src/bson/bson-timegm-private.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/libbson/src/bson/bson-timegm.c b/mongodb-1.9.0/src/libmongoc/src/libbson/src/bson/bson-timegm.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libbson/src/bson/bson-timegm.c
rename to mongodb-1.9.0/src/libmongoc/src/libbson/src/bson/bson-timegm.c
diff --git a/mongodb-1.8.1/src/libmongoc/src/libbson/src/bson/bson-types.h b/mongodb-1.9.0/src/libmongoc/src/libbson/src/bson/bson-types.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libbson/src/bson/bson-types.h
rename to mongodb-1.9.0/src/libmongoc/src/libbson/src/bson/bson-types.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/libbson/src/bson/bson-utf8.c b/mongodb-1.9.0/src/libmongoc/src/libbson/src/bson/bson-utf8.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libbson/src/bson/bson-utf8.c
rename to mongodb-1.9.0/src/libmongoc/src/libbson/src/bson/bson-utf8.c
diff --git a/mongodb-1.8.1/src/libmongoc/src/libbson/src/bson/bson-utf8.h b/mongodb-1.9.0/src/libmongoc/src/libbson/src/bson/bson-utf8.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libbson/src/bson/bson-utf8.h
rename to mongodb-1.9.0/src/libmongoc/src/libbson/src/bson/bson-utf8.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/libbson/src/bson/bson-value.c b/mongodb-1.9.0/src/libmongoc/src/libbson/src/bson/bson-value.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libbson/src/bson/bson-value.c
rename to mongodb-1.9.0/src/libmongoc/src/libbson/src/bson/bson-value.c
diff --git a/mongodb-1.8.1/src/libmongoc/src/libbson/src/bson/bson-value.h b/mongodb-1.9.0/src/libmongoc/src/libbson/src/bson/bson-value.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libbson/src/bson/bson-value.h
rename to mongodb-1.9.0/src/libmongoc/src/libbson/src/bson/bson-value.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/libbson/src/bson/bson-version-functions.c b/mongodb-1.9.0/src/libmongoc/src/libbson/src/bson/bson-version-functions.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libbson/src/bson/bson-version-functions.c
rename to mongodb-1.9.0/src/libmongoc/src/libbson/src/bson/bson-version-functions.c
diff --git a/mongodb-1.8.1/src/libmongoc/src/libbson/src/bson/bson-version-functions.h b/mongodb-1.9.0/src/libmongoc/src/libbson/src/bson/bson-version-functions.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libbson/src/bson/bson-version-functions.h
rename to mongodb-1.9.0/src/libmongoc/src/libbson/src/bson/bson-version-functions.h
diff --git a/mongodb-1.9.0/src/libmongoc/src/libbson/src/bson/bson-version.h b/mongodb-1.9.0/src/libmongoc/src/libbson/src/bson/bson-version.h
new file mode 100644
index 00000000..991ef21d
--- /dev/null
+++ b/mongodb-1.9.0/src/libmongoc/src/libbson/src/bson/bson-version.h
@@ -0,0 +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/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 (17)
+
+
+/**
+ * BSON_MICRO_VERSION:
+ *
+ * BSON micro version component (e.g. 3 if %BSON_VERSION is 1.2.3)
+ */
+#define BSON_MICRO_VERSION (2)
+
+
+/**
+ * BSON_PRERELEASE_VERSION:
+ *
+ * BSON prerelease version component (e.g. pre if %BSON_VERSION is 1.2.3-pre)
+ */
+#define BSON_PRERELEASE_VERSION ()
+
+/**
+ * BSON_VERSION:
+ *
+ * BSON version.
+ */
+#define BSON_VERSION (1.17.2)
+
+
+/**
+ * BSON_VERSION_S:
+ *
+ * BSON version, encoded as a string, useful for printing and
+ * concatenation.
+ */
+#define BSON_VERSION_S "1.17.2"
+
+
+/**
+ * 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.8.1/src/libmongoc/src/libbson/src/bson/bson-version.h.in b/mongodb-1.9.0/src/libmongoc/src/libbson/src/bson/bson-version.h.in
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libbson/src/bson/bson-version.h.in
rename to mongodb-1.9.0/src/libmongoc/src/libbson/src/bson/bson-version.h.in
diff --git a/mongodb-1.8.1/src/libmongoc/src/libbson/src/bson/bson-writer.c b/mongodb-1.9.0/src/libmongoc/src/libbson/src/bson/bson-writer.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libbson/src/bson/bson-writer.c
rename to mongodb-1.9.0/src/libmongoc/src/libbson/src/bson/bson-writer.c
diff --git a/mongodb-1.8.1/src/libmongoc/src/libbson/src/bson/bson-writer.h b/mongodb-1.9.0/src/libmongoc/src/libbson/src/bson/bson-writer.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libbson/src/bson/bson-writer.h
rename to mongodb-1.9.0/src/libmongoc/src/libbson/src/bson/bson-writer.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/libbson/src/bson/bson.c b/mongodb-1.9.0/src/libmongoc/src/libbson/src/bson/bson.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libbson/src/bson/bson.c
rename to mongodb-1.9.0/src/libmongoc/src/libbson/src/bson/bson.c
diff --git a/mongodb-1.8.1/src/libmongoc/src/libbson/src/bson/bson.h b/mongodb-1.9.0/src/libmongoc/src/libbson/src/bson/bson.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libbson/src/bson/bson.h
rename to mongodb-1.9.0/src/libmongoc/src/libbson/src/bson/bson.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/libbson/src/jsonsl/jsonsl.c b/mongodb-1.9.0/src/libmongoc/src/libbson/src/jsonsl/jsonsl.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libbson/src/jsonsl/jsonsl.c
rename to mongodb-1.9.0/src/libmongoc/src/libbson/src/jsonsl/jsonsl.c
diff --git a/mongodb-1.8.1/src/libmongoc/src/libbson/src/jsonsl/jsonsl.h b/mongodb-1.9.0/src/libmongoc/src/libbson/src/jsonsl/jsonsl.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libbson/src/jsonsl/jsonsl.h
rename to mongodb-1.9.0/src/libmongoc/src/libbson/src/jsonsl/jsonsl.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-aggregate-private.h b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-aggregate-private.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-aggregate-private.h
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-aggregate-private.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-aggregate.c b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-aggregate.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-aggregate.c
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-aggregate.c
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-apm-private.h b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-apm-private.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-apm-private.h
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-apm-private.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-apm.c b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-apm.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-apm.c
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-apm.c
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-apm.h b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-apm.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-apm.h
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-apm.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-array-private.h b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-array-private.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-array-private.h
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-array-private.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-array.c b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-array.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-array.c
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-array.c
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-async-cmd-private.h b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-async-cmd-private.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-async-cmd-private.h
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-async-cmd-private.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-async-cmd.c b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-async-cmd.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-async-cmd.c
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-async-cmd.c
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-async-private.h b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-async-private.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-async-private.h
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-async-private.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-async.c b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-async.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-async.c
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-async.c
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-buffer-private.h b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-buffer-private.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-buffer-private.h
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-buffer-private.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-buffer.c b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-buffer.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-buffer.c
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-buffer.c
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-bulk-operation-private.h b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-bulk-operation-private.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-bulk-operation-private.h
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-bulk-operation-private.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-bulk-operation.c b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-bulk-operation.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-bulk-operation.c
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-bulk-operation.c
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-bulk-operation.h b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-bulk-operation.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-bulk-operation.h
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-bulk-operation.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-change-stream-private.h b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-change-stream-private.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-change-stream-private.h
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-change-stream-private.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-change-stream.c b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-change-stream.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-change-stream.c
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-change-stream.c
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-change-stream.h b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-change-stream.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-change-stream.h
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-change-stream.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-client-pool-private.h b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-client-pool-private.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-client-pool-private.h
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-client-pool-private.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-client-pool.c b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-client-pool.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-client-pool.c
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-client-pool.c
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-client-pool.h b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-client-pool.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-client-pool.h
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-client-pool.h
diff --git a/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-client-private.h b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-client-private.h
new file mode 100644
index 00000000..30805646
--- /dev/null
+++ b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-client-private.h
@@ -0,0 +1,248 @@
+/*
+ * 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-prelude.h"
+
+#ifndef MONGOC_CLIENT_PRIVATE_H
+#define MONGOC_CLIENT_PRIVATE_H
+
+#include <bson/bson.h>
+
+#include "mongoc-apm-private.h"
+#include "mongoc-buffer-private.h"
+#include "mongoc-client.h"
+#include "mongoc-cluster-private.h"
+#include "mongoc-config.h"
+#include "mongoc-host-list.h"
+#include "mongoc-read-prefs.h"
+#include "mongoc-rpc-private.h"
+#include "mongoc-opcode.h"
+#ifdef MONGOC_ENABLE_SSL
+#include "mongoc-ssl.h"
+#endif
+
+#include "mongoc-stream.h"
+#include "mongoc-topology-private.h"
+#include "mongoc-write-concern.h"
+#include "mongoc-crypt-private.h"
+
+BSON_BEGIN_DECLS
+
+/* protocol versions this driver can speak */
+#define WIRE_VERSION_MIN 3
+#define WIRE_VERSION_MAX 9
+
+/* first version that supported "find" and "getMore" commands */
+#define WIRE_VERSION_FIND_CMD 4
+/* first version with "killCursors" command */
+#define WIRE_VERSION_KILLCURSORS_CMD 4
+/* first version when findAndModify accepts writeConcern */
+#define WIRE_VERSION_FAM_WRITE_CONCERN 4
+/* first version to support readConcern */
+#define WIRE_VERSION_READ_CONCERN 4
+/* first version to support maxStalenessSeconds */
+#define WIRE_VERSION_MAX_STALENESS 5
+/* first version to support writeConcern */
+#define WIRE_VERSION_CMD_WRITE_CONCERN 5
+/* first version to support collation */
+#define WIRE_VERSION_COLLATION 5
+/* first version to support server-side errors for unsupported hint options */
+#define WIRE_VERSION_HINT_SERVER_SIDE_ERROR 5
+/* first version to support OP_MSG */
+#define WIRE_VERSION_OP_MSG 6
+/* first version to support array filters for "update" command */
+#define WIRE_VERSION_ARRAY_FILTERS 6
+/* first version to support retryable reads */
+#define WIRE_VERSION_RETRY_READS 6
+/* first version to support retryable writes */
+#define WIRE_VERSION_RETRY_WRITES 6
+/* version corresponding to server 4.0 release */
+#define WIRE_VERSION_4_0 7
+/* first version to support hint for "update" command */
+#define WIRE_VERSION_UPDATE_HINT 8
+/* version corresponding to server 4.2 release */
+#define WIRE_VERSION_4_2 8
+/* version corresponding to client side field level encryption support. */
+#define WIRE_VERSION_CSE 8
+/* first version to throw server-side errors for unsupported hint in
+ * "findAndModify" command */
+#define WIRE_VERSION_FIND_AND_MODIFY_HINT_SERVER_SIDE_ERROR 8
+/* first version to support hint for "delete" command */
+#define WIRE_VERSION_DELETE_HINT 9
+/* first version to support hint for "findAndModify" command */
+#define WIRE_VERSION_FIND_AND_MODIFY_HINT 9
+/* version corresponding to server 4.4 release */
+#define WIRE_VERSION_4_4 9
+/* version corresponding to retryable writes error label */
+#define WIRE_VERSION_RETRYABLE_WRITE_ERROR_LABEL 9
+/* first version to support server hedged reads */
+#define WIRE_VERSION_HEDGED_READS 9
+
+struct _mongoc_collection_t;
+
+struct _mongoc_client_t {
+ mongoc_uri_t *uri;
+ mongoc_cluster_t cluster;
+ bool in_exhaust;
+
+ mongoc_stream_initiator_t initiator;
+ void *initiator_data;
+
+#ifdef MONGOC_ENABLE_SSL
+ bool use_ssl;
+ mongoc_ssl_opt_t ssl_opts;
+#endif
+
+ mongoc_topology_t *topology;
+
+ mongoc_read_prefs_t *read_prefs;
+ mongoc_read_concern_t *read_concern;
+ mongoc_write_concern_t *write_concern;
+
+ mongoc_apm_callbacks_t apm_callbacks;
+ void *apm_context;
+
+ int32_t error_api_version;
+ bool error_api_set;
+
+ /* mongoc_client_session_t's in use, to look up lsids and clusterTimes */
+ mongoc_set_t *client_sessions;
+ unsigned int csid_rand_seed;
+
+ uint32_t generation;
+};
+
+/* Defines whether _mongoc_client_command_with_opts() is acting as a read
+ * command helper for a command like "distinct", or a write command helper for
+ * a command like "createRole", or both, like "aggregate" with "$out".
+ */
+typedef enum {
+ MONGOC_CMD_RAW = 0,
+ MONGOC_CMD_READ = 1,
+ MONGOC_CMD_WRITE = 2,
+ MONGOC_CMD_RW = 3,
+} mongoc_command_mode_t;
+
+BSON_STATIC_ASSERT2 (mongoc_cmd_rw,
+ MONGOC_CMD_RW == (MONGOC_CMD_READ | MONGOC_CMD_WRITE));
+
+typedef enum { MONGOC_RR_SRV, MONGOC_RR_TXT } mongoc_rr_type_t;
+
+typedef struct _mongoc_rr_data_t {
+ /* Number of records returned by DNS. */
+ uint32_t count;
+
+ /* Set to lowest TTL found when polling SRV records. */
+ uint32_t min_ttl;
+
+ /* Set to the resulting host list when polling SRV records */
+ mongoc_host_list_t *hosts;
+
+ /* Set to the TXT record when polling for TXT */
+ char *txt_record_opts;
+} mongoc_rr_data_t;
+
+#define MONGOC_RR_DEFAULT_BUFFER_SIZE 1024
+bool
+_mongoc_client_get_rr (const char *service,
+ mongoc_rr_type_t rr_type,
+ mongoc_rr_data_t *rr_data,
+ size_t initial_buffer_size,
+ bson_error_t *error);
+
+mongoc_client_t *
+_mongoc_client_new_from_uri (mongoc_topology_t *topology);
+
+bool
+_mongoc_client_set_apm_callbacks_private (mongoc_client_t *client,
+ mongoc_apm_callbacks_t *callbacks,
+ void *context);
+
+mongoc_stream_t *
+mongoc_client_default_stream_initiator (const mongoc_uri_t *uri,
+ const mongoc_host_list_t *host,
+ void *user_data,
+ bson_error_t *error);
+
+mongoc_stream_t *
+_mongoc_client_create_stream (mongoc_client_t *client,
+ const mongoc_host_list_t *host,
+ bson_error_t *error);
+
+bool
+_mongoc_client_recv (mongoc_client_t *client,
+ mongoc_rpc_t *rpc,
+ mongoc_buffer_t *buffer,
+ mongoc_server_stream_t *server_stream,
+ bson_error_t *error);
+
+void
+_mongoc_client_kill_cursor (mongoc_client_t *client,
+ uint32_t server_id,
+ int64_t cursor_id,
+ int64_t operation_id,
+ const char *db,
+ const char *collection,
+ mongoc_client_session_t *cs);
+bool
+_mongoc_client_command_with_opts (mongoc_client_t *client,
+ const char *db_name,
+ const bson_t *command,
+ mongoc_command_mode_t mode,
+ const bson_t *opts,
+ mongoc_query_flags_t flags,
+ const mongoc_read_prefs_t *user_prefs,
+ const mongoc_read_prefs_t *default_prefs,
+ mongoc_read_concern_t *default_rc,
+ mongoc_write_concern_t *default_wc,
+ bson_t *reply,
+ bson_error_t *error);
+
+mongoc_server_session_t *
+_mongoc_client_pop_server_session (mongoc_client_t *client,
+ bson_error_t *error);
+
+bool
+_mongoc_client_lookup_session (const mongoc_client_t *client,
+ uint32_t client_session_id,
+ mongoc_client_session_t **cs,
+ bson_error_t *error);
+
+void
+_mongoc_client_unregister_session (mongoc_client_t *client,
+ mongoc_client_session_t *session);
+
+void
+_mongoc_client_push_server_session (mongoc_client_t *client,
+ mongoc_server_session_t *server_session);
+void
+_mongoc_client_end_sessions (mongoc_client_t *client);
+
+mongoc_stream_t *
+mongoc_client_connect_tcp (int32_t connecttimeoutms,
+ const mongoc_host_list_t *host,
+ bson_error_t *error);
+
+mongoc_stream_t *
+mongoc_client_connect (bool buffered,
+ bool use_ssl,
+ void *ssl_opts_void,
+ const mongoc_uri_t *uri,
+ const mongoc_host_list_t *host,
+ bson_error_t *error);
+BSON_END_DECLS
+
+#endif /* MONGOC_CLIENT_PRIVATE_H */
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-client-session-private.h b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-client-session-private.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-client-session-private.h
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-client-session-private.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-client-session.c b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-client-session.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-client-session.c
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-client-session.c
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-client-session.h b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-client-session.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-client-session.h
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-client-session.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-client-side-encryption-private.h b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-client-side-encryption-private.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-client-side-encryption-private.h
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-client-side-encryption-private.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-client-side-encryption.c b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-client-side-encryption.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-client-side-encryption.c
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-client-side-encryption.c
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-client-side-encryption.h b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-client-side-encryption.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-client-side-encryption.h
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-client-side-encryption.h
diff --git a/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-client.c b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-client.c
new file mode 100644
index 00000000..5d96526a
--- /dev/null
+++ b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-client.c
@@ -0,0 +1,3083 @@
+/*
+ * 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 <bson/bson.h>
+#include "mongoc-config.h"
+#ifdef MONGOC_HAVE_DNSAPI
+/* for DnsQuery_UTF8 */
+#include <Windows.h>
+#include <WinDNS.h>
+#include <ws2tcpip.h>
+#else
+#if defined(MONGOC_HAVE_RES_NSEARCH) || defined(MONGOC_HAVE_RES_SEARCH)
+#include <netdb.h>
+#include <netinet/tcp.h>
+#include <arpa/nameser.h>
+#include <resolv.h>
+#define BSON_INSIDE
+#include <bson/bson-string.h>
+#undef BSON_INSIDE
+
+#endif
+#endif
+
+#include "mongoc-client-private.h"
+#include "mongoc-client-side-encryption-private.h"
+#include "mongoc-collection-private.h"
+#include "mongoc-counters-private.h"
+#include "mongoc-database-private.h"
+#include "mongoc-gridfs-private.h"
+#include "mongoc-error.h"
+#include "mongoc-error-private.h"
+#include "mongoc-log.h"
+#include "mongoc-queue-private.h"
+#include "mongoc-socket.h"
+#include "mongoc-stream-buffered.h"
+#include "mongoc-stream-socket.h"
+#include "mongoc-thread-private.h"
+#include "mongoc-trace-private.h"
+#include "mongoc-uri-private.h"
+#include "mongoc-util-private.h"
+#include "mongoc-set-private.h"
+#include "mongoc-log.h"
+#include "mongoc-write-concern-private.h"
+#include "mongoc-read-concern-private.h"
+#include "mongoc-host-list-private.h"
+#include "mongoc-read-prefs-private.h"
+#include "mongoc-change-stream-private.h"
+#include "mongoc-client-session-private.h"
+#include "mongoc-cursor-private.h"
+
+#ifdef MONGOC_ENABLE_SSL
+#include "mongoc-stream-tls.h"
+#include "mongoc-ssl-private.h"
+#include "mongoc-cmd-private.h"
+#include "mongoc-opts-private.h"
+#endif
+
+
+#undef MONGOC_LOG_DOMAIN
+#define MONGOC_LOG_DOMAIN "client"
+
+
+static void
+_mongoc_client_op_killcursors (mongoc_cluster_t *cluster,
+ mongoc_server_stream_t *server_stream,
+ int64_t cursor_id,
+ int64_t operation_id,
+ const char *db,
+ const char *collection);
+
+static void
+_mongoc_client_killcursors_command (mongoc_cluster_t *cluster,
+ mongoc_server_stream_t *server_stream,
+ int64_t cursor_id,
+ const char *db,
+ const char *collection,
+ mongoc_client_session_t *cs);
+
+#define DNS_ERROR(_msg, ...) \
+ do { \
+ bson_set_error (error, \
+ MONGOC_ERROR_STREAM, \
+ MONGOC_ERROR_STREAM_NAME_RESOLUTION, \
+ _msg, \
+ __VA_ARGS__); \
+ GOTO (done); \
+ } while (0)
+
+
+#ifdef MONGOC_HAVE_DNSAPI
+
+typedef bool (*mongoc_rr_callback_t) (const char *service,
+ PDNS_RECORD pdns,
+ mongoc_rr_data_t *rr_data,
+ bson_error_t *error);
+
+static bool
+srv_callback (const char *service,
+ PDNS_RECORD pdns,
+ mongoc_rr_data_t *rr_data,
+ bson_error_t *error)
+{
+ mongoc_host_list_t new_host;
+
+ if (rr_data && rr_data->hosts) {
+ _mongoc_host_list_remove_host (
+ &(rr_data->hosts), pdns->Data.SRV.pNameTarget, pdns->Data.SRV.wPort);
+ }
+
+ if (!_mongoc_host_list_from_hostport_with_err (
+ &new_host, pdns->Data.SRV.pNameTarget, pdns->Data.SRV.wPort, error)) {
+ return false;
+ }
+ _mongoc_host_list_upsert (&rr_data->hosts, &new_host);
+
+ return true;
+}
+
+/* rr_data is unused, but here to match srv_callback signature */
+static bool
+txt_callback (const char *service,
+ PDNS_RECORD pdns,
+ mongoc_rr_data_t *rr_data,
+ bson_error_t *error)
+{
+ DWORD i;
+ bson_string_t *txt;
+
+ txt = bson_string_new (NULL);
+
+ for (i = 0; i < pdns->Data.TXT.dwStringCount; i++) {
+ bson_string_append (txt, pdns->Data.TXT.pStringArray[i]);
+ }
+
+ rr_data->txt_record_opts = bson_strdup (txt->str);
+ bson_string_free (txt, true);
+
+ return true;
+}
+
+/*
+ *--------------------------------------------------------------------------
+ *
+ * _mongoc_get_rr_dnsapi --
+ *
+ * Fetch SRV or TXT resource records using the Windows DNS API and
+ * put results in @rr_data.
+ *
+ * Returns:
+ * Success or failure.
+ *
+ * For an SRV lookup, returns false if there is any error.
+ *
+ * For TXT lookup, ignores any error fetching the resource record and
+ * always returns true.
+ *
+ * Side effects:
+ * @error is set if there is a failure.
+ * @rr_data->hosts may be set if querying SRV. Caller must destroy.
+ * @rr_data->txt_record_opts may be set if querying TXT. Caller must
+ * free.
+ *
+ *--------------------------------------------------------------------------
+ */
+
+static bool
+_mongoc_get_rr_dnsapi (const char *service,
+ mongoc_rr_type_t rr_type,
+ mongoc_rr_data_t *rr_data,
+ bson_error_t *error)
+{
+ const char *rr_type_name;
+ WORD nst;
+ mongoc_rr_callback_t callback;
+ PDNS_RECORD pdns = NULL;
+ DNS_STATUS res;
+ LPVOID lpMsgBuf = NULL;
+ bool dns_success;
+ bool callback_success = true;
+ int i;
+
+ ENTRY;
+
+ if (rr_type == MONGOC_RR_SRV) {
+ /* return true only if DNS succeeds */
+ dns_success = false;
+ rr_type_name = "SRV";
+ nst = DNS_TYPE_SRV;
+ callback = srv_callback;
+ } else {
+ /* return true whether or not DNS succeeds */
+ dns_success = true;
+ rr_type_name = "TXT";
+ nst = DNS_TYPE_TEXT;
+ callback = txt_callback;
+ }
+
+ res = DnsQuery_UTF8 (service,
+ nst,
+ DNS_QUERY_BYPASS_CACHE,
+ NULL /* IP Address */,
+ &pdns,
+ 0 /* reserved */);
+
+ if (res) {
+ DWORD flags = FORMAT_MESSAGE_ALLOCATE_BUFFER |
+ FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS;
+
+ if (FormatMessage (flags,
+ 0,
+ res,
+ MAKELANGID (LANG_NEUTRAL, SUBLANG_DEFAULT),
+ (LPTSTR) &lpMsgBuf,
+ 0,
+ 0)) {
+ DNS_ERROR ("Failed to look up %s record \"%s\": %s",
+ rr_type_name,
+ service,
+ (char *) lpMsgBuf);
+ }
+
+ DNS_ERROR ("Failed to look up %s record \"%s\": Unknown error",
+ rr_type_name,
+ service);
+ }
+
+ if (!pdns) {
+ DNS_ERROR ("No %s records for \"%s\"", rr_type_name, service);
+ }
+
+ i = 0;
+
+ do {
+ /* DnsQuery can return additional records not of the requested type */
+ if ((rr_type == MONGOC_RR_TXT && pdns->wType == DNS_TYPE_TEXT) ||
+ (rr_type == MONGOC_RR_SRV && pdns->wType == DNS_TYPE_SRV)) {
+ if (i > 0 && rr_type == MONGOC_RR_TXT) {
+ /* Initial DNS Seedlist Discovery Spec: a client "MUST raise an
+ error when multiple TXT records are encountered". */
+ callback_success = false;
+ DNS_ERROR ("Multiple TXT records for \"%s\"", service);
+ }
+
+ if (rr_data) {
+ if ((i == 0) || (pdns->dwTtl < rr_data->min_ttl)) {
+ rr_data->min_ttl = pdns->dwTtl;
+ }
+ }
+
+ if (!callback (service, pdns, rr_data, error)) {
+ callback_success = false;
+ GOTO (done);
+ }
+
+ i++;
+ }
+
+ pdns = pdns->pNext;
+ } while (pdns);
+
+
+ rr_data->count = i;
+ if (i == 0) {
+ DNS_ERROR ("No matching %s records for \"%s\"", rr_type_name, service);
+ }
+ dns_success = true;
+
+done:
+ if (pdns) {
+ DnsRecordListFree (pdns, DnsFreeRecordList);
+ }
+
+ if (lpMsgBuf) {
+ LocalFree (lpMsgBuf);
+ }
+
+ RETURN (dns_success && callback_success);
+}
+
+#elif (defined(MONGOC_HAVE_RES_NSEARCH) || defined(MONGOC_HAVE_RES_SEARCH))
+
+typedef bool (*mongoc_rr_callback_t) (const char *service,
+ ns_msg *ns_answer,
+ ns_rr *rr,
+ mongoc_rr_data_t *rr_data,
+ bson_error_t *error);
+
+static bool
+srv_callback (const char *service,
+ ns_msg *ns_answer,
+ ns_rr *rr,
+ mongoc_rr_data_t *rr_data,
+ bson_error_t *error)
+{
+ const uint8_t *data;
+ char name[1024];
+ uint16_t port;
+ int size;
+ bool ret = false;
+ mongoc_host_list_t new_host;
+
+ data = ns_rr_rdata (*rr);
+ /* memcpy the network endian port before converting to host endian. we cannot
+ * cast (data + 4) directly as a uint16_t*, because it may not align on an
+ * 2-byte boundary. */
+ memcpy (&port, data + 4, sizeof (port));
+ port = ntohs (port);
+ size = dn_expand (ns_msg_base (*ns_answer),
+ ns_msg_end (*ns_answer),
+ data + 6,
+ name,
+ sizeof (name));
+
+ if (size < 1) {
+ DNS_ERROR ("Invalid record in SRV answer for \"%s\": \"%s\"",
+ service,
+ strerror (h_errno));
+ }
+
+ if (!_mongoc_host_list_from_hostport_with_err (
+ &new_host, name, port, error)) {
+ GOTO (done);
+ }
+ _mongoc_host_list_upsert (&rr_data->hosts, &new_host);
+ ret = true;
+done:
+ return ret;
+}
+
+static bool
+txt_callback (const char *service,
+ ns_msg *ns_answer,
+ ns_rr *rr,
+ mongoc_rr_data_t *rr_data,
+ bson_error_t *error)
+{
+ char s[256];
+ const uint8_t *data;
+ bson_string_t *txt;
+ uint16_t pos, total;
+ uint8_t len;
+ bool ret = false;
+
+ total = (uint16_t) ns_rr_rdlen (*rr);
+ if (total < 1 || total > 255) {
+ DNS_ERROR ("Invalid TXT record size %hu for \"%s\"", total, service);
+ }
+
+ /* a TXT record has one or more strings, each up to 255 chars, each is
+ * prefixed by its length as 1 byte. thus endianness doesn't matter. */
+ txt = bson_string_new (NULL);
+ pos = 0;
+ data = ns_rr_rdata (*rr);
+
+ while (pos < total) {
+ memcpy (&len, data + pos, sizeof (uint8_t));
+ pos++;
+ bson_strncpy (s, (const char *) (data + pos), (size_t) len + 1);
+ bson_string_append (txt, s);
+ pos += len;
+ }
+
+ rr_data->txt_record_opts = bson_strdup (txt->str);
+ bson_string_free (txt, true);
+ ret = true;
+
+done:
+ return ret;
+}
+
+/*
+ *--------------------------------------------------------------------------
+ *
+ * _mongoc_get_rr_search --
+ *
+ * Fetch SRV or TXT resource records using libresolv and put results in
+ * @rr_data.
+ *
+ * Returns:
+ * Success or failure.
+ *
+ * For an SRV lookup, returns false if there is any error.
+ *
+ * For TXT lookup, ignores any error fetching the resource record and
+ * always returns true.
+ *
+ * Side effects:
+ * @error is set if there is a failure.
+ * @rr_data->hosts may be set if querying SRV. Caller must destroy.
+ * @rr_data->txt_record_opts may be set if querying TXT. Caller must
+ * free.
+ *
+ *--------------------------------------------------------------------------
+ */
+
+static bool
+_mongoc_get_rr_search (const char *service,
+ mongoc_rr_type_t rr_type,
+ mongoc_rr_data_t *rr_data,
+ size_t initial_buffer_size,
+ bson_error_t *error)
+{
+#ifdef MONGOC_HAVE_RES_NSEARCH
+ struct __res_state state = {0};
+#endif
+ int size = 0;
+ unsigned char *search_buf = NULL;
+ size_t buffer_size = initial_buffer_size;
+ ns_msg ns_answer;
+ int n;
+ int i;
+ const char *rr_type_name;
+ ns_type nst;
+ mongoc_rr_callback_t callback;
+ ns_rr resource_record;
+ bool dns_success;
+ bool callback_success = true;
+ int num_matching_records;
+
+ ENTRY;
+
+ if (rr_type == MONGOC_RR_SRV) {
+ /* return true only if DNS succeeds */
+ dns_success = false;
+ rr_type_name = "SRV";
+ nst = ns_t_srv;
+ callback = srv_callback;
+ } else {
+ /* return true whether or not DNS succeeds */
+ dns_success = true;
+ rr_type_name = "TXT";
+ nst = ns_t_txt;
+ callback = txt_callback;
+ }
+
+ do {
+ if (search_buf) {
+ bson_free (search_buf);
+
+ /* increase buffer size by the previous response size. This ensures
+ * that even if a subsequent response is larger, we'll still be able
+ * to fit it in the response buffer */
+ buffer_size = buffer_size + size;
+ }
+
+ search_buf = (unsigned char *) bson_malloc (buffer_size);
+ BSON_ASSERT (search_buf);
+
+#ifdef MONGOC_HAVE_RES_NSEARCH
+ /* thread-safe */
+ res_ninit (&state);
+ size =
+ res_nsearch (&state, service, ns_c_in, nst, search_buf, buffer_size);
+#elif defined(MONGOC_HAVE_RES_SEARCH)
+ size = res_search (service, ns_c_in, nst, search_buf, buffer_size);
+#endif
+
+ if (size < 0) {
+ DNS_ERROR ("Failed to look up %s record \"%s\": %s",
+ rr_type_name,
+ service,
+ strerror (h_errno));
+ }
+ } while (size >= buffer_size);
+
+ if (ns_initparse (search_buf, size, &ns_answer)) {
+ DNS_ERROR ("Invalid %s answer for \"%s\"", rr_type_name, service);
+ }
+
+ n = ns_msg_count (ns_answer, ns_s_an);
+ if (!n) {
+ DNS_ERROR ("No %s records for \"%s\"", rr_type_name, service);
+ }
+
+ rr_data->count = n;
+ num_matching_records = 0;
+ for (i = 0; i < n; i++) {
+ if (ns_parserr (&ns_answer, ns_s_an, i, &resource_record)) {
+ DNS_ERROR ("Invalid record %d of %s answer for \"%s\": \"%s\"",
+ i,
+ rr_type_name,
+ service,
+ strerror (h_errno));
+ }
+
+ /* Skip records that don't match the ones we requested. CDRIVER-3628 shows
+ * that we can receive records that were not requested. */
+ if (rr_type == MONGOC_RR_TXT) {
+ if (ns_rr_type (resource_record) != ns_t_txt) {
+ continue;
+ }
+ } else if (rr_type == MONGOC_RR_SRV) {
+ if (ns_rr_type (resource_record) != ns_t_srv) {
+ continue;
+ }
+ }
+
+ if (num_matching_records > 0 && rr_type == MONGOC_RR_TXT) {
+ /* Initial DNS Seedlist Discovery Spec: a client "MUST raise an error
+ * when multiple TXT records are encountered". */
+ callback_success = false;
+ DNS_ERROR ("Multiple TXT records for \"%s\"", service);
+ }
+
+ num_matching_records++;
+
+ if (rr_data) {
+ uint32_t ttl;
+
+ ttl = ns_rr_ttl (resource_record);
+ if ((i == 0) || (ttl < rr_data->min_ttl)) {
+ rr_data->min_ttl = ttl;
+ }
+ }
+
+ if (!callback (service, &ns_answer, &resource_record, rr_data, error)) {
+ callback_success = false;
+ GOTO (done);
+ }
+ }
+
+ if (num_matching_records == 0) {
+ DNS_ERROR ("No matching %s records for \"%s\"", rr_type_name, service);
+ }
+
+ dns_success = true;
+
+done:
+
+ bson_free (search_buf);
+
+#ifdef MONGOC_HAVE_RES_NDESTROY
+ /* defined on BSD/Darwin, and only if MONGOC_HAVE_RES_NSEARCH is defined */
+ res_ndestroy (&state);
+#elif defined(MONGOC_HAVE_RES_NCLOSE)
+ /* defined on Linux, and only if MONGOC_HAVE_RES_NSEARCH is defined */
+ res_nclose (&state);
+#endif
+ RETURN (dns_success && callback_success);
+}
+#endif
+
+/*
+ *--------------------------------------------------------------------------
+ *
+ * _mongoc_client_get_rr --
+ *
+ * Fetch an SRV or TXT resource record and update put results in
+ * @rr_data.
+ *
+ * See RFCs 1464 and 2782, MongoDB's "Initial DNS Seedlist Discovery"
+ * spec, and MongoDB's "Polling SRV Records for Mongos Discovery"
+ * spec.
+ *
+ * Returns:
+ * Success or failure.
+ *
+ * Side effects:
+ * @error is set if there is a failure. Errors fetching TXT are
+ * ignored.
+ * @rr_data->hosts may be set if querying SRV. Caller must destroy.
+ * @rr_data->txt_record_opts may be set if querying TXT. Caller must
+ * free.
+ *
+ *--------------------------------------------------------------------------
+ */
+
+bool
+_mongoc_client_get_rr (const char *service,
+ mongoc_rr_type_t rr_type,
+ mongoc_rr_data_t *rr_data,
+ size_t initial_buffer_size,
+ bson_error_t *error)
+{
+#ifdef MONGOC_HAVE_DNSAPI
+ return _mongoc_get_rr_dnsapi (service, rr_type, rr_data, error);
+#elif (defined(MONGOC_HAVE_RES_NSEARCH) || defined(MONGOC_HAVE_RES_SEARCH))
+ return _mongoc_get_rr_search (
+ service, rr_type, rr_data, initial_buffer_size, error);
+#else
+ bson_set_error (error,
+ MONGOC_ERROR_STREAM,
+ MONGOC_ERROR_STREAM_NAME_RESOLUTION,
+ "libresolv unavailable, cannot use mongodb+srv URI");
+ return false;
+#endif
+}
+
+#undef DNS_ERROR
+
+/*
+ *--------------------------------------------------------------------------
+ *
+ * mongoc_client_connect_tcp --
+ *
+ * Connect to a host using a TCP socket.
+ *
+ * This will be performed synchronously and return a mongoc_stream_t
+ * that can be used to connect with the remote host.
+ *
+ * Returns:
+ * A newly allocated mongoc_stream_t if successful; otherwise
+ * NULL and @error is set.
+ *
+ * Side effects:
+ * @error is set if return value is NULL.
+ *
+ *--------------------------------------------------------------------------
+ */
+
+mongoc_stream_t *
+mongoc_client_connect_tcp (int32_t connecttimeoutms,
+ const mongoc_host_list_t *host,
+ bson_error_t *error)
+{
+ mongoc_socket_t *sock = NULL;
+ struct addrinfo hints;
+ struct addrinfo *result, *rp;
+ int64_t expire_at;
+ char portstr[8];
+ int s;
+
+ ENTRY;
+
+ BSON_ASSERT (connecttimeoutms);
+ BSON_ASSERT (host);
+
+ bson_snprintf (portstr, sizeof portstr, "%hu", host->port);
+
+ memset (&hints, 0, sizeof hints);
+ hints.ai_family = host->family;
+ hints.ai_socktype = SOCK_STREAM;
+ hints.ai_flags = 0;
+ hints.ai_protocol = 0;
+
+ TRACE ("DNS lookup for %s", host->host);
+ s = getaddrinfo (host->host, portstr, &hints, &result);
+
+ if (s != 0) {
+ mongoc_counter_dns_failure_inc ();
+ TRACE ("Failed to resolve %s", host->host);
+ bson_set_error (error,
+ MONGOC_ERROR_STREAM,
+ MONGOC_ERROR_STREAM_NAME_RESOLUTION,
+ "Failed to resolve %s",
+ host->host);
+ RETURN (NULL);
+ }
+
+ mongoc_counter_dns_success_inc ();
+
+ for (rp = result; rp; rp = rp->ai_next) {
+ /*
+ * Create a new non-blocking socket.
+ */
+ if (!(sock = mongoc_socket_new (
+ rp->ai_family, rp->ai_socktype, rp->ai_protocol))) {
+ continue;
+ }
+
+ /*
+ * Try to connect to the peer.
+ */
+ expire_at = bson_get_monotonic_time () + (connecttimeoutms * 1000L);
+ if (0 !=
+ mongoc_socket_connect (
+ sock, rp->ai_addr, (mongoc_socklen_t) rp->ai_addrlen, expire_at)) {
+ mongoc_socket_destroy (sock);
+ sock = NULL;
+ continue;
+ }
+
+ break;
+ }
+
+ if (!sock) {
+ bson_set_error (error,
+ MONGOC_ERROR_STREAM,
+ MONGOC_ERROR_STREAM_CONNECT,
+ "Failed to connect to target host: %s",
+ host->host_and_port);
+ freeaddrinfo (result);
+ RETURN (NULL);
+ }
+
+ freeaddrinfo (result);
+
+ return mongoc_stream_socket_new (sock);
+}
+
+
+/*
+ *--------------------------------------------------------------------------
+ *
+ * mongoc_client_connect_unix --
+ *
+ * Connect to a MongoDB server using a UNIX domain socket.
+ *
+ * Returns:
+ * A newly allocated mongoc_stream_t if successful; otherwise
+ * NULL and @error is set.
+ *
+ * Side effects:
+ * @error is set if return value is NULL.
+ *
+ *--------------------------------------------------------------------------
+ */
+
+static mongoc_stream_t *
+mongoc_client_connect_unix (const mongoc_host_list_t *host, bson_error_t *error)
+{
+#ifdef _WIN32
+ ENTRY;
+ bson_set_error (error,
+ MONGOC_ERROR_STREAM,
+ MONGOC_ERROR_STREAM_CONNECT,
+ "UNIX domain sockets not supported on win32.");
+ RETURN (NULL);
+#else
+ struct sockaddr_un saddr;
+ mongoc_socket_t *sock;
+ mongoc_stream_t *ret = NULL;
+
+ ENTRY;
+
+ BSON_ASSERT (host);
+
+ memset (&saddr, 0, sizeof saddr);
+ saddr.sun_family = AF_UNIX;
+ bson_snprintf (saddr.sun_path, sizeof saddr.sun_path - 1, "%s", host->host);
+
+ sock = mongoc_socket_new (AF_UNIX, SOCK_STREAM, 0);
+
+ if (sock == NULL) {
+ bson_set_error (error,
+ MONGOC_ERROR_STREAM,
+ MONGOC_ERROR_STREAM_SOCKET,
+ "Failed to create socket.");
+ RETURN (NULL);
+ }
+
+ if (-1 == mongoc_socket_connect (
+ sock, (struct sockaddr *) &saddr, sizeof saddr, -1)) {
+ mongoc_socket_destroy (sock);
+ bson_set_error (error,
+ MONGOC_ERROR_STREAM,
+ MONGOC_ERROR_STREAM_CONNECT,
+ "Failed to connect to UNIX domain socket.");
+ RETURN (NULL);
+ }
+
+ ret = mongoc_stream_socket_new (sock);
+
+ RETURN (ret);
+#endif
+}
+
+mongoc_stream_t *
+mongoc_client_connect (bool buffered,
+ bool use_ssl,
+ void *ssl_opts_void,
+ const mongoc_uri_t *uri,
+ const mongoc_host_list_t *host,
+ bson_error_t *error)
+{
+ mongoc_stream_t *base_stream = NULL;
+ int32_t connecttimeoutms;
+
+ BSON_ASSERT (uri);
+ BSON_ASSERT (host);
+
+#ifndef MONGOC_ENABLE_SSL
+ if (ssl_opts_void || mongoc_uri_get_tls (uri)) {
+ bson_set_error (error,
+ MONGOC_ERROR_CLIENT,
+ MONGOC_ERROR_CLIENT_NO_ACCEPTABLE_PEER,
+ "TLS is not enabled in this build of mongo-c-driver.");
+ return NULL;
+ }
+#endif
+
+ connecttimeoutms = mongoc_uri_get_option_as_int32 (
+ uri, MONGOC_URI_CONNECTTIMEOUTMS, MONGOC_DEFAULT_CONNECTTIMEOUTMS);
+
+ switch (host->family) {
+ case AF_UNSPEC:
+#if defined(AF_INET6)
+ case AF_INET6:
+#endif
+ case AF_INET:
+ base_stream = mongoc_client_connect_tcp (connecttimeoutms, host, error);
+ break;
+ case AF_UNIX:
+ base_stream = mongoc_client_connect_unix (host, error);
+ break;
+ default:
+ bson_set_error (error,
+ MONGOC_ERROR_STREAM,
+ MONGOC_ERROR_STREAM_INVALID_TYPE,
+ "Invalid address family: 0x%02x",
+ host->family);
+ break;
+ }
+
+#ifdef MONGOC_ENABLE_SSL
+ if (base_stream) {
+ mongoc_ssl_opt_t *ssl_opts;
+ const char *mechanism;
+
+ ssl_opts = (mongoc_ssl_opt_t *) ssl_opts_void;
+ mechanism = mongoc_uri_get_auth_mechanism (uri);
+
+ if (use_ssl || (mechanism && (0 == strcmp (mechanism, "MONGODB-X509")))) {
+ mongoc_stream_t *original = base_stream;
+
+ base_stream = mongoc_stream_tls_new_with_hostname (
+ base_stream, host->host, ssl_opts, true);
+
+ if (!base_stream) {
+ mongoc_stream_destroy (original);
+ bson_set_error (error,
+ MONGOC_ERROR_STREAM,
+ MONGOC_ERROR_STREAM_SOCKET,
+ "Failed initialize TLS state.");
+ return NULL;
+ }
+
+ if (!mongoc_stream_tls_handshake_block (
+ base_stream, host->host, connecttimeoutms, error)) {
+ mongoc_stream_destroy (base_stream);
+ return NULL;
+ }
+ }
+ }
+#endif
+
+ if (!base_stream) {
+ return NULL;
+ }
+ if (buffered) {
+ return mongoc_stream_buffered_new (base_stream, 1024);
+ }
+ return base_stream;
+}
+
+/*
+ *--------------------------------------------------------------------------
+ *
+ * mongoc_client_default_stream_initiator --
+ *
+ * A mongoc_stream_initiator_t that will handle the various type
+ * of supported sockets by MongoDB including TCP and UNIX.
+ *
+ * Language binding authors may want to implement an alternate
+ * version of this method to use their native stream format.
+ *
+ * Returns:
+ * A mongoc_stream_t if successful; otherwise NULL and @error is set.
+ *
+ * Side effects:
+ * @error is set if return value is NULL.
+ *
+ *--------------------------------------------------------------------------
+ */
+
+mongoc_stream_t *
+mongoc_client_default_stream_initiator (const mongoc_uri_t *uri,
+ const mongoc_host_list_t *host,
+ void *user_data,
+ bson_error_t *error)
+{
+ void *ssl_opts_void = NULL;
+ bool use_ssl = false;
+#ifdef MONGOC_ENABLE_SSL
+ mongoc_client_t *client = (mongoc_client_t *) user_data;
+
+ use_ssl = client->use_ssl;
+ ssl_opts_void = (void *) &client->ssl_opts;
+
+#endif
+
+ return mongoc_client_connect (
+ true, use_ssl, ssl_opts_void, uri, host, error);
+}
+
+/*
+ *--------------------------------------------------------------------------
+ *
+ * _mongoc_client_create_stream --
+ *
+ * INTERNAL API
+ *
+ * This function is used by the mongoc_cluster_t to initiate a
+ * new stream. This is done because cluster is private API and
+ * those using mongoc_client_t may need to override this process.
+ *
+ * This function calls the default initiator for new streams.
+ *
+ * Returns:
+ * A newly allocated mongoc_stream_t if successful; otherwise
+ * NULL and @error is set.
+ *
+ * Side effects:
+ * @error is set if return value is NULL.
+ *
+ *--------------------------------------------------------------------------
+ */
+
+mongoc_stream_t *
+_mongoc_client_create_stream (mongoc_client_t *client,
+ const mongoc_host_list_t *host,
+ bson_error_t *error)
+{
+ BSON_ASSERT (client);
+ BSON_ASSERT (host);
+
+ return client->initiator (client->uri, host, client->initiator_data, error);
+}
+
+
+/*
+ *--------------------------------------------------------------------------
+ *
+ * _mongoc_client_recv --
+ *
+ * Receives a RPC from a remote MongoDB cluster node.
+ *
+ * Returns:
+ * true if successful; otherwise false and @error is set.
+ *
+ * Side effects:
+ * @error is set if return value is false.
+ *
+ *--------------------------------------------------------------------------
+ */
+
+bool
+_mongoc_client_recv (mongoc_client_t *client,
+ mongoc_rpc_t *rpc,
+ mongoc_buffer_t *buffer,
+ mongoc_server_stream_t *server_stream,
+ bson_error_t *error)
+{
+ BSON_ASSERT (client);
+ BSON_ASSERT (rpc);
+ BSON_ASSERT (buffer);
+ BSON_ASSERT (server_stream);
+
+ return mongoc_cluster_try_recv (
+ &client->cluster, rpc, buffer, server_stream, error);
+}
+
+
+/*
+ *--------------------------------------------------------------------------
+ *
+ * mongoc_client_new --
+ *
+ * Create a new mongoc_client_t using the URI provided.
+ *
+ * @uri should be a MongoDB URI string such as "mongodb://localhost/"
+ * More information on the format can be found at
+ * http://docs.mongodb.org/manual/reference/connection-string/
+ *
+ * Returns:
+ * A newly allocated mongoc_client_t or NULL if @uri_string is
+ * invalid.
+ *
+ * Side effects:
+ * None.
+ *
+ *--------------------------------------------------------------------------
+ */
+mongoc_client_t *
+mongoc_client_new (const char *uri_string)
+{
+ mongoc_topology_t *topology;
+ mongoc_client_t *client;
+ mongoc_uri_t *uri;
+
+
+ if (!uri_string) {
+ uri_string = "mongodb://127.0.0.1/";
+ }
+
+ if (!(uri = mongoc_uri_new (uri_string))) {
+ return NULL;
+ }
+
+ topology = mongoc_topology_new (uri, true);
+
+ client = _mongoc_client_new_from_uri (topology);
+ if (!client) {
+ mongoc_topology_destroy (topology);
+ }
+ mongoc_uri_destroy (uri);
+
+ return client;
+}
+
+
+/*
+ *--------------------------------------------------------------------------
+ *
+ * mongoc_client_set_ssl_opts
+ *
+ * set ssl opts for a client
+ *
+ * Returns:
+ * Nothing
+ *
+ * Side effects:
+ * None.
+ *
+ *--------------------------------------------------------------------------
+ */
+
+#ifdef MONGOC_ENABLE_SSL
+/* Only called internally. Caller must ensure opts->internal is valid. */
+void
+_mongoc_client_set_internal_tls_opts (mongoc_client_t *client,
+ _mongoc_internal_tls_opts_t *internal)
+{
+ if (!client->use_ssl) {
+ return;
+ }
+ client->ssl_opts.internal =
+ bson_malloc (sizeof (_mongoc_internal_tls_opts_t));
+ memcpy (client->ssl_opts.internal,
+ internal,
+ sizeof (_mongoc_internal_tls_opts_t));
+}
+
+void
+mongoc_client_set_ssl_opts (mongoc_client_t *client,
+ const mongoc_ssl_opt_t *opts)
+{
+ BSON_ASSERT (client);
+ BSON_ASSERT (opts);
+
+ _mongoc_ssl_opts_cleanup (&client->ssl_opts,
+ false /* don't free internal opts */);
+
+ client->use_ssl = true;
+ _mongoc_ssl_opts_copy_to (
+ opts, &client->ssl_opts, false /* don't overwrite internal opts */);
+
+ if (client->topology->single_threaded) {
+ mongoc_topology_scanner_set_ssl_opts (client->topology->scanner,
+ &client->ssl_opts);
+ }
+}
+#endif
+
+
+/*
+ *--------------------------------------------------------------------------
+ *
+ * mongoc_client_new_from_uri --
+ *
+ * Create a new mongoc_client_t for a mongoc_uri_t.
+ *
+ * Returns:
+ * A newly allocated mongoc_client_t.
+ *
+ * Side effects:
+ * None.
+ *
+ *--------------------------------------------------------------------------
+ */
+
+mongoc_client_t *
+mongoc_client_new_from_uri (const mongoc_uri_t *uri)
+{
+ mongoc_topology_t *topology;
+
+ topology = mongoc_topology_new (uri, true);
+
+ /* topology->uri may be different from uri: if this is a mongodb+srv:// URI
+ * then mongoc_topology_new has fetched SRV and TXT records and updated its
+ * uri from them.
+ */
+ return _mongoc_client_new_from_uri (topology);
+}
+
+/*
+ *--------------------------------------------------------------------------
+ *
+ * _mongoc_client_new_from_uri --
+ *
+ * Create a new mongoc_client_t for a given topology object.
+ *
+ * Returns:
+ * A newly allocated mongoc_client_t.
+ *
+ * Side effects:
+ * None.
+ *
+ *--------------------------------------------------------------------------
+ */
+
+mongoc_client_t *
+_mongoc_client_new_from_uri (mongoc_topology_t *topology)
+{
+ mongoc_client_t *client;
+ const mongoc_read_prefs_t *read_prefs;
+ const mongoc_read_concern_t *read_concern;
+ const mongoc_write_concern_t *write_concern;
+ const char *appname;
+
+ BSON_ASSERT (topology);
+
+#ifndef MONGOC_ENABLE_SSL
+ if (mongoc_uri_get_tls (topology->uri)) {
+ MONGOC_ERROR ("Can't create SSL client, SSL not enabled in this build.");
+ return NULL;
+ }
+#endif
+
+ client = (mongoc_client_t *) bson_malloc0 (sizeof *client);
+ client->uri = mongoc_uri_copy (topology->uri);
+ client->initiator = mongoc_client_default_stream_initiator;
+ client->initiator_data = client;
+ client->topology = topology;
+ client->error_api_version = MONGOC_ERROR_API_VERSION_LEGACY;
+ client->error_api_set = false;
+ client->client_sessions = mongoc_set_new (8, NULL, NULL);
+ client->csid_rand_seed = (unsigned int) bson_get_monotonic_time ();
+
+ write_concern = mongoc_uri_get_write_concern (client->uri);
+ client->write_concern = mongoc_write_concern_copy (write_concern);
+
+ read_concern = mongoc_uri_get_read_concern (client->uri);
+ client->read_concern = mongoc_read_concern_copy (read_concern);
+
+ read_prefs = mongoc_uri_get_read_prefs_t (client->uri);
+ client->read_prefs = mongoc_read_prefs_copy (read_prefs);
+
+ appname =
+ mongoc_uri_get_option_as_utf8 (client->uri, MONGOC_URI_APPNAME, NULL);
+ if (appname && client->topology->single_threaded) {
+ /* the appname should have already been validated */
+ BSON_ASSERT (mongoc_client_set_appname (client, appname));
+ }
+
+ mongoc_cluster_init (&client->cluster, client->uri, client);
+
+#ifdef MONGOC_ENABLE_SSL
+ client->use_ssl = false;
+ if (mongoc_uri_get_tls (client->uri)) {
+ mongoc_ssl_opt_t ssl_opt = {0};
+ _mongoc_internal_tls_opts_t internal_tls_opts = {0};
+
+ _mongoc_ssl_opts_from_uri (&ssl_opt, &internal_tls_opts, client->uri);
+ /* sets use_ssl = true */
+ mongoc_client_set_ssl_opts (client, &ssl_opt);
+ _mongoc_client_set_internal_tls_opts (client, &internal_tls_opts);
+ }
+#endif
+
+ mongoc_counter_clients_active_inc ();
+
+ return client;
+}
+
+/*
+ *--------------------------------------------------------------------------
+ *
+ * mongoc_client_destroy --
+ *
+ * Destroys a mongoc_client_t and cleans up all resources associated
+ * with the client instance.
+ *
+ * Returns:
+ * None.
+ *
+ * Side effects:
+ * @client is destroyed.
+ *
+ *--------------------------------------------------------------------------
+ */
+
+void
+mongoc_client_destroy (mongoc_client_t *client)
+{
+ if (client) {
+ if (client->topology->single_threaded) {
+ _mongoc_client_end_sessions (client);
+ mongoc_topology_destroy (client->topology);
+ }
+
+ mongoc_write_concern_destroy (client->write_concern);
+ mongoc_read_concern_destroy (client->read_concern);
+ mongoc_read_prefs_destroy (client->read_prefs);
+ mongoc_cluster_destroy (&client->cluster);
+ mongoc_uri_destroy (client->uri);
+ mongoc_set_destroy (client->client_sessions);
+
+#ifdef MONGOC_ENABLE_SSL
+ _mongoc_ssl_opts_cleanup (&client->ssl_opts, true);
+#endif
+
+ bson_free (client);
+
+ mongoc_counter_clients_active_dec ();
+ mongoc_counter_clients_disposed_inc ();
+ }
+}
+
+
+/*
+ *--------------------------------------------------------------------------
+ *
+ * mongoc_client_get_uri --
+ *
+ * Fetch the URI used for @client.
+ *
+ * Returns:
+ * A mongoc_uri_t that should not be modified or freed.
+ *
+ * Side effects:
+ * None.
+ *
+ *--------------------------------------------------------------------------
+ */
+
+const mongoc_uri_t *
+mongoc_client_get_uri (const mongoc_client_t *client)
+{
+ BSON_ASSERT (client);
+
+ return client->uri;
+}
+
+/*
+ *--------------------------------------------------------------------------
+ *
+ * mongoc_client_start_session --
+ *
+ * Creates a structure to communicate in a session over @client.
+ *
+ * This structure should be freed when the caller is done with it
+ * using mongoc_client_session_destroy().
+ *
+ * Returns:
+ * A newly allocated mongoc_client_session_t.
+ *
+ * Side effects:
+ * None.
+ *
+ *--------------------------------------------------------------------------
+ */
+
+mongoc_client_session_t *
+mongoc_client_start_session (mongoc_client_t *client,
+ const mongoc_session_opt_t *opts,
+ bson_error_t *error)
+{
+ mongoc_server_session_t *ss;
+ mongoc_client_session_t *cs;
+ uint32_t csid;
+
+ ENTRY;
+
+ ss = _mongoc_client_pop_server_session (client, error);
+ if (!ss) {
+ RETURN (NULL);
+ }
+
+ /* get a random internal id for the session, retrying on collision */
+ do {
+ csid = (uint32_t) _mongoc_rand_simple (&client->csid_rand_seed);
+ } while (mongoc_set_get (client->client_sessions, csid));
+
+ cs = _mongoc_client_session_new (client, ss, opts, csid);
+
+ /* remember session so if we see its client_session_id in a command, we can
+ * find its lsid and clusterTime */
+ mongoc_set_add (client->client_sessions, csid, cs);
+
+ RETURN (cs);
+}
+
+
+/*
+ *--------------------------------------------------------------------------
+ *
+ * mongoc_client_get_database --
+ *
+ * Fetches a newly allocated database structure to communicate with
+ * a database over @client.
+ *
+ * @database should be a db name such as "test".
+ *
+ * This structure should be freed when the caller is done with it
+ * using mongoc_database_destroy().
+ *
+ * Returns:
+ * A newly allocated mongoc_database_t.
+ *
+ * Side effects:
+ * None.
+ *
+ *--------------------------------------------------------------------------
+ */
+
+mongoc_database_t *
+mongoc_client_get_database (mongoc_client_t *client, const char *name)
+{
+ BSON_ASSERT (client);
+ BSON_ASSERT (name);
+
+ return _mongoc_database_new (client,
+ name,
+ client->read_prefs,
+ client->read_concern,
+ client->write_concern);
+}
+
+
+/*
+ *--------------------------------------------------------------------------
+ *
+ * mongoc_client_get_default_database --
+ *
+ * Get the database named in the MongoDB connection URI, or NULL
+ * if none was specified in the URI.
+ *
+ * This structure should be freed when the caller is done with it
+ * using mongoc_database_destroy().
+ *
+ * Returns:
+ * A newly allocated mongoc_database_t or NULL.
+ *
+ * Side effects:
+ * None.
+ *
+ *--------------------------------------------------------------------------
+ */
+
+mongoc_database_t *
+mongoc_client_get_default_database (mongoc_client_t *client)
+{
+ const char *db;
+
+ BSON_ASSERT (client);
+ db = mongoc_uri_get_database (client->uri);
+
+ if (db) {
+ return mongoc_client_get_database (client, db);
+ }
+
+ return NULL;
+}
+
+
+/*
+ *--------------------------------------------------------------------------
+ *
+ * mongoc_client_get_collection --
+ *
+ * This function returns a newly allocated collection structure.
+ *
+ * @db should be the name of the database, such as "test".
+ * @collection should be the name of the collection such as "test".
+ *
+ * The above would result in the namespace "test.test".
+ *
+ * You should free this structure when you are done with it using
+ * mongoc_collection_destroy().
+ *
+ * Returns:
+ * A newly allocated mongoc_collection_t that should be freed with
+ * mongoc_collection_destroy().
+ *
+ * Side effects:
+ * None.
+ *
+ *--------------------------------------------------------------------------
+ */
+
+mongoc_collection_t *
+mongoc_client_get_collection (mongoc_client_t *client,
+ const char *db,
+ const char *collection)
+{
+ BSON_ASSERT (client);
+ BSON_ASSERT (db);
+ BSON_ASSERT (collection);
+
+ return _mongoc_collection_new (client,
+ db,
+ collection,
+ client->read_prefs,
+ client->read_concern,
+ client->write_concern);
+}
+
+
+/*
+ *--------------------------------------------------------------------------
+ *
+ * mongoc_client_get_gridfs --
+ *
+ * This function returns a newly allocated collection structure.
+ *
+ * @db should be the name of the database, such as "test".
+ *
+ * @prefix optional prefix for GridFS collection names, or NULL. Default
+ * is "fs", thus the default collection names for GridFS are "fs.files"
+ * and "fs.chunks".
+ *
+ * Returns:
+ * A newly allocated mongoc_gridfs_t that should be freed with
+ * mongoc_gridfs_destroy().
+ *
+ * Side effects:
+ * None.
+ *
+ *--------------------------------------------------------------------------
+ */
+
+mongoc_gridfs_t *
+mongoc_client_get_gridfs (mongoc_client_t *client,
+ const char *db,
+ const char *prefix,
+ bson_error_t *error)
+{
+ BSON_ASSERT (client);
+ BSON_ASSERT (db);
+
+ if (!prefix) {
+ prefix = "fs";
+ }
+
+ return _mongoc_gridfs_new (client, db, prefix, error);
+}
+
+
+/*
+ *--------------------------------------------------------------------------
+ *
+ * mongoc_client_get_write_concern --
+ *
+ * Fetches the default write concern for @client.
+ *
+ * Returns:
+ * A mongoc_write_concern_t that should not be modified or freed.
+ *
+ * Side effects:
+ * None.
+ *
+ *--------------------------------------------------------------------------
+ */
+
+const mongoc_write_concern_t *
+mongoc_client_get_write_concern (const mongoc_client_t *client)
+{
+ BSON_ASSERT (client);
+
+ return client->write_concern;
+}
+
+
+/*
+ *--------------------------------------------------------------------------
+ *
+ * mongoc_client_set_write_concern --
+ *
+ * Sets the default write concern for @client.
+ *
+ * Returns:
+ * None.
+ *
+ * Side effects:
+ * None.
+ *
+ *--------------------------------------------------------------------------
+ */
+
+void
+mongoc_client_set_write_concern (mongoc_client_t *client,
+ const mongoc_write_concern_t *write_concern)
+{
+ BSON_ASSERT (client);
+
+ if (write_concern != client->write_concern) {
+ if (client->write_concern) {
+ mongoc_write_concern_destroy (client->write_concern);
+ }
+ client->write_concern = write_concern
+ ? mongoc_write_concern_copy (write_concern)
+ : mongoc_write_concern_new ();
+ }
+}
+
+
+/*
+ *--------------------------------------------------------------------------
+ *
+ * mongoc_client_get_read_concern --
+ *
+ * Fetches the default read concern for @client.
+ *
+ * Returns:
+ * A mongoc_read_concern_t that should not be modified or freed.
+ *
+ * Side effects:
+ * None.
+ *
+ *--------------------------------------------------------------------------
+ */
+
+const mongoc_read_concern_t *
+mongoc_client_get_read_concern (const mongoc_client_t *client)
+{
+ BSON_ASSERT (client);
+
+ return client->read_concern;
+}
+
+
+/*
+ *--------------------------------------------------------------------------
+ *
+ * mongoc_client_set_read_concern --
+ *
+ * Sets the default read concern for @client.
+ *
+ * Returns:
+ * None.
+ *
+ * Side effects:
+ * None.
+ *
+ *--------------------------------------------------------------------------
+ */
+
+void
+mongoc_client_set_read_concern (mongoc_client_t *client,
+ const mongoc_read_concern_t *read_concern)
+{
+ BSON_ASSERT (client);
+
+ if (read_concern != client->read_concern) {
+ if (client->read_concern) {
+ mongoc_read_concern_destroy (client->read_concern);
+ }
+ client->read_concern = read_concern
+ ? mongoc_read_concern_copy (read_concern)
+ : mongoc_read_concern_new ();
+ }
+}
+
+
+/*
+ *--------------------------------------------------------------------------
+ *
+ * mongoc_client_get_read_prefs --
+ *
+ * Fetch the default read preferences for @client.
+ *
+ * Returns:
+ * None.
+ *
+ * Side effects:
+ * None.
+ *
+ *--------------------------------------------------------------------------
+ */
+
+const mongoc_read_prefs_t *
+mongoc_client_get_read_prefs (const mongoc_client_t *client)
+{
+ BSON_ASSERT (client);
+
+ return client->read_prefs;
+}
+
+
+/*
+ *--------------------------------------------------------------------------
+ *
+ * mongoc_client_set_read_prefs --
+ *
+ * Set the default read preferences for @client.
+ *
+ * Returns:
+ * None.
+ *
+ * Side effects:
+ * None.
+ *
+ *--------------------------------------------------------------------------
+ */
+
+void
+mongoc_client_set_read_prefs (mongoc_client_t *client,
+ const mongoc_read_prefs_t *read_prefs)
+{
+ BSON_ASSERT (client);
+
+ if (read_prefs != client->read_prefs) {
+ if (client->read_prefs) {
+ mongoc_read_prefs_destroy (client->read_prefs);
+ }
+ client->read_prefs = read_prefs
+ ? mongoc_read_prefs_copy (read_prefs)
+ : mongoc_read_prefs_new (MONGOC_READ_PRIMARY);
+ }
+}
+
+mongoc_cursor_t *
+mongoc_client_command (mongoc_client_t *client,
+ const char *db_name,
+ 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 = NULL;
+ mongoc_cursor_t *cursor;
+
+ BSON_ASSERT (client);
+ BSON_ASSERT (db_name);
+ BSON_ASSERT (query);
+
+ /*
+ * Allow a caller to provide a fully qualified namespace
+ */
+ if (NULL == strstr (db_name, "$cmd")) {
+ ns = bson_strdup_printf ("%s.$cmd", db_name);
+ db_name = ns;
+ }
+
+ cursor =
+ _mongoc_cursor_cmd_deprecated_new (client, db_name, query, read_prefs);
+
+ bson_free (ns);
+ return cursor;
+}
+
+
+static bool
+_mongoc_client_retryable_write_command_with_stream (
+ mongoc_client_t *client,
+ mongoc_cmd_parts_t *parts,
+ mongoc_server_stream_t *server_stream,
+ bson_t *reply,
+ bson_error_t *error)
+{
+ mongoc_server_stream_t *retry_server_stream = NULL;
+ bson_iter_t txn_number_iter;
+ bool is_retryable = true;
+ bool ret;
+
+ ENTRY;
+
+ BSON_ASSERT (parts->is_retryable_write);
+
+ /* increment the transaction number for the first attempt of each retryable
+ * write command */
+ BSON_ASSERT (bson_iter_init_find (
+ &txn_number_iter, parts->assembled.command, "txnNumber"));
+ bson_iter_overwrite_int64 (
+ &txn_number_iter, ++parts->assembled.session->server_session->txn_number);
+
+retry:
+ ret = mongoc_cluster_run_command_monitored (
+ &client->cluster, &parts->assembled, reply, error);
+
+ _mongoc_write_error_handle_labels (
+ ret, error, reply, server_stream->sd->max_wire_version);
+
+ if (is_retryable) {
+ _mongoc_write_error_update_if_unsupported_storage_engine (
+ ret, error, reply);
+ }
+
+ /* If a retryable error is encountered and the write is retryable, select
+ * a new writable stream and retry. If server selection fails or the selected
+ * server does not support retryable writes, fall through and allow the
+ * original error to be reported. */
+ if (is_retryable &&
+ _mongoc_write_error_get_type (reply) == MONGOC_WRITE_ERR_RETRY) {
+ bson_error_t ignored_error;
+
+ /* each write command may be retried at most once */
+ is_retryable = false;
+
+ if (retry_server_stream) {
+ mongoc_server_stream_cleanup (retry_server_stream);
+ }
+
+ retry_server_stream = mongoc_cluster_stream_for_writes (
+ &client->cluster, parts->assembled.session, NULL, &ignored_error);
+
+ if (retry_server_stream &&
+ retry_server_stream->sd->max_wire_version >=
+ WIRE_VERSION_RETRY_WRITES) {
+ parts->assembled.server_stream = retry_server_stream;
+ bson_destroy (reply);
+ GOTO (retry);
+ }
+ }
+
+ if (retry_server_stream) {
+ mongoc_server_stream_cleanup (retry_server_stream);
+ }
+
+ if (ret && error) {
+ /* if a retry succeeded, clear the initial error */
+ memset (error, 0, sizeof (bson_error_t));
+ }
+
+ RETURN (ret);
+}
+
+
+static bool
+_mongoc_client_retryable_read_command_with_stream (
+ mongoc_client_t *client,
+ mongoc_cmd_parts_t *parts,
+ mongoc_server_stream_t *server_stream,
+ bson_t *reply,
+ bson_error_t *error)
+{
+ mongoc_server_stream_t *retry_server_stream = NULL;
+ bool is_retryable = true;
+ bool ret;
+ bson_t reply_local;
+
+ if (reply == NULL) {
+ reply = &reply_local;
+ }
+
+ ENTRY;
+
+ BSON_ASSERT (parts->is_retryable_read);
+
+retry:
+ ret = mongoc_cluster_run_command_monitored (
+ &client->cluster, &parts->assembled, reply, error);
+
+ /* If a retryable error is encountered and the read is retryable, select
+ * a new readable stream and retry. If server selection fails or the selected
+ * server does not support retryable reads, fall through and allow the
+ * original error to be reported. */
+ if (is_retryable &&
+ _mongoc_read_error_get_type (ret, error, reply) ==
+ MONGOC_READ_ERR_RETRY) {
+ bson_error_t ignored_error;
+
+ /* each read command may be retried at most once */
+ is_retryable = false;
+
+ if (retry_server_stream) {
+ mongoc_server_stream_cleanup (retry_server_stream);
+ }
+
+ retry_server_stream =
+ mongoc_cluster_stream_for_reads (&client->cluster,
+ parts->read_prefs,
+ parts->assembled.session,
+ NULL,
+ &ignored_error);
+
+ if (retry_server_stream &&
+ retry_server_stream->sd->max_wire_version >=
+ WIRE_VERSION_RETRY_READS) {
+ parts->assembled.server_stream = retry_server_stream;
+ bson_destroy (reply);
+ GOTO (retry);
+ }
+ }
+
+ if (retry_server_stream) {
+ mongoc_server_stream_cleanup (retry_server_stream);
+ }
+
+ if (ret && error) {
+ /* if a retry succeeded, clear the initial error */
+ memset (error, 0, sizeof (bson_error_t));
+ }
+
+ RETURN (ret);
+}
+
+
+static bool
+_mongoc_client_command_with_stream (mongoc_client_t *client,
+ mongoc_cmd_parts_t *parts,
+ const mongoc_read_prefs_t *read_prefs,
+ mongoc_server_stream_t *server_stream,
+ bson_t *reply,
+ bson_error_t *error)
+{
+ ENTRY;
+
+ parts->assembled.operation_id = ++client->cluster.operation_id;
+ if (!mongoc_cmd_parts_assemble (parts, server_stream, error)) {
+ _mongoc_bson_init_if_set (reply);
+ return false;
+ };
+
+ if (parts->is_retryable_write) {
+ RETURN (_mongoc_client_retryable_write_command_with_stream (
+ client, parts, server_stream, reply, error));
+ }
+
+ if (parts->is_retryable_read) {
+ RETURN (_mongoc_client_retryable_read_command_with_stream (
+ client, parts, server_stream, reply, error));
+ }
+
+ RETURN (mongoc_cluster_run_command_monitored (
+ &client->cluster, &parts->assembled, reply, error));
+}
+
+
+bool
+mongoc_client_command_simple (mongoc_client_t *client,
+ const char *db_name,
+ const bson_t *command,
+ const mongoc_read_prefs_t *read_prefs,
+ bson_t *reply,
+ bson_error_t *error)
+{
+ mongoc_cluster_t *cluster;
+ mongoc_server_stream_t *server_stream = NULL;
+ mongoc_cmd_parts_t parts;
+ bool ret;
+
+ ENTRY;
+
+ BSON_ASSERT (client);
+ BSON_ASSERT (db_name);
+ BSON_ASSERT (command);
+
+ if (!_mongoc_read_prefs_validate (read_prefs, error)) {
+ RETURN (false);
+ }
+
+ cluster = &client->cluster;
+ mongoc_cmd_parts_init (&parts, client, db_name, MONGOC_QUERY_NONE, command);
+ parts.read_prefs = read_prefs;
+
+ /* Server Selection Spec: "The generic command method has a default read
+ * preference of mode 'primary'. The generic command method MUST ignore any
+ * default read preference from client, database or collection
+ * configuration. The generic command method SHOULD allow an optional read
+ * preference argument."
+ */
+ server_stream =
+ mongoc_cluster_stream_for_reads (cluster, read_prefs, NULL, reply, error);
+
+ if (server_stream) {
+ ret = _mongoc_client_command_with_stream (
+ client, &parts, read_prefs, server_stream, reply, error);
+ } else {
+ /* reply initialized by mongoc_cluster_stream_for_reads */
+ ret = false;
+ }
+
+ mongoc_cmd_parts_cleanup (&parts);
+ mongoc_server_stream_cleanup (server_stream);
+
+ RETURN (ret);
+}
+
+
+/*
+ *--------------------------------------------------------------------------
+ *
+ * _mongoc_client_command_with_opts --
+ *
+ * Execute a command on the server. If mode is MONGOC_CMD_READ or
+ * MONGOC_CMD_RW, then read concern is applied from @opts, or else from
+ * @default_rc, and read preferences are applied from @user_prefs, or else
+ * from @default_prefs. If mode is MONGOC_CMD_WRITE or MONGOC_CMD_RW, then
+ * write concern is applied from @opts if present, or else @default_wc.
+ *
+ * If mode is MONGOC_CMD_RAW, then read concern and write concern are
+ * applied from @opts only. Read preferences are applied from
+ * @user_prefs.
+ *
+ * The mongoc_client_t's read preference, read concern, and write concern
+ * are *NOT* applied.
+ *
+ * Returns:
+ * Success or failure.
+ * A write concern timeout or write concern error is considered a failure.
+ *
+ * Side effects:
+ * @reply is always initialized.
+ * @error is filled out if the command fails.
+ *
+ *--------------------------------------------------------------------------
+ */
+bool
+_mongoc_client_command_with_opts (mongoc_client_t *client,
+ const char *db_name,
+ const bson_t *command,
+ mongoc_command_mode_t mode,
+ const bson_t *opts,
+ mongoc_query_flags_t flags,
+ const mongoc_read_prefs_t *user_prefs,
+ const mongoc_read_prefs_t *default_prefs,
+ mongoc_read_concern_t *default_rc,
+ mongoc_write_concern_t *default_wc,
+ bson_t *reply,
+ bson_error_t *error)
+{
+ mongoc_read_write_opts_t read_write_opts;
+ mongoc_cmd_parts_t parts;
+ const char *command_name;
+ const mongoc_read_prefs_t *prefs = COALESCE (user_prefs, default_prefs);
+ mongoc_server_stream_t *server_stream = NULL;
+ mongoc_cluster_t *cluster;
+ mongoc_client_session_t *cs;
+ bson_t reply_local;
+ bson_t *reply_ptr;
+ int32_t wire_version;
+ int32_t wc_wire_version;
+ bool reply_initialized = false;
+ bool ret = false;
+
+ ENTRY;
+
+ BSON_ASSERT (client);
+ BSON_ASSERT (db_name);
+ BSON_ASSERT (command);
+
+ command_name = _mongoc_get_command_name (command);
+ cluster = &client->cluster;
+ reply_ptr = reply ? reply : &reply_local;
+
+ mongoc_cmd_parts_init (&parts, client, db_name, flags, command);
+ parts.is_read_command = (mode & MONGOC_CMD_READ);
+ parts.is_write_command = (mode & MONGOC_CMD_WRITE);
+
+ if (!_mongoc_read_write_opts_parse (client, opts, &read_write_opts, error)) {
+ GOTO (done);
+ }
+
+ cs = read_write_opts.client_session;
+
+ if (!command_name) {
+ bson_set_error (error,
+ MONGOC_ERROR_COMMAND,
+ MONGOC_ERROR_COMMAND_INVALID_ARG,
+ "Empty command document");
+ GOTO (done);
+ }
+
+ if (_mongoc_client_session_in_txn (read_write_opts.client_session)) {
+ if ((mode == MONGOC_CMD_READ || mode == MONGOC_CMD_RAW) &&
+ !IS_PREF_PRIMARY (user_prefs)) {
+ bson_set_error (error,
+ MONGOC_ERROR_COMMAND,
+ MONGOC_ERROR_COMMAND_INVALID_ARG,
+ "Read preference in a transaction must be primary");
+ GOTO (done);
+ }
+
+ if (!bson_empty (&read_write_opts.readConcern)) {
+ bson_set_error (error,
+ MONGOC_ERROR_COMMAND,
+ MONGOC_ERROR_COMMAND_INVALID_ARG,
+ "Cannot set read concern after starting transaction");
+ GOTO (done);
+ }
+
+ if (read_write_opts.writeConcern &&
+ strcmp (command_name, "commitTransaction") != 0 &&
+ strcmp (command_name, "abortTransaction") != 0) {
+ bson_set_error (error,
+ MONGOC_ERROR_COMMAND,
+ MONGOC_ERROR_COMMAND_INVALID_ARG,
+ "Cannot set write concern after starting transaction");
+ GOTO (done);
+ }
+ }
+
+ if (mode == MONGOC_CMD_READ || mode == MONGOC_CMD_RAW) {
+ /* NULL read pref is ok */
+ if (!_mongoc_read_prefs_validate (prefs, error)) {
+ GOTO (done);
+ }
+
+ parts.read_prefs = prefs;
+ } else {
+ /* this is a command that writes */
+ prefs = NULL;
+ }
+
+ if (read_write_opts.serverId) {
+ /* "serverId" passed in opts */
+ server_stream =
+ mongoc_cluster_stream_for_server (cluster,
+ read_write_opts.serverId,
+ true /* reconnect ok */,
+ cs,
+ reply_ptr,
+ error);
+
+ if (server_stream && server_stream->sd->type != MONGOC_SERVER_MONGOS) {
+ parts.user_query_flags |= MONGOC_QUERY_SLAVE_OK;
+ }
+ } else if (parts.is_write_command) {
+ server_stream =
+ mongoc_cluster_stream_for_writes (cluster, cs, reply_ptr, error);
+ } else {
+ server_stream =
+ mongoc_cluster_stream_for_reads (cluster, prefs, cs, reply_ptr, error);
+ }
+
+ if (!server_stream) {
+ /* stream_for_reads/writes/server has initialized reply */
+ reply_initialized = true;
+ GOTO (done);
+ }
+
+ wire_version = server_stream->sd->max_wire_version;
+ if (!mongoc_cmd_parts_append_read_write (
+ &parts, &read_write_opts, wire_version, error)) {
+ GOTO (done);
+ }
+
+ if (mode & MONGOC_CMD_WRITE) {
+ wc_wire_version = !strcasecmp (command_name, "findandmodify")
+ ? WIRE_VERSION_FAM_WRITE_CONCERN
+ : WIRE_VERSION_CMD_WRITE_CONCERN;
+
+ if (read_write_opts.write_concern_owned &&
+ wire_version < wc_wire_version) {
+ bson_set_error (error,
+ MONGOC_ERROR_COMMAND,
+ MONGOC_ERROR_PROTOCOL_BAD_WIRE_VERSION,
+ "\"%s\" command does not support writeConcern with "
+ "wire version %d, wire version %d is required",
+ command_name,
+ wire_version,
+ wc_wire_version);
+ GOTO (done);
+ }
+
+ /* use default write concern unless it's in opts */
+ if (!mongoc_write_concern_is_default (default_wc) &&
+ !read_write_opts.write_concern_owned &&
+ wire_version >= wc_wire_version) {
+ if (!mongoc_cmd_parts_set_write_concern (
+ &parts, default_wc, wire_version, error)) {
+ GOTO (done);
+ }
+ }
+ }
+
+ /* use default read concern for read command, unless it's in opts */
+ if ((mode & MONGOC_CMD_READ) && bson_empty (&read_write_opts.readConcern)) {
+ if (!mongoc_cmd_parts_set_read_concern (
+ &parts, default_rc, wire_version, error)) {
+ GOTO (done);
+ }
+ }
+
+ ret = _mongoc_client_command_with_stream (
+ client, &parts, user_prefs, server_stream, reply_ptr, error);
+
+ reply_initialized = true;
+
+ if (ret && (mode & MONGOC_CMD_WRITE)) {
+ ret = !_mongoc_parse_wc_err (reply_ptr, error);
+ }
+
+done:
+ if (reply_ptr == &reply_local) {
+ if (reply_initialized) {
+ bson_destroy (reply_ptr);
+ }
+ } else if (!reply_initialized) {
+ _mongoc_bson_init_if_set (reply);
+ }
+
+ if (server_stream) {
+ mongoc_server_stream_cleanup (server_stream);
+ }
+
+ mongoc_cmd_parts_cleanup (&parts);
+ _mongoc_read_write_opts_cleanup (&read_write_opts);
+
+ RETURN (ret);
+}
+
+
+bool
+mongoc_client_read_command_with_opts (mongoc_client_t *client,
+ const char *db_name,
+ const bson_t *command,
+ const mongoc_read_prefs_t *read_prefs,
+ const bson_t *opts,
+ bson_t *reply,
+ bson_error_t *error)
+{
+ return _mongoc_client_command_with_opts (client,
+ db_name,
+ command,
+ MONGOC_CMD_READ,
+ opts,
+ MONGOC_QUERY_NONE,
+ read_prefs,
+ client->read_prefs,
+ client->read_concern,
+ client->write_concern,
+ reply,
+ error);
+}
+
+
+bool
+mongoc_client_write_command_with_opts (mongoc_client_t *client,
+ const char *db_name,
+ const bson_t *command,
+ const bson_t *opts,
+ bson_t *reply,
+ bson_error_t *error)
+{
+ return _mongoc_client_command_with_opts (client,
+ db_name,
+ command,
+ MONGOC_CMD_WRITE,
+ opts,
+ MONGOC_QUERY_NONE,
+ NULL,
+ client->read_prefs,
+ client->read_concern,
+ client->write_concern,
+ reply,
+ error);
+}
+
+
+bool
+mongoc_client_read_write_command_with_opts (
+ mongoc_client_t *client,
+ const char *db_name,
+ const bson_t *command,
+ const mongoc_read_prefs_t *read_prefs /* IGNORED */,
+ const bson_t *opts,
+ bson_t *reply,
+ bson_error_t *error)
+{
+ return _mongoc_client_command_with_opts (client,
+ db_name,
+ command,
+ MONGOC_CMD_RW,
+ opts,
+ MONGOC_QUERY_NONE,
+ read_prefs,
+ client->read_prefs,
+ client->read_concern,
+ client->write_concern,
+ reply,
+ error);
+}
+
+
+bool
+mongoc_client_command_with_opts (mongoc_client_t *client,
+ const char *db_name,
+ const bson_t *command,
+ const mongoc_read_prefs_t *read_prefs,
+ const bson_t *opts,
+ bson_t *reply,
+ bson_error_t *error)
+{
+ return _mongoc_client_command_with_opts (client,
+ db_name,
+ command,
+ MONGOC_CMD_RAW,
+ opts,
+ MONGOC_QUERY_NONE,
+ read_prefs,
+ NULL,
+ client->read_concern,
+ client->write_concern,
+ reply,
+ error);
+}
+
+
+bool
+mongoc_client_command_simple_with_server_id (
+ mongoc_client_t *client,
+ const char *db_name,
+ const bson_t *command,
+ const mongoc_read_prefs_t *read_prefs,
+ uint32_t server_id,
+ bson_t *reply,
+ bson_error_t *error)
+{
+ mongoc_server_stream_t *server_stream;
+ mongoc_cmd_parts_t parts;
+ bool ret;
+
+ ENTRY;
+
+ BSON_ASSERT (client);
+ BSON_ASSERT (db_name);
+ BSON_ASSERT (command);
+
+ if (!_mongoc_read_prefs_validate (read_prefs, error)) {
+ RETURN (false);
+ }
+
+ server_stream = mongoc_cluster_stream_for_server (
+ &client->cluster, server_id, true /* reconnect ok */, NULL, reply, error);
+
+ if (server_stream) {
+ mongoc_cmd_parts_init (
+ &parts, client, db_name, MONGOC_QUERY_NONE, command);
+ parts.read_prefs = read_prefs;
+
+ ret = _mongoc_client_command_with_stream (
+ client, &parts, read_prefs, server_stream, reply, error);
+
+ mongoc_cmd_parts_cleanup (&parts);
+ mongoc_server_stream_cleanup (server_stream);
+ RETURN (ret);
+ } else {
+ /* stream_for_server initialized reply */
+ RETURN (false);
+ }
+}
+
+
+static void
+_mongoc_client_prepare_killcursors_command (int64_t cursor_id,
+ const char *collection,
+ bson_t *command)
+{
+ bson_t child;
+
+ bson_append_utf8 (command, "killCursors", 11, collection, -1);
+ bson_append_array_begin (command, "cursors", 7, &child);
+ bson_append_int64 (&child, "0", 1, cursor_id);
+ bson_append_array_end (command, &child);
+}
+
+
+void
+_mongoc_client_kill_cursor (mongoc_client_t *client,
+ uint32_t server_id,
+ int64_t cursor_id,
+ int64_t operation_id,
+ const char *db,
+ const char *collection,
+ mongoc_client_session_t *cs)
+{
+ mongoc_server_stream_t *server_stream;
+
+ ENTRY;
+
+ BSON_ASSERT (client);
+ BSON_ASSERT (cursor_id);
+
+ /* don't attempt reconnect if server unavailable, and ignore errors */
+ server_stream = mongoc_cluster_stream_for_server (
+ &client->cluster, server_id, false /* reconnect_ok */, NULL, NULL, NULL);
+
+ if (!server_stream) {
+ return;
+ }
+
+ if (db && collection &&
+ server_stream->sd->max_wire_version >= WIRE_VERSION_KILLCURSORS_CMD) {
+ _mongoc_client_killcursors_command (
+ &client->cluster, server_stream, cursor_id, db, collection, cs);
+ } else {
+ _mongoc_client_op_killcursors (&client->cluster,
+ server_stream,
+ cursor_id,
+ operation_id,
+ db,
+ collection);
+ }
+
+ mongoc_server_stream_cleanup (server_stream);
+
+ EXIT;
+}
+
+
+static void
+_mongoc_client_monitor_op_killcursors (mongoc_cluster_t *cluster,
+ mongoc_server_stream_t *server_stream,
+ int64_t cursor_id,
+ int64_t operation_id,
+ const char *db,
+ const char *collection)
+{
+ bson_t doc;
+ mongoc_client_t *client;
+ mongoc_apm_command_started_t event;
+
+ ENTRY;
+
+ client = cluster->client;
+
+ if (!client->apm_callbacks.started) {
+ return;
+ }
+
+ bson_init (&doc);
+ _mongoc_client_prepare_killcursors_command (cursor_id, collection, &doc);
+ mongoc_apm_command_started_init (&event,
+ &doc,
+ db,
+ "killCursors",
+ cluster->request_id,
+ 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);
+
+ EXIT;
+}
+
+
+static void
+_mongoc_client_monitor_op_killcursors_succeeded (
+ mongoc_cluster_t *cluster,
+ int64_t duration,
+ mongoc_server_stream_t *server_stream,
+ int64_t cursor_id,
+ int64_t operation_id)
+{
+ mongoc_client_t *client;
+ bson_t doc;
+ bson_t cursors_unknown;
+ mongoc_apm_command_succeeded_t event;
+
+ ENTRY;
+
+ client = cluster->client;
+
+ if (!client->apm_callbacks.succeeded) {
+ EXIT;
+ }
+
+ /* fake server reply to killCursors command: {ok: 1, cursorsUnknown: [42]} */
+ bson_init (&doc);
+ bson_append_int32 (&doc, "ok", 2, 1);
+ bson_append_array_begin (&doc, "cursorsUnknown", 14, &cursors_unknown);
+ bson_append_int64 (&cursors_unknown, "0", 1, cursor_id);
+ bson_append_array_end (&doc, &cursors_unknown);
+
+ mongoc_apm_command_succeeded_init (&event,
+ duration,
+ &doc,
+ "killCursors",
+ cluster->request_id,
+ operation_id,
+ &server_stream->sd->host,
+ server_stream->sd->id,
+ client->apm_context);
+
+ client->apm_callbacks.succeeded (&event);
+
+ mongoc_apm_command_succeeded_cleanup (&event);
+ bson_destroy (&doc);
+}
+
+
+static void
+_mongoc_client_monitor_op_killcursors_failed (
+ mongoc_cluster_t *cluster,
+ int64_t duration,
+ mongoc_server_stream_t *server_stream,
+ const bson_error_t *error,
+ int64_t operation_id)
+{
+ mongoc_client_t *client;
+ bson_t doc;
+ mongoc_apm_command_failed_t event;
+
+ ENTRY;
+
+ client = cluster->client;
+
+ if (!client->apm_callbacks.failed) {
+ EXIT;
+ }
+
+ /* fake server reply to killCursors command: {ok: 0} */
+ bson_init (&doc);
+ bson_append_int32 (&doc, "ok", 2, 0);
+
+ mongoc_apm_command_failed_init (&event,
+ duration,
+ "killCursors",
+ error,
+ &doc,
+ cluster->request_id,
+ operation_id,
+ &server_stream->sd->host,
+ server_stream->sd->id,
+ client->apm_context);
+
+ client->apm_callbacks.failed (&event);
+
+ mongoc_apm_command_failed_cleanup (&event);
+ bson_destroy (&doc);
+}
+
+
+static void
+_mongoc_client_op_killcursors (mongoc_cluster_t *cluster,
+ mongoc_server_stream_t *server_stream,
+ int64_t cursor_id,
+ int64_t operation_id,
+ const char *db,
+ const char *collection)
+{
+ int64_t started;
+ mongoc_rpc_t rpc = {{0}};
+ bson_error_t error;
+ bool has_ns;
+ bool r;
+
+ /* called by old mongoc_client_kill_cursor without db/collection? */
+ has_ns = (db && collection);
+ started = bson_get_monotonic_time ();
+
+ ++cluster->request_id;
+
+ rpc.header.msg_len = 0;
+ rpc.header.request_id = cluster->request_id;
+ rpc.header.response_to = 0;
+ rpc.header.opcode = MONGOC_OPCODE_KILL_CURSORS;
+ rpc.kill_cursors.zero = 0;
+ rpc.kill_cursors.cursors = &cursor_id;
+ rpc.kill_cursors.n_cursors = 1;
+
+ if (has_ns) {
+ _mongoc_client_monitor_op_killcursors (
+ cluster, server_stream, cursor_id, operation_id, db, collection);
+ }
+
+ r = mongoc_cluster_legacy_rpc_sendv_to_server (
+ cluster, &rpc, server_stream, &error);
+
+ if (has_ns) {
+ if (r) {
+ _mongoc_client_monitor_op_killcursors_succeeded (
+ cluster,
+ bson_get_monotonic_time () - started,
+ server_stream,
+ cursor_id,
+ operation_id);
+ } else {
+ _mongoc_client_monitor_op_killcursors_failed (
+ cluster,
+ bson_get_monotonic_time () - started,
+ server_stream,
+ &error,
+ operation_id);
+ }
+ }
+}
+
+
+static void
+_mongoc_client_killcursors_command (mongoc_cluster_t *cluster,
+ mongoc_server_stream_t *server_stream,
+ int64_t cursor_id,
+ const char *db,
+ const char *collection,
+ mongoc_client_session_t *cs)
+{
+ bson_t command = BSON_INITIALIZER;
+ mongoc_cmd_parts_t parts;
+
+ ENTRY;
+
+ _mongoc_client_prepare_killcursors_command (cursor_id, collection, &command);
+ mongoc_cmd_parts_init (
+ &parts, cluster->client, db, MONGOC_QUERY_SLAVE_OK, &command);
+ parts.assembled.operation_id = ++cluster->operation_id;
+ mongoc_cmd_parts_set_session (&parts, cs);
+
+ if (mongoc_cmd_parts_assemble (&parts, server_stream, NULL)) {
+ /* Find, getMore And killCursors Commands Spec: "The result from the
+ * killCursors command MAY be safely ignored."
+ */
+ (void) mongoc_cluster_run_command_monitored (
+ cluster, &parts.assembled, NULL, NULL);
+ }
+
+ mongoc_cmd_parts_cleanup (&parts);
+ bson_destroy (&command);
+
+ EXIT;
+}
+
+
+/*
+ *--------------------------------------------------------------------------
+ *
+ * mongoc_client_kill_cursor --
+ *
+ * Destroy a cursor on the server.
+ *
+ * NOTE: this is only reliable when connected to a single mongod or
+ * mongos. If connected to a replica set, the driver attempts to
+ * kill the cursor on the primary. If connected to multiple mongoses
+ * the kill-cursors message is sent to a *random* mongos.
+ *
+ * If no primary, mongos, or standalone server is known, return
+ * without attempting to reconnect.
+ *
+ * Returns:
+ * None.
+ *
+ * Side effects:
+ * None.
+ *
+ *--------------------------------------------------------------------------
+ */
+
+void
+mongoc_client_kill_cursor (mongoc_client_t *client, int64_t cursor_id)
+{
+ mongoc_topology_t *topology;
+ mongoc_server_description_t *selected_server;
+ mongoc_read_prefs_t *read_prefs;
+ bson_error_t error;
+ uint32_t server_id = 0;
+
+ topology = client->topology;
+ read_prefs = mongoc_read_prefs_new (MONGOC_READ_PRIMARY);
+
+ bson_mutex_lock (&topology->mutex);
+ if (!mongoc_topology_compatible (&topology->description, NULL, &error)) {
+ MONGOC_ERROR ("Could not kill cursor: %s", error.message);
+ bson_mutex_unlock (&topology->mutex);
+ mongoc_read_prefs_destroy (read_prefs);
+ return;
+ }
+
+ /* see if there's a known writable server - do no I/O or retries */
+ selected_server =
+ mongoc_topology_description_select (&topology->description,
+ MONGOC_SS_WRITE,
+ read_prefs,
+ topology->local_threshold_msec);
+
+ if (selected_server) {
+ server_id = selected_server->id;
+ }
+
+ bson_mutex_unlock (&topology->mutex);
+
+ if (server_id) {
+ _mongoc_client_kill_cursor (client,
+ server_id,
+ cursor_id,
+ 0 /* operation_id */,
+ NULL /* db */,
+ NULL /* collection */,
+ NULL /* session */);
+ } else {
+ MONGOC_INFO ("No server available for mongoc_client_kill_cursor");
+ }
+
+ mongoc_read_prefs_destroy (read_prefs);
+}
+
+
+char **
+mongoc_client_get_database_names (mongoc_client_t *client, bson_error_t *error)
+{
+ return mongoc_client_get_database_names_with_opts (client, NULL, error);
+}
+
+
+char **
+mongoc_client_get_database_names_with_opts (mongoc_client_t *client,
+ const bson_t *opts,
+ bson_error_t *error)
+{
+ bson_iter_t iter;
+ const char *name;
+ char **ret = NULL;
+ int i = 0;
+ mongoc_cursor_t *cursor;
+ const bson_t *doc;
+ bson_t cmd = BSON_INITIALIZER;
+
+ BSON_ASSERT (client);
+ BSON_APPEND_INT32 (&cmd, "listDatabases", 1);
+ BSON_APPEND_BOOL (&cmd, "nameOnly", true);
+
+ /* ignore client read prefs */
+ cursor = _mongoc_cursor_array_new (client, "admin", &cmd, opts, "databases");
+ bson_destroy (&cmd);
+
+ while (mongoc_cursor_next (cursor, &doc)) {
+ if (bson_iter_init (&iter, doc) && bson_iter_find (&iter, "name") &&
+ BSON_ITER_HOLDS_UTF8 (&iter) &&
+ (name = bson_iter_utf8 (&iter, NULL))) {
+ ret = (char **) bson_realloc (ret, sizeof (char *) * (i + 2));
+ ret[i] = bson_strdup (name);
+ ret[++i] = NULL;
+ }
+ }
+
+ if (!ret && !mongoc_cursor_error (cursor, error)) {
+ ret = (char **) bson_malloc0 (sizeof (void *));
+ }
+
+ mongoc_cursor_destroy (cursor);
+
+ return ret;
+}
+
+
+mongoc_cursor_t *
+mongoc_client_find_databases (mongoc_client_t *client, bson_error_t *error)
+{
+ /* existing bug in this deprecated API: error pointer is unused */
+ return mongoc_client_find_databases_with_opts (client, NULL);
+}
+
+
+mongoc_cursor_t *
+mongoc_client_find_databases_with_opts (mongoc_client_t *client,
+ const bson_t *opts)
+{
+ bson_t cmd = BSON_INITIALIZER;
+ mongoc_cursor_t *cursor;
+
+ BSON_ASSERT (client);
+ BSON_APPEND_INT32 (&cmd, "listDatabases", 1);
+ cursor = _mongoc_cursor_array_new (client, "admin", &cmd, opts, "databases");
+ bson_destroy (&cmd);
+ return cursor;
+}
+
+
+int32_t
+mongoc_client_get_max_message_size (mongoc_client_t *client) /* IN */
+{
+ BSON_ASSERT (client);
+
+ return mongoc_cluster_get_max_msg_size (&client->cluster);
+}
+
+
+int32_t
+mongoc_client_get_max_bson_size (mongoc_client_t *client) /* IN */
+{
+ BSON_ASSERT (client);
+
+ return mongoc_cluster_get_max_bson_obj_size (&client->cluster);
+}
+
+
+bool
+mongoc_client_get_server_status (mongoc_client_t *client, /* IN */
+ mongoc_read_prefs_t *read_prefs, /* IN */
+ bson_t *reply, /* OUT */
+ bson_error_t *error) /* OUT */
+{
+ bson_t cmd = BSON_INITIALIZER;
+ bool ret = false;
+
+ BSON_ASSERT (client);
+
+ BSON_APPEND_INT32 (&cmd, "serverStatus", 1);
+ ret = mongoc_client_command_simple (
+ client, "admin", &cmd, read_prefs, reply, error);
+ bson_destroy (&cmd);
+
+ return ret;
+}
+
+
+void
+mongoc_client_set_stream_initiator (mongoc_client_t *client,
+ mongoc_stream_initiator_t initiator,
+ void *user_data)
+{
+ BSON_ASSERT (client);
+
+ if (!initiator) {
+ initiator = mongoc_client_default_stream_initiator;
+ user_data = client;
+ } else {
+ MONGOC_DEBUG ("Using custom stream initiator.");
+ }
+
+ client->initiator = initiator;
+ client->initiator_data = user_data;
+
+ if (client->topology->single_threaded) {
+ mongoc_topology_scanner_set_stream_initiator (
+ client->topology->scanner, initiator, user_data);
+ }
+}
+
+
+bool
+_mongoc_client_set_apm_callbacks_private (mongoc_client_t *client,
+ mongoc_apm_callbacks_t *callbacks,
+ void *context)
+{
+ if (callbacks) {
+ memcpy (
+ &client->apm_callbacks, callbacks, sizeof (mongoc_apm_callbacks_t));
+ } else {
+ memset (&client->apm_callbacks, 0, sizeof (mongoc_apm_callbacks_t));
+ }
+
+ client->apm_context = context;
+
+ /* A client pool sets APM callbacks for the entire pool. */
+ if (client->topology->single_threaded) {
+ mongoc_topology_set_apm_callbacks (client->topology, callbacks, context);
+ }
+
+ return true;
+}
+
+
+bool
+mongoc_client_set_apm_callbacks (mongoc_client_t *client,
+ mongoc_apm_callbacks_t *callbacks,
+ void *context)
+{
+ if (!client->topology->single_threaded) {
+ MONGOC_ERROR ("Cannot set callbacks on a pooled client, use "
+ "mongoc_client_pool_set_apm_callbacks");
+ return false;
+ }
+
+ return _mongoc_client_set_apm_callbacks_private (client, callbacks, context);
+}
+
+
+mongoc_server_description_t *
+mongoc_client_get_server_description (mongoc_client_t *client,
+ uint32_t server_id)
+{
+ /* the error info isn't useful */
+ return mongoc_topology_server_by_id (client->topology, server_id, NULL);
+}
+
+
+mongoc_server_description_t **
+mongoc_client_get_server_descriptions (const mongoc_client_t *client,
+ size_t *n /* OUT */)
+{
+ mongoc_topology_t *topology;
+ mongoc_server_description_t **sds;
+
+ BSON_ASSERT (client);
+ BSON_ASSERT (n);
+
+ topology = client->topology;
+
+ /* in case the client is pooled */
+ bson_mutex_lock (&topology->mutex);
+
+ sds = mongoc_topology_description_get_servers (&topology->description, n);
+
+ bson_mutex_unlock (&topology->mutex);
+
+ return sds;
+}
+
+
+void
+mongoc_server_descriptions_destroy_all (mongoc_server_description_t **sds,
+ size_t n)
+{
+ size_t i;
+
+ for (i = 0; i < n; ++i) {
+ mongoc_server_description_destroy (sds[i]);
+ }
+
+ bson_free (sds);
+}
+
+
+mongoc_server_description_t *
+mongoc_client_select_server (mongoc_client_t *client,
+ bool for_writes,
+ const mongoc_read_prefs_t *prefs,
+ bson_error_t *error)
+{
+ mongoc_ss_optype_t optype = for_writes ? MONGOC_SS_WRITE : MONGOC_SS_READ;
+ mongoc_server_description_t *sd;
+
+ if (for_writes && prefs) {
+ bson_set_error (error,
+ MONGOC_ERROR_SERVER_SELECTION,
+ MONGOC_ERROR_SERVER_SELECTION_FAILURE,
+ "Cannot use read preferences with for_writes = true");
+ return NULL;
+ }
+
+ if (!_mongoc_read_prefs_validate (prefs, error)) {
+ return NULL;
+ }
+
+ sd = mongoc_topology_select (client->topology, optype, prefs, error);
+ if (!sd) {
+ return NULL;
+ }
+
+ if (mongoc_cluster_check_interval (&client->cluster, sd->id)) {
+ /* check not required, or it succeeded */
+ return sd;
+ }
+
+ /* check failed, retry once */
+ mongoc_server_description_destroy (sd);
+ sd = mongoc_topology_select (client->topology, optype, prefs, error);
+ if (sd) {
+ return sd;
+ }
+
+ return NULL;
+}
+
+bool
+mongoc_client_set_error_api (mongoc_client_t *client, int32_t version)
+{
+ if (!client->topology->single_threaded) {
+ MONGOC_ERROR ("Cannot set Error API Version on a pooled client, use "
+ "mongoc_client_pool_set_error_api");
+ return false;
+ }
+
+ if (version != MONGOC_ERROR_API_VERSION_LEGACY &&
+ version != MONGOC_ERROR_API_VERSION_2) {
+ MONGOC_ERROR ("Unsupported Error API Version: %" PRId32, version);
+ return false;
+ }
+
+ if (client->error_api_set) {
+ MONGOC_ERROR ("Can only set Error API Version once");
+ return false;
+ }
+
+ client->error_api_version = version;
+ client->error_api_set = true;
+
+ return true;
+}
+
+bool
+mongoc_client_set_appname (mongoc_client_t *client, const char *appname)
+{
+ if (!client->topology->single_threaded) {
+ MONGOC_ERROR ("Cannot call set_appname on a client from a pool");
+ return false;
+ }
+
+ return _mongoc_topology_set_appname (client->topology, appname);
+}
+
+mongoc_server_session_t *
+_mongoc_client_pop_server_session (mongoc_client_t *client, bson_error_t *error)
+{
+ return _mongoc_topology_pop_server_session (client->topology, error);
+}
+
+/*
+ *--------------------------------------------------------------------------
+ *
+ * _mongoc_client_lookup_session --
+ *
+ * Retrieve a mongoc_client_session_t associated with @client_session_id.
+ * Use this to find the "lsid" and "$clusterTime" to send in the server
+ * command.
+ *
+ * Returns:
+ * True on success, false on error and @error is set. Will return false
+ * if the session is from an outdated client generation, a holdover
+ * from before a call to mongoc_client_reset.
+ *
+ * Side effects:
+ * None.
+ *
+ *--------------------------------------------------------------------------
+ */
+bool
+_mongoc_client_lookup_session (const mongoc_client_t *client,
+ uint32_t client_session_id,
+ mongoc_client_session_t **cs /* OUT */,
+ bson_error_t *error /* OUT */)
+{
+ ENTRY;
+
+ *cs = mongoc_set_get (client->client_sessions, client_session_id);
+
+ if (*cs) {
+ RETURN (true);
+ }
+
+ bson_set_error (error,
+ MONGOC_ERROR_COMMAND,
+ MONGOC_ERROR_COMMAND_INVALID_ARG,
+ "Invalid sessionId");
+
+ RETURN (false);
+}
+
+void
+_mongoc_client_unregister_session (mongoc_client_t *client,
+ mongoc_client_session_t *session)
+{
+ mongoc_set_rm (client->client_sessions, session->client_session_id);
+}
+
+void
+_mongoc_client_push_server_session (mongoc_client_t *client,
+ mongoc_server_session_t *server_session)
+{
+ _mongoc_topology_push_server_session (client->topology, server_session);
+}
+
+/*
+ *--------------------------------------------------------------------------
+ *
+ * mongoc_client_end_sessions --
+ *
+ * End all server sessions in the topology's server session pool.
+ * Don't block long: if server selection or connecting fails, quit.
+ *
+ * The server session pool becomes invalid, but may not be empty.
+ * Destroy the topology after this without using any sessions.
+ *
+ *--------------------------------------------------------------------------
+ */
+
+void
+_mongoc_client_end_sessions (mongoc_client_t *client)
+{
+ mongoc_topology_t *t = client->topology;
+ mongoc_read_prefs_t *prefs;
+ bson_error_t error;
+ uint32_t server_id;
+ bson_t cmd;
+ mongoc_server_stream_t *stream;
+ mongoc_cmd_parts_t parts;
+ mongoc_cluster_t *cluster = &client->cluster;
+ bool r;
+
+ if (t->session_pool) {
+ prefs = mongoc_read_prefs_new (MONGOC_READ_PRIMARY_PREFERRED);
+ server_id =
+ mongoc_topology_select_server_id (t, MONGOC_SS_READ, prefs, &error);
+
+ mongoc_read_prefs_destroy (prefs);
+ if (!server_id) {
+ MONGOC_WARNING ("Couldn't send \"endSessions\": %s", error.message);
+ return;
+ }
+
+ stream = mongoc_cluster_stream_for_server (
+ cluster, server_id, false /* reconnect_ok */, NULL, NULL, &error);
+
+ if (!stream) {
+ MONGOC_WARNING ("Couldn't send \"endSessions\": %s", error.message);
+ return;
+ }
+
+ /* end sessions in chunks */
+ while (_mongoc_topology_end_sessions_cmd (t, &cmd)) {
+ mongoc_cmd_parts_init (
+ &parts, client, "admin", MONGOC_QUERY_SLAVE_OK, &cmd);
+ parts.assembled.operation_id = ++cluster->operation_id;
+ parts.prohibit_lsid = true;
+
+ r = mongoc_cmd_parts_assemble (&parts, stream, &error);
+ if (!r) {
+ MONGOC_WARNING ("Couldn't construct \"endSessions\" command: %s",
+ error.message);
+ } else {
+ r = mongoc_cluster_run_command_monitored (
+ cluster, &parts.assembled, NULL, &error);
+
+ if (!r) {
+ MONGOC_WARNING ("Couldn't send \"endSessions\": %s",
+ error.message);
+ }
+ }
+
+ mongoc_cmd_parts_cleanup (&parts);
+
+ if (!mongoc_cluster_stream_valid (cluster, stream)) {
+ /* The stream was invalidated as a result of a network error, so we
+ * stop sending commands. */
+ break;
+ }
+
+ bson_destroy (&cmd);
+ }
+
+ bson_destroy (&cmd);
+ mongoc_server_stream_cleanup (stream);
+ }
+}
+
+void
+mongoc_client_reset (mongoc_client_t *client)
+{
+ BSON_ASSERT (client);
+
+ client->generation++;
+
+ /* Client sessions are owned and destroyed by the user, but we keep
+ local pointers to them for reference. On reset, clear our local
+ set without destroying the sessions or calling endSessions.
+ client_sessions has no dtor, so it won't destroy its items.
+
+ Destroying the local cache of client sessions here ensures they
+ cannot be used by future operations--lookup for them will fail. */
+ mongoc_set_destroy (client->client_sessions);
+ client->client_sessions = mongoc_set_new (8, NULL, NULL);
+
+ /* Server sessions are owned by us, so we clear the pool on reset. */
+ _mongoc_topology_clear_session_pool (client->topology);
+}
+
+mongoc_change_stream_t *
+mongoc_client_watch (mongoc_client_t *client,
+ const bson_t *pipeline,
+ const bson_t *opts)
+{
+ return _mongoc_change_stream_new_from_client (client, pipeline, opts);
+}
+
+bool
+mongoc_client_enable_auto_encryption (mongoc_client_t *client,
+ mongoc_auto_encryption_opts_t *opts,
+ bson_error_t *error)
+{
+ if (!client->topology->single_threaded) {
+ bson_set_error (error,
+ MONGOC_ERROR_CLIENT,
+ MONGOC_ERROR_CLIENT_INVALID_ENCRYPTION_ARG,
+ "Cannot enable auto encryption on a pooled client, use "
+ "mongoc_client_pool_enable_auto_encryption");
+ return false;
+ }
+ return _mongoc_cse_client_enable_auto_encryption (client, opts, error);
+}
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-client.h b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-client.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-client.h
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-client.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-cluster-aws-private.h b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-cluster-aws-private.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-cluster-aws-private.h
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-cluster-aws-private.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-cluster-aws.c b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-cluster-aws.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-cluster-aws.c
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-cluster-aws.c
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-cluster-cyrus-private.h b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-cluster-cyrus-private.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-cluster-cyrus-private.h
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-cluster-cyrus-private.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-cluster-cyrus.c b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-cluster-cyrus.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-cluster-cyrus.c
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-cluster-cyrus.c
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-cluster-private.h b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-cluster-private.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-cluster-private.h
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-cluster-private.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-cluster-sasl-private.h b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-cluster-sasl-private.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-cluster-sasl-private.h
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-cluster-sasl-private.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-cluster-sasl.c b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-cluster-sasl.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-cluster-sasl.c
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-cluster-sasl.c
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-cluster-sspi-private.h b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-cluster-sspi-private.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-cluster-sspi-private.h
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-cluster-sspi-private.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-cluster-sspi.c b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-cluster-sspi.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-cluster-sspi.c
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-cluster-sspi.c
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-cluster.c b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-cluster.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-cluster.c
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-cluster.c
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-cmd-private.h b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-cmd-private.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-cmd-private.h
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-cmd-private.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-cmd.c b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-cmd.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-cmd.c
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-cmd.c
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-collection-private.h b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-collection-private.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-collection-private.h
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-collection-private.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-collection.c b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-collection.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-collection.c
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-collection.c
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-collection.h b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-collection.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-collection.h
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-collection.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-compression-private.h b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-compression-private.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-compression-private.h
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-compression-private.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-compression.c b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-compression.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-compression.c
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-compression.c
diff --git a/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-config.h b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-config.h
new file mode 100644
index 00000000..5b71ea31
--- /dev/null
+++ b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-config.h
@@ -0,0 +1,414 @@
+/*
+ * 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/mongoc.h> can be included directly."
+#endif
+
+
+#ifndef MONGOC_CONFIG_H
+#define MONGOC_CONFIG_H
+
+/* MONGOC_USER_SET_CFLAGS is set from config based on what compiler flags were
+ * used to compile mongoc */
+#define MONGOC_USER_SET_CFLAGS ""
+
+#define MONGOC_USER_SET_LDFLAGS ""
+
+/* MONGOC_CC is used to determine what C compiler was used to compile mongoc */
+#define MONGOC_CC "cc"
+
+/*
+ * MONGOC_ENABLE_SSL_SECURE_CHANNEL is set from configure to determine if we are
+ * compiled with Native SSL support on Windows
+ */
+#define MONGOC_ENABLE_SSL_SECURE_CHANNEL 0
+
+#if MONGOC_ENABLE_SSL_SECURE_CHANNEL != 1
+# undef MONGOC_ENABLE_SSL_SECURE_CHANNEL
+#endif
+
+
+/*
+ * MONGOC_ENABLE_CRYPTO_CNG is set from configure to determine if we are
+ * compiled with Native Crypto support on Windows
+ */
+#define MONGOC_ENABLE_CRYPTO_CNG 0
+
+#if MONGOC_ENABLE_CRYPTO_CNG != 1
+# undef MONGOC_ENABLE_CRYPTO_CNG
+#endif
+
+
+/*
+ * MONGOC_ENABLE_SSL_SECURE_TRANSPORT is set from configure to determine if we are
+ * compiled with Native SSL support on Darwin
+ */
+#define MONGOC_ENABLE_SSL_SECURE_TRANSPORT 1
+
+#if MONGOC_ENABLE_SSL_SECURE_TRANSPORT != 1
+# undef MONGOC_ENABLE_SSL_SECURE_TRANSPORT
+#endif
+
+
+/*
+ * MONGOC_ENABLE_CRYPTO_COMMON_CRYPTO is set from configure to determine if we are
+ * compiled with Native Crypto support on Darwin
+ */
+#define MONGOC_ENABLE_CRYPTO_COMMON_CRYPTO 1
+
+#if MONGOC_ENABLE_CRYPTO_COMMON_CRYPTO != 1
+# undef MONGOC_ENABLE_CRYPTO_COMMON_CRYPTO
+#endif
+
+
+/*
+ * MONGOC_ENABLE_SSL_LIBRESSL is set from configure to determine if we are
+ * compiled with LibreSSL support.
+ */
+#define MONGOC_ENABLE_SSL_LIBRESSL 0
+
+#if MONGOC_ENABLE_SSL_LIBRESSL != 1
+# undef MONGOC_ENABLE_SSL_LIBRESSL
+#endif
+
+
+/*
+ * MONGOC_ENABLE_SSL_OPENSSL is set from configure to determine if we are
+ * compiled with OpenSSL support.
+ */
+#define MONGOC_ENABLE_SSL_OPENSSL 0
+
+#if MONGOC_ENABLE_SSL_OPENSSL != 1
+# undef MONGOC_ENABLE_SSL_OPENSSL
+#endif
+
+
+/*
+ * MONGOC_ENABLE_CRYPTO_LIBCRYPTO is set from configure to determine if we are
+ * compiled with OpenSSL support.
+ */
+#define MONGOC_ENABLE_CRYPTO_LIBCRYPTO 0
+
+#if MONGOC_ENABLE_CRYPTO_LIBCRYPTO != 1
+# undef MONGOC_ENABLE_CRYPTO_LIBCRYPTO
+#endif
+
+
+/*
+ * MONGOC_ENABLE_SSL is set from configure to determine if we are
+ * compiled with any SSL support.
+ */
+#define MONGOC_ENABLE_SSL 1
+
+#if MONGOC_ENABLE_SSL != 1
+# undef MONGOC_ENABLE_SSL
+#endif
+
+
+/*
+ * MONGOC_ENABLE_CRYPTO is set from configure to determine if we are
+ * compiled with any crypto support.
+ */
+#define MONGOC_ENABLE_CRYPTO 1
+
+#if MONGOC_ENABLE_CRYPTO != 1
+# undef MONGOC_ENABLE_CRYPTO
+#endif
+
+
+/*
+ * Use system crypto profile
+ */
+#define MONGOC_ENABLE_CRYPTO_SYSTEM_PROFILE 0
+
+#if MONGOC_ENABLE_CRYPTO_SYSTEM_PROFILE != 1
+# undef MONGOC_ENABLE_CRYPTO_SYSTEM_PROFILE
+#endif
+
+
+/*
+ * Use ASN1_STRING_get0_data () rather than the deprecated ASN1_STRING_data
+ */
+#define MONGOC_HAVE_ASN1_STRING_GET0_DATA 0
+
+#if MONGOC_HAVE_ASN1_STRING_GET0_DATA != 1
+# undef MONGOC_HAVE_ASN1_STRING_GET0_DATA
+#endif
+
+
+/*
+ * MONGOC_ENABLE_SASL is set from configure to determine if we are
+ * compiled with SASL support.
+ */
+#define MONGOC_ENABLE_SASL 1
+
+#if MONGOC_ENABLE_SASL != 1
+# undef MONGOC_ENABLE_SASL
+#endif
+
+
+/*
+ * MONGOC_ENABLE_SASL_CYRUS is set from configure to determine if we are
+ * compiled with Cyrus SASL support.
+ */
+#define MONGOC_ENABLE_SASL_CYRUS 1
+
+#if MONGOC_ENABLE_SASL_CYRUS != 1
+# undef MONGOC_ENABLE_SASL_CYRUS
+#endif
+
+
+/*
+ * MONGOC_ENABLE_SASL_SSPI is set from configure to determine if we are
+ * compiled with SSPI support.
+ */
+#define MONGOC_ENABLE_SASL_SSPI 0
+
+#if MONGOC_ENABLE_SASL_SSPI != 1
+# undef MONGOC_ENABLE_SASL_SSPI
+#endif
+
+/*
+ * MONGOC_HAVE_SASL_CLIENT_DONE is set from configure to determine if we
+ * have SASL and its version is new enough to use sasl_client_done (),
+ * which supersedes sasl_done ().
+ */
+#define MONGOC_HAVE_SASL_CLIENT_DONE 1
+
+#if MONGOC_HAVE_SASL_CLIENT_DONE != 1
+# undef MONGOC_HAVE_SASL_CLIENT_DONE
+#endif
+
+
+/*
+ * Disable automatic calls to mongoc_init() and mongoc_cleanup()
+ * before main() is called, and after exit() (respectively).
+ */
+#define MONGOC_NO_AUTOMATIC_GLOBALS 1
+
+#if MONGOC_NO_AUTOMATIC_GLOBALS != 1
+# undef MONGOC_NO_AUTOMATIC_GLOBALS
+#endif
+
+/*
+ * MONGOC_HAVE_SOCKLEN is set from configure to determine if we
+ * need to emulate the type.
+ */
+#define MONGOC_HAVE_SOCKLEN 1
+
+#if MONGOC_HAVE_SOCKLEN != 1
+# undef MONGOC_HAVE_SOCKLEN
+#endif
+
+
+/*
+ * MONGOC_HAVE_DNSAPI is set from configure to determine if we should use the
+ * Windows dnsapi for SRV record lookups.
+ */
+#define MONGOC_HAVE_DNSAPI 0
+
+#if MONGOC_HAVE_DNSAPI != 1
+# undef MONGOC_HAVE_DNSAPI
+#endif
+
+
+/*
+ * MONGOC_HAVE_RES_NSEARCH is set from configure to determine if we
+ * have thread-safe res_nsearch().
+ */
+#define MONGOC_HAVE_RES_NSEARCH 1
+
+#if MONGOC_HAVE_RES_NSEARCH != 1
+# undef MONGOC_HAVE_RES_NSEARCH
+#endif
+
+
+/*
+ * MONGOC_HAVE_RES_NDESTROY is set from configure to determine if we
+ * have BSD / Darwin's res_ndestroy().
+ */
+#define MONGOC_HAVE_RES_NDESTROY 1
+
+#if MONGOC_HAVE_RES_NDESTROY != 1
+# undef MONGOC_HAVE_RES_NDESTROY
+#endif
+
+
+/*
+ * MONGOC_HAVE_RES_NCLOSE is set from configure to determine if we
+ * have Linux's res_nclose().
+ */
+#define MONGOC_HAVE_RES_NCLOSE 0
+
+#if MONGOC_HAVE_RES_NCLOSE != 1
+# undef MONGOC_HAVE_RES_NCLOSE
+#endif
+
+
+/*
+ * MONGOC_HAVE_RES_SEARCH is set from configure to determine if we
+ * have thread-unsafe res_search(). It's unset if we have the preferred
+ * res_nsearch().
+ */
+#define MONGOC_HAVE_RES_SEARCH 0
+
+#if MONGOC_HAVE_RES_SEARCH != 1
+# undef MONGOC_HAVE_RES_SEARCH
+#endif
+
+
+/*
+ * Set from configure, see
+ * https://curl.haxx.se/mail/lib-2009-04/0287.html
+ */
+#define MONGOC_SOCKET_ARG2 struct sockaddr
+#define MONGOC_SOCKET_ARG3 socklen_t
+
+/*
+ * Enable wire protocol compression negotiation
+ *
+ */
+#define MONGOC_ENABLE_COMPRESSION 1
+
+#if MONGOC_ENABLE_COMPRESSION != 1
+# undef MONGOC_ENABLE_COMPRESSION
+#endif
+
+/*
+ * Set if we have snappy compression support
+ *
+ */
+#define MONGOC_ENABLE_COMPRESSION_SNAPPY 0
+
+#if MONGOC_ENABLE_COMPRESSION_SNAPPY != 1
+# undef MONGOC_ENABLE_COMPRESSION_SNAPPY
+#endif
+
+
+/*
+ * Set if we have zlib compression support
+ *
+ */
+#define MONGOC_ENABLE_COMPRESSION_ZLIB 1
+
+#if MONGOC_ENABLE_COMPRESSION_ZLIB != 1
+# undef MONGOC_ENABLE_COMPRESSION_ZLIB
+#endif
+
+/*
+ * Set if we have zstd compression support
+ *
+ */
+#define MONGOC_ENABLE_COMPRESSION_ZSTD 1
+
+#if MONGOC_ENABLE_COMPRESSION_ZSTD != 1
+# undef MONGOC_ENABLE_COMPRESSION_ZSTD
+#endif
+
+/*
+ * Set if performance counters are available and not disabled.
+ *
+ */
+#define MONGOC_ENABLE_SHM_COUNTERS 0
+
+#if MONGOC_ENABLE_SHM_COUNTERS != 1
+# undef MONGOC_ENABLE_SHM_COUNTERS
+#endif
+
+/*
+ * Set if we have enabled fast counters on Intel using the RDTSCP instruction
+ *
+ */
+#define MONGOC_ENABLE_RDTSCP 0
+
+#if MONGOC_ENABLE_RDTSCP != 1
+# undef MONGOC_ENABLE_RDTSCP
+#endif
+
+
+/*
+ * Set if we have the sched_getcpu() function for use with counters
+ *
+ */
+#define MONGOC_HAVE_SCHED_GETCPU 0
+
+#if MONGOC_HAVE_SCHED_GETCPU != 1
+# undef MONGOC_HAVE_SCHED_GETCPU
+#endif
+
+/*
+ * Set if tracing is enabled. Logs things like network communication and
+ * entry/exit of certain functions.
+ *
+ */
+#define MONGOC_TRACE 1
+
+#if MONGOC_TRACE != 1
+# undef MONGOC_TRACE
+#endif
+
+/*
+ * Set if we have ICU support.
+ */
+#define MONGOC_ENABLE_ICU 0
+
+#if MONGOC_ENABLE_ICU != 1
+# undef MONGOC_ENABLE_ICU
+#endif
+
+
+/*
+ * Set if we have Client Side Encryption support.
+ */
+
+#define MONGOC_ENABLE_CLIENT_SIDE_ENCRYPTION 1
+
+#if MONGOC_ENABLE_CLIENT_SIDE_ENCRYPTION != 1
+# undef MONGOC_ENABLE_CLIENT_SIDE_ENCRYPTION
+#endif
+
+
+/*
+ * Set if struct sockaddr_storage has __ss_family (instead of ss_family)
+ */
+
+#define MONGOC_HAVE_SS_FAMILY 1
+
+#if MONGOC_HAVE_SS_FAMILY != 1
+# undef MONGOC_HAVE_SS_FAMILY
+#endif
+
+/*
+ * Set if building with AWS IAM support.
+ */
+#define MONGOC_ENABLE_MONGODB_AWS_AUTH 1
+
+#if MONGOC_ENABLE_MONGODB_AWS_AUTH != 1
+# undef MONGOC_ENABLE_MONGODB_AWS_AUTH
+#endif
+
+/*
+ * NOTICE:
+ * If you're about to update this file and add a config flag, make sure to
+ * update:
+ * o The bitfield in mongoc-handshake-private.h
+ * o _mongoc_handshake_get_config_hex_string() in mongoc-handshake.c
+ * o examples/parse_handshake_cfg.py
+ * o test_handshake_config_string in test-mongoc-handshake.c
+ */
+
+#endif /* MONGOC_CONFIG_H */
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-config.h.in b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-config.h.in
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-config.h.in
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-config.h.in
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-counters-private.h b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-counters-private.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-counters-private.h
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-counters-private.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-counters.c b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-counters.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-counters.c
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-counters.c
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-counters.defs b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-counters.defs
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-counters.defs
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-counters.defs
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-crypt-private.h b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-crypt-private.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-crypt-private.h
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-crypt-private.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-crypt.c b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-crypt.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-crypt.c
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-crypt.c
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-crypto-cng-private.h b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-crypto-cng-private.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-crypto-cng-private.h
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-crypto-cng-private.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-crypto-cng.c b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-crypto-cng.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-crypto-cng.c
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-crypto-cng.c
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-crypto-common-crypto-private.h b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-crypto-common-crypto-private.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-crypto-common-crypto-private.h
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-crypto-common-crypto-private.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-crypto-common-crypto.c b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-crypto-common-crypto.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-crypto-common-crypto.c
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-crypto-common-crypto.c
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-crypto-openssl-private.h b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-crypto-openssl-private.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-crypto-openssl-private.h
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-crypto-openssl-private.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-crypto-openssl.c b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-crypto-openssl.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-crypto-openssl.c
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-crypto-openssl.c
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-crypto-private.h b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-crypto-private.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-crypto-private.h
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-crypto-private.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-crypto.c b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-crypto.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-crypto.c
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-crypto.c
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-cursor-array.c b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-cursor-array.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-cursor-array.c
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-cursor-array.c
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-cursor-change-stream.c b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-cursor-change-stream.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-cursor-change-stream.c
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-cursor-change-stream.c
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-cursor-cmd-deprecated.c b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-cursor-cmd-deprecated.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-cursor-cmd-deprecated.c
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-cursor-cmd-deprecated.c
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-cursor-cmd.c b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-cursor-cmd.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-cursor-cmd.c
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-cursor-cmd.c
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-cursor-find-cmd.c b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-cursor-find-cmd.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-cursor-find-cmd.c
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-cursor-find-cmd.c
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-cursor-find-opquery.c b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-cursor-find-opquery.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-cursor-find-opquery.c
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-cursor-find-opquery.c
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-cursor-find.c b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-cursor-find.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-cursor-find.c
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-cursor-find.c
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-cursor-legacy.c b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-cursor-legacy.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-cursor-legacy.c
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-cursor-legacy.c
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-cursor-private.h b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-cursor-private.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-cursor-private.h
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-cursor-private.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-cursor.c b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-cursor.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-cursor.c
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-cursor.c
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-cursor.h b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-cursor.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-cursor.h
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-cursor.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-cyrus-private.h b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-cyrus-private.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-cyrus-private.h
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-cyrus-private.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-cyrus.c b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-cyrus.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-cyrus.c
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-cyrus.c
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-database-private.h b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-database-private.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-database-private.h
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-database-private.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-database.c b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-database.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-database.c
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-database.c
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-database.h b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-database.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-database.h
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-database.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-errno-private.h b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-errno-private.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-errno-private.h
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-errno-private.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-error-private.h b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-error-private.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-error-private.h
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-error-private.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-error.c b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-error.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-error.c
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-error.c
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-error.h b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-error.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-error.h
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-error.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-find-and-modify-private.h b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-find-and-modify-private.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-find-and-modify-private.h
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-find-and-modify-private.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-find-and-modify.c b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-find-and-modify.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-find-and-modify.c
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-find-and-modify.c
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-find-and-modify.h b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-find-and-modify.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-find-and-modify.h
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-find-and-modify.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-flags-private.h b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-flags-private.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-flags-private.h
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-flags-private.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-flags.h b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-flags.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-flags.h
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-flags.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-gridfs-bucket-file-private.h b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-gridfs-bucket-file-private.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-gridfs-bucket-file-private.h
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-gridfs-bucket-file-private.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-gridfs-bucket-file.c b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-gridfs-bucket-file.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-gridfs-bucket-file.c
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-gridfs-bucket-file.c
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-gridfs-bucket-private.h b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-gridfs-bucket-private.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-gridfs-bucket-private.h
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-gridfs-bucket-private.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-gridfs-bucket.c b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-gridfs-bucket.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-gridfs-bucket.c
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-gridfs-bucket.c
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-gridfs-bucket.h b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-gridfs-bucket.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-gridfs-bucket.h
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-gridfs-bucket.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-gridfs-file-list-private.h b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-gridfs-file-list-private.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-gridfs-file-list-private.h
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-gridfs-file-list-private.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-gridfs-file-list.c b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-gridfs-file-list.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-gridfs-file-list.c
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-gridfs-file-list.c
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-gridfs-file-list.h b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-gridfs-file-list.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-gridfs-file-list.h
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-gridfs-file-list.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-gridfs-file-page-private.h b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-gridfs-file-page-private.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-gridfs-file-page-private.h
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-gridfs-file-page-private.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-gridfs-file-page.c b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-gridfs-file-page.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-gridfs-file-page.c
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-gridfs-file-page.c
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-gridfs-file-page.h b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-gridfs-file-page.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-gridfs-file-page.h
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-gridfs-file-page.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-gridfs-file-private.h b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-gridfs-file-private.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-gridfs-file-private.h
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-gridfs-file-private.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-gridfs-file.c b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-gridfs-file.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-gridfs-file.c
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-gridfs-file.c
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-gridfs-file.h b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-gridfs-file.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-gridfs-file.h
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-gridfs-file.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-gridfs-private.h b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-gridfs-private.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-gridfs-private.h
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-gridfs-private.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-gridfs.c b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-gridfs.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-gridfs.c
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-gridfs.c
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-gridfs.h b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-gridfs.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-gridfs.h
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-gridfs.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-handshake-compiler-private.h b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-handshake-compiler-private.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-handshake-compiler-private.h
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-handshake-compiler-private.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-handshake-os-private.h b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-handshake-os-private.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-handshake-os-private.h
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-handshake-os-private.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-handshake-private.h b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-handshake-private.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-handshake-private.h
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-handshake-private.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-handshake.c b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-handshake.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-handshake.c
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-handshake.c
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-handshake.h b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-handshake.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-handshake.h
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-handshake.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-host-list-private.h b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-host-list-private.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-host-list-private.h
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-host-list-private.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-host-list.c b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-host-list.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-host-list.c
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-host-list.c
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-host-list.h b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-host-list.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-host-list.h
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-host-list.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-http-private.h b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-http-private.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-http-private.h
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-http-private.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-http.c b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-http.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-http.c
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-http.c
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-index.c b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-index.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-index.c
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-index.c
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-index.h b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-index.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-index.h
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-index.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-init.c b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-init.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-init.c
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-init.c
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-init.h b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-init.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-init.h
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-init.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-interrupt-private.h b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-interrupt-private.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-interrupt-private.h
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-interrupt-private.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-interrupt.c b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-interrupt.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-interrupt.c
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-interrupt.c
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-iovec.h b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-iovec.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-iovec.h
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-iovec.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-libressl-private.h b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-libressl-private.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-libressl-private.h
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-libressl-private.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-libressl.c b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-libressl.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-libressl.c
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-libressl.c
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-linux-distro-scanner-private.h b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-linux-distro-scanner-private.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-linux-distro-scanner-private.h
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-linux-distro-scanner-private.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-linux-distro-scanner.c b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-linux-distro-scanner.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-linux-distro-scanner.c
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-linux-distro-scanner.c
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-list-private.h b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-list-private.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-list-private.h
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-list-private.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-list.c b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-list.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-list.c
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-list.c
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-log-private.h b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-log-private.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-log-private.h
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-log-private.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-log.c b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-log.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-log.c
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-log.c
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-log.h b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-log.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-log.h
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-log.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-macros.h b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-macros.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-macros.h
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-macros.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-matcher-op-private.h b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-matcher-op-private.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-matcher-op-private.h
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-matcher-op-private.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-matcher-op.c b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-matcher-op.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-matcher-op.c
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-matcher-op.c
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-matcher-private.h b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-matcher-private.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-matcher-private.h
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-matcher-private.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-matcher.c b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-matcher.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-matcher.c
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-matcher.c
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-matcher.h b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-matcher.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-matcher.h
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-matcher.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-memcmp-private.h b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-memcmp-private.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-memcmp-private.h
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-memcmp-private.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-memcmp.c b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-memcmp.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-memcmp.c
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-memcmp.c
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-ocsp-cache-private.h b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-ocsp-cache-private.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-ocsp-cache-private.h
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-ocsp-cache-private.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-ocsp-cache.c b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-ocsp-cache.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-ocsp-cache.c
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-ocsp-cache.c
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-opcode.h b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-opcode.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-opcode.h
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-opcode.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-openssl-private.h b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-openssl-private.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-openssl-private.h
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-openssl-private.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-openssl.c b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-openssl.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-openssl.c
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-openssl.c
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-opts-helpers-private.h b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-opts-helpers-private.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-opts-helpers-private.h
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-opts-helpers-private.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-opts-helpers.c b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-opts-helpers.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-opts-helpers.c
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-opts-helpers.c
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-opts-private.h b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-opts-private.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-opts-private.h
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-opts-private.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-opts.c b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-opts.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-opts.c
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-opts.c
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-prelude.h b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-prelude.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-prelude.h
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-prelude.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-queue-private.h b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-queue-private.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-queue-private.h
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-queue-private.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-queue.c b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-queue.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-queue.c
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-queue.c
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-rand-cng.c b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-rand-cng.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-rand-cng.c
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-rand-cng.c
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-rand-common-crypto.c b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-rand-common-crypto.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-rand-common-crypto.c
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-rand-common-crypto.c
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-rand-openssl.c b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-rand-openssl.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-rand-openssl.c
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-rand-openssl.c
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-rand-private.h b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-rand-private.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-rand-private.h
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-rand-private.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-rand.h b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-rand.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-rand.h
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-rand.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-read-concern-private.h b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-read-concern-private.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-read-concern-private.h
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-read-concern-private.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-read-concern.c b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-read-concern.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-read-concern.c
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-read-concern.c
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-read-concern.h b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-read-concern.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-read-concern.h
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-read-concern.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-read-prefs-private.h b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-read-prefs-private.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-read-prefs-private.h
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-read-prefs-private.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-read-prefs.c b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-read-prefs.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-read-prefs.c
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-read-prefs.c
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-read-prefs.h b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-read-prefs.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-read-prefs.h
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-read-prefs.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-rpc-private.h b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-rpc-private.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-rpc-private.h
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-rpc-private.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-rpc.c b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-rpc.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-rpc.c
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-rpc.c
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-sasl-private.h b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-sasl-private.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-sasl-private.h
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-sasl-private.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-sasl.c b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-sasl.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-sasl.c
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-sasl.c
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-scram-private.h b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-scram-private.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-scram-private.h
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-scram-private.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-scram.c b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-scram.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-scram.c
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-scram.c
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-secure-channel-private.h b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-secure-channel-private.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-secure-channel-private.h
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-secure-channel-private.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-secure-channel.c b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-secure-channel.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-secure-channel.c
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-secure-channel.c
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-secure-transport-private.h b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-secure-transport-private.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-secure-transport-private.h
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-secure-transport-private.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-secure-transport.c b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-secure-transport.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-secure-transport.c
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-secure-transport.c
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-server-description-private.h b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-server-description-private.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-server-description-private.h
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-server-description-private.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-server-description.c b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-server-description.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-server-description.c
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-server-description.c
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-server-description.h b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-server-description.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-server-description.h
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-server-description.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-server-monitor-private.h b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-server-monitor-private.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-server-monitor-private.h
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-server-monitor-private.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-server-monitor.c b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-server-monitor.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-server-monitor.c
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-server-monitor.c
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-server-stream-private.h b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-server-stream-private.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-server-stream-private.h
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-server-stream-private.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-server-stream.c b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-server-stream.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-server-stream.c
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-server-stream.c
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-set-private.h b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-set-private.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-set-private.h
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-set-private.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-set.c b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-set.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-set.c
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-set.c
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-socket-private.h b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-socket-private.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-socket-private.h
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-socket-private.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-socket.c b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-socket.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-socket.c
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-socket.c
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-socket.h b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-socket.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-socket.h
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-socket.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-ssl-private.h b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-ssl-private.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-ssl-private.h
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-ssl-private.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-ssl.c b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-ssl.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-ssl.c
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-ssl.c
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-ssl.h b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-ssl.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-ssl.h
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-ssl.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-sspi-private.h b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-sspi-private.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-sspi-private.h
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-sspi-private.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-sspi.c b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-sspi.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-sspi.c
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-sspi.c
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-stream-buffered.c b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-stream-buffered.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-stream-buffered.c
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-stream-buffered.c
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-stream-buffered.h b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-stream-buffered.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-stream-buffered.h
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-stream-buffered.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-stream-file.c b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-stream-file.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-stream-file.c
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-stream-file.c
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-stream-file.h b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-stream-file.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-stream-file.h
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-stream-file.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-stream-gridfs-download-private.h b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-stream-gridfs-download-private.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-stream-gridfs-download-private.h
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-stream-gridfs-download-private.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-stream-gridfs-download.c b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-stream-gridfs-download.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-stream-gridfs-download.c
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-stream-gridfs-download.c
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-stream-gridfs-upload-private.h b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-stream-gridfs-upload-private.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-stream-gridfs-upload-private.h
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-stream-gridfs-upload-private.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-stream-gridfs-upload.c b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-stream-gridfs-upload.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-stream-gridfs-upload.c
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-stream-gridfs-upload.c
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-stream-gridfs.c b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-stream-gridfs.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-stream-gridfs.c
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-stream-gridfs.c
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-stream-gridfs.h b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-stream-gridfs.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-stream-gridfs.h
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-stream-gridfs.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-stream-private.h b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-stream-private.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-stream-private.h
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-stream-private.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-stream-socket.c b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-stream-socket.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-stream-socket.c
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-stream-socket.c
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-stream-socket.h b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-stream-socket.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-stream-socket.h
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-stream-socket.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-stream-tls-libressl-private.h b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-stream-tls-libressl-private.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-stream-tls-libressl-private.h
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-stream-tls-libressl-private.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-stream-tls-libressl.c b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-stream-tls-libressl.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-stream-tls-libressl.c
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-stream-tls-libressl.c
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-stream-tls-libressl.h b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-stream-tls-libressl.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-stream-tls-libressl.h
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-stream-tls-libressl.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-stream-tls-openssl-bio-private.h b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-stream-tls-openssl-bio-private.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-stream-tls-openssl-bio-private.h
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-stream-tls-openssl-bio-private.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-stream-tls-openssl-bio.c b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-stream-tls-openssl-bio.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-stream-tls-openssl-bio.c
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-stream-tls-openssl-bio.c
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-stream-tls-openssl-private.h b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-stream-tls-openssl-private.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-stream-tls-openssl-private.h
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-stream-tls-openssl-private.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-stream-tls-openssl.c b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-stream-tls-openssl.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-stream-tls-openssl.c
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-stream-tls-openssl.c
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-stream-tls-openssl.h b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-stream-tls-openssl.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-stream-tls-openssl.h
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-stream-tls-openssl.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-stream-tls-private.h b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-stream-tls-private.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-stream-tls-private.h
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-stream-tls-private.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-stream-tls-secure-channel-private.h b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-stream-tls-secure-channel-private.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-stream-tls-secure-channel-private.h
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-stream-tls-secure-channel-private.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-stream-tls-secure-channel.c b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-stream-tls-secure-channel.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-stream-tls-secure-channel.c
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-stream-tls-secure-channel.c
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-stream-tls-secure-channel.h b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-stream-tls-secure-channel.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-stream-tls-secure-channel.h
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-stream-tls-secure-channel.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-stream-tls-secure-transport-private.h b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-stream-tls-secure-transport-private.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-stream-tls-secure-transport-private.h
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-stream-tls-secure-transport-private.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-stream-tls-secure-transport.c b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-stream-tls-secure-transport.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-stream-tls-secure-transport.c
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-stream-tls-secure-transport.c
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-stream-tls-secure-transport.h b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-stream-tls-secure-transport.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-stream-tls-secure-transport.h
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-stream-tls-secure-transport.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-stream-tls.c b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-stream-tls.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-stream-tls.c
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-stream-tls.c
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-stream-tls.h b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-stream-tls.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-stream-tls.h
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-stream-tls.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-stream.c b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-stream.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-stream.c
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-stream.c
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-stream.h b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-stream.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-stream.h
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-stream.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-thread-private.h b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-thread-private.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-thread-private.h
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-thread-private.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-topology-background-monitoring-private.h b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-topology-background-monitoring-private.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-topology-background-monitoring-private.h
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-topology-background-monitoring-private.h
diff --git a/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-topology-background-monitoring.c b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-topology-background-monitoring.c
new file mode 100644
index 00000000..b938f929
--- /dev/null
+++ b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-topology-background-monitoring.c
@@ -0,0 +1,359 @@
+/*
+ * Copyright 2020-present 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-topology-background-monitoring-private.h"
+
+#include "mongoc-client-private.h"
+#include "mongoc-log-private.h"
+#include "mongoc-server-monitor-private.h"
+#ifdef MONGOC_ENABLE_SSL
+#include "mongoc-ssl-private.h"
+#endif
+#include "mongoc-stream-private.h"
+#include "mongoc-topology-description-apm-private.h"
+#include "mongoc-topology-private.h"
+#include "mongoc-trace-private.h"
+#include "mongoc-util-private.h"
+
+#undef MONGOC_LOG_DOMAIN
+#define MONGOC_LOG_DOMAIN "monitor"
+
+static BSON_THREAD_FUN (srv_polling_run, topology_void)
+{
+ mongoc_topology_t *topology;
+
+ topology = topology_void;
+ bson_mutex_lock (&topology->mutex);
+ while (true) {
+ int64_t now_ms;
+ int64_t scan_due_ms;
+ int64_t sleep_duration_ms;
+
+ if (topology->scanner_state != MONGOC_TOPOLOGY_SCANNER_BG_RUNNING) {
+ bson_mutex_unlock (&topology->mutex);
+ break;
+ }
+
+ /* This will check if a scan is due. */
+ if (!mongoc_topology_should_rescan_srv (topology)) {
+ TRACE ("%s\n", "topology ineligible for SRV polling, stopping");
+ bson_mutex_unlock (&topology->mutex);
+ break;
+ }
+
+ mongoc_topology_rescan_srv (topology);
+
+ /* Unlock and sleep until next scan is due, or until shutdown signalled.
+ */
+ now_ms = bson_get_monotonic_time () / 1000;
+ scan_due_ms = topology->srv_polling_last_scan_ms +
+ topology->srv_polling_rescan_interval_ms;
+ sleep_duration_ms = scan_due_ms - now_ms;
+
+ if (sleep_duration_ms > 0) {
+ TRACE ("srv polling thread sleeping for %" PRId64 "ms",
+ sleep_duration_ms);
+ }
+
+ /* Check for shutdown again here. mongoc_topology_rescan_srv unlocks the
+ * topology mutex for the scan. The topology may have shut down in that
+ * time. */
+ if (topology->scanner_state != MONGOC_TOPOLOGY_SCANNER_BG_RUNNING) {
+ bson_mutex_unlock (&topology->mutex);
+ break;
+ }
+
+ /* If shutting down, stop. */
+ mongoc_cond_timedwait (
+ &topology->srv_polling_cond, &topology->mutex, sleep_duration_ms);
+ }
+ BSON_THREAD_RETURN;
+}
+
+/* Create a server monitor if necessary.
+ *
+ * Called by monitor threads and application threads when reconciling the
+ * topology description. Caller must have topology mutex locked.
+ */
+static void
+_background_monitor_reconcile_server_monitor (mongoc_topology_t *topology,
+ mongoc_server_description_t *sd)
+{
+ mongoc_set_t *server_monitors;
+ mongoc_server_monitor_t *server_monitor;
+
+ server_monitors = topology->server_monitors;
+ server_monitor = mongoc_set_get (server_monitors, sd->id);
+
+ if (!server_monitor) {
+ /* Add a new server monitor. */
+ server_monitor = mongoc_server_monitor_new (topology, sd);
+ mongoc_server_monitor_run (server_monitor);
+ mongoc_set_add (server_monitors, sd->id, server_monitor);
+ }
+
+ /* Check if an RTT monitor is needed. */
+ if (!bson_empty (&sd->topology_version)) {
+ mongoc_set_t *rtt_monitors;
+ mongoc_server_monitor_t *rtt_monitor;
+
+ rtt_monitors = topology->rtt_monitors;
+ rtt_monitor = mongoc_set_get (rtt_monitors, sd->id);
+ if (!rtt_monitor) {
+ rtt_monitor = mongoc_server_monitor_new (topology, sd);
+ mongoc_server_monitor_run_as_rtt (rtt_monitor);
+ mongoc_set_add (rtt_monitors, sd->id, rtt_monitor);
+ }
+ }
+ return;
+}
+
+/* Start background monitoring.
+ *
+ * Called by an application thread popping a client from a pool. Safe to
+ * call repeatedly.
+ * Caller must have topology mutex locked.
+ */
+void
+_mongoc_topology_background_monitoring_start (mongoc_topology_t *topology)
+{
+ BSON_ASSERT (!topology->single_threaded);
+
+ if (topology->scanner_state == MONGOC_TOPOLOGY_SCANNER_BG_RUNNING) {
+ return;
+ }
+
+ TRACE ("%s", "background monitoring starting");
+
+ BSON_ASSERT (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);
+
+ /* Reconcile to create the first server monitors. */
+ _mongoc_topology_background_monitoring_reconcile (topology);
+ /* Start SRV polling thread. */
+ if (mongoc_topology_should_rescan_srv (topology)) {
+ topology->is_srv_polling = true;
+ COMMON_PREFIX (thread_create)
+ (&topology->srv_polling_thread, srv_polling_run, topology);
+ }
+}
+
+/* Remove server monitors that are no longer in the set of server descriptions.
+ *
+ * Called by monitor threads and application threads when reconciling the
+ * topology description. Caller must have topology mutex locked.
+ */
+static void
+_remove_orphaned_server_monitors (mongoc_set_t *server_monitors,
+ mongoc_set_t *server_descriptions)
+{
+ uint32_t *server_monitor_ids_to_remove;
+ uint32_t n_server_monitor_ids_to_remove = 0;
+ int i;
+
+ /* Signal shutdown to server monitors no longer in the topology description.
+ */
+ server_monitor_ids_to_remove =
+ bson_malloc0 (sizeof (uint32_t) * server_monitors->items_len);
+ for (i = 0; i < server_monitors->items_len; i++) {
+ mongoc_server_monitor_t *server_monitor;
+ uint32_t id;
+
+ server_monitor = mongoc_set_get_item_and_id (server_monitors, i, &id);
+ if (!mongoc_set_get (server_descriptions, id)) {
+ if (mongoc_server_monitor_request_shutdown (server_monitor)) {
+ mongoc_server_monitor_wait_for_shutdown (server_monitor);
+ mongoc_server_monitor_destroy (server_monitor);
+ server_monitor_ids_to_remove[n_server_monitor_ids_to_remove] = id;
+ n_server_monitor_ids_to_remove++;
+ }
+ }
+ }
+
+ /* Remove freed server monitors that have completed shutdown. */
+ for (i = 0; i < n_server_monitor_ids_to_remove; i++) {
+ mongoc_set_rm (server_monitors, server_monitor_ids_to_remove[i]);
+ }
+ bson_free (server_monitor_ids_to_remove);
+}
+
+/* Reconcile the topology description with the set of server monitors.
+ *
+ * Called when the topology description is updated (via handshake, monitoring,
+ * or invalidation). May be called by server monitor thread or an application
+ * thread.
+ * Caller must have topology mutex locked.
+ * Locks server monitor mutexes. May join / remove server monitors that have
+ * completed shutdown.
+ */
+void
+_mongoc_topology_background_monitoring_reconcile (mongoc_topology_t *topology)
+{
+ mongoc_topology_description_t *td;
+ mongoc_set_t *server_descriptions;
+ int i;
+
+ td = &topology->description;
+ server_descriptions = td->servers;
+
+ BSON_ASSERT (!topology->single_threaded);
+
+ if (topology->scanner_state != MONGOC_TOPOLOGY_SCANNER_BG_RUNNING) {
+ return;
+ }
+
+ /* Add newly discovered server monitors, and update existing ones. */
+ for (i = 0; i < server_descriptions->items_len; i++) {
+ mongoc_server_description_t *sd;
+
+ sd = mongoc_set_get_item (server_descriptions, i);
+ _background_monitor_reconcile_server_monitor (topology, sd);
+ }
+
+ _remove_orphaned_server_monitors (topology->server_monitors,
+ server_descriptions);
+ _remove_orphaned_server_monitors (topology->rtt_monitors,
+ server_descriptions);
+}
+
+/* Request all server monitors to scan.
+ *
+ * Called from application threads (during server selection or "not master"
+ * errors). Caller must have topology mutex locked. Locks server monitor mutexes
+ * to deliver scan_requested.
+ */
+void
+_mongoc_topology_background_monitoring_request_scan (
+ mongoc_topology_t *topology)
+{
+ mongoc_set_t *server_monitors;
+ int i;
+
+ BSON_ASSERT (!topology->single_threaded);
+
+ if (topology->scanner_state == MONGOC_TOPOLOGY_SCANNER_SHUTTING_DOWN) {
+ return;
+ }
+
+ server_monitors = topology->server_monitors;
+
+ for (i = 0; i < server_monitors->items_len; i++) {
+ mongoc_server_monitor_t *server_monitor;
+ uint32_t id;
+
+ server_monitor = mongoc_set_get_item_and_id (server_monitors, i, &id);
+ mongoc_server_monitor_request_scan (server_monitor);
+ }
+}
+
+/* Stop, join, and destroy all server monitors.
+ *
+ * Called by application threads when destroying a client pool.
+ * Caller must have topology mutex locked.
+ * Locks server monitor mutexes to deliver shutdown. Releases topology mutex to
+ * join server monitor threads. Leaves topology mutex locked on exit. This
+ * function is thread-safe. But in practice, it is only ever called by one
+ * application thread (because mongoc_client_pool_destroy is not thread-safe).
+ */
+void
+_mongoc_topology_background_monitoring_stop (mongoc_topology_t *topology)
+{
+ mongoc_server_monitor_t *server_monitor;
+ int i;
+
+ BSON_ASSERT (!topology->single_threaded);
+
+ if (topology->scanner_state != MONGOC_TOPOLOGY_SCANNER_BG_RUNNING) {
+ return;
+ }
+
+ topology->scanner_state = MONGOC_TOPOLOGY_SCANNER_SHUTTING_DOWN;
+ TRACE ("%s", "background monitoring stopping");
+
+ /* Signal SRV polling to shut down (if it is started). */
+ if (topology->is_srv_polling) {
+ mongoc_cond_signal (&topology->srv_polling_cond);
+ }
+
+ /* Signal all server monitors to shut down. */
+ for (i = 0; i < topology->server_monitors->items_len; i++) {
+ server_monitor = mongoc_set_get_item (topology->server_monitors, i);
+ mongoc_server_monitor_request_shutdown (server_monitor);
+ }
+
+ /* Signal all RTT monitors to shut down. */
+ for (i = 0; i < topology->rtt_monitors->items_len; i++) {
+ server_monitor = mongoc_set_get_item (topology->rtt_monitors, i);
+ mongoc_server_monitor_request_shutdown (server_monitor);
+ }
+
+ /* Some mongoc_server_monitor_t may be waiting for topology mutex. Unlock so
+ * they can proceed to terminate. It is safe to unlock topology mutex. Since
+ * scanner_state has transitioned to shutting down, no thread can modify
+ * server_monitors. */
+ bson_mutex_unlock (&topology->mutex);
+
+ for (i = 0; i < topology->server_monitors->items_len; i++) {
+ /* Wait for the thread to shutdown. */
+ server_monitor = mongoc_set_get_item (topology->server_monitors, i);
+ mongoc_server_monitor_wait_for_shutdown (server_monitor);
+ mongoc_server_monitor_destroy (server_monitor);
+ }
+
+ for (i = 0; i < topology->rtt_monitors->items_len; i++) {
+ /* Wait for the thread to shutdown. */
+ server_monitor = mongoc_set_get_item (topology->rtt_monitors, i);
+ mongoc_server_monitor_wait_for_shutdown (server_monitor);
+ mongoc_server_monitor_destroy (server_monitor);
+ }
+
+ /* Wait for SRV polling thread. */
+ if (topology->is_srv_polling) {
+ COMMON_PREFIX (thread_join) (topology->srv_polling_thread);
+ }
+
+ bson_mutex_lock (&topology->mutex);
+ mongoc_set_destroy (topology->server_monitors);
+ mongoc_set_destroy (topology->rtt_monitors);
+ topology->server_monitors = mongoc_set_new (1, NULL, NULL);
+ topology->rtt_monitors = mongoc_set_new (1, NULL, NULL);
+ topology->scanner_state = MONGOC_TOPOLOGY_SCANNER_OFF;
+ mongoc_cond_broadcast (&topology->cond_client);
+}
+
+/* Cancel an in-progress streaming ismaster for a specific server (if
+ * applicable).
+ *
+ * Called from application threads on network errors.
+ * Caller must have topology mutex locked.
+ */
+void
+_mongoc_topology_background_monitoring_cancel_check (
+ mongoc_topology_t *topology, uint32_t server_id)
+{
+ mongoc_server_monitor_t *server_monitor;
+
+ server_monitor = mongoc_set_get (topology->server_monitors, server_id);
+ if (!server_monitor) {
+ /* Already removed. */
+ return;
+ }
+ mongoc_server_monitor_request_cancel (server_monitor);
+}
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-topology-description-apm-private.h b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-topology-description-apm-private.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-topology-description-apm-private.h
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-topology-description-apm-private.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-topology-description-apm.c b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-topology-description-apm.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-topology-description-apm.c
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-topology-description-apm.c
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-topology-description-private.h b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-topology-description-private.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-topology-description-private.h
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-topology-description-private.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-topology-description.c b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-topology-description.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-topology-description.c
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-topology-description.c
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-topology-description.h b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-topology-description.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-topology-description.h
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-topology-description.h
diff --git a/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-topology-private.h b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-topology-private.h
new file mode 100644
index 00000000..6ea365de
--- /dev/null
+++ b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-topology-private.h
@@ -0,0 +1,232 @@
+/*
+ * 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-prelude.h"
+
+#ifndef MONGOC_TOPOLOGY_PRIVATE_H
+#define MONGOC_TOPOLOGY_PRIVATE_H
+
+#include "mongoc-config.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"
+#include "mongoc-client-session-private.h"
+#include "mongoc-crypt-private.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 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
+#define MONGOC_TOPOLOGY_MIN_RESCAN_SRV_INTERVAL_MS 60000
+
+typedef enum {
+ MONGOC_TOPOLOGY_SCANNER_OFF,
+ MONGOC_TOPOLOGY_SCANNER_BG_RUNNING,
+ MONGOC_TOPOLOGY_SCANNER_SHUTTING_DOWN
+} mongoc_topology_scanner_state_t;
+
+struct _mongoc_background_monitor_t;
+struct _mongoc_client_pool_t;
+
+typedef struct _mongoc_topology_t {
+ mongoc_topology_description_t description;
+ /* topology->uri is initialized as a copy of the client/pool's URI.
+ * For a "mongodb+srv://" URI, topology->uri is then updated in
+ * mongoc_topology_new() after initial seedlist discovery.
+ * Afterwards, it remains read-only and may be read outside of the topology
+ * mutex.
+ */
+ 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;
+ /* defaults to 500ms, configurable by tests */
+ int64_t min_heartbeat_frequency_msec;
+
+ /* Minimum of SRV record TTLs, but no lower than 60 seconds.
+ * May be zero for non-SRV/non-MongoS topology. */
+ int64_t srv_polling_rescan_interval_ms;
+ int64_t srv_polling_last_scan_ms;
+ /* For multi-threaded, srv polling occurs in a separate thread. */
+ bson_thread_t srv_polling_thread;
+ mongoc_cond_t srv_polling_cond;
+
+ bson_mutex_t mutex;
+ mongoc_cond_t cond_client;
+ mongoc_topology_scanner_state_t scanner_state;
+
+ bool single_threaded;
+ bool stale;
+
+ mongoc_server_session_t *session_pool;
+
+ /* Is client side encryption enabled? */
+ bool cse_enabled;
+ bool is_srv_polling;
+
+#ifdef MONGOC_ENABLE_CLIENT_SIDE_ENCRYPTION
+ _mongoc_crypt_t *crypt;
+ struct _mongoc_client_t *mongocryptd_client; /* single threaded */
+ struct _mongoc_client_t *keyvault_client; /* single threaded */
+ struct _mongoc_client_pool_t *mongocryptd_client_pool; /* multi threaded */
+ struct _mongoc_client_pool_t *keyvault_client_pool; /* multi threaded */
+ char *keyvault_db;
+ char *keyvault_coll;
+ bool bypass_auto_encryption;
+ bool mongocryptd_bypass_spawn;
+ char *mongocryptd_spawn_path;
+ bson_t *mongocryptd_spawn_args;
+#endif
+
+ /* For background monitoring. */
+ mongoc_set_t *server_monitors;
+ mongoc_set_t *rtt_monitors;
+ bson_mutex_t apm_mutex;
+} 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);
+
+void
+mongoc_topology_reconcile (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);
+
+/* TODO: Try to remove this function when CDRIVER-3654 is complete.
+ * It is only called when an application thread needs to mark a server Unknown.
+ * But an application error is also tied to other behavior, and should also
+ * consider the connection generation. This logic is captured in
+ * _mongoc_topology_handle_app_error. This should not be called directly
+ */
+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);
+
+void
+_mongoc_topology_update_last_used (mongoc_topology_t *topology,
+ uint32_t server_id);
+
+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_set_appname (mongoc_topology_t *topology, const char *appname);
+
+void
+_mongoc_topology_update_cluster_time (mongoc_topology_t *topology,
+ const bson_t *reply);
+
+mongoc_server_session_t *
+_mongoc_topology_pop_server_session (mongoc_topology_t *topology,
+ bson_error_t *error);
+
+void
+_mongoc_topology_push_server_session (mongoc_topology_t *topology,
+ mongoc_server_session_t *server_session);
+
+bool
+_mongoc_topology_end_sessions_cmd (mongoc_topology_t *topology, bson_t *cmd);
+
+void
+_mongoc_topology_clear_session_pool (mongoc_topology_t *topology);
+
+void
+_mongoc_topology_do_blocking_scan (mongoc_topology_t *topology,
+ bson_error_t *error);
+const bson_t *
+_mongoc_topology_get_ismaster (mongoc_topology_t *topology);
+void
+_mongoc_topology_request_scan (mongoc_topology_t *topology);
+
+void
+_mongoc_topology_bypass_cooldown (mongoc_topology_t *topology);
+
+typedef enum {
+ MONGOC_SDAM_APP_ERROR_COMMAND,
+ MONGOC_SDAM_APP_ERROR_NETWORK,
+ MONGOC_SDAM_APP_ERROR_TIMEOUT
+} _mongoc_sdam_app_error_type_t;
+
+bool
+_mongoc_topology_handle_app_error (mongoc_topology_t *topology,
+ uint32_t server_id,
+ bool handshake_complete,
+ _mongoc_sdam_app_error_type_t type,
+ const bson_t *reply,
+ const bson_error_t *why,
+ uint32_t max_wire_version,
+ uint32_t generation);
+
+void
+_mongoc_topology_clear_connection_pool (mongoc_topology_t *topology,
+ uint32_t server_id);
+
+void
+mongoc_topology_rescan_srv (mongoc_topology_t *topology);
+
+bool
+mongoc_topology_should_rescan_srv (mongoc_topology_t *topology);
+#endif
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-topology-scanner-private.h b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-topology-scanner-private.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-topology-scanner-private.h
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-topology-scanner-private.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-topology-scanner.c b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-topology-scanner.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-topology-scanner.c
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-topology-scanner.c
diff --git a/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-topology.c b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-topology.c
new file mode 100644
index 00000000..3b468f7d
--- /dev/null
+++ b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-topology.c
@@ -0,0 +1,1809 @@
+/*
+ * 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-host-list-private.h"
+#include "mongoc-log.h"
+#include "mongoc-topology-private.h"
+#include "mongoc-topology-description-apm-private.h"
+#include "mongoc-client-private.h"
+#include "mongoc-cmd-private.h"
+#include "mongoc-uri-private.h"
+#include "mongoc-util-private.h"
+#include "mongoc-trace-private.h"
+#include "mongoc-error-private.h"
+#include "mongoc-topology-background-monitoring-private.h"
+#include "mongoc-read-prefs-private.h"
+
+#include "utlist.h"
+
+static void
+_topology_collect_errors (mongoc_topology_t *topology, bson_error_t *error_out);
+
+static bool
+_mongoc_topology_reconcile_add_nodes (mongoc_server_description_t *sd,
+ mongoc_topology_t *topology)
+{
+ 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 (scanner, &sd->host, sd->id);
+ mongoc_topology_scanner_scan (scanner, sd->id);
+ }
+
+ return true;
+}
+
+/* Called from:
+ * - the topology scanner callback (when an ismaster was just received)
+ * - at the start of a single-threaded scan (mongoc_topology_scan_once)
+ * Not called for multi threaded monitoring.
+ */
+void
+mongoc_topology_reconcile (mongoc_topology_t *topology)
+{
+ mongoc_topology_description_t *description;
+ mongoc_set_t *servers;
+ mongoc_server_description_t *sd;
+ int i;
+ mongoc_topology_scanner_node_t *ele, *tmp;
+
+ description = &topology->description;
+ servers = description->servers;
+
+ /* Add newly discovered nodes */
+ for (i = 0; i < (int) servers->items_len; i++) {
+ sd = (mongoc_server_description_t *) mongoc_set_get_item (servers, i);
+ _mongoc_topology_reconcile_add_nodes (sd, topology);
+ }
+
+ /* Remove removed nodes */
+ DL_FOREACH_SAFE (topology->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);
+
+ /* 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.
+ * Only called for single-threaded monitoring.
+ *
+ *-------------------------------------------------------------------------
+ */
+
+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;
+ mongoc_server_description_t *sd;
+
+ BSON_ASSERT (data);
+
+ topology = (mongoc_topology_t *) data;
+
+ bson_mutex_lock (&topology->mutex);
+ sd = mongoc_topology_description_server_by_id (
+ &topology->description, id, NULL);
+
+ if (!ismaster_response) {
+ /* Server monitoring: When a server check fails due to a network error
+ * (including a network timeout), the client MUST clear its connection
+ * pool for the server */
+ _mongoc_topology_clear_connection_pool (topology, id);
+ }
+
+ /* Server Discovery and Monitoring Spec: "Once a server is connected, the
+ * client MUST change its type to Unknown only after it has retried the
+ * server once." */
+ if (!ismaster_response && sd && sd->type != MONGOC_SERVER_UNKNOWN) {
+ _mongoc_topology_update_no_lock (
+ id, ismaster_response, rtt_msec, topology, error);
+
+ /* add another ismaster call to the current scan - the scan continues
+ * until all commands are done */
+ mongoc_topology_scanner_scan (topology->scanner, sd->id);
+ } else {
+ _mongoc_topology_update_no_lock (
+ id, ismaster_response, rtt_msec, topology, 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);
+
+ mongoc_cond_broadcast (&topology->cond_client);
+ }
+
+ bson_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;
+ bool topology_valid;
+ mongoc_topology_description_type_t init_type;
+ const char *service;
+ char *prefixed_service;
+ uint32_t id;
+ const mongoc_host_list_t *hl;
+ mongoc_rr_data_t rr_data;
+ bool has_directconnection;
+ bool directconnection;
+
+ BSON_ASSERT (uri);
+ topology_valid = false;
+
+#ifndef MONGOC_ENABLE_CRYPTO
+ if (mongoc_uri_get_option_as_bool (
+ uri, MONGOC_URI_RETRYWRITES, MONGOC_DEFAULT_RETRYWRITES)) {
+ /* retryWrites requires sessions, which require crypto - just warn */
+ MONGOC_WARNING (
+ "retryWrites not supported without an SSL crypto library");
+ }
+#endif
+
+ topology = (mongoc_topology_t *) bson_malloc0 (sizeof *topology);
+ topology->session_pool = NULL;
+ 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, MONGOC_URI_HEARTBEATFREQUENCYMS, heartbeat_default);
+
+ mongoc_topology_description_init (&topology->description, heartbeat);
+
+ topology->description.set_name =
+ bson_strdup (mongoc_uri_get_replica_set (uri));
+
+ topology->uri = mongoc_uri_copy (uri);
+
+ 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, MONGOC_URI_SERVERSELECTIONTRYONCE, true);
+ } else {
+ topology->server_selection_try_once = false;
+ }
+
+ topology->server_selection_timeout_msec = mongoc_uri_get_option_as_int32 (
+ topology->uri,
+ MONGOC_URI_SERVERSELECTIONTIMEOUTMS,
+ MONGOC_TOPOLOGY_SERVER_SELECTION_TIMEOUT_MS);
+
+ /* tests can override this */
+ topology->min_heartbeat_frequency_msec =
+ MONGOC_TOPOLOGY_MIN_HEARTBEAT_FREQUENCY_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,
+ MONGOC_URI_CONNECTTIMEOUTMS,
+ MONGOC_DEFAULT_CONNECTTIMEOUTMS);
+
+ 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->connect_timeout_msec);
+
+ bson_mutex_init (&topology->mutex);
+ mongoc_cond_init (&topology->cond_client);
+
+ if (single_threaded) {
+ /* single threaded drivers attempt speculative authentication during a
+ * topology scan */
+ topology->scanner->speculative_authentication = true;
+
+ /* single threaded clients negotiate sasl supported mechanisms during
+ * a topology scan. */
+ if (_mongoc_uri_requires_auth_negotiation (uri)) {
+ topology->scanner->negotiate_sasl_supported_mechs = true;
+ }
+ }
+
+ service = mongoc_uri_get_service (uri);
+ if (service) {
+ memset (&rr_data, 0, sizeof (mongoc_rr_data_t));
+
+ /* Initialize the last scan time and interval. Even if the initial DNS
+ * lookup fails, SRV polling will still start when background monitoring
+ * starts. */
+ topology->srv_polling_last_scan_ms = bson_get_monotonic_time () / 1000;
+ topology->srv_polling_rescan_interval_ms =
+ MONGOC_TOPOLOGY_MIN_RESCAN_SRV_INTERVAL_MS;
+
+ /* a mongodb+srv URI. try SRV lookup, if no error then also try TXT */
+ prefixed_service = bson_strdup_printf ("_mongodb._tcp.%s", service);
+ if (!_mongoc_client_get_rr (prefixed_service,
+ MONGOC_RR_SRV,
+ &rr_data,
+ MONGOC_RR_DEFAULT_BUFFER_SIZE,
+ &topology->scanner->error)) {
+ GOTO (srv_fail);
+ }
+
+ /* Failure to find TXT records will not return an error (since it is only
+ * for options). But _mongoc_client_get_rr may return an error if
+ * there is more than one TXT record returned. */
+ if (!_mongoc_client_get_rr (service,
+ MONGOC_RR_TXT,
+ &rr_data,
+ MONGOC_RR_DEFAULT_BUFFER_SIZE,
+ &topology->scanner->error)) {
+ GOTO (srv_fail);
+ }
+
+ /* Use rr_data to update the topology's URI. */
+ if (rr_data.txt_record_opts &&
+ !mongoc_uri_parse_options (topology->uri,
+ rr_data.txt_record_opts,
+ true /* from_dns */,
+ &topology->scanner->error)) {
+ GOTO (srv_fail);
+ }
+
+ if (!mongoc_uri_init_with_srv_host_list (
+ topology->uri, rr_data.hosts, &topology->scanner->error)) {
+ GOTO (srv_fail);
+ }
+
+ topology->srv_polling_last_scan_ms = bson_get_monotonic_time () / 1000;
+ topology->srv_polling_rescan_interval_ms = BSON_MAX (
+ rr_data.min_ttl * 1000, MONGOC_TOPOLOGY_MIN_RESCAN_SRV_INTERVAL_MS);
+
+ topology_valid = true;
+ srv_fail:
+ bson_free (rr_data.txt_record_opts);
+ bson_free (prefixed_service);
+ _mongoc_host_list_destroy_all (rr_data.hosts);
+ } else {
+ topology_valid = true;
+ }
+
+ /*
+ * Set topology type from URI:
+ * + if directConnection=true
+ * - whether or not we have a replicaSet name, initialize to SINGLE
+ * (directConnect with SRV or multiple hosts triggers a URI parse error)
+ * + if directConnection=false
+ * - if we've got a replicaSet name, initialize to RS_NO_PRIMARY
+ * - otherwise, initialize to UNKNOWN
+ * + if directConnection was not specified in the URI (old behavior)
+ * - 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
+ */
+ has_directconnection =
+ mongoc_uri_has_option (uri, MONGOC_URI_DIRECTCONNECTION);
+ directconnection =
+ has_directconnection &&
+ mongoc_uri_get_option_as_bool (uri, MONGOC_URI_DIRECTCONNECTION, false);
+ hl = mongoc_uri_get_hosts (topology->uri);
+ if (service && !has_directconnection) {
+ init_type = MONGOC_TOPOLOGY_UNKNOWN;
+ } else if (has_directconnection) {
+ if (directconnection) {
+ init_type = MONGOC_TOPOLOGY_SINGLE;
+ } else {
+ if (mongoc_uri_get_replica_set (topology->uri)) {
+ init_type = MONGOC_TOPOLOGY_RS_NO_PRIMARY;
+ } else {
+ init_type = MONGOC_TOPOLOGY_UNKNOWN;
+ }
+ }
+ } else if (mongoc_uri_get_replica_set (topology->uri)) {
+ init_type = MONGOC_TOPOLOGY_RS_NO_PRIMARY;
+ } else {
+ if (hl && hl->next) {
+ init_type = MONGOC_TOPOLOGY_UNKNOWN;
+ } else {
+ init_type = MONGOC_TOPOLOGY_SINGLE;
+ }
+ }
+
+ topology->description.type = init_type;
+
+ if (!topology->single_threaded) {
+ topology->server_monitors = mongoc_set_new (1, NULL, NULL);
+ topology->rtt_monitors = mongoc_set_new (1, NULL, NULL);
+ bson_mutex_init (&topology->apm_mutex);
+ mongoc_cond_init (&topology->srv_polling_cond);
+ }
+
+ if (!topology_valid) {
+ TRACE ("%s", "topology invalid");
+ /* add no nodes */
+ return topology;
+ }
+
+ while (hl) {
+ mongoc_topology_description_add_server (
+ &topology->description, hl->host_and_port, &id);
+ mongoc_topology_scanner_add (topology->scanner, hl, id);
+
+ hl = hl->next;
+ }
+
+ return topology;
+}
+/*
+ *-------------------------------------------------------------------------
+ *
+ * mongoc_topology_set_apm_callbacks --
+ *
+ * Set Application Performance Monitoring callbacks.
+ *
+ * Caller must hold topology->mutex.
+ *
+ *-------------------------------------------------------------------------
+ */
+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));
+ } else {
+ memset (&topology->description.apm_callbacks,
+ 0,
+ sizeof (mongoc_apm_callbacks_t));
+ memset (
+ &topology->scanner->apm_callbacks, 0, 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;
+ }
+
+#ifdef MONGOC_ENABLE_CLIENT_SIDE_ENCRYPTION
+ bson_free (topology->keyvault_db);
+ bson_free (topology->keyvault_coll);
+ mongoc_client_destroy (topology->mongocryptd_client);
+ mongoc_client_pool_destroy (topology->mongocryptd_client_pool);
+ _mongoc_crypt_destroy (topology->crypt);
+ bson_destroy (topology->mongocryptd_spawn_args);
+ bson_free (topology->mongocryptd_spawn_path);
+#endif
+
+ if (!topology->single_threaded) {
+ bson_mutex_lock (&topology->mutex);
+ _mongoc_topology_background_monitoring_stop (topology);
+ bson_mutex_unlock (&topology->mutex);
+ BSON_ASSERT (topology->scanner_state == MONGOC_TOPOLOGY_SCANNER_OFF);
+ mongoc_set_destroy (topology->server_monitors);
+ mongoc_set_destroy (topology->rtt_monitors);
+ bson_mutex_destroy (&topology->apm_mutex);
+ mongoc_cond_destroy (&topology->srv_polling_cond);
+ }
+ _mongoc_topology_description_monitor_closed (&topology->description);
+
+ mongoc_uri_destroy (topology->uri);
+ mongoc_topology_description_destroy (&topology->description);
+ mongoc_topology_scanner_destroy (topology->scanner);
+
+ /* If we are single-threaded, the client will try to call
+ _mongoc_topology_end_sessions_cmd when it dies. This removes
+ sessions from the pool as it calls endSessions on them. In
+ case this does not succeed, we clear the pool again here. */
+ _mongoc_topology_clear_session_pool (topology);
+
+ mongoc_cond_destroy (&topology->cond_client);
+ bson_mutex_destroy (&topology->mutex);
+
+ bson_free (topology);
+}
+
+/*
+ *--------------------------------------------------------------------------
+ *
+ * _mongoc_topology_clear_session_pool --
+ *
+ * Clears the pool of server sessions without sending endSessions.
+ *
+ * Returns:
+ * Nothing.
+ *
+ * Side effects:
+ * Server session pool will be emptied.
+ *
+ *--------------------------------------------------------------------------
+ */
+
+void
+_mongoc_topology_clear_session_pool (mongoc_topology_t *topology)
+{
+ mongoc_server_session_t *ss, *tmp1, *tmp2;
+
+ CDL_FOREACH_SAFE (topology->session_pool, ss, tmp1, tmp2)
+ {
+ _mongoc_server_session_destroy (ss);
+ }
+ topology->session_pool = NULL;
+}
+
+/* Returns false if none of the hosts were valid. */
+bool
+mongoc_topology_apply_scanned_srv_hosts (mongoc_uri_t *uri,
+ mongoc_topology_description_t *td,
+ mongoc_host_list_t *hosts,
+ bson_error_t *error)
+{
+ mongoc_host_list_t *host;
+ mongoc_host_list_t *valid_hosts = NULL;
+ bool had_valid_hosts = false;
+
+ /* Validate that the hosts have a matching domain.
+ * If validation fails, log it.
+ * If no valid hosts remain, do not update the topology description.
+ */
+ LL_FOREACH (hosts, host)
+ {
+ if (mongoc_uri_validate_srv_result (uri, host->host, error)) {
+ _mongoc_host_list_upsert (&valid_hosts, host);
+ } else {
+ MONGOC_ERROR ("Invalid host returned by SRV: %s", host->host_and_port);
+ /* Continue on, there may still be valid hosts returned. */
+ }
+ }
+
+ if (valid_hosts) {
+ /* Reconcile with the topology description. Newly found servers will start
+ * getting monitored and are eligible to be used by clients. */
+ mongoc_topology_description_reconcile (td, valid_hosts);
+ had_valid_hosts = true;
+ } else {
+ bson_set_error (error,
+ MONGOC_ERROR_STREAM,
+ MONGOC_ERROR_STREAM_NAME_RESOLUTION,
+ "SRV response did not contain any valid hosts");
+ }
+
+ _mongoc_host_list_destroy_all (valid_hosts);
+ return had_valid_hosts;
+}
+
+/*
+ *--------------------------------------------------------------------------
+ *
+ * mongoc_topology_should_rescan_srv --
+ *
+ * Checks whether it is valid to rescan SRV records on the topology.
+ * Namely, that the topology type is Sharded or Unknown, and that
+ * the topology URI was configured with SRV.
+ *
+ * If this returns false, caller can stop scanning SRV records
+ * and does not need to try again in the future.
+ *
+ * NOTE: this method expects @topology's mutex to be locked on entry.
+ *
+ * --------------------------------------------------------------------------
+ */
+bool
+mongoc_topology_should_rescan_srv (mongoc_topology_t *topology) {
+ const char *service;
+
+ service = mongoc_uri_get_service (topology->uri);
+ if (!service) {
+ /* Only rescan if we have a mongodb+srv:// URI. */
+ return false;
+ }
+
+ if ((topology->description.type != MONGOC_TOPOLOGY_SHARDED) &&
+ (topology->description.type != MONGOC_TOPOLOGY_UNKNOWN)) {
+ /* Only perform rescan for sharded topology. */
+ return false;
+ }
+
+ return true;
+}
+
+/*
+ *--------------------------------------------------------------------------
+ *
+ * mongoc_topology_rescan_srv --
+ *
+ * Queries SRV records for new hosts in a mongos cluster.
+ * Caller must call mongoc_topology_should_rescan_srv before calling
+ * to ensure preconditions are met (while holding @topology's mutex
+ * for the duration of both calls).
+ *
+ * NOTE: this method expects @topology's mutex to be locked on entry.
+ *
+ * --------------------------------------------------------------------------
+ */
+void
+mongoc_topology_rescan_srv (mongoc_topology_t *topology)
+{
+ mongoc_rr_data_t rr_data = {0};
+ const char *service;
+ char *prefixed_service = NULL;
+ int64_t scan_time_ms;
+ bool ret;
+
+ BSON_ASSERT (mongoc_topology_should_rescan_srv (topology));
+
+ service = mongoc_uri_get_service (topology->uri);
+ scan_time_ms = topology->srv_polling_last_scan_ms +
+ topology->srv_polling_rescan_interval_ms;
+ if (bson_get_monotonic_time () / 1000 < scan_time_ms) {
+ /* Query SRV no more frequently than srv_polling_rescan_interval_ms. */
+ return;
+ }
+
+ TRACE ("%s", "Polling for SRV records");
+
+ /* Go forth and query... */
+ prefixed_service = bson_strdup_printf ("_mongodb._tcp.%s", service);
+
+ /* Unlock topology mutex during scan so it does not hold up other operations.
+ */
+ bson_mutex_unlock (&topology->mutex);
+ ret = _mongoc_client_get_rr (prefixed_service,
+ MONGOC_RR_SRV,
+ &rr_data,
+ MONGOC_RR_DEFAULT_BUFFER_SIZE,
+ &topology->scanner->error);
+ bson_mutex_lock (&topology->mutex);
+
+ topology->srv_polling_last_scan_ms = bson_get_monotonic_time () / 1000;
+ if (!ret) {
+ /* Failed querying, soldier on and try again next time. */
+ topology->srv_polling_rescan_interval_ms =
+ topology->description.heartbeat_msec;
+ MONGOC_ERROR ("SRV polling error: %s", topology->scanner->error.message);
+ GOTO (done);
+ }
+
+ topology->srv_polling_rescan_interval_ms = BSON_MAX (
+ rr_data.min_ttl * 1000, MONGOC_TOPOLOGY_MIN_RESCAN_SRV_INTERVAL_MS);
+
+ if (!mongoc_topology_apply_scanned_srv_hosts (topology->uri,
+ &topology->description,
+ rr_data.hosts,
+ &topology->scanner->error)) {
+ MONGOC_ERROR ("%s", topology->scanner->error.message);
+ /* Special case when DNS returns zero records successfully or no valid
+ * hosts exist.
+ * Leave the toplogy alone and perform another scan at the next interval
+ * rather than removing all records and having nothing to connect to.
+ * For no verified hosts drivers "MUST temporarily set
+ * srv_polling_rescan_interval_ms
+ * to heartbeatFrequencyMS until at least one verified SRV record is
+ * obtained."
+ */
+ topology->srv_polling_rescan_interval_ms =
+ topology->description.heartbeat_msec;
+ GOTO (done);
+ }
+
+done:
+ bson_free (prefixed_service);
+ _mongoc_host_list_destroy_all (rr_data.hosts);
+}
+
+
+/*
+ *--------------------------------------------------------------------------
+ *
+ * mongoc_topology_scan_once --
+ *
+ * Runs a single complete scan.
+ *
+ * NOTE: this method expects @topology's mutex to be locked on entry.
+ *
+ * NOTE: this method unlocks and re-locks @topology's mutex.
+ *
+ * Only runs for single threaded monitoring. (obey_cooldown is always
+ * true).
+ *
+ *--------------------------------------------------------------------------
+ */
+static void
+mongoc_topology_scan_once (mongoc_topology_t *topology, bool obey_cooldown)
+{
+ if (mongoc_topology_should_rescan_srv (topology)) {
+ /* Prior to scanning hosts, update the list of SRV hosts, if applicable. */
+ mongoc_topology_rescan_srv (topology);
+ }
+
+ /* since the last scan, members may be added or removed from the topology
+ * description based on ismaster responses in connection handshakes, see
+ * _mongoc_topology_update_from_handshake. retire scanner nodes for removed
+ * members and create scanner nodes for new ones. */
+ mongoc_topology_reconcile (topology);
+ mongoc_topology_scanner_start (topology->scanner, obey_cooldown);
+
+ /* scanning locks and unlocks the mutex itself until the scan is done */
+ bson_mutex_unlock (&topology->mutex);
+ mongoc_topology_scanner_work (topology->scanner);
+
+ bson_mutex_lock (&topology->mutex);
+
+ _mongoc_topology_scanner_finish (topology->scanner);
+
+ topology->last_scan = bson_get_monotonic_time ();
+ topology->stale = false;
+}
+
+
+/*
+ *--------------------------------------------------------------------------
+ *
+ * _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.
+ *
+ *--------------------------------------------------------------------------
+ */
+void
+_mongoc_topology_do_blocking_scan (mongoc_topology_t *topology,
+ bson_error_t *error)
+{
+ _mongoc_handshake_freeze ();
+
+ bson_mutex_lock (&topology->mutex);
+ mongoc_topology_scan_once (topology, true /* obey cooldown */);
+ bson_mutex_unlock (&topology->mutex);
+ mongoc_topology_scanner_get_error (topology->scanner, error);
+}
+
+
+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 (td->compatibility_error.code) {
+ if (error) {
+ memcpy (error, &td->compatibility_error, sizeof (bson_error_t));
+ }
+ return false;
+ }
+
+ 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";
+
+ mongoc_topology_scanner_t *ts;
+ 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);
+ ts = topology->scanner;
+
+ bson_mutex_lock (&topology->mutex);
+ /* It isn't strictly necessary to lock here, because if the topology
+ * is invalid, it will never become valid. Lock anyway for consistency. */
+ if (!mongoc_topology_scanner_valid (ts)) {
+ if (error) {
+ mongoc_topology_scanner_get_error (ts, error);
+ error->domain = MONGOC_ERROR_SERVER_SELECTION;
+ error->code = MONGOC_ERROR_SERVER_SELECTION_FAILURE;
+ }
+ bson_mutex_unlock (&topology->mutex);
+ return 0;
+ }
+ bson_mutex_unlock (&topology->mutex);
+
+ 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 +
+ topology->min_heartbeat_frequency_msec * 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);
+
+ return 0;
+ }
+
+ sleep_usec = scan_ready - loop_end;
+ if (sleep_usec > 0) {
+ if (try_once &&
+ mongoc_topology_scanner_in_cooldown (ts, scan_ready)) {
+ _mongoc_server_selection_error (
+ "No servers yet eligible for rescan",
+ &scanner_error,
+ error);
+
+ return 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 (;;) {
+ bson_mutex_lock (&topology->mutex);
+
+ if (!mongoc_topology_compatible (
+ &topology->description, read_prefs, error)) {
+ bson_mutex_unlock (&topology->mutex);
+ return 0;
+ }
+
+ selected_server = mongoc_topology_description_select (
+ &topology->description, optype, read_prefs, local_threshold_ms);
+
+ if (!selected_server) {
+ TRACE (
+ "server selection requesting an immediate scan, want %s",
+ _mongoc_read_mode_as_str (mongoc_read_prefs_get_mode (read_prefs)));
+ _mongoc_topology_request_scan (topology);
+
+ TRACE ("server selection about to wait for %" PRId64 "ms",
+ (expire_at - loop_start) / 1000);
+ r = mongoc_cond_timedwait (&topology->cond_client,
+ &topology->mutex,
+ (expire_at - loop_start) / 1000);
+ TRACE ("%s", "server selection awake");
+ _topology_collect_errors (topology, &scanner_error);
+
+ bson_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;
+ bson_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;
+
+ bson_mutex_lock (&topology->mutex);
+
+ sd = mongoc_server_description_new_copy (
+ mongoc_topology_description_server_by_id (
+ &topology->description, id, error));
+
+ bson_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;
+
+ bson_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));
+ }
+
+ bson_mutex_unlock (&topology->mutex);
+
+ return host;
+}
+
+/*
+
+ * Caller must have topology->mutex locked.
+ *
+ */
+
+void
+_mongoc_topology_request_scan (mongoc_topology_t *topology)
+{
+ _mongoc_topology_background_monitoring_request_scan (topology);
+}
+
+/*
+ *--------------------------------------------------------------------------
+ *
+ * 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);
+
+ bson_mutex_lock (&topology->mutex);
+ mongoc_topology_description_invalidate_server (
+ &topology->description, id, error);
+ bson_mutex_unlock (&topology->mutex);
+}
+
+/*
+ * Update the topology from the response to a handshake on a new application
+ * connection.
+ * Only applicable to a client pool (single-threaded clients reuse monitoring
+ * connections).
+ * Caller must not have the topology->mutex locked.
+ * Locks topology->mutex.
+ * Called only from app threads (not server monitor threads).
+ * 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);
+ BSON_ASSERT (!topology->single_threaded);
+
+ bson_mutex_lock (&topology->mutex);
+
+ /* return false if server was removed from topology */
+ 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);
+ /* Update background monitoring. */
+ _mongoc_topology_background_monitoring_reconcile (topology);
+ bson_mutex_unlock (&topology->mutex);
+
+ return has_server;
+}
+
+/*
+ *--------------------------------------------------------------------------
+ *
+ * _mongoc_topology_update_last_used --
+ *
+ * Internal function. In single-threaded mode only, track when the socket
+ * to a particular server was last used. This is required for
+ * mongoc_cluster_check_interval to know when a socket has been idle.
+ *
+ *--------------------------------------------------------------------------
+ */
+
+void
+_mongoc_topology_update_last_used (mongoc_topology_t *topology,
+ uint32_t server_id)
+{
+ mongoc_topology_scanner_node_t *node;
+
+ if (!topology->single_threaded) {
+ return;
+ }
+
+ node = mongoc_topology_scanner_get_node (topology->scanner, server_id);
+ if (node) {
+ node->last_used = bson_get_monotonic_time ();
+ }
+}
+
+
+/*
+ *--------------------------------------------------------------------------
+ *
+ * _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;
+
+ bson_mutex_lock (&topology->mutex);
+
+ td_type = topology->description.type;
+
+ bson_mutex_unlock (&topology->mutex);
+
+ return td_type;
+}
+
+bool
+_mongoc_topology_set_appname (mongoc_topology_t *topology, const char *appname)
+{
+ bool ret = false;
+ bson_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");
+ }
+ bson_mutex_unlock (&topology->mutex);
+ return ret;
+}
+
+/*
+ *--------------------------------------------------------------------------
+ *
+ * _mongoc_topology_update_cluster_time --
+ *
+ * Internal function. If the server reply has a later $clusterTime than
+ * any seen before, update the topology's clusterTime. See the Driver
+ * Sessions Spec.
+ *
+ *--------------------------------------------------------------------------
+ */
+
+void
+_mongoc_topology_update_cluster_time (mongoc_topology_t *topology,
+ const bson_t *reply)
+{
+ bson_mutex_lock (&topology->mutex);
+ mongoc_topology_description_update_cluster_time (&topology->description,
+ reply);
+ _mongoc_topology_scanner_set_cluster_time (
+ topology->scanner, &topology->description.cluster_time);
+ bson_mutex_unlock (&topology->mutex);
+}
+
+
+/*
+ *--------------------------------------------------------------------------
+ *
+ * _mongoc_topology_pop_server_session --
+ *
+ * Internal function. Get a server session from the pool or create
+ * one. On error, return NULL and fill out @error.
+ *
+ *--------------------------------------------------------------------------
+ */
+
+mongoc_server_session_t *
+_mongoc_topology_pop_server_session (mongoc_topology_t *topology,
+ bson_error_t *error)
+{
+ int64_t timeout;
+ mongoc_server_session_t *ss = NULL;
+ mongoc_topology_description_t *td;
+
+ ENTRY;
+
+ bson_mutex_lock (&topology->mutex);
+
+ td = &topology->description;
+ timeout = td->session_timeout_minutes;
+
+ if (timeout == MONGOC_NO_SESSIONS) {
+ /* if needed, connect and check for session timeout again */
+ if (!mongoc_topology_description_has_data_node (td)) {
+ bson_mutex_unlock (&topology->mutex);
+ if (!mongoc_topology_select_server_id (
+ topology, MONGOC_SS_READ, NULL, error)) {
+ RETURN (NULL);
+ }
+
+ bson_mutex_lock (&topology->mutex);
+ timeout = td->session_timeout_minutes;
+ }
+
+ if (timeout == MONGOC_NO_SESSIONS) {
+ bson_mutex_unlock (&topology->mutex);
+ bson_set_error (error,
+ MONGOC_ERROR_CLIENT,
+ MONGOC_ERROR_CLIENT_SESSION_FAILURE,
+ "Server does not support sessions");
+ RETURN (NULL);
+ }
+ }
+
+ while (topology->session_pool) {
+ ss = topology->session_pool;
+ CDL_DELETE (topology->session_pool, ss);
+ if (_mongoc_server_session_timed_out (ss, timeout)) {
+ _mongoc_server_session_destroy (ss);
+ ss = NULL;
+ } else {
+ break;
+ }
+ }
+
+ bson_mutex_unlock (&topology->mutex);
+
+ if (!ss) {
+ ss = _mongoc_server_session_new (error);
+ }
+
+ RETURN (ss);
+}
+
+/*
+ *--------------------------------------------------------------------------
+ *
+ * _mongoc_topology_push_server_session --
+ *
+ * Internal function. Return a server session to the pool.
+ *
+ *--------------------------------------------------------------------------
+ */
+
+void
+_mongoc_topology_push_server_session (mongoc_topology_t *topology,
+ mongoc_server_session_t *server_session)
+{
+ int64_t timeout;
+ mongoc_server_session_t *ss;
+
+ ENTRY;
+
+ bson_mutex_lock (&topology->mutex);
+
+ timeout = topology->description.session_timeout_minutes;
+
+ /* start at back of queue and reap timed-out sessions */
+ while (topology->session_pool && topology->session_pool->prev) {
+ ss = topology->session_pool->prev;
+ if (_mongoc_server_session_timed_out (ss, timeout)) {
+ BSON_ASSERT (ss->next); /* silences clang scan-build */
+ CDL_DELETE (topology->session_pool, ss);
+ _mongoc_server_session_destroy (ss);
+ } else {
+ /* if ss is not timed out, sessions in front of it are ok too */
+ break;
+ }
+ }
+
+ /* If session is expiring or "dirty" (a network error occurred on it), do not
+ * return it to the pool. */
+ if (_mongoc_server_session_timed_out (server_session, timeout) ||
+ server_session->dirty) {
+ _mongoc_server_session_destroy (server_session);
+ } else {
+ /* silences clang scan-build */
+ BSON_ASSERT (!topology->session_pool || (topology->session_pool->next &&
+ topology->session_pool->prev));
+
+ /* add server session (lsid) to session pool to be reused only if the
+ * server session has been used (the server is aware of the session) */
+ if (server_session->last_used_usec == SESSION_NEVER_USED) {
+ _mongoc_server_session_destroy (server_session);
+ } else {
+ CDL_PREPEND (topology->session_pool, server_session);
+ }
+ }
+
+ bson_mutex_unlock (&topology->mutex);
+
+ EXIT;
+}
+
+
+/*
+ *--------------------------------------------------------------------------
+ *
+ * _mongoc_topology_end_sessions_cmd --
+ *
+ * Internal function. End up to 10,000 server sessions. @cmd is an
+ * uninitialized document. Sessions are destroyed as their ids are
+ * appended to @cmd.
+ *
+ * Driver Sessions Spec: "If the number of sessions is very large the
+ * endSessions command SHOULD be run multiple times to end 10,000
+ * sessions at a time (in order to avoid creating excessively large
+ * commands)."
+ *
+ * Returns:
+ * true if any session ids were appended to @cmd.
+ *
+ *--------------------------------------------------------------------------
+ */
+
+bool
+_mongoc_topology_end_sessions_cmd (mongoc_topology_t *topology, bson_t *cmd)
+{
+ mongoc_server_session_t *ss, *tmp1, *tmp2;
+ char buf[16];
+ const char *key;
+ uint32_t i;
+ bson_t ar;
+
+ bson_init (cmd);
+ BSON_APPEND_ARRAY_BEGIN (cmd, "endSessions", &ar);
+
+ i = 0;
+ CDL_FOREACH_SAFE (topology->session_pool, ss, tmp1, tmp2)
+ {
+ bson_uint32_to_string (i, &key, buf, sizeof buf);
+ BSON_APPEND_DOCUMENT (&ar, key, &ss->lsid);
+ CDL_DELETE (topology->session_pool, ss);
+ _mongoc_server_session_destroy (ss);
+
+ if (++i == 10000) {
+ break;
+ }
+ }
+
+ bson_append_array_end (cmd, &ar);
+
+ return i > 0;
+}
+
+/*
+ *--------------------------------------------------------------------------
+ *
+ * _mongoc_topology_get_ismaster --
+ *
+ * Locks topology->mutex and retrieves (possibly constructing) the
+ * handshake on the topology scanner.
+ *
+ * Returns:
+ * A bson_t representing an ismaster command.
+ *
+ *--------------------------------------------------------------------------
+ */
+const bson_t *
+_mongoc_topology_get_ismaster (mongoc_topology_t *topology)
+{
+ const bson_t *cmd;
+ bson_mutex_lock (&topology->mutex);
+ cmd = _mongoc_topology_scanner_get_ismaster (topology->scanner);
+ bson_mutex_unlock (&topology->mutex);
+ return cmd;
+}
+
+void
+_mongoc_topology_bypass_cooldown (mongoc_topology_t *topology)
+{
+ BSON_ASSERT (topology->single_threaded);
+ topology->scanner->bypass_cooldown = true;
+}
+
+static void
+_find_topology_version (const bson_t *reply, bson_t *topology_version)
+{
+ bson_iter_t iter;
+ const uint8_t *bytes;
+ uint32_t len;
+
+ if (!bson_iter_init_find (&iter, reply, "topologyVersion") ||
+ !BSON_ITER_HOLDS_DOCUMENT (&iter)) {
+ bson_init (topology_version);
+ return;
+ }
+ bson_iter_document (&iter, &len, &bytes);
+ bson_init_static (topology_version, bytes, len);
+}
+
+
+/* "Clears" the connection pool by incrementing the generation.
+ *
+ * Pooled clients with open connections will discover the invalidation
+ * the next time they fetch a stream to the server.
+ *
+ * Caller must lock topology->mutex. */
+void
+_mongoc_topology_clear_connection_pool (mongoc_topology_t *topology,
+ uint32_t server_id)
+{
+ mongoc_server_description_t *sd;
+ bson_error_t error;
+
+ sd = mongoc_topology_description_server_by_id (
+ &topology->description, server_id, &error);
+ if (!sd) {
+ /* Server removed, ignore and ignore error. */
+ return;
+ }
+ TRACE ("clearing pool for server: %s", sd->host.host_and_port);
+ sd->generation++;
+}
+
+
+/* Handle an error from an app connection.
+ *
+ * This can be a network error or "not master" / "node is recovering" error.
+ * Caller must lock topology->mutex.
+ * Returns true if pool was cleared.
+ */
+bool
+_mongoc_topology_handle_app_error (mongoc_topology_t *topology,
+ uint32_t server_id,
+ bool handshake_complete,
+ _mongoc_sdam_app_error_type_t type,
+ const bson_t *reply,
+ const bson_error_t *why,
+ uint32_t max_wire_version,
+ uint32_t generation)
+{
+ bson_error_t server_selection_error;
+ mongoc_server_description_t *sd;
+ bool pool_cleared;
+
+ pool_cleared = false;
+ sd = mongoc_topology_description_server_by_id (
+ &topology->description, server_id, &server_selection_error);
+ if (!sd) {
+ /* The server was already removed from the topology. Ignore error. */
+ return false;
+ }
+
+ if (generation < sd->generation) {
+ /* This is a stale connection. Ignore. */
+ return false;
+ }
+
+ if (type == MONGOC_SDAM_APP_ERROR_NETWORK) {
+ /* Mark server as unknown. */
+ mongoc_topology_description_invalidate_server (
+ &topology->description, server_id, why);
+ _mongoc_topology_clear_connection_pool (topology, server_id);
+ pool_cleared = true;
+ if (!topology->single_threaded) {
+ _mongoc_topology_background_monitoring_cancel_check (topology,
+ server_id);
+ }
+ } else if (type == MONGOC_SDAM_APP_ERROR_TIMEOUT) {
+ if (handshake_complete) {
+ /* Timeout errors after handshake are ok, do nothing. */
+ return false;
+ }
+ /* Mark server as unknown. */
+ mongoc_topology_description_invalidate_server (
+ &topology->description, server_id, why);
+ _mongoc_topology_clear_connection_pool (topology, server_id);
+ pool_cleared = true;
+ if (!topology->single_threaded) {
+ _mongoc_topology_background_monitoring_cancel_check (topology,
+ server_id);
+ }
+ } else if (type == MONGOC_SDAM_APP_ERROR_COMMAND) {
+ bson_error_t cmd_error;
+ bson_t incoming_topology_version;
+
+ if (_mongoc_cmd_check_ok_no_wce (
+ reply, MONGOC_ERROR_API_VERSION_2, &cmd_error)) {
+ /* No error. */
+ return false;
+ }
+
+ if (!_mongoc_error_is_state_change (&cmd_error)) {
+ /* Not a "not master" or "node is recovering" error. */
+ return false;
+ }
+
+ /* Check if the error is "stale", i.e. the topologyVersion refers to an
+ * older
+ * version of the server than we have stored in the topology description.
+ */
+ _find_topology_version (reply, &incoming_topology_version);
+ if (mongoc_server_description_topology_version_cmp (
+ &sd->topology_version, &incoming_topology_version) >= 0) {
+ /* The server description is greater or equal, ignore the error. */
+ bson_destroy (&incoming_topology_version);
+ return false;
+ }
+ /* Overwrite the topology version. */
+ mongoc_server_description_set_topology_version (
+ sd, &incoming_topology_version);
+ bson_destroy (&incoming_topology_version);
+
+ /* SDAM: When handling a "not master" or "node is recovering" error, the
+ * client MUST clear the server's connection pool if and only if the error
+ * is "node is shutting down" or the error originated from server version
+ * < 4.2.
+ */
+ if (max_wire_version <= WIRE_VERSION_4_0 ||
+ _mongoc_error_is_shutdown (&cmd_error)) {
+ _mongoc_topology_clear_connection_pool (topology, server_id);
+ pool_cleared = true;
+ }
+
+ /* SDAM: When the client sees a "not master" or "node is recovering" error
+ * and the error's topologyVersion is strictly greater than the current
+ * ServerDescription's topologyVersion it MUST replace the server's
+ * description with a ServerDescription of type Unknown. */
+ mongoc_topology_description_invalidate_server (
+ &topology->description, server_id, &cmd_error);
+
+ if (topology->single_threaded) {
+ /* SDAM: For single-threaded clients, in the case of a "not master" or
+ * "node is shutting down" error, the client MUST mark the topology as
+ * "stale"
+ */
+ if (_mongoc_error_is_not_master (&cmd_error)) {
+ topology->stale = true;
+ }
+ } else {
+ /* SDAM Spec: "Multi-threaded and asynchronous clients MUST request an
+ * immediate check of the server."
+ * Instead of requesting a check of the one server, request a scan
+ * to all servers (to find the new primary).
+ */
+ _mongoc_topology_request_scan (topology);
+ }
+ }
+ return pool_cleared;
+}
+
+/* Called from application threads
+ * Caller must hold topology lock.
+ * Locks topology description mutex to copy out server description errors.
+ * For single-threaded monitoring, the topology scanner may include errors for
+ * servers that were removed from the topology.
+ */
+static void
+_topology_collect_errors (mongoc_topology_t *topology, bson_error_t *error_out)
+{
+ mongoc_topology_description_t *topology_description;
+ mongoc_server_description_t *server_description;
+ bson_string_t *error_message;
+ int i;
+
+ topology_description = &topology->description;
+ memset (error_out, 0, sizeof (bson_error_t));
+ error_message = bson_string_new ("");
+
+ for (i = 0; i < topology_description->servers->items_len; i++) {
+ bson_error_t *error;
+
+ server_description = topology_description->servers->items[i].item;
+ error = &server_description->error;
+ if (error->code) {
+ if (error_message->len > 0) {
+ bson_string_append_c (error_message, ' ');
+ }
+ bson_string_append_printf (
+ error_message, "[%s]", server_description->error.message);
+ /* The last error's code and domain wins. */
+ error_out->code = error->code;
+ error_out->domain = error->domain;
+ }
+ }
+
+ bson_strncpy ((char *) &error_out->message,
+ error_message->str,
+ sizeof (error_out->message));
+ bson_string_free (error_message, true);
+}
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-trace-private.h b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-trace-private.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-trace-private.h
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-trace-private.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-uri-private.h b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-uri-private.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-uri-private.h
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-uri-private.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-uri.c b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-uri.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-uri.c
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-uri.c
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-uri.h b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-uri.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-uri.h
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-uri.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-util-private.h b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-util-private.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-util-private.h
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-util-private.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-util.c b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-util.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-util.c
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-util.c
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-version-functions.c b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-version-functions.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-version-functions.c
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-version-functions.c
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-version-functions.h b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-version-functions.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-version-functions.h
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-version-functions.h
diff --git a/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-version.h b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-version.h
new file mode 100644
index 00000000..c8735794
--- /dev/null
+++ b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-version.h
@@ -0,0 +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/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 (17)
+
+
+/**
+ * MONGOC_MICRO_VERSION:
+ *
+ * MONGOC micro version component (e.g. 3 if %MONGOC_VERSION is 1.2.3)
+ */
+#define MONGOC_MICRO_VERSION (2)
+
+
+/**
+ * MONGOC_PRERELEASE_VERSION:
+ *
+ * MONGOC prerelease version component (e.g. pre if %MONGOC_VERSION is 1.2.3-pre)
+ */
+#define MONGOC_PRERELEASE_VERSION ()
+
+
+/**
+ * MONGOC_VERSION:
+ *
+ * MONGOC version.
+ */
+#define MONGOC_VERSION (1.17.2)
+
+
+/**
+ * MONGOC_VERSION_S:
+ *
+ * MONGOC version, encoded as a string, useful for printing and
+ * concatenation.
+ */
+#define MONGOC_VERSION_S "1.17.2"
+
+
+/**
+ * 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.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-version.h.in b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-version.h.in
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-version.h.in
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-version.h.in
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-write-command-legacy-private.h b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-write-command-legacy-private.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-write-command-legacy-private.h
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-write-command-legacy-private.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-write-command-legacy.c b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-write-command-legacy.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-write-command-legacy.c
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-write-command-legacy.c
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-write-command-private.h b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-write-command-private.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-write-command-private.h
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-write-command-private.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-write-command.c b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-write-command.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-write-command.c
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-write-command.c
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-write-concern-private.h b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-write-concern-private.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-write-concern-private.h
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-write-concern-private.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-write-concern.c b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-write-concern.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-write-concern.c
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-write-concern.c
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-write-concern.h b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-write-concern.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc-write-concern.h
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc-write-concern.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc.h b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/mongoc.h
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/mongoc.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/op-compressed.def b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/op-compressed.def
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/op-compressed.def
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/op-compressed.def
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/op-delete.def b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/op-delete.def
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/op-delete.def
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/op-delete.def
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/op-get-more.def b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/op-get-more.def
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/op-get-more.def
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/op-get-more.def
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/op-header.def b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/op-header.def
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/op-header.def
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/op-header.def
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/op-insert.def b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/op-insert.def
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/op-insert.def
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/op-insert.def
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/op-kill-cursors.def b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/op-kill-cursors.def
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/op-kill-cursors.def
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/op-kill-cursors.def
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/op-msg.def b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/op-msg.def
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/op-msg.def
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/op-msg.def
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/op-query.def b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/op-query.def
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/op-query.def
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/op-query.def
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/op-reply-header.def b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/op-reply-header.def
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/op-reply-header.def
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/op-reply-header.def
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/op-reply.def b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/op-reply.def
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/op-reply.def
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/op-reply.def
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/op-update.def b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/op-update.def
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/op-update.def
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/op-update.def
diff --git a/mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/utlist.h b/mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/utlist.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/libmongoc/src/mongoc/utlist.h
rename to mongodb-1.9.0/src/libmongoc/src/libmongoc/src/mongoc/utlist.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/zlib-1.2.11/adler32.c b/mongodb-1.9.0/src/libmongoc/src/zlib-1.2.11/adler32.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/zlib-1.2.11/adler32.c
rename to mongodb-1.9.0/src/libmongoc/src/zlib-1.2.11/adler32.c
diff --git a/mongodb-1.8.1/src/libmongoc/src/zlib-1.2.11/compress.c b/mongodb-1.9.0/src/libmongoc/src/zlib-1.2.11/compress.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/zlib-1.2.11/compress.c
rename to mongodb-1.9.0/src/libmongoc/src/zlib-1.2.11/compress.c
diff --git a/mongodb-1.8.1/src/libmongoc/src/zlib-1.2.11/crc32.c b/mongodb-1.9.0/src/libmongoc/src/zlib-1.2.11/crc32.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/zlib-1.2.11/crc32.c
rename to mongodb-1.9.0/src/libmongoc/src/zlib-1.2.11/crc32.c
diff --git a/mongodb-1.8.1/src/libmongoc/src/zlib-1.2.11/crc32.h b/mongodb-1.9.0/src/libmongoc/src/zlib-1.2.11/crc32.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/zlib-1.2.11/crc32.h
rename to mongodb-1.9.0/src/libmongoc/src/zlib-1.2.11/crc32.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/zlib-1.2.11/deflate.c b/mongodb-1.9.0/src/libmongoc/src/zlib-1.2.11/deflate.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/zlib-1.2.11/deflate.c
rename to mongodb-1.9.0/src/libmongoc/src/zlib-1.2.11/deflate.c
diff --git a/mongodb-1.8.1/src/libmongoc/src/zlib-1.2.11/deflate.h b/mongodb-1.9.0/src/libmongoc/src/zlib-1.2.11/deflate.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/zlib-1.2.11/deflate.h
rename to mongodb-1.9.0/src/libmongoc/src/zlib-1.2.11/deflate.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/zlib-1.2.11/gzclose.c b/mongodb-1.9.0/src/libmongoc/src/zlib-1.2.11/gzclose.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/zlib-1.2.11/gzclose.c
rename to mongodb-1.9.0/src/libmongoc/src/zlib-1.2.11/gzclose.c
diff --git a/mongodb-1.8.1/src/libmongoc/src/zlib-1.2.11/gzguts.h b/mongodb-1.9.0/src/libmongoc/src/zlib-1.2.11/gzguts.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/zlib-1.2.11/gzguts.h
rename to mongodb-1.9.0/src/libmongoc/src/zlib-1.2.11/gzguts.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/zlib-1.2.11/gzlib.c b/mongodb-1.9.0/src/libmongoc/src/zlib-1.2.11/gzlib.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/zlib-1.2.11/gzlib.c
rename to mongodb-1.9.0/src/libmongoc/src/zlib-1.2.11/gzlib.c
diff --git a/mongodb-1.8.1/src/libmongoc/src/zlib-1.2.11/gzread.c b/mongodb-1.9.0/src/libmongoc/src/zlib-1.2.11/gzread.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/zlib-1.2.11/gzread.c
rename to mongodb-1.9.0/src/libmongoc/src/zlib-1.2.11/gzread.c
diff --git a/mongodb-1.8.1/src/libmongoc/src/zlib-1.2.11/gzwrite.c b/mongodb-1.9.0/src/libmongoc/src/zlib-1.2.11/gzwrite.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/zlib-1.2.11/gzwrite.c
rename to mongodb-1.9.0/src/libmongoc/src/zlib-1.2.11/gzwrite.c
diff --git a/mongodb-1.8.1/src/libmongoc/src/zlib-1.2.11/infback.c b/mongodb-1.9.0/src/libmongoc/src/zlib-1.2.11/infback.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/zlib-1.2.11/infback.c
rename to mongodb-1.9.0/src/libmongoc/src/zlib-1.2.11/infback.c
diff --git a/mongodb-1.8.1/src/libmongoc/src/zlib-1.2.11/inffast.c b/mongodb-1.9.0/src/libmongoc/src/zlib-1.2.11/inffast.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/zlib-1.2.11/inffast.c
rename to mongodb-1.9.0/src/libmongoc/src/zlib-1.2.11/inffast.c
diff --git a/mongodb-1.8.1/src/libmongoc/src/zlib-1.2.11/inffast.h b/mongodb-1.9.0/src/libmongoc/src/zlib-1.2.11/inffast.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/zlib-1.2.11/inffast.h
rename to mongodb-1.9.0/src/libmongoc/src/zlib-1.2.11/inffast.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/zlib-1.2.11/inffixed.h b/mongodb-1.9.0/src/libmongoc/src/zlib-1.2.11/inffixed.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/zlib-1.2.11/inffixed.h
rename to mongodb-1.9.0/src/libmongoc/src/zlib-1.2.11/inffixed.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/zlib-1.2.11/inflate.c b/mongodb-1.9.0/src/libmongoc/src/zlib-1.2.11/inflate.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/zlib-1.2.11/inflate.c
rename to mongodb-1.9.0/src/libmongoc/src/zlib-1.2.11/inflate.c
diff --git a/mongodb-1.8.1/src/libmongoc/src/zlib-1.2.11/inflate.h b/mongodb-1.9.0/src/libmongoc/src/zlib-1.2.11/inflate.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/zlib-1.2.11/inflate.h
rename to mongodb-1.9.0/src/libmongoc/src/zlib-1.2.11/inflate.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/zlib-1.2.11/inftrees.c b/mongodb-1.9.0/src/libmongoc/src/zlib-1.2.11/inftrees.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/zlib-1.2.11/inftrees.c
rename to mongodb-1.9.0/src/libmongoc/src/zlib-1.2.11/inftrees.c
diff --git a/mongodb-1.8.1/src/libmongoc/src/zlib-1.2.11/inftrees.h b/mongodb-1.9.0/src/libmongoc/src/zlib-1.2.11/inftrees.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/zlib-1.2.11/inftrees.h
rename to mongodb-1.9.0/src/libmongoc/src/zlib-1.2.11/inftrees.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/zlib-1.2.11/trees.c b/mongodb-1.9.0/src/libmongoc/src/zlib-1.2.11/trees.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/zlib-1.2.11/trees.c
rename to mongodb-1.9.0/src/libmongoc/src/zlib-1.2.11/trees.c
diff --git a/mongodb-1.8.1/src/libmongoc/src/zlib-1.2.11/trees.h b/mongodb-1.9.0/src/libmongoc/src/zlib-1.2.11/trees.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/zlib-1.2.11/trees.h
rename to mongodb-1.9.0/src/libmongoc/src/zlib-1.2.11/trees.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/zlib-1.2.11/uncompr.c b/mongodb-1.9.0/src/libmongoc/src/zlib-1.2.11/uncompr.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/zlib-1.2.11/uncompr.c
rename to mongodb-1.9.0/src/libmongoc/src/zlib-1.2.11/uncompr.c
diff --git a/mongodb-1.8.1/src/libmongoc/src/zlib-1.2.11/zconf.h b/mongodb-1.9.0/src/libmongoc/src/zlib-1.2.11/zconf.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/zlib-1.2.11/zconf.h
rename to mongodb-1.9.0/src/libmongoc/src/zlib-1.2.11/zconf.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/zlib-1.2.11/zconf.h.in b/mongodb-1.9.0/src/libmongoc/src/zlib-1.2.11/zconf.h.in
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/zlib-1.2.11/zconf.h.in
rename to mongodb-1.9.0/src/libmongoc/src/zlib-1.2.11/zconf.h.in
diff --git a/mongodb-1.8.1/src/libmongoc/src/zlib-1.2.11/zlib.h b/mongodb-1.9.0/src/libmongoc/src/zlib-1.2.11/zlib.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/zlib-1.2.11/zlib.h
rename to mongodb-1.9.0/src/libmongoc/src/zlib-1.2.11/zlib.h
diff --git a/mongodb-1.8.1/src/libmongoc/src/zlib-1.2.11/zutil.c b/mongodb-1.9.0/src/libmongoc/src/zlib-1.2.11/zutil.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/zlib-1.2.11/zutil.c
rename to mongodb-1.9.0/src/libmongoc/src/zlib-1.2.11/zutil.c
diff --git a/mongodb-1.8.1/src/libmongoc/src/zlib-1.2.11/zutil.h b/mongodb-1.9.0/src/libmongoc/src/zlib-1.2.11/zutil.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongoc/src/zlib-1.2.11/zutil.h
rename to mongodb-1.9.0/src/libmongoc/src/zlib-1.2.11/zutil.h
diff --git a/mongodb-1.8.1/src/libmongocrypt-compat/mongocrypt-export.h b/mongodb-1.9.0/src/libmongocrypt-compat/mongocrypt-export.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongocrypt-compat/mongocrypt-export.h
rename to mongodb-1.9.0/src/libmongocrypt-compat/mongocrypt-export.h
diff --git a/mongodb-1.8.1/src/libmongocrypt-compat/mongocrypt/mongocrypt.h b/mongodb-1.9.0/src/libmongocrypt-compat/mongocrypt/mongocrypt.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongocrypt-compat/mongocrypt/mongocrypt.h
rename to mongodb-1.9.0/src/libmongocrypt-compat/mongocrypt/mongocrypt.h
diff --git a/mongodb-1.8.1/src/libmongocrypt/kms-message/src/hexlify.c b/mongodb-1.9.0/src/libmongocrypt/kms-message/src/hexlify.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongocrypt/kms-message/src/hexlify.c
rename to mongodb-1.9.0/src/libmongocrypt/kms-message/src/hexlify.c
diff --git a/mongodb-1.8.1/src/libmongocrypt/kms-message/src/hexlify.h b/mongodb-1.9.0/src/libmongocrypt/kms-message/src/hexlify.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongocrypt/kms-message/src/hexlify.h
rename to mongodb-1.9.0/src/libmongocrypt/kms-message/src/hexlify.h
diff --git a/mongodb-1.8.1/src/libmongocrypt/kms-message/src/kms_b64.c b/mongodb-1.9.0/src/libmongocrypt/kms-message/src/kms_b64.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongocrypt/kms-message/src/kms_b64.c
rename to mongodb-1.9.0/src/libmongocrypt/kms-message/src/kms_b64.c
diff --git a/mongodb-1.8.1/src/libmongocrypt/kms-message/src/kms_caller_identity_request.c b/mongodb-1.9.0/src/libmongocrypt/kms-message/src/kms_caller_identity_request.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongocrypt/kms-message/src/kms_caller_identity_request.c
rename to mongodb-1.9.0/src/libmongocrypt/kms-message/src/kms_caller_identity_request.c
diff --git a/mongodb-1.8.1/src/libmongocrypt/kms-message/src/kms_crypto.h b/mongodb-1.9.0/src/libmongocrypt/kms-message/src/kms_crypto.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongocrypt/kms-message/src/kms_crypto.h
rename to mongodb-1.9.0/src/libmongocrypt/kms-message/src/kms_crypto.h
diff --git a/mongodb-1.8.1/src/libmongocrypt/kms-message/src/kms_crypto_apple.c b/mongodb-1.9.0/src/libmongocrypt/kms-message/src/kms_crypto_apple.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongocrypt/kms-message/src/kms_crypto_apple.c
rename to mongodb-1.9.0/src/libmongocrypt/kms-message/src/kms_crypto_apple.c
diff --git a/mongodb-1.8.1/src/libmongocrypt/kms-message/src/kms_crypto_libcrypto.c b/mongodb-1.9.0/src/libmongocrypt/kms-message/src/kms_crypto_libcrypto.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongocrypt/kms-message/src/kms_crypto_libcrypto.c
rename to mongodb-1.9.0/src/libmongocrypt/kms-message/src/kms_crypto_libcrypto.c
diff --git a/mongodb-1.8.1/src/libmongocrypt/kms-message/src/kms_crypto_none.c b/mongodb-1.9.0/src/libmongocrypt/kms-message/src/kms_crypto_none.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongocrypt/kms-message/src/kms_crypto_none.c
rename to mongodb-1.9.0/src/libmongocrypt/kms-message/src/kms_crypto_none.c
diff --git a/mongodb-1.8.1/src/libmongocrypt/kms-message/src/kms_crypto_windows.c b/mongodb-1.9.0/src/libmongocrypt/kms-message/src/kms_crypto_windows.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongocrypt/kms-message/src/kms_crypto_windows.c
rename to mongodb-1.9.0/src/libmongocrypt/kms-message/src/kms_crypto_windows.c
diff --git a/mongodb-1.8.1/src/libmongocrypt/kms-message/src/kms_decrypt_request.c b/mongodb-1.9.0/src/libmongocrypt/kms-message/src/kms_decrypt_request.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongocrypt/kms-message/src/kms_decrypt_request.c
rename to mongodb-1.9.0/src/libmongocrypt/kms-message/src/kms_decrypt_request.c
diff --git a/mongodb-1.8.1/src/libmongocrypt/kms-message/src/kms_encrypt_request.c b/mongodb-1.9.0/src/libmongocrypt/kms-message/src/kms_encrypt_request.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongocrypt/kms-message/src/kms_encrypt_request.c
rename to mongodb-1.9.0/src/libmongocrypt/kms-message/src/kms_encrypt_request.c
diff --git a/mongodb-1.8.1/src/libmongocrypt/kms-message/src/kms_kv_list.c b/mongodb-1.9.0/src/libmongocrypt/kms-message/src/kms_kv_list.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongocrypt/kms-message/src/kms_kv_list.c
rename to mongodb-1.9.0/src/libmongocrypt/kms-message/src/kms_kv_list.c
diff --git a/mongodb-1.8.1/src/libmongocrypt/kms-message/src/kms_kv_list.h b/mongodb-1.9.0/src/libmongocrypt/kms-message/src/kms_kv_list.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongocrypt/kms-message/src/kms_kv_list.h
rename to mongodb-1.9.0/src/libmongocrypt/kms-message/src/kms_kv_list.h
diff --git a/mongodb-1.8.1/src/libmongocrypt/kms-message/src/kms_message.c b/mongodb-1.9.0/src/libmongocrypt/kms-message/src/kms_message.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongocrypt/kms-message/src/kms_message.c
rename to mongodb-1.9.0/src/libmongocrypt/kms-message/src/kms_message.c
diff --git a/mongodb-1.8.1/src/libmongocrypt/kms-message/src/kms_message/kms_b64.h b/mongodb-1.9.0/src/libmongocrypt/kms-message/src/kms_message/kms_b64.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongocrypt/kms-message/src/kms_message/kms_b64.h
rename to mongodb-1.9.0/src/libmongocrypt/kms-message/src/kms_message/kms_b64.h
diff --git a/mongodb-1.8.1/src/libmongocrypt/kms-message/src/kms_message/kms_caller_identity_request.h b/mongodb-1.9.0/src/libmongocrypt/kms-message/src/kms_message/kms_caller_identity_request.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongocrypt/kms-message/src/kms_message/kms_caller_identity_request.h
rename to mongodb-1.9.0/src/libmongocrypt/kms-message/src/kms_message/kms_caller_identity_request.h
diff --git a/mongodb-1.8.1/src/libmongocrypt/kms-message/src/kms_message/kms_decrypt_request.h b/mongodb-1.9.0/src/libmongocrypt/kms-message/src/kms_message/kms_decrypt_request.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongocrypt/kms-message/src/kms_message/kms_decrypt_request.h
rename to mongodb-1.9.0/src/libmongocrypt/kms-message/src/kms_message/kms_decrypt_request.h
diff --git a/mongodb-1.8.1/src/libmongocrypt/kms-message/src/kms_message/kms_encrypt_request.h b/mongodb-1.9.0/src/libmongocrypt/kms-message/src/kms_message/kms_encrypt_request.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongocrypt/kms-message/src/kms_message/kms_encrypt_request.h
rename to mongodb-1.9.0/src/libmongocrypt/kms-message/src/kms_message/kms_encrypt_request.h
diff --git a/mongodb-1.8.1/src/libmongocrypt/kms-message/src/kms_message/kms_message.h b/mongodb-1.9.0/src/libmongocrypt/kms-message/src/kms_message/kms_message.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongocrypt/kms-message/src/kms_message/kms_message.h
rename to mongodb-1.9.0/src/libmongocrypt/kms-message/src/kms_message/kms_message.h
diff --git a/mongodb-1.8.1/src/libmongocrypt/kms-message/src/kms_message/kms_message_defines.h b/mongodb-1.9.0/src/libmongocrypt/kms-message/src/kms_message/kms_message_defines.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongocrypt/kms-message/src/kms_message/kms_message_defines.h
rename to mongodb-1.9.0/src/libmongocrypt/kms-message/src/kms_message/kms_message_defines.h
diff --git a/mongodb-1.8.1/src/libmongocrypt/kms-message/src/kms_message/kms_request.h b/mongodb-1.9.0/src/libmongocrypt/kms-message/src/kms_message/kms_request.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongocrypt/kms-message/src/kms_message/kms_request.h
rename to mongodb-1.9.0/src/libmongocrypt/kms-message/src/kms_message/kms_request.h
diff --git a/mongodb-1.8.1/src/libmongocrypt/kms-message/src/kms_message/kms_request_opt.h b/mongodb-1.9.0/src/libmongocrypt/kms-message/src/kms_message/kms_request_opt.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongocrypt/kms-message/src/kms_message/kms_request_opt.h
rename to mongodb-1.9.0/src/libmongocrypt/kms-message/src/kms_message/kms_request_opt.h
diff --git a/mongodb-1.8.1/src/libmongocrypt/kms-message/src/kms_message/kms_response.h b/mongodb-1.9.0/src/libmongocrypt/kms-message/src/kms_message/kms_response.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongocrypt/kms-message/src/kms_message/kms_response.h
rename to mongodb-1.9.0/src/libmongocrypt/kms-message/src/kms_message/kms_response.h
diff --git a/mongodb-1.8.1/src/libmongocrypt/kms-message/src/kms_message/kms_response_parser.h b/mongodb-1.9.0/src/libmongocrypt/kms-message/src/kms_message/kms_response_parser.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongocrypt/kms-message/src/kms_message/kms_response_parser.h
rename to mongodb-1.9.0/src/libmongocrypt/kms-message/src/kms_message/kms_response_parser.h
diff --git a/mongodb-1.8.1/src/libmongocrypt/kms-message/src/kms_message_private.h b/mongodb-1.9.0/src/libmongocrypt/kms-message/src/kms_message_private.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongocrypt/kms-message/src/kms_message_private.h
rename to mongodb-1.9.0/src/libmongocrypt/kms-message/src/kms_message_private.h
diff --git a/mongodb-1.8.1/src/libmongocrypt/kms-message/src/kms_port.c b/mongodb-1.9.0/src/libmongocrypt/kms-message/src/kms_port.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongocrypt/kms-message/src/kms_port.c
rename to mongodb-1.9.0/src/libmongocrypt/kms-message/src/kms_port.c
diff --git a/mongodb-1.8.1/src/libmongocrypt/kms-message/src/kms_port.h b/mongodb-1.9.0/src/libmongocrypt/kms-message/src/kms_port.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongocrypt/kms-message/src/kms_port.h
rename to mongodb-1.9.0/src/libmongocrypt/kms-message/src/kms_port.h
diff --git a/mongodb-1.8.1/src/libmongocrypt/kms-message/src/kms_request.c b/mongodb-1.9.0/src/libmongocrypt/kms-message/src/kms_request.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongocrypt/kms-message/src/kms_request.c
rename to mongodb-1.9.0/src/libmongocrypt/kms-message/src/kms_request.c
diff --git a/mongodb-1.8.1/src/libmongocrypt/kms-message/src/kms_request_opt.c b/mongodb-1.9.0/src/libmongocrypt/kms-message/src/kms_request_opt.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongocrypt/kms-message/src/kms_request_opt.c
rename to mongodb-1.9.0/src/libmongocrypt/kms-message/src/kms_request_opt.c
diff --git a/mongodb-1.8.1/src/libmongocrypt/kms-message/src/kms_request_opt_private.h b/mongodb-1.9.0/src/libmongocrypt/kms-message/src/kms_request_opt_private.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongocrypt/kms-message/src/kms_request_opt_private.h
rename to mongodb-1.9.0/src/libmongocrypt/kms-message/src/kms_request_opt_private.h
diff --git a/mongodb-1.8.1/src/libmongocrypt/kms-message/src/kms_request_str.c b/mongodb-1.9.0/src/libmongocrypt/kms-message/src/kms_request_str.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongocrypt/kms-message/src/kms_request_str.c
rename to mongodb-1.9.0/src/libmongocrypt/kms-message/src/kms_request_str.c
diff --git a/mongodb-1.8.1/src/libmongocrypt/kms-message/src/kms_request_str.h b/mongodb-1.9.0/src/libmongocrypt/kms-message/src/kms_request_str.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongocrypt/kms-message/src/kms_request_str.h
rename to mongodb-1.9.0/src/libmongocrypt/kms-message/src/kms_request_str.h
diff --git a/mongodb-1.8.1/src/libmongocrypt/kms-message/src/kms_response.c b/mongodb-1.9.0/src/libmongocrypt/kms-message/src/kms_response.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongocrypt/kms-message/src/kms_response.c
rename to mongodb-1.9.0/src/libmongocrypt/kms-message/src/kms_response.c
diff --git a/mongodb-1.8.1/src/libmongocrypt/kms-message/src/kms_response_parser.c b/mongodb-1.9.0/src/libmongocrypt/kms-message/src/kms_response_parser.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongocrypt/kms-message/src/kms_response_parser.c
rename to mongodb-1.9.0/src/libmongocrypt/kms-message/src/kms_response_parser.c
diff --git a/mongodb-1.8.1/src/libmongocrypt/kms-message/src/sort.c b/mongodb-1.9.0/src/libmongocrypt/kms-message/src/sort.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongocrypt/kms-message/src/sort.c
rename to mongodb-1.9.0/src/libmongocrypt/kms-message/src/sort.c
diff --git a/mongodb-1.8.1/src/libmongocrypt/kms-message/src/sort.h b/mongodb-1.9.0/src/libmongocrypt/kms-message/src/sort.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongocrypt/kms-message/src/sort.h
rename to mongodb-1.9.0/src/libmongocrypt/kms-message/src/sort.h
diff --git a/mongodb-1.8.1/src/libmongocrypt/src/crypto/cng.c b/mongodb-1.9.0/src/libmongocrypt/src/crypto/cng.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongocrypt/src/crypto/cng.c
rename to mongodb-1.9.0/src/libmongocrypt/src/crypto/cng.c
diff --git a/mongodb-1.8.1/src/libmongocrypt/src/crypto/commoncrypto.c b/mongodb-1.9.0/src/libmongocrypt/src/crypto/commoncrypto.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongocrypt/src/crypto/commoncrypto.c
rename to mongodb-1.9.0/src/libmongocrypt/src/crypto/commoncrypto.c
diff --git a/mongodb-1.8.1/src/libmongocrypt/src/crypto/libcrypto.c b/mongodb-1.9.0/src/libmongocrypt/src/crypto/libcrypto.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongocrypt/src/crypto/libcrypto.c
rename to mongodb-1.9.0/src/libmongocrypt/src/crypto/libcrypto.c
diff --git a/mongodb-1.8.1/src/libmongocrypt/src/crypto/none.c b/mongodb-1.9.0/src/libmongocrypt/src/crypto/none.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongocrypt/src/crypto/none.c
rename to mongodb-1.9.0/src/libmongocrypt/src/crypto/none.c
diff --git a/mongodb-1.8.1/src/libmongocrypt/src/mongocrypt-binary-private.h b/mongodb-1.9.0/src/libmongocrypt/src/mongocrypt-binary-private.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongocrypt/src/mongocrypt-binary-private.h
rename to mongodb-1.9.0/src/libmongocrypt/src/mongocrypt-binary-private.h
diff --git a/mongodb-1.8.1/src/libmongocrypt/src/mongocrypt-binary.c b/mongodb-1.9.0/src/libmongocrypt/src/mongocrypt-binary.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongocrypt/src/mongocrypt-binary.c
rename to mongodb-1.9.0/src/libmongocrypt/src/mongocrypt-binary.c
diff --git a/mongodb-1.8.1/src/libmongocrypt/src/mongocrypt-buffer-private.h b/mongodb-1.9.0/src/libmongocrypt/src/mongocrypt-buffer-private.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongocrypt/src/mongocrypt-buffer-private.h
rename to mongodb-1.9.0/src/libmongocrypt/src/mongocrypt-buffer-private.h
diff --git a/mongodb-1.8.1/src/libmongocrypt/src/mongocrypt-buffer.c b/mongodb-1.9.0/src/libmongocrypt/src/mongocrypt-buffer.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongocrypt/src/mongocrypt-buffer.c
rename to mongodb-1.9.0/src/libmongocrypt/src/mongocrypt-buffer.c
diff --git a/mongodb-1.8.1/src/libmongocrypt/src/mongocrypt-cache-collinfo-private.h b/mongodb-1.9.0/src/libmongocrypt/src/mongocrypt-cache-collinfo-private.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongocrypt/src/mongocrypt-cache-collinfo-private.h
rename to mongodb-1.9.0/src/libmongocrypt/src/mongocrypt-cache-collinfo-private.h
diff --git a/mongodb-1.8.1/src/libmongocrypt/src/mongocrypt-cache-collinfo.c b/mongodb-1.9.0/src/libmongocrypt/src/mongocrypt-cache-collinfo.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongocrypt/src/mongocrypt-cache-collinfo.c
rename to mongodb-1.9.0/src/libmongocrypt/src/mongocrypt-cache-collinfo.c
diff --git a/mongodb-1.8.1/src/libmongocrypt/src/mongocrypt-cache-key-private.h b/mongodb-1.9.0/src/libmongocrypt/src/mongocrypt-cache-key-private.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongocrypt/src/mongocrypt-cache-key-private.h
rename to mongodb-1.9.0/src/libmongocrypt/src/mongocrypt-cache-key-private.h
diff --git a/mongodb-1.8.1/src/libmongocrypt/src/mongocrypt-cache-key.c b/mongodb-1.9.0/src/libmongocrypt/src/mongocrypt-cache-key.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongocrypt/src/mongocrypt-cache-key.c
rename to mongodb-1.9.0/src/libmongocrypt/src/mongocrypt-cache-key.c
diff --git a/mongodb-1.8.1/src/libmongocrypt/src/mongocrypt-cache-private.h b/mongodb-1.9.0/src/libmongocrypt/src/mongocrypt-cache-private.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongocrypt/src/mongocrypt-cache-private.h
rename to mongodb-1.9.0/src/libmongocrypt/src/mongocrypt-cache-private.h
diff --git a/mongodb-1.8.1/src/libmongocrypt/src/mongocrypt-cache.c b/mongodb-1.9.0/src/libmongocrypt/src/mongocrypt-cache.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongocrypt/src/mongocrypt-cache.c
rename to mongodb-1.9.0/src/libmongocrypt/src/mongocrypt-cache.c
diff --git a/mongodb-1.8.1/src/libmongocrypt/src/mongocrypt-ciphertext-private.h b/mongodb-1.9.0/src/libmongocrypt/src/mongocrypt-ciphertext-private.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongocrypt/src/mongocrypt-ciphertext-private.h
rename to mongodb-1.9.0/src/libmongocrypt/src/mongocrypt-ciphertext-private.h
diff --git a/mongodb-1.8.1/src/libmongocrypt/src/mongocrypt-ciphertext.c b/mongodb-1.9.0/src/libmongocrypt/src/mongocrypt-ciphertext.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongocrypt/src/mongocrypt-ciphertext.c
rename to mongodb-1.9.0/src/libmongocrypt/src/mongocrypt-ciphertext.c
diff --git a/mongodb-1.8.1/src/libmongocrypt/src/mongocrypt-compat.h b/mongodb-1.9.0/src/libmongocrypt/src/mongocrypt-compat.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongocrypt/src/mongocrypt-compat.h
rename to mongodb-1.9.0/src/libmongocrypt/src/mongocrypt-compat.h
diff --git a/mongodb-1.8.1/src/libmongocrypt/src/mongocrypt-config.h b/mongodb-1.9.0/src/libmongocrypt/src/mongocrypt-config.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongocrypt/src/mongocrypt-config.h
rename to mongodb-1.9.0/src/libmongocrypt/src/mongocrypt-config.h
diff --git a/mongodb-1.8.1/src/libmongocrypt/src/mongocrypt-config.h.in b/mongodb-1.9.0/src/libmongocrypt/src/mongocrypt-config.h.in
similarity index 100%
rename from mongodb-1.8.1/src/libmongocrypt/src/mongocrypt-config.h.in
rename to mongodb-1.9.0/src/libmongocrypt/src/mongocrypt-config.h.in
diff --git a/mongodb-1.8.1/src/libmongocrypt/src/mongocrypt-crypto-private.h b/mongodb-1.9.0/src/libmongocrypt/src/mongocrypt-crypto-private.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongocrypt/src/mongocrypt-crypto-private.h
rename to mongodb-1.9.0/src/libmongocrypt/src/mongocrypt-crypto-private.h
diff --git a/mongodb-1.8.1/src/libmongocrypt/src/mongocrypt-crypto.c b/mongodb-1.9.0/src/libmongocrypt/src/mongocrypt-crypto.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongocrypt/src/mongocrypt-crypto.c
rename to mongodb-1.9.0/src/libmongocrypt/src/mongocrypt-crypto.c
diff --git a/mongodb-1.8.1/src/libmongocrypt/src/mongocrypt-ctx-datakey.c b/mongodb-1.9.0/src/libmongocrypt/src/mongocrypt-ctx-datakey.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongocrypt/src/mongocrypt-ctx-datakey.c
rename to mongodb-1.9.0/src/libmongocrypt/src/mongocrypt-ctx-datakey.c
diff --git a/mongodb-1.8.1/src/libmongocrypt/src/mongocrypt-ctx-decrypt.c b/mongodb-1.9.0/src/libmongocrypt/src/mongocrypt-ctx-decrypt.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongocrypt/src/mongocrypt-ctx-decrypt.c
rename to mongodb-1.9.0/src/libmongocrypt/src/mongocrypt-ctx-decrypt.c
diff --git a/mongodb-1.8.1/src/libmongocrypt/src/mongocrypt-ctx-encrypt.c b/mongodb-1.9.0/src/libmongocrypt/src/mongocrypt-ctx-encrypt.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongocrypt/src/mongocrypt-ctx-encrypt.c
rename to mongodb-1.9.0/src/libmongocrypt/src/mongocrypt-ctx-encrypt.c
diff --git a/mongodb-1.8.1/src/libmongocrypt/src/mongocrypt-ctx-private.h b/mongodb-1.9.0/src/libmongocrypt/src/mongocrypt-ctx-private.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongocrypt/src/mongocrypt-ctx-private.h
rename to mongodb-1.9.0/src/libmongocrypt/src/mongocrypt-ctx-private.h
diff --git a/mongodb-1.8.1/src/libmongocrypt/src/mongocrypt-ctx.c b/mongodb-1.9.0/src/libmongocrypt/src/mongocrypt-ctx.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongocrypt/src/mongocrypt-ctx.c
rename to mongodb-1.9.0/src/libmongocrypt/src/mongocrypt-ctx.c
diff --git a/mongodb-1.8.1/src/libmongocrypt/src/mongocrypt-key-broker-private.h b/mongodb-1.9.0/src/libmongocrypt/src/mongocrypt-key-broker-private.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongocrypt/src/mongocrypt-key-broker-private.h
rename to mongodb-1.9.0/src/libmongocrypt/src/mongocrypt-key-broker-private.h
diff --git a/mongodb-1.8.1/src/libmongocrypt/src/mongocrypt-key-broker.c b/mongodb-1.9.0/src/libmongocrypt/src/mongocrypt-key-broker.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongocrypt/src/mongocrypt-key-broker.c
rename to mongodb-1.9.0/src/libmongocrypt/src/mongocrypt-key-broker.c
diff --git a/mongodb-1.8.1/src/libmongocrypt/src/mongocrypt-key-private.h b/mongodb-1.9.0/src/libmongocrypt/src/mongocrypt-key-private.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongocrypt/src/mongocrypt-key-private.h
rename to mongodb-1.9.0/src/libmongocrypt/src/mongocrypt-key-private.h
diff --git a/mongodb-1.8.1/src/libmongocrypt/src/mongocrypt-key.c b/mongodb-1.9.0/src/libmongocrypt/src/mongocrypt-key.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongocrypt/src/mongocrypt-key.c
rename to mongodb-1.9.0/src/libmongocrypt/src/mongocrypt-key.c
diff --git a/mongodb-1.8.1/src/libmongocrypt/src/mongocrypt-kms-ctx-private.h b/mongodb-1.9.0/src/libmongocrypt/src/mongocrypt-kms-ctx-private.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongocrypt/src/mongocrypt-kms-ctx-private.h
rename to mongodb-1.9.0/src/libmongocrypt/src/mongocrypt-kms-ctx-private.h
diff --git a/mongodb-1.8.1/src/libmongocrypt/src/mongocrypt-kms-ctx.c b/mongodb-1.9.0/src/libmongocrypt/src/mongocrypt-kms-ctx.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongocrypt/src/mongocrypt-kms-ctx.c
rename to mongodb-1.9.0/src/libmongocrypt/src/mongocrypt-kms-ctx.c
diff --git a/mongodb-1.8.1/src/libmongocrypt/src/mongocrypt-log-private.h b/mongodb-1.9.0/src/libmongocrypt/src/mongocrypt-log-private.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongocrypt/src/mongocrypt-log-private.h
rename to mongodb-1.9.0/src/libmongocrypt/src/mongocrypt-log-private.h
diff --git a/mongodb-1.8.1/src/libmongocrypt/src/mongocrypt-log.c b/mongodb-1.9.0/src/libmongocrypt/src/mongocrypt-log.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongocrypt/src/mongocrypt-log.c
rename to mongodb-1.9.0/src/libmongocrypt/src/mongocrypt-log.c
diff --git a/mongodb-1.8.1/src/libmongocrypt/src/mongocrypt-marking-private.h b/mongodb-1.9.0/src/libmongocrypt/src/mongocrypt-marking-private.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongocrypt/src/mongocrypt-marking-private.h
rename to mongodb-1.9.0/src/libmongocrypt/src/mongocrypt-marking-private.h
diff --git a/mongodb-1.8.1/src/libmongocrypt/src/mongocrypt-marking.c b/mongodb-1.9.0/src/libmongocrypt/src/mongocrypt-marking.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongocrypt/src/mongocrypt-marking.c
rename to mongodb-1.9.0/src/libmongocrypt/src/mongocrypt-marking.c
diff --git a/mongodb-1.8.1/src/libmongocrypt/src/mongocrypt-mutex-private.h b/mongodb-1.9.0/src/libmongocrypt/src/mongocrypt-mutex-private.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongocrypt/src/mongocrypt-mutex-private.h
rename to mongodb-1.9.0/src/libmongocrypt/src/mongocrypt-mutex-private.h
diff --git a/mongodb-1.8.1/src/libmongocrypt/src/mongocrypt-opts-private.h b/mongodb-1.9.0/src/libmongocrypt/src/mongocrypt-opts-private.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongocrypt/src/mongocrypt-opts-private.h
rename to mongodb-1.9.0/src/libmongocrypt/src/mongocrypt-opts-private.h
diff --git a/mongodb-1.8.1/src/libmongocrypt/src/mongocrypt-opts.c b/mongodb-1.9.0/src/libmongocrypt/src/mongocrypt-opts.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongocrypt/src/mongocrypt-opts.c
rename to mongodb-1.9.0/src/libmongocrypt/src/mongocrypt-opts.c
diff --git a/mongodb-1.8.1/src/libmongocrypt/src/mongocrypt-os-private.h b/mongodb-1.9.0/src/libmongocrypt/src/mongocrypt-os-private.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongocrypt/src/mongocrypt-os-private.h
rename to mongodb-1.9.0/src/libmongocrypt/src/mongocrypt-os-private.h
diff --git a/mongodb-1.8.1/src/libmongocrypt/src/mongocrypt-private.h b/mongodb-1.9.0/src/libmongocrypt/src/mongocrypt-private.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongocrypt/src/mongocrypt-private.h
rename to mongodb-1.9.0/src/libmongocrypt/src/mongocrypt-private.h
diff --git a/mongodb-1.8.1/src/libmongocrypt/src/mongocrypt-status-private.h b/mongodb-1.9.0/src/libmongocrypt/src/mongocrypt-status-private.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongocrypt/src/mongocrypt-status-private.h
rename to mongodb-1.9.0/src/libmongocrypt/src/mongocrypt-status-private.h
diff --git a/mongodb-1.8.1/src/libmongocrypt/src/mongocrypt-status.c b/mongodb-1.9.0/src/libmongocrypt/src/mongocrypt-status.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongocrypt/src/mongocrypt-status.c
rename to mongodb-1.9.0/src/libmongocrypt/src/mongocrypt-status.c
diff --git a/mongodb-1.8.1/src/libmongocrypt/src/mongocrypt-traverse-util-private.h b/mongodb-1.9.0/src/libmongocrypt/src/mongocrypt-traverse-util-private.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongocrypt/src/mongocrypt-traverse-util-private.h
rename to mongodb-1.9.0/src/libmongocrypt/src/mongocrypt-traverse-util-private.h
diff --git a/mongodb-1.8.1/src/libmongocrypt/src/mongocrypt-traverse-util.c b/mongodb-1.9.0/src/libmongocrypt/src/mongocrypt-traverse-util.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongocrypt/src/mongocrypt-traverse-util.c
rename to mongodb-1.9.0/src/libmongocrypt/src/mongocrypt-traverse-util.c
diff --git a/mongodb-1.8.1/src/libmongocrypt/src/mongocrypt.c b/mongodb-1.9.0/src/libmongocrypt/src/mongocrypt.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongocrypt/src/mongocrypt.c
rename to mongodb-1.9.0/src/libmongocrypt/src/mongocrypt.c
diff --git a/mongodb-1.8.1/src/libmongocrypt/src/mongocrypt.h b/mongodb-1.9.0/src/libmongocrypt/src/mongocrypt.h
similarity index 100%
rename from mongodb-1.8.1/src/libmongocrypt/src/mongocrypt.h
rename to mongodb-1.9.0/src/libmongocrypt/src/mongocrypt.h
diff --git a/mongodb-1.8.1/src/libmongocrypt/src/mongocrypt.h.in b/mongodb-1.9.0/src/libmongocrypt/src/mongocrypt.h.in
similarity index 100%
rename from mongodb-1.8.1/src/libmongocrypt/src/mongocrypt.h.in
rename to mongodb-1.9.0/src/libmongocrypt/src/mongocrypt.h.in
diff --git a/mongodb-1.8.1/src/libmongocrypt/src/os_posix/os_mutex.c b/mongodb-1.9.0/src/libmongocrypt/src/os_posix/os_mutex.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongocrypt/src/os_posix/os_mutex.c
rename to mongodb-1.9.0/src/libmongocrypt/src/os_posix/os_mutex.c
diff --git a/mongodb-1.8.1/src/libmongocrypt/src/os_posix/os_once.c b/mongodb-1.9.0/src/libmongocrypt/src/os_posix/os_once.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongocrypt/src/os_posix/os_once.c
rename to mongodb-1.9.0/src/libmongocrypt/src/os_posix/os_once.c
diff --git a/mongodb-1.8.1/src/libmongocrypt/src/os_win/os_mutex.c b/mongodb-1.9.0/src/libmongocrypt/src/os_win/os_mutex.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongocrypt/src/os_win/os_mutex.c
rename to mongodb-1.9.0/src/libmongocrypt/src/os_win/os_mutex.c
diff --git a/mongodb-1.8.1/src/libmongocrypt/src/os_win/os_once.c b/mongodb-1.9.0/src/libmongocrypt/src/os_win/os_once.c
similarity index 100%
rename from mongodb-1.8.1/src/libmongocrypt/src/os_win/os_once.c
rename to mongodb-1.9.0/src/libmongocrypt/src/os_win/os_once.c
diff --git a/mongodb-1.8.1/tests/apm/bug0950-001.phpt b/mongodb-1.9.0/tests/apm/bug0950-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/apm/bug0950-001.phpt
rename to mongodb-1.9.0/tests/apm/bug0950-001.phpt
diff --git a/mongodb-1.9.0/tests/apm/bug0950-002.phpt b/mongodb-1.9.0/tests/apm/bug0950-002.phpt
new file mode 100644
index 00000000..9550d386
--- /dev/null
+++ b/mongodb-1.9.0/tests/apm/bug0950-002.phpt
@@ -0,0 +1,59 @@
+--TEST--
+PHPC-950: Segfault killing cursor after subscriber HashTable is destroyed (one subscriber)
+--SKIPIF--
+<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
+<?php skip_if_php_version('>=', '7.99'); ?>
+<?php skip_if_not_live(); ?>
+<?php skip_if_not_clean(); ?>
+--FILE--
+<?php
+require_once __DIR__ . "/../utils/basic.inc";
+
+/* Note: this test is skipped on PHP 8 because the CommandSubscriber ends up
+ * observing the killCursors command invoked from the Cursor's dtor. */
+
+class MySubscriber implements MongoDB\Driver\Monitoring\CommandSubscriber
+{
+ public function commandStarted(MongoDB\Driver\Monitoring\CommandStartedEvent $event)
+ {
+ printf("- started: %s\n", $event->getCommandName());
+ }
+
+ public function commandSucceeded(MongoDB\Driver\Monitoring\CommandSucceededEvent $event)
+ {
+ printf("- succeeded: %s\n", $event->getCommandName());
+ }
+
+ public function commandFailed(MongoDB\Driver\Monitoring\CommandFailedEvent $event)
+ {
+ printf("- failed: %s\n", $event->getCommandName());
+ }
+}
+
+$manager = new MongoDB\Driver\Manager(URI);
+
+$bulk = new MongoDB\Driver\BulkWrite();
+$bulk->insert(['_id' => 1]);
+$bulk->insert(['_id' => 2]);
+$bulk->insert(['_id' => 3]);
+$manager->executeBulkWrite(NS, $bulk);
+
+MongoDB\Driver\Monitoring\addSubscriber(new MySubscriber);
+
+$cursor = $manager->executeQuery(NS, new MongoDB\Driver\Query([], ['batchSize' => 2]));
+
+/* Exiting during iteration on a live cursor will result in
+ * php_phongo_command_started() being invoked for the killCursors command after
+ * RSHUTDOWN has already destroyed the subscriber HashTable */
+foreach ($cursor as $data) {
+ echo "Exiting during first iteration on cursor\n";
+ exit(0);
+}
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+- started: find
+- succeeded: find
+Exiting during first iteration on cursor
diff --git a/mongodb-1.8.1/tests/apm/monitoring-addSubscriber-001.phpt b/mongodb-1.9.0/tests/apm/monitoring-addSubscriber-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/apm/monitoring-addSubscriber-001.phpt
rename to mongodb-1.9.0/tests/apm/monitoring-addSubscriber-001.phpt
diff --git a/mongodb-1.8.1/tests/apm/monitoring-addSubscriber-002.phpt b/mongodb-1.9.0/tests/apm/monitoring-addSubscriber-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/apm/monitoring-addSubscriber-002.phpt
rename to mongodb-1.9.0/tests/apm/monitoring-addSubscriber-002.phpt
diff --git a/mongodb-1.8.1/tests/apm/monitoring-addSubscriber-003.phpt b/mongodb-1.9.0/tests/apm/monitoring-addSubscriber-003.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/apm/monitoring-addSubscriber-003.phpt
rename to mongodb-1.9.0/tests/apm/monitoring-addSubscriber-003.phpt
diff --git a/mongodb-1.8.1/tests/apm/monitoring-addSubscriber-004.phpt b/mongodb-1.9.0/tests/apm/monitoring-addSubscriber-004.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/apm/monitoring-addSubscriber-004.phpt
rename to mongodb-1.9.0/tests/apm/monitoring-addSubscriber-004.phpt
diff --git a/mongodb-1.8.1/tests/apm/monitoring-commandFailed-001.phpt b/mongodb-1.9.0/tests/apm/monitoring-commandFailed-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/apm/monitoring-commandFailed-001.phpt
rename to mongodb-1.9.0/tests/apm/monitoring-commandFailed-001.phpt
diff --git a/mongodb-1.8.1/tests/apm/monitoring-commandFailed-002.phpt b/mongodb-1.9.0/tests/apm/monitoring-commandFailed-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/apm/monitoring-commandFailed-002.phpt
rename to mongodb-1.9.0/tests/apm/monitoring-commandFailed-002.phpt
diff --git a/mongodb-1.8.1/tests/apm/monitoring-commandFailed-003.phpt b/mongodb-1.9.0/tests/apm/monitoring-commandFailed-003.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/apm/monitoring-commandFailed-003.phpt
rename to mongodb-1.9.0/tests/apm/monitoring-commandFailed-003.phpt
diff --git a/mongodb-1.8.1/tests/apm/monitoring-commandStarted-001.phpt b/mongodb-1.9.0/tests/apm/monitoring-commandStarted-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/apm/monitoring-commandStarted-001.phpt
rename to mongodb-1.9.0/tests/apm/monitoring-commandStarted-001.phpt
diff --git a/mongodb-1.8.1/tests/apm/monitoring-commandSucceeded-001.phpt b/mongodb-1.9.0/tests/apm/monitoring-commandSucceeded-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/apm/monitoring-commandSucceeded-001.phpt
rename to mongodb-1.9.0/tests/apm/monitoring-commandSucceeded-001.phpt
diff --git a/mongodb-1.8.1/tests/apm/monitoring-commandSucceeded-002.phpt b/mongodb-1.9.0/tests/apm/monitoring-commandSucceeded-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/apm/monitoring-commandSucceeded-002.phpt
rename to mongodb-1.9.0/tests/apm/monitoring-commandSucceeded-002.phpt
diff --git a/mongodb-1.8.1/tests/apm/monitoring-removeSubscriber-001.phpt b/mongodb-1.9.0/tests/apm/monitoring-removeSubscriber-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/apm/monitoring-removeSubscriber-001.phpt
rename to mongodb-1.9.0/tests/apm/monitoring-removeSubscriber-001.phpt
diff --git a/mongodb-1.8.1/tests/apm/monitoring-removeSubscriber-002.phpt b/mongodb-1.9.0/tests/apm/monitoring-removeSubscriber-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/apm/monitoring-removeSubscriber-002.phpt
rename to mongodb-1.9.0/tests/apm/monitoring-removeSubscriber-002.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/array-decodeError-001.phpt b/mongodb-1.9.0/tests/bson-corpus/array-decodeError-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/array-decodeError-001.phpt
rename to mongodb-1.9.0/tests/bson-corpus/array-decodeError-001.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/array-decodeError-002.phpt b/mongodb-1.9.0/tests/bson-corpus/array-decodeError-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/array-decodeError-002.phpt
rename to mongodb-1.9.0/tests/bson-corpus/array-decodeError-002.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/array-decodeError-003.phpt b/mongodb-1.9.0/tests/bson-corpus/array-decodeError-003.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/array-decodeError-003.phpt
rename to mongodb-1.9.0/tests/bson-corpus/array-decodeError-003.phpt
diff --git a/mongodb-1.9.0/tests/bson-corpus/array-valid-001.phpt b/mongodb-1.9.0/tests/bson-corpus/array-valid-001.phpt
new file mode 100644
index 00000000..9906b440
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/array-valid-001.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Array: Empty
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('0D000000046100050000000000');
+$canonicalExtJson = '{"a" : []}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+0d000000046100050000000000
+{"a":[]}
+0d000000046100050000000000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/array-valid-002.phpt b/mongodb-1.9.0/tests/bson-corpus/array-valid-002.phpt
new file mode 100644
index 00000000..0b732bb8
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/array-valid-002.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Array: Single Element Array
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('140000000461000C0000001030000A0000000000');
+$canonicalExtJson = '{"a" : [{"$numberInt": "10"}]}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+140000000461000c0000001030000a0000000000
+{"a":[{"$numberInt":"10"}]}
+140000000461000c0000001030000a0000000000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/array-valid-003.phpt b/mongodb-1.9.0/tests/bson-corpus/array-valid-003.phpt
new file mode 100644
index 00000000..a39850ee
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/array-valid-003.phpt
@@ -0,0 +1,40 @@
+--TEST--
+Array: Single Element Array with index set incorrectly to empty string
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('140000000461000C0000001030000A0000000000');
+$degenerateBson = hex2bin('130000000461000B00000010000A0000000000');
+$canonicalExtJson = '{"a" : [{"$numberInt": "10"}]}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($degenerateBson))), "\n";
+
+// Degenerate BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($degenerateBson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+140000000461000c0000001030000a0000000000
+{"a":[{"$numberInt":"10"}]}
+140000000461000c0000001030000a0000000000
+140000000461000c0000001030000a0000000000
+{"a":[{"$numberInt":"10"}]}
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/array-valid-004.phpt b/mongodb-1.9.0/tests/bson-corpus/array-valid-004.phpt
new file mode 100644
index 00000000..03536dcd
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/array-valid-004.phpt
@@ -0,0 +1,40 @@
+--TEST--
+Array: Single Element Array with index set incorrectly to ab
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('140000000461000C0000001030000A0000000000');
+$degenerateBson = hex2bin('150000000461000D000000106162000A0000000000');
+$canonicalExtJson = '{"a" : [{"$numberInt": "10"}]}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($degenerateBson))), "\n";
+
+// Degenerate BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($degenerateBson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+140000000461000c0000001030000a0000000000
+{"a":[{"$numberInt":"10"}]}
+140000000461000c0000001030000a0000000000
+140000000461000c0000001030000a0000000000
+{"a":[{"$numberInt":"10"}]}
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/array-valid-005.phpt b/mongodb-1.9.0/tests/bson-corpus/array-valid-005.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/array-valid-005.phpt
rename to mongodb-1.9.0/tests/bson-corpus/array-valid-005.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/binary-decodeError-001.phpt b/mongodb-1.9.0/tests/bson-corpus/binary-decodeError-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/binary-decodeError-001.phpt
rename to mongodb-1.9.0/tests/bson-corpus/binary-decodeError-001.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/binary-decodeError-002.phpt b/mongodb-1.9.0/tests/bson-corpus/binary-decodeError-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/binary-decodeError-002.phpt
rename to mongodb-1.9.0/tests/bson-corpus/binary-decodeError-002.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/binary-decodeError-003.phpt b/mongodb-1.9.0/tests/bson-corpus/binary-decodeError-003.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/binary-decodeError-003.phpt
rename to mongodb-1.9.0/tests/bson-corpus/binary-decodeError-003.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/binary-decodeError-004.phpt b/mongodb-1.9.0/tests/bson-corpus/binary-decodeError-004.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/binary-decodeError-004.phpt
rename to mongodb-1.9.0/tests/bson-corpus/binary-decodeError-004.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/binary-decodeError-005.phpt b/mongodb-1.9.0/tests/bson-corpus/binary-decodeError-005.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/binary-decodeError-005.phpt
rename to mongodb-1.9.0/tests/bson-corpus/binary-decodeError-005.phpt
diff --git a/mongodb-1.9.0/tests/bson-corpus/binary-valid-001.phpt b/mongodb-1.9.0/tests/bson-corpus/binary-valid-001.phpt
new file mode 100644
index 00000000..cf35473d
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/binary-valid-001.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Binary type: subtype 0x00 (Zero-length)
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('0D000000057800000000000000');
+$canonicalExtJson = '{"x" : { "$binary" : {"base64" : "", "subType" : "00"}}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+0d000000057800000000000000
+{"x":{"$binary":{"base64":"","subType":"00"}}}
+0d000000057800000000000000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/binary-valid-002.phpt b/mongodb-1.9.0/tests/bson-corpus/binary-valid-002.phpt
new file mode 100644
index 00000000..96a923cf
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/binary-valid-002.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Binary type: subtype 0x00 (Zero-length, keys reversed)
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('0D000000057800000000000000');
+$canonicalExtJson = '{"x" : { "$binary" : {"base64" : "", "subType" : "00"}}}';
+$degenerateExtJson = '{"x" : { "$binary" : {"subType" : "00", "base64" : ""}}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+0d000000057800000000000000
+{"x":{"$binary":{"base64":"","subType":"00"}}}
+0d000000057800000000000000
+0d000000057800000000000000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/binary-valid-003.phpt b/mongodb-1.9.0/tests/bson-corpus/binary-valid-003.phpt
new file mode 100644
index 00000000..e2ef8186
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/binary-valid-003.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Binary type: subtype 0x00
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('0F0000000578000200000000FFFF00');
+$canonicalExtJson = '{"x" : { "$binary" : {"base64" : "//8=", "subType" : "00"}}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+0f0000000578000200000000ffff00
+{"x":{"$binary":{"base64":"\/\/8=","subType":"00"}}}
+0f0000000578000200000000ffff00
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/binary-valid-004.phpt b/mongodb-1.9.0/tests/bson-corpus/binary-valid-004.phpt
new file mode 100644
index 00000000..95648188
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/binary-valid-004.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Binary type: subtype 0x01
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('0F0000000578000200000001FFFF00');
+$canonicalExtJson = '{"x" : { "$binary" : {"base64" : "//8=", "subType" : "01"}}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+0f0000000578000200000001ffff00
+{"x":{"$binary":{"base64":"\/\/8=","subType":"01"}}}
+0f0000000578000200000001ffff00
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/binary-valid-005.phpt b/mongodb-1.9.0/tests/bson-corpus/binary-valid-005.phpt
new file mode 100644
index 00000000..3002315f
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/binary-valid-005.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Binary type: subtype 0x02
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('13000000057800060000000202000000FFFF00');
+$canonicalExtJson = '{"x" : { "$binary" : {"base64" : "//8=", "subType" : "02"}}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+13000000057800060000000202000000ffff00
+{"x":{"$binary":{"base64":"\/\/8=","subType":"02"}}}
+13000000057800060000000202000000ffff00
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/binary-valid-006.phpt b/mongodb-1.9.0/tests/bson-corpus/binary-valid-006.phpt
new file mode 100644
index 00000000..e1256742
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/binary-valid-006.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Binary type: subtype 0x03
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('1D000000057800100000000373FFD26444B34C6990E8E7D1DFC035D400');
+$canonicalExtJson = '{"x" : { "$binary" : {"base64" : "c//SZESzTGmQ6OfR38A11A==", "subType" : "03"}}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+1d000000057800100000000373ffd26444b34c6990e8e7d1dfc035d400
+{"x":{"$binary":{"base64":"c\/\/SZESzTGmQ6OfR38A11A==","subType":"03"}}}
+1d000000057800100000000373ffd26444b34c6990e8e7d1dfc035d400
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/binary-valid-007.phpt b/mongodb-1.9.0/tests/bson-corpus/binary-valid-007.phpt
new file mode 100644
index 00000000..0b0f1249
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/binary-valid-007.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Binary type: subtype 0x04
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('1D000000057800100000000473FFD26444B34C6990E8E7D1DFC035D400');
+$canonicalExtJson = '{"x" : { "$binary" : {"base64" : "c//SZESzTGmQ6OfR38A11A==", "subType" : "04"}}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+1d000000057800100000000473ffd26444b34c6990e8e7d1dfc035d400
+{"x":{"$binary":{"base64":"c\/\/SZESzTGmQ6OfR38A11A==","subType":"04"}}}
+1d000000057800100000000473ffd26444b34c6990e8e7d1dfc035d400
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/binary-valid-008.phpt b/mongodb-1.9.0/tests/bson-corpus/binary-valid-008.phpt
new file mode 100644
index 00000000..5e660819
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/binary-valid-008.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Binary type: subtype 0x05
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('1D000000057800100000000573FFD26444B34C6990E8E7D1DFC035D400');
+$canonicalExtJson = '{"x" : { "$binary" : {"base64" : "c//SZESzTGmQ6OfR38A11A==", "subType" : "05"}}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+1d000000057800100000000573ffd26444b34c6990e8e7d1dfc035d400
+{"x":{"$binary":{"base64":"c\/\/SZESzTGmQ6OfR38A11A==","subType":"05"}}}
+1d000000057800100000000573ffd26444b34c6990e8e7d1dfc035d400
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/binary-valid-009.phpt b/mongodb-1.9.0/tests/bson-corpus/binary-valid-009.phpt
new file mode 100644
index 00000000..34f9004f
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/binary-valid-009.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Binary type: subtype 0x80
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('0F0000000578000200000080FFFF00');
+$canonicalExtJson = '{"x" : { "$binary" : {"base64" : "//8=", "subType" : "80"}}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+0f0000000578000200000080ffff00
+{"x":{"$binary":{"base64":"\/\/8=","subType":"80"}}}
+0f0000000578000200000080ffff00
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/binary-valid-010.phpt b/mongodb-1.9.0/tests/bson-corpus/binary-valid-010.phpt
new file mode 100644
index 00000000..123b2607
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/binary-valid-010.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Binary type: $type query operator (conflicts with legacy $binary form with $type field)
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('1F000000037800170000000224747970650007000000737472696E67000000');
+$canonicalExtJson = '{"x" : { "$type" : "string"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+1f000000037800170000000224747970650007000000737472696e67000000
+{"x":{"$type":"string"}}
+1f000000037800170000000224747970650007000000737472696e67000000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/binary-valid-011.phpt b/mongodb-1.9.0/tests/bson-corpus/binary-valid-011.phpt
new file mode 100644
index 00000000..a6028320
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/binary-valid-011.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Binary type: $type query operator (conflicts with legacy $binary form with $type field)
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000000378001000000010247479706500020000000000');
+$canonicalExtJson = '{"x" : { "$type" : {"$numberInt": "2"}}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000000378001000000010247479706500020000000000
+{"x":{"$type":{"$numberInt":"2"}}}
+180000000378001000000010247479706500020000000000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/boolean-decodeError-001.phpt b/mongodb-1.9.0/tests/bson-corpus/boolean-decodeError-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/boolean-decodeError-001.phpt
rename to mongodb-1.9.0/tests/bson-corpus/boolean-decodeError-001.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/boolean-decodeError-002.phpt b/mongodb-1.9.0/tests/bson-corpus/boolean-decodeError-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/boolean-decodeError-002.phpt
rename to mongodb-1.9.0/tests/bson-corpus/boolean-decodeError-002.phpt
diff --git a/mongodb-1.9.0/tests/bson-corpus/boolean-valid-001.phpt b/mongodb-1.9.0/tests/bson-corpus/boolean-valid-001.phpt
new file mode 100644
index 00000000..4c7dee25
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/boolean-valid-001.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Boolean: True
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('090000000862000100');
+$canonicalExtJson = '{"b" : true}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+090000000862000100
+{"b":true}
+090000000862000100
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/boolean-valid-002.phpt b/mongodb-1.9.0/tests/bson-corpus/boolean-valid-002.phpt
new file mode 100644
index 00000000..9c6969c4
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/boolean-valid-002.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Boolean: False
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('090000000862000000');
+$canonicalExtJson = '{"b" : false}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+090000000862000000
+{"b":false}
+090000000862000000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/code-decodeError-001.phpt b/mongodb-1.9.0/tests/bson-corpus/code-decodeError-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/code-decodeError-001.phpt
rename to mongodb-1.9.0/tests/bson-corpus/code-decodeError-001.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/code-decodeError-002.phpt b/mongodb-1.9.0/tests/bson-corpus/code-decodeError-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/code-decodeError-002.phpt
rename to mongodb-1.9.0/tests/bson-corpus/code-decodeError-002.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/code-decodeError-003.phpt b/mongodb-1.9.0/tests/bson-corpus/code-decodeError-003.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/code-decodeError-003.phpt
rename to mongodb-1.9.0/tests/bson-corpus/code-decodeError-003.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/code-decodeError-004.phpt b/mongodb-1.9.0/tests/bson-corpus/code-decodeError-004.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/code-decodeError-004.phpt
rename to mongodb-1.9.0/tests/bson-corpus/code-decodeError-004.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/code-decodeError-005.phpt b/mongodb-1.9.0/tests/bson-corpus/code-decodeError-005.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/code-decodeError-005.phpt
rename to mongodb-1.9.0/tests/bson-corpus/code-decodeError-005.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/code-decodeError-006.phpt b/mongodb-1.9.0/tests/bson-corpus/code-decodeError-006.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/code-decodeError-006.phpt
rename to mongodb-1.9.0/tests/bson-corpus/code-decodeError-006.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/code-decodeError-007.phpt b/mongodb-1.9.0/tests/bson-corpus/code-decodeError-007.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/code-decodeError-007.phpt
rename to mongodb-1.9.0/tests/bson-corpus/code-decodeError-007.phpt
diff --git a/mongodb-1.9.0/tests/bson-corpus/code-valid-001.phpt b/mongodb-1.9.0/tests/bson-corpus/code-valid-001.phpt
new file mode 100644
index 00000000..385518ac
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/code-valid-001.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Javascript Code: Empty string
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('0D0000000D6100010000000000');
+$canonicalExtJson = '{"a" : {"$code" : ""}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+0d0000000d6100010000000000
+{"a":{"$code":""}}
+0d0000000d6100010000000000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/code-valid-002.phpt b/mongodb-1.9.0/tests/bson-corpus/code-valid-002.phpt
new file mode 100644
index 00000000..19821b5a
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/code-valid-002.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Javascript Code: Single character
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('0E0000000D610002000000620000');
+$canonicalExtJson = '{"a" : {"$code" : "b"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+0e0000000d610002000000620000
+{"a":{"$code":"b"}}
+0e0000000d610002000000620000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/code-valid-003.phpt b/mongodb-1.9.0/tests/bson-corpus/code-valid-003.phpt
new file mode 100644
index 00000000..e1aaad04
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/code-valid-003.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Javascript Code: Multi-character
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('190000000D61000D0000006162616261626162616261620000');
+$canonicalExtJson = '{"a" : {"$code" : "abababababab"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+190000000d61000d0000006162616261626162616261620000
+{"a":{"$code":"abababababab"}}
+190000000d61000d0000006162616261626162616261620000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/code-valid-004.phpt b/mongodb-1.9.0/tests/bson-corpus/code-valid-004.phpt
new file mode 100644
index 00000000..b024e197
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/code-valid-004.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Javascript Code: two-byte UTF-8 (é)
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('190000000261000D000000C3A9C3A9C3A9C3A9C3A9C3A90000');
+$canonicalExtJson = '{"a" : "\\u00e9\\u00e9\\u00e9\\u00e9\\u00e9\\u00e9"}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+190000000261000d000000c3a9c3a9c3a9c3a9c3a9c3a90000
+{"a":"\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9"}
+190000000261000d000000c3a9c3a9c3a9c3a9c3a9c3a90000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/code-valid-005.phpt b/mongodb-1.9.0/tests/bson-corpus/code-valid-005.phpt
new file mode 100644
index 00000000..5429bea0
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/code-valid-005.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Javascript Code: three-byte UTF-8 (☆)
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('190000000261000D000000E29886E29886E29886E298860000');
+$canonicalExtJson = '{"a" : "\\u2606\\u2606\\u2606\\u2606"}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+190000000261000d000000e29886e29886e29886e298860000
+{"a":"\u2606\u2606\u2606\u2606"}
+190000000261000d000000e29886e29886e29886e298860000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/code-valid-006.phpt b/mongodb-1.9.0/tests/bson-corpus/code-valid-006.phpt
new file mode 100644
index 00000000..2a0a3699
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/code-valid-006.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Javascript Code: Embedded nulls
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('190000000261000D0000006162006261620062616261620000');
+$canonicalExtJson = '{"a" : "ab\\u0000bab\\u0000babab"}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+190000000261000d0000006162006261620062616261620000
+{"a":"ab\u0000bab\u0000babab"}
+190000000261000d0000006162006261620062616261620000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/code_w_scope-decodeError-001.phpt b/mongodb-1.9.0/tests/bson-corpus/code_w_scope-decodeError-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/code_w_scope-decodeError-001.phpt
rename to mongodb-1.9.0/tests/bson-corpus/code_w_scope-decodeError-001.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/code_w_scope-decodeError-002.phpt b/mongodb-1.9.0/tests/bson-corpus/code_w_scope-decodeError-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/code_w_scope-decodeError-002.phpt
rename to mongodb-1.9.0/tests/bson-corpus/code_w_scope-decodeError-002.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/code_w_scope-decodeError-003.phpt b/mongodb-1.9.0/tests/bson-corpus/code_w_scope-decodeError-003.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/code_w_scope-decodeError-003.phpt
rename to mongodb-1.9.0/tests/bson-corpus/code_w_scope-decodeError-003.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/code_w_scope-decodeError-004.phpt b/mongodb-1.9.0/tests/bson-corpus/code_w_scope-decodeError-004.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/code_w_scope-decodeError-004.phpt
rename to mongodb-1.9.0/tests/bson-corpus/code_w_scope-decodeError-004.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/code_w_scope-decodeError-005.phpt b/mongodb-1.9.0/tests/bson-corpus/code_w_scope-decodeError-005.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/code_w_scope-decodeError-005.phpt
rename to mongodb-1.9.0/tests/bson-corpus/code_w_scope-decodeError-005.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/code_w_scope-decodeError-006.phpt b/mongodb-1.9.0/tests/bson-corpus/code_w_scope-decodeError-006.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/code_w_scope-decodeError-006.phpt
rename to mongodb-1.9.0/tests/bson-corpus/code_w_scope-decodeError-006.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/code_w_scope-decodeError-007.phpt b/mongodb-1.9.0/tests/bson-corpus/code_w_scope-decodeError-007.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/code_w_scope-decodeError-007.phpt
rename to mongodb-1.9.0/tests/bson-corpus/code_w_scope-decodeError-007.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/code_w_scope-decodeError-008.phpt b/mongodb-1.9.0/tests/bson-corpus/code_w_scope-decodeError-008.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/code_w_scope-decodeError-008.phpt
rename to mongodb-1.9.0/tests/bson-corpus/code_w_scope-decodeError-008.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/code_w_scope-decodeError-009.phpt b/mongodb-1.9.0/tests/bson-corpus/code_w_scope-decodeError-009.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/code_w_scope-decodeError-009.phpt
rename to mongodb-1.9.0/tests/bson-corpus/code_w_scope-decodeError-009.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/code_w_scope-decodeError-010.phpt b/mongodb-1.9.0/tests/bson-corpus/code_w_scope-decodeError-010.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/code_w_scope-decodeError-010.phpt
rename to mongodb-1.9.0/tests/bson-corpus/code_w_scope-decodeError-010.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/code_w_scope-decodeError-011.phpt b/mongodb-1.9.0/tests/bson-corpus/code_w_scope-decodeError-011.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/code_w_scope-decodeError-011.phpt
rename to mongodb-1.9.0/tests/bson-corpus/code_w_scope-decodeError-011.phpt
diff --git a/mongodb-1.9.0/tests/bson-corpus/code_w_scope-valid-001.phpt b/mongodb-1.9.0/tests/bson-corpus/code_w_scope-valid-001.phpt
new file mode 100644
index 00000000..834134fb
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/code_w_scope-valid-001.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Javascript Code with Scope: Empty code string, empty scope
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('160000000F61000E0000000100000000050000000000');
+$canonicalExtJson = '{"a" : {"$code" : "", "$scope" : {}}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+160000000f61000e0000000100000000050000000000
+{"a":{"$code":"","$scope":{}}}
+160000000f61000e0000000100000000050000000000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/code_w_scope-valid-002.phpt b/mongodb-1.9.0/tests/bson-corpus/code_w_scope-valid-002.phpt
new file mode 100644
index 00000000..054422b6
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/code_w_scope-valid-002.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Javascript Code with Scope: Non-empty code string, empty scope
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('1A0000000F610012000000050000006162636400050000000000');
+$canonicalExtJson = '{"a" : {"$code" : "abcd", "$scope" : {}}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+1a0000000f610012000000050000006162636400050000000000
+{"a":{"$code":"abcd","$scope":{}}}
+1a0000000f610012000000050000006162636400050000000000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/code_w_scope-valid-003.phpt b/mongodb-1.9.0/tests/bson-corpus/code_w_scope-valid-003.phpt
new file mode 100644
index 00000000..afb2f334
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/code_w_scope-valid-003.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Javascript Code with Scope: Empty code string, non-empty scope
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('1D0000000F61001500000001000000000C000000107800010000000000');
+$canonicalExtJson = '{"a" : {"$code" : "", "$scope" : {"x" : {"$numberInt": "1"}}}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+1d0000000f61001500000001000000000c000000107800010000000000
+{"a":{"$code":"","$scope":{"x":{"$numberInt":"1"}}}}
+1d0000000f61001500000001000000000c000000107800010000000000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/code_w_scope-valid-004.phpt b/mongodb-1.9.0/tests/bson-corpus/code_w_scope-valid-004.phpt
new file mode 100644
index 00000000..079f2dc5
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/code_w_scope-valid-004.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Javascript Code with Scope: Non-empty code string and non-empty scope
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('210000000F6100190000000500000061626364000C000000107800010000000000');
+$canonicalExtJson = '{"a" : {"$code" : "abcd", "$scope" : {"x" : {"$numberInt": "1"}}}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+210000000f6100190000000500000061626364000c000000107800010000000000
+{"a":{"$code":"abcd","$scope":{"x":{"$numberInt":"1"}}}}
+210000000f6100190000000500000061626364000c000000107800010000000000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/code_w_scope-valid-005.phpt b/mongodb-1.9.0/tests/bson-corpus/code_w_scope-valid-005.phpt
new file mode 100644
index 00000000..5be5710f
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/code_w_scope-valid-005.phpt
@@ -0,0 +1,33 @@
+--TEST--
+Javascript Code with Scope: Unicode and embedded null in code string, empty scope
+--XFAIL--
+Embedded null in code string is not supported in libbson (CDRIVER-1879)
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('1A0000000F61001200000005000000C3A9006400050000000000');
+$canonicalExtJson = '{"a" : {"$code" : "\\u00e9\\u0000d", "$scope" : {}}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+1a0000000f61001200000005000000c3a9006400050000000000
+{"a":{"$code":"\u00e9\u0000d","$scope":{}}}
+1a0000000f61001200000005000000c3a9006400050000000000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/datetime-decodeError-001.phpt b/mongodb-1.9.0/tests/bson-corpus/datetime-decodeError-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/datetime-decodeError-001.phpt
rename to mongodb-1.9.0/tests/bson-corpus/datetime-decodeError-001.phpt
diff --git a/mongodb-1.9.0/tests/bson-corpus/datetime-valid-001.phpt b/mongodb-1.9.0/tests/bson-corpus/datetime-valid-001.phpt
new file mode 100644
index 00000000..1b86a666
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/datetime-valid-001.phpt
@@ -0,0 +1,40 @@
+--TEST--
+DateTime: epoch
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('10000000096100000000000000000000');
+$canonicalExtJson = '{"a" : {"$date" : {"$numberLong" : "0"}}}';
+$relaxedExtJson = '{"a" : {"$date" : "1970-01-01T00:00:00Z"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical BSON -> Relaxed extJSON
+echo json_canonicalize(toRelaxedExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Relaxed extJSON -> BSON -> Relaxed extJSON
+echo json_canonicalize(toRelaxedExtendedJSON(fromJSON($relaxedExtJson))), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+10000000096100000000000000000000
+{"a":{"$date":{"$numberLong":"0"}}}
+{"a":{"$date":"1970-01-01T00:00:00Z"}}
+10000000096100000000000000000000
+{"a":{"$date":"1970-01-01T00:00:00Z"}}
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/datetime-valid-002.phpt b/mongodb-1.9.0/tests/bson-corpus/datetime-valid-002.phpt
new file mode 100644
index 00000000..86c84bbd
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/datetime-valid-002.phpt
@@ -0,0 +1,40 @@
+--TEST--
+DateTime: positive ms
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('10000000096100C5D8D6CC3B01000000');
+$canonicalExtJson = '{"a" : {"$date" : {"$numberLong" : "1356351330501"}}}';
+$relaxedExtJson = '{"a" : {"$date" : "2012-12-24T12:15:30.501Z"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical BSON -> Relaxed extJSON
+echo json_canonicalize(toRelaxedExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Relaxed extJSON -> BSON -> Relaxed extJSON
+echo json_canonicalize(toRelaxedExtendedJSON(fromJSON($relaxedExtJson))), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+10000000096100c5d8d6cc3b01000000
+{"a":{"$date":{"$numberLong":"1356351330501"}}}
+{"a":{"$date":"2012-12-24T12:15:30.501Z"}}
+10000000096100c5d8d6cc3b01000000
+{"a":{"$date":"2012-12-24T12:15:30.501Z"}}
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/datetime-valid-003.phpt b/mongodb-1.9.0/tests/bson-corpus/datetime-valid-003.phpt
new file mode 100644
index 00000000..c288c269
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/datetime-valid-003.phpt
@@ -0,0 +1,40 @@
+--TEST--
+DateTime: negative
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('10000000096100C33CE7B9BDFFFFFF00');
+$canonicalExtJson = '{"a" : {"$date" : {"$numberLong" : "-284643869501"}}}';
+$relaxedExtJson = '{"a" : {"$date" : {"$numberLong" : "-284643869501"}}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical BSON -> Relaxed extJSON
+echo json_canonicalize(toRelaxedExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Relaxed extJSON -> BSON -> Relaxed extJSON
+echo json_canonicalize(toRelaxedExtendedJSON(fromJSON($relaxedExtJson))), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+10000000096100c33ce7b9bdffffff00
+{"a":{"$date":{"$numberLong":"-284643869501"}}}
+{"a":{"$date":{"$numberLong":"-284643869501"}}}
+10000000096100c33ce7b9bdffffff00
+{"a":{"$date":{"$numberLong":"-284643869501"}}}
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/datetime-valid-004.phpt b/mongodb-1.9.0/tests/bson-corpus/datetime-valid-004.phpt
new file mode 100644
index 00000000..b8c93cef
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/datetime-valid-004.phpt
@@ -0,0 +1,31 @@
+--TEST--
+DateTime: Y10K
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('1000000009610000DC1FD277E6000000');
+$canonicalExtJson = '{"a":{"$date":{"$numberLong":"253402300800000"}}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+1000000009610000dc1fd277e6000000
+{"a":{"$date":{"$numberLong":"253402300800000"}}}
+1000000009610000dc1fd277e6000000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/datetime-valid-005.phpt b/mongodb-1.9.0/tests/bson-corpus/datetime-valid-005.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/datetime-valid-005.phpt
rename to mongodb-1.9.0/tests/bson-corpus/datetime-valid-005.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/dbpointer-decodeError-001.phpt b/mongodb-1.9.0/tests/bson-corpus/dbpointer-decodeError-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/dbpointer-decodeError-001.phpt
rename to mongodb-1.9.0/tests/bson-corpus/dbpointer-decodeError-001.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/dbpointer-decodeError-002.phpt b/mongodb-1.9.0/tests/bson-corpus/dbpointer-decodeError-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/dbpointer-decodeError-002.phpt
rename to mongodb-1.9.0/tests/bson-corpus/dbpointer-decodeError-002.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/dbpointer-decodeError-003.phpt b/mongodb-1.9.0/tests/bson-corpus/dbpointer-decodeError-003.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/dbpointer-decodeError-003.phpt
rename to mongodb-1.9.0/tests/bson-corpus/dbpointer-decodeError-003.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/dbpointer-decodeError-004.phpt b/mongodb-1.9.0/tests/bson-corpus/dbpointer-decodeError-004.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/dbpointer-decodeError-004.phpt
rename to mongodb-1.9.0/tests/bson-corpus/dbpointer-decodeError-004.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/dbpointer-decodeError-005.phpt b/mongodb-1.9.0/tests/bson-corpus/dbpointer-decodeError-005.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/dbpointer-decodeError-005.phpt
rename to mongodb-1.9.0/tests/bson-corpus/dbpointer-decodeError-005.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/dbpointer-decodeError-006.phpt b/mongodb-1.9.0/tests/bson-corpus/dbpointer-decodeError-006.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/dbpointer-decodeError-006.phpt
rename to mongodb-1.9.0/tests/bson-corpus/dbpointer-decodeError-006.phpt
diff --git a/mongodb-1.9.0/tests/bson-corpus/dbpointer-valid-001.phpt b/mongodb-1.9.0/tests/bson-corpus/dbpointer-valid-001.phpt
new file mode 100644
index 00000000..ea184028
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/dbpointer-valid-001.phpt
@@ -0,0 +1,33 @@
+--TEST--
+DBPointer type (deprecated): DBpointer
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('1A0000000C610002000000620056E1FC72E0C917E9C471416100');
+$convertedBson = hex2bin('2a00000003610022000000022472656600020000006200072469640056e1fc72e0c917e9c47141610000');
+$canonicalExtJson = '{"a": {"$dbPointer": {"$ref": "b", "$id": {"$oid": "56e1fc72e0c917e9c4714161"}}}}';
+$convertedExtJson = '{"a": {"$ref": "b", "$id": {"$oid": "56e1fc72e0c917e9c4714161"}}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+1a0000000c610002000000620056e1fc72e0c917e9c471416100
+{"a":{"$dbPointer":{"$ref":"b","$id":{"$oid":"56e1fc72e0c917e9c4714161"}}}}
+1a0000000c610002000000620056e1fc72e0c917e9c471416100
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/dbpointer-valid-002.phpt b/mongodb-1.9.0/tests/bson-corpus/dbpointer-valid-002.phpt
new file mode 100644
index 00000000..e82e737b
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/dbpointer-valid-002.phpt
@@ -0,0 +1,38 @@
+--TEST--
+DBPointer type (deprecated): DBpointer with opposite key order
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('1A0000000C610002000000620056E1FC72E0C917E9C471416100');
+$convertedBson = hex2bin('2a00000003610022000000022472656600020000006200072469640056e1fc72e0c917e9c47141610000');
+$canonicalExtJson = '{"a": {"$dbPointer": {"$ref": "b", "$id": {"$oid": "56e1fc72e0c917e9c4714161"}}}}';
+$degenerateExtJson = '{"a": {"$dbPointer": {"$id": {"$oid": "56e1fc72e0c917e9c4714161"}, "$ref": "b"}}}';
+$convertedExtJson = '{"a": {"$ref": "b", "$id": {"$oid": "56e1fc72e0c917e9c4714161"}}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+1a0000000c610002000000620056e1fc72e0c917e9c471416100
+{"a":{"$dbPointer":{"$ref":"b","$id":{"$oid":"56e1fc72e0c917e9c4714161"}}}}
+1a0000000c610002000000620056e1fc72e0c917e9c471416100
+1a0000000c610002000000620056e1fc72e0c917e9c471416100
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/dbpointer-valid-003.phpt b/mongodb-1.9.0/tests/bson-corpus/dbpointer-valid-003.phpt
new file mode 100644
index 00000000..4884749c
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/dbpointer-valid-003.phpt
@@ -0,0 +1,33 @@
+--TEST--
+DBPointer type (deprecated): With two-byte UTF-8
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('1B0000000C610003000000C3A90056E1FC72E0C917E9C471416100');
+$convertedBson = hex2bin('2B0000000361002300000002247265660003000000C3A900072469640056E1FC72E0C917E9C47141610000');
+$canonicalExtJson = '{"a": {"$dbPointer": {"$ref": "é", "$id": {"$oid": "56e1fc72e0c917e9c4714161"}}}}';
+$convertedExtJson = '{"a": {"$ref": "é", "$id": {"$oid": "56e1fc72e0c917e9c4714161"}}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+1b0000000c610003000000c3a90056e1fc72e0c917e9c471416100
+{"a":{"$dbPointer":{"$ref":"\u00e9","$id":{"$oid":"56e1fc72e0c917e9c4714161"}}}}
+1b0000000c610003000000c3a90056e1fc72e0c917e9c471416100
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/dbref-valid-001.phpt b/mongodb-1.9.0/tests/bson-corpus/dbref-valid-001.phpt
new file mode 100644
index 00000000..d35c0edf
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/dbref-valid-001.phpt
@@ -0,0 +1,31 @@
+--TEST--
+DBRef: DBRef
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('37000000036462726566002b0000000224726566000b000000636f6c6c656374696f6e00072469640058921b3e6e32ab156a22b59e0000');
+$canonicalExtJson = '{"dbref": {"$ref": "collection", "$id": {"$oid": "58921b3e6e32ab156a22b59e"}}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+37000000036462726566002b0000000224726566000b000000636f6c6c656374696f6e00072469640058921b3e6e32ab156a22b59e0000
+{"dbref":{"$ref":"collection","$id":{"$oid":"58921b3e6e32ab156a22b59e"}}}
+37000000036462726566002b0000000224726566000b000000636f6c6c656374696f6e00072469640058921b3e6e32ab156a22b59e0000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/dbref-valid-002.phpt b/mongodb-1.9.0/tests/bson-corpus/dbref-valid-002.phpt
new file mode 100644
index 00000000..b922a070
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/dbref-valid-002.phpt
@@ -0,0 +1,31 @@
+--TEST--
+DBRef: DBRef with database
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('4300000003646272656600370000000224726566000b000000636f6c6c656374696f6e00072469640058921b3e6e32ab156a22b59e0224646200030000006462000000');
+$canonicalExtJson = '{"dbref": {"$ref": "collection", "$id": {"$oid": "58921b3e6e32ab156a22b59e"}, "$db": "db"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+4300000003646272656600370000000224726566000b000000636f6c6c656374696f6e00072469640058921b3e6e32ab156a22b59e0224646200030000006462000000
+{"dbref":{"$ref":"collection","$id":{"$oid":"58921b3e6e32ab156a22b59e"},"$db":"db"}}
+4300000003646272656600370000000224726566000b000000636f6c6c656374696f6e00072469640058921b3e6e32ab156a22b59e0224646200030000006462000000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/dbref-valid-003.phpt b/mongodb-1.9.0/tests/bson-corpus/dbref-valid-003.phpt
new file mode 100644
index 00000000..7292b4e5
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/dbref-valid-003.phpt
@@ -0,0 +1,31 @@
+--TEST--
+DBRef: DBRef with database and additional fields
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('48000000036462726566003c0000000224726566000b000000636f6c6c656374696f6e0010246964002a00000002246462000300000064620002666f6f0004000000626172000000');
+$canonicalExtJson = '{"dbref": {"$ref": "collection", "$id": {"$numberInt": "42"}, "$db": "db", "foo": "bar"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+48000000036462726566003c0000000224726566000b000000636f6c6c656374696f6e0010246964002a00000002246462000300000064620002666f6f0004000000626172000000
+{"dbref":{"$ref":"collection","$id":{"$numberInt":"42"},"$db":"db","foo":"bar"}}
+48000000036462726566003c0000000224726566000b000000636f6c6c656374696f6e0010246964002a00000002246462000300000064620002666f6f0004000000626172000000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/dbref-valid-004.phpt b/mongodb-1.9.0/tests/bson-corpus/dbref-valid-004.phpt
new file mode 100644
index 00000000..992513d4
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/dbref-valid-004.phpt
@@ -0,0 +1,31 @@
+--TEST--
+DBRef: DBRef with additional fields
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('4400000003646272656600380000000224726566000b000000636f6c6c656374696f6e00072469640058921b3e6e32ab156a22b59e02666f6f0004000000626172000000');
+$canonicalExtJson = '{"dbref": {"$ref": "collection", "$id": {"$oid": "58921b3e6e32ab156a22b59e"}, "foo": "bar"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+4400000003646272656600380000000224726566000b000000636f6c6c656374696f6e00072469640058921b3e6e32ab156a22b59e02666f6f0004000000626172000000
+{"dbref":{"$ref":"collection","$id":{"$oid":"58921b3e6e32ab156a22b59e"},"foo":"bar"}}
+4400000003646272656600380000000224726566000b000000636f6c6c656374696f6e00072469640058921b3e6e32ab156a22b59e02666f6f0004000000626172000000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/dbref-valid-005.phpt b/mongodb-1.9.0/tests/bson-corpus/dbref-valid-005.phpt
new file mode 100644
index 00000000..b86ba0eb
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/dbref-valid-005.phpt
@@ -0,0 +1,31 @@
+--TEST--
+DBRef: Document with key names similar to those of a DBRef
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('3e0000000224726566000c0000006e6f742d612d646272656600072469640058921b3e6e32ab156a22b59e022462616e616e6100050000007065656c0000');
+$canonicalExtJson = '{"$ref": "not-a-dbref", "$id": {"$oid": "58921b3e6e32ab156a22b59e"}, "$banana": "peel"}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+3e0000000224726566000c0000006e6f742d612d646272656600072469640058921b3e6e32ab156a22b59e022462616e616e6100050000007065656c0000
+{"$ref":"not-a-dbref","$id":{"$oid":"58921b3e6e32ab156a22b59e"},"$banana":"peel"}
+3e0000000224726566000c0000006e6f742d612d646272656600072469640058921b3e6e32ab156a22b59e022462616e616e6100050000007065656c0000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-1-valid-001.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-1-valid-001.phpt
new file mode 100644
index 00000000..6a722320
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-1-valid-001.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: Special - Canonical NaN
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000000000000000000000000000000007C00');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "NaN"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000000000000000000000000000000007c00
+{"d":{"$numberDecimal":"NaN"}}
+180000001364000000000000000000000000000000007c00
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-1-valid-002.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-1-valid-002.phpt
new file mode 100644
index 00000000..c9633b36
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-1-valid-002.phpt
@@ -0,0 +1,27 @@
+--TEST--
+Decimal128: Special - Negative NaN
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400000000000000000000000000000000FC00');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "NaN"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400000000000000000000000000000000fc00
+{"d":{"$numberDecimal":"NaN"}}
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-1-valid-003.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-1-valid-003.phpt
new file mode 100644
index 00000000..0faec74b
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-1-valid-003.phpt
@@ -0,0 +1,28 @@
+--TEST--
+Decimal128: Special - Negative NaN
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400000000000000000000000000000000FC00');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "NaN"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "-NaN"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400000000000000000000000000000000fc00
+{"d":{"$numberDecimal":"NaN"}}
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-1-valid-004.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-1-valid-004.phpt
new file mode 100644
index 00000000..ce03f058
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-1-valid-004.phpt
@@ -0,0 +1,27 @@
+--TEST--
+Decimal128: Special - Canonical SNaN
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000000000000000000000000000000007E00');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "NaN"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000000000000000000000000000000007e00
+{"d":{"$numberDecimal":"NaN"}}
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-1-valid-005.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-1-valid-005.phpt
new file mode 100644
index 00000000..08927ae7
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-1-valid-005.phpt
@@ -0,0 +1,27 @@
+--TEST--
+Decimal128: Special - Negative SNaN
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400000000000000000000000000000000FE00');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "NaN"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400000000000000000000000000000000fe00
+{"d":{"$numberDecimal":"NaN"}}
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-1-valid-006.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-1-valid-006.phpt
new file mode 100644
index 00000000..88a9810e
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-1-valid-006.phpt
@@ -0,0 +1,27 @@
+--TEST--
+Decimal128: Special - NaN with a payload
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364001200000000000000000000000000007E00');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "NaN"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364001200000000000000000000000000007e00
+{"d":{"$numberDecimal":"NaN"}}
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-1-valid-007.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-1-valid-007.phpt
new file mode 100644
index 00000000..1f389d9e
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-1-valid-007.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: Special - Canonical Positive Infinity
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000000000000000000000000000000007800');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "Infinity"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000000000000000000000000000000007800
+{"d":{"$numberDecimal":"Infinity"}}
+180000001364000000000000000000000000000000007800
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-1-valid-008.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-1-valid-008.phpt
new file mode 100644
index 00000000..382cd28b
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-1-valid-008.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: Special - Canonical Negative Infinity
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400000000000000000000000000000000F800');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "-Infinity"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400000000000000000000000000000000f800
+{"d":{"$numberDecimal":"-Infinity"}}
+18000000136400000000000000000000000000000000f800
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-1-valid-009.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-1-valid-009.phpt
new file mode 100644
index 00000000..fbb475f3
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-1-valid-009.phpt
@@ -0,0 +1,27 @@
+--TEST--
+Decimal128: Special - Invalid representation treated as 0
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000000000000000000000000000000106C00');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "0"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000000000000000000000000000000106c00
+{"d":{"$numberDecimal":"0"}}
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-1-valid-010.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-1-valid-010.phpt
new file mode 100644
index 00000000..39249498
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-1-valid-010.phpt
@@ -0,0 +1,27 @@
+--TEST--
+Decimal128: Special - Invalid representation treated as -0
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400DCBA9876543210DEADBEEF00000010EC00');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "-0"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400dcba9876543210deadbeef00000010ec00
+{"d":{"$numberDecimal":"-0"}}
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-1-valid-011.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-1-valid-011.phpt
new file mode 100644
index 00000000..fa336e77
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-1-valid-011.phpt
@@ -0,0 +1,27 @@
+--TEST--
+Decimal128: Special - Invalid representation treated as 0E3
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400FFFFFFFFFFFFFFFFFFFFFFFFFFFF116C00');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "0E+3"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400ffffffffffffffffffffffffffff116c00
+{"d":{"$numberDecimal":"0E+3"}}
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-1-valid-012.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-1-valid-012.phpt
new file mode 100644
index 00000000..9164f7a3
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-1-valid-012.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: Regular - Adjusted Exponent Limit
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400F2AF967ED05C82DE3297FF6FDE3CF22F00');
+$canonicalExtJson = '{"d": { "$numberDecimal": "0.000001234567890123456789012345678901234" }}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400f2af967ed05c82de3297ff6fde3cf22f00
+{"d":{"$numberDecimal":"0.000001234567890123456789012345678901234"}}
+18000000136400f2af967ed05c82de3297ff6fde3cf22f00
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-1-valid-013.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-1-valid-013.phpt
new file mode 100644
index 00000000..8bf13895
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-1-valid-013.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: Regular - Smallest
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400D204000000000000000000000000343000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "0.001234"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400d204000000000000000000000000343000
+{"d":{"$numberDecimal":"0.001234"}}
+18000000136400d204000000000000000000000000343000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-1-valid-014.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-1-valid-014.phpt
new file mode 100644
index 00000000..d3644c4b
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-1-valid-014.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: Regular - Smallest with Trailing Zeros
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('1800000013640040EF5A07000000000000000000002A3000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "0.00123400000"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+1800000013640040ef5a07000000000000000000002a3000
+{"d":{"$numberDecimal":"0.00123400000"}}
+1800000013640040ef5a07000000000000000000002a3000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-1-valid-015.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-1-valid-015.phpt
new file mode 100644
index 00000000..9f999c99
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-1-valid-015.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: Regular - 0.1
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('1800000013640001000000000000000000000000003E3000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "0.1"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+1800000013640001000000000000000000000000003e3000
+{"d":{"$numberDecimal":"0.1"}}
+1800000013640001000000000000000000000000003e3000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-1-valid-016.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-1-valid-016.phpt
new file mode 100644
index 00000000..e481e60c
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-1-valid-016.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: Regular - 0.1234567890123456789012345678901234
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400F2AF967ED05C82DE3297FF6FDE3CFC2F00');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "0.1234567890123456789012345678901234"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400f2af967ed05c82de3297ff6fde3cfc2f00
+{"d":{"$numberDecimal":"0.1234567890123456789012345678901234"}}
+18000000136400f2af967ed05c82de3297ff6fde3cfc2f00
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-1-valid-017.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-1-valid-017.phpt
new file mode 100644
index 00000000..3fbbba74
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-1-valid-017.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: Regular - 0
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000000000000000000000000000000403000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "0"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000000000000000000000000000000403000
+{"d":{"$numberDecimal":"0"}}
+180000001364000000000000000000000000000000403000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-1-valid-018.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-1-valid-018.phpt
new file mode 100644
index 00000000..a9f639ee
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-1-valid-018.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: Regular - -0
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400000000000000000000000000000040B000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "-0"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400000000000000000000000000000040b000
+{"d":{"$numberDecimal":"-0"}}
+18000000136400000000000000000000000000000040b000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-1-valid-019.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-1-valid-019.phpt
new file mode 100644
index 00000000..fd008d87
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-1-valid-019.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: Regular - -0.0
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('1800000013640000000000000000000000000000003EB000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "-0.0"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+1800000013640000000000000000000000000000003eb000
+{"d":{"$numberDecimal":"-0.0"}}
+1800000013640000000000000000000000000000003eb000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-1-valid-020.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-1-valid-020.phpt
new file mode 100644
index 00000000..bb105c30
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-1-valid-020.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: Regular - 2
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000200000000000000000000000000403000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "2"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000200000000000000000000000000403000
+{"d":{"$numberDecimal":"2"}}
+180000001364000200000000000000000000000000403000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-1-valid-021.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-1-valid-021.phpt
new file mode 100644
index 00000000..746ebd17
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-1-valid-021.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: Regular - 2.000
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400D0070000000000000000000000003A3000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "2.000"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400d0070000000000000000000000003a3000
+{"d":{"$numberDecimal":"2.000"}}
+18000000136400d0070000000000000000000000003a3000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-1-valid-022.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-1-valid-022.phpt
new file mode 100644
index 00000000..3893209a
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-1-valid-022.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: Regular - Largest
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400F2AF967ED05C82DE3297FF6FDE3C403000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "1234567890123456789012345678901234"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400f2af967ed05c82de3297ff6fde3c403000
+{"d":{"$numberDecimal":"1234567890123456789012345678901234"}}
+18000000136400f2af967ed05c82de3297ff6fde3c403000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-1-valid-023.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-1-valid-023.phpt
new file mode 100644
index 00000000..b7c3d5c7
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-1-valid-023.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: Scientific - Tiniest
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400FFFFFFFF638E8D37C087ADBE09ED010000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "9.999999999999999999999999999999999E-6143"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400ffffffff638e8d37c087adbe09ed010000
+{"d":{"$numberDecimal":"9.999999999999999999999999999999999E-6143"}}
+18000000136400ffffffff638e8d37c087adbe09ed010000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-1-valid-024.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-1-valid-024.phpt
new file mode 100644
index 00000000..648e775c
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-1-valid-024.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: Scientific - Tiny
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000100000000000000000000000000000000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "1E-6176"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000100000000000000000000000000000000
+{"d":{"$numberDecimal":"1E-6176"}}
+180000001364000100000000000000000000000000000000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-1-valid-025.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-1-valid-025.phpt
new file mode 100644
index 00000000..be8e53ff
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-1-valid-025.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: Scientific - Negative Tiny
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000100000000000000000000000000008000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "-1E-6176"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000100000000000000000000000000008000
+{"d":{"$numberDecimal":"-1E-6176"}}
+180000001364000100000000000000000000000000008000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-1-valid-026.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-1-valid-026.phpt
new file mode 100644
index 00000000..1833a2f5
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-1-valid-026.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: Scientific - Adjusted Exponent Limit
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400F2AF967ED05C82DE3297FF6FDE3CF02F00');
+$canonicalExtJson = '{"d": { "$numberDecimal": "1.234567890123456789012345678901234E-7" }}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400f2af967ed05c82de3297ff6fde3cf02f00
+{"d":{"$numberDecimal":"1.234567890123456789012345678901234E-7"}}
+18000000136400f2af967ed05c82de3297ff6fde3cf02f00
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-1-valid-027.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-1-valid-027.phpt
new file mode 100644
index 00000000..ce09ca28
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-1-valid-027.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: Scientific - Fractional
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('1800000013640064000000000000000000000000002CB000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "-1.00E-8"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+1800000013640064000000000000000000000000002cb000
+{"d":{"$numberDecimal":"-1.00E-8"}}
+1800000013640064000000000000000000000000002cb000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-1-valid-028.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-1-valid-028.phpt
new file mode 100644
index 00000000..97f61f00
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-1-valid-028.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: Scientific - 0 with Exponent
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000000000000000000000000000000205F00');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "0E+6000"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000000000000000000000000000000205f00
+{"d":{"$numberDecimal":"0E+6000"}}
+180000001364000000000000000000000000000000205f00
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-1-valid-029.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-1-valid-029.phpt
new file mode 100644
index 00000000..f62c572b
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-1-valid-029.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: Scientific - 0 with Negative Exponent
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('1800000013640000000000000000000000000000007A2B00');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "0E-611"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+1800000013640000000000000000000000000000007a2b00
+{"d":{"$numberDecimal":"0E-611"}}
+1800000013640000000000000000000000000000007a2b00
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-1-valid-030.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-1-valid-030.phpt
new file mode 100644
index 00000000..41d6248a
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-1-valid-030.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: Scientific - No Decimal with Signed Exponent
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000100000000000000000000000000463000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "1E+3"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000100000000000000000000000000463000
+{"d":{"$numberDecimal":"1E+3"}}
+180000001364000100000000000000000000000000463000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-1-valid-031.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-1-valid-031.phpt
new file mode 100644
index 00000000..a42c6d78
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-1-valid-031.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: Scientific - Trailing Zero
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364001A04000000000000000000000000423000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.050E+4"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364001a04000000000000000000000000423000
+{"d":{"$numberDecimal":"1.050E+4"}}
+180000001364001a04000000000000000000000000423000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-1-valid-032.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-1-valid-032.phpt
new file mode 100644
index 00000000..c7bbe5db
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-1-valid-032.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: Scientific - With Decimal
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364006900000000000000000000000000423000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.05E+3"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364006900000000000000000000000000423000
+{"d":{"$numberDecimal":"1.05E+3"}}
+180000001364006900000000000000000000000000423000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-1-valid-033.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-1-valid-033.phpt
new file mode 100644
index 00000000..a3e1d717
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-1-valid-033.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: Scientific - Full
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400FFFFFFFFFFFFFFFFFFFFFFFFFFFF403000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "5192296858534827628530496329220095"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400ffffffffffffffffffffffffffff403000
+{"d":{"$numberDecimal":"5192296858534827628530496329220095"}}
+18000000136400ffffffffffffffffffffffffffff403000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-1-valid-034.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-1-valid-034.phpt
new file mode 100644
index 00000000..cbe1fda8
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-1-valid-034.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: Scientific - Large
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400000000000A5BC138938D44C64D31FE5F00');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.000000000000000000000000000000000E+6144"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400000000000a5bc138938d44c64d31fe5f00
+{"d":{"$numberDecimal":"1.000000000000000000000000000000000E+6144"}}
+18000000136400000000000a5bc138938d44c64d31fe5f00
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-1-valid-035.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-1-valid-035.phpt
new file mode 100644
index 00000000..1e30de54
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-1-valid-035.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: Scientific - Largest
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400FFFFFFFF638E8D37C087ADBE09EDFF5F00');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "9.999999999999999999999999999999999E+6144"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400ffffffff638e8d37c087adbe09edff5f00
+{"d":{"$numberDecimal":"9.999999999999999999999999999999999E+6144"}}
+18000000136400ffffffff638e8d37c087adbe09edff5f00
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-1-valid-036.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-1-valid-036.phpt
new file mode 100644
index 00000000..3e74c5db
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-1-valid-036.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: Non-Canonical Parsing - Exponent Normalization
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('1800000013640064000000000000000000000000002CB000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "-1.00E-8"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "-100E-10"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+1800000013640064000000000000000000000000002cb000
+{"d":{"$numberDecimal":"-1.00E-8"}}
+1800000013640064000000000000000000000000002cb000
+1800000013640064000000000000000000000000002cb000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-1-valid-037.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-1-valid-037.phpt
new file mode 100644
index 00000000..b992f8b9
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-1-valid-037.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: Non-Canonical Parsing - Unsigned Positive Exponent
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000100000000000000000000000000463000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "1E+3"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "1E3"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000100000000000000000000000000463000
+{"d":{"$numberDecimal":"1E+3"}}
+180000001364000100000000000000000000000000463000
+180000001364000100000000000000000000000000463000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-1-valid-038.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-1-valid-038.phpt
new file mode 100644
index 00000000..9be978cd
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-1-valid-038.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: Non-Canonical Parsing - Lowercase Exponent Identifier
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000100000000000000000000000000463000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "1E+3"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "1e+3"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000100000000000000000000000000463000
+{"d":{"$numberDecimal":"1E+3"}}
+180000001364000100000000000000000000000000463000
+180000001364000100000000000000000000000000463000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-1-valid-039.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-1-valid-039.phpt
new file mode 100644
index 00000000..9515868f
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-1-valid-039.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: Non-Canonical Parsing - Long Significand with Exponent
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('1800000013640079D9E0F9763ADA429D0200000000583000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.2345689012345789012345E+34"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "12345689012345789012345E+12"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+1800000013640079d9e0f9763ada429d0200000000583000
+{"d":{"$numberDecimal":"1.2345689012345789012345E+34"}}
+1800000013640079d9e0f9763ada429d0200000000583000
+1800000013640079d9e0f9763ada429d0200000000583000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-1-valid-040.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-1-valid-040.phpt
new file mode 100644
index 00000000..7cd968d6
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-1-valid-040.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: Non-Canonical Parsing - Positive Sign
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400F2AF967ED05C82DE3297FF6FDE3C403000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "1234567890123456789012345678901234"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "+1234567890123456789012345678901234"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400f2af967ed05c82de3297ff6fde3c403000
+{"d":{"$numberDecimal":"1234567890123456789012345678901234"}}
+18000000136400f2af967ed05c82de3297ff6fde3c403000
+18000000136400f2af967ed05c82de3297ff6fde3c403000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-1-valid-041.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-1-valid-041.phpt
new file mode 100644
index 00000000..887a3391
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-1-valid-041.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: Non-Canonical Parsing - Long Decimal String
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000100000000000000000000000000722800');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "1E-999"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : ".000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000100000000000000000000000000722800
+{"d":{"$numberDecimal":"1E-999"}}
+180000001364000100000000000000000000000000722800
+180000001364000100000000000000000000000000722800
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-1-valid-042.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-1-valid-042.phpt
new file mode 100644
index 00000000..31439f85
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-1-valid-042.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: Non-Canonical Parsing - nan
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000000000000000000000000000000007C00');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "NaN"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "nan"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000000000000000000000000000000007c00
+{"d":{"$numberDecimal":"NaN"}}
+180000001364000000000000000000000000000000007c00
+180000001364000000000000000000000000000000007c00
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-1-valid-043.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-1-valid-043.phpt
new file mode 100644
index 00000000..e4486d24
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-1-valid-043.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: Non-Canonical Parsing - nAn
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000000000000000000000000000000007C00');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "NaN"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "nAn"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000000000000000000000000000000007c00
+{"d":{"$numberDecimal":"NaN"}}
+180000001364000000000000000000000000000000007c00
+180000001364000000000000000000000000000000007c00
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-1-valid-044.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-1-valid-044.phpt
new file mode 100644
index 00000000..05959b36
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-1-valid-044.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: Non-Canonical Parsing - +infinity
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000000000000000000000000000000007800');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "Infinity"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "+infinity"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000000000000000000000000000000007800
+{"d":{"$numberDecimal":"Infinity"}}
+180000001364000000000000000000000000000000007800
+180000001364000000000000000000000000000000007800
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-1-valid-045.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-1-valid-045.phpt
new file mode 100644
index 00000000..f5505517
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-1-valid-045.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: Non-Canonical Parsing - infinity
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000000000000000000000000000000007800');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "Infinity"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "infinity"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000000000000000000000000000000007800
+{"d":{"$numberDecimal":"Infinity"}}
+180000001364000000000000000000000000000000007800
+180000001364000000000000000000000000000000007800
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-1-valid-046.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-1-valid-046.phpt
new file mode 100644
index 00000000..9f71d287
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-1-valid-046.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: Non-Canonical Parsing - infiniTY
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000000000000000000000000000000007800');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "Infinity"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "infiniTY"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000000000000000000000000000000007800
+{"d":{"$numberDecimal":"Infinity"}}
+180000001364000000000000000000000000000000007800
+180000001364000000000000000000000000000000007800
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-1-valid-047.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-1-valid-047.phpt
new file mode 100644
index 00000000..e9788d7f
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-1-valid-047.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: Non-Canonical Parsing - inf
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000000000000000000000000000000007800');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "Infinity"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "inf"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000000000000000000000000000000007800
+{"d":{"$numberDecimal":"Infinity"}}
+180000001364000000000000000000000000000000007800
+180000001364000000000000000000000000000000007800
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-1-valid-048.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-1-valid-048.phpt
new file mode 100644
index 00000000..9a098a57
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-1-valid-048.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: Non-Canonical Parsing - inF
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000000000000000000000000000000007800');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "Infinity"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "inF"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000000000000000000000000000000007800
+{"d":{"$numberDecimal":"Infinity"}}
+180000001364000000000000000000000000000000007800
+180000001364000000000000000000000000000000007800
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-1-valid-049.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-1-valid-049.phpt
new file mode 100644
index 00000000..c47268c0
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-1-valid-049.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: Non-Canonical Parsing - -infinity
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400000000000000000000000000000000F800');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "-Infinity"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "-infinity"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400000000000000000000000000000000f800
+{"d":{"$numberDecimal":"-Infinity"}}
+18000000136400000000000000000000000000000000f800
+18000000136400000000000000000000000000000000f800
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-1-valid-050.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-1-valid-050.phpt
new file mode 100644
index 00000000..e3059d95
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-1-valid-050.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: Non-Canonical Parsing - -infiniTy
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400000000000000000000000000000000F800');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "-Infinity"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "-infiniTy"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400000000000000000000000000000000f800
+{"d":{"$numberDecimal":"-Infinity"}}
+18000000136400000000000000000000000000000000f800
+18000000136400000000000000000000000000000000f800
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-1-valid-051.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-1-valid-051.phpt
new file mode 100644
index 00000000..fe5c8bdb
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-1-valid-051.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: Non-Canonical Parsing - -Inf
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400000000000000000000000000000000F800');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "-Infinity"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "-Infinity"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400000000000000000000000000000000f800
+{"d":{"$numberDecimal":"-Infinity"}}
+18000000136400000000000000000000000000000000f800
+18000000136400000000000000000000000000000000f800
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-1-valid-052.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-1-valid-052.phpt
new file mode 100644
index 00000000..8444f1e2
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-1-valid-052.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: Non-Canonical Parsing - -inf
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400000000000000000000000000000000F800');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "-Infinity"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "-inf"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400000000000000000000000000000000f800
+{"d":{"$numberDecimal":"-Infinity"}}
+18000000136400000000000000000000000000000000f800
+18000000136400000000000000000000000000000000f800
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-1-valid-053.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-1-valid-053.phpt
new file mode 100644
index 00000000..0ff23e53
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-1-valid-053.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: Non-Canonical Parsing - -inF
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400000000000000000000000000000000F800');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "-Infinity"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "-inF"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400000000000000000000000000000000f800
+{"d":{"$numberDecimal":"-Infinity"}}
+18000000136400000000000000000000000000000000f800
+18000000136400000000000000000000000000000000f800
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-1-valid-054.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-1-valid-054.phpt
new file mode 100644
index 00000000..2831a4c9
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-1-valid-054.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: Rounded Subnormal number
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000100000000000000000000000000000000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "1E-6176"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "10E-6177"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000100000000000000000000000000000000
+{"d":{"$numberDecimal":"1E-6176"}}
+180000001364000100000000000000000000000000000000
+180000001364000100000000000000000000000000000000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-1-valid-055.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-1-valid-055.phpt
new file mode 100644
index 00000000..1d44f3fc
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-1-valid-055.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: Clamped
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000a00000000000000000000000000fe5f00');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.0E+6112"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "1E6112"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000a00000000000000000000000000fe5f00
+{"d":{"$numberDecimal":"1.0E+6112"}}
+180000001364000a00000000000000000000000000fe5f00
+180000001364000a00000000000000000000000000fe5f00
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-1-valid-056.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-1-valid-056.phpt
new file mode 100644
index 00000000..68ae68d5
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-1-valid-056.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: Exact rounding
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400000000000a5bc138938d44c64d31cc3700');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.000000000000000000000000000000000E+999"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400000000000a5bc138938d44c64d31cc3700
+{"d":{"$numberDecimal":"1.000000000000000000000000000000000E+999"}}
+18000000136400000000000a5bc138938d44c64d31cc3700
+18000000136400000000000a5bc138938d44c64d31cc3700
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-001.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-001.phpt
new file mode 100644
index 00000000..46158ddc
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-001.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [decq021] Normality
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400F2AF967ED05C82DE3297FF6FDE3C40B000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "-1234567890123456789012345678901234"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400f2af967ed05c82de3297ff6fde3c40b000
+{"d":{"$numberDecimal":"-1234567890123456789012345678901234"}}
+18000000136400f2af967ed05c82de3297ff6fde3c40b000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-002.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-002.phpt
new file mode 100644
index 00000000..f89c6d63
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-002.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [decq823] values around [u]int32 edges (zeros done earlier)
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400010000800000000000000000000040B000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "-2147483649"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400010000800000000000000000000040b000
+{"d":{"$numberDecimal":"-2147483649"}}
+18000000136400010000800000000000000000000040b000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-003.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-003.phpt
new file mode 100644
index 00000000..898ae3d7
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-003.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [decq822] values around [u]int32 edges (zeros done earlier)
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400000000800000000000000000000040B000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "-2147483648"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400000000800000000000000000000040b000
+{"d":{"$numberDecimal":"-2147483648"}}
+18000000136400000000800000000000000000000040b000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-004.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-004.phpt
new file mode 100644
index 00000000..e3c226f0
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-004.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [decq821] values around [u]int32 edges (zeros done earlier)
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400FFFFFF7F0000000000000000000040B000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "-2147483647"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400ffffff7f0000000000000000000040b000
+{"d":{"$numberDecimal":"-2147483647"}}
+18000000136400ffffff7f0000000000000000000040b000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-005.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-005.phpt
new file mode 100644
index 00000000..dd5d2ba0
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-005.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [decq820] values around [u]int32 edges (zeros done earlier)
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400FEFFFF7F0000000000000000000040B000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "-2147483646"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400feffff7f0000000000000000000040b000
+{"d":{"$numberDecimal":"-2147483646"}}
+18000000136400feffff7f0000000000000000000040b000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-006.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-006.phpt
new file mode 100644
index 00000000..932754e5
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-006.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [decq152] fold-downs (more below)
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400393000000000000000000000000040B000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "-12345"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400393000000000000000000000000040b000
+{"d":{"$numberDecimal":"-12345"}}
+18000000136400393000000000000000000000000040b000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-007.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-007.phpt
new file mode 100644
index 00000000..884db78e
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-007.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [decq154] fold-downs (more below)
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400D20400000000000000000000000040B000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "-1234"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400d20400000000000000000000000040b000
+{"d":{"$numberDecimal":"-1234"}}
+18000000136400d20400000000000000000000000040b000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-008.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-008.phpt
new file mode 100644
index 00000000..1059e7b0
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-008.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [decq006] derivative canonical plain strings
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400EE0200000000000000000000000040B000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "-750"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400ee0200000000000000000000000040b000
+{"d":{"$numberDecimal":"-750"}}
+18000000136400ee0200000000000000000000000040b000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-009.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-009.phpt
new file mode 100644
index 00000000..cfe3dbd4
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-009.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [decq164] fold-downs (more below)
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('1800000013640039300000000000000000000000003CB000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "-123.45"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+1800000013640039300000000000000000000000003cb000
+{"d":{"$numberDecimal":"-123.45"}}
+1800000013640039300000000000000000000000003cb000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-010.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-010.phpt
new file mode 100644
index 00000000..329bcb7b
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-010.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [decq156] fold-downs (more below)
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364007B0000000000000000000000000040B000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "-123"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364007b0000000000000000000000000040b000
+{"d":{"$numberDecimal":"-123"}}
+180000001364007b0000000000000000000000000040b000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-011.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-011.phpt
new file mode 100644
index 00000000..76c7a2b8
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-011.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [decq008] derivative canonical plain strings
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400EE020000000000000000000000003EB000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "-75.0"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400ee020000000000000000000000003eb000
+{"d":{"$numberDecimal":"-75.0"}}
+18000000136400ee020000000000000000000000003eb000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-012.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-012.phpt
new file mode 100644
index 00000000..e9d1d2b3
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-012.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [decq158] fold-downs (more below)
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000C0000000000000000000000000040B000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "-12"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000c0000000000000000000000000040b000
+{"d":{"$numberDecimal":"-12"}}
+180000001364000c0000000000000000000000000040b000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-013.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-013.phpt
new file mode 100644
index 00000000..406439ef
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-013.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [decq122] Nmax and similar
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400FFFFFFFF638E8D37C087ADBE09EDFFDF00');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "-9.999999999999999999999999999999999E+6144"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400ffffffff638e8d37c087adbe09edffdf00
+{"d":{"$numberDecimal":"-9.999999999999999999999999999999999E+6144"}}
+18000000136400ffffffff638e8d37c087adbe09edffdf00
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-014.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-014.phpt
new file mode 100644
index 00000000..a34df5a6
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-014.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [decq002] (mostly derived from the Strawman 4 document and examples)
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400EE020000000000000000000000003CB000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "-7.50"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400ee020000000000000000000000003cb000
+{"d":{"$numberDecimal":"-7.50"}}
+18000000136400ee020000000000000000000000003cb000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-015.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-015.phpt
new file mode 100644
index 00000000..f291e8c3
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-015.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [decq004] derivative canonical plain strings
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400EE0200000000000000000000000042B000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "-7.50E+3"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400ee0200000000000000000000000042b000
+{"d":{"$numberDecimal":"-7.50E+3"}}
+18000000136400ee0200000000000000000000000042b000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-016.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-016.phpt
new file mode 100644
index 00000000..208cbfcc
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-016.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [decq018] derivative canonical plain strings
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400EE020000000000000000000000002EB000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "-7.50E-7"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400ee020000000000000000000000002eb000
+{"d":{"$numberDecimal":"-7.50E-7"}}
+18000000136400ee020000000000000000000000002eb000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-017.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-017.phpt
new file mode 100644
index 00000000..bd801147
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-017.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [decq125] Nmax and similar
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400F2AF967ED05C82DE3297FF6FDE3CFEDF00');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "-1.234567890123456789012345678901234E+6144"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400f2af967ed05c82de3297ff6fde3cfedf00
+{"d":{"$numberDecimal":"-1.234567890123456789012345678901234E+6144"}}
+18000000136400f2af967ed05c82de3297ff6fde3cfedf00
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-018.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-018.phpt
new file mode 100644
index 00000000..8842a505
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-018.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [decq131] fold-downs (more below)
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400000000807F1BCF85B27059C8A43CFEDF00');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "-1.230000000000000000000000000000000E+6144"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400000000807f1bcf85b27059c8a43cfedf00
+{"d":{"$numberDecimal":"-1.230000000000000000000000000000000E+6144"}}
+18000000136400000000807f1bcf85b27059c8a43cfedf00
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-019.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-019.phpt
new file mode 100644
index 00000000..49ec7188
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-019.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [decq162] fold-downs (more below)
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364007B000000000000000000000000003CB000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "-1.23"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364007b000000000000000000000000003cb000
+{"d":{"$numberDecimal":"-1.23"}}
+180000001364007b000000000000000000000000003cb000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-020.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-020.phpt
new file mode 100644
index 00000000..30e32aeb
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-020.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [decq176] Nmin and below
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400010000000A5BC138938D44C64D31008000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "-1.000000000000000000000000000000001E-6143"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400010000000a5bc138938d44c64d31008000
+{"d":{"$numberDecimal":"-1.000000000000000000000000000000001E-6143"}}
+18000000136400010000000a5bc138938d44c64d31008000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-021.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-021.phpt
new file mode 100644
index 00000000..3392bc03
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-021.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [decq174] Nmin and below
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400000000000A5BC138938D44C64D31008000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "-1.000000000000000000000000000000000E-6143"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400000000000a5bc138938d44c64d31008000
+{"d":{"$numberDecimal":"-1.000000000000000000000000000000000E-6143"}}
+18000000136400000000000a5bc138938d44c64d31008000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-022.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-022.phpt
new file mode 100644
index 00000000..87d88683
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-022.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [decq133] fold-downs (more below)
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400000000000A5BC138938D44C64D31FEDF00');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "-1.000000000000000000000000000000000E+6144"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400000000000a5bc138938d44c64d31fedf00
+{"d":{"$numberDecimal":"-1.000000000000000000000000000000000E+6144"}}
+18000000136400000000000a5bc138938d44c64d31fedf00
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-023.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-023.phpt
new file mode 100644
index 00000000..90fb190c
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-023.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [decq160] fold-downs (more below)
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400010000000000000000000000000040B000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "-1"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400010000000000000000000000000040b000
+{"d":{"$numberDecimal":"-1"}}
+18000000136400010000000000000000000000000040b000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-024.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-024.phpt
new file mode 100644
index 00000000..963d3c42
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-024.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [decq172] Nmin and below
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000100000000000000000000000000428000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "-1E-6143"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000100000000000000000000000000428000
+{"d":{"$numberDecimal":"-1E-6143"}}
+180000001364000100000000000000000000000000428000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-025.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-025.phpt
new file mode 100644
index 00000000..db39d01e
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-025.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [decq010] derivative canonical plain strings
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400EE020000000000000000000000003AB000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "-0.750"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400ee020000000000000000000000003ab000
+{"d":{"$numberDecimal":"-0.750"}}
+18000000136400ee020000000000000000000000003ab000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-026.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-026.phpt
new file mode 100644
index 00000000..64069996
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-026.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [decq012] derivative canonical plain strings
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400EE0200000000000000000000000038B000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "-0.0750"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400ee0200000000000000000000000038b000
+{"d":{"$numberDecimal":"-0.0750"}}
+18000000136400ee0200000000000000000000000038b000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-027.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-027.phpt
new file mode 100644
index 00000000..70b274ea
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-027.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [decq014] derivative canonical plain strings
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400EE0200000000000000000000000034B000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "-0.000750"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400ee0200000000000000000000000034b000
+{"d":{"$numberDecimal":"-0.000750"}}
+18000000136400ee0200000000000000000000000034b000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-028.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-028.phpt
new file mode 100644
index 00000000..750f2c79
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-028.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [decq016] derivative canonical plain strings
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400EE0200000000000000000000000030B000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "-0.00000750"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400ee0200000000000000000000000030b000
+{"d":{"$numberDecimal":"-0.00000750"}}
+18000000136400ee0200000000000000000000000030b000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-029.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-029.phpt
new file mode 100644
index 00000000..1e41506f
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-029.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [decq404] zeros
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000000000000000000000000000000000000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "0E-6176"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000000000000000000000000000000000000
+{"d":{"$numberDecimal":"0E-6176"}}
+180000001364000000000000000000000000000000000000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-030.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-030.phpt
new file mode 100644
index 00000000..b4096af1
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-030.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [decq424] negative zeros
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000000000000000000000000000000008000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "-0E-6176"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000000000000000000000000000000008000
+{"d":{"$numberDecimal":"-0E-6176"}}
+180000001364000000000000000000000000000000008000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-031.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-031.phpt
new file mode 100644
index 00000000..bd1500ec
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-031.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [decq407] zeros
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('1800000013640000000000000000000000000000003C3000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "0.00"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+1800000013640000000000000000000000000000003c3000
+{"d":{"$numberDecimal":"0.00"}}
+1800000013640000000000000000000000000000003c3000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-032.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-032.phpt
new file mode 100644
index 00000000..6989caa1
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-032.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [decq427] negative zeros
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('1800000013640000000000000000000000000000003CB000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "-0.00"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+1800000013640000000000000000000000000000003cb000
+{"d":{"$numberDecimal":"-0.00"}}
+1800000013640000000000000000000000000000003cb000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-033.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-033.phpt
new file mode 100644
index 00000000..75a34e77
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-033.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [decq409] zeros
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000000000000000000000000000000403000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "0"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000000000000000000000000000000403000
+{"d":{"$numberDecimal":"0"}}
+180000001364000000000000000000000000000000403000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-034.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-034.phpt
new file mode 100644
index 00000000..ccedfa42
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-034.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [decq428] negative zeros
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400000000000000000000000000000040B000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "-0"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400000000000000000000000000000040b000
+{"d":{"$numberDecimal":"-0"}}
+18000000136400000000000000000000000000000040b000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-035.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-035.phpt
new file mode 100644
index 00000000..6da0be58
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-035.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [decq700] Selected DPD codes
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000000000000000000000000000000403000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "0"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000000000000000000000000000000403000
+{"d":{"$numberDecimal":"0"}}
+180000001364000000000000000000000000000000403000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-036.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-036.phpt
new file mode 100644
index 00000000..d850c7ba
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-036.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [decq406] zeros
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('1800000013640000000000000000000000000000003C3000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "0.00"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+1800000013640000000000000000000000000000003c3000
+{"d":{"$numberDecimal":"0.00"}}
+1800000013640000000000000000000000000000003c3000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-037.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-037.phpt
new file mode 100644
index 00000000..e70260ad
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-037.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [decq426] negative zeros
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('1800000013640000000000000000000000000000003CB000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "-0.00"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+1800000013640000000000000000000000000000003cb000
+{"d":{"$numberDecimal":"-0.00"}}
+1800000013640000000000000000000000000000003cb000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-038.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-038.phpt
new file mode 100644
index 00000000..4dfe8707
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-038.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [decq410] zeros
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000000000000000000000000000000463000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "0E+3"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000000000000000000000000000000463000
+{"d":{"$numberDecimal":"0E+3"}}
+180000001364000000000000000000000000000000463000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-039.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-039.phpt
new file mode 100644
index 00000000..060cf7fa
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-039.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [decq431] negative zeros
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400000000000000000000000000000046B000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "-0E+3"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400000000000000000000000000000046b000
+{"d":{"$numberDecimal":"-0E+3"}}
+18000000136400000000000000000000000000000046b000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-040.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-040.phpt
new file mode 100644
index 00000000..efe7757e
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-040.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [decq419] clamped zeros...
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000000000000000000000000000000FE5F00');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "0E+6111"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000000000000000000000000000000fe5f00
+{"d":{"$numberDecimal":"0E+6111"}}
+180000001364000000000000000000000000000000fe5f00
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-041.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-041.phpt
new file mode 100644
index 00000000..69beb539
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-041.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [decq432] negative zeros
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000000000000000000000000000000FEDF00');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "-0E+6111"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000000000000000000000000000000fedf00
+{"d":{"$numberDecimal":"-0E+6111"}}
+180000001364000000000000000000000000000000fedf00
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-042.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-042.phpt
new file mode 100644
index 00000000..e7329b48
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-042.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [decq405] zeros
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000000000000000000000000000000000000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "0E-6176"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000000000000000000000000000000000000
+{"d":{"$numberDecimal":"0E-6176"}}
+180000001364000000000000000000000000000000000000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-043.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-043.phpt
new file mode 100644
index 00000000..2d401254
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-043.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [decq425] negative zeros
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000000000000000000000000000000008000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "-0E-6176"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000000000000000000000000000000008000
+{"d":{"$numberDecimal":"-0E-6176"}}
+180000001364000000000000000000000000000000008000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-044.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-044.phpt
new file mode 100644
index 00000000..798c5451
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-044.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [decq508] Specials
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000000000000000000000000000000007800');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "Infinity"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000000000000000000000000000000007800
+{"d":{"$numberDecimal":"Infinity"}}
+180000001364000000000000000000000000000000007800
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-045.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-045.phpt
new file mode 100644
index 00000000..d7adb925
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-045.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [decq528] Specials
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400000000000000000000000000000000F800');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "-Infinity"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400000000000000000000000000000000f800
+{"d":{"$numberDecimal":"-Infinity"}}
+18000000136400000000000000000000000000000000f800
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-046.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-046.phpt
new file mode 100644
index 00000000..d4167280
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-046.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [decq541] Specials
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000000000000000000000000000000007C00');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "NaN"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000000000000000000000000000000007c00
+{"d":{"$numberDecimal":"NaN"}}
+180000001364000000000000000000000000000000007c00
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-047.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-047.phpt
new file mode 100644
index 00000000..0cb82ef6
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-047.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [decq074] Nmin and below
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400000000000A5BC138938D44C64D31000000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.000000000000000000000000000000000E-6143"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400000000000a5bc138938d44c64d31000000
+{"d":{"$numberDecimal":"1.000000000000000000000000000000000E-6143"}}
+18000000136400000000000a5bc138938d44c64d31000000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-048.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-048.phpt
new file mode 100644
index 00000000..f5fc4ec2
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-048.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [decq602] fold-down full sequence
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400000000000A5BC138938D44C64D31FE5F00');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.000000000000000000000000000000000E+6144"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400000000000a5bc138938d44c64d31fe5f00
+{"d":{"$numberDecimal":"1.000000000000000000000000000000000E+6144"}}
+18000000136400000000000a5bc138938d44c64d31fe5f00
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-049.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-049.phpt
new file mode 100644
index 00000000..faaae1c2
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-049.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [decq604] fold-down full sequence
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000000000081EFAC855B416D2DEE04FE5F00');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.00000000000000000000000000000000E+6143"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000000000081efac855b416d2dee04fe5f00
+{"d":{"$numberDecimal":"1.00000000000000000000000000000000E+6143"}}
+180000001364000000000081efac855b416d2dee04fe5f00
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-050.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-050.phpt
new file mode 100644
index 00000000..5b9da546
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-050.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [decq606] fold-down full sequence
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('1800000013640000000080264B91C02220BE377E00FE5F00');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.0000000000000000000000000000000E+6142"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+1800000013640000000080264b91c02220be377e00fe5f00
+{"d":{"$numberDecimal":"1.0000000000000000000000000000000E+6142"}}
+1800000013640000000080264b91c02220be377e00fe5f00
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-051.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-051.phpt
new file mode 100644
index 00000000..480baf4b
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-051.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [decq608] fold-down full sequence
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('1800000013640000000040EAED7446D09C2C9F0C00FE5F00');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.000000000000000000000000000000E+6141"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+1800000013640000000040eaed7446d09c2c9f0c00fe5f00
+{"d":{"$numberDecimal":"1.000000000000000000000000000000E+6141"}}
+1800000013640000000040eaed7446d09c2c9f0c00fe5f00
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-052.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-052.phpt
new file mode 100644
index 00000000..d5d20197
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-052.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [decq610] fold-down full sequence
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400000000A0CA17726DAE0F1E430100FE5F00');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.00000000000000000000000000000E+6140"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400000000a0ca17726dae0f1e430100fe5f00
+{"d":{"$numberDecimal":"1.00000000000000000000000000000E+6140"}}
+18000000136400000000a0ca17726dae0f1e430100fe5f00
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-053.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-053.phpt
new file mode 100644
index 00000000..dfd62fb1
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-053.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [decq612] fold-down full sequence
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400000000106102253E5ECE4F200000FE5F00');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.0000000000000000000000000000E+6139"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400000000106102253e5ece4f200000fe5f00
+{"d":{"$numberDecimal":"1.0000000000000000000000000000E+6139"}}
+18000000136400000000106102253e5ece4f200000fe5f00
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-054.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-054.phpt
new file mode 100644
index 00000000..fe64773e
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-054.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [decq614] fold-down full sequence
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400000000E83C80D09F3C2E3B030000FE5F00');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.000000000000000000000000000E+6138"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400000000e83c80d09f3c2e3b030000fe5f00
+{"d":{"$numberDecimal":"1.000000000000000000000000000E+6138"}}
+18000000136400000000e83c80d09f3c2e3b030000fe5f00
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-055.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-055.phpt
new file mode 100644
index 00000000..d3699df8
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-055.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [decq616] fold-down full sequence
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400000000E4D20CC8DCD2B752000000FE5F00');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.00000000000000000000000000E+6137"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400000000e4d20cc8dcd2b752000000fe5f00
+{"d":{"$numberDecimal":"1.00000000000000000000000000E+6137"}}
+18000000136400000000e4d20cc8dcd2b752000000fe5f00
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-056.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-056.phpt
new file mode 100644
index 00000000..7f13cfa1
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-056.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [decq618] fold-down full sequence
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000000004A48011416954508000000FE5F00');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.0000000000000000000000000E+6136"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000000004a48011416954508000000fe5f00
+{"d":{"$numberDecimal":"1.0000000000000000000000000E+6136"}}
+180000001364000000004a48011416954508000000fe5f00
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-057.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-057.phpt
new file mode 100644
index 00000000..26ad3075
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-057.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [decq620] fold-down full sequence
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400000000A1EDCCCE1BC2D300000000FE5F00');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.000000000000000000000000E+6135"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400000000a1edccce1bc2d300000000fe5f00
+{"d":{"$numberDecimal":"1.000000000000000000000000E+6135"}}
+18000000136400000000a1edccce1bc2d300000000fe5f00
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-058.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-058.phpt
new file mode 100644
index 00000000..16418cbd
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-058.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [decq622] fold-down full sequence
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400000080F64AE1C7022D1500000000FE5F00');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.00000000000000000000000E+6134"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400000080f64ae1c7022d1500000000fe5f00
+{"d":{"$numberDecimal":"1.00000000000000000000000E+6134"}}
+18000000136400000080f64ae1c7022d1500000000fe5f00
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-059.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-059.phpt
new file mode 100644
index 00000000..c6c10387
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-059.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [decq624] fold-down full sequence
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400000040B2BAC9E0191E0200000000FE5F00');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.0000000000000000000000E+6133"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400000040b2bac9e0191e0200000000fe5f00
+{"d":{"$numberDecimal":"1.0000000000000000000000E+6133"}}
+18000000136400000040b2bac9e0191e0200000000fe5f00
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-060.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-060.phpt
new file mode 100644
index 00000000..7f9e3dba
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-060.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [decq626] fold-down full sequence
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000000A0DEC5ADC935360000000000FE5F00');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.000000000000000000000E+6132"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000000a0dec5adc935360000000000fe5f00
+{"d":{"$numberDecimal":"1.000000000000000000000E+6132"}}
+180000001364000000a0dec5adc935360000000000fe5f00
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-061.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-061.phpt
new file mode 100644
index 00000000..dc1e7b15
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-061.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [decq628] fold-down full sequence
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400000010632D5EC76B050000000000FE5F00');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.00000000000000000000E+6131"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400000010632d5ec76b050000000000fe5f00
+{"d":{"$numberDecimal":"1.00000000000000000000E+6131"}}
+18000000136400000010632d5ec76b050000000000fe5f00
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-062.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-062.phpt
new file mode 100644
index 00000000..e11d1d62
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-062.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [decq630] fold-down full sequence
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000000E8890423C78A000000000000FE5F00');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.0000000000000000000E+6130"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000000e8890423c78a000000000000fe5f00
+{"d":{"$numberDecimal":"1.0000000000000000000E+6130"}}
+180000001364000000e8890423c78a000000000000fe5f00
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-063.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-063.phpt
new file mode 100644
index 00000000..fff595a5
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-063.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [decq632] fold-down full sequence
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400000064A7B3B6E00D000000000000FE5F00');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.000000000000000000E+6129"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400000064a7b3b6e00d000000000000fe5f00
+{"d":{"$numberDecimal":"1.000000000000000000E+6129"}}
+18000000136400000064a7b3b6e00d000000000000fe5f00
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-064.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-064.phpt
new file mode 100644
index 00000000..9b509533
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-064.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [decq634] fold-down full sequence
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('1800000013640000008A5D78456301000000000000FE5F00');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.00000000000000000E+6128"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+1800000013640000008a5d78456301000000000000fe5f00
+{"d":{"$numberDecimal":"1.00000000000000000E+6128"}}
+1800000013640000008a5d78456301000000000000fe5f00
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-065.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-065.phpt
new file mode 100644
index 00000000..94d1d8fa
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-065.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [decq636] fold-down full sequence
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000000C16FF2862300000000000000FE5F00');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.0000000000000000E+6127"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000000c16ff2862300000000000000fe5f00
+{"d":{"$numberDecimal":"1.0000000000000000E+6127"}}
+180000001364000000c16ff2862300000000000000fe5f00
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-066.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-066.phpt
new file mode 100644
index 00000000..733c6650
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-066.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [decq638] fold-down full sequence
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000080C6A47E8D0300000000000000FE5F00');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.000000000000000E+6126"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000080c6a47e8d0300000000000000fe5f00
+{"d":{"$numberDecimal":"1.000000000000000E+6126"}}
+180000001364000080c6a47e8d0300000000000000fe5f00
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-067.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-067.phpt
new file mode 100644
index 00000000..444363e9
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-067.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [decq640] fold-down full sequence
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('1800000013640000407A10F35A0000000000000000FE5F00');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.00000000000000E+6125"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+1800000013640000407a10f35a0000000000000000fe5f00
+{"d":{"$numberDecimal":"1.00000000000000E+6125"}}
+1800000013640000407a10f35a0000000000000000fe5f00
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-068.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-068.phpt
new file mode 100644
index 00000000..447487a3
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-068.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [decq642] fold-down full sequence
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('1800000013640000A0724E18090000000000000000FE5F00');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.0000000000000E+6124"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+1800000013640000a0724e18090000000000000000fe5f00
+{"d":{"$numberDecimal":"1.0000000000000E+6124"}}
+1800000013640000a0724e18090000000000000000fe5f00
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-069.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-069.phpt
new file mode 100644
index 00000000..e30ff238
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-069.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [decq644] fold-down full sequence
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000010A5D4E8000000000000000000FE5F00');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.000000000000E+6123"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000010a5d4e8000000000000000000fe5f00
+{"d":{"$numberDecimal":"1.000000000000E+6123"}}
+180000001364000010a5d4e8000000000000000000fe5f00
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-070.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-070.phpt
new file mode 100644
index 00000000..0acf16b6
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-070.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [decq646] fold-down full sequence
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('1800000013640000E8764817000000000000000000FE5F00');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.00000000000E+6122"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+1800000013640000e8764817000000000000000000fe5f00
+{"d":{"$numberDecimal":"1.00000000000E+6122"}}
+1800000013640000e8764817000000000000000000fe5f00
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-071.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-071.phpt
new file mode 100644
index 00000000..4f781924
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-071.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [decq648] fold-down full sequence
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('1800000013640000E40B5402000000000000000000FE5F00');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.0000000000E+6121"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+1800000013640000e40b5402000000000000000000fe5f00
+{"d":{"$numberDecimal":"1.0000000000E+6121"}}
+1800000013640000e40b5402000000000000000000fe5f00
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-072.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-072.phpt
new file mode 100644
index 00000000..ae06bd47
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-072.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [decq650] fold-down full sequence
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('1800000013640000CA9A3B00000000000000000000FE5F00');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.000000000E+6120"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+1800000013640000ca9a3b00000000000000000000fe5f00
+{"d":{"$numberDecimal":"1.000000000E+6120"}}
+1800000013640000ca9a3b00000000000000000000fe5f00
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-073.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-073.phpt
new file mode 100644
index 00000000..a46fad74
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-073.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [decq652] fold-down full sequence
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('1800000013640000E1F50500000000000000000000FE5F00');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.00000000E+6119"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+1800000013640000e1f50500000000000000000000fe5f00
+{"d":{"$numberDecimal":"1.00000000E+6119"}}
+1800000013640000e1f50500000000000000000000fe5f00
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-074.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-074.phpt
new file mode 100644
index 00000000..e6902c9e
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-074.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [decq654] fold-down full sequence
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364008096980000000000000000000000FE5F00');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.0000000E+6118"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364008096980000000000000000000000fe5f00
+{"d":{"$numberDecimal":"1.0000000E+6118"}}
+180000001364008096980000000000000000000000fe5f00
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-075.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-075.phpt
new file mode 100644
index 00000000..e0d2f819
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-075.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [decq656] fold-down full sequence
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('1800000013640040420F0000000000000000000000FE5F00');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.000000E+6117"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+1800000013640040420f0000000000000000000000fe5f00
+{"d":{"$numberDecimal":"1.000000E+6117"}}
+1800000013640040420f0000000000000000000000fe5f00
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-076.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-076.phpt
new file mode 100644
index 00000000..2a703811
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-076.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [decq658] fold-down full sequence
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400A086010000000000000000000000FE5F00');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.00000E+6116"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400a086010000000000000000000000fe5f00
+{"d":{"$numberDecimal":"1.00000E+6116"}}
+18000000136400a086010000000000000000000000fe5f00
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-077.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-077.phpt
new file mode 100644
index 00000000..b91d2c97
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-077.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [decq660] fold-down full sequence
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364001027000000000000000000000000FE5F00');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.0000E+6115"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364001027000000000000000000000000fe5f00
+{"d":{"$numberDecimal":"1.0000E+6115"}}
+180000001364001027000000000000000000000000fe5f00
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-078.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-078.phpt
new file mode 100644
index 00000000..8afe1a68
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-078.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [decq662] fold-down full sequence
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400E803000000000000000000000000FE5F00');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.000E+6114"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400e803000000000000000000000000fe5f00
+{"d":{"$numberDecimal":"1.000E+6114"}}
+18000000136400e803000000000000000000000000fe5f00
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-079.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-079.phpt
new file mode 100644
index 00000000..06f5337d
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-079.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [decq664] fold-down full sequence
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364006400000000000000000000000000FE5F00');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.00E+6113"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364006400000000000000000000000000fe5f00
+{"d":{"$numberDecimal":"1.00E+6113"}}
+180000001364006400000000000000000000000000fe5f00
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-080.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-080.phpt
new file mode 100644
index 00000000..79773967
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-080.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [decq666] fold-down full sequence
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000A00000000000000000000000000FE5F00');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.0E+6112"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000a00000000000000000000000000fe5f00
+{"d":{"$numberDecimal":"1.0E+6112"}}
+180000001364000a00000000000000000000000000fe5f00
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-081.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-081.phpt
new file mode 100644
index 00000000..b78ee54e
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-081.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [decq060] fold-downs (more below)
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000100000000000000000000000000403000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "1"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000100000000000000000000000000403000
+{"d":{"$numberDecimal":"1"}}
+180000001364000100000000000000000000000000403000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-082.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-082.phpt
new file mode 100644
index 00000000..1fe914fa
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-082.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [decq670] fold-down full sequence
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000100000000000000000000000000FC5F00');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "1E+6110"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000100000000000000000000000000fc5f00
+{"d":{"$numberDecimal":"1E+6110"}}
+180000001364000100000000000000000000000000fc5f00
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-083.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-083.phpt
new file mode 100644
index 00000000..6376046c
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-083.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [decq668] fold-down full sequence
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000100000000000000000000000000FE5F00');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "1E+6111"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000100000000000000000000000000fe5f00
+{"d":{"$numberDecimal":"1E+6111"}}
+180000001364000100000000000000000000000000fe5f00
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-084.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-084.phpt
new file mode 100644
index 00000000..b9a004d7
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-084.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [decq072] Nmin and below
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000100000000000000000000000000420000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "1E-6143"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000100000000000000000000000000420000
+{"d":{"$numberDecimal":"1E-6143"}}
+180000001364000100000000000000000000000000420000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-085.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-085.phpt
new file mode 100644
index 00000000..c0bf48ea
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-085.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [decq076] Nmin and below
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400010000000A5BC138938D44C64D31000000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.000000000000000000000000000000001E-6143"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400010000000a5bc138938d44c64d31000000
+{"d":{"$numberDecimal":"1.000000000000000000000000000000001E-6143"}}
+18000000136400010000000a5bc138938d44c64d31000000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-086.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-086.phpt
new file mode 100644
index 00000000..dda319c4
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-086.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [decq036] fold-downs (more below)
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400000000807F1BCF85B27059C8A43CFE5F00');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.230000000000000000000000000000000E+6144"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400000000807f1bcf85b27059c8a43cfe5f00
+{"d":{"$numberDecimal":"1.230000000000000000000000000000000E+6144"}}
+18000000136400000000807f1bcf85b27059c8a43cfe5f00
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-087.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-087.phpt
new file mode 100644
index 00000000..85c91374
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-087.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [decq062] fold-downs (more below)
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364007B000000000000000000000000003C3000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.23"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364007b000000000000000000000000003c3000
+{"d":{"$numberDecimal":"1.23"}}
+180000001364007b000000000000000000000000003c3000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-088.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-088.phpt
new file mode 100644
index 00000000..ba23a7f9
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-088.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [decq034] Nmax and similar
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400F2AF967ED05C82DE3297FF6FDE3CFE5F00');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.234567890123456789012345678901234E+6144"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400f2af967ed05c82de3297ff6fde3cfe5f00
+{"d":{"$numberDecimal":"1.234567890123456789012345678901234E+6144"}}
+18000000136400f2af967ed05c82de3297ff6fde3cfe5f00
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-089.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-089.phpt
new file mode 100644
index 00000000..bfc8531e
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-089.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [decq441] exponent lengths
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000700000000000000000000000000403000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "7"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000700000000000000000000000000403000
+{"d":{"$numberDecimal":"7"}}
+180000001364000700000000000000000000000000403000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-090.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-090.phpt
new file mode 100644
index 00000000..ccc01a02
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-090.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [decq449] exponent lengths
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('1800000013640007000000000000000000000000001E5F00');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "7E+5999"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+1800000013640007000000000000000000000000001e5f00
+{"d":{"$numberDecimal":"7E+5999"}}
+1800000013640007000000000000000000000000001e5f00
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-091.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-091.phpt
new file mode 100644
index 00000000..98893a77
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-091.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [decq447] exponent lengths
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('1800000013640007000000000000000000000000000E3800');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "7E+999"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+1800000013640007000000000000000000000000000e3800
+{"d":{"$numberDecimal":"7E+999"}}
+1800000013640007000000000000000000000000000e3800
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-092.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-092.phpt
new file mode 100644
index 00000000..a982661d
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-092.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [decq445] exponent lengths
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000700000000000000000000000000063100');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "7E+99"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000700000000000000000000000000063100
+{"d":{"$numberDecimal":"7E+99"}}
+180000001364000700000000000000000000000000063100
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-093.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-093.phpt
new file mode 100644
index 00000000..47f03b6d
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-093.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [decq443] exponent lengths
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000700000000000000000000000000523000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "7E+9"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000700000000000000000000000000523000
+{"d":{"$numberDecimal":"7E+9"}}
+180000001364000700000000000000000000000000523000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-094.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-094.phpt
new file mode 100644
index 00000000..f9d1f28d
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-094.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [decq842] VG testcase
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000000FED83F4E7C9FE4E269E38A5BCD1700');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "7.049000000000010795488000000000000E-3097"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000000fed83f4e7c9fe4e269e38a5bcd1700
+{"d":{"$numberDecimal":"7.049000000000010795488000000000000E-3097"}}
+180000001364000000fed83f4e7c9fe4e269e38a5bcd1700
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-095.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-095.phpt
new file mode 100644
index 00000000..2866db3a
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-095.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [decq841] VG testcase
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000000203B9DB5056F000000000000002400');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "8.000000000000000000E-1550"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000000203b9db5056f000000000000002400
+{"d":{"$numberDecimal":"8.000000000000000000E-1550"}}
+180000001364000000203b9db5056f000000000000002400
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-096.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-096.phpt
new file mode 100644
index 00000000..5fc3e119
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-096.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [decq840] VG testcase
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364003C17258419D710C42F0000000000002400');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "8.81125000000001349436E-1548"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364003c17258419d710c42f0000000000002400
+{"d":{"$numberDecimal":"8.81125000000001349436E-1548"}}
+180000001364003c17258419d710c42f0000000000002400
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-097.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-097.phpt
new file mode 100644
index 00000000..2e694b6b
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-097.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [decq701] Selected DPD codes
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000900000000000000000000000000403000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "9"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000900000000000000000000000000403000
+{"d":{"$numberDecimal":"9"}}
+180000001364000900000000000000000000000000403000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-098.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-098.phpt
new file mode 100644
index 00000000..6957c5b9
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-098.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [decq032] Nmax and similar
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400FFFFFFFF638E8D37C087ADBE09EDFF5F00');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "9.999999999999999999999999999999999E+6144"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400ffffffff638e8d37c087adbe09edff5f00
+{"d":{"$numberDecimal":"9.999999999999999999999999999999999E+6144"}}
+18000000136400ffffffff638e8d37c087adbe09edff5f00
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-099.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-099.phpt
new file mode 100644
index 00000000..682f7118
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-099.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [decq702] Selected DPD codes
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000A00000000000000000000000000403000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "10"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000a00000000000000000000000000403000
+{"d":{"$numberDecimal":"10"}}
+180000001364000a00000000000000000000000000403000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-100.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-100.phpt
new file mode 100644
index 00000000..ab329404
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-100.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [decq057] fold-downs (more below)
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000C00000000000000000000000000403000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "12"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000c00000000000000000000000000403000
+{"d":{"$numberDecimal":"12"}}
+180000001364000c00000000000000000000000000403000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-101.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-101.phpt
new file mode 100644
index 00000000..466e8bec
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-101.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [decq703] Selected DPD codes
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364001300000000000000000000000000403000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "19"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364001300000000000000000000000000403000
+{"d":{"$numberDecimal":"19"}}
+180000001364001300000000000000000000000000403000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-102.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-102.phpt
new file mode 100644
index 00000000..dea47a75
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-102.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [decq704] Selected DPD codes
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364001400000000000000000000000000403000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "20"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364001400000000000000000000000000403000
+{"d":{"$numberDecimal":"20"}}
+180000001364001400000000000000000000000000403000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-103.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-103.phpt
new file mode 100644
index 00000000..3ed2e472
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-103.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [decq705] Selected DPD codes
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364001D00000000000000000000000000403000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "29"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364001d00000000000000000000000000403000
+{"d":{"$numberDecimal":"29"}}
+180000001364001d00000000000000000000000000403000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-104.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-104.phpt
new file mode 100644
index 00000000..5a5091f3
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-104.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [decq706] Selected DPD codes
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364001E00000000000000000000000000403000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "30"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364001e00000000000000000000000000403000
+{"d":{"$numberDecimal":"30"}}
+180000001364001e00000000000000000000000000403000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-105.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-105.phpt
new file mode 100644
index 00000000..b94cd87d
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-105.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [decq707] Selected DPD codes
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364002700000000000000000000000000403000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "39"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364002700000000000000000000000000403000
+{"d":{"$numberDecimal":"39"}}
+180000001364002700000000000000000000000000403000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-106.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-106.phpt
new file mode 100644
index 00000000..c89ebe53
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-106.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [decq708] Selected DPD codes
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364002800000000000000000000000000403000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "40"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364002800000000000000000000000000403000
+{"d":{"$numberDecimal":"40"}}
+180000001364002800000000000000000000000000403000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-107.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-107.phpt
new file mode 100644
index 00000000..41a7ae0c
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-107.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [decq709] Selected DPD codes
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364003100000000000000000000000000403000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "49"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364003100000000000000000000000000403000
+{"d":{"$numberDecimal":"49"}}
+180000001364003100000000000000000000000000403000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-108.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-108.phpt
new file mode 100644
index 00000000..268b6149
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-108.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [decq710] Selected DPD codes
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364003200000000000000000000000000403000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "50"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364003200000000000000000000000000403000
+{"d":{"$numberDecimal":"50"}}
+180000001364003200000000000000000000000000403000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-109.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-109.phpt
new file mode 100644
index 00000000..f3744f1e
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-109.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [decq711] Selected DPD codes
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364003B00000000000000000000000000403000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "59"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364003b00000000000000000000000000403000
+{"d":{"$numberDecimal":"59"}}
+180000001364003b00000000000000000000000000403000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-110.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-110.phpt
new file mode 100644
index 00000000..f90899ea
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-110.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [decq712] Selected DPD codes
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364003C00000000000000000000000000403000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "60"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364003c00000000000000000000000000403000
+{"d":{"$numberDecimal":"60"}}
+180000001364003c00000000000000000000000000403000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-111.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-111.phpt
new file mode 100644
index 00000000..b2de9604
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-111.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [decq713] Selected DPD codes
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364004500000000000000000000000000403000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "69"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364004500000000000000000000000000403000
+{"d":{"$numberDecimal":"69"}}
+180000001364004500000000000000000000000000403000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-112.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-112.phpt
new file mode 100644
index 00000000..92599a07
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-112.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [decq714] Selected DPD codes
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364004600000000000000000000000000403000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "70"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364004600000000000000000000000000403000
+{"d":{"$numberDecimal":"70"}}
+180000001364004600000000000000000000000000403000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-113.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-113.phpt
new file mode 100644
index 00000000..f8dec958
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-113.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [decq715] Selected DPD codes
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364004700000000000000000000000000403000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "71"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364004700000000000000000000000000403000
+{"d":{"$numberDecimal":"71"}}
+180000001364004700000000000000000000000000403000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-114.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-114.phpt
new file mode 100644
index 00000000..47cae74d
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-114.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [decq716] Selected DPD codes
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364004800000000000000000000000000403000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "72"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364004800000000000000000000000000403000
+{"d":{"$numberDecimal":"72"}}
+180000001364004800000000000000000000000000403000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-115.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-115.phpt
new file mode 100644
index 00000000..1f6eec73
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-115.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [decq717] Selected DPD codes
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364004900000000000000000000000000403000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "73"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364004900000000000000000000000000403000
+{"d":{"$numberDecimal":"73"}}
+180000001364004900000000000000000000000000403000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-116.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-116.phpt
new file mode 100644
index 00000000..8e3812f0
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-116.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [decq718] Selected DPD codes
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364004A00000000000000000000000000403000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "74"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364004a00000000000000000000000000403000
+{"d":{"$numberDecimal":"74"}}
+180000001364004a00000000000000000000000000403000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-117.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-117.phpt
new file mode 100644
index 00000000..cdf68aaa
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-117.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [decq719] Selected DPD codes
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364004B00000000000000000000000000403000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "75"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364004b00000000000000000000000000403000
+{"d":{"$numberDecimal":"75"}}
+180000001364004b00000000000000000000000000403000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-118.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-118.phpt
new file mode 100644
index 00000000..b2e848f2
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-118.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [decq720] Selected DPD codes
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364004C00000000000000000000000000403000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "76"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364004c00000000000000000000000000403000
+{"d":{"$numberDecimal":"76"}}
+180000001364004c00000000000000000000000000403000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-119.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-119.phpt
new file mode 100644
index 00000000..d24b3b4d
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-119.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [decq721] Selected DPD codes
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364004D00000000000000000000000000403000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "77"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364004d00000000000000000000000000403000
+{"d":{"$numberDecimal":"77"}}
+180000001364004d00000000000000000000000000403000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-120.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-120.phpt
new file mode 100644
index 00000000..63d4a0fa
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-120.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [decq722] Selected DPD codes
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364004E00000000000000000000000000403000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "78"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364004e00000000000000000000000000403000
+{"d":{"$numberDecimal":"78"}}
+180000001364004e00000000000000000000000000403000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-121.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-121.phpt
new file mode 100644
index 00000000..676bf145
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-121.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [decq723] Selected DPD codes
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364004F00000000000000000000000000403000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "79"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364004f00000000000000000000000000403000
+{"d":{"$numberDecimal":"79"}}
+180000001364004f00000000000000000000000000403000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-122.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-122.phpt
new file mode 100644
index 00000000..61bb78ea
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-122.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [decq056] fold-downs (more below)
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364007B00000000000000000000000000403000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "123"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364007b00000000000000000000000000403000
+{"d":{"$numberDecimal":"123"}}
+180000001364007b00000000000000000000000000403000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-123.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-123.phpt
new file mode 100644
index 00000000..91281098
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-123.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [decq064] fold-downs (more below)
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('1800000013640039300000000000000000000000003C3000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "123.45"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+1800000013640039300000000000000000000000003c3000
+{"d":{"$numberDecimal":"123.45"}}
+1800000013640039300000000000000000000000003c3000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-124.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-124.phpt
new file mode 100644
index 00000000..91bdb7a7
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-124.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [decq732] Selected DPD codes
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000802000000000000000000000000403000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "520"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000802000000000000000000000000403000
+{"d":{"$numberDecimal":"520"}}
+180000001364000802000000000000000000000000403000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-125.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-125.phpt
new file mode 100644
index 00000000..14727c33
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-125.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [decq733] Selected DPD codes
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000902000000000000000000000000403000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "521"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000902000000000000000000000000403000
+{"d":{"$numberDecimal":"521"}}
+180000001364000902000000000000000000000000403000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-126.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-126.phpt
new file mode 100644
index 00000000..9e404916
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-126.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [decq740] DPD: one of each of the huffman groups
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000903000000000000000000000000403000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "777"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000903000000000000000000000000403000
+{"d":{"$numberDecimal":"777"}}
+180000001364000903000000000000000000000000403000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-127.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-127.phpt
new file mode 100644
index 00000000..f0a2cc4b
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-127.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [decq741] DPD: one of each of the huffman groups
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000A03000000000000000000000000403000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "778"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000a03000000000000000000000000403000
+{"d":{"$numberDecimal":"778"}}
+180000001364000a03000000000000000000000000403000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-128.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-128.phpt
new file mode 100644
index 00000000..e9637a4a
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-128.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [decq742] DPD: one of each of the huffman groups
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364001303000000000000000000000000403000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "787"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364001303000000000000000000000000403000
+{"d":{"$numberDecimal":"787"}}
+180000001364001303000000000000000000000000403000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-129.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-129.phpt
new file mode 100644
index 00000000..b9ca046c
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-129.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [decq746] DPD: one of each of the huffman groups
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364001F03000000000000000000000000403000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "799"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364001f03000000000000000000000000403000
+{"d":{"$numberDecimal":"799"}}
+180000001364001f03000000000000000000000000403000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-130.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-130.phpt
new file mode 100644
index 00000000..b01aba96
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-130.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [decq743] DPD: one of each of the huffman groups
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364006D03000000000000000000000000403000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "877"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364006d03000000000000000000000000403000
+{"d":{"$numberDecimal":"877"}}
+180000001364006d03000000000000000000000000403000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-131.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-131.phpt
new file mode 100644
index 00000000..392d1a3f
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-131.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [decq753] DPD all-highs cases (includes the 24 redundant codes)
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364007803000000000000000000000000403000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "888"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364007803000000000000000000000000403000
+{"d":{"$numberDecimal":"888"}}
+180000001364007803000000000000000000000000403000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-132.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-132.phpt
new file mode 100644
index 00000000..30ba0b5c
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-132.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [decq754] DPD all-highs cases (includes the 24 redundant codes)
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364007903000000000000000000000000403000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "889"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364007903000000000000000000000000403000
+{"d":{"$numberDecimal":"889"}}
+180000001364007903000000000000000000000000403000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-133.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-133.phpt
new file mode 100644
index 00000000..329165dc
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-133.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [decq760] DPD all-highs cases (includes the 24 redundant codes)
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364008203000000000000000000000000403000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "898"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364008203000000000000000000000000403000
+{"d":{"$numberDecimal":"898"}}
+180000001364008203000000000000000000000000403000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-134.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-134.phpt
new file mode 100644
index 00000000..581a133e
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-134.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [decq764] DPD all-highs cases (includes the 24 redundant codes)
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364008303000000000000000000000000403000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "899"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364008303000000000000000000000000403000
+{"d":{"$numberDecimal":"899"}}
+180000001364008303000000000000000000000000403000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-135.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-135.phpt
new file mode 100644
index 00000000..3e242ca7
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-135.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [decq745] DPD: one of each of the huffman groups
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400D303000000000000000000000000403000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "979"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400d303000000000000000000000000403000
+{"d":{"$numberDecimal":"979"}}
+18000000136400d303000000000000000000000000403000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-136.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-136.phpt
new file mode 100644
index 00000000..33b7225b
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-136.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [decq770] DPD all-highs cases (includes the 24 redundant codes)
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400DC03000000000000000000000000403000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "988"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400dc03000000000000000000000000403000
+{"d":{"$numberDecimal":"988"}}
+18000000136400dc03000000000000000000000000403000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-137.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-137.phpt
new file mode 100644
index 00000000..3c28e9b4
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-137.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [decq774] DPD all-highs cases (includes the 24 redundant codes)
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400DD03000000000000000000000000403000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "989"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400dd03000000000000000000000000403000
+{"d":{"$numberDecimal":"989"}}
+18000000136400dd03000000000000000000000000403000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-138.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-138.phpt
new file mode 100644
index 00000000..5e9707ac
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-138.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [decq730] Selected DPD codes
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400E203000000000000000000000000403000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "994"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400e203000000000000000000000000403000
+{"d":{"$numberDecimal":"994"}}
+18000000136400e203000000000000000000000000403000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-139.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-139.phpt
new file mode 100644
index 00000000..f124c990
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-139.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [decq731] Selected DPD codes
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400E303000000000000000000000000403000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "995"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400e303000000000000000000000000403000
+{"d":{"$numberDecimal":"995"}}
+18000000136400e303000000000000000000000000403000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-140.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-140.phpt
new file mode 100644
index 00000000..a5b27701
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-140.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [decq744] DPD: one of each of the huffman groups
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400E503000000000000000000000000403000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "997"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400e503000000000000000000000000403000
+{"d":{"$numberDecimal":"997"}}
+18000000136400e503000000000000000000000000403000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-141.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-141.phpt
new file mode 100644
index 00000000..160b4ad2
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-141.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [decq780] DPD all-highs cases (includes the 24 redundant codes)
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400E603000000000000000000000000403000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "998"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400e603000000000000000000000000403000
+{"d":{"$numberDecimal":"998"}}
+18000000136400e603000000000000000000000000403000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-142.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-142.phpt
new file mode 100644
index 00000000..458b6acd
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-142.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [decq787] DPD all-highs cases (includes the 24 redundant codes)
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400E703000000000000000000000000403000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "999"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400e703000000000000000000000000403000
+{"d":{"$numberDecimal":"999"}}
+18000000136400e703000000000000000000000000403000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-143.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-143.phpt
new file mode 100644
index 00000000..fd7aeb29
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-143.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [decq053] fold-downs (more below)
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400D204000000000000000000000000403000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "1234"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400d204000000000000000000000000403000
+{"d":{"$numberDecimal":"1234"}}
+18000000136400d204000000000000000000000000403000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-144.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-144.phpt
new file mode 100644
index 00000000..ad635ddd
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-144.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [decq052] fold-downs (more below)
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364003930000000000000000000000000403000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "12345"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364003930000000000000000000000000403000
+{"d":{"$numberDecimal":"12345"}}
+180000001364003930000000000000000000000000403000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-145.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-145.phpt
new file mode 100644
index 00000000..eb7b9d71
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-145.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [decq792] Miscellaneous (testers' queries, etc.)
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364003075000000000000000000000000403000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "30000"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364003075000000000000000000000000403000
+{"d":{"$numberDecimal":"30000"}}
+180000001364003075000000000000000000000000403000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-146.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-146.phpt
new file mode 100644
index 00000000..3317c658
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-146.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [decq793] Miscellaneous (testers' queries, etc.)
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('1800000013640090940D0000000000000000000000403000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "890000"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+1800000013640090940d0000000000000000000000403000
+{"d":{"$numberDecimal":"890000"}}
+1800000013640090940d0000000000000000000000403000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-147.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-147.phpt
new file mode 100644
index 00000000..23633beb
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-147.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [decq824] values around [u]int32 edges (zeros done earlier)
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400FEFFFF7F00000000000000000000403000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "2147483646"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400feffff7f00000000000000000000403000
+{"d":{"$numberDecimal":"2147483646"}}
+18000000136400feffff7f00000000000000000000403000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-148.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-148.phpt
new file mode 100644
index 00000000..24701c26
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-148.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [decq825] values around [u]int32 edges (zeros done earlier)
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400FFFFFF7F00000000000000000000403000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "2147483647"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400ffffff7f00000000000000000000403000
+{"d":{"$numberDecimal":"2147483647"}}
+18000000136400ffffff7f00000000000000000000403000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-149.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-149.phpt
new file mode 100644
index 00000000..f548bd6b
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-149.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [decq826] values around [u]int32 edges (zeros done earlier)
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000000008000000000000000000000403000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "2147483648"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000000008000000000000000000000403000
+{"d":{"$numberDecimal":"2147483648"}}
+180000001364000000008000000000000000000000403000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-150.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-150.phpt
new file mode 100644
index 00000000..b9ba6fed
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-150.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [decq827] values around [u]int32 edges (zeros done earlier)
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000100008000000000000000000000403000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "2147483649"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000100008000000000000000000000403000
+{"d":{"$numberDecimal":"2147483649"}}
+180000001364000100008000000000000000000000403000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-151.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-151.phpt
new file mode 100644
index 00000000..a084777d
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-151.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [decq828] values around [u]int32 edges (zeros done earlier)
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400FEFFFFFF00000000000000000000403000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "4294967294"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400feffffff00000000000000000000403000
+{"d":{"$numberDecimal":"4294967294"}}
+18000000136400feffffff00000000000000000000403000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-152.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-152.phpt
new file mode 100644
index 00000000..c896f2db
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-152.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [decq829] values around [u]int32 edges (zeros done earlier)
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400FFFFFFFF00000000000000000000403000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "4294967295"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400ffffffff00000000000000000000403000
+{"d":{"$numberDecimal":"4294967295"}}
+18000000136400ffffffff00000000000000000000403000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-153.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-153.phpt
new file mode 100644
index 00000000..78f5891f
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-153.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [decq830] values around [u]int32 edges (zeros done earlier)
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000000000001000000000000000000403000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "4294967296"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000000000001000000000000000000403000
+{"d":{"$numberDecimal":"4294967296"}}
+180000001364000000000001000000000000000000403000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-154.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-154.phpt
new file mode 100644
index 00000000..dc9ffaad
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-154.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [decq831] values around [u]int32 edges (zeros done earlier)
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000100000001000000000000000000403000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "4294967297"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000100000001000000000000000000403000
+{"d":{"$numberDecimal":"4294967297"}}
+180000001364000100000001000000000000000000403000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-155.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-155.phpt
new file mode 100644
index 00000000..e9d2dfdd
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-155.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [decq022] Normality
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400C7711CC7B548F377DC80A131C836403000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "1111111111111111111111111111111111"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400c7711cc7b548f377dc80a131c836403000
+{"d":{"$numberDecimal":"1111111111111111111111111111111111"}}
+18000000136400c7711cc7b548f377dc80a131c836403000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-156.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-156.phpt
new file mode 100644
index 00000000..f94fdc6e
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-156.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [decq020] Normality
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400F2AF967ED05C82DE3297FF6FDE3C403000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "1234567890123456789012345678901234"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400f2af967ed05c82de3297ff6fde3c403000
+{"d":{"$numberDecimal":"1234567890123456789012345678901234"}}
+18000000136400f2af967ed05c82de3297ff6fde3c403000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-157.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-157.phpt
new file mode 100644
index 00000000..33ca5b6e
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-2-valid-157.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [decq550] Specials
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400FFFFFFFF638E8D37C087ADBE09ED413000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "9999999999999999999999999999999999"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400ffffffff638e8d37c087adbe09ed413000
+{"d":{"$numberDecimal":"9999999999999999999999999999999999"}}
+18000000136400ffffffff638e8d37c087adbe09ed413000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-001.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-001.phpt
new file mode 100644
index 00000000..60081eed
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-001.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx066] strings without E cannot generate E in result
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400185C0ACE0000000000000000000038B000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "-345678.5432"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "-00345678.5432"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400185c0ace0000000000000000000038b000
+{"d":{"$numberDecimal":"-345678.5432"}}
+18000000136400185c0ace0000000000000000000038b000
+18000000136400185c0ace0000000000000000000038b000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-002.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-002.phpt
new file mode 100644
index 00000000..814c6be4
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-002.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx065] strings without E cannot generate E in result
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400185C0ACE0000000000000000000038B000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "-345678.5432"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "-0345678.5432"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400185c0ace0000000000000000000038b000
+{"d":{"$numberDecimal":"-345678.5432"}}
+18000000136400185c0ace0000000000000000000038b000
+18000000136400185c0ace0000000000000000000038b000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-003.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-003.phpt
new file mode 100644
index 00000000..dfa0b5c9
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-003.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [basx064] strings without E cannot generate E in result
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400185C0ACE0000000000000000000038B000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "-345678.5432"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400185c0ace0000000000000000000038b000
+{"d":{"$numberDecimal":"-345678.5432"}}
+18000000136400185c0ace0000000000000000000038b000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-004.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-004.phpt
new file mode 100644
index 00000000..f26a3534
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-004.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [basx041] strings without E cannot generate E in result
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364004C0000000000000000000000000040B000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "-76"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364004c0000000000000000000000000040b000
+{"d":{"$numberDecimal":"-76"}}
+180000001364004c0000000000000000000000000040b000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-005.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-005.phpt
new file mode 100644
index 00000000..5284840d
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-005.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [basx027] conform to rules and exponent will be in permitted range).
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000F270000000000000000000000003AB000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "-9.999"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000f270000000000000000000000003ab000
+{"d":{"$numberDecimal":"-9.999"}}
+180000001364000f270000000000000000000000003ab000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-006.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-006.phpt
new file mode 100644
index 00000000..95edd62e
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-006.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [basx026] conform to rules and exponent will be in permitted range).
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364009F230000000000000000000000003AB000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "-9.119"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364009f230000000000000000000000003ab000
+{"d":{"$numberDecimal":"-9.119"}}
+180000001364009f230000000000000000000000003ab000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-007.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-007.phpt
new file mode 100644
index 00000000..401e90e9
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-007.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [basx025] conform to rules and exponent will be in permitted range).
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364008F030000000000000000000000003CB000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "-9.11"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364008f030000000000000000000000003cb000
+{"d":{"$numberDecimal":"-9.11"}}
+180000001364008f030000000000000000000000003cb000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-008.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-008.phpt
new file mode 100644
index 00000000..6b665829
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-008.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [basx024] conform to rules and exponent will be in permitted range).
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364005B000000000000000000000000003EB000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "-9.1"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364005b000000000000000000000000003eb000
+{"d":{"$numberDecimal":"-9.1"}}
+180000001364005b000000000000000000000000003eb000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-009.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-009.phpt
new file mode 100644
index 00000000..cdadfcd7
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-009.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [dqbsr531] negatives (Rounded)
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('1800000013640099761CC7B548F377DC80A131C836FEAF00');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "-1.111111111111111111111111111112345"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "-1.1111111111111111111111111111123450"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+1800000013640099761cc7b548f377dc80a131c836feaf00
+{"d":{"$numberDecimal":"-1.111111111111111111111111111112345"}}
+1800000013640099761cc7b548f377dc80a131c836feaf00
+1800000013640099761cc7b548f377dc80a131c836feaf00
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-010.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-010.phpt
new file mode 100644
index 00000000..10452d4c
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-010.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [basx022] conform to rules and exponent will be in permitted range).
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000A000000000000000000000000003EB000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "-1.0"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000a000000000000000000000000003eb000
+{"d":{"$numberDecimal":"-1.0"}}
+180000001364000a000000000000000000000000003eb000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-011.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-011.phpt
new file mode 100644
index 00000000..7e0016c2
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-011.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [basx021] conform to rules and exponent will be in permitted range).
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400010000000000000000000000000040B000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "-1"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400010000000000000000000000000040b000
+{"d":{"$numberDecimal":"-1"}}
+18000000136400010000000000000000000000000040b000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-012.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-012.phpt
new file mode 100644
index 00000000..a59d0fed
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-012.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx601] Zeros
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('1800000013640000000000000000000000000000002E3000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "0E-9"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "0.000000000"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+1800000013640000000000000000000000000000002e3000
+{"d":{"$numberDecimal":"0E-9"}}
+1800000013640000000000000000000000000000002e3000
+1800000013640000000000000000000000000000002e3000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-013.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-013.phpt
new file mode 100644
index 00000000..ef5d308e
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-013.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx622] Zeros
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('1800000013640000000000000000000000000000002EB000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "-0E-9"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "-0.000000000"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+1800000013640000000000000000000000000000002eb000
+{"d":{"$numberDecimal":"-0E-9"}}
+1800000013640000000000000000000000000000002eb000
+1800000013640000000000000000000000000000002eb000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-014.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-014.phpt
new file mode 100644
index 00000000..1238dd24
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-014.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx602] Zeros
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000000000000000000000000000000303000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "0E-8"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "0.00000000"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000000000000000000000000000000303000
+{"d":{"$numberDecimal":"0E-8"}}
+180000001364000000000000000000000000000000303000
+180000001364000000000000000000000000000000303000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-015.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-015.phpt
new file mode 100644
index 00000000..146f02d7
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-015.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx621] Zeros
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400000000000000000000000000000030B000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "-0E-8"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "-0.00000000"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400000000000000000000000000000030b000
+{"d":{"$numberDecimal":"-0E-8"}}
+18000000136400000000000000000000000000000030b000
+18000000136400000000000000000000000000000030b000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-016.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-016.phpt
new file mode 100644
index 00000000..40e91c6c
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-016.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx603] Zeros
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000000000000000000000000000000323000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "0E-7"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "0.0000000"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000000000000000000000000000000323000
+{"d":{"$numberDecimal":"0E-7"}}
+180000001364000000000000000000000000000000323000
+180000001364000000000000000000000000000000323000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-017.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-017.phpt
new file mode 100644
index 00000000..4c1c078d
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-017.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx620] Zeros
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400000000000000000000000000000032B000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "-0E-7"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "-0.0000000"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400000000000000000000000000000032b000
+{"d":{"$numberDecimal":"-0E-7"}}
+18000000136400000000000000000000000000000032b000
+18000000136400000000000000000000000000000032b000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-018.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-018.phpt
new file mode 100644
index 00000000..feed0897
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-018.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [basx604] Zeros
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000000000000000000000000000000343000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "0.000000"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000000000000000000000000000000343000
+{"d":{"$numberDecimal":"0.000000"}}
+180000001364000000000000000000000000000000343000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-019.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-019.phpt
new file mode 100644
index 00000000..a1c3b27e
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-019.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [basx619] Zeros
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400000000000000000000000000000034B000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "-0.000000"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400000000000000000000000000000034b000
+{"d":{"$numberDecimal":"-0.000000"}}
+18000000136400000000000000000000000000000034b000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-020.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-020.phpt
new file mode 100644
index 00000000..da92ab83
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-020.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [basx605] Zeros
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000000000000000000000000000000363000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "0.00000"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000000000000000000000000000000363000
+{"d":{"$numberDecimal":"0.00000"}}
+180000001364000000000000000000000000000000363000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-021.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-021.phpt
new file mode 100644
index 00000000..549c65f5
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-021.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [basx618] Zeros
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400000000000000000000000000000036B000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "-0.00000"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400000000000000000000000000000036b000
+{"d":{"$numberDecimal":"-0.00000"}}
+18000000136400000000000000000000000000000036b000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-022.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-022.phpt
new file mode 100644
index 00000000..64a1c279
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-022.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx680] Zeros
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000000000000000000000000000000403000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "0"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "000000."}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000000000000000000000000000000403000
+{"d":{"$numberDecimal":"0"}}
+180000001364000000000000000000000000000000403000
+180000001364000000000000000000000000000000403000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-023.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-023.phpt
new file mode 100644
index 00000000..1beff1ac
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-023.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [basx606] Zeros
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000000000000000000000000000000383000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "0.0000"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000000000000000000000000000000383000
+{"d":{"$numberDecimal":"0.0000"}}
+180000001364000000000000000000000000000000383000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-024.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-024.phpt
new file mode 100644
index 00000000..92f3dc42
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-024.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [basx617] Zeros
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400000000000000000000000000000038B000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "-0.0000"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400000000000000000000000000000038b000
+{"d":{"$numberDecimal":"-0.0000"}}
+18000000136400000000000000000000000000000038b000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-025.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-025.phpt
new file mode 100644
index 00000000..b02fee2c
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-025.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx681] Zeros
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000000000000000000000000000000403000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "0"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "00000."}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000000000000000000000000000000403000
+{"d":{"$numberDecimal":"0"}}
+180000001364000000000000000000000000000000403000
+180000001364000000000000000000000000000000403000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-026.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-026.phpt
new file mode 100644
index 00000000..e0a5328e
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-026.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx686] Zeros
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000000000000000000000000000000403000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "0"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "+00000."}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000000000000000000000000000000403000
+{"d":{"$numberDecimal":"0"}}
+180000001364000000000000000000000000000000403000
+180000001364000000000000000000000000000000403000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-027.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-027.phpt
new file mode 100644
index 00000000..d5a56905
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-027.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx687] Zeros
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400000000000000000000000000000040B000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "-0"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "-00000."}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400000000000000000000000000000040b000
+{"d":{"$numberDecimal":"-0"}}
+18000000136400000000000000000000000000000040b000
+18000000136400000000000000000000000000000040b000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-028.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-028.phpt
new file mode 100644
index 00000000..9209ac73
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-028.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx019] conform to rules and exponent will be in permitted range).
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('1800000013640000000000000000000000000000003CB000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "-0.00"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "-00.00"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+1800000013640000000000000000000000000000003cb000
+{"d":{"$numberDecimal":"-0.00"}}
+1800000013640000000000000000000000000000003cb000
+1800000013640000000000000000000000000000003cb000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-029.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-029.phpt
new file mode 100644
index 00000000..dfc39d4d
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-029.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [basx607] Zeros
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('1800000013640000000000000000000000000000003A3000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "0.000"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+1800000013640000000000000000000000000000003a3000
+{"d":{"$numberDecimal":"0.000"}}
+1800000013640000000000000000000000000000003a3000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-030.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-030.phpt
new file mode 100644
index 00000000..04055dcf
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-030.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [basx616] Zeros
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('1800000013640000000000000000000000000000003AB000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "-0.000"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+1800000013640000000000000000000000000000003ab000
+{"d":{"$numberDecimal":"-0.000"}}
+1800000013640000000000000000000000000000003ab000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-031.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-031.phpt
new file mode 100644
index 00000000..dd60b8ce
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-031.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx682] Zeros
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000000000000000000000000000000403000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "0"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "0000."}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000000000000000000000000000000403000
+{"d":{"$numberDecimal":"0"}}
+180000001364000000000000000000000000000000403000
+180000001364000000000000000000000000000000403000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-032.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-032.phpt
new file mode 100644
index 00000000..d63ebbde
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-032.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx155] Numbers with E
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('1800000013640000000000000000000000000000003A3000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "0.000"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "0.000e+0"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+1800000013640000000000000000000000000000003a3000
+{"d":{"$numberDecimal":"0.000"}}
+1800000013640000000000000000000000000000003a3000
+1800000013640000000000000000000000000000003a3000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-033.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-033.phpt
new file mode 100644
index 00000000..90f9844e
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-033.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx130] Numbers with E
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000000000000000000000000000000383000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "0.0000"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "0.000E-1"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000000000000000000000000000000383000
+{"d":{"$numberDecimal":"0.0000"}}
+180000001364000000000000000000000000000000383000
+180000001364000000000000000000000000000000383000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-034.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-034.phpt
new file mode 100644
index 00000000..88ac518c
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-034.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx290] some more negative zeros [systematic tests below]
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400000000000000000000000000000038B000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "-0.0000"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "-0.000E-1"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400000000000000000000000000000038b000
+{"d":{"$numberDecimal":"-0.0000"}}
+18000000136400000000000000000000000000000038b000
+18000000136400000000000000000000000000000038b000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-035.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-035.phpt
new file mode 100644
index 00000000..1d1daf9c
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-035.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx131] Numbers with E
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000000000000000000000000000000363000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "0.00000"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "0.000E-2"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000000000000000000000000000000363000
+{"d":{"$numberDecimal":"0.00000"}}
+180000001364000000000000000000000000000000363000
+180000001364000000000000000000000000000000363000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-036.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-036.phpt
new file mode 100644
index 00000000..5db6387e
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-036.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx291] some more negative zeros [systematic tests below]
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400000000000000000000000000000036B000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "-0.00000"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "-0.000E-2"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400000000000000000000000000000036b000
+{"d":{"$numberDecimal":"-0.00000"}}
+18000000136400000000000000000000000000000036b000
+18000000136400000000000000000000000000000036b000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-037.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-037.phpt
new file mode 100644
index 00000000..90097a0c
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-037.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx132] Numbers with E
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000000000000000000000000000000343000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "0.000000"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "0.000E-3"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000000000000000000000000000000343000
+{"d":{"$numberDecimal":"0.000000"}}
+180000001364000000000000000000000000000000343000
+180000001364000000000000000000000000000000343000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-038.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-038.phpt
new file mode 100644
index 00000000..974a3d63
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-038.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx292] some more negative zeros [systematic tests below]
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400000000000000000000000000000034B000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "-0.000000"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "-0.000E-3"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400000000000000000000000000000034b000
+{"d":{"$numberDecimal":"-0.000000"}}
+18000000136400000000000000000000000000000034b000
+18000000136400000000000000000000000000000034b000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-039.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-039.phpt
new file mode 100644
index 00000000..82a10553
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-039.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx133] Numbers with E
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000000000000000000000000000000323000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "0E-7"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "0.000E-4"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000000000000000000000000000000323000
+{"d":{"$numberDecimal":"0E-7"}}
+180000001364000000000000000000000000000000323000
+180000001364000000000000000000000000000000323000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-040.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-040.phpt
new file mode 100644
index 00000000..5f8a0059
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-040.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx293] some more negative zeros [systematic tests below]
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400000000000000000000000000000032B000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "-0E-7"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "-0.000E-4"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400000000000000000000000000000032b000
+{"d":{"$numberDecimal":"-0E-7"}}
+18000000136400000000000000000000000000000032b000
+18000000136400000000000000000000000000000032b000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-041.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-041.phpt
new file mode 100644
index 00000000..11fbbaa6
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-041.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [basx608] Zeros
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('1800000013640000000000000000000000000000003C3000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "0.00"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+1800000013640000000000000000000000000000003c3000
+{"d":{"$numberDecimal":"0.00"}}
+1800000013640000000000000000000000000000003c3000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-042.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-042.phpt
new file mode 100644
index 00000000..de495c5f
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-042.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [basx615] Zeros
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('1800000013640000000000000000000000000000003CB000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "-0.00"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+1800000013640000000000000000000000000000003cb000
+{"d":{"$numberDecimal":"-0.00"}}
+1800000013640000000000000000000000000000003cb000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-043.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-043.phpt
new file mode 100644
index 00000000..9080b6da
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-043.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx683] Zeros
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000000000000000000000000000000403000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "0"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "000."}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000000000000000000000000000000403000
+{"d":{"$numberDecimal":"0"}}
+180000001364000000000000000000000000000000403000
+180000001364000000000000000000000000000000403000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-044.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-044.phpt
new file mode 100644
index 00000000..5cbbaba1
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-044.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx630] Zeros
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('1800000013640000000000000000000000000000003C3000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "0.00"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "0.00E+0"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+1800000013640000000000000000000000000000003c3000
+{"d":{"$numberDecimal":"0.00"}}
+1800000013640000000000000000000000000000003c3000
+1800000013640000000000000000000000000000003c3000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-045.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-045.phpt
new file mode 100644
index 00000000..7270491f
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-045.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx670] Zeros
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('1800000013640000000000000000000000000000003C3000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "0.00"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "0.00E-0"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+1800000013640000000000000000000000000000003c3000
+{"d":{"$numberDecimal":"0.00"}}
+1800000013640000000000000000000000000000003c3000
+1800000013640000000000000000000000000000003c3000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-046.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-046.phpt
new file mode 100644
index 00000000..616dffac
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-046.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx631] Zeros
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('1800000013640000000000000000000000000000003E3000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "0.0"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "0.00E+1"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+1800000013640000000000000000000000000000003e3000
+{"d":{"$numberDecimal":"0.0"}}
+1800000013640000000000000000000000000000003e3000
+1800000013640000000000000000000000000000003e3000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-047.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-047.phpt
new file mode 100644
index 00000000..afad75ea
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-047.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx671] Zeros
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('1800000013640000000000000000000000000000003A3000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "0.000"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "0.00E-1"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+1800000013640000000000000000000000000000003a3000
+{"d":{"$numberDecimal":"0.000"}}
+1800000013640000000000000000000000000000003a3000
+1800000013640000000000000000000000000000003a3000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-048.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-048.phpt
new file mode 100644
index 00000000..410f8d4b
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-048.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx134] Numbers with E
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000000000000000000000000000000383000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "0.0000"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "0.00E-2"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000000000000000000000000000000383000
+{"d":{"$numberDecimal":"0.0000"}}
+180000001364000000000000000000000000000000383000
+180000001364000000000000000000000000000000383000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-049.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-049.phpt
new file mode 100644
index 00000000..053e0fd0
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-049.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx294] some more negative zeros [systematic tests below]
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400000000000000000000000000000038B000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "-0.0000"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "-0.00E-2"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400000000000000000000000000000038b000
+{"d":{"$numberDecimal":"-0.0000"}}
+18000000136400000000000000000000000000000038b000
+18000000136400000000000000000000000000000038b000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-050.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-050.phpt
new file mode 100644
index 00000000..f08fd3da
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-050.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx632] Zeros
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000000000000000000000000000000403000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "0"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "0.00E+2"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000000000000000000000000000000403000
+{"d":{"$numberDecimal":"0"}}
+180000001364000000000000000000000000000000403000
+180000001364000000000000000000000000000000403000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-051.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-051.phpt
new file mode 100644
index 00000000..2208372d
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-051.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx672] Zeros
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000000000000000000000000000000383000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "0.0000"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "0.00E-2"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000000000000000000000000000000383000
+{"d":{"$numberDecimal":"0.0000"}}
+180000001364000000000000000000000000000000383000
+180000001364000000000000000000000000000000383000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-052.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-052.phpt
new file mode 100644
index 00000000..100a774a
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-052.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx135] Numbers with E
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000000000000000000000000000000363000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "0.00000"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "0.00E-3"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000000000000000000000000000000363000
+{"d":{"$numberDecimal":"0.00000"}}
+180000001364000000000000000000000000000000363000
+180000001364000000000000000000000000000000363000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-053.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-053.phpt
new file mode 100644
index 00000000..7c5afbed
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-053.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx295] some more negative zeros [systematic tests below]
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400000000000000000000000000000036B000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "-0.00000"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "-0.00E-3"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400000000000000000000000000000036b000
+{"d":{"$numberDecimal":"-0.00000"}}
+18000000136400000000000000000000000000000036b000
+18000000136400000000000000000000000000000036b000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-054.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-054.phpt
new file mode 100644
index 00000000..5518c06c
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-054.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx633] Zeros
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000000000000000000000000000000423000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "0E+1"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "0.00E+3"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000000000000000000000000000000423000
+{"d":{"$numberDecimal":"0E+1"}}
+180000001364000000000000000000000000000000423000
+180000001364000000000000000000000000000000423000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-055.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-055.phpt
new file mode 100644
index 00000000..69005500
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-055.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx673] Zeros
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000000000000000000000000000000363000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "0.00000"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "0.00E-3"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000000000000000000000000000000363000
+{"d":{"$numberDecimal":"0.00000"}}
+180000001364000000000000000000000000000000363000
+180000001364000000000000000000000000000000363000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-056.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-056.phpt
new file mode 100644
index 00000000..d0c95203
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-056.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx136] Numbers with E
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000000000000000000000000000000343000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "0.000000"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "0.00E-4"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000000000000000000000000000000343000
+{"d":{"$numberDecimal":"0.000000"}}
+180000001364000000000000000000000000000000343000
+180000001364000000000000000000000000000000343000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-057.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-057.phpt
new file mode 100644
index 00000000..b4ed2f2e
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-057.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx674] Zeros
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000000000000000000000000000000343000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "0.000000"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "0.00E-4"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000000000000000000000000000000343000
+{"d":{"$numberDecimal":"0.000000"}}
+180000001364000000000000000000000000000000343000
+180000001364000000000000000000000000000000343000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-058.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-058.phpt
new file mode 100644
index 00000000..5fa019d7
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-058.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx634] Zeros
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000000000000000000000000000000443000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "0E+2"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "0.00E+4"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000000000000000000000000000000443000
+{"d":{"$numberDecimal":"0E+2"}}
+180000001364000000000000000000000000000000443000
+180000001364000000000000000000000000000000443000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-059.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-059.phpt
new file mode 100644
index 00000000..e11958fa
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-059.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx137] Numbers with E
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000000000000000000000000000000323000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "0E-7"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "0.00E-5"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000000000000000000000000000000323000
+{"d":{"$numberDecimal":"0E-7"}}
+180000001364000000000000000000000000000000323000
+180000001364000000000000000000000000000000323000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-060.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-060.phpt
new file mode 100644
index 00000000..25bf112c
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-060.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx635] Zeros
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000000000000000000000000000000463000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "0E+3"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "0.00E+5"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000000000000000000000000000000463000
+{"d":{"$numberDecimal":"0E+3"}}
+180000001364000000000000000000000000000000463000
+180000001364000000000000000000000000000000463000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-061.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-061.phpt
new file mode 100644
index 00000000..2861bda6
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-061.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx675] Zeros
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000000000000000000000000000000323000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "0E-7"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "0.00E-5"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000000000000000000000000000000323000
+{"d":{"$numberDecimal":"0E-7"}}
+180000001364000000000000000000000000000000323000
+180000001364000000000000000000000000000000323000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-062.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-062.phpt
new file mode 100644
index 00000000..dc0c9fed
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-062.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx636] Zeros
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000000000000000000000000000000483000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "0E+4"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "0.00E+6"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000000000000000000000000000000483000
+{"d":{"$numberDecimal":"0E+4"}}
+180000001364000000000000000000000000000000483000
+180000001364000000000000000000000000000000483000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-063.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-063.phpt
new file mode 100644
index 00000000..5ea79e51
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-063.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx676] Zeros
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000000000000000000000000000000303000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "0E-8"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "0.00E-6"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000000000000000000000000000000303000
+{"d":{"$numberDecimal":"0E-8"}}
+180000001364000000000000000000000000000000303000
+180000001364000000000000000000000000000000303000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-064.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-064.phpt
new file mode 100644
index 00000000..4c36c203
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-064.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx637] Zeros
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('1800000013640000000000000000000000000000004A3000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "0E+5"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "0.00E+7"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+1800000013640000000000000000000000000000004a3000
+{"d":{"$numberDecimal":"0E+5"}}
+1800000013640000000000000000000000000000004a3000
+1800000013640000000000000000000000000000004a3000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-065.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-065.phpt
new file mode 100644
index 00000000..8c02f5c4
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-065.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx677] Zeros
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('1800000013640000000000000000000000000000002E3000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "0E-9"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "0.00E-7"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+1800000013640000000000000000000000000000002e3000
+{"d":{"$numberDecimal":"0E-9"}}
+1800000013640000000000000000000000000000002e3000
+1800000013640000000000000000000000000000002e3000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-066.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-066.phpt
new file mode 100644
index 00000000..8921362e
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-066.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx638] Zeros
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('1800000013640000000000000000000000000000004C3000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "0E+6"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "0.00E+8"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+1800000013640000000000000000000000000000004c3000
+{"d":{"$numberDecimal":"0E+6"}}
+1800000013640000000000000000000000000000004c3000
+1800000013640000000000000000000000000000004c3000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-067.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-067.phpt
new file mode 100644
index 00000000..127468db
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-067.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx678] Zeros
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('1800000013640000000000000000000000000000002C3000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "0E-10"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "0.00E-8"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+1800000013640000000000000000000000000000002c3000
+{"d":{"$numberDecimal":"0E-10"}}
+1800000013640000000000000000000000000000002c3000
+1800000013640000000000000000000000000000002c3000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-068.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-068.phpt
new file mode 100644
index 00000000..01d239f0
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-068.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx149] Numbers with E
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000000000000000000000000000000523000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "0E+9"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "000E+9"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000000000000000000000000000000523000
+{"d":{"$numberDecimal":"0E+9"}}
+180000001364000000000000000000000000000000523000
+180000001364000000000000000000000000000000523000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-069.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-069.phpt
new file mode 100644
index 00000000..248246a1
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-069.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx639] Zeros
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('1800000013640000000000000000000000000000004E3000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "0E+7"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "0.00E+9"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+1800000013640000000000000000000000000000004e3000
+{"d":{"$numberDecimal":"0E+7"}}
+1800000013640000000000000000000000000000004e3000
+1800000013640000000000000000000000000000004e3000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-070.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-070.phpt
new file mode 100644
index 00000000..d0cde819
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-070.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx679] Zeros
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('1800000013640000000000000000000000000000002A3000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "0E-11"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "0.00E-9"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+1800000013640000000000000000000000000000002a3000
+{"d":{"$numberDecimal":"0E-11"}}
+1800000013640000000000000000000000000000002a3000
+1800000013640000000000000000000000000000002a3000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-071.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-071.phpt
new file mode 100644
index 00000000..bc0c7036
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-071.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx063] strings without E cannot generate E in result
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400185C0ACE00000000000000000000383000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "345678.5432"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "+00345678.5432"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400185c0ace00000000000000000000383000
+{"d":{"$numberDecimal":"345678.5432"}}
+18000000136400185c0ace00000000000000000000383000
+18000000136400185c0ace00000000000000000000383000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-072.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-072.phpt
new file mode 100644
index 00000000..b0ed1d8e
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-072.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [basx018] conform to rules and exponent will be in permitted range).
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('1800000013640000000000000000000000000000003EB000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "-0.0"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+1800000013640000000000000000000000000000003eb000
+{"d":{"$numberDecimal":"-0.0"}}
+1800000013640000000000000000000000000000003eb000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-073.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-073.phpt
new file mode 100644
index 00000000..3fe749e4
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-073.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [basx609] Zeros
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('1800000013640000000000000000000000000000003E3000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "0.0"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+1800000013640000000000000000000000000000003e3000
+{"d":{"$numberDecimal":"0.0"}}
+1800000013640000000000000000000000000000003e3000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-074.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-074.phpt
new file mode 100644
index 00000000..c86e3bf8
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-074.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [basx614] Zeros
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('1800000013640000000000000000000000000000003EB000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "-0.0"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+1800000013640000000000000000000000000000003eb000
+{"d":{"$numberDecimal":"-0.0"}}
+1800000013640000000000000000000000000000003eb000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-075.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-075.phpt
new file mode 100644
index 00000000..b7fa18d2
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-075.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx684] Zeros
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000000000000000000000000000000403000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "0"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "00."}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000000000000000000000000000000403000
+{"d":{"$numberDecimal":"0"}}
+180000001364000000000000000000000000000000403000
+180000001364000000000000000000000000000000403000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-076.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-076.phpt
new file mode 100644
index 00000000..e8fc68c6
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-076.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx640] Zeros
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('1800000013640000000000000000000000000000003E3000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "0.0"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "0.0E+0"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+1800000013640000000000000000000000000000003e3000
+{"d":{"$numberDecimal":"0.0"}}
+1800000013640000000000000000000000000000003e3000
+1800000013640000000000000000000000000000003e3000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-077.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-077.phpt
new file mode 100644
index 00000000..8255bd82
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-077.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx660] Zeros
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('1800000013640000000000000000000000000000003E3000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "0.0"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "0.0E-0"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+1800000013640000000000000000000000000000003e3000
+{"d":{"$numberDecimal":"0.0"}}
+1800000013640000000000000000000000000000003e3000
+1800000013640000000000000000000000000000003e3000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-078.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-078.phpt
new file mode 100644
index 00000000..9d8ae6af
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-078.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx641] Zeros
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000000000000000000000000000000403000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "0"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "0.0E+1"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000000000000000000000000000000403000
+{"d":{"$numberDecimal":"0"}}
+180000001364000000000000000000000000000000403000
+180000001364000000000000000000000000000000403000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-079.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-079.phpt
new file mode 100644
index 00000000..883e6832
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-079.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx661] Zeros
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('1800000013640000000000000000000000000000003C3000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "0.00"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "0.0E-1"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+1800000013640000000000000000000000000000003c3000
+{"d":{"$numberDecimal":"0.00"}}
+1800000013640000000000000000000000000000003c3000
+1800000013640000000000000000000000000000003c3000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-080.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-080.phpt
new file mode 100644
index 00000000..82d9e67e
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-080.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx296] some more negative zeros [systematic tests below]
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('1800000013640000000000000000000000000000003AB000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "-0.000"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "-0.0E-2"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+1800000013640000000000000000000000000000003ab000
+{"d":{"$numberDecimal":"-0.000"}}
+1800000013640000000000000000000000000000003ab000
+1800000013640000000000000000000000000000003ab000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-081.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-081.phpt
new file mode 100644
index 00000000..c358e555
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-081.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx642] Zeros
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000000000000000000000000000000423000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "0E+1"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "0.0E+2"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000000000000000000000000000000423000
+{"d":{"$numberDecimal":"0E+1"}}
+180000001364000000000000000000000000000000423000
+180000001364000000000000000000000000000000423000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-082.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-082.phpt
new file mode 100644
index 00000000..b37b86ab
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-082.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx662] Zeros
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('1800000013640000000000000000000000000000003A3000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "0.000"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "0.0E-2"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+1800000013640000000000000000000000000000003a3000
+{"d":{"$numberDecimal":"0.000"}}
+1800000013640000000000000000000000000000003a3000
+1800000013640000000000000000000000000000003a3000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-083.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-083.phpt
new file mode 100644
index 00000000..ea80317d
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-083.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx297] some more negative zeros [systematic tests below]
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400000000000000000000000000000038B000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "-0.0000"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "-0.0E-3"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400000000000000000000000000000038b000
+{"d":{"$numberDecimal":"-0.0000"}}
+18000000136400000000000000000000000000000038b000
+18000000136400000000000000000000000000000038b000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-084.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-084.phpt
new file mode 100644
index 00000000..cb9e4486
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-084.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx643] Zeros
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000000000000000000000000000000443000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "0E+2"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "0.0E+3"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000000000000000000000000000000443000
+{"d":{"$numberDecimal":"0E+2"}}
+180000001364000000000000000000000000000000443000
+180000001364000000000000000000000000000000443000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-085.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-085.phpt
new file mode 100644
index 00000000..16e932e3
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-085.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx663] Zeros
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000000000000000000000000000000383000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "0.0000"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "0.0E-3"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000000000000000000000000000000383000
+{"d":{"$numberDecimal":"0.0000"}}
+180000001364000000000000000000000000000000383000
+180000001364000000000000000000000000000000383000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-086.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-086.phpt
new file mode 100644
index 00000000..e190213a
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-086.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx644] Zeros
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000000000000000000000000000000463000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "0E+3"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "0.0E+4"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000000000000000000000000000000463000
+{"d":{"$numberDecimal":"0E+3"}}
+180000001364000000000000000000000000000000463000
+180000001364000000000000000000000000000000463000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-087.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-087.phpt
new file mode 100644
index 00000000..acce5420
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-087.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx664] Zeros
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000000000000000000000000000000363000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "0.00000"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "0.0E-4"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000000000000000000000000000000363000
+{"d":{"$numberDecimal":"0.00000"}}
+180000001364000000000000000000000000000000363000
+180000001364000000000000000000000000000000363000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-088.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-088.phpt
new file mode 100644
index 00000000..3a759c1d
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-088.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx645] Zeros
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000000000000000000000000000000483000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "0E+4"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "0.0E+5"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000000000000000000000000000000483000
+{"d":{"$numberDecimal":"0E+4"}}
+180000001364000000000000000000000000000000483000
+180000001364000000000000000000000000000000483000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-089.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-089.phpt
new file mode 100644
index 00000000..8efd17b3
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-089.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx665] Zeros
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000000000000000000000000000000343000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "0.000000"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "0.0E-5"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000000000000000000000000000000343000
+{"d":{"$numberDecimal":"0.000000"}}
+180000001364000000000000000000000000000000343000
+180000001364000000000000000000000000000000343000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-090.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-090.phpt
new file mode 100644
index 00000000..efda8e5e
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-090.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx646] Zeros
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('1800000013640000000000000000000000000000004A3000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "0E+5"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "0.0E+6"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+1800000013640000000000000000000000000000004a3000
+{"d":{"$numberDecimal":"0E+5"}}
+1800000013640000000000000000000000000000004a3000
+1800000013640000000000000000000000000000004a3000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-091.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-091.phpt
new file mode 100644
index 00000000..57acd25c
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-091.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx666] Zeros
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000000000000000000000000000000323000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "0E-7"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "0.0E-6"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000000000000000000000000000000323000
+{"d":{"$numberDecimal":"0E-7"}}
+180000001364000000000000000000000000000000323000
+180000001364000000000000000000000000000000323000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-092.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-092.phpt
new file mode 100644
index 00000000..7397c9a1
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-092.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx647] Zeros
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('1800000013640000000000000000000000000000004C3000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "0E+6"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "0.0E+7"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+1800000013640000000000000000000000000000004c3000
+{"d":{"$numberDecimal":"0E+6"}}
+1800000013640000000000000000000000000000004c3000
+1800000013640000000000000000000000000000004c3000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-093.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-093.phpt
new file mode 100644
index 00000000..7161a91c
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-093.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx667] Zeros
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000000000000000000000000000000303000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "0E-8"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "0.0E-7"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000000000000000000000000000000303000
+{"d":{"$numberDecimal":"0E-8"}}
+180000001364000000000000000000000000000000303000
+180000001364000000000000000000000000000000303000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-094.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-094.phpt
new file mode 100644
index 00000000..b050fe81
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-094.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx648] Zeros
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('1800000013640000000000000000000000000000004E3000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "0E+7"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "0.0E+8"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+1800000013640000000000000000000000000000004e3000
+{"d":{"$numberDecimal":"0E+7"}}
+1800000013640000000000000000000000000000004e3000
+1800000013640000000000000000000000000000004e3000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-095.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-095.phpt
new file mode 100644
index 00000000..b6d761d3
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-095.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx668] Zeros
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('1800000013640000000000000000000000000000002E3000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "0E-9"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "0.0E-8"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+1800000013640000000000000000000000000000002e3000
+{"d":{"$numberDecimal":"0E-9"}}
+1800000013640000000000000000000000000000002e3000
+1800000013640000000000000000000000000000002e3000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-096.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-096.phpt
new file mode 100644
index 00000000..ccbd575c
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-096.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx160] Numbers with E
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000000000000000000000000000000523000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "0E+9"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "00E+9"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000000000000000000000000000000523000
+{"d":{"$numberDecimal":"0E+9"}}
+180000001364000000000000000000000000000000523000
+180000001364000000000000000000000000000000523000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-097.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-097.phpt
new file mode 100644
index 00000000..c319295a
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-097.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx161] Numbers with E
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('1800000013640000000000000000000000000000002E3000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "0E-9"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "00E-9"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+1800000013640000000000000000000000000000002e3000
+{"d":{"$numberDecimal":"0E-9"}}
+1800000013640000000000000000000000000000002e3000
+1800000013640000000000000000000000000000002e3000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-098.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-098.phpt
new file mode 100644
index 00000000..e1b5a708
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-098.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx649] Zeros
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000000000000000000000000000000503000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "0E+8"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "0.0E+9"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000000000000000000000000000000503000
+{"d":{"$numberDecimal":"0E+8"}}
+180000001364000000000000000000000000000000503000
+180000001364000000000000000000000000000000503000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-099.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-099.phpt
new file mode 100644
index 00000000..53aaa01b
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-099.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx669] Zeros
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('1800000013640000000000000000000000000000002C3000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "0E-10"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "0.0E-9"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+1800000013640000000000000000000000000000002c3000
+{"d":{"$numberDecimal":"0E-10"}}
+1800000013640000000000000000000000000000002c3000
+1800000013640000000000000000000000000000002c3000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-100.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-100.phpt
new file mode 100644
index 00000000..83449dc2
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-100.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx062] strings without E cannot generate E in result
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400185C0ACE00000000000000000000383000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "345678.5432"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "+0345678.5432"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400185c0ace00000000000000000000383000
+{"d":{"$numberDecimal":"345678.5432"}}
+18000000136400185c0ace00000000000000000000383000
+18000000136400185c0ace00000000000000000000383000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-101.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-101.phpt
new file mode 100644
index 00000000..f219ca29
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-101.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [basx001] conform to rules and exponent will be in permitted range).
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000000000000000000000000000000403000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "0"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000000000000000000000000000000403000
+{"d":{"$numberDecimal":"0"}}
+180000001364000000000000000000000000000000403000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-102.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-102.phpt
new file mode 100644
index 00000000..3f3f1422
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-102.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [basx017] conform to rules and exponent will be in permitted range).
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400000000000000000000000000000040B000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "-0"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400000000000000000000000000000040b000
+{"d":{"$numberDecimal":"-0"}}
+18000000136400000000000000000000000000000040b000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-103.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-103.phpt
new file mode 100644
index 00000000..34de3724
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-103.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx611] Zeros
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000000000000000000000000000000403000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "0"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "0."}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000000000000000000000000000000403000
+{"d":{"$numberDecimal":"0"}}
+180000001364000000000000000000000000000000403000
+180000001364000000000000000000000000000000403000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-104.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-104.phpt
new file mode 100644
index 00000000..6a736e39
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-104.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx613] Zeros
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400000000000000000000000000000040B000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "-0"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "-0."}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400000000000000000000000000000040b000
+{"d":{"$numberDecimal":"-0"}}
+18000000136400000000000000000000000000000040b000
+18000000136400000000000000000000000000000040b000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-105.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-105.phpt
new file mode 100644
index 00000000..d5c0907b
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-105.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx685] Zeros
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000000000000000000000000000000403000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "0"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "0."}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000000000000000000000000000000403000
+{"d":{"$numberDecimal":"0"}}
+180000001364000000000000000000000000000000403000
+180000001364000000000000000000000000000000403000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-106.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-106.phpt
new file mode 100644
index 00000000..75c549ae
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-106.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx688] Zeros
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000000000000000000000000000000403000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "0"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "+0."}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000000000000000000000000000000403000
+{"d":{"$numberDecimal":"0"}}
+180000001364000000000000000000000000000000403000
+180000001364000000000000000000000000000000403000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-107.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-107.phpt
new file mode 100644
index 00000000..e609c8a0
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-107.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx689] Zeros
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400000000000000000000000000000040B000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "-0"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "-0."}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400000000000000000000000000000040b000
+{"d":{"$numberDecimal":"-0"}}
+18000000136400000000000000000000000000000040b000
+18000000136400000000000000000000000000000040b000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-108.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-108.phpt
new file mode 100644
index 00000000..9663b86c
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-108.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx650] Zeros
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000000000000000000000000000000403000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "0"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "0E+0"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000000000000000000000000000000403000
+{"d":{"$numberDecimal":"0"}}
+180000001364000000000000000000000000000000403000
+180000001364000000000000000000000000000000403000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-109.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-109.phpt
new file mode 100644
index 00000000..9ef1da4e
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-109.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [basx651] Zeros
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000000000000000000000000000000423000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "0E+1"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000000000000000000000000000000423000
+{"d":{"$numberDecimal":"0E+1"}}
+180000001364000000000000000000000000000000423000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-110.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-110.phpt
new file mode 100644
index 00000000..28e255b4
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-110.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx298] some more negative zeros [systematic tests below]
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('1800000013640000000000000000000000000000003CB000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "-0.00"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "-0E-2"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+1800000013640000000000000000000000000000003cb000
+{"d":{"$numberDecimal":"-0.00"}}
+1800000013640000000000000000000000000000003cb000
+1800000013640000000000000000000000000000003cb000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-111.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-111.phpt
new file mode 100644
index 00000000..9c742feb
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-111.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [basx652] Zeros
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000000000000000000000000000000443000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "0E+2"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000000000000000000000000000000443000
+{"d":{"$numberDecimal":"0E+2"}}
+180000001364000000000000000000000000000000443000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-112.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-112.phpt
new file mode 100644
index 00000000..a0189bce
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-112.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx299] some more negative zeros [systematic tests below]
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('1800000013640000000000000000000000000000003AB000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "-0.000"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "-0E-3"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+1800000013640000000000000000000000000000003ab000
+{"d":{"$numberDecimal":"-0.000"}}
+1800000013640000000000000000000000000000003ab000
+1800000013640000000000000000000000000000003ab000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-113.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-113.phpt
new file mode 100644
index 00000000..3bbf69d9
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-113.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [basx653] Zeros
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000000000000000000000000000000463000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "0E+3"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000000000000000000000000000000463000
+{"d":{"$numberDecimal":"0E+3"}}
+180000001364000000000000000000000000000000463000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-114.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-114.phpt
new file mode 100644
index 00000000..47f9e4d3
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-114.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [basx654] Zeros
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000000000000000000000000000000483000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "0E+4"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000000000000000000000000000000483000
+{"d":{"$numberDecimal":"0E+4"}}
+180000001364000000000000000000000000000000483000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-115.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-115.phpt
new file mode 100644
index 00000000..1e17b99d
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-115.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [basx655] Zeros
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('1800000013640000000000000000000000000000004A3000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "0E+5"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+1800000013640000000000000000000000000000004a3000
+{"d":{"$numberDecimal":"0E+5"}}
+1800000013640000000000000000000000000000004a3000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-116.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-116.phpt
new file mode 100644
index 00000000..429759ac
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-116.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [basx656] Zeros
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('1800000013640000000000000000000000000000004C3000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "0E+6"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+1800000013640000000000000000000000000000004c3000
+{"d":{"$numberDecimal":"0E+6"}}
+1800000013640000000000000000000000000000004c3000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-117.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-117.phpt
new file mode 100644
index 00000000..0dc91b08
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-117.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [basx657] Zeros
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('1800000013640000000000000000000000000000004E3000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "0E+7"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+1800000013640000000000000000000000000000004e3000
+{"d":{"$numberDecimal":"0E+7"}}
+1800000013640000000000000000000000000000004e3000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-118.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-118.phpt
new file mode 100644
index 00000000..4a80b791
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-118.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [basx658] Zeros
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000000000000000000000000000000503000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "0E+8"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000000000000000000000000000000503000
+{"d":{"$numberDecimal":"0E+8"}}
+180000001364000000000000000000000000000000503000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-119.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-119.phpt
new file mode 100644
index 00000000..40af8299
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-119.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx138] Numbers with E
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000000000000000000000000000000523000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "0E+9"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "+0E+9"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000000000000000000000000000000523000
+{"d":{"$numberDecimal":"0E+9"}}
+180000001364000000000000000000000000000000523000
+180000001364000000000000000000000000000000523000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-120.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-120.phpt
new file mode 100644
index 00000000..a76f5a64
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-120.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [basx139] Numbers with E
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400000000000000000000000000000052B000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "-0E+9"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400000000000000000000000000000052b000
+{"d":{"$numberDecimal":"-0E+9"}}
+18000000136400000000000000000000000000000052b000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-121.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-121.phpt
new file mode 100644
index 00000000..f0a92d81
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-121.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [basx144] Numbers with E
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000000000000000000000000000000523000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "0E+9"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000000000000000000000000000000523000
+{"d":{"$numberDecimal":"0E+9"}}
+180000001364000000000000000000000000000000523000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-122.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-122.phpt
new file mode 100644
index 00000000..be4bb1cb
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-122.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx154] Numbers with E
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000000000000000000000000000000523000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "0E+9"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "0E9"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000000000000000000000000000000523000
+{"d":{"$numberDecimal":"0E+9"}}
+180000001364000000000000000000000000000000523000
+180000001364000000000000000000000000000000523000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-123.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-123.phpt
new file mode 100644
index 00000000..5c38e49d
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-123.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [basx659] Zeros
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000000000000000000000000000000523000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "0E+9"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000000000000000000000000000000523000
+{"d":{"$numberDecimal":"0E+9"}}
+180000001364000000000000000000000000000000523000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-124.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-124.phpt
new file mode 100644
index 00000000..a4446cc3
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-124.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx042] strings without E cannot generate E in result
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400FC040000000000000000000000003C3000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "12.76"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "+12.76"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400fc040000000000000000000000003c3000
+{"d":{"$numberDecimal":"12.76"}}
+18000000136400fc040000000000000000000000003c3000
+18000000136400fc040000000000000000000000003c3000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-125.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-125.phpt
new file mode 100644
index 00000000..f9e86a83
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-125.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx143] Numbers with E
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000100000000000000000000000000523000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "1E+9"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "+1E+009"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000100000000000000000000000000523000
+{"d":{"$numberDecimal":"1E+9"}}
+180000001364000100000000000000000000000000523000
+180000001364000100000000000000000000000000523000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-126.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-126.phpt
new file mode 100644
index 00000000..3834458d
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-126.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx061] strings without E cannot generate E in result
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400185C0ACE00000000000000000000383000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "345678.5432"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "+345678.5432"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400185c0ace00000000000000000000383000
+{"d":{"$numberDecimal":"345678.5432"}}
+18000000136400185c0ace00000000000000000000383000
+18000000136400185c0ace00000000000000000000383000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-127.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-127.phpt
new file mode 100644
index 00000000..10825644
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-127.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx036] conform to rules and exponent will be in permitted range).
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('1800000013640015CD5B0700000000000000000000203000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.23456789E-8"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "0.0000000123456789"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+1800000013640015cd5b0700000000000000000000203000
+{"d":{"$numberDecimal":"1.23456789E-8"}}
+1800000013640015cd5b0700000000000000000000203000
+1800000013640015cd5b0700000000000000000000203000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-128.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-128.phpt
new file mode 100644
index 00000000..c786de3e
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-128.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx035] conform to rules and exponent will be in permitted range).
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('1800000013640015CD5B0700000000000000000000223000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.23456789E-7"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "0.000000123456789"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+1800000013640015cd5b0700000000000000000000223000
+{"d":{"$numberDecimal":"1.23456789E-7"}}
+1800000013640015cd5b0700000000000000000000223000
+1800000013640015cd5b0700000000000000000000223000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-129.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-129.phpt
new file mode 100644
index 00000000..042791ad
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-129.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [basx034] conform to rules and exponent will be in permitted range).
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('1800000013640015CD5B0700000000000000000000243000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "0.00000123456789"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+1800000013640015cd5b0700000000000000000000243000
+{"d":{"$numberDecimal":"0.00000123456789"}}
+1800000013640015cd5b0700000000000000000000243000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-130.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-130.phpt
new file mode 100644
index 00000000..83df4461
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-130.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [basx053] strings without E cannot generate E in result
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364003200000000000000000000000000323000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "0.0000050"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364003200000000000000000000000000323000
+{"d":{"$numberDecimal":"0.0000050"}}
+180000001364003200000000000000000000000000323000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-131.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-131.phpt
new file mode 100644
index 00000000..b2c8f1d6
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-131.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [basx033] conform to rules and exponent will be in permitted range).
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('1800000013640015CD5B0700000000000000000000263000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "0.0000123456789"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+1800000013640015cd5b0700000000000000000000263000
+{"d":{"$numberDecimal":"0.0000123456789"}}
+1800000013640015cd5b0700000000000000000000263000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-132.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-132.phpt
new file mode 100644
index 00000000..ee932789
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-132.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [basx016] conform to rules and exponent will be in permitted range).
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000C000000000000000000000000003A3000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "0.012"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000c000000000000000000000000003a3000
+{"d":{"$numberDecimal":"0.012"}}
+180000001364000c000000000000000000000000003a3000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-133.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-133.phpt
new file mode 100644
index 00000000..a0054e7e
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-133.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [basx015] conform to rules and exponent will be in permitted range).
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364007B000000000000000000000000003A3000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "0.123"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364007b000000000000000000000000003a3000
+{"d":{"$numberDecimal":"0.123"}}
+180000001364007b000000000000000000000000003a3000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-134.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-134.phpt
new file mode 100644
index 00000000..015c404c
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-134.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [basx037] conform to rules and exponent will be in permitted range).
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('1800000013640078DF0D8648700000000000000000223000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "0.123456789012344"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+1800000013640078df0d8648700000000000000000223000
+{"d":{"$numberDecimal":"0.123456789012344"}}
+1800000013640078df0d8648700000000000000000223000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-135.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-135.phpt
new file mode 100644
index 00000000..c2d09e63
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-135.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [basx038] conform to rules and exponent will be in permitted range).
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('1800000013640079DF0D8648700000000000000000223000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "0.123456789012345"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+1800000013640079df0d8648700000000000000000223000
+{"d":{"$numberDecimal":"0.123456789012345"}}
+1800000013640079df0d8648700000000000000000223000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-136.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-136.phpt
new file mode 100644
index 00000000..ac5cf475
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-136.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [basx250] Numbers with E
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400F104000000000000000000000000383000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "0.1265"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400f104000000000000000000000000383000
+{"d":{"$numberDecimal":"0.1265"}}
+18000000136400f104000000000000000000000000383000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-137.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-137.phpt
new file mode 100644
index 00000000..d9aa5edd
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-137.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx257] Numbers with E
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400F104000000000000000000000000383000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "0.1265"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "0.1265E-0"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400f104000000000000000000000000383000
+{"d":{"$numberDecimal":"0.1265"}}
+18000000136400f104000000000000000000000000383000
+18000000136400f104000000000000000000000000383000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-138.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-138.phpt
new file mode 100644
index 00000000..45d06690
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-138.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx256] Numbers with E
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400F104000000000000000000000000363000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "0.01265"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "0.1265E-1"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400f104000000000000000000000000363000
+{"d":{"$numberDecimal":"0.01265"}}
+18000000136400f104000000000000000000000000363000
+18000000136400f104000000000000000000000000363000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-139.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-139.phpt
new file mode 100644
index 00000000..b7ae5026
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-139.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx258] Numbers with E
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400F1040000000000000000000000003A3000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.265"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "0.1265E+1"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400f1040000000000000000000000003a3000
+{"d":{"$numberDecimal":"1.265"}}
+18000000136400f1040000000000000000000000003a3000
+18000000136400f1040000000000000000000000003a3000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-140.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-140.phpt
new file mode 100644
index 00000000..91edbe5e
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-140.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx251] Numbers with E
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400F104000000000000000000000000103000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.265E-21"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "0.1265E-20"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400f104000000000000000000000000103000
+{"d":{"$numberDecimal":"1.265E-21"}}
+18000000136400f104000000000000000000000000103000
+18000000136400f104000000000000000000000000103000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-141.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-141.phpt
new file mode 100644
index 00000000..fd332b9a
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-141.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx263] Numbers with E
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400F104000000000000000000000000603000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.265E+19"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "0.1265E+20"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400f104000000000000000000000000603000
+{"d":{"$numberDecimal":"1.265E+19"}}
+18000000136400f104000000000000000000000000603000
+18000000136400f104000000000000000000000000603000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-142.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-142.phpt
new file mode 100644
index 00000000..59b5178b
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-142.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx255] Numbers with E
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400F104000000000000000000000000343000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "0.001265"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "0.1265E-2"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400f104000000000000000000000000343000
+{"d":{"$numberDecimal":"0.001265"}}
+18000000136400f104000000000000000000000000343000
+18000000136400f104000000000000000000000000343000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-143.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-143.phpt
new file mode 100644
index 00000000..0f65cfca
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-143.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx259] Numbers with E
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400F1040000000000000000000000003C3000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "12.65"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "0.1265E+2"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400f1040000000000000000000000003c3000
+{"d":{"$numberDecimal":"12.65"}}
+18000000136400f1040000000000000000000000003c3000
+18000000136400f1040000000000000000000000003c3000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-144.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-144.phpt
new file mode 100644
index 00000000..1e999924
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-144.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx254] Numbers with E
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400F104000000000000000000000000323000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "0.0001265"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "0.1265E-3"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400f104000000000000000000000000323000
+{"d":{"$numberDecimal":"0.0001265"}}
+18000000136400f104000000000000000000000000323000
+18000000136400f104000000000000000000000000323000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-145.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-145.phpt
new file mode 100644
index 00000000..10a6f37c
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-145.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx260] Numbers with E
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400F1040000000000000000000000003E3000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "126.5"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "0.1265E+3"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400f1040000000000000000000000003e3000
+{"d":{"$numberDecimal":"126.5"}}
+18000000136400f1040000000000000000000000003e3000
+18000000136400f1040000000000000000000000003e3000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-146.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-146.phpt
new file mode 100644
index 00000000..20d8bf20
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-146.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx253] Numbers with E
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400F104000000000000000000000000303000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "0.00001265"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "0.1265E-4"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400f104000000000000000000000000303000
+{"d":{"$numberDecimal":"0.00001265"}}
+18000000136400f104000000000000000000000000303000
+18000000136400f104000000000000000000000000303000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-147.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-147.phpt
new file mode 100644
index 00000000..1373988a
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-147.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx261] Numbers with E
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400F104000000000000000000000000403000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "1265"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "0.1265E+4"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400f104000000000000000000000000403000
+{"d":{"$numberDecimal":"1265"}}
+18000000136400f104000000000000000000000000403000
+18000000136400f104000000000000000000000000403000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-148.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-148.phpt
new file mode 100644
index 00000000..a789ab40
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-148.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx252] Numbers with E
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400F104000000000000000000000000283000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.265E-9"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "0.1265E-8"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400f104000000000000000000000000283000
+{"d":{"$numberDecimal":"1.265E-9"}}
+18000000136400f104000000000000000000000000283000
+18000000136400f104000000000000000000000000283000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-149.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-149.phpt
new file mode 100644
index 00000000..d0e1c38b
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-149.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx262] Numbers with E
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400F104000000000000000000000000483000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.265E+7"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "0.1265E+8"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400f104000000000000000000000000483000
+{"d":{"$numberDecimal":"1.265E+7"}}
+18000000136400f104000000000000000000000000483000
+18000000136400f104000000000000000000000000483000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-150.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-150.phpt
new file mode 100644
index 00000000..b9664b22
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-150.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx159] Numbers with E
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('1800000013640049000000000000000000000000002E3000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "7.3E-8"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "0.73e-7"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+1800000013640049000000000000000000000000002e3000
+{"d":{"$numberDecimal":"7.3E-8"}}
+1800000013640049000000000000000000000000002e3000
+1800000013640049000000000000000000000000002e3000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-151.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-151.phpt
new file mode 100644
index 00000000..e63888c0
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-151.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [basx004] conform to rules and exponent will be in permitted range).
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('1800000013640064000000000000000000000000003C3000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.00"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+1800000013640064000000000000000000000000003c3000
+{"d":{"$numberDecimal":"1.00"}}
+1800000013640064000000000000000000000000003c3000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-152.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-152.phpt
new file mode 100644
index 00000000..c72e87ee
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-152.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [basx003] conform to rules and exponent will be in permitted range).
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000A000000000000000000000000003E3000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.0"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000a000000000000000000000000003e3000
+{"d":{"$numberDecimal":"1.0"}}
+180000001364000a000000000000000000000000003e3000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-153.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-153.phpt
new file mode 100644
index 00000000..e3cc0bcc
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-153.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [basx002] conform to rules and exponent will be in permitted range).
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000100000000000000000000000000403000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "1"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000100000000000000000000000000403000
+{"d":{"$numberDecimal":"1"}}
+180000001364000100000000000000000000000000403000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-154.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-154.phpt
new file mode 100644
index 00000000..a3fbffbb
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-154.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx148] Numbers with E
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000100000000000000000000000000523000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "1E+9"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "1E+009"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000100000000000000000000000000523000
+{"d":{"$numberDecimal":"1E+9"}}
+180000001364000100000000000000000000000000523000
+180000001364000100000000000000000000000000523000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-155.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-155.phpt
new file mode 100644
index 00000000..6f112a08
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-155.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx153] Numbers with E
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000100000000000000000000000000523000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "1E+9"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "1E009"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000100000000000000000000000000523000
+{"d":{"$numberDecimal":"1E+9"}}
+180000001364000100000000000000000000000000523000
+180000001364000100000000000000000000000000523000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-156.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-156.phpt
new file mode 100644
index 00000000..5ec9c33a
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-156.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx141] Numbers with E
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000100000000000000000000000000523000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "1E+9"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "1e+09"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000100000000000000000000000000523000
+{"d":{"$numberDecimal":"1E+9"}}
+180000001364000100000000000000000000000000523000
+180000001364000100000000000000000000000000523000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-157.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-157.phpt
new file mode 100644
index 00000000..a9f885b4
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-157.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx146] Numbers with E
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000100000000000000000000000000523000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "1E+9"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "1E+09"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000100000000000000000000000000523000
+{"d":{"$numberDecimal":"1E+9"}}
+180000001364000100000000000000000000000000523000
+180000001364000100000000000000000000000000523000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-158.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-158.phpt
new file mode 100644
index 00000000..82ebd108
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-158.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx151] Numbers with E
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000100000000000000000000000000523000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "1E+9"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "1e09"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000100000000000000000000000000523000
+{"d":{"$numberDecimal":"1E+9"}}
+180000001364000100000000000000000000000000523000
+180000001364000100000000000000000000000000523000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-159.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-159.phpt
new file mode 100644
index 00000000..49fd218a
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-159.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [basx142] Numbers with E
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000100000000000000000000000000F43000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "1E+90"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000100000000000000000000000000f43000
+{"d":{"$numberDecimal":"1E+90"}}
+180000001364000100000000000000000000000000f43000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-160.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-160.phpt
new file mode 100644
index 00000000..a0b3648f
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-160.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx147] Numbers with E
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000100000000000000000000000000F43000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "1E+90"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "1e+90"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000100000000000000000000000000f43000
+{"d":{"$numberDecimal":"1E+90"}}
+180000001364000100000000000000000000000000f43000
+180000001364000100000000000000000000000000f43000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-161.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-161.phpt
new file mode 100644
index 00000000..e5521648
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-161.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx152] Numbers with E
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000100000000000000000000000000F43000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "1E+90"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "1E90"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000100000000000000000000000000f43000
+{"d":{"$numberDecimal":"1E+90"}}
+180000001364000100000000000000000000000000f43000
+180000001364000100000000000000000000000000f43000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-162.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-162.phpt
new file mode 100644
index 00000000..642c5e69
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-162.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [basx140] Numbers with E
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000100000000000000000000000000523000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "1E+9"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000100000000000000000000000000523000
+{"d":{"$numberDecimal":"1E+9"}}
+180000001364000100000000000000000000000000523000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-163.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-163.phpt
new file mode 100644
index 00000000..6a81bf6a
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-163.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx150] Numbers with E
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000100000000000000000000000000523000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "1E+9"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "1E9"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000100000000000000000000000000523000
+{"d":{"$numberDecimal":"1E+9"}}
+180000001364000100000000000000000000000000523000
+180000001364000100000000000000000000000000523000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-164.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-164.phpt
new file mode 100644
index 00000000..4a4d2f16
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-164.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [basx014] conform to rules and exponent will be in permitted range).
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400D2040000000000000000000000003A3000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.234"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400d2040000000000000000000000003a3000
+{"d":{"$numberDecimal":"1.234"}}
+18000000136400d2040000000000000000000000003a3000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-165.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-165.phpt
new file mode 100644
index 00000000..4a7b0221
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-165.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [basx170] Numbers with E
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400F1040000000000000000000000003A3000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.265"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400f1040000000000000000000000003a3000
+{"d":{"$numberDecimal":"1.265"}}
+18000000136400f1040000000000000000000000003a3000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-166.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-166.phpt
new file mode 100644
index 00000000..1a533948
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-166.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx177] Numbers with E
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400F1040000000000000000000000003A3000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.265"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "1.265E-0"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400f1040000000000000000000000003a3000
+{"d":{"$numberDecimal":"1.265"}}
+18000000136400f1040000000000000000000000003a3000
+18000000136400f1040000000000000000000000003a3000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-167.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-167.phpt
new file mode 100644
index 00000000..ba66f56d
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-167.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx176] Numbers with E
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400F104000000000000000000000000383000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "0.1265"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "1.265E-1"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400f104000000000000000000000000383000
+{"d":{"$numberDecimal":"0.1265"}}
+18000000136400f104000000000000000000000000383000
+18000000136400f104000000000000000000000000383000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-168.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-168.phpt
new file mode 100644
index 00000000..dc357100
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-168.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx178] Numbers with E
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400F1040000000000000000000000003C3000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "12.65"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "1.265E+1"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400f1040000000000000000000000003c3000
+{"d":{"$numberDecimal":"12.65"}}
+18000000136400f1040000000000000000000000003c3000
+18000000136400f1040000000000000000000000003c3000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-169.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-169.phpt
new file mode 100644
index 00000000..52a2d1e4
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-169.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [basx171] Numbers with E
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400F104000000000000000000000000123000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.265E-20"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400f104000000000000000000000000123000
+{"d":{"$numberDecimal":"1.265E-20"}}
+18000000136400f104000000000000000000000000123000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-170.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-170.phpt
new file mode 100644
index 00000000..b1e0d4fb
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-170.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [basx183] Numbers with E
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400F104000000000000000000000000623000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.265E+20"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400f104000000000000000000000000623000
+{"d":{"$numberDecimal":"1.265E+20"}}
+18000000136400f104000000000000000000000000623000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-171.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-171.phpt
new file mode 100644
index 00000000..819d7b3c
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-171.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx175] Numbers with E
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400F104000000000000000000000000363000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "0.01265"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "1.265E-2"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400f104000000000000000000000000363000
+{"d":{"$numberDecimal":"0.01265"}}
+18000000136400f104000000000000000000000000363000
+18000000136400f104000000000000000000000000363000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-172.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-172.phpt
new file mode 100644
index 00000000..2974e304
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-172.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx179] Numbers with E
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400F1040000000000000000000000003E3000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "126.5"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "1.265E+2"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400f1040000000000000000000000003e3000
+{"d":{"$numberDecimal":"126.5"}}
+18000000136400f1040000000000000000000000003e3000
+18000000136400f1040000000000000000000000003e3000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-173.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-173.phpt
new file mode 100644
index 00000000..d9b9b010
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-173.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx174] Numbers with E
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400F104000000000000000000000000343000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "0.001265"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "1.265E-3"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400f104000000000000000000000000343000
+{"d":{"$numberDecimal":"0.001265"}}
+18000000136400f104000000000000000000000000343000
+18000000136400f104000000000000000000000000343000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-174.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-174.phpt
new file mode 100644
index 00000000..6581cb1e
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-174.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx180] Numbers with E
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400F104000000000000000000000000403000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "1265"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "1.265E+3"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400f104000000000000000000000000403000
+{"d":{"$numberDecimal":"1265"}}
+18000000136400f104000000000000000000000000403000
+18000000136400f104000000000000000000000000403000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-175.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-175.phpt
new file mode 100644
index 00000000..139a85f3
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-175.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx173] Numbers with E
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400F104000000000000000000000000323000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "0.0001265"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "1.265E-4"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400f104000000000000000000000000323000
+{"d":{"$numberDecimal":"0.0001265"}}
+18000000136400f104000000000000000000000000323000
+18000000136400f104000000000000000000000000323000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-176.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-176.phpt
new file mode 100644
index 00000000..040b8f0d
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-176.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [basx181] Numbers with E
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400F104000000000000000000000000423000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.265E+4"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400f104000000000000000000000000423000
+{"d":{"$numberDecimal":"1.265E+4"}}
+18000000136400f104000000000000000000000000423000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-177.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-177.phpt
new file mode 100644
index 00000000..9def1035
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-177.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [basx172] Numbers with E
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400F1040000000000000000000000002A3000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.265E-8"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400f1040000000000000000000000002a3000
+{"d":{"$numberDecimal":"1.265E-8"}}
+18000000136400f1040000000000000000000000002a3000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-178.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-178.phpt
new file mode 100644
index 00000000..722742b2
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-178.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [basx182] Numbers with E
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400F1040000000000000000000000004A3000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.265E+8"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400f1040000000000000000000000004a3000
+{"d":{"$numberDecimal":"1.265E+8"}}
+18000000136400f1040000000000000000000000004a3000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-179.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-179.phpt
new file mode 100644
index 00000000..d1a79ea4
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-179.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [basx157] Numbers with E
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000400000000000000000000000000523000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "4E+9"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000400000000000000000000000000523000
+{"d":{"$numberDecimal":"4E+9"}}
+180000001364000400000000000000000000000000523000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-180.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-180.phpt
new file mode 100644
index 00000000..246ded1d
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-180.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx067] examples
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000500000000000000000000000000343000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "0.000005"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "5E-6"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000500000000000000000000000000343000
+{"d":{"$numberDecimal":"0.000005"}}
+180000001364000500000000000000000000000000343000
+180000001364000500000000000000000000000000343000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-181.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-181.phpt
new file mode 100644
index 00000000..1c3bff0a
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-181.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [basx069] examples
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000500000000000000000000000000323000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "5E-7"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000500000000000000000000000000323000
+{"d":{"$numberDecimal":"5E-7"}}
+180000001364000500000000000000000000000000323000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-182.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-182.phpt
new file mode 100644
index 00000000..639b8362
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-182.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx385] Engineering notation tests
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000700000000000000000000000000403000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "7"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "7E0"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000700000000000000000000000000403000
+{"d":{"$numberDecimal":"7"}}
+180000001364000700000000000000000000000000403000
+180000001364000700000000000000000000000000403000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-183.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-183.phpt
new file mode 100644
index 00000000..6c75ab83
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-183.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx365] Engineering notation tests
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000700000000000000000000000000543000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "7E+10"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "7E10"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000700000000000000000000000000543000
+{"d":{"$numberDecimal":"7E+10"}}
+180000001364000700000000000000000000000000543000
+180000001364000700000000000000000000000000543000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-184.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-184.phpt
new file mode 100644
index 00000000..5af18ce8
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-184.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [basx405] Engineering notation tests
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('1800000013640007000000000000000000000000002C3000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "7E-10"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+1800000013640007000000000000000000000000002c3000
+{"d":{"$numberDecimal":"7E-10"}}
+1800000013640007000000000000000000000000002c3000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-185.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-185.phpt
new file mode 100644
index 00000000..36f00484
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-185.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx363] Engineering notation tests
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000700000000000000000000000000563000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "7E+11"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "7E11"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000700000000000000000000000000563000
+{"d":{"$numberDecimal":"7E+11"}}
+180000001364000700000000000000000000000000563000
+180000001364000700000000000000000000000000563000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-186.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-186.phpt
new file mode 100644
index 00000000..6f42fdf2
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-186.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [basx407] Engineering notation tests
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('1800000013640007000000000000000000000000002A3000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "7E-11"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+1800000013640007000000000000000000000000002a3000
+{"d":{"$numberDecimal":"7E-11"}}
+1800000013640007000000000000000000000000002a3000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-187.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-187.phpt
new file mode 100644
index 00000000..733edd67
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-187.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx361] Engineering notation tests
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000700000000000000000000000000583000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "7E+12"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "7E12"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000700000000000000000000000000583000
+{"d":{"$numberDecimal":"7E+12"}}
+180000001364000700000000000000000000000000583000
+180000001364000700000000000000000000000000583000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-188.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-188.phpt
new file mode 100644
index 00000000..4aa37142
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-188.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [basx409] Engineering notation tests
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000700000000000000000000000000283000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "7E-12"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000700000000000000000000000000283000
+{"d":{"$numberDecimal":"7E-12"}}
+180000001364000700000000000000000000000000283000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-189.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-189.phpt
new file mode 100644
index 00000000..54cbc8d0
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-189.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [basx411] Engineering notation tests
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000700000000000000000000000000263000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "7E-13"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000700000000000000000000000000263000
+{"d":{"$numberDecimal":"7E-13"}}
+180000001364000700000000000000000000000000263000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-190.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-190.phpt
new file mode 100644
index 00000000..4193f990
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-190.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx383] Engineering notation tests
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000700000000000000000000000000423000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "7E+1"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "7E1"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000700000000000000000000000000423000
+{"d":{"$numberDecimal":"7E+1"}}
+180000001364000700000000000000000000000000423000
+180000001364000700000000000000000000000000423000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-191.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-191.phpt
new file mode 100644
index 00000000..663b20b6
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-191.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx387] Engineering notation tests
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('1800000013640007000000000000000000000000003E3000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "0.7"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "7E-1"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+1800000013640007000000000000000000000000003e3000
+{"d":{"$numberDecimal":"0.7"}}
+1800000013640007000000000000000000000000003e3000
+1800000013640007000000000000000000000000003e3000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-192.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-192.phpt
new file mode 100644
index 00000000..2c65748d
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-192.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx381] Engineering notation tests
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000700000000000000000000000000443000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "7E+2"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "7E2"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000700000000000000000000000000443000
+{"d":{"$numberDecimal":"7E+2"}}
+180000001364000700000000000000000000000000443000
+180000001364000700000000000000000000000000443000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-193.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-193.phpt
new file mode 100644
index 00000000..72bb0f5c
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-193.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx389] Engineering notation tests
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('1800000013640007000000000000000000000000003C3000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "0.07"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "7E-2"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+1800000013640007000000000000000000000000003c3000
+{"d":{"$numberDecimal":"0.07"}}
+1800000013640007000000000000000000000000003c3000
+1800000013640007000000000000000000000000003c3000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-194.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-194.phpt
new file mode 100644
index 00000000..138f0448
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-194.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx379] Engineering notation tests
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000700000000000000000000000000463000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "7E+3"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "7E3"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000700000000000000000000000000463000
+{"d":{"$numberDecimal":"7E+3"}}
+180000001364000700000000000000000000000000463000
+180000001364000700000000000000000000000000463000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-195.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-195.phpt
new file mode 100644
index 00000000..6f860bed
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-195.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx391] Engineering notation tests
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('1800000013640007000000000000000000000000003A3000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "0.007"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "7E-3"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+1800000013640007000000000000000000000000003a3000
+{"d":{"$numberDecimal":"0.007"}}
+1800000013640007000000000000000000000000003a3000
+1800000013640007000000000000000000000000003a3000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-196.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-196.phpt
new file mode 100644
index 00000000..f3727f0d
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-196.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx377] Engineering notation tests
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000700000000000000000000000000483000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "7E+4"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "7E4"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000700000000000000000000000000483000
+{"d":{"$numberDecimal":"7E+4"}}
+180000001364000700000000000000000000000000483000
+180000001364000700000000000000000000000000483000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-197.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-197.phpt
new file mode 100644
index 00000000..24b73760
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-197.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx393] Engineering notation tests
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000700000000000000000000000000383000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "0.0007"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "7E-4"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000700000000000000000000000000383000
+{"d":{"$numberDecimal":"0.0007"}}
+180000001364000700000000000000000000000000383000
+180000001364000700000000000000000000000000383000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-198.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-198.phpt
new file mode 100644
index 00000000..ef48f52d
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-198.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx375] Engineering notation tests
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('1800000013640007000000000000000000000000004A3000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "7E+5"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "7E5"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+1800000013640007000000000000000000000000004a3000
+{"d":{"$numberDecimal":"7E+5"}}
+1800000013640007000000000000000000000000004a3000
+1800000013640007000000000000000000000000004a3000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-199.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-199.phpt
new file mode 100644
index 00000000..db486dc4
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-199.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx395] Engineering notation tests
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000700000000000000000000000000363000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "0.00007"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "7E-5"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000700000000000000000000000000363000
+{"d":{"$numberDecimal":"0.00007"}}
+180000001364000700000000000000000000000000363000
+180000001364000700000000000000000000000000363000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-200.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-200.phpt
new file mode 100644
index 00000000..2ffa0079
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-200.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx373] Engineering notation tests
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('1800000013640007000000000000000000000000004C3000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "7E+6"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "7E6"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+1800000013640007000000000000000000000000004c3000
+{"d":{"$numberDecimal":"7E+6"}}
+1800000013640007000000000000000000000000004c3000
+1800000013640007000000000000000000000000004c3000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-201.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-201.phpt
new file mode 100644
index 00000000..fa790ff1
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-201.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx397] Engineering notation tests
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000700000000000000000000000000343000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "0.000007"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "7E-6"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000700000000000000000000000000343000
+{"d":{"$numberDecimal":"0.000007"}}
+180000001364000700000000000000000000000000343000
+180000001364000700000000000000000000000000343000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-202.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-202.phpt
new file mode 100644
index 00000000..2b24e73b
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-202.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx371] Engineering notation tests
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('1800000013640007000000000000000000000000004E3000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "7E+7"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "7E7"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+1800000013640007000000000000000000000000004e3000
+{"d":{"$numberDecimal":"7E+7"}}
+1800000013640007000000000000000000000000004e3000
+1800000013640007000000000000000000000000004e3000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-203.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-203.phpt
new file mode 100644
index 00000000..9fd29743
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-203.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [basx399] Engineering notation tests
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000700000000000000000000000000323000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "7E-7"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000700000000000000000000000000323000
+{"d":{"$numberDecimal":"7E-7"}}
+180000001364000700000000000000000000000000323000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-204.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-204.phpt
new file mode 100644
index 00000000..26d926cc
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-204.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx369] Engineering notation tests
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000700000000000000000000000000503000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "7E+8"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "7E8"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000700000000000000000000000000503000
+{"d":{"$numberDecimal":"7E+8"}}
+180000001364000700000000000000000000000000503000
+180000001364000700000000000000000000000000503000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-205.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-205.phpt
new file mode 100644
index 00000000..5af9ad16
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-205.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [basx401] Engineering notation tests
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000700000000000000000000000000303000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "7E-8"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000700000000000000000000000000303000
+{"d":{"$numberDecimal":"7E-8"}}
+180000001364000700000000000000000000000000303000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-206.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-206.phpt
new file mode 100644
index 00000000..cbf3d0e2
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-206.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx367] Engineering notation tests
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000700000000000000000000000000523000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "7E+9"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "7E9"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000700000000000000000000000000523000
+{"d":{"$numberDecimal":"7E+9"}}
+180000001364000700000000000000000000000000523000
+180000001364000700000000000000000000000000523000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-207.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-207.phpt
new file mode 100644
index 00000000..70b185f4
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-207.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [basx403] Engineering notation tests
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('1800000013640007000000000000000000000000002E3000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "7E-9"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+1800000013640007000000000000000000000000002e3000
+{"d":{"$numberDecimal":"7E-9"}}
+1800000013640007000000000000000000000000002e3000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-208.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-208.phpt
new file mode 100644
index 00000000..d6392659
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-208.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [basx007] conform to rules and exponent will be in permitted range).
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('1800000013640064000000000000000000000000003E3000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "10.0"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+1800000013640064000000000000000000000000003e3000
+{"d":{"$numberDecimal":"10.0"}}
+1800000013640064000000000000000000000000003e3000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-209.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-209.phpt
new file mode 100644
index 00000000..80ff7950
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-209.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [basx005] conform to rules and exponent will be in permitted range).
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000A00000000000000000000000000403000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "10"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000a00000000000000000000000000403000
+{"d":{"$numberDecimal":"10"}}
+180000001364000a00000000000000000000000000403000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-210.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-210.phpt
new file mode 100644
index 00000000..2a78965e
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-210.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx165] Numbers with E
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000A00000000000000000000000000523000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.0E+10"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "10E+009"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000a00000000000000000000000000523000
+{"d":{"$numberDecimal":"1.0E+10"}}
+180000001364000a00000000000000000000000000523000
+180000001364000a00000000000000000000000000523000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-211.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-211.phpt
new file mode 100644
index 00000000..9e109b89
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-211.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx163] Numbers with E
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000A00000000000000000000000000523000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.0E+10"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "10E+09"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000a00000000000000000000000000523000
+{"d":{"$numberDecimal":"1.0E+10"}}
+180000001364000a00000000000000000000000000523000
+180000001364000a00000000000000000000000000523000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-212.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-212.phpt
new file mode 100644
index 00000000..616b8d28
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-212.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx325] Engineering notation tests
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000A00000000000000000000000000403000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "10"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "10e0"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000a00000000000000000000000000403000
+{"d":{"$numberDecimal":"10"}}
+180000001364000a00000000000000000000000000403000
+180000001364000a00000000000000000000000000403000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-213.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-213.phpt
new file mode 100644
index 00000000..c258d9a2
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-213.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx305] Engineering notation tests
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000A00000000000000000000000000543000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.0E+11"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "10e10"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000a00000000000000000000000000543000
+{"d":{"$numberDecimal":"1.0E+11"}}
+180000001364000a00000000000000000000000000543000
+180000001364000a00000000000000000000000000543000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-214.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-214.phpt
new file mode 100644
index 00000000..7fd2ef81
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-214.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx345] Engineering notation tests
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000A000000000000000000000000002C3000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.0E-9"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "10e-10"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000a000000000000000000000000002c3000
+{"d":{"$numberDecimal":"1.0E-9"}}
+180000001364000a000000000000000000000000002c3000
+180000001364000a000000000000000000000000002c3000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-215.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-215.phpt
new file mode 100644
index 00000000..1be40290
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-215.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx303] Engineering notation tests
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000A00000000000000000000000000563000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.0E+12"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "10e11"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000a00000000000000000000000000563000
+{"d":{"$numberDecimal":"1.0E+12"}}
+180000001364000a00000000000000000000000000563000
+180000001364000a00000000000000000000000000563000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-216.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-216.phpt
new file mode 100644
index 00000000..115286f5
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-216.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx347] Engineering notation tests
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000A000000000000000000000000002A3000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.0E-10"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "10e-11"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000a000000000000000000000000002a3000
+{"d":{"$numberDecimal":"1.0E-10"}}
+180000001364000a000000000000000000000000002a3000
+180000001364000a000000000000000000000000002a3000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-217.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-217.phpt
new file mode 100644
index 00000000..1c974b80
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-217.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx301] Engineering notation tests
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000A00000000000000000000000000583000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.0E+13"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "10e12"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000a00000000000000000000000000583000
+{"d":{"$numberDecimal":"1.0E+13"}}
+180000001364000a00000000000000000000000000583000
+180000001364000a00000000000000000000000000583000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-218.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-218.phpt
new file mode 100644
index 00000000..669445a8
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-218.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx349] Engineering notation tests
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000A00000000000000000000000000283000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.0E-11"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "10e-12"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000a00000000000000000000000000283000
+{"d":{"$numberDecimal":"1.0E-11"}}
+180000001364000a00000000000000000000000000283000
+180000001364000a00000000000000000000000000283000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-219.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-219.phpt
new file mode 100644
index 00000000..0fd22b04
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-219.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx351] Engineering notation tests
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000A00000000000000000000000000263000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.0E-12"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "10e-13"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000a00000000000000000000000000263000
+{"d":{"$numberDecimal":"1.0E-12"}}
+180000001364000a00000000000000000000000000263000
+180000001364000a00000000000000000000000000263000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-220.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-220.phpt
new file mode 100644
index 00000000..fa0214f4
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-220.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx323] Engineering notation tests
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000A00000000000000000000000000423000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.0E+2"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "10e1"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000a00000000000000000000000000423000
+{"d":{"$numberDecimal":"1.0E+2"}}
+180000001364000a00000000000000000000000000423000
+180000001364000a00000000000000000000000000423000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-221.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-221.phpt
new file mode 100644
index 00000000..ad83d8ae
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-221.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx327] Engineering notation tests
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000A000000000000000000000000003E3000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.0"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "10e-1"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000a000000000000000000000000003e3000
+{"d":{"$numberDecimal":"1.0"}}
+180000001364000a000000000000000000000000003e3000
+180000001364000a000000000000000000000000003e3000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-222.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-222.phpt
new file mode 100644
index 00000000..9f296a07
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-222.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx321] Engineering notation tests
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000A00000000000000000000000000443000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.0E+3"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "10e2"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000a00000000000000000000000000443000
+{"d":{"$numberDecimal":"1.0E+3"}}
+180000001364000a00000000000000000000000000443000
+180000001364000a00000000000000000000000000443000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-223.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-223.phpt
new file mode 100644
index 00000000..31e4c446
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-223.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx329] Engineering notation tests
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000A000000000000000000000000003C3000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "0.10"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "10e-2"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000a000000000000000000000000003c3000
+{"d":{"$numberDecimal":"0.10"}}
+180000001364000a000000000000000000000000003c3000
+180000001364000a000000000000000000000000003c3000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-224.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-224.phpt
new file mode 100644
index 00000000..62117ecf
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-224.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx319] Engineering notation tests
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000A00000000000000000000000000463000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.0E+4"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "10e3"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000a00000000000000000000000000463000
+{"d":{"$numberDecimal":"1.0E+4"}}
+180000001364000a00000000000000000000000000463000
+180000001364000a00000000000000000000000000463000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-225.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-225.phpt
new file mode 100644
index 00000000..53638de3
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-225.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx331] Engineering notation tests
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000A000000000000000000000000003A3000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "0.010"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "10e-3"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000a000000000000000000000000003a3000
+{"d":{"$numberDecimal":"0.010"}}
+180000001364000a000000000000000000000000003a3000
+180000001364000a000000000000000000000000003a3000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-226.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-226.phpt
new file mode 100644
index 00000000..9998a25a
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-226.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx317] Engineering notation tests
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000A00000000000000000000000000483000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.0E+5"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "10e4"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000a00000000000000000000000000483000
+{"d":{"$numberDecimal":"1.0E+5"}}
+180000001364000a00000000000000000000000000483000
+180000001364000a00000000000000000000000000483000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-227.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-227.phpt
new file mode 100644
index 00000000..e7d13663
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-227.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx333] Engineering notation tests
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000A00000000000000000000000000383000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "0.0010"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "10e-4"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000a00000000000000000000000000383000
+{"d":{"$numberDecimal":"0.0010"}}
+180000001364000a00000000000000000000000000383000
+180000001364000a00000000000000000000000000383000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-228.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-228.phpt
new file mode 100644
index 00000000..78c7644e
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-228.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx315] Engineering notation tests
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000A000000000000000000000000004A3000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.0E+6"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "10e5"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000a000000000000000000000000004a3000
+{"d":{"$numberDecimal":"1.0E+6"}}
+180000001364000a000000000000000000000000004a3000
+180000001364000a000000000000000000000000004a3000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-229.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-229.phpt
new file mode 100644
index 00000000..cfd090da
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-229.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx335] Engineering notation tests
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000A00000000000000000000000000363000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "0.00010"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "10e-5"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000a00000000000000000000000000363000
+{"d":{"$numberDecimal":"0.00010"}}
+180000001364000a00000000000000000000000000363000
+180000001364000a00000000000000000000000000363000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-230.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-230.phpt
new file mode 100644
index 00000000..47a3db92
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-230.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx313] Engineering notation tests
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000A000000000000000000000000004C3000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.0E+7"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "10e6"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000a000000000000000000000000004c3000
+{"d":{"$numberDecimal":"1.0E+7"}}
+180000001364000a000000000000000000000000004c3000
+180000001364000a000000000000000000000000004c3000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-231.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-231.phpt
new file mode 100644
index 00000000..2a562b73
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-231.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx337] Engineering notation tests
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000A00000000000000000000000000343000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "0.000010"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "10e-6"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000a00000000000000000000000000343000
+{"d":{"$numberDecimal":"0.000010"}}
+180000001364000a00000000000000000000000000343000
+180000001364000a00000000000000000000000000343000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-232.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-232.phpt
new file mode 100644
index 00000000..47421b4b
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-232.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx311] Engineering notation tests
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000A000000000000000000000000004E3000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.0E+8"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "10e7"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000a000000000000000000000000004e3000
+{"d":{"$numberDecimal":"1.0E+8"}}
+180000001364000a000000000000000000000000004e3000
+180000001364000a000000000000000000000000004e3000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-233.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-233.phpt
new file mode 100644
index 00000000..caafa097
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-233.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx339] Engineering notation tests
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000A00000000000000000000000000323000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "0.0000010"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "10e-7"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000a00000000000000000000000000323000
+{"d":{"$numberDecimal":"0.0000010"}}
+180000001364000a00000000000000000000000000323000
+180000001364000a00000000000000000000000000323000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-234.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-234.phpt
new file mode 100644
index 00000000..154652d5
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-234.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx309] Engineering notation tests
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000A00000000000000000000000000503000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.0E+9"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "10e8"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000a00000000000000000000000000503000
+{"d":{"$numberDecimal":"1.0E+9"}}
+180000001364000a00000000000000000000000000503000
+180000001364000a00000000000000000000000000503000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-235.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-235.phpt
new file mode 100644
index 00000000..e5ced06d
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-235.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx341] Engineering notation tests
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000A00000000000000000000000000303000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.0E-7"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "10e-8"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000a00000000000000000000000000303000
+{"d":{"$numberDecimal":"1.0E-7"}}
+180000001364000a00000000000000000000000000303000
+180000001364000a00000000000000000000000000303000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-236.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-236.phpt
new file mode 100644
index 00000000..f634be6b
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-236.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx164] Numbers with E
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000A00000000000000000000000000F43000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.0E+91"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "10e+90"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000a00000000000000000000000000f43000
+{"d":{"$numberDecimal":"1.0E+91"}}
+180000001364000a00000000000000000000000000f43000
+180000001364000a00000000000000000000000000f43000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-237.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-237.phpt
new file mode 100644
index 00000000..a5851f61
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-237.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx162] Numbers with E
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000A00000000000000000000000000523000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.0E+10"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "10E+9"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000a00000000000000000000000000523000
+{"d":{"$numberDecimal":"1.0E+10"}}
+180000001364000a00000000000000000000000000523000
+180000001364000a00000000000000000000000000523000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-238.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-238.phpt
new file mode 100644
index 00000000..37bfa4e4
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-238.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx307] Engineering notation tests
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000A00000000000000000000000000523000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.0E+10"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "10e9"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000a00000000000000000000000000523000
+{"d":{"$numberDecimal":"1.0E+10"}}
+180000001364000a00000000000000000000000000523000
+180000001364000a00000000000000000000000000523000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-239.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-239.phpt
new file mode 100644
index 00000000..e69a165e
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-239.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx343] Engineering notation tests
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000A000000000000000000000000002E3000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.0E-8"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "10e-9"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000a000000000000000000000000002e3000
+{"d":{"$numberDecimal":"1.0E-8"}}
+180000001364000a000000000000000000000000002e3000
+180000001364000a000000000000000000000000002e3000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-240.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-240.phpt
new file mode 100644
index 00000000..e460557d
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-240.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [basx008] conform to rules and exponent will be in permitted range).
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('1800000013640065000000000000000000000000003E3000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "10.1"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+1800000013640065000000000000000000000000003e3000
+{"d":{"$numberDecimal":"10.1"}}
+1800000013640065000000000000000000000000003e3000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-241.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-241.phpt
new file mode 100644
index 00000000..ce94aec8
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-241.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [basx009] conform to rules and exponent will be in permitted range).
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('1800000013640068000000000000000000000000003E3000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "10.4"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+1800000013640068000000000000000000000000003e3000
+{"d":{"$numberDecimal":"10.4"}}
+1800000013640068000000000000000000000000003e3000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-242.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-242.phpt
new file mode 100644
index 00000000..dd2edb08
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-242.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [basx010] conform to rules and exponent will be in permitted range).
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('1800000013640069000000000000000000000000003E3000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "10.5"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+1800000013640069000000000000000000000000003e3000
+{"d":{"$numberDecimal":"10.5"}}
+1800000013640069000000000000000000000000003e3000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-243.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-243.phpt
new file mode 100644
index 00000000..82392e44
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-243.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [basx011] conform to rules and exponent will be in permitted range).
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364006A000000000000000000000000003E3000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "10.6"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364006a000000000000000000000000003e3000
+{"d":{"$numberDecimal":"10.6"}}
+180000001364006a000000000000000000000000003e3000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-244.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-244.phpt
new file mode 100644
index 00000000..ffdd5018
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-244.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [basx012] conform to rules and exponent will be in permitted range).
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364006D000000000000000000000000003E3000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "10.9"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364006d000000000000000000000000003e3000
+{"d":{"$numberDecimal":"10.9"}}
+180000001364006d000000000000000000000000003e3000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-245.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-245.phpt
new file mode 100644
index 00000000..f377bcc1
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-245.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [basx013] conform to rules and exponent will be in permitted range).
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364006E000000000000000000000000003E3000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "11.0"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364006e000000000000000000000000003e3000
+{"d":{"$numberDecimal":"11.0"}}
+180000001364006e000000000000000000000000003e3000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-246.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-246.phpt
new file mode 100644
index 00000000..89910381
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-246.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [basx040] strings without E cannot generate E in result
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000C00000000000000000000000000403000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "12"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000c00000000000000000000000000403000
+{"d":{"$numberDecimal":"12"}}
+180000001364000c00000000000000000000000000403000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-247.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-247.phpt
new file mode 100644
index 00000000..fabaa22b
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-247.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [basx190] Numbers with E
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400F1040000000000000000000000003C3000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "12.65"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400f1040000000000000000000000003c3000
+{"d":{"$numberDecimal":"12.65"}}
+18000000136400f1040000000000000000000000003c3000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-248.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-248.phpt
new file mode 100644
index 00000000..8e022823
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-248.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx197] Numbers with E
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400F1040000000000000000000000003C3000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "12.65"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "12.65E-0"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400f1040000000000000000000000003c3000
+{"d":{"$numberDecimal":"12.65"}}
+18000000136400f1040000000000000000000000003c3000
+18000000136400f1040000000000000000000000003c3000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-249.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-249.phpt
new file mode 100644
index 00000000..4939e9fc
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-249.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx196] Numbers with E
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400F1040000000000000000000000003A3000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.265"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "12.65E-1"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400f1040000000000000000000000003a3000
+{"d":{"$numberDecimal":"1.265"}}
+18000000136400f1040000000000000000000000003a3000
+18000000136400f1040000000000000000000000003a3000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-250.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-250.phpt
new file mode 100644
index 00000000..1d230c66
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-250.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx198] Numbers with E
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400F1040000000000000000000000003E3000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "126.5"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "12.65E+1"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400f1040000000000000000000000003e3000
+{"d":{"$numberDecimal":"126.5"}}
+18000000136400f1040000000000000000000000003e3000
+18000000136400f1040000000000000000000000003e3000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-251.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-251.phpt
new file mode 100644
index 00000000..0cd15f73
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-251.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx191] Numbers with E
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400F104000000000000000000000000143000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.265E-19"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "12.65E-20"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400f104000000000000000000000000143000
+{"d":{"$numberDecimal":"1.265E-19"}}
+18000000136400f104000000000000000000000000143000
+18000000136400f104000000000000000000000000143000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-252.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-252.phpt
new file mode 100644
index 00000000..9fe10320
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-252.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx203] Numbers with E
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400F104000000000000000000000000643000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.265E+21"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "12.65E+20"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400f104000000000000000000000000643000
+{"d":{"$numberDecimal":"1.265E+21"}}
+18000000136400f104000000000000000000000000643000
+18000000136400f104000000000000000000000000643000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-253.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-253.phpt
new file mode 100644
index 00000000..30ef33c3
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-253.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx195] Numbers with E
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400F104000000000000000000000000383000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "0.1265"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "12.65E-2"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400f104000000000000000000000000383000
+{"d":{"$numberDecimal":"0.1265"}}
+18000000136400f104000000000000000000000000383000
+18000000136400f104000000000000000000000000383000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-254.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-254.phpt
new file mode 100644
index 00000000..1f4a8a64
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-254.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx199] Numbers with E
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400F104000000000000000000000000403000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "1265"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "12.65E+2"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400f104000000000000000000000000403000
+{"d":{"$numberDecimal":"1265"}}
+18000000136400f104000000000000000000000000403000
+18000000136400f104000000000000000000000000403000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-255.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-255.phpt
new file mode 100644
index 00000000..f249f471
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-255.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx194] Numbers with E
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400F104000000000000000000000000363000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "0.01265"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "12.65E-3"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400f104000000000000000000000000363000
+{"d":{"$numberDecimal":"0.01265"}}
+18000000136400f104000000000000000000000000363000
+18000000136400f104000000000000000000000000363000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-256.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-256.phpt
new file mode 100644
index 00000000..7afd5f34
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-256.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx200] Numbers with E
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400F104000000000000000000000000423000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.265E+4"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "12.65E+3"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400f104000000000000000000000000423000
+{"d":{"$numberDecimal":"1.265E+4"}}
+18000000136400f104000000000000000000000000423000
+18000000136400f104000000000000000000000000423000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-257.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-257.phpt
new file mode 100644
index 00000000..380e5479
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-257.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx193] Numbers with E
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400F104000000000000000000000000343000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "0.001265"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "12.65E-4"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400f104000000000000000000000000343000
+{"d":{"$numberDecimal":"0.001265"}}
+18000000136400f104000000000000000000000000343000
+18000000136400f104000000000000000000000000343000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-258.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-258.phpt
new file mode 100644
index 00000000..4731d026
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-258.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx201] Numbers with E
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400F104000000000000000000000000443000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.265E+5"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "12.65E+4"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400f104000000000000000000000000443000
+{"d":{"$numberDecimal":"1.265E+5"}}
+18000000136400f104000000000000000000000000443000
+18000000136400f104000000000000000000000000443000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-259.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-259.phpt
new file mode 100644
index 00000000..8095e28e
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-259.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx192] Numbers with E
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400F1040000000000000000000000002C3000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.265E-7"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "12.65E-8"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400f1040000000000000000000000002c3000
+{"d":{"$numberDecimal":"1.265E-7"}}
+18000000136400f1040000000000000000000000002c3000
+18000000136400f1040000000000000000000000002c3000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-260.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-260.phpt
new file mode 100644
index 00000000..400763f1
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-260.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx202] Numbers with E
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400F1040000000000000000000000004C3000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.265E+9"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "12.65E+8"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400f1040000000000000000000000004c3000
+{"d":{"$numberDecimal":"1.265E+9"}}
+18000000136400f1040000000000000000000000004c3000
+18000000136400f1040000000000000000000000004c3000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-261.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-261.phpt
new file mode 100644
index 00000000..a4ebf9ac
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-261.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx044] strings without E cannot generate E in result
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400FC040000000000000000000000003C3000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "12.76"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "012.76"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400fc040000000000000000000000003c3000
+{"d":{"$numberDecimal":"12.76"}}
+18000000136400fc040000000000000000000000003c3000
+18000000136400fc040000000000000000000000003c3000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-262.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-262.phpt
new file mode 100644
index 00000000..e2350027
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-262.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [basx042] strings without E cannot generate E in result
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400FC040000000000000000000000003C3000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "12.76"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400fc040000000000000000000000003c3000
+{"d":{"$numberDecimal":"12.76"}}
+18000000136400fc040000000000000000000000003c3000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-263.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-263.phpt
new file mode 100644
index 00000000..624a6ae7
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-263.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx046] strings without E cannot generate E in result
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364001100000000000000000000000000403000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "17"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "17."}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364001100000000000000000000000000403000
+{"d":{"$numberDecimal":"17"}}
+180000001364001100000000000000000000000000403000
+180000001364001100000000000000000000000000403000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-264.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-264.phpt
new file mode 100644
index 00000000..aa5982ba
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-264.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx049] strings without E cannot generate E in result
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364002C00000000000000000000000000403000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "44"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "0044"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364002c00000000000000000000000000403000
+{"d":{"$numberDecimal":"44"}}
+180000001364002c00000000000000000000000000403000
+180000001364002c00000000000000000000000000403000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-265.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-265.phpt
new file mode 100644
index 00000000..946fcd58
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-265.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx048] strings without E cannot generate E in result
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364002C00000000000000000000000000403000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "44"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "044"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364002c00000000000000000000000000403000
+{"d":{"$numberDecimal":"44"}}
+180000001364002c00000000000000000000000000403000
+180000001364002c00000000000000000000000000403000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-266.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-266.phpt
new file mode 100644
index 00000000..089d943c
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-266.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx158] Numbers with E
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364002C00000000000000000000000000523000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "4.4E+10"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "44E+9"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364002c00000000000000000000000000523000
+{"d":{"$numberDecimal":"4.4E+10"}}
+180000001364002c00000000000000000000000000523000
+180000001364002c00000000000000000000000000523000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-267.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-267.phpt
new file mode 100644
index 00000000..ff8042d7
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-267.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx068] examples
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364003200000000000000000000000000323000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "0.0000050"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "50E-7"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364003200000000000000000000000000323000
+{"d":{"$numberDecimal":"0.0000050"}}
+180000001364003200000000000000000000000000323000
+180000001364003200000000000000000000000000323000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-268.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-268.phpt
new file mode 100644
index 00000000..aa0f8eff
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-268.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx169] Numbers with E
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364006400000000000000000000000000523000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.00E+11"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "100e+009"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364006400000000000000000000000000523000
+{"d":{"$numberDecimal":"1.00E+11"}}
+180000001364006400000000000000000000000000523000
+180000001364006400000000000000000000000000523000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-269.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-269.phpt
new file mode 100644
index 00000000..d3c07467
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-269.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx167] Numbers with E
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364006400000000000000000000000000523000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.00E+11"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "100e+09"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364006400000000000000000000000000523000
+{"d":{"$numberDecimal":"1.00E+11"}}
+180000001364006400000000000000000000000000523000
+180000001364006400000000000000000000000000523000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-270.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-270.phpt
new file mode 100644
index 00000000..3c25e66b
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-270.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx168] Numbers with E
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364006400000000000000000000000000F43000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.00E+92"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "100E+90"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364006400000000000000000000000000f43000
+{"d":{"$numberDecimal":"1.00E+92"}}
+180000001364006400000000000000000000000000f43000
+180000001364006400000000000000000000000000f43000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-271.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-271.phpt
new file mode 100644
index 00000000..dc9bc314
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-271.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx166] Numbers with E
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364006400000000000000000000000000523000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.00E+11"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "100e+9"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364006400000000000000000000000000523000
+{"d":{"$numberDecimal":"1.00E+11"}}
+180000001364006400000000000000000000000000523000
+180000001364006400000000000000000000000000523000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-272.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-272.phpt
new file mode 100644
index 00000000..0caff5d4
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-272.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [basx210] Numbers with E
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400F1040000000000000000000000003E3000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "126.5"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400f1040000000000000000000000003e3000
+{"d":{"$numberDecimal":"126.5"}}
+18000000136400f1040000000000000000000000003e3000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-273.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-273.phpt
new file mode 100644
index 00000000..33395a13
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-273.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx217] Numbers with E
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400F1040000000000000000000000003E3000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "126.5"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "126.5E-0"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400f1040000000000000000000000003e3000
+{"d":{"$numberDecimal":"126.5"}}
+18000000136400f1040000000000000000000000003e3000
+18000000136400f1040000000000000000000000003e3000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-274.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-274.phpt
new file mode 100644
index 00000000..4e82a330
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-274.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx216] Numbers with E
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400F1040000000000000000000000003C3000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "12.65"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "126.5E-1"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400f1040000000000000000000000003c3000
+{"d":{"$numberDecimal":"12.65"}}
+18000000136400f1040000000000000000000000003c3000
+18000000136400f1040000000000000000000000003c3000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-275.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-275.phpt
new file mode 100644
index 00000000..a5829c7b
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-275.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx218] Numbers with E
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400F104000000000000000000000000403000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "1265"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "126.5E+1"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400f104000000000000000000000000403000
+{"d":{"$numberDecimal":"1265"}}
+18000000136400f104000000000000000000000000403000
+18000000136400f104000000000000000000000000403000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-276.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-276.phpt
new file mode 100644
index 00000000..76303edb
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-276.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx211] Numbers with E
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400F104000000000000000000000000163000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.265E-18"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "126.5E-20"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400f104000000000000000000000000163000
+{"d":{"$numberDecimal":"1.265E-18"}}
+18000000136400f104000000000000000000000000163000
+18000000136400f104000000000000000000000000163000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-277.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-277.phpt
new file mode 100644
index 00000000..1817800c
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-277.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx223] Numbers with E
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400F104000000000000000000000000663000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.265E+22"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "126.5E+20"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400f104000000000000000000000000663000
+{"d":{"$numberDecimal":"1.265E+22"}}
+18000000136400f104000000000000000000000000663000
+18000000136400f104000000000000000000000000663000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-278.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-278.phpt
new file mode 100644
index 00000000..8eba669a
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-278.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx215] Numbers with E
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400F1040000000000000000000000003A3000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.265"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "126.5E-2"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400f1040000000000000000000000003a3000
+{"d":{"$numberDecimal":"1.265"}}
+18000000136400f1040000000000000000000000003a3000
+18000000136400f1040000000000000000000000003a3000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-279.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-279.phpt
new file mode 100644
index 00000000..c8c2ef09
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-279.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx219] Numbers with E
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400F104000000000000000000000000423000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.265E+4"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "126.5E+2"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400f104000000000000000000000000423000
+{"d":{"$numberDecimal":"1.265E+4"}}
+18000000136400f104000000000000000000000000423000
+18000000136400f104000000000000000000000000423000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-280.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-280.phpt
new file mode 100644
index 00000000..d9ce5fe2
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-280.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx214] Numbers with E
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400F104000000000000000000000000383000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "0.1265"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "126.5E-3"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400f104000000000000000000000000383000
+{"d":{"$numberDecimal":"0.1265"}}
+18000000136400f104000000000000000000000000383000
+18000000136400f104000000000000000000000000383000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-281.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-281.phpt
new file mode 100644
index 00000000..c18071cc
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-281.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx220] Numbers with E
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400F104000000000000000000000000443000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.265E+5"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "126.5E+3"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400f104000000000000000000000000443000
+{"d":{"$numberDecimal":"1.265E+5"}}
+18000000136400f104000000000000000000000000443000
+18000000136400f104000000000000000000000000443000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-282.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-282.phpt
new file mode 100644
index 00000000..2e6ddea3
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-282.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx213] Numbers with E
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400F104000000000000000000000000363000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "0.01265"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "126.5E-4"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400f104000000000000000000000000363000
+{"d":{"$numberDecimal":"0.01265"}}
+18000000136400f104000000000000000000000000363000
+18000000136400f104000000000000000000000000363000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-283.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-283.phpt
new file mode 100644
index 00000000..0bb3aabd
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-283.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx221] Numbers with E
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400F104000000000000000000000000463000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.265E+6"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "126.5E+4"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400f104000000000000000000000000463000
+{"d":{"$numberDecimal":"1.265E+6"}}
+18000000136400f104000000000000000000000000463000
+18000000136400f104000000000000000000000000463000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-284.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-284.phpt
new file mode 100644
index 00000000..3b07ca42
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-284.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx212] Numbers with E
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400F1040000000000000000000000002E3000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "0.000001265"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "126.5E-8"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400f1040000000000000000000000002e3000
+{"d":{"$numberDecimal":"0.000001265"}}
+18000000136400f1040000000000000000000000002e3000
+18000000136400f1040000000000000000000000002e3000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-285.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-285.phpt
new file mode 100644
index 00000000..cd65f0e6
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-285.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx222] Numbers with E
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400F1040000000000000000000000004E3000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.265E+10"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "126.5E+8"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400f1040000000000000000000000004e3000
+{"d":{"$numberDecimal":"1.265E+10"}}
+18000000136400f1040000000000000000000000004e3000
+18000000136400f1040000000000000000000000004e3000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-286.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-286.phpt
new file mode 100644
index 00000000..8c821c73
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-286.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [basx006] conform to rules and exponent will be in permitted range).
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400E803000000000000000000000000403000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "1000"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400e803000000000000000000000000403000
+{"d":{"$numberDecimal":"1000"}}
+18000000136400e803000000000000000000000000403000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-287.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-287.phpt
new file mode 100644
index 00000000..41cd0ebe
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-287.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [basx230] Numbers with E
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400F104000000000000000000000000403000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "1265"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400f104000000000000000000000000403000
+{"d":{"$numberDecimal":"1265"}}
+18000000136400f104000000000000000000000000403000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-288.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-288.phpt
new file mode 100644
index 00000000..2d45f520
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-288.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx237] Numbers with E
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400F104000000000000000000000000403000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "1265"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "1265E-0"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400f104000000000000000000000000403000
+{"d":{"$numberDecimal":"1265"}}
+18000000136400f104000000000000000000000000403000
+18000000136400f104000000000000000000000000403000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-289.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-289.phpt
new file mode 100644
index 00000000..14816e2f
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-289.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx236] Numbers with E
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400F1040000000000000000000000003E3000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "126.5"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "1265E-1"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400f1040000000000000000000000003e3000
+{"d":{"$numberDecimal":"126.5"}}
+18000000136400f1040000000000000000000000003e3000
+18000000136400f1040000000000000000000000003e3000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-290.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-290.phpt
new file mode 100644
index 00000000..9add8be0
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-290.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx238] Numbers with E
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400F104000000000000000000000000423000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.265E+4"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "1265E+1"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400f104000000000000000000000000423000
+{"d":{"$numberDecimal":"1.265E+4"}}
+18000000136400f104000000000000000000000000423000
+18000000136400f104000000000000000000000000423000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-291.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-291.phpt
new file mode 100644
index 00000000..15ecf99a
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-291.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx231] Numbers with E
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400F104000000000000000000000000183000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.265E-17"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "1265E-20"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400f104000000000000000000000000183000
+{"d":{"$numberDecimal":"1.265E-17"}}
+18000000136400f104000000000000000000000000183000
+18000000136400f104000000000000000000000000183000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-292.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-292.phpt
new file mode 100644
index 00000000..1e85aeff
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-292.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx243] Numbers with E
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400F104000000000000000000000000683000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.265E+23"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "1265E+20"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400f104000000000000000000000000683000
+{"d":{"$numberDecimal":"1.265E+23"}}
+18000000136400f104000000000000000000000000683000
+18000000136400f104000000000000000000000000683000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-293.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-293.phpt
new file mode 100644
index 00000000..e5e0372f
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-293.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx235] Numbers with E
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400F1040000000000000000000000003C3000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "12.65"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "1265E-2"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400f1040000000000000000000000003c3000
+{"d":{"$numberDecimal":"12.65"}}
+18000000136400f1040000000000000000000000003c3000
+18000000136400f1040000000000000000000000003c3000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-294.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-294.phpt
new file mode 100644
index 00000000..530ed238
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-294.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx239] Numbers with E
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400F104000000000000000000000000443000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.265E+5"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "1265E+2"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400f104000000000000000000000000443000
+{"d":{"$numberDecimal":"1.265E+5"}}
+18000000136400f104000000000000000000000000443000
+18000000136400f104000000000000000000000000443000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-295.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-295.phpt
new file mode 100644
index 00000000..12c18d89
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-295.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx234] Numbers with E
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400F1040000000000000000000000003A3000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.265"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "1265E-3"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400f1040000000000000000000000003a3000
+{"d":{"$numberDecimal":"1.265"}}
+18000000136400f1040000000000000000000000003a3000
+18000000136400f1040000000000000000000000003a3000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-296.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-296.phpt
new file mode 100644
index 00000000..969135f7
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-296.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx240] Numbers with E
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400F104000000000000000000000000463000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.265E+6"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "1265E+3"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400f104000000000000000000000000463000
+{"d":{"$numberDecimal":"1.265E+6"}}
+18000000136400f104000000000000000000000000463000
+18000000136400f104000000000000000000000000463000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-297.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-297.phpt
new file mode 100644
index 00000000..5e461ac0
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-297.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx233] Numbers with E
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400F104000000000000000000000000383000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "0.1265"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "1265E-4"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400f104000000000000000000000000383000
+{"d":{"$numberDecimal":"0.1265"}}
+18000000136400f104000000000000000000000000383000
+18000000136400f104000000000000000000000000383000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-298.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-298.phpt
new file mode 100644
index 00000000..656642b6
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-298.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx241] Numbers with E
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400F104000000000000000000000000483000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.265E+7"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "1265E+4"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400f104000000000000000000000000483000
+{"d":{"$numberDecimal":"1.265E+7"}}
+18000000136400f104000000000000000000000000483000
+18000000136400f104000000000000000000000000483000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-299.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-299.phpt
new file mode 100644
index 00000000..c6057686
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-299.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx232] Numbers with E
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400F104000000000000000000000000303000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "0.00001265"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "1265E-8"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400f104000000000000000000000000303000
+{"d":{"$numberDecimal":"0.00001265"}}
+18000000136400f104000000000000000000000000303000
+18000000136400f104000000000000000000000000303000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-300.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-300.phpt
new file mode 100644
index 00000000..f64919a8
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-300.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx242] Numbers with E
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400F104000000000000000000000000503000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.265E+11"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "1265E+8"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400f104000000000000000000000000503000
+{"d":{"$numberDecimal":"1.265E+11"}}
+18000000136400f104000000000000000000000000503000
+18000000136400f104000000000000000000000000503000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-301.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-301.phpt
new file mode 100644
index 00000000..886bd7f6
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-301.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [basx060] strings without E cannot generate E in result
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400185C0ACE00000000000000000000383000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "345678.5432"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400185c0ace00000000000000000000383000
+{"d":{"$numberDecimal":"345678.5432"}}
+18000000136400185c0ace00000000000000000000383000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-302.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-302.phpt
new file mode 100644
index 00000000..37f1b433
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-302.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx059] strings without E cannot generate E in result
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400F198670C08000000000000000000363000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "345678.54321"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "0345678.54321"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400f198670c08000000000000000000363000
+{"d":{"$numberDecimal":"345678.54321"}}
+18000000136400f198670c08000000000000000000363000
+18000000136400f198670c08000000000000000000363000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-303.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-303.phpt
new file mode 100644
index 00000000..4930245c
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-303.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [basx058] strings without E cannot generate E in result
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364006AF90B7C50000000000000000000343000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "345678.543210"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364006af90b7c50000000000000000000343000
+{"d":{"$numberDecimal":"345678.543210"}}
+180000001364006af90b7c50000000000000000000343000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-304.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-304.phpt
new file mode 100644
index 00000000..5a15e464
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-304.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [basx057] strings without E cannot generate E in result
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364006A19562522020000000000000000343000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "2345678.543210"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364006a19562522020000000000000000343000
+{"d":{"$numberDecimal":"2345678.543210"}}
+180000001364006a19562522020000000000000000343000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-305.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-305.phpt
new file mode 100644
index 00000000..97b3cd8a
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-305.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [basx056] strings without E cannot generate E in result
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364006AB9C8733A0B0000000000000000343000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "12345678.543210"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364006ab9c8733a0b0000000000000000343000
+{"d":{"$numberDecimal":"12345678.543210"}}
+180000001364006ab9c8733a0b0000000000000000343000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-306.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-306.phpt
new file mode 100644
index 00000000..d1121ac0
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-306.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [basx031] conform to rules and exponent will be in permitted range).
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('1800000013640040AF0D8648700000000000000000343000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "123456789.000000"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+1800000013640040af0d8648700000000000000000343000
+{"d":{"$numberDecimal":"123456789.000000"}}
+1800000013640040af0d8648700000000000000000343000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-307.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-307.phpt
new file mode 100644
index 00000000..597ee755
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-307.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [basx030] conform to rules and exponent will be in permitted range).
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('1800000013640080910F8648700000000000000000343000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "123456789.123456"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+1800000013640080910f8648700000000000000000343000
+{"d":{"$numberDecimal":"123456789.123456"}}
+1800000013640080910f8648700000000000000000343000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-308.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-308.phpt
new file mode 100644
index 00000000..5be085ea
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-3-valid-308.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [basx032] conform to rules and exponent will be in permitted range).
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('1800000013640080910F8648700000000000000000403000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "123456789123456"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+1800000013640080910f8648700000000000000000403000
+{"d":{"$numberDecimal":"123456789123456"}}
+1800000013640080910f8648700000000000000000403000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-4-parseError-001.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-4-parseError-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/decimal128-4-parseError-001.phpt
rename to mongodb-1.9.0/tests/bson-corpus/decimal128-4-parseError-001.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-4-parseError-002.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-4-parseError-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/decimal128-4-parseError-002.phpt
rename to mongodb-1.9.0/tests/bson-corpus/decimal128-4-parseError-002.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-4-parseError-003.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-4-parseError-003.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/decimal128-4-parseError-003.phpt
rename to mongodb-1.9.0/tests/bson-corpus/decimal128-4-parseError-003.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-4-parseError-004.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-4-parseError-004.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/decimal128-4-parseError-004.phpt
rename to mongodb-1.9.0/tests/bson-corpus/decimal128-4-parseError-004.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-4-parseError-005.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-4-parseError-005.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/decimal128-4-parseError-005.phpt
rename to mongodb-1.9.0/tests/bson-corpus/decimal128-4-parseError-005.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-4-parseError-006.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-4-parseError-006.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/decimal128-4-parseError-006.phpt
rename to mongodb-1.9.0/tests/bson-corpus/decimal128-4-parseError-006.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-4-parseError-007.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-4-parseError-007.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/decimal128-4-parseError-007.phpt
rename to mongodb-1.9.0/tests/bson-corpus/decimal128-4-parseError-007.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-4-parseError-008.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-4-parseError-008.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/decimal128-4-parseError-008.phpt
rename to mongodb-1.9.0/tests/bson-corpus/decimal128-4-parseError-008.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-4-parseError-009.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-4-parseError-009.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/decimal128-4-parseError-009.phpt
rename to mongodb-1.9.0/tests/bson-corpus/decimal128-4-parseError-009.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-4-parseError-010.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-4-parseError-010.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/decimal128-4-parseError-010.phpt
rename to mongodb-1.9.0/tests/bson-corpus/decimal128-4-parseError-010.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-4-parseError-011.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-4-parseError-011.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/decimal128-4-parseError-011.phpt
rename to mongodb-1.9.0/tests/bson-corpus/decimal128-4-parseError-011.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-4-parseError-012.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-4-parseError-012.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/decimal128-4-parseError-012.phpt
rename to mongodb-1.9.0/tests/bson-corpus/decimal128-4-parseError-012.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-4-parseError-013.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-4-parseError-013.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/decimal128-4-parseError-013.phpt
rename to mongodb-1.9.0/tests/bson-corpus/decimal128-4-parseError-013.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-4-parseError-014.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-4-parseError-014.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/decimal128-4-parseError-014.phpt
rename to mongodb-1.9.0/tests/bson-corpus/decimal128-4-parseError-014.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-4-parseError-015.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-4-parseError-015.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/decimal128-4-parseError-015.phpt
rename to mongodb-1.9.0/tests/bson-corpus/decimal128-4-parseError-015.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-4-parseError-016.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-4-parseError-016.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/decimal128-4-parseError-016.phpt
rename to mongodb-1.9.0/tests/bson-corpus/decimal128-4-parseError-016.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-4-parseError-017.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-4-parseError-017.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/decimal128-4-parseError-017.phpt
rename to mongodb-1.9.0/tests/bson-corpus/decimal128-4-parseError-017.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-4-parseError-018.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-4-parseError-018.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/decimal128-4-parseError-018.phpt
rename to mongodb-1.9.0/tests/bson-corpus/decimal128-4-parseError-018.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-4-parseError-019.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-4-parseError-019.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/decimal128-4-parseError-019.phpt
rename to mongodb-1.9.0/tests/bson-corpus/decimal128-4-parseError-019.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-4-parseError-020.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-4-parseError-020.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/decimal128-4-parseError-020.phpt
rename to mongodb-1.9.0/tests/bson-corpus/decimal128-4-parseError-020.phpt
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-4-valid-001.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-4-valid-001.phpt
new file mode 100644
index 00000000..801a670c
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-4-valid-001.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [basx023] conform to rules and exponent will be in permitted range).
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('1800000013640001000000000000000000000000003EB000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "-0.1"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+1800000013640001000000000000000000000000003eb000
+{"d":{"$numberDecimal":"-0.1"}}
+1800000013640001000000000000000000000000003eb000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-4-valid-002.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-4-valid-002.phpt
new file mode 100644
index 00000000..d2a6453c
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-4-valid-002.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx045] strings without E cannot generate E in result
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('1800000013640003000000000000000000000000003A3000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "0.003"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "+0.003"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+1800000013640003000000000000000000000000003a3000
+{"d":{"$numberDecimal":"0.003"}}
+1800000013640003000000000000000000000000003a3000
+1800000013640003000000000000000000000000003a3000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-4-valid-003.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-4-valid-003.phpt
new file mode 100644
index 00000000..d3323f37
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-4-valid-003.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx610] Zeros
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('1800000013640000000000000000000000000000003E3000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "0.0"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : ".0"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+1800000013640000000000000000000000000000003e3000
+{"d":{"$numberDecimal":"0.0"}}
+1800000013640000000000000000000000000000003e3000
+1800000013640000000000000000000000000000003e3000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-4-valid-004.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-4-valid-004.phpt
new file mode 100644
index 00000000..829abaf0
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-4-valid-004.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx612] Zeros
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('1800000013640000000000000000000000000000003EB000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "-0.0"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "-.0"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+1800000013640000000000000000000000000000003eb000
+{"d":{"$numberDecimal":"-0.0"}}
+1800000013640000000000000000000000000000003eb000
+1800000013640000000000000000000000000000003eb000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-4-valid-005.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-4-valid-005.phpt
new file mode 100644
index 00000000..1a13e2ac
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-4-valid-005.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx043] strings without E cannot generate E in result
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400FC040000000000000000000000003C3000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "12.76"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "+12.76"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400fc040000000000000000000000003c3000
+{"d":{"$numberDecimal":"12.76"}}
+18000000136400fc040000000000000000000000003c3000
+18000000136400fc040000000000000000000000003c3000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-4-valid-006.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-4-valid-006.phpt
new file mode 100644
index 00000000..b3344cc6
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-4-valid-006.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx055] strings without E cannot generate E in result
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000500000000000000000000000000303000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "5E-8"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "0.00000005"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000500000000000000000000000000303000
+{"d":{"$numberDecimal":"5E-8"}}
+180000001364000500000000000000000000000000303000
+180000001364000500000000000000000000000000303000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-4-valid-007.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-4-valid-007.phpt
new file mode 100644
index 00000000..f6224879
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-4-valid-007.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx054] strings without E cannot generate E in result
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000500000000000000000000000000323000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "5E-7"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "0.0000005"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000500000000000000000000000000323000
+{"d":{"$numberDecimal":"5E-7"}}
+180000001364000500000000000000000000000000323000
+180000001364000500000000000000000000000000323000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-4-valid-008.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-4-valid-008.phpt
new file mode 100644
index 00000000..cbd256cc
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-4-valid-008.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [basx052] strings without E cannot generate E in result
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000500000000000000000000000000343000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "0.000005"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000500000000000000000000000000343000
+{"d":{"$numberDecimal":"0.000005"}}
+180000001364000500000000000000000000000000343000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-4-valid-009.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-4-valid-009.phpt
new file mode 100644
index 00000000..e8f1cc5e
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-4-valid-009.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx051] strings without E cannot generate E in result
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000500000000000000000000000000363000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "0.00005"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "00.00005"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000500000000000000000000000000363000
+{"d":{"$numberDecimal":"0.00005"}}
+180000001364000500000000000000000000000000363000
+180000001364000500000000000000000000000000363000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-4-valid-010.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-4-valid-010.phpt
new file mode 100644
index 00000000..e2e2dd09
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-4-valid-010.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [basx050] strings without E cannot generate E in result
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000500000000000000000000000000383000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "0.0005"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000500000000000000000000000000383000
+{"d":{"$numberDecimal":"0.0005"}}
+180000001364000500000000000000000000000000383000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-4-valid-011.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-4-valid-011.phpt
new file mode 100644
index 00000000..a1c88ca3
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-4-valid-011.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [basx047] strings without E cannot generate E in result
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('1800000013640005000000000000000000000000003E3000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "0.5"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : ".5"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+1800000013640005000000000000000000000000003e3000
+{"d":{"$numberDecimal":"0.5"}}
+1800000013640005000000000000000000000000003e3000
+1800000013640005000000000000000000000000003e3000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-4-valid-012.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-4-valid-012.phpt
new file mode 100644
index 00000000..c2025fcd
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-4-valid-012.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [dqbsr431] check rounding modes heeded (Rounded)
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('1800000013640099761CC7B548F377DC80A131C836FE2F00');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.111111111111111111111111111112345"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "1.1111111111111111111111111111123450"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+1800000013640099761cc7b548f377dc80a131c836fe2f00
+{"d":{"$numberDecimal":"1.111111111111111111111111111112345"}}
+1800000013640099761cc7b548f377dc80a131c836fe2f00
+1800000013640099761cc7b548f377dc80a131c836fe2f00
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-4-valid-013.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-4-valid-013.phpt
new file mode 100644
index 00000000..88509646
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-4-valid-013.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: OK2
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400000000000A5BC138938D44C64D31FC2F00');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "0.1000000000000000000000000000000000"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : ".100000000000000000000000000000000000000000000000000000000000"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400000000000a5bc138938d44c64d31fc2f00
+{"d":{"$numberDecimal":"0.1000000000000000000000000000000000"}}
+18000000136400000000000a5bc138938d44c64d31fc2f00
+18000000136400000000000a5bc138938d44c64d31fc2f00
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-001.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-001.phpt
new file mode 100644
index 00000000..13d11bc3
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-001.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [decq035] fold-downs (more below) (Clamped)
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400000000807F1BCF85B27059C8A43CFE5F00');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.230000000000000000000000000000000E+6144"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "1.23E+6144"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400000000807f1bcf85b27059c8a43cfe5f00
+{"d":{"$numberDecimal":"1.230000000000000000000000000000000E+6144"}}
+18000000136400000000807f1bcf85b27059c8a43cfe5f00
+18000000136400000000807f1bcf85b27059c8a43cfe5f00
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-002.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-002.phpt
new file mode 100644
index 00000000..137a5157
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-002.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [decq037] fold-downs (more below) (Clamped)
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400000000000A5BC138938D44C64D31FE5F00');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.000000000000000000000000000000000E+6144"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "1E+6144"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400000000000a5bc138938d44c64d31fe5f00
+{"d":{"$numberDecimal":"1.000000000000000000000000000000000E+6144"}}
+18000000136400000000000a5bc138938d44c64d31fe5f00
+18000000136400000000000a5bc138938d44c64d31fe5f00
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-003.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-003.phpt
new file mode 100644
index 00000000..1fc069c7
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-003.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [decq077] Nmin and below (Subnormal)
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000000000081EFAC855B416D2DEE04000000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.00000000000000000000000000000000E-6144"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "0.100000000000000000000000000000000E-6143"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000000000081efac855b416d2dee04000000
+{"d":{"$numberDecimal":"1.00000000000000000000000000000000E-6144"}}
+180000001364000000000081efac855b416d2dee04000000
+180000001364000000000081efac855b416d2dee04000000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-004.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-004.phpt
new file mode 100644
index 00000000..846db323
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-004.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [decq078] Nmin and below (Subnormal)
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000000000081EFAC855B416D2DEE04000000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.00000000000000000000000000000000E-6144"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000000000081efac855b416d2dee04000000
+{"d":{"$numberDecimal":"1.00000000000000000000000000000000E-6144"}}
+180000001364000000000081efac855b416d2dee04000000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-005.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-005.phpt
new file mode 100644
index 00000000..998607b2
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-005.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [decq079] Nmin and below (Subnormal)
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000A00000000000000000000000000000000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.0E-6175"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "0.000000000000000000000000000000010E-6143"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000a00000000000000000000000000000000
+{"d":{"$numberDecimal":"1.0E-6175"}}
+180000001364000a00000000000000000000000000000000
+180000001364000a00000000000000000000000000000000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-006.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-006.phpt
new file mode 100644
index 00000000..ea3413df
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-006.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [decq080] Nmin and below (Subnormal)
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000A00000000000000000000000000000000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.0E-6175"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000a00000000000000000000000000000000
+{"d":{"$numberDecimal":"1.0E-6175"}}
+180000001364000a00000000000000000000000000000000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-007.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-007.phpt
new file mode 100644
index 00000000..87b0ca14
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-007.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [decq081] Nmin and below (Subnormal)
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000100000000000000000000000000020000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "1E-6175"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "0.00000000000000000000000000000001E-6143"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000100000000000000000000000000020000
+{"d":{"$numberDecimal":"1E-6175"}}
+180000001364000100000000000000000000000000020000
+180000001364000100000000000000000000000000020000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-008.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-008.phpt
new file mode 100644
index 00000000..8abb2a9b
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-008.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [decq082] Nmin and below (Subnormal)
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000100000000000000000000000000020000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "1E-6175"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000100000000000000000000000000020000
+{"d":{"$numberDecimal":"1E-6175"}}
+180000001364000100000000000000000000000000020000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-009.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-009.phpt
new file mode 100644
index 00000000..29cfbe82
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-009.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [decq083] Nmin and below (Subnormal)
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000100000000000000000000000000000000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "1E-6176"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "0.000000000000000000000000000000001E-6143"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000100000000000000000000000000000000
+{"d":{"$numberDecimal":"1E-6176"}}
+180000001364000100000000000000000000000000000000
+180000001364000100000000000000000000000000000000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-010.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-010.phpt
new file mode 100644
index 00000000..fb404af2
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-010.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [decq084] Nmin and below (Subnormal)
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000100000000000000000000000000000000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "1E-6176"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000100000000000000000000000000000000
+{"d":{"$numberDecimal":"1E-6176"}}
+180000001364000100000000000000000000000000000000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-011.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-011.phpt
new file mode 100644
index 00000000..3f909c1f
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-011.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [decq090] underflows cannot be tested for simple copies, check edge cases (Subnormal)
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000100000000000000000000000000000000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "1E-6176"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "1e-6176"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000100000000000000000000000000000000
+{"d":{"$numberDecimal":"1E-6176"}}
+180000001364000100000000000000000000000000000000
+180000001364000100000000000000000000000000000000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-012.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-012.phpt
new file mode 100644
index 00000000..04989c00
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-012.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [decq100] underflows cannot be tested for simple copies, check edge cases (Subnormal)
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400FFFFFFFF095BC138938D44C64D31000000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "9.99999999999999999999999999999999E-6144"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "999999999999999999999999999999999e-6176"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400ffffffff095bc138938d44c64d31000000
+{"d":{"$numberDecimal":"9.99999999999999999999999999999999E-6144"}}
+18000000136400ffffffff095bc138938d44c64d31000000
+18000000136400ffffffff095bc138938d44c64d31000000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-013.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-013.phpt
new file mode 100644
index 00000000..8cc0fa7b
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-013.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [decq130] fold-downs (more below) (Clamped)
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400000000807F1BCF85B27059C8A43CFEDF00');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "-1.230000000000000000000000000000000E+6144"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "-1.23E+6144"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400000000807f1bcf85b27059c8a43cfedf00
+{"d":{"$numberDecimal":"-1.230000000000000000000000000000000E+6144"}}
+18000000136400000000807f1bcf85b27059c8a43cfedf00
+18000000136400000000807f1bcf85b27059c8a43cfedf00
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-014.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-014.phpt
new file mode 100644
index 00000000..1d1e5dea
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-014.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [decq132] fold-downs (more below) (Clamped)
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400000000000A5BC138938D44C64D31FEDF00');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "-1.000000000000000000000000000000000E+6144"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "-1E+6144"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400000000000a5bc138938d44c64d31fedf00
+{"d":{"$numberDecimal":"-1.000000000000000000000000000000000E+6144"}}
+18000000136400000000000a5bc138938d44c64d31fedf00
+18000000136400000000000a5bc138938d44c64d31fedf00
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-015.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-015.phpt
new file mode 100644
index 00000000..93a5f02f
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-015.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [decq177] Nmin and below (Subnormal)
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000000000081EFAC855B416D2DEE04008000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "-1.00000000000000000000000000000000E-6144"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "-0.100000000000000000000000000000000E-6143"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000000000081efac855b416d2dee04008000
+{"d":{"$numberDecimal":"-1.00000000000000000000000000000000E-6144"}}
+180000001364000000000081efac855b416d2dee04008000
+180000001364000000000081efac855b416d2dee04008000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-016.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-016.phpt
new file mode 100644
index 00000000..b6258725
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-016.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [decq178] Nmin and below (Subnormal)
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000000000081EFAC855B416D2DEE04008000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "-1.00000000000000000000000000000000E-6144"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000000000081efac855b416d2dee04008000
+{"d":{"$numberDecimal":"-1.00000000000000000000000000000000E-6144"}}
+180000001364000000000081efac855b416d2dee04008000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-017.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-017.phpt
new file mode 100644
index 00000000..e0091bee
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-017.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [decq179] Nmin and below (Subnormal)
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000A00000000000000000000000000008000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "-1.0E-6175"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "-0.000000000000000000000000000000010E-6143"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000a00000000000000000000000000008000
+{"d":{"$numberDecimal":"-1.0E-6175"}}
+180000001364000a00000000000000000000000000008000
+180000001364000a00000000000000000000000000008000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-018.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-018.phpt
new file mode 100644
index 00000000..181ad3fd
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-018.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [decq180] Nmin and below (Subnormal)
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000A00000000000000000000000000008000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "-1.0E-6175"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000a00000000000000000000000000008000
+{"d":{"$numberDecimal":"-1.0E-6175"}}
+180000001364000a00000000000000000000000000008000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-019.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-019.phpt
new file mode 100644
index 00000000..aca70fcb
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-019.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [decq181] Nmin and below (Subnormal)
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000100000000000000000000000000028000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "-1E-6175"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "-0.00000000000000000000000000000001E-6143"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000100000000000000000000000000028000
+{"d":{"$numberDecimal":"-1E-6175"}}
+180000001364000100000000000000000000000000028000
+180000001364000100000000000000000000000000028000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-020.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-020.phpt
new file mode 100644
index 00000000..8fc50fc9
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-020.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [decq182] Nmin and below (Subnormal)
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000100000000000000000000000000028000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "-1E-6175"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000100000000000000000000000000028000
+{"d":{"$numberDecimal":"-1E-6175"}}
+180000001364000100000000000000000000000000028000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-021.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-021.phpt
new file mode 100644
index 00000000..55aa669f
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-021.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [decq183] Nmin and below (Subnormal)
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000100000000000000000000000000008000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "-1E-6176"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "-0.000000000000000000000000000000001E-6143"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000100000000000000000000000000008000
+{"d":{"$numberDecimal":"-1E-6176"}}
+180000001364000100000000000000000000000000008000
+180000001364000100000000000000000000000000008000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-022.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-022.phpt
new file mode 100644
index 00000000..ce551116
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-022.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Decimal128: [decq184] Nmin and below (Subnormal)
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000100000000000000000000000000008000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "-1E-6176"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000100000000000000000000000000008000
+{"d":{"$numberDecimal":"-1E-6176"}}
+180000001364000100000000000000000000000000008000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-023.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-023.phpt
new file mode 100644
index 00000000..46a167b1
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-023.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [decq190] underflow edge cases (Subnormal)
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000100000000000000000000000000008000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "-1E-6176"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "-1e-6176"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000100000000000000000000000000008000
+{"d":{"$numberDecimal":"-1E-6176"}}
+180000001364000100000000000000000000000000008000
+180000001364000100000000000000000000000000008000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-024.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-024.phpt
new file mode 100644
index 00000000..15509c89
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-024.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [decq200] underflow edge cases (Subnormal)
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400FFFFFFFF095BC138938D44C64D31008000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "-9.99999999999999999999999999999999E-6144"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "-999999999999999999999999999999999e-6176"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400ffffffff095bc138938d44c64d31008000
+{"d":{"$numberDecimal":"-9.99999999999999999999999999999999E-6144"}}
+18000000136400ffffffff095bc138938d44c64d31008000
+18000000136400ffffffff095bc138938d44c64d31008000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-025.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-025.phpt
new file mode 100644
index 00000000..6e70d799
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-025.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [decq400] zeros (Clamped)
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000000000000000000000000000000000000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "0E-6176"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "0E-8000"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000000000000000000000000000000000000
+{"d":{"$numberDecimal":"0E-6176"}}
+180000001364000000000000000000000000000000000000
+180000001364000000000000000000000000000000000000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-026.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-026.phpt
new file mode 100644
index 00000000..e4a1845e
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-026.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [decq401] zeros (Clamped)
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000000000000000000000000000000000000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "0E-6176"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "0E-6177"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000000000000000000000000000000000000
+{"d":{"$numberDecimal":"0E-6176"}}
+180000001364000000000000000000000000000000000000
+180000001364000000000000000000000000000000000000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-027.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-027.phpt
new file mode 100644
index 00000000..872d229a
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-027.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [decq414] clamped zeros... (Clamped)
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000000000000000000000000000000FE5F00');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "0E+6111"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "0E+6112"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000000000000000000000000000000fe5f00
+{"d":{"$numberDecimal":"0E+6111"}}
+180000001364000000000000000000000000000000fe5f00
+180000001364000000000000000000000000000000fe5f00
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-028.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-028.phpt
new file mode 100644
index 00000000..c70c3a75
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-028.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [decq416] clamped zeros... (Clamped)
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000000000000000000000000000000FE5F00');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "0E+6111"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "0E+6144"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000000000000000000000000000000fe5f00
+{"d":{"$numberDecimal":"0E+6111"}}
+180000001364000000000000000000000000000000fe5f00
+180000001364000000000000000000000000000000fe5f00
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-029.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-029.phpt
new file mode 100644
index 00000000..a4e6912a
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-029.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [decq418] clamped zeros... (Clamped)
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000000000000000000000000000000FE5F00');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "0E+6111"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "0E+8000"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000000000000000000000000000000fe5f00
+{"d":{"$numberDecimal":"0E+6111"}}
+180000001364000000000000000000000000000000fe5f00
+180000001364000000000000000000000000000000fe5f00
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-030.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-030.phpt
new file mode 100644
index 00000000..c6848ff6
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-030.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [decq420] negative zeros (Clamped)
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000000000000000000000000000000008000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "-0E-6176"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "-0E-8000"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000000000000000000000000000000008000
+{"d":{"$numberDecimal":"-0E-6176"}}
+180000001364000000000000000000000000000000008000
+180000001364000000000000000000000000000000008000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-031.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-031.phpt
new file mode 100644
index 00000000..867377f0
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-031.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [decq421] negative zeros (Clamped)
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000000000000000000000000000000008000');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "-0E-6176"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "-0E-6177"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000000000000000000000000000000008000
+{"d":{"$numberDecimal":"-0E-6176"}}
+180000001364000000000000000000000000000000008000
+180000001364000000000000000000000000000000008000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-032.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-032.phpt
new file mode 100644
index 00000000..0fe4cba7
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-032.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [decq434] clamped zeros... (Clamped)
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000000000000000000000000000000FEDF00');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "-0E+6111"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "-0E+6112"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000000000000000000000000000000fedf00
+{"d":{"$numberDecimal":"-0E+6111"}}
+180000001364000000000000000000000000000000fedf00
+180000001364000000000000000000000000000000fedf00
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-033.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-033.phpt
new file mode 100644
index 00000000..4eebd74c
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-033.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [decq436] clamped zeros... (Clamped)
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000000000000000000000000000000FEDF00');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "-0E+6111"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "-0E+6144"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000000000000000000000000000000fedf00
+{"d":{"$numberDecimal":"-0E+6111"}}
+180000001364000000000000000000000000000000fedf00
+180000001364000000000000000000000000000000fedf00
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-034.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-034.phpt
new file mode 100644
index 00000000..53a7b91a
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-034.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [decq438] clamped zeros... (Clamped)
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000000000000000000000000000000FEDF00');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "-0E+6111"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "-0E+8000"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000000000000000000000000000000fedf00
+{"d":{"$numberDecimal":"-0E+6111"}}
+180000001364000000000000000000000000000000fedf00
+180000001364000000000000000000000000000000fedf00
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-035.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-035.phpt
new file mode 100644
index 00000000..6eb4cad2
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-035.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [decq601] fold-down full sequence (Clamped)
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400000000000A5BC138938D44C64D31FE5F00');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.000000000000000000000000000000000E+6144"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "1E+6144"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400000000000a5bc138938d44c64d31fe5f00
+{"d":{"$numberDecimal":"1.000000000000000000000000000000000E+6144"}}
+18000000136400000000000a5bc138938d44c64d31fe5f00
+18000000136400000000000a5bc138938d44c64d31fe5f00
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-036.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-036.phpt
new file mode 100644
index 00000000..24e5cad4
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-036.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [decq603] fold-down full sequence (Clamped)
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000000000081EFAC855B416D2DEE04FE5F00');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.00000000000000000000000000000000E+6143"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "1E+6143"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000000000081efac855b416d2dee04fe5f00
+{"d":{"$numberDecimal":"1.00000000000000000000000000000000E+6143"}}
+180000001364000000000081efac855b416d2dee04fe5f00
+180000001364000000000081efac855b416d2dee04fe5f00
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-037.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-037.phpt
new file mode 100644
index 00000000..bd1514b5
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-037.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [decq605] fold-down full sequence (Clamped)
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('1800000013640000000080264B91C02220BE377E00FE5F00');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.0000000000000000000000000000000E+6142"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "1E+6142"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+1800000013640000000080264b91c02220be377e00fe5f00
+{"d":{"$numberDecimal":"1.0000000000000000000000000000000E+6142"}}
+1800000013640000000080264b91c02220be377e00fe5f00
+1800000013640000000080264b91c02220be377e00fe5f00
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-038.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-038.phpt
new file mode 100644
index 00000000..bd816f38
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-038.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [decq607] fold-down full sequence (Clamped)
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('1800000013640000000040EAED7446D09C2C9F0C00FE5F00');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.000000000000000000000000000000E+6141"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "1E+6141"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+1800000013640000000040eaed7446d09c2c9f0c00fe5f00
+{"d":{"$numberDecimal":"1.000000000000000000000000000000E+6141"}}
+1800000013640000000040eaed7446d09c2c9f0c00fe5f00
+1800000013640000000040eaed7446d09c2c9f0c00fe5f00
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-039.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-039.phpt
new file mode 100644
index 00000000..c9a1ab0f
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-039.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [decq609] fold-down full sequence (Clamped)
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400000000A0CA17726DAE0F1E430100FE5F00');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.00000000000000000000000000000E+6140"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "1E+6140"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400000000a0ca17726dae0f1e430100fe5f00
+{"d":{"$numberDecimal":"1.00000000000000000000000000000E+6140"}}
+18000000136400000000a0ca17726dae0f1e430100fe5f00
+18000000136400000000a0ca17726dae0f1e430100fe5f00
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-040.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-040.phpt
new file mode 100644
index 00000000..5c828dd6
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-040.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [decq611] fold-down full sequence (Clamped)
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400000000106102253E5ECE4F200000FE5F00');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.0000000000000000000000000000E+6139"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "1E+6139"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400000000106102253e5ece4f200000fe5f00
+{"d":{"$numberDecimal":"1.0000000000000000000000000000E+6139"}}
+18000000136400000000106102253e5ece4f200000fe5f00
+18000000136400000000106102253e5ece4f200000fe5f00
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-041.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-041.phpt
new file mode 100644
index 00000000..da828b69
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-041.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [decq613] fold-down full sequence (Clamped)
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400000000E83C80D09F3C2E3B030000FE5F00');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.000000000000000000000000000E+6138"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "1E+6138"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400000000e83c80d09f3c2e3b030000fe5f00
+{"d":{"$numberDecimal":"1.000000000000000000000000000E+6138"}}
+18000000136400000000e83c80d09f3c2e3b030000fe5f00
+18000000136400000000e83c80d09f3c2e3b030000fe5f00
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-042.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-042.phpt
new file mode 100644
index 00000000..e5c4990c
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-042.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [decq615] fold-down full sequence (Clamped)
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400000000E4D20CC8DCD2B752000000FE5F00');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.00000000000000000000000000E+6137"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "1E+6137"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400000000e4d20cc8dcd2b752000000fe5f00
+{"d":{"$numberDecimal":"1.00000000000000000000000000E+6137"}}
+18000000136400000000e4d20cc8dcd2b752000000fe5f00
+18000000136400000000e4d20cc8dcd2b752000000fe5f00
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-043.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-043.phpt
new file mode 100644
index 00000000..6a395baa
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-043.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [decq617] fold-down full sequence (Clamped)
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000000004A48011416954508000000FE5F00');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.0000000000000000000000000E+6136"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "1E+6136"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000000004a48011416954508000000fe5f00
+{"d":{"$numberDecimal":"1.0000000000000000000000000E+6136"}}
+180000001364000000004a48011416954508000000fe5f00
+180000001364000000004a48011416954508000000fe5f00
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-044.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-044.phpt
new file mode 100644
index 00000000..09b76576
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-044.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [decq619] fold-down full sequence (Clamped)
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400000000A1EDCCCE1BC2D300000000FE5F00');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.000000000000000000000000E+6135"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "1E+6135"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400000000a1edccce1bc2d300000000fe5f00
+{"d":{"$numberDecimal":"1.000000000000000000000000E+6135"}}
+18000000136400000000a1edccce1bc2d300000000fe5f00
+18000000136400000000a1edccce1bc2d300000000fe5f00
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-045.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-045.phpt
new file mode 100644
index 00000000..a5d568eb
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-045.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [decq621] fold-down full sequence (Clamped)
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400000080F64AE1C7022D1500000000FE5F00');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.00000000000000000000000E+6134"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "1E+6134"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400000080f64ae1c7022d1500000000fe5f00
+{"d":{"$numberDecimal":"1.00000000000000000000000E+6134"}}
+18000000136400000080f64ae1c7022d1500000000fe5f00
+18000000136400000080f64ae1c7022d1500000000fe5f00
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-046.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-046.phpt
new file mode 100644
index 00000000..09b4f7bd
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-046.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [decq623] fold-down full sequence (Clamped)
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400000040B2BAC9E0191E0200000000FE5F00');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.0000000000000000000000E+6133"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "1E+6133"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400000040b2bac9e0191e0200000000fe5f00
+{"d":{"$numberDecimal":"1.0000000000000000000000E+6133"}}
+18000000136400000040b2bac9e0191e0200000000fe5f00
+18000000136400000040b2bac9e0191e0200000000fe5f00
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-047.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-047.phpt
new file mode 100644
index 00000000..4ef9aba1
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-047.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [decq625] fold-down full sequence (Clamped)
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000000A0DEC5ADC935360000000000FE5F00');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.000000000000000000000E+6132"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "1E+6132"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000000a0dec5adc935360000000000fe5f00
+{"d":{"$numberDecimal":"1.000000000000000000000E+6132"}}
+180000001364000000a0dec5adc935360000000000fe5f00
+180000001364000000a0dec5adc935360000000000fe5f00
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-048.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-048.phpt
new file mode 100644
index 00000000..689952d2
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-048.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [decq627] fold-down full sequence (Clamped)
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400000010632D5EC76B050000000000FE5F00');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.00000000000000000000E+6131"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "1E+6131"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400000010632d5ec76b050000000000fe5f00
+{"d":{"$numberDecimal":"1.00000000000000000000E+6131"}}
+18000000136400000010632d5ec76b050000000000fe5f00
+18000000136400000010632d5ec76b050000000000fe5f00
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-049.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-049.phpt
new file mode 100644
index 00000000..5571319a
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-049.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [decq629] fold-down full sequence (Clamped)
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000000E8890423C78A000000000000FE5F00');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.0000000000000000000E+6130"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "1E+6130"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000000e8890423c78a000000000000fe5f00
+{"d":{"$numberDecimal":"1.0000000000000000000E+6130"}}
+180000001364000000e8890423c78a000000000000fe5f00
+180000001364000000e8890423c78a000000000000fe5f00
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-050.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-050.phpt
new file mode 100644
index 00000000..2e17c117
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-050.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [decq631] fold-down full sequence (Clamped)
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400000064A7B3B6E00D000000000000FE5F00');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.000000000000000000E+6129"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "1E+6129"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400000064a7b3b6e00d000000000000fe5f00
+{"d":{"$numberDecimal":"1.000000000000000000E+6129"}}
+18000000136400000064a7b3b6e00d000000000000fe5f00
+18000000136400000064a7b3b6e00d000000000000fe5f00
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-051.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-051.phpt
new file mode 100644
index 00000000..e48ccca2
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-051.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [decq633] fold-down full sequence (Clamped)
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('1800000013640000008A5D78456301000000000000FE5F00');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.00000000000000000E+6128"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "1E+6128"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+1800000013640000008a5d78456301000000000000fe5f00
+{"d":{"$numberDecimal":"1.00000000000000000E+6128"}}
+1800000013640000008a5d78456301000000000000fe5f00
+1800000013640000008a5d78456301000000000000fe5f00
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-052.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-052.phpt
new file mode 100644
index 00000000..eb4f9f8c
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-052.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [decq635] fold-down full sequence (Clamped)
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000000C16FF2862300000000000000FE5F00');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.0000000000000000E+6127"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "1E+6127"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000000c16ff2862300000000000000fe5f00
+{"d":{"$numberDecimal":"1.0000000000000000E+6127"}}
+180000001364000000c16ff2862300000000000000fe5f00
+180000001364000000c16ff2862300000000000000fe5f00
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-053.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-053.phpt
new file mode 100644
index 00000000..d42fee70
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-053.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [decq637] fold-down full sequence (Clamped)
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000080C6A47E8D0300000000000000FE5F00');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.000000000000000E+6126"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "1E+6126"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000080c6a47e8d0300000000000000fe5f00
+{"d":{"$numberDecimal":"1.000000000000000E+6126"}}
+180000001364000080c6a47e8d0300000000000000fe5f00
+180000001364000080c6a47e8d0300000000000000fe5f00
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-054.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-054.phpt
new file mode 100644
index 00000000..f0104719
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-054.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [decq639] fold-down full sequence (Clamped)
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('1800000013640000407A10F35A0000000000000000FE5F00');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.00000000000000E+6125"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "1E+6125"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+1800000013640000407a10f35a0000000000000000fe5f00
+{"d":{"$numberDecimal":"1.00000000000000E+6125"}}
+1800000013640000407a10f35a0000000000000000fe5f00
+1800000013640000407a10f35a0000000000000000fe5f00
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-055.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-055.phpt
new file mode 100644
index 00000000..f1349f81
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-055.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [decq641] fold-down full sequence (Clamped)
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('1800000013640000A0724E18090000000000000000FE5F00');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.0000000000000E+6124"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "1E+6124"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+1800000013640000a0724e18090000000000000000fe5f00
+{"d":{"$numberDecimal":"1.0000000000000E+6124"}}
+1800000013640000a0724e18090000000000000000fe5f00
+1800000013640000a0724e18090000000000000000fe5f00
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-056.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-056.phpt
new file mode 100644
index 00000000..4cffe6e0
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-056.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [decq643] fold-down full sequence (Clamped)
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000010A5D4E8000000000000000000FE5F00');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.000000000000E+6123"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "1E+6123"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000010a5d4e8000000000000000000fe5f00
+{"d":{"$numberDecimal":"1.000000000000E+6123"}}
+180000001364000010a5d4e8000000000000000000fe5f00
+180000001364000010a5d4e8000000000000000000fe5f00
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-057.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-057.phpt
new file mode 100644
index 00000000..ebea8d3a
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-057.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [decq645] fold-down full sequence (Clamped)
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('1800000013640000E8764817000000000000000000FE5F00');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.00000000000E+6122"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "1E+6122"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+1800000013640000e8764817000000000000000000fe5f00
+{"d":{"$numberDecimal":"1.00000000000E+6122"}}
+1800000013640000e8764817000000000000000000fe5f00
+1800000013640000e8764817000000000000000000fe5f00
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-058.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-058.phpt
new file mode 100644
index 00000000..d92ef5d5
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-058.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [decq647] fold-down full sequence (Clamped)
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('1800000013640000E40B5402000000000000000000FE5F00');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.0000000000E+6121"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "1E+6121"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+1800000013640000e40b5402000000000000000000fe5f00
+{"d":{"$numberDecimal":"1.0000000000E+6121"}}
+1800000013640000e40b5402000000000000000000fe5f00
+1800000013640000e40b5402000000000000000000fe5f00
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-059.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-059.phpt
new file mode 100644
index 00000000..52d913cc
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-059.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [decq649] fold-down full sequence (Clamped)
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('1800000013640000CA9A3B00000000000000000000FE5F00');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.000000000E+6120"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "1E+6120"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+1800000013640000ca9a3b00000000000000000000fe5f00
+{"d":{"$numberDecimal":"1.000000000E+6120"}}
+1800000013640000ca9a3b00000000000000000000fe5f00
+1800000013640000ca9a3b00000000000000000000fe5f00
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-060.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-060.phpt
new file mode 100644
index 00000000..dfbbbcb6
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-060.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [decq651] fold-down full sequence (Clamped)
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('1800000013640000E1F50500000000000000000000FE5F00');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.00000000E+6119"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "1E+6119"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+1800000013640000e1f50500000000000000000000fe5f00
+{"d":{"$numberDecimal":"1.00000000E+6119"}}
+1800000013640000e1f50500000000000000000000fe5f00
+1800000013640000e1f50500000000000000000000fe5f00
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-061.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-061.phpt
new file mode 100644
index 00000000..01016e5e
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-061.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [decq653] fold-down full sequence (Clamped)
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364008096980000000000000000000000FE5F00');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.0000000E+6118"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "1E+6118"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364008096980000000000000000000000fe5f00
+{"d":{"$numberDecimal":"1.0000000E+6118"}}
+180000001364008096980000000000000000000000fe5f00
+180000001364008096980000000000000000000000fe5f00
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-062.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-062.phpt
new file mode 100644
index 00000000..25fae962
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-062.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [decq655] fold-down full sequence (Clamped)
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('1800000013640040420F0000000000000000000000FE5F00');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.000000E+6117"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "1E+6117"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+1800000013640040420f0000000000000000000000fe5f00
+{"d":{"$numberDecimal":"1.000000E+6117"}}
+1800000013640040420f0000000000000000000000fe5f00
+1800000013640040420f0000000000000000000000fe5f00
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-063.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-063.phpt
new file mode 100644
index 00000000..48eb4046
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-063.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [decq657] fold-down full sequence (Clamped)
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400A086010000000000000000000000FE5F00');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.00000E+6116"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "1E+6116"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400a086010000000000000000000000fe5f00
+{"d":{"$numberDecimal":"1.00000E+6116"}}
+18000000136400a086010000000000000000000000fe5f00
+18000000136400a086010000000000000000000000fe5f00
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-064.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-064.phpt
new file mode 100644
index 00000000..45bf0fdb
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-064.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [decq659] fold-down full sequence (Clamped)
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364001027000000000000000000000000FE5F00');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.0000E+6115"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "1E+6115"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364001027000000000000000000000000fe5f00
+{"d":{"$numberDecimal":"1.0000E+6115"}}
+180000001364001027000000000000000000000000fe5f00
+180000001364001027000000000000000000000000fe5f00
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-065.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-065.phpt
new file mode 100644
index 00000000..9d74b645
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-065.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [decq661] fold-down full sequence (Clamped)
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('18000000136400E803000000000000000000000000FE5F00');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.000E+6114"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "1E+6114"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+18000000136400e803000000000000000000000000fe5f00
+{"d":{"$numberDecimal":"1.000E+6114"}}
+18000000136400e803000000000000000000000000fe5f00
+18000000136400e803000000000000000000000000fe5f00
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-066.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-066.phpt
new file mode 100644
index 00000000..dea19c3a
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-066.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [decq663] fold-down full sequence (Clamped)
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364006400000000000000000000000000FE5F00');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.00E+6113"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "1E+6113"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364006400000000000000000000000000fe5f00
+{"d":{"$numberDecimal":"1.00E+6113"}}
+180000001364006400000000000000000000000000fe5f00
+180000001364006400000000000000000000000000fe5f00
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-067.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-067.phpt
new file mode 100644
index 00000000..21ca8616
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/decimal128-5-valid-067.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Decimal128: [decq665] fold-down full sequence (Clamped)
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000001364000A00000000000000000000000000FE5F00');
+$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.0E+6112"}}';
+$degenerateExtJson = '{"d" : {"$numberDecimal" : "1E+6112"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000001364000a00000000000000000000000000fe5f00
+{"d":{"$numberDecimal":"1.0E+6112"}}
+180000001364000a00000000000000000000000000fe5f00
+180000001364000a00000000000000000000000000fe5f00
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-6-parseError-001.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-6-parseError-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/decimal128-6-parseError-001.phpt
rename to mongodb-1.9.0/tests/bson-corpus/decimal128-6-parseError-001.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-6-parseError-002.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-6-parseError-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/decimal128-6-parseError-002.phpt
rename to mongodb-1.9.0/tests/bson-corpus/decimal128-6-parseError-002.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-6-parseError-003.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-6-parseError-003.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/decimal128-6-parseError-003.phpt
rename to mongodb-1.9.0/tests/bson-corpus/decimal128-6-parseError-003.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-6-parseError-004.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-6-parseError-004.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/decimal128-6-parseError-004.phpt
rename to mongodb-1.9.0/tests/bson-corpus/decimal128-6-parseError-004.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-6-parseError-005.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-6-parseError-005.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/decimal128-6-parseError-005.phpt
rename to mongodb-1.9.0/tests/bson-corpus/decimal128-6-parseError-005.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-6-parseError-006.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-6-parseError-006.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/decimal128-6-parseError-006.phpt
rename to mongodb-1.9.0/tests/bson-corpus/decimal128-6-parseError-006.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-6-parseError-007.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-6-parseError-007.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/decimal128-6-parseError-007.phpt
rename to mongodb-1.9.0/tests/bson-corpus/decimal128-6-parseError-007.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-6-parseError-008.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-6-parseError-008.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/decimal128-6-parseError-008.phpt
rename to mongodb-1.9.0/tests/bson-corpus/decimal128-6-parseError-008.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-6-parseError-009.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-6-parseError-009.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/decimal128-6-parseError-009.phpt
rename to mongodb-1.9.0/tests/bson-corpus/decimal128-6-parseError-009.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-6-parseError-010.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-6-parseError-010.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/decimal128-6-parseError-010.phpt
rename to mongodb-1.9.0/tests/bson-corpus/decimal128-6-parseError-010.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-6-parseError-011.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-6-parseError-011.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/decimal128-6-parseError-011.phpt
rename to mongodb-1.9.0/tests/bson-corpus/decimal128-6-parseError-011.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-6-parseError-012.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-6-parseError-012.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/decimal128-6-parseError-012.phpt
rename to mongodb-1.9.0/tests/bson-corpus/decimal128-6-parseError-012.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-6-parseError-013.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-6-parseError-013.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/decimal128-6-parseError-013.phpt
rename to mongodb-1.9.0/tests/bson-corpus/decimal128-6-parseError-013.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-6-parseError-014.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-6-parseError-014.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/decimal128-6-parseError-014.phpt
rename to mongodb-1.9.0/tests/bson-corpus/decimal128-6-parseError-014.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-6-parseError-015.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-6-parseError-015.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/decimal128-6-parseError-015.phpt
rename to mongodb-1.9.0/tests/bson-corpus/decimal128-6-parseError-015.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-6-parseError-016.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-6-parseError-016.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/decimal128-6-parseError-016.phpt
rename to mongodb-1.9.0/tests/bson-corpus/decimal128-6-parseError-016.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-6-parseError-017.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-6-parseError-017.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/decimal128-6-parseError-017.phpt
rename to mongodb-1.9.0/tests/bson-corpus/decimal128-6-parseError-017.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-6-parseError-018.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-6-parseError-018.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/decimal128-6-parseError-018.phpt
rename to mongodb-1.9.0/tests/bson-corpus/decimal128-6-parseError-018.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-6-parseError-019.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-6-parseError-019.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/decimal128-6-parseError-019.phpt
rename to mongodb-1.9.0/tests/bson-corpus/decimal128-6-parseError-019.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-6-parseError-020.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-6-parseError-020.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/decimal128-6-parseError-020.phpt
rename to mongodb-1.9.0/tests/bson-corpus/decimal128-6-parseError-020.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-6-parseError-021.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-6-parseError-021.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/decimal128-6-parseError-021.phpt
rename to mongodb-1.9.0/tests/bson-corpus/decimal128-6-parseError-021.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-6-parseError-022.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-6-parseError-022.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/decimal128-6-parseError-022.phpt
rename to mongodb-1.9.0/tests/bson-corpus/decimal128-6-parseError-022.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-6-parseError-023.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-6-parseError-023.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/decimal128-6-parseError-023.phpt
rename to mongodb-1.9.0/tests/bson-corpus/decimal128-6-parseError-023.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-6-parseError-024.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-6-parseError-024.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/decimal128-6-parseError-024.phpt
rename to mongodb-1.9.0/tests/bson-corpus/decimal128-6-parseError-024.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-6-parseError-025.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-6-parseError-025.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/decimal128-6-parseError-025.phpt
rename to mongodb-1.9.0/tests/bson-corpus/decimal128-6-parseError-025.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-6-parseError-026.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-6-parseError-026.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/decimal128-6-parseError-026.phpt
rename to mongodb-1.9.0/tests/bson-corpus/decimal128-6-parseError-026.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-6-parseError-027.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-6-parseError-027.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/decimal128-6-parseError-027.phpt
rename to mongodb-1.9.0/tests/bson-corpus/decimal128-6-parseError-027.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-6-parseError-028.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-6-parseError-028.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/decimal128-6-parseError-028.phpt
rename to mongodb-1.9.0/tests/bson-corpus/decimal128-6-parseError-028.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-6-parseError-029.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-6-parseError-029.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/decimal128-6-parseError-029.phpt
rename to mongodb-1.9.0/tests/bson-corpus/decimal128-6-parseError-029.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-6-parseError-030.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-6-parseError-030.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/decimal128-6-parseError-030.phpt
rename to mongodb-1.9.0/tests/bson-corpus/decimal128-6-parseError-030.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-6-parseError-031.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-6-parseError-031.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/decimal128-6-parseError-031.phpt
rename to mongodb-1.9.0/tests/bson-corpus/decimal128-6-parseError-031.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-7-parseError-001.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-7-parseError-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/decimal128-7-parseError-001.phpt
rename to mongodb-1.9.0/tests/bson-corpus/decimal128-7-parseError-001.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-7-parseError-002.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-7-parseError-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/decimal128-7-parseError-002.phpt
rename to mongodb-1.9.0/tests/bson-corpus/decimal128-7-parseError-002.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-7-parseError-003.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-7-parseError-003.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/decimal128-7-parseError-003.phpt
rename to mongodb-1.9.0/tests/bson-corpus/decimal128-7-parseError-003.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-7-parseError-004.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-7-parseError-004.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/decimal128-7-parseError-004.phpt
rename to mongodb-1.9.0/tests/bson-corpus/decimal128-7-parseError-004.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-7-parseError-005.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-7-parseError-005.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/decimal128-7-parseError-005.phpt
rename to mongodb-1.9.0/tests/bson-corpus/decimal128-7-parseError-005.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-7-parseError-006.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-7-parseError-006.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/decimal128-7-parseError-006.phpt
rename to mongodb-1.9.0/tests/bson-corpus/decimal128-7-parseError-006.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-7-parseError-007.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-7-parseError-007.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/decimal128-7-parseError-007.phpt
rename to mongodb-1.9.0/tests/bson-corpus/decimal128-7-parseError-007.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-7-parseError-008.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-7-parseError-008.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/decimal128-7-parseError-008.phpt
rename to mongodb-1.9.0/tests/bson-corpus/decimal128-7-parseError-008.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-7-parseError-009.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-7-parseError-009.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/decimal128-7-parseError-009.phpt
rename to mongodb-1.9.0/tests/bson-corpus/decimal128-7-parseError-009.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-7-parseError-010.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-7-parseError-010.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/decimal128-7-parseError-010.phpt
rename to mongodb-1.9.0/tests/bson-corpus/decimal128-7-parseError-010.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-7-parseError-011.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-7-parseError-011.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/decimal128-7-parseError-011.phpt
rename to mongodb-1.9.0/tests/bson-corpus/decimal128-7-parseError-011.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-7-parseError-012.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-7-parseError-012.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/decimal128-7-parseError-012.phpt
rename to mongodb-1.9.0/tests/bson-corpus/decimal128-7-parseError-012.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-7-parseError-013.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-7-parseError-013.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/decimal128-7-parseError-013.phpt
rename to mongodb-1.9.0/tests/bson-corpus/decimal128-7-parseError-013.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-7-parseError-014.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-7-parseError-014.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/decimal128-7-parseError-014.phpt
rename to mongodb-1.9.0/tests/bson-corpus/decimal128-7-parseError-014.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-7-parseError-015.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-7-parseError-015.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/decimal128-7-parseError-015.phpt
rename to mongodb-1.9.0/tests/bson-corpus/decimal128-7-parseError-015.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-7-parseError-016.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-7-parseError-016.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/decimal128-7-parseError-016.phpt
rename to mongodb-1.9.0/tests/bson-corpus/decimal128-7-parseError-016.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-7-parseError-017.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-7-parseError-017.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/decimal128-7-parseError-017.phpt
rename to mongodb-1.9.0/tests/bson-corpus/decimal128-7-parseError-017.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-7-parseError-018.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-7-parseError-018.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/decimal128-7-parseError-018.phpt
rename to mongodb-1.9.0/tests/bson-corpus/decimal128-7-parseError-018.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-7-parseError-019.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-7-parseError-019.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/decimal128-7-parseError-019.phpt
rename to mongodb-1.9.0/tests/bson-corpus/decimal128-7-parseError-019.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-7-parseError-020.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-7-parseError-020.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/decimal128-7-parseError-020.phpt
rename to mongodb-1.9.0/tests/bson-corpus/decimal128-7-parseError-020.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-7-parseError-021.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-7-parseError-021.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/decimal128-7-parseError-021.phpt
rename to mongodb-1.9.0/tests/bson-corpus/decimal128-7-parseError-021.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-7-parseError-022.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-7-parseError-022.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/decimal128-7-parseError-022.phpt
rename to mongodb-1.9.0/tests/bson-corpus/decimal128-7-parseError-022.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-7-parseError-023.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-7-parseError-023.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/decimal128-7-parseError-023.phpt
rename to mongodb-1.9.0/tests/bson-corpus/decimal128-7-parseError-023.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-7-parseError-024.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-7-parseError-024.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/decimal128-7-parseError-024.phpt
rename to mongodb-1.9.0/tests/bson-corpus/decimal128-7-parseError-024.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-7-parseError-025.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-7-parseError-025.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/decimal128-7-parseError-025.phpt
rename to mongodb-1.9.0/tests/bson-corpus/decimal128-7-parseError-025.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-7-parseError-026.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-7-parseError-026.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/decimal128-7-parseError-026.phpt
rename to mongodb-1.9.0/tests/bson-corpus/decimal128-7-parseError-026.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-7-parseError-027.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-7-parseError-027.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/decimal128-7-parseError-027.phpt
rename to mongodb-1.9.0/tests/bson-corpus/decimal128-7-parseError-027.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-7-parseError-028.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-7-parseError-028.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/decimal128-7-parseError-028.phpt
rename to mongodb-1.9.0/tests/bson-corpus/decimal128-7-parseError-028.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-7-parseError-029.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-7-parseError-029.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/decimal128-7-parseError-029.phpt
rename to mongodb-1.9.0/tests/bson-corpus/decimal128-7-parseError-029.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-7-parseError-030.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-7-parseError-030.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/decimal128-7-parseError-030.phpt
rename to mongodb-1.9.0/tests/bson-corpus/decimal128-7-parseError-030.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-7-parseError-031.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-7-parseError-031.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/decimal128-7-parseError-031.phpt
rename to mongodb-1.9.0/tests/bson-corpus/decimal128-7-parseError-031.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-7-parseError-032.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-7-parseError-032.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/decimal128-7-parseError-032.phpt
rename to mongodb-1.9.0/tests/bson-corpus/decimal128-7-parseError-032.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-7-parseError-033.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-7-parseError-033.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/decimal128-7-parseError-033.phpt
rename to mongodb-1.9.0/tests/bson-corpus/decimal128-7-parseError-033.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-7-parseError-034.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-7-parseError-034.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/decimal128-7-parseError-034.phpt
rename to mongodb-1.9.0/tests/bson-corpus/decimal128-7-parseError-034.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-7-parseError-035.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-7-parseError-035.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/decimal128-7-parseError-035.phpt
rename to mongodb-1.9.0/tests/bson-corpus/decimal128-7-parseError-035.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-7-parseError-036.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-7-parseError-036.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/decimal128-7-parseError-036.phpt
rename to mongodb-1.9.0/tests/bson-corpus/decimal128-7-parseError-036.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-7-parseError-037.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-7-parseError-037.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/decimal128-7-parseError-037.phpt
rename to mongodb-1.9.0/tests/bson-corpus/decimal128-7-parseError-037.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-7-parseError-038.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-7-parseError-038.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/decimal128-7-parseError-038.phpt
rename to mongodb-1.9.0/tests/bson-corpus/decimal128-7-parseError-038.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-7-parseError-039.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-7-parseError-039.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/decimal128-7-parseError-039.phpt
rename to mongodb-1.9.0/tests/bson-corpus/decimal128-7-parseError-039.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-7-parseError-040.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-7-parseError-040.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/decimal128-7-parseError-040.phpt
rename to mongodb-1.9.0/tests/bson-corpus/decimal128-7-parseError-040.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-7-parseError-041.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-7-parseError-041.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/decimal128-7-parseError-041.phpt
rename to mongodb-1.9.0/tests/bson-corpus/decimal128-7-parseError-041.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-7-parseError-042.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-7-parseError-042.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/decimal128-7-parseError-042.phpt
rename to mongodb-1.9.0/tests/bson-corpus/decimal128-7-parseError-042.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-7-parseError-043.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-7-parseError-043.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/decimal128-7-parseError-043.phpt
rename to mongodb-1.9.0/tests/bson-corpus/decimal128-7-parseError-043.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-7-parseError-044.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-7-parseError-044.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/decimal128-7-parseError-044.phpt
rename to mongodb-1.9.0/tests/bson-corpus/decimal128-7-parseError-044.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-7-parseError-045.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-7-parseError-045.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/decimal128-7-parseError-045.phpt
rename to mongodb-1.9.0/tests/bson-corpus/decimal128-7-parseError-045.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-7-parseError-046.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-7-parseError-046.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/decimal128-7-parseError-046.phpt
rename to mongodb-1.9.0/tests/bson-corpus/decimal128-7-parseError-046.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-7-parseError-047.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-7-parseError-047.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/decimal128-7-parseError-047.phpt
rename to mongodb-1.9.0/tests/bson-corpus/decimal128-7-parseError-047.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-7-parseError-048.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-7-parseError-048.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/decimal128-7-parseError-048.phpt
rename to mongodb-1.9.0/tests/bson-corpus/decimal128-7-parseError-048.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-7-parseError-049.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-7-parseError-049.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/decimal128-7-parseError-049.phpt
rename to mongodb-1.9.0/tests/bson-corpus/decimal128-7-parseError-049.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-7-parseError-050.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-7-parseError-050.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/decimal128-7-parseError-050.phpt
rename to mongodb-1.9.0/tests/bson-corpus/decimal128-7-parseError-050.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-7-parseError-051.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-7-parseError-051.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/decimal128-7-parseError-051.phpt
rename to mongodb-1.9.0/tests/bson-corpus/decimal128-7-parseError-051.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-7-parseError-052.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-7-parseError-052.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/decimal128-7-parseError-052.phpt
rename to mongodb-1.9.0/tests/bson-corpus/decimal128-7-parseError-052.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-7-parseError-053.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-7-parseError-053.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/decimal128-7-parseError-053.phpt
rename to mongodb-1.9.0/tests/bson-corpus/decimal128-7-parseError-053.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-7-parseError-054.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-7-parseError-054.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/decimal128-7-parseError-054.phpt
rename to mongodb-1.9.0/tests/bson-corpus/decimal128-7-parseError-054.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-7-parseError-055.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-7-parseError-055.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/decimal128-7-parseError-055.phpt
rename to mongodb-1.9.0/tests/bson-corpus/decimal128-7-parseError-055.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-7-parseError-056.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-7-parseError-056.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/decimal128-7-parseError-056.phpt
rename to mongodb-1.9.0/tests/bson-corpus/decimal128-7-parseError-056.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-7-parseError-057.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-7-parseError-057.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/decimal128-7-parseError-057.phpt
rename to mongodb-1.9.0/tests/bson-corpus/decimal128-7-parseError-057.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-7-parseError-058.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-7-parseError-058.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/decimal128-7-parseError-058.phpt
rename to mongodb-1.9.0/tests/bson-corpus/decimal128-7-parseError-058.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-7-parseError-059.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-7-parseError-059.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/decimal128-7-parseError-059.phpt
rename to mongodb-1.9.0/tests/bson-corpus/decimal128-7-parseError-059.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-7-parseError-060.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-7-parseError-060.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/decimal128-7-parseError-060.phpt
rename to mongodb-1.9.0/tests/bson-corpus/decimal128-7-parseError-060.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-7-parseError-061.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-7-parseError-061.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/decimal128-7-parseError-061.phpt
rename to mongodb-1.9.0/tests/bson-corpus/decimal128-7-parseError-061.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-7-parseError-062.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-7-parseError-062.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/decimal128-7-parseError-062.phpt
rename to mongodb-1.9.0/tests/bson-corpus/decimal128-7-parseError-062.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-7-parseError-063.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-7-parseError-063.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/decimal128-7-parseError-063.phpt
rename to mongodb-1.9.0/tests/bson-corpus/decimal128-7-parseError-063.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-7-parseError-064.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-7-parseError-064.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/decimal128-7-parseError-064.phpt
rename to mongodb-1.9.0/tests/bson-corpus/decimal128-7-parseError-064.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-7-parseError-065.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-7-parseError-065.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/decimal128-7-parseError-065.phpt
rename to mongodb-1.9.0/tests/bson-corpus/decimal128-7-parseError-065.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-7-parseError-066.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-7-parseError-066.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/decimal128-7-parseError-066.phpt
rename to mongodb-1.9.0/tests/bson-corpus/decimal128-7-parseError-066.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-7-parseError-067.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-7-parseError-067.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/decimal128-7-parseError-067.phpt
rename to mongodb-1.9.0/tests/bson-corpus/decimal128-7-parseError-067.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-7-parseError-068.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-7-parseError-068.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/decimal128-7-parseError-068.phpt
rename to mongodb-1.9.0/tests/bson-corpus/decimal128-7-parseError-068.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-7-parseError-069.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-7-parseError-069.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/decimal128-7-parseError-069.phpt
rename to mongodb-1.9.0/tests/bson-corpus/decimal128-7-parseError-069.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-7-parseError-070.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-7-parseError-070.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/decimal128-7-parseError-070.phpt
rename to mongodb-1.9.0/tests/bson-corpus/decimal128-7-parseError-070.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-7-parseError-071.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-7-parseError-071.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/decimal128-7-parseError-071.phpt
rename to mongodb-1.9.0/tests/bson-corpus/decimal128-7-parseError-071.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-7-parseError-072.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-7-parseError-072.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/decimal128-7-parseError-072.phpt
rename to mongodb-1.9.0/tests/bson-corpus/decimal128-7-parseError-072.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-7-parseError-073.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-7-parseError-073.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/decimal128-7-parseError-073.phpt
rename to mongodb-1.9.0/tests/bson-corpus/decimal128-7-parseError-073.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-7-parseError-074.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-7-parseError-074.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/decimal128-7-parseError-074.phpt
rename to mongodb-1.9.0/tests/bson-corpus/decimal128-7-parseError-074.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-7-parseError-075.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-7-parseError-075.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/decimal128-7-parseError-075.phpt
rename to mongodb-1.9.0/tests/bson-corpus/decimal128-7-parseError-075.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-7-parseError-076.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-7-parseError-076.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/decimal128-7-parseError-076.phpt
rename to mongodb-1.9.0/tests/bson-corpus/decimal128-7-parseError-076.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-7-parseError-077.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-7-parseError-077.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/decimal128-7-parseError-077.phpt
rename to mongodb-1.9.0/tests/bson-corpus/decimal128-7-parseError-077.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-7-parseError-078.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-7-parseError-078.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/decimal128-7-parseError-078.phpt
rename to mongodb-1.9.0/tests/bson-corpus/decimal128-7-parseError-078.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-7-parseError-079.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-7-parseError-079.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/decimal128-7-parseError-079.phpt
rename to mongodb-1.9.0/tests/bson-corpus/decimal128-7-parseError-079.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/decimal128-7-parseError-080.phpt b/mongodb-1.9.0/tests/bson-corpus/decimal128-7-parseError-080.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/decimal128-7-parseError-080.phpt
rename to mongodb-1.9.0/tests/bson-corpus/decimal128-7-parseError-080.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/document-decodeError-001.phpt b/mongodb-1.9.0/tests/bson-corpus/document-decodeError-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/document-decodeError-001.phpt
rename to mongodb-1.9.0/tests/bson-corpus/document-decodeError-001.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/document-decodeError-002.phpt b/mongodb-1.9.0/tests/bson-corpus/document-decodeError-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/document-decodeError-002.phpt
rename to mongodb-1.9.0/tests/bson-corpus/document-decodeError-002.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/document-decodeError-003.phpt b/mongodb-1.9.0/tests/bson-corpus/document-decodeError-003.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/document-decodeError-003.phpt
rename to mongodb-1.9.0/tests/bson-corpus/document-decodeError-003.phpt
diff --git a/mongodb-1.9.0/tests/bson-corpus/document-valid-001.phpt b/mongodb-1.9.0/tests/bson-corpus/document-valid-001.phpt
new file mode 100644
index 00000000..8793b9c9
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/document-valid-001.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Document type (sub-documents): Empty subdoc
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('0D000000037800050000000000');
+$canonicalExtJson = '{"x" : {}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+0d000000037800050000000000
+{"x":{}}
+0d000000037800050000000000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/document-valid-002.phpt b/mongodb-1.9.0/tests/bson-corpus/document-valid-002.phpt
new file mode 100644
index 00000000..96abba2c
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/document-valid-002.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Document type (sub-documents): Empty-string key subdoc
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('150000000378000D00000002000200000062000000');
+$canonicalExtJson = '{"x" : {"" : "b"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+150000000378000d00000002000200000062000000
+{"x":{"":"b"}}
+150000000378000d00000002000200000062000000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/document-valid-003.phpt b/mongodb-1.9.0/tests/bson-corpus/document-valid-003.phpt
new file mode 100644
index 00000000..cf72f520
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/document-valid-003.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Document type (sub-documents): Single-character key subdoc
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('160000000378000E0000000261000200000062000000');
+$canonicalExtJson = '{"x" : {"a" : "b"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+160000000378000e0000000261000200000062000000
+{"x":{"a":"b"}}
+160000000378000e0000000261000200000062000000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/double-decodeError-001.phpt b/mongodb-1.9.0/tests/bson-corpus/double-decodeError-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/double-decodeError-001.phpt
rename to mongodb-1.9.0/tests/bson-corpus/double-decodeError-001.phpt
diff --git a/mongodb-1.9.0/tests/bson-corpus/double-valid-001.phpt b/mongodb-1.9.0/tests/bson-corpus/double-valid-001.phpt
new file mode 100644
index 00000000..ab96ff23
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/double-valid-001.phpt
@@ -0,0 +1,40 @@
+--TEST--
+Double type: +1.0
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('10000000016400000000000000F03F00');
+$canonicalExtJson = '{"d" : {"$numberDouble": "1.0"}}';
+$relaxedExtJson = '{"d" : 1.0}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical BSON -> Relaxed extJSON
+echo json_canonicalize(toRelaxedExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Relaxed extJSON -> BSON -> Relaxed extJSON
+echo json_canonicalize(toRelaxedExtendedJSON(fromJSON($relaxedExtJson))), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+10000000016400000000000000f03f00
+{"d":{"$numberDouble":"1"}}
+{"d":1}
+10000000016400000000000000f03f00
+{"d":1}
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/double-valid-002.phpt b/mongodb-1.9.0/tests/bson-corpus/double-valid-002.phpt
new file mode 100644
index 00000000..d1323aa0
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/double-valid-002.phpt
@@ -0,0 +1,40 @@
+--TEST--
+Double type: -1.0
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('10000000016400000000000000F0BF00');
+$canonicalExtJson = '{"d" : {"$numberDouble": "-1.0"}}';
+$relaxedExtJson = '{"d" : -1.0}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical BSON -> Relaxed extJSON
+echo json_canonicalize(toRelaxedExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Relaxed extJSON -> BSON -> Relaxed extJSON
+echo json_canonicalize(toRelaxedExtendedJSON(fromJSON($relaxedExtJson))), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+10000000016400000000000000f0bf00
+{"d":{"$numberDouble":"-1"}}
+{"d":-1}
+10000000016400000000000000f0bf00
+{"d":-1}
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/double-valid-003.phpt b/mongodb-1.9.0/tests/bson-corpus/double-valid-003.phpt
new file mode 100644
index 00000000..fcadc8af
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/double-valid-003.phpt
@@ -0,0 +1,40 @@
+--TEST--
+Double type: +1.0001220703125
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('10000000016400000000008000F03F00');
+$canonicalExtJson = '{"d" : {"$numberDouble": "1.0001220703125"}}';
+$relaxedExtJson = '{"d" : 1.0001220703125}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical BSON -> Relaxed extJSON
+echo json_canonicalize(toRelaxedExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Relaxed extJSON -> BSON -> Relaxed extJSON
+echo json_canonicalize(toRelaxedExtendedJSON(fromJSON($relaxedExtJson))), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+10000000016400000000008000f03f00
+{"d":{"$numberDouble":"1.0001220703125"}}
+{"d":1.0001220703125}
+10000000016400000000008000f03f00
+{"d":1.0001220703125}
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/double-valid-004.phpt b/mongodb-1.9.0/tests/bson-corpus/double-valid-004.phpt
new file mode 100644
index 00000000..90e260ff
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/double-valid-004.phpt
@@ -0,0 +1,40 @@
+--TEST--
+Double type: -1.0001220703125
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('10000000016400000000008000F0BF00');
+$canonicalExtJson = '{"d" : {"$numberDouble": "-1.0001220703125"}}';
+$relaxedExtJson = '{"d" : -1.0001220703125}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical BSON -> Relaxed extJSON
+echo json_canonicalize(toRelaxedExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Relaxed extJSON -> BSON -> Relaxed extJSON
+echo json_canonicalize(toRelaxedExtendedJSON(fromJSON($relaxedExtJson))), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+10000000016400000000008000f0bf00
+{"d":{"$numberDouble":"-1.0001220703125"}}
+{"d":-1.0001220703125}
+10000000016400000000008000f0bf00
+{"d":-1.0001220703125}
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/double-valid-005.phpt b/mongodb-1.9.0/tests/bson-corpus/double-valid-005.phpt
new file mode 100644
index 00000000..6cb44f05
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/double-valid-005.phpt
@@ -0,0 +1,40 @@
+--TEST--
+Double type: 1.2345678921232E+18
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('100000000164002a1bf5f41022b14300');
+$canonicalExtJson = '{"d" : {"$numberDouble": "1.2345678921232E+18"}}';
+$relaxedExtJson = '{"d" : 1.2345678921232E+18}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical BSON -> Relaxed extJSON
+echo json_canonicalize(toRelaxedExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Relaxed extJSON -> BSON -> Relaxed extJSON
+echo json_canonicalize(toRelaxedExtendedJSON(fromJSON($relaxedExtJson))), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+100000000164002a1bf5f41022b14300
+{"d":{"$numberDouble":"1.2345678921232e+18"}}
+{"d":1.2345678921232e+18}
+100000000164002a1bf5f41022b14300
+{"d":1.2345678921232e+18}
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/double-valid-006.phpt b/mongodb-1.9.0/tests/bson-corpus/double-valid-006.phpt
new file mode 100644
index 00000000..ebad57ed
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/double-valid-006.phpt
@@ -0,0 +1,40 @@
+--TEST--
+Double type: -1.2345678921232E+18
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('100000000164002a1bf5f41022b1c300');
+$canonicalExtJson = '{"d" : {"$numberDouble": "-1.2345678921232E+18"}}';
+$relaxedExtJson = '{"d" : -1.2345678921232E+18}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical BSON -> Relaxed extJSON
+echo json_canonicalize(toRelaxedExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Relaxed extJSON -> BSON -> Relaxed extJSON
+echo json_canonicalize(toRelaxedExtendedJSON(fromJSON($relaxedExtJson))), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+100000000164002a1bf5f41022b1c300
+{"d":{"$numberDouble":"-1.2345678921232e+18"}}
+{"d":-1.2345678921232e+18}
+100000000164002a1bf5f41022b1c300
+{"d":-1.2345678921232e+18}
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/double-valid-007.phpt b/mongodb-1.9.0/tests/bson-corpus/double-valid-007.phpt
new file mode 100644
index 00000000..9586e097
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/double-valid-007.phpt
@@ -0,0 +1,40 @@
+--TEST--
+Double type: 0.0
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('10000000016400000000000000000000');
+$canonicalExtJson = '{"d" : {"$numberDouble": "0.0"}}';
+$relaxedExtJson = '{"d" : 0.0}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical BSON -> Relaxed extJSON
+echo json_canonicalize(toRelaxedExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Relaxed extJSON -> BSON -> Relaxed extJSON
+echo json_canonicalize(toRelaxedExtendedJSON(fromJSON($relaxedExtJson))), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+10000000016400000000000000000000
+{"d":{"$numberDouble":"0"}}
+{"d":0}
+10000000016400000000000000000000
+{"d":0}
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/double-valid-008.phpt b/mongodb-1.9.0/tests/bson-corpus/double-valid-008.phpt
new file mode 100644
index 00000000..35be2714
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/double-valid-008.phpt
@@ -0,0 +1,40 @@
+--TEST--
+Double type: -0.0
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('10000000016400000000000000008000');
+$canonicalExtJson = '{"d" : {"$numberDouble": "-0.0"}}';
+$relaxedExtJson = '{"d" : -0.0}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical BSON -> Relaxed extJSON
+echo json_canonicalize(toRelaxedExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Relaxed extJSON -> BSON -> Relaxed extJSON
+echo json_canonicalize(toRelaxedExtendedJSON(fromJSON($relaxedExtJson))), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+10000000016400000000000000008000
+{"d":{"$numberDouble":"-0"}}
+{"d":-0}
+10000000016400000000000000008000
+{"d":-0}
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/double-valid-009.phpt b/mongodb-1.9.0/tests/bson-corpus/double-valid-009.phpt
new file mode 100644
index 00000000..9c465c43
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/double-valid-009.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Double type: NaN
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('10000000016400000000000000F87F00');
+$canonicalExtJson = '{"d": {"$numberDouble": "NaN"}}';
+$relaxedExtJson = '{"d": {"$numberDouble": "NaN"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical BSON -> Relaxed extJSON
+echo json_canonicalize(toRelaxedExtendedJSON($canonicalBson)), "\n";
+
+// Relaxed extJSON -> BSON -> Relaxed extJSON
+echo json_canonicalize(toRelaxedExtendedJSON(fromJSON($relaxedExtJson))), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+10000000016400000000000000f87f00
+{"d":{"$numberDouble":"NaN"}}
+{"d":{"$numberDouble":"NaN"}}
+{"d":{"$numberDouble":"NaN"}}
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/double-valid-010.phpt b/mongodb-1.9.0/tests/bson-corpus/double-valid-010.phpt
new file mode 100644
index 00000000..0777281d
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/double-valid-010.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Double type: NaN with payload
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('10000000016400120000000000F87F00');
+$canonicalExtJson = '{"d": {"$numberDouble": "NaN"}}';
+$relaxedExtJson = '{"d": {"$numberDouble": "NaN"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical BSON -> Relaxed extJSON
+echo json_canonicalize(toRelaxedExtendedJSON($canonicalBson)), "\n";
+
+// Relaxed extJSON -> BSON -> Relaxed extJSON
+echo json_canonicalize(toRelaxedExtendedJSON(fromJSON($relaxedExtJson))), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+10000000016400120000000000f87f00
+{"d":{"$numberDouble":"NaN"}}
+{"d":{"$numberDouble":"NaN"}}
+{"d":{"$numberDouble":"NaN"}}
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/double-valid-011.phpt b/mongodb-1.9.0/tests/bson-corpus/double-valid-011.phpt
new file mode 100644
index 00000000..8f8938ff
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/double-valid-011.phpt
@@ -0,0 +1,40 @@
+--TEST--
+Double type: Inf
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('10000000016400000000000000F07F00');
+$canonicalExtJson = '{"d": {"$numberDouble": "Infinity"}}';
+$relaxedExtJson = '{"d": {"$numberDouble": "Infinity"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical BSON -> Relaxed extJSON
+echo json_canonicalize(toRelaxedExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Relaxed extJSON -> BSON -> Relaxed extJSON
+echo json_canonicalize(toRelaxedExtendedJSON(fromJSON($relaxedExtJson))), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+10000000016400000000000000f07f00
+{"d":{"$numberDouble":"Infinity"}}
+{"d":{"$numberDouble":"Infinity"}}
+10000000016400000000000000f07f00
+{"d":{"$numberDouble":"Infinity"}}
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/double-valid-012.phpt b/mongodb-1.9.0/tests/bson-corpus/double-valid-012.phpt
new file mode 100644
index 00000000..1bf2a08f
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/double-valid-012.phpt
@@ -0,0 +1,40 @@
+--TEST--
+Double type: -Inf
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('10000000016400000000000000F0FF00');
+$canonicalExtJson = '{"d": {"$numberDouble": "-Infinity"}}';
+$relaxedExtJson = '{"d": {"$numberDouble": "-Infinity"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical BSON -> Relaxed extJSON
+echo json_canonicalize(toRelaxedExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Relaxed extJSON -> BSON -> Relaxed extJSON
+echo json_canonicalize(toRelaxedExtendedJSON(fromJSON($relaxedExtJson))), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+10000000016400000000000000f0ff00
+{"d":{"$numberDouble":"-Infinity"}}
+{"d":{"$numberDouble":"-Infinity"}}
+10000000016400000000000000f0ff00
+{"d":{"$numberDouble":"-Infinity"}}
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/int32-decodeError-001.phpt b/mongodb-1.9.0/tests/bson-corpus/int32-decodeError-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/int32-decodeError-001.phpt
rename to mongodb-1.9.0/tests/bson-corpus/int32-decodeError-001.phpt
diff --git a/mongodb-1.9.0/tests/bson-corpus/int32-valid-001.phpt b/mongodb-1.9.0/tests/bson-corpus/int32-valid-001.phpt
new file mode 100644
index 00000000..a547f3bd
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/int32-valid-001.phpt
@@ -0,0 +1,40 @@
+--TEST--
+Int32 type: MinValue
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('0C0000001069000000008000');
+$canonicalExtJson = '{"i" : {"$numberInt": "-2147483648"}}';
+$relaxedExtJson = '{"i" : -2147483648}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical BSON -> Relaxed extJSON
+echo json_canonicalize(toRelaxedExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Relaxed extJSON -> BSON -> Relaxed extJSON
+echo json_canonicalize(toRelaxedExtendedJSON(fromJSON($relaxedExtJson))), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+0c0000001069000000008000
+{"i":{"$numberInt":"-2147483648"}}
+{"i":-2147483648}
+0c0000001069000000008000
+{"i":-2147483648}
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/int32-valid-002.phpt b/mongodb-1.9.0/tests/bson-corpus/int32-valid-002.phpt
new file mode 100644
index 00000000..db11e4fe
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/int32-valid-002.phpt
@@ -0,0 +1,40 @@
+--TEST--
+Int32 type: MaxValue
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('0C000000106900FFFFFF7F00');
+$canonicalExtJson = '{"i" : {"$numberInt": "2147483647"}}';
+$relaxedExtJson = '{"i" : 2147483647}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical BSON -> Relaxed extJSON
+echo json_canonicalize(toRelaxedExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Relaxed extJSON -> BSON -> Relaxed extJSON
+echo json_canonicalize(toRelaxedExtendedJSON(fromJSON($relaxedExtJson))), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+0c000000106900ffffff7f00
+{"i":{"$numberInt":"2147483647"}}
+{"i":2147483647}
+0c000000106900ffffff7f00
+{"i":2147483647}
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/int32-valid-003.phpt b/mongodb-1.9.0/tests/bson-corpus/int32-valid-003.phpt
new file mode 100644
index 00000000..fb985ec6
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/int32-valid-003.phpt
@@ -0,0 +1,40 @@
+--TEST--
+Int32 type: -1
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('0C000000106900FFFFFFFF00');
+$canonicalExtJson = '{"i" : {"$numberInt": "-1"}}';
+$relaxedExtJson = '{"i" : -1}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical BSON -> Relaxed extJSON
+echo json_canonicalize(toRelaxedExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Relaxed extJSON -> BSON -> Relaxed extJSON
+echo json_canonicalize(toRelaxedExtendedJSON(fromJSON($relaxedExtJson))), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+0c000000106900ffffffff00
+{"i":{"$numberInt":"-1"}}
+{"i":-1}
+0c000000106900ffffffff00
+{"i":-1}
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/int32-valid-004.phpt b/mongodb-1.9.0/tests/bson-corpus/int32-valid-004.phpt
new file mode 100644
index 00000000..c3eba0d3
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/int32-valid-004.phpt
@@ -0,0 +1,40 @@
+--TEST--
+Int32 type: 0
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('0C0000001069000000000000');
+$canonicalExtJson = '{"i" : {"$numberInt": "0"}}';
+$relaxedExtJson = '{"i" : 0}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical BSON -> Relaxed extJSON
+echo json_canonicalize(toRelaxedExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Relaxed extJSON -> BSON -> Relaxed extJSON
+echo json_canonicalize(toRelaxedExtendedJSON(fromJSON($relaxedExtJson))), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+0c0000001069000000000000
+{"i":{"$numberInt":"0"}}
+{"i":0}
+0c0000001069000000000000
+{"i":0}
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/int32-valid-005.phpt b/mongodb-1.9.0/tests/bson-corpus/int32-valid-005.phpt
new file mode 100644
index 00000000..5834dab3
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/int32-valid-005.phpt
@@ -0,0 +1,40 @@
+--TEST--
+Int32 type: 1
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('0C0000001069000100000000');
+$canonicalExtJson = '{"i" : {"$numberInt": "1"}}';
+$relaxedExtJson = '{"i" : 1}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical BSON -> Relaxed extJSON
+echo json_canonicalize(toRelaxedExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Relaxed extJSON -> BSON -> Relaxed extJSON
+echo json_canonicalize(toRelaxedExtendedJSON(fromJSON($relaxedExtJson))), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+0c0000001069000100000000
+{"i":{"$numberInt":"1"}}
+{"i":1}
+0c0000001069000100000000
+{"i":1}
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/int64-decodeError-001.phpt b/mongodb-1.9.0/tests/bson-corpus/int64-decodeError-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/int64-decodeError-001.phpt
rename to mongodb-1.9.0/tests/bson-corpus/int64-decodeError-001.phpt
diff --git a/mongodb-1.9.0/tests/bson-corpus/int64-valid-001.phpt b/mongodb-1.9.0/tests/bson-corpus/int64-valid-001.phpt
new file mode 100644
index 00000000..c0c5f9c7
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/int64-valid-001.phpt
@@ -0,0 +1,42 @@
+--TEST--
+Int64 type: MinValue
+--SKIPIF--
+<?php if (PHP_INT_SIZE !== 8) { die("skip Can't represent 64-bit ints on a 32-bit platform"); } ?>
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('10000000126100000000000000008000');
+$canonicalExtJson = '{"a" : {"$numberLong" : "-9223372036854775808"}}';
+$relaxedExtJson = '{"a" : -9223372036854775808}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical BSON -> Relaxed extJSON
+echo json_canonicalize(toRelaxedExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Relaxed extJSON -> BSON -> Relaxed extJSON
+echo json_canonicalize(toRelaxedExtendedJSON(fromJSON($relaxedExtJson))), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+10000000126100000000000000008000
+{"a":{"$numberLong":"-9223372036854775808"}}
+{"a":-9223372036854775808}
+10000000126100000000000000008000
+{"a":-9223372036854775808}
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/int64-valid-002.phpt b/mongodb-1.9.0/tests/bson-corpus/int64-valid-002.phpt
new file mode 100644
index 00000000..de411876
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/int64-valid-002.phpt
@@ -0,0 +1,42 @@
+--TEST--
+Int64 type: MaxValue
+--SKIPIF--
+<?php if (PHP_INT_SIZE !== 8) { die("skip Can't represent 64-bit ints on a 32-bit platform"); } ?>
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('10000000126100FFFFFFFFFFFFFF7F00');
+$canonicalExtJson = '{"a" : {"$numberLong" : "9223372036854775807"}}';
+$relaxedExtJson = '{"a" : 9223372036854775807}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical BSON -> Relaxed extJSON
+echo json_canonicalize(toRelaxedExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Relaxed extJSON -> BSON -> Relaxed extJSON
+echo json_canonicalize(toRelaxedExtendedJSON(fromJSON($relaxedExtJson))), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+10000000126100ffffffffffffff7f00
+{"a":{"$numberLong":"9223372036854775807"}}
+{"a":9223372036854775807}
+10000000126100ffffffffffffff7f00
+{"a":9223372036854775807}
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/int64-valid-003.phpt b/mongodb-1.9.0/tests/bson-corpus/int64-valid-003.phpt
new file mode 100644
index 00000000..557aaa2b
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/int64-valid-003.phpt
@@ -0,0 +1,42 @@
+--TEST--
+Int64 type: -1
+--XFAIL--
+PHP encodes integers as 32-bit if range allows
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('10000000126100FFFFFFFFFFFFFFFF00');
+$canonicalExtJson = '{"a" : {"$numberLong" : "-1"}}';
+$relaxedExtJson = '{"a" : -1}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical BSON -> Relaxed extJSON
+echo json_canonicalize(toRelaxedExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Relaxed extJSON -> BSON -> Relaxed extJSON
+echo json_canonicalize(toRelaxedExtendedJSON(fromJSON($relaxedExtJson))), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+10000000126100ffffffffffffffff00
+{"a":{"$numberLong":"-1"}}
+{"a":-1}
+10000000126100ffffffffffffffff00
+{"a":-1}
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/int64-valid-004.phpt b/mongodb-1.9.0/tests/bson-corpus/int64-valid-004.phpt
new file mode 100644
index 00000000..5401a3c9
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/int64-valid-004.phpt
@@ -0,0 +1,42 @@
+--TEST--
+Int64 type: 0
+--XFAIL--
+PHP encodes integers as 32-bit if range allows
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('10000000126100000000000000000000');
+$canonicalExtJson = '{"a" : {"$numberLong" : "0"}}';
+$relaxedExtJson = '{"a" : 0}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical BSON -> Relaxed extJSON
+echo json_canonicalize(toRelaxedExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Relaxed extJSON -> BSON -> Relaxed extJSON
+echo json_canonicalize(toRelaxedExtendedJSON(fromJSON($relaxedExtJson))), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+10000000126100000000000000000000
+{"a":{"$numberLong":"0"}}
+{"a":0}
+10000000126100000000000000000000
+{"a":0}
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/int64-valid-005.phpt b/mongodb-1.9.0/tests/bson-corpus/int64-valid-005.phpt
new file mode 100644
index 00000000..109d17e5
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/int64-valid-005.phpt
@@ -0,0 +1,42 @@
+--TEST--
+Int64 type: 1
+--XFAIL--
+PHP encodes integers as 32-bit if range allows
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('10000000126100010000000000000000');
+$canonicalExtJson = '{"a" : {"$numberLong" : "1"}}';
+$relaxedExtJson = '{"a" : 1}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical BSON -> Relaxed extJSON
+echo json_canonicalize(toRelaxedExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Relaxed extJSON -> BSON -> Relaxed extJSON
+echo json_canonicalize(toRelaxedExtendedJSON(fromJSON($relaxedExtJson))), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+10000000126100010000000000000000
+{"a":{"$numberLong":"1"}}
+{"a":1}
+10000000126100010000000000000000
+{"a":1}
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/maxkey-valid-001.phpt b/mongodb-1.9.0/tests/bson-corpus/maxkey-valid-001.phpt
new file mode 100644
index 00000000..9104fdca
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/maxkey-valid-001.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Maxkey type: Maxkey
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('080000007F610000');
+$canonicalExtJson = '{"a" : {"$maxKey" : 1}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+080000007f610000
+{"a":{"$maxKey":1}}
+080000007f610000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/minkey-valid-001.phpt b/mongodb-1.9.0/tests/bson-corpus/minkey-valid-001.phpt
new file mode 100644
index 00000000..3c2e5fcc
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/minkey-valid-001.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Minkey type: Minkey
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('08000000FF610000');
+$canonicalExtJson = '{"a" : {"$minKey" : 1}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+08000000ff610000
+{"a":{"$minKey":1}}
+08000000ff610000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/multi-type-deprecated-valid-001.phpt b/mongodb-1.9.0/tests/bson-corpus/multi-type-deprecated-valid-001.phpt
new file mode 100644
index 00000000..d60f66b2
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/multi-type-deprecated-valid-001.phpt
@@ -0,0 +1,35 @@
+--TEST--
+Multiple types within the same document: All BSON types
+--XFAIL--
+PHP encodes integers as 32-bit if range allows
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('38020000075F69640057E193D7A9CC81B4027498B50E53796D626F6C000700000073796D626F6C0002537472696E670007000000737472696E670010496E743332002A00000012496E743634002A0000000000000001446F75626C6500000000000000F0BF0542696E617279001000000003A34C38F7C3ABEDC8A37814A992AB8DB60542696E61727955736572446566696E656400050000008001020304050D436F6465000E00000066756E6374696F6E2829207B7D000F436F64655769746853636F7065001B0000000E00000066756E6374696F6E2829207B7D00050000000003537562646F63756D656E74001200000002666F6F0004000000626172000004417272617900280000001030000100000010310002000000103200030000001033000400000010340005000000001154696D657374616D7000010000002A0000000B5265676578007061747465726E0000094461746574696D6545706F6368000000000000000000094461746574696D65506F73697469766500FFFFFF7F00000000094461746574696D654E656761746976650000000080FFFFFFFF085472756500010846616C736500000C4442506F696E746572000B000000636F6C6C656374696F6E0057E193D7A9CC81B4027498B1034442526566003D0000000224726566000B000000636F6C6C656374696F6E00072469640057FD71E96E32AB4225B723FB02246462000900000064617461626173650000FF4D696E6B6579007F4D61786B6579000A4E756C6C0006556E646566696E65640000');
+$convertedBson = hex2bin('48020000075f69640057e193d7a9cc81b4027498b50253796d626f6c000700000073796d626f6c0002537472696e670007000000737472696e670010496e743332002a00000012496e743634002a0000000000000001446f75626c6500000000000000f0bf0542696e617279001000000003a34c38f7c3abedc8a37814a992ab8db60542696e61727955736572446566696e656400050000008001020304050d436f6465000e00000066756e6374696f6e2829207b7d000f436f64655769746853636f7065001b0000000e00000066756e6374696f6e2829207b7d00050000000003537562646f63756d656e74001200000002666f6f0004000000626172000004417272617900280000001030000100000010310002000000103200030000001033000400000010340005000000001154696d657374616d7000010000002a0000000b5265676578007061747465726e0000094461746574696d6545706f6368000000000000000000094461746574696d65506f73697469766500ffffff7f00000000094461746574696d654e656761746976650000000080ffffffff085472756500010846616c73650000034442506f696e746572002b0000000224726566000b000000636f6c6c656374696f6e00072469640057e193d7a9cc81b4027498b100034442526566003d0000000224726566000b000000636f6c6c656374696f6e00072469640057fd71e96e32ab4225b723fb02246462000900000064617461626173650000ff4d696e6b6579007f4d61786b6579000a4e756c6c000a556e646566696e65640000');
+$canonicalExtJson = '{"_id": {"$oid": "57e193d7a9cc81b4027498b5"}, "Symbol": {"$symbol": "symbol"}, "String": "string", "Int32": {"$numberInt": "42"}, "Int64": {"$numberLong": "42"}, "Double": {"$numberDouble": "-1.0"}, "Binary": { "$binary" : {"base64": "o0w498Or7cijeBSpkquNtg==", "subType": "03"}}, "BinaryUserDefined": { "$binary" : {"base64": "AQIDBAU=", "subType": "80"}}, "Code": {"$code": "function() {}"}, "CodeWithScope": {"$code": "function() {}", "$scope": {}}, "Subdocument": {"foo": "bar"}, "Array": [{"$numberInt": "1"}, {"$numberInt": "2"}, {"$numberInt": "3"}, {"$numberInt": "4"}, {"$numberInt": "5"}], "Timestamp": {"$timestamp": {"t": 42, "i": 1}}, "Regex": {"$regularExpression": {"pattern": "pattern", "options": ""}}, "DatetimeEpoch": {"$date": {"$numberLong": "0"}}, "DatetimePositive": {"$date": {"$numberLong": "2147483647"}}, "DatetimeNegative": {"$date": {"$numberLong": "-2147483648"}}, "True": true, "False": false, "DBPointer": {"$dbPointer": {"$ref": "collection", "$id": {"$oid": "57e193d7a9cc81b4027498b1"}}}, "DBRef": {"$ref": "collection", "$id": {"$oid": "57fd71e96e32ab4225b723fb"}, "$db": "database"}, "Minkey": {"$minKey": 1}, "Maxkey": {"$maxKey": 1}, "Null": null, "Undefined": {"$undefined": true}}';
+$convertedExtJson = '{"_id": {"$oid": "57e193d7a9cc81b4027498b5"}, "Symbol": "symbol", "String": "string", "Int32": {"$numberInt": "42"}, "Int64": {"$numberLong": "42"}, "Double": {"$numberDouble": "-1.0"}, "Binary": { "$binary" : {"base64": "o0w498Or7cijeBSpkquNtg==", "subType": "03"}}, "BinaryUserDefined": { "$binary" : {"base64": "AQIDBAU=", "subType": "80"}}, "Code": {"$code": "function() {}"}, "CodeWithScope": {"$code": "function() {}", "$scope": {}}, "Subdocument": {"foo": "bar"}, "Array": [{"$numberInt": "1"}, {"$numberInt": "2"}, {"$numberInt": "3"}, {"$numberInt": "4"}, {"$numberInt": "5"}], "Timestamp": {"$timestamp": {"t": 42, "i": 1}}, "Regex": {"$regularExpression": {"pattern": "pattern", "options": ""}}, "DatetimeEpoch": {"$date": {"$numberLong": "0"}}, "DatetimePositive": {"$date": {"$numberLong": "2147483647"}}, "DatetimeNegative": {"$date": {"$numberLong": "-2147483648"}}, "True": true, "False": false, "DBPointer": {"$ref": "collection", "$id": {"$oid": "57e193d7a9cc81b4027498b1"}}, "DBRef": {"$ref": "collection", "$id": {"$oid": "57fd71e96e32ab4225b723fb"}, "$db": "database"}, "Minkey": {"$minKey": 1}, "Maxkey": {"$maxKey": 1}, "Null": null, "Undefined": null}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+38020000075f69640057e193d7a9cc81b4027498b50e53796d626f6c000700000073796d626f6c0002537472696e670007000000737472696e670010496e743332002a00000012496e743634002a0000000000000001446f75626c6500000000000000f0bf0542696e617279001000000003a34c38f7c3abedc8a37814a992ab8db60542696e61727955736572446566696e656400050000008001020304050d436f6465000e00000066756e6374696f6e2829207b7d000f436f64655769746853636f7065001b0000000e00000066756e6374696f6e2829207b7d00050000000003537562646f63756d656e74001200000002666f6f0004000000626172000004417272617900280000001030000100000010310002000000103200030000001033000400000010340005000000001154696d657374616d7000010000002a0000000b5265676578007061747465726e0000094461746574696d6545706f6368000000000000000000094461746574696d65506f73697469766500ffffff7f00000000094461746574696d654e656761746976650000000080ffffffff085472756500010846616c736500000c4442506f696e746572000b000000636f6c6c656374696f6e0057e193d7a9cc81b4027498b1034442526566003d0000000224726566000b000000636f6c6c656374696f6e00072469640057fd71e96e32ab4225b723fb02246462000900000064617461626173650000ff4d696e6b6579007f4d61786b6579000a4e756c6c0006556e646566696e65640000
+{"_id":{"$oid":"57e193d7a9cc81b4027498b5"},"Symbol":{"$symbol":"symbol"},"String":"string","Int32":{"$numberInt":"42"},"Int64":{"$numberLong":"42"},"Double":{"$numberDouble":"-1"},"Binary":{"$binary":{"base64":"o0w498Or7cijeBSpkquNtg==","subType":"03"}},"BinaryUserDefined":{"$binary":{"base64":"AQIDBAU=","subType":"80"}},"Code":{"$code":"function() {}"},"CodeWithScope":{"$code":"function() {}","$scope":{}},"Subdocument":{"foo":"bar"},"Array":[{"$numberInt":"1"},{"$numberInt":"2"},{"$numberInt":"3"},{"$numberInt":"4"},{"$numberInt":"5"}],"Timestamp":{"$timestamp":{"t":42,"i":1}},"Regex":{"$regularExpression":{"pattern":"pattern","options":""}},"DatetimeEpoch":{"$date":{"$numberLong":"0"}},"DatetimePositive":{"$date":{"$numberLong":"2147483647"}},"DatetimeNegative":{"$date":{"$numberLong":"-2147483648"}},"True":true,"False":false,"DBPointer":{"$dbPointer":{"$ref":"collection","$id":{"$oid":"57e193d7a9cc81b4027498b1"}}},"DBRef":{"$ref":"collection","$id":{"$oid":"57fd71e96e32ab4225b723fb"},"$db":"database"},"Minkey":{"$minKey":1},"Maxkey":{"$maxKey":1},"Null":null,"Undefined":{"$undefined":true}}
+38020000075f69640057e193d7a9cc81b4027498b50e53796d626f6c000700000073796d626f6c0002537472696e670007000000737472696e670010496e743332002a00000012496e743634002a0000000000000001446f75626c6500000000000000f0bf0542696e617279001000000003a34c38f7c3abedc8a37814a992ab8db60542696e61727955736572446566696e656400050000008001020304050d436f6465000e00000066756e6374696f6e2829207b7d000f436f64655769746853636f7065001b0000000e00000066756e6374696f6e2829207b7d00050000000003537562646f63756d656e74001200000002666f6f0004000000626172000004417272617900280000001030000100000010310002000000103200030000001033000400000010340005000000001154696d657374616d7000010000002a0000000b5265676578007061747465726e0000094461746574696d6545706f6368000000000000000000094461746574696d65506f73697469766500ffffff7f00000000094461746574696d654e656761746976650000000080ffffffff085472756500010846616c736500000c4442506f696e746572000b000000636f6c6c656374696f6e0057e193d7a9cc81b4027498b1034442526566003d0000000224726566000b000000636f6c6c656374696f6e00072469640057fd71e96e32ab4225b723fb02246462000900000064617461626173650000ff4d696e6b6579007f4d61786b6579000a4e756c6c0006556e646566696e65640000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/multi-type-valid-001.phpt b/mongodb-1.9.0/tests/bson-corpus/multi-type-valid-001.phpt
new file mode 100644
index 00000000..6050707c
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/multi-type-valid-001.phpt
@@ -0,0 +1,33 @@
+--TEST--
+Multiple types within the same document: All BSON types
+--XFAIL--
+PHP encodes integers as 32-bit if range allows
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('F4010000075F69640057E193D7A9CC81B4027498B502537472696E670007000000737472696E670010496E743332002A00000012496E743634002A0000000000000001446F75626C6500000000000000F0BF0542696E617279001000000003A34C38F7C3ABEDC8A37814A992AB8DB60542696E61727955736572446566696E656400050000008001020304050D436F6465000E00000066756E6374696F6E2829207B7D000F436F64655769746853636F7065001B0000000E00000066756E6374696F6E2829207B7D00050000000003537562646F63756D656E74001200000002666F6F0004000000626172000004417272617900280000001030000100000010310002000000103200030000001033000400000010340005000000001154696D657374616D7000010000002A0000000B5265676578007061747465726E0000094461746574696D6545706F6368000000000000000000094461746574696D65506F73697469766500FFFFFF7F00000000094461746574696D654E656761746976650000000080FFFFFFFF085472756500010846616C73650000034442526566003D0000000224726566000B000000636F6C6C656374696F6E00072469640057FD71E96E32AB4225B723FB02246462000900000064617461626173650000FF4D696E6B6579007F4D61786B6579000A4E756C6C0000');
+$canonicalExtJson = '{"_id": {"$oid": "57e193d7a9cc81b4027498b5"}, "String": "string", "Int32": {"$numberInt": "42"}, "Int64": {"$numberLong": "42"}, "Double": {"$numberDouble": "-1.0"}, "Binary": { "$binary" : {"base64": "o0w498Or7cijeBSpkquNtg==", "subType": "03"}}, "BinaryUserDefined": { "$binary" : {"base64": "AQIDBAU=", "subType": "80"}}, "Code": {"$code": "function() {}"}, "CodeWithScope": {"$code": "function() {}", "$scope": {}}, "Subdocument": {"foo": "bar"}, "Array": [{"$numberInt": "1"}, {"$numberInt": "2"}, {"$numberInt": "3"}, {"$numberInt": "4"}, {"$numberInt": "5"}], "Timestamp": {"$timestamp": {"t": 42, "i": 1}}, "Regex": {"$regularExpression": {"pattern": "pattern", "options": ""}}, "DatetimeEpoch": {"$date": {"$numberLong": "0"}}, "DatetimePositive": {"$date": {"$numberLong": "2147483647"}}, "DatetimeNegative": {"$date": {"$numberLong": "-2147483648"}}, "True": true, "False": false, "DBRef": {"$ref": "collection", "$id": {"$oid": "57fd71e96e32ab4225b723fb"}, "$db": "database"}, "Minkey": {"$minKey": 1}, "Maxkey": {"$maxKey": 1}, "Null": null}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+f4010000075f69640057e193d7a9cc81b4027498b502537472696e670007000000737472696e670010496e743332002a00000012496e743634002a0000000000000001446f75626c6500000000000000f0bf0542696e617279001000000003a34c38f7c3abedc8a37814a992ab8db60542696e61727955736572446566696e656400050000008001020304050d436f6465000e00000066756e6374696f6e2829207b7d000f436f64655769746853636f7065001b0000000e00000066756e6374696f6e2829207b7d00050000000003537562646f63756d656e74001200000002666f6f0004000000626172000004417272617900280000001030000100000010310002000000103200030000001033000400000010340005000000001154696d657374616d7000010000002a0000000b5265676578007061747465726e0000094461746574696d6545706f6368000000000000000000094461746574696d65506f73697469766500ffffff7f00000000094461746574696d654e656761746976650000000080ffffffff085472756500010846616c73650000034442526566003d0000000224726566000b000000636f6c6c656374696f6e00072469640057fd71e96e32ab4225b723fb02246462000900000064617461626173650000ff4d696e6b6579007f4d61786b6579000a4e756c6c0000
+{"_id":{"$oid":"57e193d7a9cc81b4027498b5"},"String":"string","Int32":{"$numberInt":"42"},"Int64":{"$numberLong":"42"},"Double":{"$numberDouble":"-1"},"Binary":{"$binary":{"base64":"o0w498Or7cijeBSpkquNtg==","subType":"03"}},"BinaryUserDefined":{"$binary":{"base64":"AQIDBAU=","subType":"80"}},"Code":{"$code":"function() {}"},"CodeWithScope":{"$code":"function() {}","$scope":{}},"Subdocument":{"foo":"bar"},"Array":[{"$numberInt":"1"},{"$numberInt":"2"},{"$numberInt":"3"},{"$numberInt":"4"},{"$numberInt":"5"}],"Timestamp":{"$timestamp":{"t":42,"i":1}},"Regex":{"$regularExpression":{"pattern":"pattern","options":""}},"DatetimeEpoch":{"$date":{"$numberLong":"0"}},"DatetimePositive":{"$date":{"$numberLong":"2147483647"}},"DatetimeNegative":{"$date":{"$numberLong":"-2147483648"}},"True":true,"False":false,"DBRef":{"$ref":"collection","$id":{"$oid":"57fd71e96e32ab4225b723fb"},"$db":"database"},"Minkey":{"$minKey":1},"Maxkey":{"$maxKey":1},"Null":null}
+f4010000075f69640057e193d7a9cc81b4027498b502537472696e670007000000737472696e670010496e743332002a00000012496e743634002a0000000000000001446f75626c6500000000000000f0bf0542696e617279001000000003a34c38f7c3abedc8a37814a992ab8db60542696e61727955736572446566696e656400050000008001020304050d436f6465000e00000066756e6374696f6e2829207b7d000f436f64655769746853636f7065001b0000000e00000066756e6374696f6e2829207b7d00050000000003537562646f63756d656e74001200000002666f6f0004000000626172000004417272617900280000001030000100000010310002000000103200030000001033000400000010340005000000001154696d657374616d7000010000002a0000000b5265676578007061747465726e0000094461746574696d6545706f6368000000000000000000094461746574696d65506f73697469766500ffffff7f00000000094461746574696d654e656761746976650000000080ffffffff085472756500010846616c73650000034442526566003d0000000224726566000b000000636f6c6c656374696f6e00072469640057fd71e96e32ab4225b723fb02246462000900000064617461626173650000ff4d696e6b6579007f4d61786b6579000a4e756c6c0000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/null-valid-001.phpt b/mongodb-1.9.0/tests/bson-corpus/null-valid-001.phpt
new file mode 100644
index 00000000..865289aa
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/null-valid-001.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Null type: Null
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('080000000A610000');
+$canonicalExtJson = '{"a" : null}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+080000000a610000
+{"a":null}
+080000000a610000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/oid-decodeError-001.phpt b/mongodb-1.9.0/tests/bson-corpus/oid-decodeError-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/oid-decodeError-001.phpt
rename to mongodb-1.9.0/tests/bson-corpus/oid-decodeError-001.phpt
diff --git a/mongodb-1.9.0/tests/bson-corpus/oid-valid-001.phpt b/mongodb-1.9.0/tests/bson-corpus/oid-valid-001.phpt
new file mode 100644
index 00000000..54691aa1
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/oid-valid-001.phpt
@@ -0,0 +1,31 @@
+--TEST--
+ObjectId: All zeroes
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('1400000007610000000000000000000000000000');
+$canonicalExtJson = '{"a" : {"$oid" : "000000000000000000000000"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+1400000007610000000000000000000000000000
+{"a":{"$oid":"000000000000000000000000"}}
+1400000007610000000000000000000000000000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/oid-valid-002.phpt b/mongodb-1.9.0/tests/bson-corpus/oid-valid-002.phpt
new file mode 100644
index 00000000..b65ef0e6
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/oid-valid-002.phpt
@@ -0,0 +1,31 @@
+--TEST--
+ObjectId: All ones
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('14000000076100FFFFFFFFFFFFFFFFFFFFFFFF00');
+$canonicalExtJson = '{"a" : {"$oid" : "ffffffffffffffffffffffff"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+14000000076100ffffffffffffffffffffffff00
+{"a":{"$oid":"ffffffffffffffffffffffff"}}
+14000000076100ffffffffffffffffffffffff00
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/oid-valid-003.phpt b/mongodb-1.9.0/tests/bson-corpus/oid-valid-003.phpt
new file mode 100644
index 00000000..24767da3
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/oid-valid-003.phpt
@@ -0,0 +1,31 @@
+--TEST--
+ObjectId: Random
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('1400000007610056E1FC72E0C917E9C471416100');
+$canonicalExtJson = '{"a" : {"$oid" : "56e1fc72e0c917e9c4714161"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+1400000007610056e1fc72e0c917e9c471416100
+{"a":{"$oid":"56e1fc72e0c917e9c4714161"}}
+1400000007610056e1fc72e0c917e9c471416100
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/regex-decodeError-001.phpt b/mongodb-1.9.0/tests/bson-corpus/regex-decodeError-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/regex-decodeError-001.phpt
rename to mongodb-1.9.0/tests/bson-corpus/regex-decodeError-001.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/regex-decodeError-002.phpt b/mongodb-1.9.0/tests/bson-corpus/regex-decodeError-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/regex-decodeError-002.phpt
rename to mongodb-1.9.0/tests/bson-corpus/regex-decodeError-002.phpt
diff --git a/mongodb-1.9.0/tests/bson-corpus/regex-valid-001.phpt b/mongodb-1.9.0/tests/bson-corpus/regex-valid-001.phpt
new file mode 100644
index 00000000..0cb6e2fd
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/regex-valid-001.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Regular Expression type: empty regex with no options
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('0A0000000B6100000000');
+$canonicalExtJson = '{"a" : {"$regularExpression" : { "pattern": "", "options" : ""}}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+0a0000000b6100000000
+{"a":{"$regularExpression":{"pattern":"","options":""}}}
+0a0000000b6100000000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/regex-valid-002.phpt b/mongodb-1.9.0/tests/bson-corpus/regex-valid-002.phpt
new file mode 100644
index 00000000..a54ddb7c
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/regex-valid-002.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Regular Expression type: regex without options
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('0D0000000B6100616263000000');
+$canonicalExtJson = '{"a" : {"$regularExpression" : { "pattern": "abc", "options" : ""}}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+0d0000000b6100616263000000
+{"a":{"$regularExpression":{"pattern":"abc","options":""}}}
+0d0000000b6100616263000000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/regex-valid-003.phpt b/mongodb-1.9.0/tests/bson-corpus/regex-valid-003.phpt
new file mode 100644
index 00000000..786a04b4
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/regex-valid-003.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Regular Expression type: regex with options
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('0F0000000B610061626300696D0000');
+$canonicalExtJson = '{"a" : {"$regularExpression" : { "pattern": "abc", "options" : "im"}}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+0f0000000b610061626300696d0000
+{"a":{"$regularExpression":{"pattern":"abc","options":"im"}}}
+0f0000000b610061626300696d0000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/regex-valid-004.phpt b/mongodb-1.9.0/tests/bson-corpus/regex-valid-004.phpt
new file mode 100644
index 00000000..00a1442f
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/regex-valid-004.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Regular Expression type: regex with options (keys reversed)
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('0F0000000B610061626300696D0000');
+$canonicalExtJson = '{"a" : {"$regularExpression" : { "pattern": "abc", "options" : "im"}}}';
+$degenerateExtJson = '{"a" : {"$regularExpression" : {"options" : "im", "pattern": "abc"}}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+0f0000000b610061626300696d0000
+{"a":{"$regularExpression":{"pattern":"abc","options":"im"}}}
+0f0000000b610061626300696d0000
+0f0000000b610061626300696d0000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/regex-valid-005.phpt b/mongodb-1.9.0/tests/bson-corpus/regex-valid-005.phpt
new file mode 100644
index 00000000..bb182817
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/regex-valid-005.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Regular Expression type: regex with slash
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('110000000B610061622F636400696D0000');
+$canonicalExtJson = '{"a" : {"$regularExpression" : { "pattern": "ab/cd", "options" : "im"}}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+110000000b610061622f636400696d0000
+{"a":{"$regularExpression":{"pattern":"ab\/cd","options":"im"}}}
+110000000b610061622f636400696d0000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/regex-valid-006.phpt b/mongodb-1.9.0/tests/bson-corpus/regex-valid-006.phpt
new file mode 100644
index 00000000..0df5d179
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/regex-valid-006.phpt
@@ -0,0 +1,45 @@
+--TEST--
+Regular Expression type: flags not alphabetized
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('100000000B610061626300696D780000');
+$degenerateBson = hex2bin('100000000B6100616263006D69780000');
+$canonicalExtJson = '{"a" : {"$regularExpression" : { "pattern": "abc", "options" : "imx"}}}';
+$degenerateExtJson = '{"a" : {"$regularExpression" : { "pattern": "abc", "options" : "mix"}}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($degenerateBson))), "\n";
+
+// Degenerate BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($degenerateBson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+100000000b610061626300696d780000
+{"a":{"$regularExpression":{"pattern":"abc","options":"imx"}}}
+100000000b610061626300696d780000
+100000000b610061626300696d780000
+{"a":{"$regularExpression":{"pattern":"abc","options":"imx"}}}
+100000000b610061626300696d780000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/regex-valid-007.phpt b/mongodb-1.9.0/tests/bson-corpus/regex-valid-007.phpt
new file mode 100644
index 00000000..a83df13a
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/regex-valid-007.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Regular Expression type: Required escapes
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('100000000B610061625C226162000000');
+$canonicalExtJson = '{"a" : {"$regularExpression" : { "pattern": "ab\\\\\\"ab", "options" : ""}}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+100000000b610061625c226162000000
+{"a":{"$regularExpression":{"pattern":"ab\\\"ab","options":""}}}
+100000000b610061625c226162000000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/regex-valid-008.phpt b/mongodb-1.9.0/tests/bson-corpus/regex-valid-008.phpt
new file mode 100644
index 00000000..db58cbe8
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/regex-valid-008.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Regular Expression type: Regular expression as value of $regex query operator
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('180000000B247265676578007061747465726E0069780000');
+$canonicalExtJson = '{"$regex" : {"$regularExpression" : { "pattern": "pattern", "options" : "ix"}}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+180000000b247265676578007061747465726e0069780000
+{"$regex":{"$regularExpression":{"pattern":"pattern","options":"ix"}}}
+180000000b247265676578007061747465726e0069780000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/regex-valid-009.phpt b/mongodb-1.9.0/tests/bson-corpus/regex-valid-009.phpt
new file mode 100644
index 00000000..42d7ca15
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/regex-valid-009.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Regular Expression type: Regular expression as value of $regex query operator with $options
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('270000000B247265676578007061747465726E000002246F7074696F6E73000300000069780000');
+$canonicalExtJson = '{"$regex" : {"$regularExpression" : { "pattern": "pattern", "options" : ""}}, "$options" : "ix"}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+270000000b247265676578007061747465726e000002246f7074696f6e73000300000069780000
+{"$regex":{"$regularExpression":{"pattern":"pattern","options":""}},"$options":"ix"}
+270000000b247265676578007061747465726e000002246f7074696f6e73000300000069780000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/string-decodeError-001.phpt b/mongodb-1.9.0/tests/bson-corpus/string-decodeError-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/string-decodeError-001.phpt
rename to mongodb-1.9.0/tests/bson-corpus/string-decodeError-001.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/string-decodeError-002.phpt b/mongodb-1.9.0/tests/bson-corpus/string-decodeError-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/string-decodeError-002.phpt
rename to mongodb-1.9.0/tests/bson-corpus/string-decodeError-002.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/string-decodeError-003.phpt b/mongodb-1.9.0/tests/bson-corpus/string-decodeError-003.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/string-decodeError-003.phpt
rename to mongodb-1.9.0/tests/bson-corpus/string-decodeError-003.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/string-decodeError-004.phpt b/mongodb-1.9.0/tests/bson-corpus/string-decodeError-004.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/string-decodeError-004.phpt
rename to mongodb-1.9.0/tests/bson-corpus/string-decodeError-004.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/string-decodeError-005.phpt b/mongodb-1.9.0/tests/bson-corpus/string-decodeError-005.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/string-decodeError-005.phpt
rename to mongodb-1.9.0/tests/bson-corpus/string-decodeError-005.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/string-decodeError-006.phpt b/mongodb-1.9.0/tests/bson-corpus/string-decodeError-006.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/string-decodeError-006.phpt
rename to mongodb-1.9.0/tests/bson-corpus/string-decodeError-006.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/string-decodeError-007.phpt b/mongodb-1.9.0/tests/bson-corpus/string-decodeError-007.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/string-decodeError-007.phpt
rename to mongodb-1.9.0/tests/bson-corpus/string-decodeError-007.phpt
diff --git a/mongodb-1.9.0/tests/bson-corpus/string-valid-001.phpt b/mongodb-1.9.0/tests/bson-corpus/string-valid-001.phpt
new file mode 100644
index 00000000..2f37de41
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/string-valid-001.phpt
@@ -0,0 +1,31 @@
+--TEST--
+String: Empty string
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('0D000000026100010000000000');
+$canonicalExtJson = '{"a" : ""}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+0d000000026100010000000000
+{"a":""}
+0d000000026100010000000000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/string-valid-002.phpt b/mongodb-1.9.0/tests/bson-corpus/string-valid-002.phpt
new file mode 100644
index 00000000..0f597a01
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/string-valid-002.phpt
@@ -0,0 +1,31 @@
+--TEST--
+String: Single character
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('0E00000002610002000000620000');
+$canonicalExtJson = '{"a" : "b"}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+0e00000002610002000000620000
+{"a":"b"}
+0e00000002610002000000620000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/string-valid-003.phpt b/mongodb-1.9.0/tests/bson-corpus/string-valid-003.phpt
new file mode 100644
index 00000000..020934ff
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/string-valid-003.phpt
@@ -0,0 +1,31 @@
+--TEST--
+String: Multi-character
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('190000000261000D0000006162616261626162616261620000');
+$canonicalExtJson = '{"a" : "abababababab"}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+190000000261000d0000006162616261626162616261620000
+{"a":"abababababab"}
+190000000261000d0000006162616261626162616261620000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/string-valid-004.phpt b/mongodb-1.9.0/tests/bson-corpus/string-valid-004.phpt
new file mode 100644
index 00000000..252d0219
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/string-valid-004.phpt
@@ -0,0 +1,31 @@
+--TEST--
+String: two-byte UTF-8 (é)
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('190000000261000D000000C3A9C3A9C3A9C3A9C3A9C3A90000');
+$canonicalExtJson = '{"a" : "\\u00e9\\u00e9\\u00e9\\u00e9\\u00e9\\u00e9"}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+190000000261000d000000c3a9c3a9c3a9c3a9c3a9c3a90000
+{"a":"\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9"}
+190000000261000d000000c3a9c3a9c3a9c3a9c3a9c3a90000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/string-valid-005.phpt b/mongodb-1.9.0/tests/bson-corpus/string-valid-005.phpt
new file mode 100644
index 00000000..2cd7ccbc
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/string-valid-005.phpt
@@ -0,0 +1,31 @@
+--TEST--
+String: three-byte UTF-8 (☆)
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('190000000261000D000000E29886E29886E29886E298860000');
+$canonicalExtJson = '{"a" : "\\u2606\\u2606\\u2606\\u2606"}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+190000000261000d000000e29886e29886e29886e298860000
+{"a":"\u2606\u2606\u2606\u2606"}
+190000000261000d000000e29886e29886e29886e298860000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/string-valid-006.phpt b/mongodb-1.9.0/tests/bson-corpus/string-valid-006.phpt
new file mode 100644
index 00000000..efee7e35
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/string-valid-006.phpt
@@ -0,0 +1,31 @@
+--TEST--
+String: Embedded nulls
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('190000000261000D0000006162006261620062616261620000');
+$canonicalExtJson = '{"a" : "ab\\u0000bab\\u0000babab"}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+190000000261000d0000006162006261620062616261620000
+{"a":"ab\u0000bab\u0000babab"}
+190000000261000d0000006162006261620062616261620000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/string-valid-007.phpt b/mongodb-1.9.0/tests/bson-corpus/string-valid-007.phpt
new file mode 100644
index 00000000..419f9b16
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/string-valid-007.phpt
@@ -0,0 +1,31 @@
+--TEST--
+String: Required escapes
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('320000000261002600000061625C220102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F61620000');
+$canonicalExtJson = '{"a":"ab\\\\\\"\\u0001\\u0002\\u0003\\u0004\\u0005\\u0006\\u0007\\b\\t\\n\\u000b\\f\\r\\u000e\\u000f\\u0010\\u0011\\u0012\\u0013\\u0014\\u0015\\u0016\\u0017\\u0018\\u0019\\u001a\\u001b\\u001c\\u001d\\u001e\\u001fab"}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+320000000261002600000061625c220102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f61620000
+{"a":"ab\\\"\u0001\u0002\u0003\u0004\u0005\u0006\u0007\b\t\n\u000b\f\r\u000e\u000f\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001a\u001b\u001c\u001d\u001e\u001fab"}
+320000000261002600000061625c220102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f61620000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/symbol-decodeError-001.phpt b/mongodb-1.9.0/tests/bson-corpus/symbol-decodeError-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/symbol-decodeError-001.phpt
rename to mongodb-1.9.0/tests/bson-corpus/symbol-decodeError-001.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/symbol-decodeError-002.phpt b/mongodb-1.9.0/tests/bson-corpus/symbol-decodeError-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/symbol-decodeError-002.phpt
rename to mongodb-1.9.0/tests/bson-corpus/symbol-decodeError-002.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/symbol-decodeError-003.phpt b/mongodb-1.9.0/tests/bson-corpus/symbol-decodeError-003.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/symbol-decodeError-003.phpt
rename to mongodb-1.9.0/tests/bson-corpus/symbol-decodeError-003.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/symbol-decodeError-004.phpt b/mongodb-1.9.0/tests/bson-corpus/symbol-decodeError-004.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/symbol-decodeError-004.phpt
rename to mongodb-1.9.0/tests/bson-corpus/symbol-decodeError-004.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/symbol-decodeError-005.phpt b/mongodb-1.9.0/tests/bson-corpus/symbol-decodeError-005.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/symbol-decodeError-005.phpt
rename to mongodb-1.9.0/tests/bson-corpus/symbol-decodeError-005.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/symbol-decodeError-006.phpt b/mongodb-1.9.0/tests/bson-corpus/symbol-decodeError-006.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/symbol-decodeError-006.phpt
rename to mongodb-1.9.0/tests/bson-corpus/symbol-decodeError-006.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/symbol-decodeError-007.phpt b/mongodb-1.9.0/tests/bson-corpus/symbol-decodeError-007.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/symbol-decodeError-007.phpt
rename to mongodb-1.9.0/tests/bson-corpus/symbol-decodeError-007.phpt
diff --git a/mongodb-1.9.0/tests/bson-corpus/symbol-valid-001.phpt b/mongodb-1.9.0/tests/bson-corpus/symbol-valid-001.phpt
new file mode 100644
index 00000000..b496ced1
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/symbol-valid-001.phpt
@@ -0,0 +1,33 @@
+--TEST--
+Symbol: Empty string
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('0D0000000E6100010000000000');
+$convertedBson = hex2bin('0D000000026100010000000000');
+$canonicalExtJson = '{"a": {"$symbol": ""}}';
+$convertedExtJson = '{"a": ""}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+0d0000000e6100010000000000
+{"a":{"$symbol":""}}
+0d0000000e6100010000000000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/symbol-valid-002.phpt b/mongodb-1.9.0/tests/bson-corpus/symbol-valid-002.phpt
new file mode 100644
index 00000000..528742e7
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/symbol-valid-002.phpt
@@ -0,0 +1,33 @@
+--TEST--
+Symbol: Single character
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('0E0000000E610002000000620000');
+$convertedBson = hex2bin('0E00000002610002000000620000');
+$canonicalExtJson = '{"a": {"$symbol": "b"}}';
+$convertedExtJson = '{"a": "b"}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+0e0000000e610002000000620000
+{"a":{"$symbol":"b"}}
+0e0000000e610002000000620000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/symbol-valid-003.phpt b/mongodb-1.9.0/tests/bson-corpus/symbol-valid-003.phpt
new file mode 100644
index 00000000..461cdea5
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/symbol-valid-003.phpt
@@ -0,0 +1,33 @@
+--TEST--
+Symbol: Multi-character
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('190000000E61000D0000006162616261626162616261620000');
+$convertedBson = hex2bin('190000000261000D0000006162616261626162616261620000');
+$canonicalExtJson = '{"a": {"$symbol": "abababababab"}}';
+$convertedExtJson = '{"a": "abababababab"}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+190000000e61000d0000006162616261626162616261620000
+{"a":{"$symbol":"abababababab"}}
+190000000e61000d0000006162616261626162616261620000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/symbol-valid-004.phpt b/mongodb-1.9.0/tests/bson-corpus/symbol-valid-004.phpt
new file mode 100644
index 00000000..78957aae
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/symbol-valid-004.phpt
@@ -0,0 +1,33 @@
+--TEST--
+Symbol: two-byte UTF-8 (é)
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('190000000E61000D000000C3A9C3A9C3A9C3A9C3A9C3A90000');
+$convertedBson = hex2bin('190000000261000D000000C3A9C3A9C3A9C3A9C3A9C3A90000');
+$canonicalExtJson = '{"a": {"$symbol": "éééééé"}}';
+$convertedExtJson = '{"a": "éééééé"}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+190000000e61000d000000c3a9c3a9c3a9c3a9c3a9c3a90000
+{"a":{"$symbol":"\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9"}}
+190000000e61000d000000c3a9c3a9c3a9c3a9c3a9c3a90000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/symbol-valid-005.phpt b/mongodb-1.9.0/tests/bson-corpus/symbol-valid-005.phpt
new file mode 100644
index 00000000..d80f9b22
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/symbol-valid-005.phpt
@@ -0,0 +1,33 @@
+--TEST--
+Symbol: three-byte UTF-8 (☆)
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('190000000E61000D000000E29886E29886E29886E298860000');
+$convertedBson = hex2bin('190000000261000D000000E29886E29886E29886E298860000');
+$canonicalExtJson = '{"a": {"$symbol": "☆☆☆☆"}}';
+$convertedExtJson = '{"a": "☆☆☆☆"}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+190000000e61000d000000e29886e29886e29886e298860000
+{"a":{"$symbol":"\u2606\u2606\u2606\u2606"}}
+190000000e61000d000000e29886e29886e29886e298860000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/symbol-valid-006.phpt b/mongodb-1.9.0/tests/bson-corpus/symbol-valid-006.phpt
new file mode 100644
index 00000000..ea66b385
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/symbol-valid-006.phpt
@@ -0,0 +1,33 @@
+--TEST--
+Symbol: Embedded nulls
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('190000000E61000D0000006162006261620062616261620000');
+$convertedBson = hex2bin('190000000261000D0000006162006261620062616261620000');
+$canonicalExtJson = '{"a": {"$symbol": "ab\\u0000bab\\u0000babab"}}';
+$convertedExtJson = '{"a": "ab\\u0000bab\\u0000babab"}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+190000000e61000d0000006162006261620062616261620000
+{"a":{"$symbol":"ab\u0000bab\u0000babab"}}
+190000000e61000d0000006162006261620062616261620000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/timestamp-decodeError-001.phpt b/mongodb-1.9.0/tests/bson-corpus/timestamp-decodeError-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/timestamp-decodeError-001.phpt
rename to mongodb-1.9.0/tests/bson-corpus/timestamp-decodeError-001.phpt
diff --git a/mongodb-1.9.0/tests/bson-corpus/timestamp-valid-001.phpt b/mongodb-1.9.0/tests/bson-corpus/timestamp-valid-001.phpt
new file mode 100644
index 00000000..9c2226e9
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/timestamp-valid-001.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Timestamp type: Timestamp: (123456789, 42)
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('100000001161002A00000015CD5B0700');
+$canonicalExtJson = '{"a" : {"$timestamp" : {"t" : 123456789, "i" : 42} } }';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+100000001161002a00000015cd5b0700
+{"a":{"$timestamp":{"t":123456789,"i":42}}}
+100000001161002a00000015cd5b0700
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/timestamp-valid-002.phpt b/mongodb-1.9.0/tests/bson-corpus/timestamp-valid-002.phpt
new file mode 100644
index 00000000..dc78c67b
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/timestamp-valid-002.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Timestamp type: Timestamp: (123456789, 42) (keys reversed)
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('100000001161002A00000015CD5B0700');
+$canonicalExtJson = '{"a" : {"$timestamp" : {"t" : 123456789, "i" : 42} } }';
+$degenerateExtJson = '{"a" : {"$timestamp" : {"i" : 42, "t" : 123456789} } }';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+// Degenerate extJSON -> Canonical BSON
+echo bin2hex(fromJSON($degenerateExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+100000001161002a00000015cd5b0700
+{"a":{"$timestamp":{"t":123456789,"i":42}}}
+100000001161002a00000015cd5b0700
+100000001161002a00000015cd5b0700
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/timestamp-valid-003.phpt b/mongodb-1.9.0/tests/bson-corpus/timestamp-valid-003.phpt
new file mode 100644
index 00000000..c1423eec
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/timestamp-valid-003.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Timestamp type: Timestamp with high-order bit set on both seconds and increment
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('10000000116100FFFFFFFFFFFFFFFF00');
+$canonicalExtJson = '{"a" : {"$timestamp" : {"t" : 4294967295, "i" : 4294967295} } }';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+10000000116100ffffffffffffffff00
+{"a":{"$timestamp":{"t":4294967295,"i":4294967295}}}
+10000000116100ffffffffffffffff00
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/timestamp-valid-004.phpt b/mongodb-1.9.0/tests/bson-corpus/timestamp-valid-004.phpt
new file mode 100644
index 00000000..3b9723bc
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/timestamp-valid-004.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Timestamp type: Timestamp with high-order bit set on both seconds and increment (not UINT32_MAX)
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('1000000011610000286BEE00286BEE00');
+$canonicalExtJson = '{"a" : {"$timestamp" : {"t" : 4000000000, "i" : 4000000000} } }';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+1000000011610000286bee00286bee00
+{"a":{"$timestamp":{"t":4000000000,"i":4000000000}}}
+1000000011610000286bee00286bee00
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/top-decodeError-001.phpt b/mongodb-1.9.0/tests/bson-corpus/top-decodeError-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/top-decodeError-001.phpt
rename to mongodb-1.9.0/tests/bson-corpus/top-decodeError-001.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/top-decodeError-002.phpt b/mongodb-1.9.0/tests/bson-corpus/top-decodeError-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/top-decodeError-002.phpt
rename to mongodb-1.9.0/tests/bson-corpus/top-decodeError-002.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/top-decodeError-003.phpt b/mongodb-1.9.0/tests/bson-corpus/top-decodeError-003.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/top-decodeError-003.phpt
rename to mongodb-1.9.0/tests/bson-corpus/top-decodeError-003.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/top-decodeError-004.phpt b/mongodb-1.9.0/tests/bson-corpus/top-decodeError-004.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/top-decodeError-004.phpt
rename to mongodb-1.9.0/tests/bson-corpus/top-decodeError-004.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/top-decodeError-005.phpt b/mongodb-1.9.0/tests/bson-corpus/top-decodeError-005.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/top-decodeError-005.phpt
rename to mongodb-1.9.0/tests/bson-corpus/top-decodeError-005.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/top-decodeError-006.phpt b/mongodb-1.9.0/tests/bson-corpus/top-decodeError-006.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/top-decodeError-006.phpt
rename to mongodb-1.9.0/tests/bson-corpus/top-decodeError-006.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/top-decodeError-007.phpt b/mongodb-1.9.0/tests/bson-corpus/top-decodeError-007.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/top-decodeError-007.phpt
rename to mongodb-1.9.0/tests/bson-corpus/top-decodeError-007.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/top-decodeError-008.phpt b/mongodb-1.9.0/tests/bson-corpus/top-decodeError-008.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/top-decodeError-008.phpt
rename to mongodb-1.9.0/tests/bson-corpus/top-decodeError-008.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/top-decodeError-009.phpt b/mongodb-1.9.0/tests/bson-corpus/top-decodeError-009.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/top-decodeError-009.phpt
rename to mongodb-1.9.0/tests/bson-corpus/top-decodeError-009.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/top-decodeError-010.phpt b/mongodb-1.9.0/tests/bson-corpus/top-decodeError-010.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/top-decodeError-010.phpt
rename to mongodb-1.9.0/tests/bson-corpus/top-decodeError-010.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/top-decodeError-011.phpt b/mongodb-1.9.0/tests/bson-corpus/top-decodeError-011.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/top-decodeError-011.phpt
rename to mongodb-1.9.0/tests/bson-corpus/top-decodeError-011.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/top-decodeError-012.phpt b/mongodb-1.9.0/tests/bson-corpus/top-decodeError-012.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/top-decodeError-012.phpt
rename to mongodb-1.9.0/tests/bson-corpus/top-decodeError-012.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/top-decodeError-013.phpt b/mongodb-1.9.0/tests/bson-corpus/top-decodeError-013.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/top-decodeError-013.phpt
rename to mongodb-1.9.0/tests/bson-corpus/top-decodeError-013.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/top-decodeError-014.phpt b/mongodb-1.9.0/tests/bson-corpus/top-decodeError-014.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/top-decodeError-014.phpt
rename to mongodb-1.9.0/tests/bson-corpus/top-decodeError-014.phpt
diff --git a/mongodb-1.9.0/tests/bson-corpus/top-parseError-001.phpt b/mongodb-1.9.0/tests/bson-corpus/top-parseError-001.phpt
new file mode 100644
index 00000000..ac3b3107
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/top-parseError-001.phpt
@@ -0,0 +1,21 @@
+--TEST--
+Top-level document validity: Bad $regularExpression (extra field)
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+throws(function() {
+ fromJSON('{"a" : {"$regularExpression": {"pattern": "abc", "options": "", "unrelated": true}}}');
+}, 'MongoDB\Driver\Exception\UnexpectedValueException');
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+OK: Got MongoDB\Driver\Exception\UnexpectedValueException
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/top-parseError-002.phpt b/mongodb-1.9.0/tests/bson-corpus/top-parseError-002.phpt
new file mode 100644
index 00000000..8434eb9d
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/top-parseError-002.phpt
@@ -0,0 +1,21 @@
+--TEST--
+Top-level document validity: Bad $regularExpression (missing options field)
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+throws(function() {
+ fromJSON('{"a" : {"$regularExpression": {"pattern": "abc"}}}');
+}, 'MongoDB\Driver\Exception\UnexpectedValueException');
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+OK: Got MongoDB\Driver\Exception\UnexpectedValueException
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/top-parseError-003.phpt b/mongodb-1.9.0/tests/bson-corpus/top-parseError-003.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/top-parseError-003.phpt
rename to mongodb-1.9.0/tests/bson-corpus/top-parseError-003.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/top-parseError-004.phpt b/mongodb-1.9.0/tests/bson-corpus/top-parseError-004.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/top-parseError-004.phpt
rename to mongodb-1.9.0/tests/bson-corpus/top-parseError-004.phpt
diff --git a/mongodb-1.9.0/tests/bson-corpus/top-parseError-005.phpt b/mongodb-1.9.0/tests/bson-corpus/top-parseError-005.phpt
new file mode 100644
index 00000000..b1f7350a
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/top-parseError-005.phpt
@@ -0,0 +1,21 @@
+--TEST--
+Top-level document validity: Bad $regularExpression (missing pattern field)
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+throws(function() {
+ fromJSON('{"a" : {"$regularExpression": {"options":"ix"}}}');
+}, 'MongoDB\Driver\Exception\UnexpectedValueException');
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+OK: Got MongoDB\Driver\Exception\UnexpectedValueException
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/top-parseError-006.phpt b/mongodb-1.9.0/tests/bson-corpus/top-parseError-006.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/top-parseError-006.phpt
rename to mongodb-1.9.0/tests/bson-corpus/top-parseError-006.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/top-parseError-007.phpt b/mongodb-1.9.0/tests/bson-corpus/top-parseError-007.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/top-parseError-007.phpt
rename to mongodb-1.9.0/tests/bson-corpus/top-parseError-007.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/top-parseError-008.phpt b/mongodb-1.9.0/tests/bson-corpus/top-parseError-008.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/top-parseError-008.phpt
rename to mongodb-1.9.0/tests/bson-corpus/top-parseError-008.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/top-parseError-009.phpt b/mongodb-1.9.0/tests/bson-corpus/top-parseError-009.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/top-parseError-009.phpt
rename to mongodb-1.9.0/tests/bson-corpus/top-parseError-009.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/top-parseError-010.phpt b/mongodb-1.9.0/tests/bson-corpus/top-parseError-010.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/top-parseError-010.phpt
rename to mongodb-1.9.0/tests/bson-corpus/top-parseError-010.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/top-parseError-011.phpt b/mongodb-1.9.0/tests/bson-corpus/top-parseError-011.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/top-parseError-011.phpt
rename to mongodb-1.9.0/tests/bson-corpus/top-parseError-011.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/top-parseError-012.phpt b/mongodb-1.9.0/tests/bson-corpus/top-parseError-012.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/top-parseError-012.phpt
rename to mongodb-1.9.0/tests/bson-corpus/top-parseError-012.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/top-parseError-013.phpt b/mongodb-1.9.0/tests/bson-corpus/top-parseError-013.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/top-parseError-013.phpt
rename to mongodb-1.9.0/tests/bson-corpus/top-parseError-013.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/top-parseError-014.phpt b/mongodb-1.9.0/tests/bson-corpus/top-parseError-014.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/top-parseError-014.phpt
rename to mongodb-1.9.0/tests/bson-corpus/top-parseError-014.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/top-parseError-015.phpt b/mongodb-1.9.0/tests/bson-corpus/top-parseError-015.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/top-parseError-015.phpt
rename to mongodb-1.9.0/tests/bson-corpus/top-parseError-015.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/top-parseError-016.phpt b/mongodb-1.9.0/tests/bson-corpus/top-parseError-016.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/top-parseError-016.phpt
rename to mongodb-1.9.0/tests/bson-corpus/top-parseError-016.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/top-parseError-017.phpt b/mongodb-1.9.0/tests/bson-corpus/top-parseError-017.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/top-parseError-017.phpt
rename to mongodb-1.9.0/tests/bson-corpus/top-parseError-017.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/top-parseError-018.phpt b/mongodb-1.9.0/tests/bson-corpus/top-parseError-018.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/top-parseError-018.phpt
rename to mongodb-1.9.0/tests/bson-corpus/top-parseError-018.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/top-parseError-019.phpt b/mongodb-1.9.0/tests/bson-corpus/top-parseError-019.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/top-parseError-019.phpt
rename to mongodb-1.9.0/tests/bson-corpus/top-parseError-019.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/top-parseError-020.phpt b/mongodb-1.9.0/tests/bson-corpus/top-parseError-020.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/top-parseError-020.phpt
rename to mongodb-1.9.0/tests/bson-corpus/top-parseError-020.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/top-parseError-021.phpt b/mongodb-1.9.0/tests/bson-corpus/top-parseError-021.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/top-parseError-021.phpt
rename to mongodb-1.9.0/tests/bson-corpus/top-parseError-021.phpt
diff --git a/mongodb-1.9.0/tests/bson-corpus/top-parseError-022.phpt b/mongodb-1.9.0/tests/bson-corpus/top-parseError-022.phpt
new file mode 100644
index 00000000..c10f21e5
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/top-parseError-022.phpt
@@ -0,0 +1,21 @@
+--TEST--
+Top-level document validity: Bad $code (type is number, not string) when $scope is also present
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+throws(function() {
+ fromJSON('{"a" : {"$code" : 42, "$scope" : {}}}');
+}, 'MongoDB\Driver\Exception\UnexpectedValueException');
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+OK: Got MongoDB\Driver\Exception\UnexpectedValueException
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson-corpus/top-parseError-022.phpt b/mongodb-1.9.0/tests/bson-corpus/top-parseError-023.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/top-parseError-022.phpt
rename to mongodb-1.9.0/tests/bson-corpus/top-parseError-023.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/top-parseError-023.phpt b/mongodb-1.9.0/tests/bson-corpus/top-parseError-024.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/top-parseError-023.phpt
rename to mongodb-1.9.0/tests/bson-corpus/top-parseError-024.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/top-parseError-024.phpt b/mongodb-1.9.0/tests/bson-corpus/top-parseError-025.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/top-parseError-024.phpt
rename to mongodb-1.9.0/tests/bson-corpus/top-parseError-025.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/top-parseError-025.phpt b/mongodb-1.9.0/tests/bson-corpus/top-parseError-026.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/top-parseError-025.phpt
rename to mongodb-1.9.0/tests/bson-corpus/top-parseError-026.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/top-parseError-026.phpt b/mongodb-1.9.0/tests/bson-corpus/top-parseError-027.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/top-parseError-026.phpt
rename to mongodb-1.9.0/tests/bson-corpus/top-parseError-027.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/top-parseError-027.phpt b/mongodb-1.9.0/tests/bson-corpus/top-parseError-028.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/top-parseError-027.phpt
rename to mongodb-1.9.0/tests/bson-corpus/top-parseError-028.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/top-parseError-028.phpt b/mongodb-1.9.0/tests/bson-corpus/top-parseError-029.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/top-parseError-028.phpt
rename to mongodb-1.9.0/tests/bson-corpus/top-parseError-029.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/top-parseError-029.phpt b/mongodb-1.9.0/tests/bson-corpus/top-parseError-030.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/top-parseError-029.phpt
rename to mongodb-1.9.0/tests/bson-corpus/top-parseError-030.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/top-parseError-030.phpt b/mongodb-1.9.0/tests/bson-corpus/top-parseError-031.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/top-parseError-030.phpt
rename to mongodb-1.9.0/tests/bson-corpus/top-parseError-031.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/top-parseError-031.phpt b/mongodb-1.9.0/tests/bson-corpus/top-parseError-032.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/top-parseError-031.phpt
rename to mongodb-1.9.0/tests/bson-corpus/top-parseError-032.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/top-parseError-032.phpt b/mongodb-1.9.0/tests/bson-corpus/top-parseError-033.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/top-parseError-032.phpt
rename to mongodb-1.9.0/tests/bson-corpus/top-parseError-033.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/top-parseError-033.phpt b/mongodb-1.9.0/tests/bson-corpus/top-parseError-034.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/top-parseError-033.phpt
rename to mongodb-1.9.0/tests/bson-corpus/top-parseError-034.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/top-parseError-034.phpt b/mongodb-1.9.0/tests/bson-corpus/top-parseError-035.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/top-parseError-034.phpt
rename to mongodb-1.9.0/tests/bson-corpus/top-parseError-035.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/top-parseError-035.phpt b/mongodb-1.9.0/tests/bson-corpus/top-parseError-036.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/top-parseError-035.phpt
rename to mongodb-1.9.0/tests/bson-corpus/top-parseError-036.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/top-parseError-036.phpt b/mongodb-1.9.0/tests/bson-corpus/top-parseError-037.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/top-parseError-036.phpt
rename to mongodb-1.9.0/tests/bson-corpus/top-parseError-037.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/top-parseError-037.phpt b/mongodb-1.9.0/tests/bson-corpus/top-parseError-038.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/top-parseError-037.phpt
rename to mongodb-1.9.0/tests/bson-corpus/top-parseError-038.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/top-parseError-038.phpt b/mongodb-1.9.0/tests/bson-corpus/top-parseError-039.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/top-parseError-038.phpt
rename to mongodb-1.9.0/tests/bson-corpus/top-parseError-039.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/top-parseError-039.phpt b/mongodb-1.9.0/tests/bson-corpus/top-parseError-040.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/top-parseError-039.phpt
rename to mongodb-1.9.0/tests/bson-corpus/top-parseError-040.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/top-parseError-040.phpt b/mongodb-1.9.0/tests/bson-corpus/top-parseError-041.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/top-parseError-040.phpt
rename to mongodb-1.9.0/tests/bson-corpus/top-parseError-041.phpt
diff --git a/mongodb-1.8.1/tests/bson-corpus/top-parseError-041.phpt b/mongodb-1.9.0/tests/bson-corpus/top-parseError-042.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson-corpus/top-parseError-041.phpt
rename to mongodb-1.9.0/tests/bson-corpus/top-parseError-042.phpt
diff --git a/mongodb-1.9.0/tests/bson-corpus/top-valid-001.phpt b/mongodb-1.9.0/tests/bson-corpus/top-valid-001.phpt
new file mode 100644
index 00000000..b7759b9e
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/top-valid-001.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Top-level document validity: Document with keys that start with $
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('0F00000010246B6579002A00000000');
+$canonicalExtJson = '{"$key": {"$numberInt": "42"}}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+0f00000010246b6579002a00000000
+{"$key":{"$numberInt":"42"}}
+0f00000010246b6579002a00000000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.9.0/tests/bson-corpus/undefined-valid-001.phpt b/mongodb-1.9.0/tests/bson-corpus/undefined-valid-001.phpt
new file mode 100644
index 00000000..5a65d0a4
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson-corpus/undefined-valid-001.phpt
@@ -0,0 +1,33 @@
+--TEST--
+Undefined type (deprecated): Undefined
+--DESCRIPTION--
+Generated by scripts/convert-bson-corpus-tests.php
+
+DO NOT EDIT THIS FILE
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$canonicalBson = hex2bin('0800000006610000');
+$convertedBson = hex2bin('080000000A610000');
+$canonicalExtJson = '{"a" : {"$undefined" : true}}';
+$convertedExtJson = '{"a" : null}';
+
+// Canonical BSON -> Native -> Canonical BSON
+echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n";
+
+// Canonical BSON -> Canonical extJSON
+echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n";
+
+// Canonical extJSON -> Canonical BSON
+echo bin2hex(fromJSON($canonicalExtJson)), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+0800000006610000
+{"a":{"$undefined":true}}
+0800000006610000
+===DONE===
\ No newline at end of file
diff --git a/mongodb-1.8.1/tests/bson/bson-binary-001.phpt b/mongodb-1.9.0/tests/bson/bson-binary-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-binary-001.phpt
rename to mongodb-1.9.0/tests/bson/bson-binary-001.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-binary-clone-001.phpt b/mongodb-1.9.0/tests/bson/bson-binary-clone-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-binary-clone-001.phpt
rename to mongodb-1.9.0/tests/bson/bson-binary-clone-001.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-binary-compare-001.phpt b/mongodb-1.9.0/tests/bson/bson-binary-compare-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-binary-compare-001.phpt
rename to mongodb-1.9.0/tests/bson/bson-binary-compare-001.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-binary-compare-002.phpt b/mongodb-1.9.0/tests/bson/bson-binary-compare-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-binary-compare-002.phpt
rename to mongodb-1.9.0/tests/bson/bson-binary-compare-002.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-binary-get_properties-001.phpt b/mongodb-1.9.0/tests/bson/bson-binary-get_properties-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-binary-get_properties-001.phpt
rename to mongodb-1.9.0/tests/bson/bson-binary-get_properties-001.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-binary-get_properties-002.phpt b/mongodb-1.9.0/tests/bson/bson-binary-get_properties-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-binary-get_properties-002.phpt
rename to mongodb-1.9.0/tests/bson/bson-binary-get_properties-002.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-binary-jsonserialize-001.phpt b/mongodb-1.9.0/tests/bson/bson-binary-jsonserialize-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-binary-jsonserialize-001.phpt
rename to mongodb-1.9.0/tests/bson/bson-binary-jsonserialize-001.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-binary-jsonserialize-002.phpt b/mongodb-1.9.0/tests/bson/bson-binary-jsonserialize-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-binary-jsonserialize-002.phpt
rename to mongodb-1.9.0/tests/bson/bson-binary-jsonserialize-002.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-binary-serialization-001.phpt b/mongodb-1.9.0/tests/bson/bson-binary-serialization-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-binary-serialization-001.phpt
rename to mongodb-1.9.0/tests/bson/bson-binary-serialization-001.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-binary-serialization_error-001.phpt b/mongodb-1.9.0/tests/bson/bson-binary-serialization_error-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-binary-serialization_error-001.phpt
rename to mongodb-1.9.0/tests/bson/bson-binary-serialization_error-001.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-binary-serialization_error-002.phpt b/mongodb-1.9.0/tests/bson/bson-binary-serialization_error-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-binary-serialization_error-002.phpt
rename to mongodb-1.9.0/tests/bson/bson-binary-serialization_error-002.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-binary-serialization_error-003.phpt b/mongodb-1.9.0/tests/bson/bson-binary-serialization_error-003.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-binary-serialization_error-003.phpt
rename to mongodb-1.9.0/tests/bson/bson-binary-serialization_error-003.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-binary-set_state-001.phpt b/mongodb-1.9.0/tests/bson/bson-binary-set_state-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-binary-set_state-001.phpt
rename to mongodb-1.9.0/tests/bson/bson-binary-set_state-001.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-binary-set_state_error-001.phpt b/mongodb-1.9.0/tests/bson/bson-binary-set_state_error-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-binary-set_state_error-001.phpt
rename to mongodb-1.9.0/tests/bson/bson-binary-set_state_error-001.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-binary-set_state_error-002.phpt b/mongodb-1.9.0/tests/bson/bson-binary-set_state_error-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-binary-set_state_error-002.phpt
rename to mongodb-1.9.0/tests/bson/bson-binary-set_state_error-002.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-binary-set_state_error-003.phpt b/mongodb-1.9.0/tests/bson/bson-binary-set_state_error-003.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-binary-set_state_error-003.phpt
rename to mongodb-1.9.0/tests/bson/bson-binary-set_state_error-003.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-binary-tostring-001.phpt b/mongodb-1.9.0/tests/bson/bson-binary-tostring-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-binary-tostring-001.phpt
rename to mongodb-1.9.0/tests/bson/bson-binary-tostring-001.phpt
diff --git a/mongodb-1.9.0/tests/bson/bson-binary_error-001.phpt b/mongodb-1.9.0/tests/bson/bson-binary_error-001.phpt
new file mode 100644
index 00000000..c44224f4
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson/bson-binary_error-001.phpt
@@ -0,0 +1,36 @@
+--TEST--
+MongoDB\BSON\Binary argument count errors
+--SKIPIF--
+<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
+<?php skip_if_php_version('>=', '7.99'); ?>
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$binary = new MongoDB\BSON\Binary("random binary data", MongoDB\BSON\Binary::TYPE_GENERIC);
+
+echo throws(function() use ($binary) {
+ $binary->getData(2);
+}, MongoDB\Driver\Exception\InvalidArgumentException::class), "\n";
+
+echo throws(function() use ($binary) {
+ $binary->getType(2);
+}, MongoDB\Driver\Exception\InvalidArgumentException::class), "\n";
+
+echo throws(function() {
+ new MongoDB\BSON\Binary("random binary data without type");
+}, MongoDB\Driver\Exception\InvalidArgumentException::class), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECTF--
+OK: Got MongoDB\Driver\Exception\InvalidArgumentException
+MongoDB\BSON\Binary::getData() expects exactly 0 %r(argument|parameter)%rs, 1 given
+OK: Got MongoDB\Driver\Exception\InvalidArgumentException
+MongoDB\BSON\Binary::getType() expects exactly 0 %r(argument|parameter)%rs, 1 given
+OK: Got MongoDB\Driver\Exception\InvalidArgumentException
+MongoDB\BSON\Binary::__construct() expects exactly 2 %r(argument|parameter)%rs, 1 given
+===DONE===
+
diff --git a/mongodb-1.8.1/tests/bson/bson-binary_error-002.phpt b/mongodb-1.9.0/tests/bson/bson-binary_error-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-binary_error-002.phpt
rename to mongodb-1.9.0/tests/bson/bson-binary_error-002.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-binary_error-003.phpt b/mongodb-1.9.0/tests/bson/bson-binary_error-003.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-binary_error-003.phpt
rename to mongodb-1.9.0/tests/bson/bson-binary_error-003.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-binary_error-004.phpt b/mongodb-1.9.0/tests/bson/bson-binary_error-004.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-binary_error-004.phpt
rename to mongodb-1.9.0/tests/bson/bson-binary_error-004.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-binaryinterface-001.phpt b/mongodb-1.9.0/tests/bson/bson-binaryinterface-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-binaryinterface-001.phpt
rename to mongodb-1.9.0/tests/bson/bson-binaryinterface-001.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-dbpointer-001.phpt b/mongodb-1.9.0/tests/bson/bson-dbpointer-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-dbpointer-001.phpt
rename to mongodb-1.9.0/tests/bson/bson-dbpointer-001.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-dbpointer-002.phpt b/mongodb-1.9.0/tests/bson/bson-dbpointer-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-dbpointer-002.phpt
rename to mongodb-1.9.0/tests/bson/bson-dbpointer-002.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-dbpointer-clone-001.phpt b/mongodb-1.9.0/tests/bson/bson-dbpointer-clone-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-dbpointer-clone-001.phpt
rename to mongodb-1.9.0/tests/bson/bson-dbpointer-clone-001.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-dbpointer-compare-001.phpt b/mongodb-1.9.0/tests/bson/bson-dbpointer-compare-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-dbpointer-compare-001.phpt
rename to mongodb-1.9.0/tests/bson/bson-dbpointer-compare-001.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-dbpointer-get_properties-001.phpt b/mongodb-1.9.0/tests/bson/bson-dbpointer-get_properties-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-dbpointer-get_properties-001.phpt
rename to mongodb-1.9.0/tests/bson/bson-dbpointer-get_properties-001.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-dbpointer-get_properties-002.phpt b/mongodb-1.9.0/tests/bson/bson-dbpointer-get_properties-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-dbpointer-get_properties-002.phpt
rename to mongodb-1.9.0/tests/bson/bson-dbpointer-get_properties-002.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-dbpointer-jsonserialize-001.phpt b/mongodb-1.9.0/tests/bson/bson-dbpointer-jsonserialize-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-dbpointer-jsonserialize-001.phpt
rename to mongodb-1.9.0/tests/bson/bson-dbpointer-jsonserialize-001.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-dbpointer-jsonserialize-003.phpt b/mongodb-1.9.0/tests/bson/bson-dbpointer-jsonserialize-003.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-dbpointer-jsonserialize-003.phpt
rename to mongodb-1.9.0/tests/bson/bson-dbpointer-jsonserialize-003.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-dbpointer-serialization-001.phpt b/mongodb-1.9.0/tests/bson/bson-dbpointer-serialization-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-dbpointer-serialization-001.phpt
rename to mongodb-1.9.0/tests/bson/bson-dbpointer-serialization-001.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-dbpointer-serialization_error-001.phpt b/mongodb-1.9.0/tests/bson/bson-dbpointer-serialization_error-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-dbpointer-serialization_error-001.phpt
rename to mongodb-1.9.0/tests/bson/bson-dbpointer-serialization_error-001.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-dbpointer-serialization_error-002.phpt b/mongodb-1.9.0/tests/bson/bson-dbpointer-serialization_error-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-dbpointer-serialization_error-002.phpt
rename to mongodb-1.9.0/tests/bson/bson-dbpointer-serialization_error-002.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-dbpointer-tostring-001.phpt b/mongodb-1.9.0/tests/bson/bson-dbpointer-tostring-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-dbpointer-tostring-001.phpt
rename to mongodb-1.9.0/tests/bson/bson-dbpointer-tostring-001.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-dbpointer_error-002.phpt b/mongodb-1.9.0/tests/bson/bson-dbpointer_error-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-dbpointer_error-002.phpt
rename to mongodb-1.9.0/tests/bson/bson-dbpointer_error-002.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-decimal128-001.phpt b/mongodb-1.9.0/tests/bson/bson-decimal128-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-decimal128-001.phpt
rename to mongodb-1.9.0/tests/bson/bson-decimal128-001.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-decimal128-002.phpt b/mongodb-1.9.0/tests/bson/bson-decimal128-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-decimal128-002.phpt
rename to mongodb-1.9.0/tests/bson/bson-decimal128-002.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-decimal128-003.phpt b/mongodb-1.9.0/tests/bson/bson-decimal128-003.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-decimal128-003.phpt
rename to mongodb-1.9.0/tests/bson/bson-decimal128-003.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-decimal128-004.phpt b/mongodb-1.9.0/tests/bson/bson-decimal128-004.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-decimal128-004.phpt
rename to mongodb-1.9.0/tests/bson/bson-decimal128-004.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-decimal128-clone-001.phpt b/mongodb-1.9.0/tests/bson/bson-decimal128-clone-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-decimal128-clone-001.phpt
rename to mongodb-1.9.0/tests/bson/bson-decimal128-clone-001.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-decimal128-get_properties-001.phpt b/mongodb-1.9.0/tests/bson/bson-decimal128-get_properties-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-decimal128-get_properties-001.phpt
rename to mongodb-1.9.0/tests/bson/bson-decimal128-get_properties-001.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-decimal128-get_properties-002.phpt b/mongodb-1.9.0/tests/bson/bson-decimal128-get_properties-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-decimal128-get_properties-002.phpt
rename to mongodb-1.9.0/tests/bson/bson-decimal128-get_properties-002.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-decimal128-jsonserialize-001.phpt b/mongodb-1.9.0/tests/bson/bson-decimal128-jsonserialize-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-decimal128-jsonserialize-001.phpt
rename to mongodb-1.9.0/tests/bson/bson-decimal128-jsonserialize-001.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-decimal128-jsonserialize-002.phpt b/mongodb-1.9.0/tests/bson/bson-decimal128-jsonserialize-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-decimal128-jsonserialize-002.phpt
rename to mongodb-1.9.0/tests/bson/bson-decimal128-jsonserialize-002.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-decimal128-serialization-001.phpt b/mongodb-1.9.0/tests/bson/bson-decimal128-serialization-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-decimal128-serialization-001.phpt
rename to mongodb-1.9.0/tests/bson/bson-decimal128-serialization-001.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-decimal128-serialization_error-001.phpt b/mongodb-1.9.0/tests/bson/bson-decimal128-serialization_error-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-decimal128-serialization_error-001.phpt
rename to mongodb-1.9.0/tests/bson/bson-decimal128-serialization_error-001.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-decimal128-serialization_error-002.phpt b/mongodb-1.9.0/tests/bson/bson-decimal128-serialization_error-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-decimal128-serialization_error-002.phpt
rename to mongodb-1.9.0/tests/bson/bson-decimal128-serialization_error-002.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-decimal128-set_state-001.phpt b/mongodb-1.9.0/tests/bson/bson-decimal128-set_state-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-decimal128-set_state-001.phpt
rename to mongodb-1.9.0/tests/bson/bson-decimal128-set_state-001.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-decimal128-set_state_error-001.phpt b/mongodb-1.9.0/tests/bson/bson-decimal128-set_state_error-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-decimal128-set_state_error-001.phpt
rename to mongodb-1.9.0/tests/bson/bson-decimal128-set_state_error-001.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-decimal128-set_state_error-002.phpt b/mongodb-1.9.0/tests/bson/bson-decimal128-set_state_error-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-decimal128-set_state_error-002.phpt
rename to mongodb-1.9.0/tests/bson/bson-decimal128-set_state_error-002.phpt
diff --git a/mongodb-1.9.0/tests/bson/bson-decimal128_error-001.phpt b/mongodb-1.9.0/tests/bson/bson-decimal128_error-001.phpt
new file mode 100644
index 00000000..27370de7
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson/bson-decimal128_error-001.phpt
@@ -0,0 +1,28 @@
+--TEST--
+MongoDB\BSON\Decimal128 requires valid decimal string
+--SKIPIF--
+<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
+<?php skip_if_php_version('>=', '7.99'); ?>
+<?php if (!class_exists('MongoDB\BSON\Decimal128')) { die('skip MongoDB\BSON\Decimal128 is not available'); } ?>
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+echo throws(function() {
+ new MongoDB\BSON\Decimal128([]);
+}, MongoDB\Driver\Exception\InvalidArgumentException::class), "\n";
+
+echo throws(function() {
+ new MongoDB\BSON\Decimal128('foo');
+}, MongoDB\Driver\Exception\InvalidArgumentException::class), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECTF--
+OK: Got MongoDB\Driver\Exception\InvalidArgumentException
+%SMongoDB\BSON\Decimal128::__construct()%sstring, array given
+OK: Got MongoDB\Driver\Exception\InvalidArgumentException
+Error parsing Decimal128 string: foo
+===DONE===
diff --git a/mongodb-1.8.1/tests/bson/bson-decimal128_error-002.phpt b/mongodb-1.9.0/tests/bson/bson-decimal128_error-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-decimal128_error-002.phpt
rename to mongodb-1.9.0/tests/bson/bson-decimal128_error-002.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-decimal128interface-001.phpt b/mongodb-1.9.0/tests/bson/bson-decimal128interface-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-decimal128interface-001.phpt
rename to mongodb-1.9.0/tests/bson/bson-decimal128interface-001.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-decode-001.phpt b/mongodb-1.9.0/tests/bson/bson-decode-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-decode-001.phpt
rename to mongodb-1.9.0/tests/bson/bson-decode-001.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-decode-002.phpt b/mongodb-1.9.0/tests/bson/bson-decode-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-decode-002.phpt
rename to mongodb-1.9.0/tests/bson/bson-decode-002.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-encode-001.phpt b/mongodb-1.9.0/tests/bson/bson-encode-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-encode-001.phpt
rename to mongodb-1.9.0/tests/bson/bson-encode-001.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-encode-002.phpt b/mongodb-1.9.0/tests/bson/bson-encode-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-encode-002.phpt
rename to mongodb-1.9.0/tests/bson/bson-encode-002.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-encode-003.phpt b/mongodb-1.9.0/tests/bson/bson-encode-003.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-encode-003.phpt
rename to mongodb-1.9.0/tests/bson/bson-encode-003.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-encode-004.phpt b/mongodb-1.9.0/tests/bson/bson-encode-004.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-encode-004.phpt
rename to mongodb-1.9.0/tests/bson/bson-encode-004.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-encode-005.phpt b/mongodb-1.9.0/tests/bson/bson-encode-005.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-encode-005.phpt
rename to mongodb-1.9.0/tests/bson/bson-encode-005.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-fromJSON-001.phpt b/mongodb-1.9.0/tests/bson/bson-fromJSON-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-fromJSON-001.phpt
rename to mongodb-1.9.0/tests/bson/bson-fromJSON-001.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-fromJSON-002.phpt b/mongodb-1.9.0/tests/bson/bson-fromJSON-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-fromJSON-002.phpt
rename to mongodb-1.9.0/tests/bson/bson-fromJSON-002.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-fromJSON_error-001.phpt b/mongodb-1.9.0/tests/bson/bson-fromJSON_error-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-fromJSON_error-001.phpt
rename to mongodb-1.9.0/tests/bson/bson-fromJSON_error-001.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-fromPHP-001.phpt b/mongodb-1.9.0/tests/bson/bson-fromPHP-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-fromPHP-001.phpt
rename to mongodb-1.9.0/tests/bson/bson-fromPHP-001.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-fromPHP-002.phpt b/mongodb-1.9.0/tests/bson/bson-fromPHP-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-fromPHP-002.phpt
rename to mongodb-1.9.0/tests/bson/bson-fromPHP-002.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-fromPHP-003.phpt b/mongodb-1.9.0/tests/bson/bson-fromPHP-003.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-fromPHP-003.phpt
rename to mongodb-1.9.0/tests/bson/bson-fromPHP-003.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-fromPHP-005.phpt b/mongodb-1.9.0/tests/bson/bson-fromPHP-005.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-fromPHP-005.phpt
rename to mongodb-1.9.0/tests/bson/bson-fromPHP-005.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-fromPHP-006.phpt b/mongodb-1.9.0/tests/bson/bson-fromPHP-006.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-fromPHP-006.phpt
rename to mongodb-1.9.0/tests/bson/bson-fromPHP-006.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-fromPHP_error-001.phpt b/mongodb-1.9.0/tests/bson/bson-fromPHP_error-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-fromPHP_error-001.phpt
rename to mongodb-1.9.0/tests/bson/bson-fromPHP_error-001.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-fromPHP_error-002.phpt b/mongodb-1.9.0/tests/bson/bson-fromPHP_error-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-fromPHP_error-002.phpt
rename to mongodb-1.9.0/tests/bson/bson-fromPHP_error-002.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-fromPHP_error-003.phpt b/mongodb-1.9.0/tests/bson/bson-fromPHP_error-003.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-fromPHP_error-003.phpt
rename to mongodb-1.9.0/tests/bson/bson-fromPHP_error-003.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-fromPHP_error-004.phpt b/mongodb-1.9.0/tests/bson/bson-fromPHP_error-004.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-fromPHP_error-004.phpt
rename to mongodb-1.9.0/tests/bson/bson-fromPHP_error-004.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-fromPHP_error-005.phpt b/mongodb-1.9.0/tests/bson/bson-fromPHP_error-005.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-fromPHP_error-005.phpt
rename to mongodb-1.9.0/tests/bson/bson-fromPHP_error-005.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-fromPHP_error-006.phpt b/mongodb-1.9.0/tests/bson/bson-fromPHP_error-006.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-fromPHP_error-006.phpt
rename to mongodb-1.9.0/tests/bson/bson-fromPHP_error-006.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-fromPHP_error-007.phpt b/mongodb-1.9.0/tests/bson/bson-fromPHP_error-007.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-fromPHP_error-007.phpt
rename to mongodb-1.9.0/tests/bson/bson-fromPHP_error-007.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-fromPHP_error-008.phpt b/mongodb-1.9.0/tests/bson/bson-fromPHP_error-008.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-fromPHP_error-008.phpt
rename to mongodb-1.9.0/tests/bson/bson-fromPHP_error-008.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-generate-document-id.phpt b/mongodb-1.9.0/tests/bson/bson-generate-document-id.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-generate-document-id.phpt
rename to mongodb-1.9.0/tests/bson/bson-generate-document-id.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-int64-001.phpt b/mongodb-1.9.0/tests/bson/bson-int64-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-int64-001.phpt
rename to mongodb-1.9.0/tests/bson/bson-int64-001.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-int64-002.phpt b/mongodb-1.9.0/tests/bson/bson-int64-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-int64-002.phpt
rename to mongodb-1.9.0/tests/bson/bson-int64-002.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-int64-003.phpt b/mongodb-1.9.0/tests/bson/bson-int64-003.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-int64-003.phpt
rename to mongodb-1.9.0/tests/bson/bson-int64-003.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-int64-clone-001.phpt b/mongodb-1.9.0/tests/bson/bson-int64-clone-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-int64-clone-001.phpt
rename to mongodb-1.9.0/tests/bson/bson-int64-clone-001.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-int64-compare-001.phpt b/mongodb-1.9.0/tests/bson/bson-int64-compare-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-int64-compare-001.phpt
rename to mongodb-1.9.0/tests/bson/bson-int64-compare-001.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-int64-debug-001.phpt b/mongodb-1.9.0/tests/bson/bson-int64-debug-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-int64-debug-001.phpt
rename to mongodb-1.9.0/tests/bson/bson-int64-debug-001.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-int64-get_properties-001.phpt b/mongodb-1.9.0/tests/bson/bson-int64-get_properties-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-int64-get_properties-001.phpt
rename to mongodb-1.9.0/tests/bson/bson-int64-get_properties-001.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-int64-get_properties-002.phpt b/mongodb-1.9.0/tests/bson/bson-int64-get_properties-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-int64-get_properties-002.phpt
rename to mongodb-1.9.0/tests/bson/bson-int64-get_properties-002.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-int64-jsonserialize-001.phpt b/mongodb-1.9.0/tests/bson/bson-int64-jsonserialize-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-int64-jsonserialize-001.phpt
rename to mongodb-1.9.0/tests/bson/bson-int64-jsonserialize-001.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-int64-jsonserialize-002.phpt b/mongodb-1.9.0/tests/bson/bson-int64-jsonserialize-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-int64-jsonserialize-002.phpt
rename to mongodb-1.9.0/tests/bson/bson-int64-jsonserialize-002.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-int64-serialization-001.phpt b/mongodb-1.9.0/tests/bson/bson-int64-serialization-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-int64-serialization-001.phpt
rename to mongodb-1.9.0/tests/bson/bson-int64-serialization-001.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-int64-serialization_error-001.phpt b/mongodb-1.9.0/tests/bson/bson-int64-serialization_error-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-int64-serialization_error-001.phpt
rename to mongodb-1.9.0/tests/bson/bson-int64-serialization_error-001.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-int64-serialization_error-002.phpt b/mongodb-1.9.0/tests/bson/bson-int64-serialization_error-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-int64-serialization_error-002.phpt
rename to mongodb-1.9.0/tests/bson/bson-int64-serialization_error-002.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-int64-tostring-001.phpt b/mongodb-1.9.0/tests/bson/bson-int64-tostring-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-int64-tostring-001.phpt
rename to mongodb-1.9.0/tests/bson/bson-int64-tostring-001.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-int64_error-001.phpt b/mongodb-1.9.0/tests/bson/bson-int64_error-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-int64_error-001.phpt
rename to mongodb-1.9.0/tests/bson/bson-int64_error-001.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-javascript-001.phpt b/mongodb-1.9.0/tests/bson/bson-javascript-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-javascript-001.phpt
rename to mongodb-1.9.0/tests/bson/bson-javascript-001.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-javascript-002.phpt b/mongodb-1.9.0/tests/bson/bson-javascript-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-javascript-002.phpt
rename to mongodb-1.9.0/tests/bson/bson-javascript-002.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-javascript-clone-001.phpt b/mongodb-1.9.0/tests/bson/bson-javascript-clone-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-javascript-clone-001.phpt
rename to mongodb-1.9.0/tests/bson/bson-javascript-clone-001.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-javascript-compare-001.phpt b/mongodb-1.9.0/tests/bson/bson-javascript-compare-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-javascript-compare-001.phpt
rename to mongodb-1.9.0/tests/bson/bson-javascript-compare-001.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-javascript-compare-002.phpt b/mongodb-1.9.0/tests/bson/bson-javascript-compare-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-javascript-compare-002.phpt
rename to mongodb-1.9.0/tests/bson/bson-javascript-compare-002.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-javascript-getCode-001.phpt b/mongodb-1.9.0/tests/bson/bson-javascript-getCode-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-javascript-getCode-001.phpt
rename to mongodb-1.9.0/tests/bson/bson-javascript-getCode-001.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-javascript-getScope-001.phpt b/mongodb-1.9.0/tests/bson/bson-javascript-getScope-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-javascript-getScope-001.phpt
rename to mongodb-1.9.0/tests/bson/bson-javascript-getScope-001.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-javascript-get_properties-001.phpt b/mongodb-1.9.0/tests/bson/bson-javascript-get_properties-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-javascript-get_properties-001.phpt
rename to mongodb-1.9.0/tests/bson/bson-javascript-get_properties-001.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-javascript-get_properties-002.phpt b/mongodb-1.9.0/tests/bson/bson-javascript-get_properties-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-javascript-get_properties-002.phpt
rename to mongodb-1.9.0/tests/bson/bson-javascript-get_properties-002.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-javascript-jsonserialize-001.phpt b/mongodb-1.9.0/tests/bson/bson-javascript-jsonserialize-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-javascript-jsonserialize-001.phpt
rename to mongodb-1.9.0/tests/bson/bson-javascript-jsonserialize-001.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-javascript-jsonserialize-002.phpt b/mongodb-1.9.0/tests/bson/bson-javascript-jsonserialize-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-javascript-jsonserialize-002.phpt
rename to mongodb-1.9.0/tests/bson/bson-javascript-jsonserialize-002.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-javascript-jsonserialize-003.phpt b/mongodb-1.9.0/tests/bson/bson-javascript-jsonserialize-003.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-javascript-jsonserialize-003.phpt
rename to mongodb-1.9.0/tests/bson/bson-javascript-jsonserialize-003.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-javascript-jsonserialize-004.phpt b/mongodb-1.9.0/tests/bson/bson-javascript-jsonserialize-004.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-javascript-jsonserialize-004.phpt
rename to mongodb-1.9.0/tests/bson/bson-javascript-jsonserialize-004.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-javascript-serialization-001.phpt b/mongodb-1.9.0/tests/bson/bson-javascript-serialization-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-javascript-serialization-001.phpt
rename to mongodb-1.9.0/tests/bson/bson-javascript-serialization-001.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-javascript-serialization_error-001.phpt b/mongodb-1.9.0/tests/bson/bson-javascript-serialization_error-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-javascript-serialization_error-001.phpt
rename to mongodb-1.9.0/tests/bson/bson-javascript-serialization_error-001.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-javascript-serialization_error-002.phpt b/mongodb-1.9.0/tests/bson/bson-javascript-serialization_error-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-javascript-serialization_error-002.phpt
rename to mongodb-1.9.0/tests/bson/bson-javascript-serialization_error-002.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-javascript-serialization_error-003.phpt b/mongodb-1.9.0/tests/bson/bson-javascript-serialization_error-003.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-javascript-serialization_error-003.phpt
rename to mongodb-1.9.0/tests/bson/bson-javascript-serialization_error-003.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-javascript-set_state-001.phpt b/mongodb-1.9.0/tests/bson/bson-javascript-set_state-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-javascript-set_state-001.phpt
rename to mongodb-1.9.0/tests/bson/bson-javascript-set_state-001.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-javascript-set_state_error-001.phpt b/mongodb-1.9.0/tests/bson/bson-javascript-set_state_error-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-javascript-set_state_error-001.phpt
rename to mongodb-1.9.0/tests/bson/bson-javascript-set_state_error-001.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-javascript-set_state_error-002.phpt b/mongodb-1.9.0/tests/bson/bson-javascript-set_state_error-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-javascript-set_state_error-002.phpt
rename to mongodb-1.9.0/tests/bson/bson-javascript-set_state_error-002.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-javascript-set_state_error-003.phpt b/mongodb-1.9.0/tests/bson/bson-javascript-set_state_error-003.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-javascript-set_state_error-003.phpt
rename to mongodb-1.9.0/tests/bson/bson-javascript-set_state_error-003.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-javascript-tostring-001.phpt b/mongodb-1.9.0/tests/bson/bson-javascript-tostring-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-javascript-tostring-001.phpt
rename to mongodb-1.9.0/tests/bson/bson-javascript-tostring-001.phpt
diff --git a/mongodb-1.9.0/tests/bson/bson-javascript_error-001.phpt b/mongodb-1.9.0/tests/bson/bson-javascript_error-001.phpt
new file mode 100644
index 00000000..9cf0317c
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson/bson-javascript_error-001.phpt
@@ -0,0 +1,21 @@
+--TEST--
+MongoDB\BSON\Javascript argument count errors
+--SKIPIF--
+<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
+<?php skip_if_php_version('>=', '7.99'); ?>
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+echo throws(function() {
+ new MongoDB\BSON\Javascript;
+}, MongoDB\Driver\Exception\InvalidArgumentException::class), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECTF--
+OK: Got MongoDB\Driver\Exception\InvalidArgumentException
+MongoDB\BSON\Javascript::__construct() expects at least 1 %r(argument|parameter)%r, 0 given
+===DONE===
diff --git a/mongodb-1.8.1/tests/bson/bson-javascript_error-002.phpt b/mongodb-1.9.0/tests/bson/bson-javascript_error-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-javascript_error-002.phpt
rename to mongodb-1.9.0/tests/bson/bson-javascript_error-002.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-javascript_error-003.phpt b/mongodb-1.9.0/tests/bson/bson-javascript_error-003.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-javascript_error-003.phpt
rename to mongodb-1.9.0/tests/bson/bson-javascript_error-003.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-javascriptinterface-001.phpt b/mongodb-1.9.0/tests/bson/bson-javascriptinterface-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-javascriptinterface-001.phpt
rename to mongodb-1.9.0/tests/bson/bson-javascriptinterface-001.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-maxkey-001.phpt b/mongodb-1.9.0/tests/bson/bson-maxkey-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-maxkey-001.phpt
rename to mongodb-1.9.0/tests/bson/bson-maxkey-001.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-maxkey-clone-001.phpt b/mongodb-1.9.0/tests/bson/bson-maxkey-clone-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-maxkey-clone-001.phpt
rename to mongodb-1.9.0/tests/bson/bson-maxkey-clone-001.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-maxkey-compare-001.phpt b/mongodb-1.9.0/tests/bson/bson-maxkey-compare-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-maxkey-compare-001.phpt
rename to mongodb-1.9.0/tests/bson/bson-maxkey-compare-001.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-maxkey-jsonserialize-001.phpt b/mongodb-1.9.0/tests/bson/bson-maxkey-jsonserialize-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-maxkey-jsonserialize-001.phpt
rename to mongodb-1.9.0/tests/bson/bson-maxkey-jsonserialize-001.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-maxkey-jsonserialize-002.phpt b/mongodb-1.9.0/tests/bson/bson-maxkey-jsonserialize-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-maxkey-jsonserialize-002.phpt
rename to mongodb-1.9.0/tests/bson/bson-maxkey-jsonserialize-002.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-maxkey-serialization-001.phpt b/mongodb-1.9.0/tests/bson/bson-maxkey-serialization-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-maxkey-serialization-001.phpt
rename to mongodb-1.9.0/tests/bson/bson-maxkey-serialization-001.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-maxkey-set_state-001.phpt b/mongodb-1.9.0/tests/bson/bson-maxkey-set_state-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-maxkey-set_state-001.phpt
rename to mongodb-1.9.0/tests/bson/bson-maxkey-set_state-001.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-maxkey_error-001.phpt b/mongodb-1.9.0/tests/bson/bson-maxkey_error-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-maxkey_error-001.phpt
rename to mongodb-1.9.0/tests/bson/bson-maxkey_error-001.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-maxkeyinterface-001.phpt b/mongodb-1.9.0/tests/bson/bson-maxkeyinterface-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-maxkeyinterface-001.phpt
rename to mongodb-1.9.0/tests/bson/bson-maxkeyinterface-001.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-minkey-001.phpt b/mongodb-1.9.0/tests/bson/bson-minkey-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-minkey-001.phpt
rename to mongodb-1.9.0/tests/bson/bson-minkey-001.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-minkey-clone-001.phpt b/mongodb-1.9.0/tests/bson/bson-minkey-clone-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-minkey-clone-001.phpt
rename to mongodb-1.9.0/tests/bson/bson-minkey-clone-001.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-minkey-compare-001.phpt b/mongodb-1.9.0/tests/bson/bson-minkey-compare-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-minkey-compare-001.phpt
rename to mongodb-1.9.0/tests/bson/bson-minkey-compare-001.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-minkey-jsonserialize-001.phpt b/mongodb-1.9.0/tests/bson/bson-minkey-jsonserialize-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-minkey-jsonserialize-001.phpt
rename to mongodb-1.9.0/tests/bson/bson-minkey-jsonserialize-001.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-minkey-jsonserialize-002.phpt b/mongodb-1.9.0/tests/bson/bson-minkey-jsonserialize-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-minkey-jsonserialize-002.phpt
rename to mongodb-1.9.0/tests/bson/bson-minkey-jsonserialize-002.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-minkey-serialization-001.phpt b/mongodb-1.9.0/tests/bson/bson-minkey-serialization-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-minkey-serialization-001.phpt
rename to mongodb-1.9.0/tests/bson/bson-minkey-serialization-001.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-minkey-set_state-001.phpt b/mongodb-1.9.0/tests/bson/bson-minkey-set_state-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-minkey-set_state-001.phpt
rename to mongodb-1.9.0/tests/bson/bson-minkey-set_state-001.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-minkey_error-001.phpt b/mongodb-1.9.0/tests/bson/bson-minkey_error-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-minkey_error-001.phpt
rename to mongodb-1.9.0/tests/bson/bson-minkey_error-001.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-minkeyinterface-001.phpt b/mongodb-1.9.0/tests/bson/bson-minkeyinterface-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-minkeyinterface-001.phpt
rename to mongodb-1.9.0/tests/bson/bson-minkeyinterface-001.phpt
diff --git a/mongodb-1.9.0/tests/bson/bson-objectid-001.phpt b/mongodb-1.9.0/tests/bson/bson-objectid-001.phpt
new file mode 100644
index 00000000..822b7162
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson/bson-objectid-001.phpt
@@ -0,0 +1,94 @@
+--TEST--
+MongoDB\BSON\ObjectId #001
+--SKIPIF--
+<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
+<?php skip_if_php_version('>=', '7.99'); ?>
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$sameid = new MongoDB\BSON\ObjectId("53e2a1c40640fd72175d4603");
+$samestd = new stdClass;
+$samestd->my = $sameid;
+$samearr = array("my" => $sameid);
+
+
+$std = new stdclass;
+$std->_id = new MongoDB\BSON\ObjectId;
+
+$array = array(
+ "_id" => new MongoDB\BSON\ObjectId,
+ "id" => new MongoDB\BSON\ObjectId,
+ "d" => new MongoDB\BSON\ObjectId,
+);
+
+$pregenerated = new MongoDB\BSON\ObjectId("53e28b650640fd3162152de1");
+
+$tests = array(
+ $array,
+ $std,
+ $samestd,
+ $samearr,
+ array("pregenerated" => $pregenerated),
+);
+
+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);
+}
+
+throws(function() {
+ $id = new MongoDB\BSON\ObjectId("53e28b650640fd3162152de12");
+}, MongoDB\Driver\Exception\InvalidArgumentException::class);
+
+throws(function() {
+ $id = new MongoDB\BSON\ObjectId("53e28b650640fd3162152dg1");
+}, MongoDB\Driver\Exception\InvalidArgumentException::class);
+
+throws(function() {
+ $id = new MongoDB\BSON\ObjectId("-3e28b650640fd3162152da1");
+}, MongoDB\Driver\Exception\InvalidArgumentException::class);
+
+throws(function() {
+ $id = new MongoDB\BSON\ObjectId(" 3e28b650640fd3162152da1");
+}, MongoDB\Driver\Exception\InvalidArgumentException::class);
+
+throws(function() use ($pregenerated) {
+ $pregenerated->__toString(1);
+}, MongoDB\Driver\Exception\InvalidArgumentException::class);
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECTF--
+Test#0 { "_id" : { "$oid" : "%s" }, "id" : { "$oid" : "%s" }, "d" : { "$oid" : "%s" } }
+string(146) "{ "_id" : { "$oid" : "%s" }, "id" : { "$oid" : "%s" }, "d" : { "$oid" : "%s" } }"
+string(146) "{ "_id" : { "$oid" : "%s" }, "id" : { "$oid" : "%s" }, "d" : { "$oid" : "%s" } }"
+bool(true)
+Test#1 { "_id" : { "$oid" : "%s" } }
+string(51) "{ "_id" : { "$oid" : "%s" } }"
+string(51) "{ "_id" : { "$oid" : "%s" } }"
+bool(true)
+Test#2 { "my" : { "$oid" : "53e2a1c40640fd72175d4603" } }
+string(50) "{ "my" : { "$oid" : "53e2a1c40640fd72175d4603" } }"
+string(50) "{ "my" : { "$oid" : "53e2a1c40640fd72175d4603" } }"
+bool(true)
+Test#3 { "my" : { "$oid" : "53e2a1c40640fd72175d4603" } }
+string(50) "{ "my" : { "$oid" : "53e2a1c40640fd72175d4603" } }"
+string(50) "{ "my" : { "$oid" : "53e2a1c40640fd72175d4603" } }"
+bool(true)
+Test#4 { "pregenerated" : { "$oid" : "53e28b650640fd3162152de1" } }
+string(60) "{ "pregenerated" : { "$oid" : "53e28b650640fd3162152de1" } }"
+string(60) "{ "pregenerated" : { "$oid" : "53e28b650640fd3162152de1" } }"
+bool(true)
+OK: Got MongoDB\Driver\Exception\InvalidArgumentException
+OK: Got MongoDB\Driver\Exception\InvalidArgumentException
+OK: Got MongoDB\Driver\Exception\InvalidArgumentException
+OK: Got MongoDB\Driver\Exception\InvalidArgumentException
+OK: Got MongoDB\Driver\Exception\InvalidArgumentException
+===DONE===
diff --git a/mongodb-1.8.1/tests/bson/bson-objectid-002.phpt b/mongodb-1.9.0/tests/bson/bson-objectid-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-objectid-002.phpt
rename to mongodb-1.9.0/tests/bson/bson-objectid-002.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-objectid-003.phpt b/mongodb-1.9.0/tests/bson/bson-objectid-003.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-objectid-003.phpt
rename to mongodb-1.9.0/tests/bson/bson-objectid-003.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-objectid-004.phpt b/mongodb-1.9.0/tests/bson/bson-objectid-004.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-objectid-004.phpt
rename to mongodb-1.9.0/tests/bson/bson-objectid-004.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-objectid-clone-001.phpt b/mongodb-1.9.0/tests/bson/bson-objectid-clone-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-objectid-clone-001.phpt
rename to mongodb-1.9.0/tests/bson/bson-objectid-clone-001.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-objectid-compare-001.phpt b/mongodb-1.9.0/tests/bson/bson-objectid-compare-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-objectid-compare-001.phpt
rename to mongodb-1.9.0/tests/bson/bson-objectid-compare-001.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-objectid-compare-002.phpt b/mongodb-1.9.0/tests/bson/bson-objectid-compare-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-objectid-compare-002.phpt
rename to mongodb-1.9.0/tests/bson/bson-objectid-compare-002.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-objectid-getTimestamp-001.phpt b/mongodb-1.9.0/tests/bson/bson-objectid-getTimestamp-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-objectid-getTimestamp-001.phpt
rename to mongodb-1.9.0/tests/bson/bson-objectid-getTimestamp-001.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-objectid-getTimestamp-002.phpt b/mongodb-1.9.0/tests/bson/bson-objectid-getTimestamp-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-objectid-getTimestamp-002.phpt
rename to mongodb-1.9.0/tests/bson/bson-objectid-getTimestamp-002.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-objectid-get_properties-001.phpt b/mongodb-1.9.0/tests/bson/bson-objectid-get_properties-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-objectid-get_properties-001.phpt
rename to mongodb-1.9.0/tests/bson/bson-objectid-get_properties-001.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-objectid-get_properties-002.phpt b/mongodb-1.9.0/tests/bson/bson-objectid-get_properties-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-objectid-get_properties-002.phpt
rename to mongodb-1.9.0/tests/bson/bson-objectid-get_properties-002.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-objectid-jsonserialize-001.phpt b/mongodb-1.9.0/tests/bson/bson-objectid-jsonserialize-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-objectid-jsonserialize-001.phpt
rename to mongodb-1.9.0/tests/bson/bson-objectid-jsonserialize-001.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-objectid-jsonserialize-002.phpt b/mongodb-1.9.0/tests/bson/bson-objectid-jsonserialize-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-objectid-jsonserialize-002.phpt
rename to mongodb-1.9.0/tests/bson/bson-objectid-jsonserialize-002.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-objectid-serialization-001.phpt b/mongodb-1.9.0/tests/bson/bson-objectid-serialization-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-objectid-serialization-001.phpt
rename to mongodb-1.9.0/tests/bson/bson-objectid-serialization-001.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-objectid-serialization_error-001.phpt b/mongodb-1.9.0/tests/bson/bson-objectid-serialization_error-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-objectid-serialization_error-001.phpt
rename to mongodb-1.9.0/tests/bson/bson-objectid-serialization_error-001.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-objectid-serialization_error-002.phpt b/mongodb-1.9.0/tests/bson/bson-objectid-serialization_error-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-objectid-serialization_error-002.phpt
rename to mongodb-1.9.0/tests/bson/bson-objectid-serialization_error-002.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-objectid-set_state-001.phpt b/mongodb-1.9.0/tests/bson/bson-objectid-set_state-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-objectid-set_state-001.phpt
rename to mongodb-1.9.0/tests/bson/bson-objectid-set_state-001.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-objectid-set_state_error-001.phpt b/mongodb-1.9.0/tests/bson/bson-objectid-set_state_error-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-objectid-set_state_error-001.phpt
rename to mongodb-1.9.0/tests/bson/bson-objectid-set_state_error-001.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-objectid-set_state_error-002.phpt b/mongodb-1.9.0/tests/bson/bson-objectid-set_state_error-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-objectid-set_state_error-002.phpt
rename to mongodb-1.9.0/tests/bson/bson-objectid-set_state_error-002.phpt
diff --git a/mongodb-1.9.0/tests/bson/bson-objectid-tostring_error-001.phpt b/mongodb-1.9.0/tests/bson/bson-objectid-tostring_error-001.phpt
new file mode 100644
index 00000000..66c53fbf
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson/bson-objectid-tostring_error-001.phpt
@@ -0,0 +1,23 @@
+--TEST--
+MongoDB\BSON\ObjectId raises warning on invalid arguments
+--SKIPIF--
+<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
+<?php skip_if_php_version('>=', '7.99'); ?>
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$pregenerated = new MongoDB\BSON\ObjectId("53e28b650640fd3162152de1");
+
+echo throws(function() use($pregenerated) {
+ $pregenerated->__toString(1);
+}, MongoDB\Driver\Exception\InvalidArgumentException::class), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECTF--
+OK: Got MongoDB\Driver\Exception\InvalidArgumentException
+MongoDB\BSON\ObjectId::__toString() expects exactly 0 parameters, 1 given
+===DONE===
diff --git a/mongodb-1.9.0/tests/bson/bson-objectid_error-001.phpt b/mongodb-1.9.0/tests/bson/bson-objectid_error-001.phpt
new file mode 100644
index 00000000..ee979486
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson/bson-objectid_error-001.phpt
@@ -0,0 +1,21 @@
+--TEST--
+MongoDB\BSON\ObjectId constructor type validation
+--SKIPIF--
+<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
+<?php skip_if_php_version('>=', '7.99'); ?>
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+echo throws(function() {
+ new MongoDB\BSON\ObjectId(new stdclass);
+}, MongoDB\Driver\Exception\InvalidArgumentException::class), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECTF--
+OK: Got MongoDB\Driver\Exception\InvalidArgumentException
+%SMongoDB\BSON\ObjectId::__construct()%sstring, %r(object|stdClass)%r given
+===DONE===
diff --git a/mongodb-1.8.1/tests/bson/bson-objectid_error-002.phpt b/mongodb-1.9.0/tests/bson/bson-objectid_error-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-objectid_error-002.phpt
rename to mongodb-1.9.0/tests/bson/bson-objectid_error-002.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-objectid_error-003.phpt b/mongodb-1.9.0/tests/bson/bson-objectid_error-003.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-objectid_error-003.phpt
rename to mongodb-1.9.0/tests/bson/bson-objectid_error-003.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-objectidinterface-001.phpt b/mongodb-1.9.0/tests/bson/bson-objectidinterface-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-objectidinterface-001.phpt
rename to mongodb-1.9.0/tests/bson/bson-objectidinterface-001.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-regex-001.phpt b/mongodb-1.9.0/tests/bson/bson-regex-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-regex-001.phpt
rename to mongodb-1.9.0/tests/bson/bson-regex-001.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-regex-002.phpt b/mongodb-1.9.0/tests/bson/bson-regex-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-regex-002.phpt
rename to mongodb-1.9.0/tests/bson/bson-regex-002.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-regex-003.phpt b/mongodb-1.9.0/tests/bson/bson-regex-003.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-regex-003.phpt
rename to mongodb-1.9.0/tests/bson/bson-regex-003.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-regex-004.phpt b/mongodb-1.9.0/tests/bson/bson-regex-004.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-regex-004.phpt
rename to mongodb-1.9.0/tests/bson/bson-regex-004.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-regex-005.phpt b/mongodb-1.9.0/tests/bson/bson-regex-005.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-regex-005.phpt
rename to mongodb-1.9.0/tests/bson/bson-regex-005.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-regex-clone-001.phpt b/mongodb-1.9.0/tests/bson/bson-regex-clone-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-regex-clone-001.phpt
rename to mongodb-1.9.0/tests/bson/bson-regex-clone-001.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-regex-compare-001.phpt b/mongodb-1.9.0/tests/bson/bson-regex-compare-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-regex-compare-001.phpt
rename to mongodb-1.9.0/tests/bson/bson-regex-compare-001.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-regex-compare-002.phpt b/mongodb-1.9.0/tests/bson/bson-regex-compare-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-regex-compare-002.phpt
rename to mongodb-1.9.0/tests/bson/bson-regex-compare-002.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-regex-get_properties-001.phpt b/mongodb-1.9.0/tests/bson/bson-regex-get_properties-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-regex-get_properties-001.phpt
rename to mongodb-1.9.0/tests/bson/bson-regex-get_properties-001.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-regex-get_properties-002.phpt b/mongodb-1.9.0/tests/bson/bson-regex-get_properties-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-regex-get_properties-002.phpt
rename to mongodb-1.9.0/tests/bson/bson-regex-get_properties-002.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-regex-jsonserialize-001.phpt b/mongodb-1.9.0/tests/bson/bson-regex-jsonserialize-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-regex-jsonserialize-001.phpt
rename to mongodb-1.9.0/tests/bson/bson-regex-jsonserialize-001.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-regex-jsonserialize-002.phpt b/mongodb-1.9.0/tests/bson/bson-regex-jsonserialize-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-regex-jsonserialize-002.phpt
rename to mongodb-1.9.0/tests/bson/bson-regex-jsonserialize-002.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-regex-jsonserialize-003.phpt b/mongodb-1.9.0/tests/bson/bson-regex-jsonserialize-003.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-regex-jsonserialize-003.phpt
rename to mongodb-1.9.0/tests/bson/bson-regex-jsonserialize-003.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-regex-jsonserialize-004.phpt b/mongodb-1.9.0/tests/bson/bson-regex-jsonserialize-004.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-regex-jsonserialize-004.phpt
rename to mongodb-1.9.0/tests/bson/bson-regex-jsonserialize-004.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-regex-serialization-001.phpt b/mongodb-1.9.0/tests/bson/bson-regex-serialization-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-regex-serialization-001.phpt
rename to mongodb-1.9.0/tests/bson/bson-regex-serialization-001.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-regex-serialization-002.phpt b/mongodb-1.9.0/tests/bson/bson-regex-serialization-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-regex-serialization-002.phpt
rename to mongodb-1.9.0/tests/bson/bson-regex-serialization-002.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-regex-serialization-003.phpt b/mongodb-1.9.0/tests/bson/bson-regex-serialization-003.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-regex-serialization-003.phpt
rename to mongodb-1.9.0/tests/bson/bson-regex-serialization-003.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-regex-serialization_error-001.phpt b/mongodb-1.9.0/tests/bson/bson-regex-serialization_error-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-regex-serialization_error-001.phpt
rename to mongodb-1.9.0/tests/bson/bson-regex-serialization_error-001.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-regex-serialization_error-002.phpt b/mongodb-1.9.0/tests/bson/bson-regex-serialization_error-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-regex-serialization_error-002.phpt
rename to mongodb-1.9.0/tests/bson/bson-regex-serialization_error-002.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-regex-set_state-001.phpt b/mongodb-1.9.0/tests/bson/bson-regex-set_state-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-regex-set_state-001.phpt
rename to mongodb-1.9.0/tests/bson/bson-regex-set_state-001.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-regex-set_state-002.phpt b/mongodb-1.9.0/tests/bson/bson-regex-set_state-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-regex-set_state-002.phpt
rename to mongodb-1.9.0/tests/bson/bson-regex-set_state-002.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-regex-set_state_error-001.phpt b/mongodb-1.9.0/tests/bson/bson-regex-set_state_error-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-regex-set_state_error-001.phpt
rename to mongodb-1.9.0/tests/bson/bson-regex-set_state_error-001.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-regex-set_state_error-002.phpt b/mongodb-1.9.0/tests/bson/bson-regex-set_state_error-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-regex-set_state_error-002.phpt
rename to mongodb-1.9.0/tests/bson/bson-regex-set_state_error-002.phpt
diff --git a/mongodb-1.9.0/tests/bson/bson-regex_error-001.phpt b/mongodb-1.9.0/tests/bson/bson-regex_error-001.phpt
new file mode 100644
index 00000000..95ea5709
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson/bson-regex_error-001.phpt
@@ -0,0 +1,35 @@
+--TEST--
+MongoDB\BSON\Regex argument count errors
+--SKIPIF--
+<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
+<?php skip_if_php_version('>=', '7.99'); ?>
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$regex = new MongoDB\BSON\Regex("regex", "i");
+
+echo throws(function() use ($regex) {
+ $regex->getPattern(true);
+}, MongoDB\Driver\Exception\InvalidArgumentException::class), "\n";
+
+echo throws(function() use ($regex) {
+ $regex->getFlags(true);
+}, MongoDB\Driver\Exception\InvalidArgumentException::class), "\n";
+
+echo throws(function() {
+ new MongoDB\BSON\Regex;
+}, MongoDB\Driver\Exception\InvalidArgumentException::class), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECTF--
+OK: Got MongoDB\Driver\Exception\InvalidArgumentException
+MongoDB\BSON\Regex::getPattern() expects exactly 0 %r(argument|parameter)%rs, 1 given
+OK: Got MongoDB\Driver\Exception\InvalidArgumentException
+MongoDB\BSON\Regex::getFlags() expects exactly 0 %r(argument|parameter)%rs, 1 given
+OK: Got MongoDB\Driver\Exception\InvalidArgumentException
+MongoDB\BSON\Regex::__construct() expects at least 1 %r(argument|parameter)%r, 0 given
+===DONE===
diff --git a/mongodb-1.8.1/tests/bson/bson-regex_error-002.phpt b/mongodb-1.9.0/tests/bson/bson-regex_error-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-regex_error-002.phpt
rename to mongodb-1.9.0/tests/bson/bson-regex_error-002.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-regex_error-003.phpt b/mongodb-1.9.0/tests/bson/bson-regex_error-003.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-regex_error-003.phpt
rename to mongodb-1.9.0/tests/bson/bson-regex_error-003.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-regexinterface-001.phpt b/mongodb-1.9.0/tests/bson/bson-regexinterface-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-regexinterface-001.phpt
rename to mongodb-1.9.0/tests/bson/bson-regexinterface-001.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-symbol-001.phpt b/mongodb-1.9.0/tests/bson/bson-symbol-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-symbol-001.phpt
rename to mongodb-1.9.0/tests/bson/bson-symbol-001.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-symbol-clone-001.phpt b/mongodb-1.9.0/tests/bson/bson-symbol-clone-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-symbol-clone-001.phpt
rename to mongodb-1.9.0/tests/bson/bson-symbol-clone-001.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-symbol-compare-001.phpt b/mongodb-1.9.0/tests/bson/bson-symbol-compare-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-symbol-compare-001.phpt
rename to mongodb-1.9.0/tests/bson/bson-symbol-compare-001.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-symbol-get_properties-001.phpt b/mongodb-1.9.0/tests/bson/bson-symbol-get_properties-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-symbol-get_properties-001.phpt
rename to mongodb-1.9.0/tests/bson/bson-symbol-get_properties-001.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-symbol-get_properties-002.phpt b/mongodb-1.9.0/tests/bson/bson-symbol-get_properties-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-symbol-get_properties-002.phpt
rename to mongodb-1.9.0/tests/bson/bson-symbol-get_properties-002.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-symbol-jsonserialize-001.phpt b/mongodb-1.9.0/tests/bson/bson-symbol-jsonserialize-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-symbol-jsonserialize-001.phpt
rename to mongodb-1.9.0/tests/bson/bson-symbol-jsonserialize-001.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-symbol-jsonserialize-002.phpt b/mongodb-1.9.0/tests/bson/bson-symbol-jsonserialize-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-symbol-jsonserialize-002.phpt
rename to mongodb-1.9.0/tests/bson/bson-symbol-jsonserialize-002.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-symbol-serialization-001.phpt b/mongodb-1.9.0/tests/bson/bson-symbol-serialization-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-symbol-serialization-001.phpt
rename to mongodb-1.9.0/tests/bson/bson-symbol-serialization-001.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-symbol-serialization_error-001.phpt b/mongodb-1.9.0/tests/bson/bson-symbol-serialization_error-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-symbol-serialization_error-001.phpt
rename to mongodb-1.9.0/tests/bson/bson-symbol-serialization_error-001.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-symbol-serialization_error-002.phpt b/mongodb-1.9.0/tests/bson/bson-symbol-serialization_error-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-symbol-serialization_error-002.phpt
rename to mongodb-1.9.0/tests/bson/bson-symbol-serialization_error-002.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-symbol-tostring-001.phpt b/mongodb-1.9.0/tests/bson/bson-symbol-tostring-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-symbol-tostring-001.phpt
rename to mongodb-1.9.0/tests/bson/bson-symbol-tostring-001.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-symbol_error-001.phpt b/mongodb-1.9.0/tests/bson/bson-symbol_error-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-symbol_error-001.phpt
rename to mongodb-1.9.0/tests/bson/bson-symbol_error-001.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-timestamp-001.phpt b/mongodb-1.9.0/tests/bson/bson-timestamp-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-timestamp-001.phpt
rename to mongodb-1.9.0/tests/bson/bson-timestamp-001.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-timestamp-002.phpt b/mongodb-1.9.0/tests/bson/bson-timestamp-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-timestamp-002.phpt
rename to mongodb-1.9.0/tests/bson/bson-timestamp-002.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-timestamp-003.phpt b/mongodb-1.9.0/tests/bson/bson-timestamp-003.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-timestamp-003.phpt
rename to mongodb-1.9.0/tests/bson/bson-timestamp-003.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-timestamp-004.phpt b/mongodb-1.9.0/tests/bson/bson-timestamp-004.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-timestamp-004.phpt
rename to mongodb-1.9.0/tests/bson/bson-timestamp-004.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-timestamp-005.phpt b/mongodb-1.9.0/tests/bson/bson-timestamp-005.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-timestamp-005.phpt
rename to mongodb-1.9.0/tests/bson/bson-timestamp-005.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-timestamp-clone-001.phpt b/mongodb-1.9.0/tests/bson/bson-timestamp-clone-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-timestamp-clone-001.phpt
rename to mongodb-1.9.0/tests/bson/bson-timestamp-clone-001.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-timestamp-compare-001.phpt b/mongodb-1.9.0/tests/bson/bson-timestamp-compare-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-timestamp-compare-001.phpt
rename to mongodb-1.9.0/tests/bson/bson-timestamp-compare-001.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-timestamp-getIncrement-001.phpt b/mongodb-1.9.0/tests/bson/bson-timestamp-getIncrement-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-timestamp-getIncrement-001.phpt
rename to mongodb-1.9.0/tests/bson/bson-timestamp-getIncrement-001.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-timestamp-getTimestamp-001.phpt b/mongodb-1.9.0/tests/bson/bson-timestamp-getTimestamp-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-timestamp-getTimestamp-001.phpt
rename to mongodb-1.9.0/tests/bson/bson-timestamp-getTimestamp-001.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-timestamp-get_properties-001.phpt b/mongodb-1.9.0/tests/bson/bson-timestamp-get_properties-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-timestamp-get_properties-001.phpt
rename to mongodb-1.9.0/tests/bson/bson-timestamp-get_properties-001.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-timestamp-get_properties-002.phpt b/mongodb-1.9.0/tests/bson/bson-timestamp-get_properties-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-timestamp-get_properties-002.phpt
rename to mongodb-1.9.0/tests/bson/bson-timestamp-get_properties-002.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-timestamp-jsonserialize-001.phpt b/mongodb-1.9.0/tests/bson/bson-timestamp-jsonserialize-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-timestamp-jsonserialize-001.phpt
rename to mongodb-1.9.0/tests/bson/bson-timestamp-jsonserialize-001.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-timestamp-jsonserialize-002.phpt b/mongodb-1.9.0/tests/bson/bson-timestamp-jsonserialize-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-timestamp-jsonserialize-002.phpt
rename to mongodb-1.9.0/tests/bson/bson-timestamp-jsonserialize-002.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-timestamp-serialization-001.phpt b/mongodb-1.9.0/tests/bson/bson-timestamp-serialization-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-timestamp-serialization-001.phpt
rename to mongodb-1.9.0/tests/bson/bson-timestamp-serialization-001.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-timestamp-serialization-002.phpt b/mongodb-1.9.0/tests/bson/bson-timestamp-serialization-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-timestamp-serialization-002.phpt
rename to mongodb-1.9.0/tests/bson/bson-timestamp-serialization-002.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-timestamp-serialization_error-001.phpt b/mongodb-1.9.0/tests/bson/bson-timestamp-serialization_error-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-timestamp-serialization_error-001.phpt
rename to mongodb-1.9.0/tests/bson/bson-timestamp-serialization_error-001.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-timestamp-serialization_error-002.phpt b/mongodb-1.9.0/tests/bson/bson-timestamp-serialization_error-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-timestamp-serialization_error-002.phpt
rename to mongodb-1.9.0/tests/bson/bson-timestamp-serialization_error-002.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-timestamp-serialization_error-003.phpt b/mongodb-1.9.0/tests/bson/bson-timestamp-serialization_error-003.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-timestamp-serialization_error-003.phpt
rename to mongodb-1.9.0/tests/bson/bson-timestamp-serialization_error-003.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-timestamp-serialization_error-004.phpt b/mongodb-1.9.0/tests/bson/bson-timestamp-serialization_error-004.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-timestamp-serialization_error-004.phpt
rename to mongodb-1.9.0/tests/bson/bson-timestamp-serialization_error-004.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-timestamp-set_state-001.phpt b/mongodb-1.9.0/tests/bson/bson-timestamp-set_state-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-timestamp-set_state-001.phpt
rename to mongodb-1.9.0/tests/bson/bson-timestamp-set_state-001.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-timestamp-set_state-002.phpt b/mongodb-1.9.0/tests/bson/bson-timestamp-set_state-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-timestamp-set_state-002.phpt
rename to mongodb-1.9.0/tests/bson/bson-timestamp-set_state-002.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-timestamp-set_state_error-001.phpt b/mongodb-1.9.0/tests/bson/bson-timestamp-set_state_error-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-timestamp-set_state_error-001.phpt
rename to mongodb-1.9.0/tests/bson/bson-timestamp-set_state_error-001.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-timestamp-set_state_error-002.phpt b/mongodb-1.9.0/tests/bson/bson-timestamp-set_state_error-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-timestamp-set_state_error-002.phpt
rename to mongodb-1.9.0/tests/bson/bson-timestamp-set_state_error-002.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-timestamp-set_state_error-003.phpt b/mongodb-1.9.0/tests/bson/bson-timestamp-set_state_error-003.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-timestamp-set_state_error-003.phpt
rename to mongodb-1.9.0/tests/bson/bson-timestamp-set_state_error-003.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-timestamp-set_state_error-004.phpt b/mongodb-1.9.0/tests/bson/bson-timestamp-set_state_error-004.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-timestamp-set_state_error-004.phpt
rename to mongodb-1.9.0/tests/bson/bson-timestamp-set_state_error-004.phpt
diff --git a/mongodb-1.9.0/tests/bson/bson-timestamp_error-001.phpt b/mongodb-1.9.0/tests/bson/bson-timestamp_error-001.phpt
new file mode 100644
index 00000000..c6a8eb09
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson/bson-timestamp_error-001.phpt
@@ -0,0 +1,22 @@
+--TEST--
+MongoDB\BSON\Timestamp argument count errors
+--SKIPIF--
+<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
+<?php skip_if_php_version('>=', '7.99'); ?>
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+echo throws(function() {
+ new MongoDB\BSON\Timestamp;
+}, MongoDB\Driver\Exception\InvalidArgumentException::class), "\n"
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECTF--
+OK: Got MongoDB\Driver\Exception\InvalidArgumentException
+MongoDB\BSON\Timestamp::__construct() expects exactly 2 %r(argument|parameter)%rs, 0 given
+===DONE===
+
diff --git a/mongodb-1.8.1/tests/bson/bson-timestamp_error-002.phpt b/mongodb-1.9.0/tests/bson/bson-timestamp_error-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-timestamp_error-002.phpt
rename to mongodb-1.9.0/tests/bson/bson-timestamp_error-002.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-timestamp_error-003.phpt b/mongodb-1.9.0/tests/bson/bson-timestamp_error-003.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-timestamp_error-003.phpt
rename to mongodb-1.9.0/tests/bson/bson-timestamp_error-003.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-timestamp_error-004.phpt b/mongodb-1.9.0/tests/bson/bson-timestamp_error-004.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-timestamp_error-004.phpt
rename to mongodb-1.9.0/tests/bson/bson-timestamp_error-004.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-timestamp_error-005.phpt b/mongodb-1.9.0/tests/bson/bson-timestamp_error-005.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-timestamp_error-005.phpt
rename to mongodb-1.9.0/tests/bson/bson-timestamp_error-005.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-timestamp_error-006.phpt b/mongodb-1.9.0/tests/bson/bson-timestamp_error-006.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-timestamp_error-006.phpt
rename to mongodb-1.9.0/tests/bson/bson-timestamp_error-006.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-timestampinterface-001.phpt b/mongodb-1.9.0/tests/bson/bson-timestampinterface-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-timestampinterface-001.phpt
rename to mongodb-1.9.0/tests/bson/bson-timestampinterface-001.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-toCanonicalJSON-001.phpt b/mongodb-1.9.0/tests/bson/bson-toCanonicalJSON-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-toCanonicalJSON-001.phpt
rename to mongodb-1.9.0/tests/bson/bson-toCanonicalJSON-001.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-toCanonicalJSON-002.phpt b/mongodb-1.9.0/tests/bson/bson-toCanonicalJSON-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-toCanonicalJSON-002.phpt
rename to mongodb-1.9.0/tests/bson/bson-toCanonicalJSON-002.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-toCanonicalJSON_error-001.phpt b/mongodb-1.9.0/tests/bson/bson-toCanonicalJSON_error-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-toCanonicalJSON_error-001.phpt
rename to mongodb-1.9.0/tests/bson/bson-toCanonicalJSON_error-001.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-toCanonicalJSON_error-002.phpt b/mongodb-1.9.0/tests/bson/bson-toCanonicalJSON_error-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-toCanonicalJSON_error-002.phpt
rename to mongodb-1.9.0/tests/bson/bson-toCanonicalJSON_error-002.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-toCanonicalJSON_error-003.phpt b/mongodb-1.9.0/tests/bson/bson-toCanonicalJSON_error-003.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-toCanonicalJSON_error-003.phpt
rename to mongodb-1.9.0/tests/bson/bson-toCanonicalJSON_error-003.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-toJSON-001.phpt b/mongodb-1.9.0/tests/bson/bson-toJSON-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-toJSON-001.phpt
rename to mongodb-1.9.0/tests/bson/bson-toJSON-001.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-toJSON-002.phpt b/mongodb-1.9.0/tests/bson/bson-toJSON-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-toJSON-002.phpt
rename to mongodb-1.9.0/tests/bson/bson-toJSON-002.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-toJSON_error-001.phpt b/mongodb-1.9.0/tests/bson/bson-toJSON_error-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-toJSON_error-001.phpt
rename to mongodb-1.9.0/tests/bson/bson-toJSON_error-001.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-toJSON_error-002.phpt b/mongodb-1.9.0/tests/bson/bson-toJSON_error-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-toJSON_error-002.phpt
rename to mongodb-1.9.0/tests/bson/bson-toJSON_error-002.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-toJSON_error-003.phpt b/mongodb-1.9.0/tests/bson/bson-toJSON_error-003.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-toJSON_error-003.phpt
rename to mongodb-1.9.0/tests/bson/bson-toJSON_error-003.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-toPHP-001.phpt b/mongodb-1.9.0/tests/bson/bson-toPHP-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-toPHP-001.phpt
rename to mongodb-1.9.0/tests/bson/bson-toPHP-001.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-toPHP-002.phpt b/mongodb-1.9.0/tests/bson/bson-toPHP-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-toPHP-002.phpt
rename to mongodb-1.9.0/tests/bson/bson-toPHP-002.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-toPHP-003.phpt b/mongodb-1.9.0/tests/bson/bson-toPHP-003.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-toPHP-003.phpt
rename to mongodb-1.9.0/tests/bson/bson-toPHP-003.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-toPHP-004.phpt b/mongodb-1.9.0/tests/bson/bson-toPHP-004.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-toPHP-004.phpt
rename to mongodb-1.9.0/tests/bson/bson-toPHP-004.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-toPHP-006.phpt b/mongodb-1.9.0/tests/bson/bson-toPHP-006.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-toPHP-006.phpt
rename to mongodb-1.9.0/tests/bson/bson-toPHP-006.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-toPHP-007.phpt b/mongodb-1.9.0/tests/bson/bson-toPHP-007.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-toPHP-007.phpt
rename to mongodb-1.9.0/tests/bson/bson-toPHP-007.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-toPHP-008.phpt b/mongodb-1.9.0/tests/bson/bson-toPHP-008.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-toPHP-008.phpt
rename to mongodb-1.9.0/tests/bson/bson-toPHP-008.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-toPHP-009.phpt b/mongodb-1.9.0/tests/bson/bson-toPHP-009.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-toPHP-009.phpt
rename to mongodb-1.9.0/tests/bson/bson-toPHP-009.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-toPHP-010.phpt b/mongodb-1.9.0/tests/bson/bson-toPHP-010.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-toPHP-010.phpt
rename to mongodb-1.9.0/tests/bson/bson-toPHP-010.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-toPHP-011.phpt b/mongodb-1.9.0/tests/bson/bson-toPHP-011.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-toPHP-011.phpt
rename to mongodb-1.9.0/tests/bson/bson-toPHP-011.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-toPHP_error-001.phpt b/mongodb-1.9.0/tests/bson/bson-toPHP_error-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-toPHP_error-001.phpt
rename to mongodb-1.9.0/tests/bson/bson-toPHP_error-001.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-toPHP_error-002.phpt b/mongodb-1.9.0/tests/bson/bson-toPHP_error-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-toPHP_error-002.phpt
rename to mongodb-1.9.0/tests/bson/bson-toPHP_error-002.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-toPHP_error-003.phpt b/mongodb-1.9.0/tests/bson/bson-toPHP_error-003.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-toPHP_error-003.phpt
rename to mongodb-1.9.0/tests/bson/bson-toPHP_error-003.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-toPHP_error-004.phpt b/mongodb-1.9.0/tests/bson/bson-toPHP_error-004.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-toPHP_error-004.phpt
rename to mongodb-1.9.0/tests/bson/bson-toPHP_error-004.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-toPHP_error-005.phpt b/mongodb-1.9.0/tests/bson/bson-toPHP_error-005.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-toPHP_error-005.phpt
rename to mongodb-1.9.0/tests/bson/bson-toPHP_error-005.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-toPHP_error-006.phpt b/mongodb-1.9.0/tests/bson/bson-toPHP_error-006.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-toPHP_error-006.phpt
rename to mongodb-1.9.0/tests/bson/bson-toPHP_error-006.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-toRelaxedJSON-001.phpt b/mongodb-1.9.0/tests/bson/bson-toRelaxedJSON-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-toRelaxedJSON-001.phpt
rename to mongodb-1.9.0/tests/bson/bson-toRelaxedJSON-001.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-toRelaxedJSON-002.phpt b/mongodb-1.9.0/tests/bson/bson-toRelaxedJSON-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-toRelaxedJSON-002.phpt
rename to mongodb-1.9.0/tests/bson/bson-toRelaxedJSON-002.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-toRelaxedJSON_error-001.phpt b/mongodb-1.9.0/tests/bson/bson-toRelaxedJSON_error-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-toRelaxedJSON_error-001.phpt
rename to mongodb-1.9.0/tests/bson/bson-toRelaxedJSON_error-001.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-toRelaxedJSON_error-002.phpt b/mongodb-1.9.0/tests/bson/bson-toRelaxedJSON_error-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-toRelaxedJSON_error-002.phpt
rename to mongodb-1.9.0/tests/bson/bson-toRelaxedJSON_error-002.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-toRelaxedJSON_error-003.phpt b/mongodb-1.9.0/tests/bson/bson-toRelaxedJSON_error-003.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-toRelaxedJSON_error-003.phpt
rename to mongodb-1.9.0/tests/bson/bson-toRelaxedJSON_error-003.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-undefined-001.phpt b/mongodb-1.9.0/tests/bson/bson-undefined-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-undefined-001.phpt
rename to mongodb-1.9.0/tests/bson/bson-undefined-001.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-undefined-clone-001.phpt b/mongodb-1.9.0/tests/bson/bson-undefined-clone-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-undefined-clone-001.phpt
rename to mongodb-1.9.0/tests/bson/bson-undefined-clone-001.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-undefined-compare-001.phpt b/mongodb-1.9.0/tests/bson/bson-undefined-compare-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-undefined-compare-001.phpt
rename to mongodb-1.9.0/tests/bson/bson-undefined-compare-001.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-undefined-jsonserialize-001.phpt b/mongodb-1.9.0/tests/bson/bson-undefined-jsonserialize-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-undefined-jsonserialize-001.phpt
rename to mongodb-1.9.0/tests/bson/bson-undefined-jsonserialize-001.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-undefined-jsonserialize-002.phpt b/mongodb-1.9.0/tests/bson/bson-undefined-jsonserialize-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-undefined-jsonserialize-002.phpt
rename to mongodb-1.9.0/tests/bson/bson-undefined-jsonserialize-002.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-undefined-serialization-001.phpt b/mongodb-1.9.0/tests/bson/bson-undefined-serialization-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-undefined-serialization-001.phpt
rename to mongodb-1.9.0/tests/bson/bson-undefined-serialization-001.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-undefined-tostring-001.phpt b/mongodb-1.9.0/tests/bson/bson-undefined-tostring-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-undefined-tostring-001.phpt
rename to mongodb-1.9.0/tests/bson/bson-undefined-tostring-001.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-undefined_error-001.phpt b/mongodb-1.9.0/tests/bson/bson-undefined_error-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-undefined_error-001.phpt
rename to mongodb-1.9.0/tests/bson/bson-undefined_error-001.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-unknown-001.phpt b/mongodb-1.9.0/tests/bson/bson-unknown-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-unknown-001.phpt
rename to mongodb-1.9.0/tests/bson/bson-unknown-001.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-utcdatetime-001.phpt b/mongodb-1.9.0/tests/bson/bson-utcdatetime-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-utcdatetime-001.phpt
rename to mongodb-1.9.0/tests/bson/bson-utcdatetime-001.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-utcdatetime-002.phpt b/mongodb-1.9.0/tests/bson/bson-utcdatetime-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-utcdatetime-002.phpt
rename to mongodb-1.9.0/tests/bson/bson-utcdatetime-002.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-utcdatetime-003.phpt b/mongodb-1.9.0/tests/bson/bson-utcdatetime-003.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-utcdatetime-003.phpt
rename to mongodb-1.9.0/tests/bson/bson-utcdatetime-003.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-utcdatetime-004.phpt b/mongodb-1.9.0/tests/bson/bson-utcdatetime-004.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-utcdatetime-004.phpt
rename to mongodb-1.9.0/tests/bson/bson-utcdatetime-004.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-utcdatetime-005.phpt b/mongodb-1.9.0/tests/bson/bson-utcdatetime-005.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-utcdatetime-005.phpt
rename to mongodb-1.9.0/tests/bson/bson-utcdatetime-005.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-utcdatetime-006.phpt b/mongodb-1.9.0/tests/bson/bson-utcdatetime-006.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-utcdatetime-006.phpt
rename to mongodb-1.9.0/tests/bson/bson-utcdatetime-006.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-utcdatetime-007.phpt b/mongodb-1.9.0/tests/bson/bson-utcdatetime-007.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-utcdatetime-007.phpt
rename to mongodb-1.9.0/tests/bson/bson-utcdatetime-007.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-utcdatetime-clone-001.phpt b/mongodb-1.9.0/tests/bson/bson-utcdatetime-clone-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-utcdatetime-clone-001.phpt
rename to mongodb-1.9.0/tests/bson/bson-utcdatetime-clone-001.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-utcdatetime-compare-001.phpt b/mongodb-1.9.0/tests/bson/bson-utcdatetime-compare-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-utcdatetime-compare-001.phpt
rename to mongodb-1.9.0/tests/bson/bson-utcdatetime-compare-001.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-utcdatetime-get_properties-001.phpt b/mongodb-1.9.0/tests/bson/bson-utcdatetime-get_properties-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-utcdatetime-get_properties-001.phpt
rename to mongodb-1.9.0/tests/bson/bson-utcdatetime-get_properties-001.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-utcdatetime-get_properties-002.phpt b/mongodb-1.9.0/tests/bson/bson-utcdatetime-get_properties-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-utcdatetime-get_properties-002.phpt
rename to mongodb-1.9.0/tests/bson/bson-utcdatetime-get_properties-002.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-utcdatetime-int-size-001.phpt b/mongodb-1.9.0/tests/bson/bson-utcdatetime-int-size-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-utcdatetime-int-size-001.phpt
rename to mongodb-1.9.0/tests/bson/bson-utcdatetime-int-size-001.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-utcdatetime-int-size-002.phpt b/mongodb-1.9.0/tests/bson/bson-utcdatetime-int-size-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-utcdatetime-int-size-002.phpt
rename to mongodb-1.9.0/tests/bson/bson-utcdatetime-int-size-002.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-utcdatetime-jsonserialize-001.phpt b/mongodb-1.9.0/tests/bson/bson-utcdatetime-jsonserialize-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-utcdatetime-jsonserialize-001.phpt
rename to mongodb-1.9.0/tests/bson/bson-utcdatetime-jsonserialize-001.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-utcdatetime-jsonserialize-002.phpt b/mongodb-1.9.0/tests/bson/bson-utcdatetime-jsonserialize-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-utcdatetime-jsonserialize-002.phpt
rename to mongodb-1.9.0/tests/bson/bson-utcdatetime-jsonserialize-002.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-utcdatetime-serialization-001.phpt b/mongodb-1.9.0/tests/bson/bson-utcdatetime-serialization-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-utcdatetime-serialization-001.phpt
rename to mongodb-1.9.0/tests/bson/bson-utcdatetime-serialization-001.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-utcdatetime-serialization-002.phpt b/mongodb-1.9.0/tests/bson/bson-utcdatetime-serialization-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-utcdatetime-serialization-002.phpt
rename to mongodb-1.9.0/tests/bson/bson-utcdatetime-serialization-002.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-utcdatetime-serialization_error-001.phpt b/mongodb-1.9.0/tests/bson/bson-utcdatetime-serialization_error-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-utcdatetime-serialization_error-001.phpt
rename to mongodb-1.9.0/tests/bson/bson-utcdatetime-serialization_error-001.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-utcdatetime-serialization_error-002.phpt b/mongodb-1.9.0/tests/bson/bson-utcdatetime-serialization_error-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-utcdatetime-serialization_error-002.phpt
rename to mongodb-1.9.0/tests/bson/bson-utcdatetime-serialization_error-002.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-utcdatetime-set_state-001.phpt b/mongodb-1.9.0/tests/bson/bson-utcdatetime-set_state-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-utcdatetime-set_state-001.phpt
rename to mongodb-1.9.0/tests/bson/bson-utcdatetime-set_state-001.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-utcdatetime-set_state-002.phpt b/mongodb-1.9.0/tests/bson/bson-utcdatetime-set_state-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-utcdatetime-set_state-002.phpt
rename to mongodb-1.9.0/tests/bson/bson-utcdatetime-set_state-002.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-utcdatetime-set_state_error-001.phpt b/mongodb-1.9.0/tests/bson/bson-utcdatetime-set_state_error-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-utcdatetime-set_state_error-001.phpt
rename to mongodb-1.9.0/tests/bson/bson-utcdatetime-set_state_error-001.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-utcdatetime-set_state_error-002.phpt b/mongodb-1.9.0/tests/bson/bson-utcdatetime-set_state_error-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-utcdatetime-set_state_error-002.phpt
rename to mongodb-1.9.0/tests/bson/bson-utcdatetime-set_state_error-002.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-utcdatetime-todatetime-001.phpt b/mongodb-1.9.0/tests/bson/bson-utcdatetime-todatetime-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-utcdatetime-todatetime-001.phpt
rename to mongodb-1.9.0/tests/bson/bson-utcdatetime-todatetime-001.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-utcdatetime-todatetime-002.phpt b/mongodb-1.9.0/tests/bson/bson-utcdatetime-todatetime-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-utcdatetime-todatetime-002.phpt
rename to mongodb-1.9.0/tests/bson/bson-utcdatetime-todatetime-002.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-utcdatetime-tostring-001.phpt b/mongodb-1.9.0/tests/bson/bson-utcdatetime-tostring-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-utcdatetime-tostring-001.phpt
rename to mongodb-1.9.0/tests/bson/bson-utcdatetime-tostring-001.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-utcdatetime_error-001.phpt b/mongodb-1.9.0/tests/bson/bson-utcdatetime_error-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-utcdatetime_error-001.phpt
rename to mongodb-1.9.0/tests/bson/bson-utcdatetime_error-001.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-utcdatetime_error-002.phpt b/mongodb-1.9.0/tests/bson/bson-utcdatetime_error-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-utcdatetime_error-002.phpt
rename to mongodb-1.9.0/tests/bson/bson-utcdatetime_error-002.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-utcdatetime_error-003.phpt b/mongodb-1.9.0/tests/bson/bson-utcdatetime_error-003.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-utcdatetime_error-003.phpt
rename to mongodb-1.9.0/tests/bson/bson-utcdatetime_error-003.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-utcdatetime_error-004.phpt b/mongodb-1.9.0/tests/bson/bson-utcdatetime_error-004.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-utcdatetime_error-004.phpt
rename to mongodb-1.9.0/tests/bson/bson-utcdatetime_error-004.phpt
diff --git a/mongodb-1.8.1/tests/bson/bson-utcdatetimeinterface-001.phpt b/mongodb-1.9.0/tests/bson/bson-utcdatetimeinterface-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bson-utcdatetimeinterface-001.phpt
rename to mongodb-1.9.0/tests/bson/bson-utcdatetimeinterface-001.phpt
diff --git a/mongodb-1.8.1/tests/bson/bug0274.phpt b/mongodb-1.9.0/tests/bson/bug0274.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bug0274.phpt
rename to mongodb-1.9.0/tests/bson/bug0274.phpt
diff --git a/mongodb-1.8.1/tests/bson/bug0325.phpt b/mongodb-1.9.0/tests/bson/bug0325.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bug0325.phpt
rename to mongodb-1.9.0/tests/bson/bug0325.phpt
diff --git a/mongodb-1.8.1/tests/bson/bug0334-001.phpt b/mongodb-1.9.0/tests/bson/bug0334-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bug0334-001.phpt
rename to mongodb-1.9.0/tests/bson/bug0334-001.phpt
diff --git a/mongodb-1.8.1/tests/bson/bug0334-002.phpt b/mongodb-1.9.0/tests/bson/bug0334-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bug0334-002.phpt
rename to mongodb-1.9.0/tests/bson/bug0334-002.phpt
diff --git a/mongodb-1.8.1/tests/bson/bug0341.phpt b/mongodb-1.9.0/tests/bson/bug0341.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bug0341.phpt
rename to mongodb-1.9.0/tests/bson/bug0341.phpt
diff --git a/mongodb-1.8.1/tests/bson/bug0347.phpt b/mongodb-1.9.0/tests/bson/bug0347.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bug0347.phpt
rename to mongodb-1.9.0/tests/bson/bug0347.phpt
diff --git a/mongodb-1.8.1/tests/bson/bug0528.phpt b/mongodb-1.9.0/tests/bson/bug0528.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bug0528.phpt
rename to mongodb-1.9.0/tests/bson/bug0528.phpt
diff --git a/mongodb-1.8.1/tests/bson/bug0531-001.phpt b/mongodb-1.9.0/tests/bson/bug0531-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bug0531-001.phpt
rename to mongodb-1.9.0/tests/bson/bug0531-001.phpt
diff --git a/mongodb-1.8.1/tests/bson/bug0544.phpt b/mongodb-1.9.0/tests/bson/bug0544.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bug0544.phpt
rename to mongodb-1.9.0/tests/bson/bug0544.phpt
diff --git a/mongodb-1.8.1/tests/bson/bug0592.phpt b/mongodb-1.9.0/tests/bson/bug0592.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bug0592.phpt
rename to mongodb-1.9.0/tests/bson/bug0592.phpt
diff --git a/mongodb-1.8.1/tests/bson/bug0623.phpt b/mongodb-1.9.0/tests/bson/bug0623.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bug0623.phpt
rename to mongodb-1.9.0/tests/bson/bug0623.phpt
diff --git a/mongodb-1.8.1/tests/bson/bug0631.phpt b/mongodb-1.9.0/tests/bson/bug0631.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bug0631.phpt
rename to mongodb-1.9.0/tests/bson/bug0631.phpt
diff --git a/mongodb-1.8.1/tests/bson/bug0672.phpt b/mongodb-1.9.0/tests/bson/bug0672.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bug0672.phpt
rename to mongodb-1.9.0/tests/bson/bug0672.phpt
diff --git a/mongodb-1.8.1/tests/bson/bug0894-001.phpt b/mongodb-1.9.0/tests/bson/bug0894-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bug0894-001.phpt
rename to mongodb-1.9.0/tests/bson/bug0894-001.phpt
diff --git a/mongodb-1.8.1/tests/bson/bug0923-001.phpt b/mongodb-1.9.0/tests/bson/bug0923-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bug0923-001.phpt
rename to mongodb-1.9.0/tests/bson/bug0923-001.phpt
diff --git a/mongodb-1.8.1/tests/bson/bug0923-002.phpt b/mongodb-1.9.0/tests/bson/bug0923-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bug0923-002.phpt
rename to mongodb-1.9.0/tests/bson/bug0923-002.phpt
diff --git a/mongodb-1.9.0/tests/bson/bug0939-001.phpt b/mongodb-1.9.0/tests/bson/bug0939-001.phpt
new file mode 100644
index 00000000..37f2e579
--- /dev/null
+++ b/mongodb-1.9.0/tests/bson/bug0939-001.phpt
@@ -0,0 +1,98 @@
+--TEST--
+PHPC-939: BSON classes should not assign public properties after var_dump()
+--FILE--
+<?php
+
+$tests = [
+ [ new MongoDB\BSON\Binary('foo', MongoDB\BSON\Binary::TYPE_GENERIC), ['data', 'type'] ],
+ [ new MongoDB\BSON\Decimal128('3.14'), ['dec'] ],
+ [ new MongoDB\BSON\Javascript('function foo() { return bar; }', ['bar' => 42]), ['code', 'scope'] ],
+ [ new MongoDB\BSON\MaxKey, [] ],
+ [ new MongoDB\BSON\MinKey, [] ],
+ [ new MongoDB\BSON\ObjectId, ['oid'] ],
+ [ new MongoDB\BSON\Regex('foo', 'i'), ['pattern', 'flags'] ],
+ [ new MongoDB\BSON\Timestamp(1234, 5678), ['increment', 'timestamp'] ],
+ [ new MongoDB\BSON\UTCDateTime, ['milliseconds'] ],
+];
+
+foreach ($tests as $test) {
+ list($object, $properties) = $test;
+
+ var_dump($object);
+
+ foreach ($properties as $property) {
+ printf("%s::$%s exists: %s\n", get_class($object), $property, property_exists($object, $property) ? 'yes' : 'no');
+ }
+
+ echo "\n";
+}
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECTF--
+
+object(MongoDB\BSON\Binary)#%d (%d) {
+ ["data"]=>
+ string(3) "foo"
+ ["type"]=>
+ int(0)
+}
+MongoDB\BSON\Binary::$data exists: no
+MongoDB\BSON\Binary::$type exists: no
+
+object(MongoDB\BSON\Decimal128)#%d (%d) {
+ ["dec"]=>
+ string(4) "3.14"
+}
+MongoDB\BSON\Decimal128::$dec exists: no
+
+object(MongoDB\BSON\Javascript)#%d (%d) {
+ ["code"]=>
+ string(30) "function foo() { return bar; }"
+ ["scope"]=>
+ object(stdClass)#%d (%d) {
+ ["bar"]=>
+ int(42)
+ }
+}
+MongoDB\BSON\Javascript::$code exists: no
+MongoDB\BSON\Javascript::$scope exists: no
+
+object(MongoDB\BSON\MaxKey)#%d (%d) {
+}
+
+object(MongoDB\BSON\MinKey)#%d (%d) {
+}
+
+object(MongoDB\BSON\ObjectId)#%d (%d) {
+ ["oid"]=>
+ string(24) "%x"
+}
+MongoDB\BSON\ObjectId::$oid exists: no
+
+object(MongoDB\BSON\Regex)#%d (%d) {
+ ["pattern"]=>
+ string(3) "foo"
+ ["flags"]=>
+ string(1) "i"
+}
+MongoDB\BSON\Regex::$pattern exists: no
+MongoDB\BSON\Regex::$flags exists: no
+
+object(MongoDB\BSON\Timestamp)#%d (%d) {
+ ["increment"]=>
+ string(4) "1234"
+ ["timestamp"]=>
+ string(4) "5678"
+}
+MongoDB\BSON\Timestamp::$increment exists: no
+MongoDB\BSON\Timestamp::$timestamp exists: no
+
+object(MongoDB\BSON\UTCDateTime)#%d (%d) {
+ ["milliseconds"]=>
+ string(%d) "%d"
+}
+MongoDB\BSON\UTCDateTime::$milliseconds exists: no
+
+===DONE===
diff --git a/mongodb-1.8.1/tests/bson/bug0974-001.phpt b/mongodb-1.9.0/tests/bson/bug0974-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bug0974-001.phpt
rename to mongodb-1.9.0/tests/bson/bug0974-001.phpt
diff --git a/mongodb-1.8.1/tests/bson/bug1006-001.phpt b/mongodb-1.9.0/tests/bson/bug1006-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bug1006-001.phpt
rename to mongodb-1.9.0/tests/bson/bug1006-001.phpt
diff --git a/mongodb-1.8.1/tests/bson/bug1006-002.phpt b/mongodb-1.9.0/tests/bson/bug1006-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bug1006-002.phpt
rename to mongodb-1.9.0/tests/bson/bug1006-002.phpt
diff --git a/mongodb-1.8.1/tests/bson/bug1053.phpt b/mongodb-1.9.0/tests/bson/bug1053.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bug1053.phpt
rename to mongodb-1.9.0/tests/bson/bug1053.phpt
diff --git a/mongodb-1.8.1/tests/bson/bug1067.phpt b/mongodb-1.9.0/tests/bson/bug1067.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bug1067.phpt
rename to mongodb-1.9.0/tests/bson/bug1067.phpt
diff --git a/mongodb-1.8.1/tests/bson/bug1266.phpt b/mongodb-1.9.0/tests/bson/bug1266.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bug1266.phpt
rename to mongodb-1.9.0/tests/bson/bug1266.phpt
diff --git a/mongodb-1.8.1/tests/bson/bug1598-001.phpt b/mongodb-1.9.0/tests/bson/bug1598-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bug1598-001.phpt
rename to mongodb-1.9.0/tests/bson/bug1598-001.phpt
diff --git a/mongodb-1.8.1/tests/bson/bug1598-002.phpt b/mongodb-1.9.0/tests/bson/bug1598-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/bug1598-002.phpt
rename to mongodb-1.9.0/tests/bson/bug1598-002.phpt
diff --git a/mongodb-1.8.1/tests/bson/typemap-001.phpt b/mongodb-1.9.0/tests/bson/typemap-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/typemap-001.phpt
rename to mongodb-1.9.0/tests/bson/typemap-001.phpt
diff --git a/mongodb-1.8.1/tests/bson/typemap-002.phpt b/mongodb-1.9.0/tests/bson/typemap-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/typemap-002.phpt
rename to mongodb-1.9.0/tests/bson/typemap-002.phpt
diff --git a/mongodb-1.8.1/tests/bson/typemap-003.phpt b/mongodb-1.9.0/tests/bson/typemap-003.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/typemap-003.phpt
rename to mongodb-1.9.0/tests/bson/typemap-003.phpt
diff --git a/mongodb-1.8.1/tests/bson/typemap-004.phpt b/mongodb-1.9.0/tests/bson/typemap-004.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/typemap-004.phpt
rename to mongodb-1.9.0/tests/bson/typemap-004.phpt
diff --git a/mongodb-1.8.1/tests/bson/typemap-005.phpt b/mongodb-1.9.0/tests/bson/typemap-005.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/typemap-005.phpt
rename to mongodb-1.9.0/tests/bson/typemap-005.phpt
diff --git a/mongodb-1.8.1/tests/bson/typemap-006.phpt b/mongodb-1.9.0/tests/bson/typemap-006.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/typemap-006.phpt
rename to mongodb-1.9.0/tests/bson/typemap-006.phpt
diff --git a/mongodb-1.8.1/tests/bson/typemap-007.phpt b/mongodb-1.9.0/tests/bson/typemap-007.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bson/typemap-007.phpt
rename to mongodb-1.9.0/tests/bson/typemap-007.phpt
diff --git a/mongodb-1.8.1/tests/bulk/bug0667.phpt b/mongodb-1.9.0/tests/bulk/bug0667.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bulk/bug0667.phpt
rename to mongodb-1.9.0/tests/bulk/bug0667.phpt
diff --git a/mongodb-1.8.1/tests/bulk/bulkwrite-count-001.phpt b/mongodb-1.9.0/tests/bulk/bulkwrite-count-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bulk/bulkwrite-count-001.phpt
rename to mongodb-1.9.0/tests/bulk/bulkwrite-count-001.phpt
diff --git a/mongodb-1.8.1/tests/bulk/bulkwrite-countable-001.phpt b/mongodb-1.9.0/tests/bulk/bulkwrite-countable-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bulk/bulkwrite-countable-001.phpt
rename to mongodb-1.9.0/tests/bulk/bulkwrite-countable-001.phpt
diff --git a/mongodb-1.9.0/tests/bulk/bulkwrite-debug-001.phpt b/mongodb-1.9.0/tests/bulk/bulkwrite-debug-001.phpt
new file mode 100644
index 00000000..4e43821c
--- /dev/null
+++ b/mongodb-1.9.0/tests/bulk/bulkwrite-debug-001.phpt
@@ -0,0 +1,112 @@
+--TEST--
+MongoDB\Driver\BulkWrite debug output before execution
+--FILE--
+<?php
+
+$tests = [
+ [],
+ ['ordered' => true],
+ ['ordered' => false],
+ ['bypassDocumentValidation' => true],
+ ['bypassDocumentValidation' => false],
+];
+
+foreach ($tests as $options) {
+ var_dump(new MongoDB\Driver\BulkWrite($options));
+}
+
+?>
+===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)
+ ["session"]=>
+ NULL
+ ["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)
+ ["session"]=>
+ NULL
+ ["write_concern"]=>
+ NULL
+}
+object(MongoDB\Driver\BulkWrite)#%d (%d) {
+ ["database"]=>
+ NULL
+ ["collection"]=>
+ NULL
+ ["ordered"]=>
+ bool(false)
+ ["bypassDocumentValidation"]=>
+ NULL
+ ["executed"]=>
+ bool(false)
+ ["server_id"]=>
+ int(0)
+ ["session"]=>
+ NULL
+ ["write_concern"]=>
+ NULL
+}
+object(MongoDB\Driver\BulkWrite)#%d (%d) {
+ ["database"]=>
+ NULL
+ ["collection"]=>
+ NULL
+ ["ordered"]=>
+ bool(true)
+ ["bypassDocumentValidation"]=>
+ bool(true)
+ ["executed"]=>
+ bool(false)
+ ["server_id"]=>
+ int(0)
+ ["session"]=>
+ NULL
+ ["write_concern"]=>
+ NULL
+}
+object(MongoDB\Driver\BulkWrite)#%d (%d) {
+ ["database"]=>
+ NULL
+ ["collection"]=>
+ NULL
+ ["ordered"]=>
+ bool(true)
+ ["bypassDocumentValidation"]=>
+ bool(false)
+ ["executed"]=>
+ bool(false)
+ ["server_id"]=>
+ int(0)
+ ["session"]=>
+ NULL
+ ["write_concern"]=>
+ NULL
+}
+===DONE===
diff --git a/mongodb-1.9.0/tests/bulk/bulkwrite-debug-002.phpt b/mongodb-1.9.0/tests/bulk/bulkwrite-debug-002.phpt
new file mode 100644
index 00000000..d309fc00
--- /dev/null
+++ b/mongodb-1.9.0/tests/bulk/bulkwrite-debug-002.phpt
@@ -0,0 +1,68 @@
+--TEST--
+MongoDB\Driver\BulkWrite debug output after execution
+--SKIPIF--
+<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
+<?php skip_if_not_live(); ?>
+<?php skip_if_not_clean(); ?>
+<?php skip_if_server_version('<', '3.6'); ?>
+--FILE--
+<?php
+require_once __DIR__ . "/../utils/basic.inc";
+
+$manager = new MongoDB\Driver\Manager(URI);
+
+$tests = [
+ [],
+ ['session' => $manager->startSession()],
+];
+
+foreach ($tests as $options) {
+ $bulk = new MongoDB\Driver\BulkWrite();
+ $bulk->insert(['foo' => 'bar']);
+ $manager->executeBulkWrite(NS, $bulk, $options);
+ var_dump($bulk);
+}
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECTF--
+object(MongoDB\Driver\BulkWrite)#%d (%d) {
+ ["database"]=>
+ %s
+ ["collection"]=>
+ %s
+ ["ordered"]=>
+ bool(true)
+ ["bypassDocumentValidation"]=>
+ NULL
+ ["executed"]=>
+ bool(true)
+ ["server_id"]=>
+ int(%d)
+ ["session"]=>
+ NULL
+ ["write_concern"]=>
+ NULL
+}
+object(MongoDB\Driver\BulkWrite)#%d (%d) {
+ ["database"]=>
+ %s
+ ["collection"]=>
+ %s
+ ["ordered"]=>
+ bool(true)
+ ["bypassDocumentValidation"]=>
+ NULL
+ ["executed"]=>
+ bool(true)
+ ["server_id"]=>
+ int(%d)
+ ["session"]=>
+ object(MongoDB\Driver\Session)#%d (%d) {
+ %a
+ }
+ ["write_concern"]=>
+ NULL
+}
+===DONE===
diff --git a/mongodb-1.8.1/tests/bulk/bulkwrite-delete-001.phpt b/mongodb-1.9.0/tests/bulk/bulkwrite-delete-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bulk/bulkwrite-delete-001.phpt
rename to mongodb-1.9.0/tests/bulk/bulkwrite-delete-001.phpt
diff --git a/mongodb-1.8.1/tests/bulk/bulkwrite-delete-002.phpt b/mongodb-1.9.0/tests/bulk/bulkwrite-delete-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bulk/bulkwrite-delete-002.phpt
rename to mongodb-1.9.0/tests/bulk/bulkwrite-delete-002.phpt
diff --git a/mongodb-1.8.1/tests/bulk/bulkwrite-delete_error-001.phpt b/mongodb-1.9.0/tests/bulk/bulkwrite-delete_error-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bulk/bulkwrite-delete_error-001.phpt
rename to mongodb-1.9.0/tests/bulk/bulkwrite-delete_error-001.phpt
diff --git a/mongodb-1.8.1/tests/bulk/bulkwrite-delete_error-002.phpt b/mongodb-1.9.0/tests/bulk/bulkwrite-delete_error-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bulk/bulkwrite-delete_error-002.phpt
rename to mongodb-1.9.0/tests/bulk/bulkwrite-delete_error-002.phpt
diff --git a/mongodb-1.8.1/tests/bulk/bulkwrite-delete_error-003.phpt b/mongodb-1.9.0/tests/bulk/bulkwrite-delete_error-003.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bulk/bulkwrite-delete_error-003.phpt
rename to mongodb-1.9.0/tests/bulk/bulkwrite-delete_error-003.phpt
diff --git a/mongodb-1.8.1/tests/bulk/bulkwrite-delete_error-004.phpt b/mongodb-1.9.0/tests/bulk/bulkwrite-delete_error-004.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bulk/bulkwrite-delete_error-004.phpt
rename to mongodb-1.9.0/tests/bulk/bulkwrite-delete_error-004.phpt
diff --git a/mongodb-1.8.1/tests/bulk/bulkwrite-delete_error-005.phpt b/mongodb-1.9.0/tests/bulk/bulkwrite-delete_error-005.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bulk/bulkwrite-delete_error-005.phpt
rename to mongodb-1.9.0/tests/bulk/bulkwrite-delete_error-005.phpt
diff --git a/mongodb-1.8.1/tests/bulk/bulkwrite-insert-001.phpt b/mongodb-1.9.0/tests/bulk/bulkwrite-insert-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bulk/bulkwrite-insert-001.phpt
rename to mongodb-1.9.0/tests/bulk/bulkwrite-insert-001.phpt
diff --git a/mongodb-1.8.1/tests/bulk/bulkwrite-insert-004.phpt b/mongodb-1.9.0/tests/bulk/bulkwrite-insert-004.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bulk/bulkwrite-insert-004.phpt
rename to mongodb-1.9.0/tests/bulk/bulkwrite-insert-004.phpt
diff --git a/mongodb-1.8.1/tests/bulk/bulkwrite-insert_error-001.phpt b/mongodb-1.9.0/tests/bulk/bulkwrite-insert_error-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bulk/bulkwrite-insert_error-001.phpt
rename to mongodb-1.9.0/tests/bulk/bulkwrite-insert_error-001.phpt
diff --git a/mongodb-1.8.1/tests/bulk/bulkwrite-insert_error-002.phpt b/mongodb-1.9.0/tests/bulk/bulkwrite-insert_error-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bulk/bulkwrite-insert_error-002.phpt
rename to mongodb-1.9.0/tests/bulk/bulkwrite-insert_error-002.phpt
diff --git a/mongodb-1.8.1/tests/bulk/bulkwrite-insert_error-003.phpt b/mongodb-1.9.0/tests/bulk/bulkwrite-insert_error-003.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bulk/bulkwrite-insert_error-003.phpt
rename to mongodb-1.9.0/tests/bulk/bulkwrite-insert_error-003.phpt
diff --git a/mongodb-1.8.1/tests/bulk/bulkwrite-update-001.phpt b/mongodb-1.9.0/tests/bulk/bulkwrite-update-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bulk/bulkwrite-update-001.phpt
rename to mongodb-1.9.0/tests/bulk/bulkwrite-update-001.phpt
diff --git a/mongodb-1.8.1/tests/bulk/bulkwrite-update-002.phpt b/mongodb-1.9.0/tests/bulk/bulkwrite-update-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bulk/bulkwrite-update-002.phpt
rename to mongodb-1.9.0/tests/bulk/bulkwrite-update-002.phpt
diff --git a/mongodb-1.8.1/tests/bulk/bulkwrite-update-003.phpt b/mongodb-1.9.0/tests/bulk/bulkwrite-update-003.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bulk/bulkwrite-update-003.phpt
rename to mongodb-1.9.0/tests/bulk/bulkwrite-update-003.phpt
diff --git a/mongodb-1.8.1/tests/bulk/bulkwrite-update-004.phpt b/mongodb-1.9.0/tests/bulk/bulkwrite-update-004.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bulk/bulkwrite-update-004.phpt
rename to mongodb-1.9.0/tests/bulk/bulkwrite-update-004.phpt
diff --git a/mongodb-1.8.1/tests/bulk/bulkwrite-update_error-001.phpt b/mongodb-1.9.0/tests/bulk/bulkwrite-update_error-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bulk/bulkwrite-update_error-001.phpt
rename to mongodb-1.9.0/tests/bulk/bulkwrite-update_error-001.phpt
diff --git a/mongodb-1.8.1/tests/bulk/bulkwrite-update_error-002.phpt b/mongodb-1.9.0/tests/bulk/bulkwrite-update_error-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bulk/bulkwrite-update_error-002.phpt
rename to mongodb-1.9.0/tests/bulk/bulkwrite-update_error-002.phpt
diff --git a/mongodb-1.8.1/tests/bulk/bulkwrite-update_error-003.phpt b/mongodb-1.9.0/tests/bulk/bulkwrite-update_error-003.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bulk/bulkwrite-update_error-003.phpt
rename to mongodb-1.9.0/tests/bulk/bulkwrite-update_error-003.phpt
diff --git a/mongodb-1.8.1/tests/bulk/bulkwrite-update_error-004.phpt b/mongodb-1.9.0/tests/bulk/bulkwrite-update_error-004.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bulk/bulkwrite-update_error-004.phpt
rename to mongodb-1.9.0/tests/bulk/bulkwrite-update_error-004.phpt
diff --git a/mongodb-1.8.1/tests/bulk/bulkwrite-update_error-005.phpt b/mongodb-1.9.0/tests/bulk/bulkwrite-update_error-005.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bulk/bulkwrite-update_error-005.phpt
rename to mongodb-1.9.0/tests/bulk/bulkwrite-update_error-005.phpt
diff --git a/mongodb-1.8.1/tests/bulk/bulkwrite-update_error-006.phpt b/mongodb-1.9.0/tests/bulk/bulkwrite-update_error-006.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bulk/bulkwrite-update_error-006.phpt
rename to mongodb-1.9.0/tests/bulk/bulkwrite-update_error-006.phpt
diff --git a/mongodb-1.8.1/tests/bulk/bulkwrite-update_error-007.phpt b/mongodb-1.9.0/tests/bulk/bulkwrite-update_error-007.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bulk/bulkwrite-update_error-007.phpt
rename to mongodb-1.9.0/tests/bulk/bulkwrite-update_error-007.phpt
diff --git a/mongodb-1.8.1/tests/bulk/bulkwrite-update_error-008.phpt b/mongodb-1.9.0/tests/bulk/bulkwrite-update_error-008.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bulk/bulkwrite-update_error-008.phpt
rename to mongodb-1.9.0/tests/bulk/bulkwrite-update_error-008.phpt
diff --git a/mongodb-1.8.1/tests/bulk/bulkwrite_error-001.phpt b/mongodb-1.9.0/tests/bulk/bulkwrite_error-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bulk/bulkwrite_error-001.phpt
rename to mongodb-1.9.0/tests/bulk/bulkwrite_error-001.phpt
diff --git a/mongodb-1.8.1/tests/bulk/bulkwrite_error-002.phpt b/mongodb-1.9.0/tests/bulk/bulkwrite_error-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/bulk/bulkwrite_error-002.phpt
rename to mongodb-1.9.0/tests/bulk/bulkwrite_error-002.phpt
diff --git a/mongodb-1.9.0/tests/bulk/write-0001.phpt b/mongodb-1.9.0/tests/bulk/write-0001.phpt
new file mode 100644
index 00000000..f626d58d
--- /dev/null
+++ b/mongodb-1.9.0/tests/bulk/write-0001.phpt
@@ -0,0 +1,137 @@
+--TEST--
+MongoDB\Driver\BulkWrite: #001 Variety Bulk
+--SKIPIF--
+<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
+<?php skip_if_not_live(); ?>
+<?php skip_if_not_clean(); ?>
+--FILE--
+<?php
+require_once __DIR__ . "/../utils/basic.inc";
+
+$manager = new MongoDB\Driver\Manager(URI);
+
+$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)
+ ["session"]=>
+ NULL
+ ["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)
+ ["session"]=>
+ NULL
+ ["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)
+ ["session"]=>
+ NULL
+ ["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)
+ ["session"]=>
+ NULL
+ ["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(%r[1-9]\d*%r)
+ ["session"]=>
+ NULL
+ ["write_concern"]=>
+ NULL
+}
+Inserted: 3
+Deleted: 1
+Updated: 1
+Upserted: 0
+===DONE===
diff --git a/mongodb-1.9.0/tests/bulk/write-0002.phpt b/mongodb-1.9.0/tests/bulk/write-0002.phpt
new file mode 100644
index 00000000..16d65eb9
--- /dev/null
+++ b/mongodb-1.9.0/tests/bulk/write-0002.phpt
@@ -0,0 +1,83 @@
+--TEST--
+MongoDB\Driver\BulkWrite: #002 Get the generated ID
+--SKIPIF--
+<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
+<?php skip_if_not_live(); ?>
+<?php skip_if_not_clean(); ?>
+--FILE--
+<?php
+require_once __DIR__ . "/../utils/basic.inc";
+
+$manager = new MongoDB\Driver\Manager(URI);
+
+$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)
+ ["session"]=>
+ NULL
+ ["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(%r[1-9]\d*%r)
+ ["session"]=>
+ NULL
+ ["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.8.1/tests/causal-consistency/causal-consistency-001.phpt b/mongodb-1.9.0/tests/causal-consistency/causal-consistency-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/causal-consistency/causal-consistency-001.phpt
rename to mongodb-1.9.0/tests/causal-consistency/causal-consistency-001.phpt
diff --git a/mongodb-1.8.1/tests/causal-consistency/causal-consistency-002.phpt b/mongodb-1.9.0/tests/causal-consistency/causal-consistency-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/causal-consistency/causal-consistency-002.phpt
rename to mongodb-1.9.0/tests/causal-consistency/causal-consistency-002.phpt
diff --git a/mongodb-1.8.1/tests/causal-consistency/causal-consistency-003.phpt b/mongodb-1.9.0/tests/causal-consistency/causal-consistency-003.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/causal-consistency/causal-consistency-003.phpt
rename to mongodb-1.9.0/tests/causal-consistency/causal-consistency-003.phpt
diff --git a/mongodb-1.8.1/tests/causal-consistency/causal-consistency-004.phpt b/mongodb-1.9.0/tests/causal-consistency/causal-consistency-004.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/causal-consistency/causal-consistency-004.phpt
rename to mongodb-1.9.0/tests/causal-consistency/causal-consistency-004.phpt
diff --git a/mongodb-1.8.1/tests/causal-consistency/causal-consistency-005.phpt b/mongodb-1.9.0/tests/causal-consistency/causal-consistency-005.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/causal-consistency/causal-consistency-005.phpt
rename to mongodb-1.9.0/tests/causal-consistency/causal-consistency-005.phpt
diff --git a/mongodb-1.8.1/tests/causal-consistency/causal-consistency-006.phpt b/mongodb-1.9.0/tests/causal-consistency/causal-consistency-006.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/causal-consistency/causal-consistency-006.phpt
rename to mongodb-1.9.0/tests/causal-consistency/causal-consistency-006.phpt
diff --git a/mongodb-1.8.1/tests/causal-consistency/causal-consistency-007.phpt b/mongodb-1.9.0/tests/causal-consistency/causal-consistency-007.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/causal-consistency/causal-consistency-007.phpt
rename to mongodb-1.9.0/tests/causal-consistency/causal-consistency-007.phpt
diff --git a/mongodb-1.8.1/tests/causal-consistency/causal-consistency-008.phpt b/mongodb-1.9.0/tests/causal-consistency/causal-consistency-008.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/causal-consistency/causal-consistency-008.phpt
rename to mongodb-1.9.0/tests/causal-consistency/causal-consistency-008.phpt
diff --git a/mongodb-1.8.1/tests/causal-consistency/causal-consistency-009.phpt b/mongodb-1.9.0/tests/causal-consistency/causal-consistency-009.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/causal-consistency/causal-consistency-009.phpt
rename to mongodb-1.9.0/tests/causal-consistency/causal-consistency-009.phpt
diff --git a/mongodb-1.8.1/tests/causal-consistency/causal-consistency-010.phpt b/mongodb-1.9.0/tests/causal-consistency/causal-consistency-010.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/causal-consistency/causal-consistency-010.phpt
rename to mongodb-1.9.0/tests/causal-consistency/causal-consistency-010.phpt
diff --git a/mongodb-1.8.1/tests/causal-consistency/causal-consistency-011.phpt b/mongodb-1.9.0/tests/causal-consistency/causal-consistency-011.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/causal-consistency/causal-consistency-011.phpt
rename to mongodb-1.9.0/tests/causal-consistency/causal-consistency-011.phpt
diff --git a/mongodb-1.8.1/tests/causal-consistency/causal-consistency-012.phpt b/mongodb-1.9.0/tests/causal-consistency/causal-consistency-012.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/causal-consistency/causal-consistency-012.phpt
rename to mongodb-1.9.0/tests/causal-consistency/causal-consistency-012.phpt
diff --git a/mongodb-1.8.1/tests/clientEncryption/clientEncryption-constants.phpt b/mongodb-1.9.0/tests/clientEncryption/clientEncryption-constants.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/clientEncryption/clientEncryption-constants.phpt
rename to mongodb-1.9.0/tests/clientEncryption/clientEncryption-constants.phpt
diff --git a/mongodb-1.8.1/tests/clientEncryption/clientEncryption-createDataKey-001.phpt b/mongodb-1.9.0/tests/clientEncryption/clientEncryption-createDataKey-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/clientEncryption/clientEncryption-createDataKey-001.phpt
rename to mongodb-1.9.0/tests/clientEncryption/clientEncryption-createDataKey-001.phpt
diff --git a/mongodb-1.8.1/tests/clientEncryption/clientEncryption-createDataKey_error-001.phpt b/mongodb-1.9.0/tests/clientEncryption/clientEncryption-createDataKey_error-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/clientEncryption/clientEncryption-createDataKey_error-001.phpt
rename to mongodb-1.9.0/tests/clientEncryption/clientEncryption-createDataKey_error-001.phpt
diff --git a/mongodb-1.8.1/tests/clientEncryption/clientEncryption-decrypt-001.phpt b/mongodb-1.9.0/tests/clientEncryption/clientEncryption-decrypt-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/clientEncryption/clientEncryption-decrypt-001.phpt
rename to mongodb-1.9.0/tests/clientEncryption/clientEncryption-decrypt-001.phpt
diff --git a/mongodb-1.8.1/tests/clientEncryption/clientEncryption-encrypt-001.phpt b/mongodb-1.9.0/tests/clientEncryption/clientEncryption-encrypt-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/clientEncryption/clientEncryption-encrypt-001.phpt
rename to mongodb-1.9.0/tests/clientEncryption/clientEncryption-encrypt-001.phpt
diff --git a/mongodb-1.8.1/tests/command/command-ctor-001.phpt b/mongodb-1.9.0/tests/command/command-ctor-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/command/command-ctor-001.phpt
rename to mongodb-1.9.0/tests/command/command-ctor-001.phpt
diff --git a/mongodb-1.8.1/tests/command/command_error-001.phpt b/mongodb-1.9.0/tests/command/command_error-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/command/command_error-001.phpt
rename to mongodb-1.9.0/tests/command/command_error-001.phpt
diff --git a/mongodb-1.8.1/tests/command/cursor-batchsize-001.phpt b/mongodb-1.9.0/tests/command/cursor-batchsize-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/command/cursor-batchsize-001.phpt
rename to mongodb-1.9.0/tests/command/cursor-batchsize-001.phpt
diff --git a/mongodb-1.8.1/tests/command/cursor-batchsize-002.phpt b/mongodb-1.9.0/tests/command/cursor-batchsize-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/command/cursor-batchsize-002.phpt
rename to mongodb-1.9.0/tests/command/cursor-batchsize-002.phpt
diff --git a/mongodb-1.8.1/tests/command/cursor-tailable-001.phpt b/mongodb-1.9.0/tests/command/cursor-tailable-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/command/cursor-tailable-001.phpt
rename to mongodb-1.9.0/tests/command/cursor-tailable-001.phpt
diff --git a/mongodb-1.8.1/tests/command/findAndModify-001.phpt b/mongodb-1.9.0/tests/command/findAndModify-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/command/findAndModify-001.phpt
rename to mongodb-1.9.0/tests/command/findAndModify-001.phpt
diff --git a/mongodb-1.8.1/tests/command/update-001.phpt b/mongodb-1.9.0/tests/command/update-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/command/update-001.phpt
rename to mongodb-1.9.0/tests/command/update-001.phpt
diff --git a/mongodb-1.8.1/tests/connect/bug0720.phpt b/mongodb-1.9.0/tests/connect/bug0720.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/connect/bug0720.phpt
rename to mongodb-1.9.0/tests/connect/bug0720.phpt
diff --git a/mongodb-1.8.1/tests/connect/bug1015.phpt b/mongodb-1.9.0/tests/connect/bug1015.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/connect/bug1015.phpt
rename to mongodb-1.9.0/tests/connect/bug1015.phpt
diff --git a/mongodb-1.8.1/tests/connect/bug1045.phpt b/mongodb-1.9.0/tests/connect/bug1045.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/connect/bug1045.phpt
rename to mongodb-1.9.0/tests/connect/bug1045.phpt
diff --git a/mongodb-1.8.1/tests/connect/compression_error-001.phpt b/mongodb-1.9.0/tests/connect/compression_error-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/connect/compression_error-001.phpt
rename to mongodb-1.9.0/tests/connect/compression_error-001.phpt
diff --git a/mongodb-1.8.1/tests/connect/compression_error-002.phpt b/mongodb-1.9.0/tests/connect/compression_error-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/connect/compression_error-002.phpt
rename to mongodb-1.9.0/tests/connect/compression_error-002.phpt
diff --git a/mongodb-1.8.1/tests/connect/replicaset-seedlist-001.phpt b/mongodb-1.9.0/tests/connect/replicaset-seedlist-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/connect/replicaset-seedlist-001.phpt
rename to mongodb-1.9.0/tests/connect/replicaset-seedlist-001.phpt
diff --git a/mongodb-1.8.1/tests/connect/replicaset-seedlist-002.phpt b/mongodb-1.9.0/tests/connect/replicaset-seedlist-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/connect/replicaset-seedlist-002.phpt
rename to mongodb-1.9.0/tests/connect/replicaset-seedlist-002.phpt
diff --git a/mongodb-1.8.1/tests/connect/standalone-auth-001.phpt b/mongodb-1.9.0/tests/connect/standalone-auth-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/connect/standalone-auth-001.phpt
rename to mongodb-1.9.0/tests/connect/standalone-auth-001.phpt
diff --git a/mongodb-1.8.1/tests/connect/standalone-auth_error-001.phpt b/mongodb-1.9.0/tests/connect/standalone-auth_error-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/connect/standalone-auth_error-001.phpt
rename to mongodb-1.9.0/tests/connect/standalone-auth_error-001.phpt
diff --git a/mongodb-1.8.1/tests/connect/standalone-plain-0001.phpt b/mongodb-1.9.0/tests/connect/standalone-plain-0001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/connect/standalone-plain-0001.phpt
rename to mongodb-1.9.0/tests/connect/standalone-plain-0001.phpt
diff --git a/mongodb-1.8.1/tests/connect/standalone-plain-0002.phpt b/mongodb-1.9.0/tests/connect/standalone-plain-0002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/connect/standalone-plain-0002.phpt
rename to mongodb-1.9.0/tests/connect/standalone-plain-0002.phpt
diff --git a/mongodb-1.8.1/tests/connect/standalone-ssl-no_verify-001.phpt b/mongodb-1.9.0/tests/connect/standalone-ssl-no_verify-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/connect/standalone-ssl-no_verify-001.phpt
rename to mongodb-1.9.0/tests/connect/standalone-ssl-no_verify-001.phpt
diff --git a/mongodb-1.8.1/tests/connect/standalone-ssl-no_verify-002.phpt b/mongodb-1.9.0/tests/connect/standalone-ssl-no_verify-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/connect/standalone-ssl-no_verify-002.phpt
rename to mongodb-1.9.0/tests/connect/standalone-ssl-no_verify-002.phpt
diff --git a/mongodb-1.8.1/tests/connect/standalone-ssl-verify_cert-001.phpt b/mongodb-1.9.0/tests/connect/standalone-ssl-verify_cert-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/connect/standalone-ssl-verify_cert-001.phpt
rename to mongodb-1.9.0/tests/connect/standalone-ssl-verify_cert-001.phpt
diff --git a/mongodb-1.8.1/tests/connect/standalone-ssl-verify_cert-002.phpt b/mongodb-1.9.0/tests/connect/standalone-ssl-verify_cert-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/connect/standalone-ssl-verify_cert-002.phpt
rename to mongodb-1.9.0/tests/connect/standalone-ssl-verify_cert-002.phpt
diff --git a/mongodb-1.8.1/tests/connect/standalone-ssl-verify_cert-error-001.phpt b/mongodb-1.9.0/tests/connect/standalone-ssl-verify_cert-error-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/connect/standalone-ssl-verify_cert-error-001.phpt
rename to mongodb-1.9.0/tests/connect/standalone-ssl-verify_cert-error-001.phpt
diff --git a/mongodb-1.8.1/tests/connect/standalone-ssl-verify_cert-error-002.phpt b/mongodb-1.9.0/tests/connect/standalone-ssl-verify_cert-error-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/connect/standalone-ssl-verify_cert-error-002.phpt
rename to mongodb-1.9.0/tests/connect/standalone-ssl-verify_cert-error-002.phpt
diff --git a/mongodb-1.8.1/tests/connect/standalone-x509-auth-001.phpt b/mongodb-1.9.0/tests/connect/standalone-x509-auth-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/connect/standalone-x509-auth-001.phpt
rename to mongodb-1.9.0/tests/connect/standalone-x509-auth-001.phpt
diff --git a/mongodb-1.8.1/tests/connect/standalone-x509-auth-002.phpt b/mongodb-1.9.0/tests/connect/standalone-x509-auth-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/connect/standalone-x509-auth-002.phpt
rename to mongodb-1.9.0/tests/connect/standalone-x509-auth-002.phpt
diff --git a/mongodb-1.8.1/tests/connect/standalone-x509-error-0001.phpt b/mongodb-1.9.0/tests/connect/standalone-x509-error-0001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/connect/standalone-x509-error-0001.phpt
rename to mongodb-1.9.0/tests/connect/standalone-x509-error-0001.phpt
diff --git a/mongodb-1.8.1/tests/connect/standalone-x509-extract_username-001.phpt b/mongodb-1.9.0/tests/connect/standalone-x509-extract_username-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/connect/standalone-x509-extract_username-001.phpt
rename to mongodb-1.9.0/tests/connect/standalone-x509-extract_username-001.phpt
diff --git a/mongodb-1.8.1/tests/connect/standalone-x509-extract_username-002.phpt b/mongodb-1.9.0/tests/connect/standalone-x509-extract_username-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/connect/standalone-x509-extract_username-002.phpt
rename to mongodb-1.9.0/tests/connect/standalone-x509-extract_username-002.phpt
diff --git a/mongodb-1.8.1/tests/cursor/bug0671-001.phpt b/mongodb-1.9.0/tests/cursor/bug0671-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/cursor/bug0671-001.phpt
rename to mongodb-1.9.0/tests/cursor/bug0671-001.phpt
diff --git a/mongodb-1.8.1/tests/cursor/bug0732-001.phpt b/mongodb-1.9.0/tests/cursor/bug0732-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/cursor/bug0732-001.phpt
rename to mongodb-1.9.0/tests/cursor/bug0732-001.phpt
diff --git a/mongodb-1.8.1/tests/cursor/bug0849-001.phpt b/mongodb-1.9.0/tests/cursor/bug0849-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/cursor/bug0849-001.phpt
rename to mongodb-1.9.0/tests/cursor/bug0849-001.phpt
diff --git a/mongodb-1.8.1/tests/cursor/bug0924-001.phpt b/mongodb-1.9.0/tests/cursor/bug0924-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/cursor/bug0924-001.phpt
rename to mongodb-1.9.0/tests/cursor/bug0924-001.phpt
diff --git a/mongodb-1.8.1/tests/cursor/bug0924-002.phpt b/mongodb-1.9.0/tests/cursor/bug0924-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/cursor/bug0924-002.phpt
rename to mongodb-1.9.0/tests/cursor/bug0924-002.phpt
diff --git a/mongodb-1.9.0/tests/cursor/bug1050-001.phpt b/mongodb-1.9.0/tests/cursor/bug1050-001.phpt
new file mode 100644
index 00000000..d6f261f8
--- /dev/null
+++ b/mongodb-1.9.0/tests/cursor/bug1050-001.phpt
@@ -0,0 +1,110 @@
+--TEST--
+PHPC-1050: Command cursor should not invoke getMore at execution
+--SKIPIF--
+<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
+<?php skip_if_not_replica_set(); ?>
+<?php skip_if_not_clean(); ?>
+<?php skip_if_server_version('<', '3.6'); ?>
+<?php skip_if_not_server_storage_engine('wiredTiger'); ?>
+--FILE--
+<?php
+require_once __DIR__ . "/../utils/basic.inc";
+
+class CommandLogger implements MongoDB\Driver\Monitoring\CommandSubscriber
+{
+ public function commandStarted(MongoDB\Driver\Monitoring\CommandStartedEvent $event)
+ {
+ if ($event->getCommandName() !== 'aggregate' && $event->getCommandName() !== 'getMore') {
+ return;
+ }
+
+ printf("Executing command: %s\n", $event->getCommandName());
+ }
+
+ public function commandSucceeded(MongoDB\Driver\Monitoring\CommandSucceededEvent $event)
+ {
+ if ($event->getCommandName() !== 'aggregate' && $event->getCommandName() !== 'getMore') {
+ return;
+ }
+
+ printf("Executing command took %0.6f seconds\n", $event->getDurationMicros() / 1000000);
+ }
+
+ public function commandFailed(MongoDB\Driver\Monitoring\CommandFailedEvent $event)
+ {
+ }
+}
+
+$manager = new MongoDB\Driver\Manager(URI);
+
+$cmd = new MongoDB\Driver\Command(
+ [
+ 'aggregate' => COLLECTION_NAME,
+ 'pipeline' => [
+ ['$changeStream' => (object) []],
+ ],
+ 'cursor' => (object) [],
+ ],
+ [
+ 'maxAwaitTimeMS' => 500,
+ ]
+);
+
+MongoDB\Driver\Monitoring\addSubscriber(new CommandLogger);
+
+$cursor = $manager->executeReadCommand(DATABASE_NAME, $cmd);
+
+$it = new IteratorIterator($cursor);
+
+printf("Current position is valid: %s\n\n", $it->valid() ? 'yes' : 'no');
+
+echo "Rewinding cursor\n";
+$it->rewind();
+
+printf("Current position is valid: %s\n\n", $it->valid() ? 'yes' : 'no');
+
+$bulk = new MongoDB\Driver\BulkWrite;
+$bulk->insert(['x' => 1]);
+$manager->executeBulkWrite(NS, $bulk);
+
+echo "Advancing cursor\n";
+$it->next();
+
+printf("Current position is valid: %s\n\n", $it->valid() ? 'yes' : 'no');
+
+$document = $it->current();
+
+if (isset($document)) {
+ printf("Operation type: %s\n", $document->operationType);
+ var_dump($document->fullDocument);
+}
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECTF--
+Executing command: aggregate
+Executing command took 0.%d seconds
+Current position is valid: no
+
+Rewinding cursor
+Executing command: getMore
+Executing command took 0.%r(4|5)%r%d seconds
+Current position is valid: no
+
+Advancing cursor
+Executing command: getMore
+Executing command took 0.%d seconds
+Current position is valid: yes
+
+Operation type: insert
+object(stdClass)#%d (%d) {
+ ["_id"]=>
+ object(MongoDB\BSON\ObjectId)#%d (%d) {
+ ["oid"]=>
+ string(24) "%x"
+ }
+ ["x"]=>
+ int(1)
+}
+===DONE===
diff --git a/mongodb-1.9.0/tests/cursor/bug1050-002.phpt b/mongodb-1.9.0/tests/cursor/bug1050-002.phpt
new file mode 100644
index 00000000..d55c2455
--- /dev/null
+++ b/mongodb-1.9.0/tests/cursor/bug1050-002.phpt
@@ -0,0 +1,118 @@
+--TEST--
+PHPC-1050: Command cursor should not invoke getMore at execution (rewind omitted)
+--SKIPIF--
+<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
+<?php skip_if_php_version('>', '7.99'); ?>
+<?php skip_if_not_replica_set(); ?>
+<?php skip_if_not_clean(); ?>
+<?php skip_if_server_version('<', '3.6'); ?>
+<?php skip_if_not_server_storage_engine('wiredTiger'); ?>
+--FILE--
+<?php
+require_once __DIR__ . "/../utils/basic.inc";
+
+/* Note: this test is skipped on PHP 8 because the InternalIterator class
+ * returned by Cursor::getIterator() has logic to ensure rewind() is always
+ * called. That causes and additional getMore to be observed when starting
+ * iteration with next(), since rewind() and next() both trigger a getMore.
+ * We may be able to resume running this test on PHP 8 if Cursor implements
+ * Iterator directly and allow rewind() to be optional (see: PHPC-1691). */
+
+class CommandLogger implements MongoDB\Driver\Monitoring\CommandSubscriber
+{
+ public function commandStarted(MongoDB\Driver\Monitoring\CommandStartedEvent $event)
+ {
+ if ($event->getCommandName() !== 'aggregate' && $event->getCommandName() !== 'getMore') {
+ return;
+ }
+
+ printf("Executing command: %s\n", $event->getCommandName());
+ }
+
+ public function commandSucceeded(MongoDB\Driver\Monitoring\CommandSucceededEvent $event)
+ {
+ if ($event->getCommandName() !== 'aggregate' && $event->getCommandName() !== 'getMore') {
+ return;
+ }
+
+ printf("Executing command took %0.6f seconds\n", $event->getDurationMicros() / 1000000);
+ }
+
+ public function commandFailed(MongoDB\Driver\Monitoring\CommandFailedEvent $event)
+ {
+ }
+}
+
+$manager = new MongoDB\Driver\Manager(URI);
+
+$cmd = new MongoDB\Driver\Command(
+ [
+ 'aggregate' => COLLECTION_NAME,
+ 'pipeline' => [
+ ['$changeStream' => (object) []],
+ ],
+ 'cursor' => (object) [],
+ ],
+ [
+ 'maxAwaitTimeMS' => 500,
+ ]
+);
+
+MongoDB\Driver\Monitoring\addSubscriber(new CommandLogger);
+
+$cursor = $manager->executeReadCommand(DATABASE_NAME, $cmd);
+
+$it = new IteratorIterator($cursor);
+
+printf("Current position is valid: %s\n\n", $it->valid() ? 'yes' : 'no');
+
+echo "Advancing cursor\n";
+$it->next();
+
+printf("Current position is valid: %s\n\n", $it->valid() ? 'yes' : 'no');
+
+$bulk = new MongoDB\Driver\BulkWrite;
+$bulk->insert(['x' => 1]);
+$manager->executeBulkWrite(NS, $bulk);
+
+echo "Advancing cursor\n";
+$it->next();
+
+printf("Current position is valid: %s\n\n", $it->valid() ? 'yes' : 'no');
+
+$document = $it->current();
+
+if (isset($document)) {
+ printf("Operation type: %s\n", $document->operationType);
+ var_dump($document->fullDocument);
+}
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECTF--
+Executing command: aggregate
+Executing command took 0.%d seconds
+Current position is valid: no
+
+Advancing cursor
+Executing command: getMore
+Executing command took 0.%r(4|5)%r%d seconds
+Current position is valid: no
+
+Advancing cursor
+Executing command: getMore
+Executing command took 0.%d seconds
+Current position is valid: yes
+
+Operation type: insert
+object(stdClass)#%d (%d) {
+ ["_id"]=>
+ object(MongoDB\BSON\ObjectId)#%d (%d) {
+ ["oid"]=>
+ string(24) "%x"
+ }
+ ["x"]=>
+ int(1)
+}
+===DONE===
diff --git a/mongodb-1.8.1/tests/cursor/bug1151-001.phpt b/mongodb-1.9.0/tests/cursor/bug1151-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/cursor/bug1151-001.phpt
rename to mongodb-1.9.0/tests/cursor/bug1151-001.phpt
diff --git a/mongodb-1.8.1/tests/cursor/bug1151-002.phpt b/mongodb-1.9.0/tests/cursor/bug1151-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/cursor/bug1151-002.phpt
rename to mongodb-1.9.0/tests/cursor/bug1151-002.phpt
diff --git a/mongodb-1.8.1/tests/cursor/bug1151-003.phpt b/mongodb-1.9.0/tests/cursor/bug1151-003.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/cursor/bug1151-003.phpt
rename to mongodb-1.9.0/tests/cursor/bug1151-003.phpt
diff --git a/mongodb-1.8.1/tests/cursor/bug1151-004.phpt b/mongodb-1.9.0/tests/cursor/bug1151-004.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/cursor/bug1151-004.phpt
rename to mongodb-1.9.0/tests/cursor/bug1151-004.phpt
diff --git a/mongodb-1.8.1/tests/cursor/bug1152-001.phpt b/mongodb-1.9.0/tests/cursor/bug1152-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/cursor/bug1152-001.phpt
rename to mongodb-1.9.0/tests/cursor/bug1152-001.phpt
diff --git a/mongodb-1.8.1/tests/cursor/bug1152-002.phpt b/mongodb-1.9.0/tests/cursor/bug1152-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/cursor/bug1152-002.phpt
rename to mongodb-1.9.0/tests/cursor/bug1152-002.phpt
diff --git a/mongodb-1.8.1/tests/cursor/bug1162-001.phpt b/mongodb-1.9.0/tests/cursor/bug1162-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/cursor/bug1162-001.phpt
rename to mongodb-1.9.0/tests/cursor/bug1162-001.phpt
diff --git a/mongodb-1.8.1/tests/cursor/bug1274-001.phpt b/mongodb-1.9.0/tests/cursor/bug1274-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/cursor/bug1274-001.phpt
rename to mongodb-1.9.0/tests/cursor/bug1274-001.phpt
diff --git a/mongodb-1.8.1/tests/cursor/bug1274-002.phpt b/mongodb-1.9.0/tests/cursor/bug1274-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/cursor/bug1274-002.phpt
rename to mongodb-1.9.0/tests/cursor/bug1274-002.phpt
diff --git a/mongodb-1.8.1/tests/cursor/bug1274-003.phpt b/mongodb-1.9.0/tests/cursor/bug1274-003.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/cursor/bug1274-003.phpt
rename to mongodb-1.9.0/tests/cursor/bug1274-003.phpt
diff --git a/mongodb-1.8.1/tests/cursor/bug1419-001.phpt b/mongodb-1.9.0/tests/cursor/bug1419-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/cursor/bug1419-001.phpt
rename to mongodb-1.9.0/tests/cursor/bug1419-001.phpt
diff --git a/mongodb-1.8.1/tests/cursor/cursor-001.phpt b/mongodb-1.9.0/tests/cursor/cursor-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/cursor/cursor-001.phpt
rename to mongodb-1.9.0/tests/cursor/cursor-001.phpt
diff --git a/mongodb-1.8.1/tests/cursor/cursor-IteratorIterator-001.phpt b/mongodb-1.9.0/tests/cursor/cursor-IteratorIterator-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/cursor/cursor-IteratorIterator-001.phpt
rename to mongodb-1.9.0/tests/cursor/cursor-IteratorIterator-001.phpt
diff --git a/mongodb-1.8.1/tests/cursor/cursor-IteratorIterator-002.phpt b/mongodb-1.9.0/tests/cursor/cursor-IteratorIterator-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/cursor/cursor-IteratorIterator-002.phpt
rename to mongodb-1.9.0/tests/cursor/cursor-IteratorIterator-002.phpt
diff --git a/mongodb-1.8.1/tests/cursor/cursor-IteratorIterator-003.phpt b/mongodb-1.9.0/tests/cursor/cursor-IteratorIterator-003.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/cursor/cursor-IteratorIterator-003.phpt
rename to mongodb-1.9.0/tests/cursor/cursor-IteratorIterator-003.phpt
diff --git a/mongodb-1.8.1/tests/cursor/cursor-IteratorIterator-004.phpt b/mongodb-1.9.0/tests/cursor/cursor-IteratorIterator-004.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/cursor/cursor-IteratorIterator-004.phpt
rename to mongodb-1.9.0/tests/cursor/cursor-IteratorIterator-004.phpt
diff --git a/mongodb-1.8.1/tests/cursor/cursor-NoRewindIterator-001.phpt b/mongodb-1.9.0/tests/cursor/cursor-NoRewindIterator-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/cursor/cursor-NoRewindIterator-001.phpt
rename to mongodb-1.9.0/tests/cursor/cursor-NoRewindIterator-001.phpt
diff --git a/mongodb-1.8.1/tests/cursor/cursor-destruct-001.phpt b/mongodb-1.9.0/tests/cursor/cursor-destruct-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/cursor/cursor-destruct-001.phpt
rename to mongodb-1.9.0/tests/cursor/cursor-destruct-001.phpt
diff --git a/mongodb-1.8.1/tests/cursor/cursor-getmore-001.phpt b/mongodb-1.9.0/tests/cursor/cursor-getmore-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/cursor/cursor-getmore-001.phpt
rename to mongodb-1.9.0/tests/cursor/cursor-getmore-001.phpt
diff --git a/mongodb-1.8.1/tests/cursor/cursor-getmore-002.phpt b/mongodb-1.9.0/tests/cursor/cursor-getmore-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/cursor/cursor-getmore-002.phpt
rename to mongodb-1.9.0/tests/cursor/cursor-getmore-002.phpt
diff --git a/mongodb-1.8.1/tests/cursor/cursor-getmore-003.phpt b/mongodb-1.9.0/tests/cursor/cursor-getmore-003.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/cursor/cursor-getmore-003.phpt
rename to mongodb-1.9.0/tests/cursor/cursor-getmore-003.phpt
diff --git a/mongodb-1.8.1/tests/cursor/cursor-getmore-004.phpt b/mongodb-1.9.0/tests/cursor/cursor-getmore-004.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/cursor/cursor-getmore-004.phpt
rename to mongodb-1.9.0/tests/cursor/cursor-getmore-004.phpt
diff --git a/mongodb-1.8.1/tests/cursor/cursor-getmore-005.phpt b/mongodb-1.9.0/tests/cursor/cursor-getmore-005.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/cursor/cursor-getmore-005.phpt
rename to mongodb-1.9.0/tests/cursor/cursor-getmore-005.phpt
diff --git a/mongodb-1.8.1/tests/cursor/cursor-getmore-006.phpt b/mongodb-1.9.0/tests/cursor/cursor-getmore-006.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/cursor/cursor-getmore-006.phpt
rename to mongodb-1.9.0/tests/cursor/cursor-getmore-006.phpt
diff --git a/mongodb-1.8.1/tests/cursor/cursor-getmore-007.phpt b/mongodb-1.9.0/tests/cursor/cursor-getmore-007.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/cursor/cursor-getmore-007.phpt
rename to mongodb-1.9.0/tests/cursor/cursor-getmore-007.phpt
diff --git a/mongodb-1.8.1/tests/cursor/cursor-getmore-008.phpt b/mongodb-1.9.0/tests/cursor/cursor-getmore-008.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/cursor/cursor-getmore-008.phpt
rename to mongodb-1.9.0/tests/cursor/cursor-getmore-008.phpt
diff --git a/mongodb-1.8.1/tests/cursor/cursor-isDead-001.phpt b/mongodb-1.9.0/tests/cursor/cursor-isDead-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/cursor/cursor-isDead-001.phpt
rename to mongodb-1.9.0/tests/cursor/cursor-isDead-001.phpt
diff --git a/mongodb-1.8.1/tests/cursor/cursor-isDead-002.phpt b/mongodb-1.9.0/tests/cursor/cursor-isDead-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/cursor/cursor-isDead-002.phpt
rename to mongodb-1.9.0/tests/cursor/cursor-isDead-002.phpt
diff --git a/mongodb-1.8.1/tests/cursor/cursor-isDead-003.phpt b/mongodb-1.9.0/tests/cursor/cursor-isDead-003.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/cursor/cursor-isDead-003.phpt
rename to mongodb-1.9.0/tests/cursor/cursor-isDead-003.phpt
diff --git a/mongodb-1.8.1/tests/cursor/cursor-isDead-004.phpt b/mongodb-1.9.0/tests/cursor/cursor-isDead-004.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/cursor/cursor-isDead-004.phpt
rename to mongodb-1.9.0/tests/cursor/cursor-isDead-004.phpt
diff --git a/mongodb-1.9.0/tests/cursor/cursor-iterator-001.phpt b/mongodb-1.9.0/tests/cursor/cursor-iterator-001.phpt
new file mode 100644
index 00000000..ef6ac601
--- /dev/null
+++ b/mongodb-1.9.0/tests/cursor/cursor-iterator-001.phpt
@@ -0,0 +1,61 @@
+--TEST--
+MongoDB\Driver\Cursor does not allow iterating multiple times (foreach)
+--SKIPIF--
+<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
+<?php skip_if_not_live(); ?>
+<?php skip_if_not_clean(); ?>
+--FILE--
+<?php
+require_once __DIR__ . "/../utils/basic.inc";
+
+$manager = new MongoDB\Driver\Manager(URI);
+
+$bulkWrite = new MongoDB\Driver\BulkWrite;
+
+for ($i = 0; $i < 3; $i++) {
+ $bulkWrite->insert(array('_id' => $i));
+}
+
+$writeResult = $manager->executeBulkWrite(NS, $bulkWrite);
+printf("Inserted: %d\n", $writeResult->getInsertedCount());
+
+$cursor = $manager->executeQuery(NS, new MongoDB\Driver\Query(array()));
+
+echo "\nFirst foreach statement:\n";
+
+foreach ($cursor as $document) {
+ var_dump($document);
+}
+
+echo "\nSecond foreach statement:\n";
+
+echo throws(function () use ($cursor) {
+ foreach ($cursor as $document) {
+ echo "FAILED: get_iterator should not yield multiple iterators\n";
+ }
+}, MongoDB\Driver\Exception\LogicException::class), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECTF--
+Inserted: 3
+
+First foreach statement:
+object(stdClass)#%d (1) {
+ ["_id"]=>
+ int(0)
+}
+object(stdClass)#%d (1) {
+ ["_id"]=>
+ int(1)
+}
+object(stdClass)#%d (1) {
+ ["_id"]=>
+ int(2)
+}
+
+Second foreach statement:
+OK: Got MongoDB\Driver\Exception\LogicException
+Cursors cannot rewind after starting iteration
+===DONE===
diff --git a/mongodb-1.9.0/tests/cursor/cursor-iterator-002.phpt b/mongodb-1.9.0/tests/cursor/cursor-iterator-002.phpt
new file mode 100644
index 00000000..b49525fc
--- /dev/null
+++ b/mongodb-1.9.0/tests/cursor/cursor-iterator-002.phpt
@@ -0,0 +1,62 @@
+--TEST--
+MongoDB\Driver\Cursor does not allow iterating multiple times (toArray())
+--SKIPIF--
+<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
+<?php skip_if_not_live(); ?>
+<?php skip_if_not_clean(); ?>
+--FILE--
+<?php
+require_once __DIR__ . "/../utils/basic.inc";
+
+$manager = new MongoDB\Driver\Manager(URI);
+
+$bulkWrite = new MongoDB\Driver\BulkWrite;
+
+for ($i = 0; $i < 3; $i++) {
+ $bulkWrite->insert(array('_id' => $i));
+}
+
+$writeResult = $manager->executeBulkWrite(NS, $bulkWrite);
+printf("Inserted: %d\n", $writeResult->getInsertedCount());
+
+$cursor = $manager->executeQuery(NS, new MongoDB\Driver\Query(array()));
+
+echo "\nFirst Cursor::toArray():\n";
+
+var_dump($cursor->toArray());
+
+echo "\nSecond Cursor::toArray():\n";
+
+echo throws(function () use ($cursor) {
+ var_dump($cursor->toArray());
+}, MongoDB\Driver\Exception\LogicException::class), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECTF--
+Inserted: 3
+
+First Cursor::toArray():
+array(3) {
+ [0]=>
+ object(stdClass)#%d (1) {
+ ["_id"]=>
+ int(0)
+ }
+ [1]=>
+ object(stdClass)#%d (1) {
+ ["_id"]=>
+ int(1)
+ }
+ [2]=>
+ object(stdClass)#%d (1) {
+ ["_id"]=>
+ int(2)
+ }
+}
+
+Second Cursor::toArray():
+OK: Got MongoDB\Driver\Exception\LogicException
+Cursors cannot rewind after starting iteration
+===DONE===
diff --git a/mongodb-1.8.1/tests/cursor/cursor-iterator_handlers-001.phpt b/mongodb-1.9.0/tests/cursor/cursor-iterator_handlers-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/cursor/cursor-iterator_handlers-001.phpt
rename to mongodb-1.9.0/tests/cursor/cursor-iterator_handlers-001.phpt
diff --git a/mongodb-1.8.1/tests/cursor/cursor-rewind-001.phpt b/mongodb-1.9.0/tests/cursor/cursor-rewind-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/cursor/cursor-rewind-001.phpt
rename to mongodb-1.9.0/tests/cursor/cursor-rewind-001.phpt
diff --git a/mongodb-1.8.1/tests/cursor/cursor-session-001.phpt b/mongodb-1.9.0/tests/cursor/cursor-session-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/cursor/cursor-session-001.phpt
rename to mongodb-1.9.0/tests/cursor/cursor-session-001.phpt
diff --git a/mongodb-1.8.1/tests/cursor/cursor-session-002.phpt b/mongodb-1.9.0/tests/cursor/cursor-session-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/cursor/cursor-session-002.phpt
rename to mongodb-1.9.0/tests/cursor/cursor-session-002.phpt
diff --git a/mongodb-1.8.1/tests/cursor/cursor-session-003.phpt b/mongodb-1.9.0/tests/cursor/cursor-session-003.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/cursor/cursor-session-003.phpt
rename to mongodb-1.9.0/tests/cursor/cursor-session-003.phpt
diff --git a/mongodb-1.8.1/tests/cursor/cursor-session-004.phpt b/mongodb-1.9.0/tests/cursor/cursor-session-004.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/cursor/cursor-session-004.phpt
rename to mongodb-1.9.0/tests/cursor/cursor-session-004.phpt
diff --git a/mongodb-1.8.1/tests/cursor/cursor-setTypeMap_error-001.phpt b/mongodb-1.9.0/tests/cursor/cursor-setTypeMap_error-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/cursor/cursor-setTypeMap_error-001.phpt
rename to mongodb-1.9.0/tests/cursor/cursor-setTypeMap_error-001.phpt
diff --git a/mongodb-1.8.1/tests/cursor/cursor-setTypeMap_error-002.phpt b/mongodb-1.9.0/tests/cursor/cursor-setTypeMap_error-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/cursor/cursor-setTypeMap_error-002.phpt
rename to mongodb-1.9.0/tests/cursor/cursor-setTypeMap_error-002.phpt
diff --git a/mongodb-1.8.1/tests/cursor/cursor-setTypeMap_error-003.phpt b/mongodb-1.9.0/tests/cursor/cursor-setTypeMap_error-003.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/cursor/cursor-setTypeMap_error-003.phpt
rename to mongodb-1.9.0/tests/cursor/cursor-setTypeMap_error-003.phpt
diff --git a/mongodb-1.8.1/tests/cursor/cursor-setTypeMap_error-004.phpt b/mongodb-1.9.0/tests/cursor/cursor-setTypeMap_error-004.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/cursor/cursor-setTypeMap_error-004.phpt
rename to mongodb-1.9.0/tests/cursor/cursor-setTypeMap_error-004.phpt
diff --git a/mongodb-1.8.1/tests/cursor/cursor-tailable-001.phpt b/mongodb-1.9.0/tests/cursor/cursor-tailable-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/cursor/cursor-tailable-001.phpt
rename to mongodb-1.9.0/tests/cursor/cursor-tailable-001.phpt
diff --git a/mongodb-1.8.1/tests/cursor/cursor-tailable-002.phpt b/mongodb-1.9.0/tests/cursor/cursor-tailable-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/cursor/cursor-tailable-002.phpt
rename to mongodb-1.9.0/tests/cursor/cursor-tailable-002.phpt
diff --git a/mongodb-1.8.1/tests/cursor/cursor-tailable-003.phpt b/mongodb-1.9.0/tests/cursor/cursor-tailable-003.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/cursor/cursor-tailable-003.phpt
rename to mongodb-1.9.0/tests/cursor/cursor-tailable-003.phpt
diff --git a/mongodb-1.8.1/tests/cursor/cursor-tailable_error-001.phpt b/mongodb-1.9.0/tests/cursor/cursor-tailable_error-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/cursor/cursor-tailable_error-001.phpt
rename to mongodb-1.9.0/tests/cursor/cursor-tailable_error-001.phpt
diff --git a/mongodb-1.8.1/tests/cursor/cursor-tailable_error-002.phpt b/mongodb-1.9.0/tests/cursor/cursor-tailable_error-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/cursor/cursor-tailable_error-002.phpt
rename to mongodb-1.9.0/tests/cursor/cursor-tailable_error-002.phpt
diff --git a/mongodb-1.8.1/tests/cursor/cursor-toArray-001.phpt b/mongodb-1.9.0/tests/cursor/cursor-toArray-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/cursor/cursor-toArray-001.phpt
rename to mongodb-1.9.0/tests/cursor/cursor-toArray-001.phpt
diff --git a/mongodb-1.8.1/tests/cursor/cursor-toArray-002.phpt b/mongodb-1.9.0/tests/cursor/cursor-toArray-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/cursor/cursor-toArray-002.phpt
rename to mongodb-1.9.0/tests/cursor/cursor-toArray-002.phpt
diff --git a/mongodb-1.8.1/tests/cursor/cursor_error-001.phpt b/mongodb-1.9.0/tests/cursor/cursor_error-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/cursor/cursor_error-001.phpt
rename to mongodb-1.9.0/tests/cursor/cursor_error-001.phpt
diff --git a/mongodb-1.8.1/tests/cursor/cursorinterface-001.phpt b/mongodb-1.9.0/tests/cursor/cursorinterface-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/cursor/cursorinterface-001.phpt
rename to mongodb-1.9.0/tests/cursor/cursorinterface-001.phpt
diff --git a/mongodb-1.8.1/tests/cursor/cursorinterface-002.phpt b/mongodb-1.9.0/tests/cursor/cursorinterface-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/cursor/cursorinterface-002.phpt
rename to mongodb-1.9.0/tests/cursor/cursorinterface-002.phpt
diff --git a/mongodb-1.9.0/tests/cursor/cursorinterface-003.phpt b/mongodb-1.9.0/tests/cursor/cursorinterface-003.phpt
new file mode 100644
index 00000000..7746f416
--- /dev/null
+++ b/mongodb-1.9.0/tests/cursor/cursorinterface-003.phpt
@@ -0,0 +1,11 @@
+--TEST--
+MongoDB\Driver\CursorInterface does not extend Iterator
+--FILE--
+<?php
+var_dump(in_array('Iterator', class_implements('MongoDB\Driver\CursorInterface')));
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+bool(false)
+===DONE===
diff --git a/mongodb-1.8.1/tests/cursorid/cursorid-001.phpt b/mongodb-1.9.0/tests/cursorid/cursorid-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/cursorid/cursorid-001.phpt
rename to mongodb-1.9.0/tests/cursorid/cursorid-001.phpt
diff --git a/mongodb-1.8.1/tests/cursorid/cursorid-002.phpt b/mongodb-1.9.0/tests/cursorid/cursorid-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/cursorid/cursorid-002.phpt
rename to mongodb-1.9.0/tests/cursorid/cursorid-002.phpt
diff --git a/mongodb-1.8.1/tests/cursorid/cursorid-serialization-001.phpt b/mongodb-1.9.0/tests/cursorid/cursorid-serialization-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/cursorid/cursorid-serialization-001.phpt
rename to mongodb-1.9.0/tests/cursorid/cursorid-serialization-001.phpt
diff --git a/mongodb-1.8.1/tests/cursorid/cursorid_error-001.phpt b/mongodb-1.9.0/tests/cursorid/cursorid_error-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/cursorid/cursorid_error-001.phpt
rename to mongodb-1.9.0/tests/cursorid/cursorid_error-001.phpt
diff --git a/mongodb-1.8.1/tests/exception/bulkwriteexception-getwriteresult-001.phpt b/mongodb-1.9.0/tests/exception/bulkwriteexception-getwriteresult-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/exception/bulkwriteexception-getwriteresult-001.phpt
rename to mongodb-1.9.0/tests/exception/bulkwriteexception-getwriteresult-001.phpt
diff --git a/mongodb-1.8.1/tests/exception/bulkwriteexception-haserrorlabel-001.phpt b/mongodb-1.9.0/tests/exception/bulkwriteexception-haserrorlabel-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/exception/bulkwriteexception-haserrorlabel-001.phpt
rename to mongodb-1.9.0/tests/exception/bulkwriteexception-haserrorlabel-001.phpt
diff --git a/mongodb-1.8.1/tests/exception/bulkwriteexception-haserrorlabel-002.phpt b/mongodb-1.9.0/tests/exception/bulkwriteexception-haserrorlabel-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/exception/bulkwriteexception-haserrorlabel-002.phpt
rename to mongodb-1.9.0/tests/exception/bulkwriteexception-haserrorlabel-002.phpt
diff --git a/mongodb-1.8.1/tests/exception/bulkwriteexception-haserrorlabel_error-001.phpt b/mongodb-1.9.0/tests/exception/bulkwriteexception-haserrorlabel_error-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/exception/bulkwriteexception-haserrorlabel_error-001.phpt
rename to mongodb-1.9.0/tests/exception/bulkwriteexception-haserrorlabel_error-001.phpt
diff --git a/mongodb-1.8.1/tests/exception/commandexception-getresultdocument-001.phpt b/mongodb-1.9.0/tests/exception/commandexception-getresultdocument-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/exception/commandexception-getresultdocument-001.phpt
rename to mongodb-1.9.0/tests/exception/commandexception-getresultdocument-001.phpt
diff --git a/mongodb-1.8.1/tests/exception/commandexception-haserrorlabel-001.phpt b/mongodb-1.9.0/tests/exception/commandexception-haserrorlabel-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/exception/commandexception-haserrorlabel-001.phpt
rename to mongodb-1.9.0/tests/exception/commandexception-haserrorlabel-001.phpt
diff --git a/mongodb-1.8.1/tests/exception/commandexception-haserrorlabel_error-001.phpt b/mongodb-1.9.0/tests/exception/commandexception-haserrorlabel_error-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/exception/commandexception-haserrorlabel_error-001.phpt
rename to mongodb-1.9.0/tests/exception/commandexception-haserrorlabel_error-001.phpt
diff --git a/mongodb-1.8.1/tests/exception/exception-001.phpt b/mongodb-1.9.0/tests/exception/exception-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/exception/exception-001.phpt
rename to mongodb-1.9.0/tests/exception/exception-001.phpt
diff --git a/mongodb-1.8.1/tests/exception/runtimeexception-haserrorlabel-001.phpt b/mongodb-1.9.0/tests/exception/runtimeexception-haserrorlabel-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/exception/runtimeexception-haserrorlabel-001.phpt
rename to mongodb-1.9.0/tests/exception/runtimeexception-haserrorlabel-001.phpt
diff --git a/mongodb-1.8.1/tests/exception/runtimeexception-haserrorlabel_error-001.phpt b/mongodb-1.9.0/tests/exception/runtimeexception-haserrorlabel_error-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/exception/runtimeexception-haserrorlabel_error-001.phpt
rename to mongodb-1.9.0/tests/exception/runtimeexception-haserrorlabel_error-001.phpt
diff --git a/mongodb-1.8.1/tests/functional/cursor-001.phpt b/mongodb-1.9.0/tests/functional/cursor-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/functional/cursor-001.phpt
rename to mongodb-1.9.0/tests/functional/cursor-001.phpt
diff --git a/mongodb-1.8.1/tests/functional/cursorid-001.phpt b/mongodb-1.9.0/tests/functional/cursorid-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/functional/cursorid-001.phpt
rename to mongodb-1.9.0/tests/functional/cursorid-001.phpt
diff --git a/mongodb-1.8.1/tests/functional/phpinfo-1.phpt b/mongodb-1.9.0/tests/functional/phpinfo-1.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/functional/phpinfo-1.phpt
rename to mongodb-1.9.0/tests/functional/phpinfo-1.phpt
diff --git a/mongodb-1.8.1/tests/functional/phpinfo-2.phpt b/mongodb-1.9.0/tests/functional/phpinfo-2.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/functional/phpinfo-2.phpt
rename to mongodb-1.9.0/tests/functional/phpinfo-2.phpt
diff --git a/mongodb-1.8.1/tests/functional/query-sort-001.phpt b/mongodb-1.9.0/tests/functional/query-sort-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/functional/query-sort-001.phpt
rename to mongodb-1.9.0/tests/functional/query-sort-001.phpt
diff --git a/mongodb-1.8.1/tests/functional/query-sort-002.phpt b/mongodb-1.9.0/tests/functional/query-sort-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/functional/query-sort-002.phpt
rename to mongodb-1.9.0/tests/functional/query-sort-002.phpt
diff --git a/mongodb-1.8.1/tests/functional/query-sort-003.phpt b/mongodb-1.9.0/tests/functional/query-sort-003.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/functional/query-sort-003.phpt
rename to mongodb-1.9.0/tests/functional/query-sort-003.phpt
diff --git a/mongodb-1.8.1/tests/functional/query-sort-004.phpt b/mongodb-1.9.0/tests/functional/query-sort-004.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/functional/query-sort-004.phpt
rename to mongodb-1.9.0/tests/functional/query-sort-004.phpt
diff --git a/mongodb-1.8.1/tests/manager/bug0572.phpt b/mongodb-1.9.0/tests/manager/bug0572.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/manager/bug0572.phpt
rename to mongodb-1.9.0/tests/manager/bug0572.phpt
diff --git a/mongodb-1.8.1/tests/manager/bug0851-001.phpt b/mongodb-1.9.0/tests/manager/bug0851-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/manager/bug0851-001.phpt
rename to mongodb-1.9.0/tests/manager/bug0851-001.phpt
diff --git a/mongodb-1.8.1/tests/manager/bug0851-002.phpt b/mongodb-1.9.0/tests/manager/bug0851-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/manager/bug0851-002.phpt
rename to mongodb-1.9.0/tests/manager/bug0851-002.phpt
diff --git a/mongodb-1.8.1/tests/manager/bug0912-001.phpt b/mongodb-1.9.0/tests/manager/bug0912-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/manager/bug0912-001.phpt
rename to mongodb-1.9.0/tests/manager/bug0912-001.phpt
diff --git a/mongodb-1.8.1/tests/manager/bug0913-001.phpt b/mongodb-1.9.0/tests/manager/bug0913-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/manager/bug0913-001.phpt
rename to mongodb-1.9.0/tests/manager/bug0913-001.phpt
diff --git a/mongodb-1.8.1/tests/manager/bug0940-001.phpt b/mongodb-1.9.0/tests/manager/bug0940-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/manager/bug0940-001.phpt
rename to mongodb-1.9.0/tests/manager/bug0940-001.phpt
diff --git a/mongodb-1.8.1/tests/manager/bug0940-002.phpt b/mongodb-1.9.0/tests/manager/bug0940-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/manager/bug0940-002.phpt
rename to mongodb-1.9.0/tests/manager/bug0940-002.phpt
diff --git a/mongodb-1.8.1/tests/manager/bug1163-001.phpt b/mongodb-1.9.0/tests/manager/bug1163-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/manager/bug1163-001.phpt
rename to mongodb-1.9.0/tests/manager/bug1163-001.phpt
diff --git a/mongodb-1.9.0/tests/manager/bug1701-001.phpt b/mongodb-1.9.0/tests/manager/bug1701-001.phpt
new file mode 100644
index 00000000..a7e147ac
--- /dev/null
+++ b/mongodb-1.9.0/tests/manager/bug1701-001.phpt
@@ -0,0 +1,23 @@
+--TEST--
+PHPC-1701: prep_authmechanismproperties may leak if Manager ctor errors
+--FILE--
+<?php
+
+require_once __DIR__ . "/../utils/basic.inc";
+
+echo throws(function () {
+ // Using a stream context without SSL options causes an exception in the constructor, triggering the potential leak
+ new MongoDB\Driver\Manager(
+ null,
+ ['username' => 'username', 'authMechanism' => 'GSSAPI', 'authMechanismProperties' => ['canonicalize_host_name' => true]],
+ ['context' => stream_context_create([])]
+ );
+}, "MongoDB\Driver\Exception\InvalidArgumentException"), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+OK: Got MongoDB\Driver\Exception\InvalidArgumentException
+Stream-Context resource does not contain "ssl" options array
+===DONE===
diff --git a/mongodb-1.8.1/tests/manager/manager-createClientEncryption-001.phpt b/mongodb-1.9.0/tests/manager/manager-createClientEncryption-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/manager/manager-createClientEncryption-001.phpt
rename to mongodb-1.9.0/tests/manager/manager-createClientEncryption-001.phpt
diff --git a/mongodb-1.8.1/tests/manager/manager-createClientEncryption-error-001.phpt b/mongodb-1.9.0/tests/manager/manager-createClientEncryption-error-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/manager/manager-createClientEncryption-error-001.phpt
rename to mongodb-1.9.0/tests/manager/manager-createClientEncryption-error-001.phpt
diff --git a/mongodb-1.8.1/tests/manager/manager-createClientEncryption-error-002.phpt b/mongodb-1.9.0/tests/manager/manager-createClientEncryption-error-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/manager/manager-createClientEncryption-error-002.phpt
rename to mongodb-1.9.0/tests/manager/manager-createClientEncryption-error-002.phpt
diff --git a/mongodb-1.8.1/tests/manager/manager-ctor-001.phpt b/mongodb-1.9.0/tests/manager/manager-ctor-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/manager/manager-ctor-001.phpt
rename to mongodb-1.9.0/tests/manager/manager-ctor-001.phpt
diff --git a/mongodb-1.8.1/tests/manager/manager-ctor-002.phpt b/mongodb-1.9.0/tests/manager/manager-ctor-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/manager/manager-ctor-002.phpt
rename to mongodb-1.9.0/tests/manager/manager-ctor-002.phpt
diff --git a/mongodb-1.8.1/tests/manager/manager-ctor-003.phpt b/mongodb-1.9.0/tests/manager/manager-ctor-003.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/manager/manager-ctor-003.phpt
rename to mongodb-1.9.0/tests/manager/manager-ctor-003.phpt
diff --git a/mongodb-1.8.1/tests/manager/manager-ctor-004.phpt b/mongodb-1.9.0/tests/manager/manager-ctor-004.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/manager/manager-ctor-004.phpt
rename to mongodb-1.9.0/tests/manager/manager-ctor-004.phpt
diff --git a/mongodb-1.8.1/tests/manager/manager-ctor-005.phpt b/mongodb-1.9.0/tests/manager/manager-ctor-005.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/manager/manager-ctor-005.phpt
rename to mongodb-1.9.0/tests/manager/manager-ctor-005.phpt
diff --git a/mongodb-1.8.1/tests/manager/manager-ctor-006.phpt b/mongodb-1.9.0/tests/manager/manager-ctor-006.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/manager/manager-ctor-006.phpt
rename to mongodb-1.9.0/tests/manager/manager-ctor-006.phpt
diff --git a/mongodb-1.8.1/tests/manager/manager-ctor-appname-001.phpt b/mongodb-1.9.0/tests/manager/manager-ctor-appname-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/manager/manager-ctor-appname-001.phpt
rename to mongodb-1.9.0/tests/manager/manager-ctor-appname-001.phpt
diff --git a/mongodb-1.8.1/tests/manager/manager-ctor-appname_error-001.phpt b/mongodb-1.9.0/tests/manager/manager-ctor-appname_error-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/manager/manager-ctor-appname_error-001.phpt
rename to mongodb-1.9.0/tests/manager/manager-ctor-appname_error-001.phpt
diff --git a/mongodb-1.8.1/tests/manager/manager-ctor-auth_mechanism-001.phpt b/mongodb-1.9.0/tests/manager/manager-ctor-auth_mechanism-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/manager/manager-ctor-auth_mechanism-001.phpt
rename to mongodb-1.9.0/tests/manager/manager-ctor-auth_mechanism-001.phpt
diff --git a/mongodb-1.8.1/tests/manager/manager-ctor-auth_mechanism-002.phpt b/mongodb-1.9.0/tests/manager/manager-ctor-auth_mechanism-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/manager/manager-ctor-auth_mechanism-002.phpt
rename to mongodb-1.9.0/tests/manager/manager-ctor-auth_mechanism-002.phpt
diff --git a/mongodb-1.8.1/tests/manager/manager-ctor-auth_mechanism-error-001.phpt b/mongodb-1.9.0/tests/manager/manager-ctor-auth_mechanism-error-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/manager/manager-ctor-auth_mechanism-error-001.phpt
rename to mongodb-1.9.0/tests/manager/manager-ctor-auth_mechanism-error-001.phpt
diff --git a/mongodb-1.8.1/tests/manager/manager-ctor-auth_source-001.phpt b/mongodb-1.9.0/tests/manager/manager-ctor-auth_source-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/manager/manager-ctor-auth_source-001.phpt
rename to mongodb-1.9.0/tests/manager/manager-ctor-auth_source-001.phpt
diff --git a/mongodb-1.8.1/tests/manager/manager-ctor-auto_encryption-001.phpt b/mongodb-1.9.0/tests/manager/manager-ctor-auto_encryption-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/manager/manager-ctor-auto_encryption-001.phpt
rename to mongodb-1.9.0/tests/manager/manager-ctor-auto_encryption-001.phpt
diff --git a/mongodb-1.8.1/tests/manager/manager-ctor-auto_encryption-error-001.phpt b/mongodb-1.9.0/tests/manager/manager-ctor-auto_encryption-error-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/manager/manager-ctor-auto_encryption-error-001.phpt
rename to mongodb-1.9.0/tests/manager/manager-ctor-auto_encryption-error-001.phpt
diff --git a/mongodb-1.8.1/tests/manager/manager-ctor-auto_encryption-error-002.phpt b/mongodb-1.9.0/tests/manager/manager-ctor-auto_encryption-error-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/manager/manager-ctor-auto_encryption-error-002.phpt
rename to mongodb-1.9.0/tests/manager/manager-ctor-auto_encryption-error-002.phpt
diff --git a/mongodb-1.8.1/tests/manager/manager-ctor-auto_encryption-error-003.phpt b/mongodb-1.9.0/tests/manager/manager-ctor-auto_encryption-error-003.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/manager/manager-ctor-auto_encryption-error-003.phpt
rename to mongodb-1.9.0/tests/manager/manager-ctor-auto_encryption-error-003.phpt
diff --git a/mongodb-1.8.1/tests/manager/manager-ctor-directconnection-001.phpt b/mongodb-1.9.0/tests/manager/manager-ctor-directconnection-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/manager/manager-ctor-directconnection-001.phpt
rename to mongodb-1.9.0/tests/manager/manager-ctor-directconnection-001.phpt
diff --git a/mongodb-1.8.1/tests/manager/manager-ctor-directconnection-error-001.phpt b/mongodb-1.9.0/tests/manager/manager-ctor-directconnection-error-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/manager/manager-ctor-directconnection-error-001.phpt
rename to mongodb-1.9.0/tests/manager/manager-ctor-directconnection-error-001.phpt
diff --git a/mongodb-1.8.1/tests/manager/manager-ctor-directconnection-error-002.phpt b/mongodb-1.9.0/tests/manager/manager-ctor-directconnection-error-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/manager/manager-ctor-directconnection-error-002.phpt
rename to mongodb-1.9.0/tests/manager/manager-ctor-directconnection-error-002.phpt
diff --git a/mongodb-1.8.1/tests/manager/manager-ctor-driver-metadata-001.phpt b/mongodb-1.9.0/tests/manager/manager-ctor-driver-metadata-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/manager/manager-ctor-driver-metadata-001.phpt
rename to mongodb-1.9.0/tests/manager/manager-ctor-driver-metadata-001.phpt
diff --git a/mongodb-1.8.1/tests/manager/manager-ctor-duplicate-option-001.phpt b/mongodb-1.9.0/tests/manager/manager-ctor-duplicate-option-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/manager/manager-ctor-duplicate-option-001.phpt
rename to mongodb-1.9.0/tests/manager/manager-ctor-duplicate-option-001.phpt
diff --git a/mongodb-1.8.1/tests/manager/manager-ctor-duplicate-option-002.phpt b/mongodb-1.9.0/tests/manager/manager-ctor-duplicate-option-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/manager/manager-ctor-duplicate-option-002.phpt
rename to mongodb-1.9.0/tests/manager/manager-ctor-duplicate-option-002.phpt
diff --git a/mongodb-1.8.1/tests/manager/manager-ctor-duplicate-option-003.phpt b/mongodb-1.9.0/tests/manager/manager-ctor-duplicate-option-003.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/manager/manager-ctor-duplicate-option-003.phpt
rename to mongodb-1.9.0/tests/manager/manager-ctor-duplicate-option-003.phpt
diff --git a/mongodb-1.8.1/tests/manager/manager-ctor-duplicate-option-004.phpt b/mongodb-1.9.0/tests/manager/manager-ctor-duplicate-option-004.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/manager/manager-ctor-duplicate-option-004.phpt
rename to mongodb-1.9.0/tests/manager/manager-ctor-duplicate-option-004.phpt
diff --git a/mongodb-1.8.1/tests/manager/manager-ctor-read_concern-001.phpt b/mongodb-1.9.0/tests/manager/manager-ctor-read_concern-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/manager/manager-ctor-read_concern-001.phpt
rename to mongodb-1.9.0/tests/manager/manager-ctor-read_concern-001.phpt
diff --git a/mongodb-1.8.1/tests/manager/manager-ctor-read_concern-error-001.phpt b/mongodb-1.9.0/tests/manager/manager-ctor-read_concern-error-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/manager/manager-ctor-read_concern-error-001.phpt
rename to mongodb-1.9.0/tests/manager/manager-ctor-read_concern-error-001.phpt
diff --git a/mongodb-1.8.1/tests/manager/manager-ctor-read_preference-001.phpt b/mongodb-1.9.0/tests/manager/manager-ctor-read_preference-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/manager/manager-ctor-read_preference-001.phpt
rename to mongodb-1.9.0/tests/manager/manager-ctor-read_preference-001.phpt
diff --git a/mongodb-1.8.1/tests/manager/manager-ctor-read_preference-002.phpt b/mongodb-1.9.0/tests/manager/manager-ctor-read_preference-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/manager/manager-ctor-read_preference-002.phpt
rename to mongodb-1.9.0/tests/manager/manager-ctor-read_preference-002.phpt
diff --git a/mongodb-1.8.1/tests/manager/manager-ctor-read_preference-004.phpt b/mongodb-1.9.0/tests/manager/manager-ctor-read_preference-004.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/manager/manager-ctor-read_preference-004.phpt
rename to mongodb-1.9.0/tests/manager/manager-ctor-read_preference-004.phpt
diff --git a/mongodb-1.8.1/tests/manager/manager-ctor-read_preference-error-001.phpt b/mongodb-1.9.0/tests/manager/manager-ctor-read_preference-error-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/manager/manager-ctor-read_preference-error-001.phpt
rename to mongodb-1.9.0/tests/manager/manager-ctor-read_preference-error-001.phpt
diff --git a/mongodb-1.8.1/tests/manager/manager-ctor-read_preference-error-002.phpt b/mongodb-1.9.0/tests/manager/manager-ctor-read_preference-error-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/manager/manager-ctor-read_preference-error-002.phpt
rename to mongodb-1.9.0/tests/manager/manager-ctor-read_preference-error-002.phpt
diff --git a/mongodb-1.8.1/tests/manager/manager-ctor-read_preference-error-003.phpt b/mongodb-1.9.0/tests/manager/manager-ctor-read_preference-error-003.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/manager/manager-ctor-read_preference-error-003.phpt
rename to mongodb-1.9.0/tests/manager/manager-ctor-read_preference-error-003.phpt
diff --git a/mongodb-1.8.1/tests/manager/manager-ctor-read_preference-error-004.phpt b/mongodb-1.9.0/tests/manager/manager-ctor-read_preference-error-004.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/manager/manager-ctor-read_preference-error-004.phpt
rename to mongodb-1.9.0/tests/manager/manager-ctor-read_preference-error-004.phpt
diff --git a/mongodb-1.8.1/tests/manager/manager-ctor-server.phpt b/mongodb-1.9.0/tests/manager/manager-ctor-server.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/manager/manager-ctor-server.phpt
rename to mongodb-1.9.0/tests/manager/manager-ctor-server.phpt
diff --git a/mongodb-1.8.1/tests/manager/manager-ctor-ssl-001.phpt b/mongodb-1.9.0/tests/manager/manager-ctor-ssl-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/manager/manager-ctor-ssl-001.phpt
rename to mongodb-1.9.0/tests/manager/manager-ctor-ssl-001.phpt
diff --git a/mongodb-1.8.1/tests/manager/manager-ctor-ssl-002.phpt b/mongodb-1.9.0/tests/manager/manager-ctor-ssl-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/manager/manager-ctor-ssl-002.phpt
rename to mongodb-1.9.0/tests/manager/manager-ctor-ssl-002.phpt
diff --git a/mongodb-1.8.1/tests/manager/manager-ctor-ssl-003.phpt b/mongodb-1.9.0/tests/manager/manager-ctor-ssl-003.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/manager/manager-ctor-ssl-003.phpt
rename to mongodb-1.9.0/tests/manager/manager-ctor-ssl-003.phpt
diff --git a/mongodb-1.8.1/tests/manager/manager-ctor-ssl-deprecated-001.phpt b/mongodb-1.9.0/tests/manager/manager-ctor-ssl-deprecated-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/manager/manager-ctor-ssl-deprecated-001.phpt
rename to mongodb-1.9.0/tests/manager/manager-ctor-ssl-deprecated-001.phpt
diff --git a/mongodb-1.8.1/tests/manager/manager-ctor-ssl-deprecated-002.phpt b/mongodb-1.9.0/tests/manager/manager-ctor-ssl-deprecated-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/manager/manager-ctor-ssl-deprecated-002.phpt
rename to mongodb-1.9.0/tests/manager/manager-ctor-ssl-deprecated-002.phpt
diff --git a/mongodb-1.8.1/tests/manager/manager-ctor-tls-error-001.phpt b/mongodb-1.9.0/tests/manager/manager-ctor-tls-error-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/manager/manager-ctor-tls-error-001.phpt
rename to mongodb-1.9.0/tests/manager/manager-ctor-tls-error-001.phpt
diff --git a/mongodb-1.8.1/tests/manager/manager-ctor-wireversion.phpt b/mongodb-1.9.0/tests/manager/manager-ctor-wireversion.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/manager/manager-ctor-wireversion.phpt
rename to mongodb-1.9.0/tests/manager/manager-ctor-wireversion.phpt
diff --git a/mongodb-1.8.1/tests/manager/manager-ctor-write_concern-001.phpt b/mongodb-1.9.0/tests/manager/manager-ctor-write_concern-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/manager/manager-ctor-write_concern-001.phpt
rename to mongodb-1.9.0/tests/manager/manager-ctor-write_concern-001.phpt
diff --git a/mongodb-1.8.1/tests/manager/manager-ctor-write_concern-002.phpt b/mongodb-1.9.0/tests/manager/manager-ctor-write_concern-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/manager/manager-ctor-write_concern-002.phpt
rename to mongodb-1.9.0/tests/manager/manager-ctor-write_concern-002.phpt
diff --git a/mongodb-1.8.1/tests/manager/manager-ctor-write_concern-003.phpt b/mongodb-1.9.0/tests/manager/manager-ctor-write_concern-003.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/manager/manager-ctor-write_concern-003.phpt
rename to mongodb-1.9.0/tests/manager/manager-ctor-write_concern-003.phpt
diff --git a/mongodb-1.8.1/tests/manager/manager-ctor-write_concern-004.phpt b/mongodb-1.9.0/tests/manager/manager-ctor-write_concern-004.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/manager/manager-ctor-write_concern-004.phpt
rename to mongodb-1.9.0/tests/manager/manager-ctor-write_concern-004.phpt
diff --git a/mongodb-1.8.1/tests/manager/manager-ctor-write_concern-005.phpt b/mongodb-1.9.0/tests/manager/manager-ctor-write_concern-005.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/manager/manager-ctor-write_concern-005.phpt
rename to mongodb-1.9.0/tests/manager/manager-ctor-write_concern-005.phpt
diff --git a/mongodb-1.8.1/tests/manager/manager-ctor-write_concern-006.phpt b/mongodb-1.9.0/tests/manager/manager-ctor-write_concern-006.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/manager/manager-ctor-write_concern-006.phpt
rename to mongodb-1.9.0/tests/manager/manager-ctor-write_concern-006.phpt
diff --git a/mongodb-1.8.1/tests/manager/manager-ctor-write_concern-error-001.phpt b/mongodb-1.9.0/tests/manager/manager-ctor-write_concern-error-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/manager/manager-ctor-write_concern-error-001.phpt
rename to mongodb-1.9.0/tests/manager/manager-ctor-write_concern-error-001.phpt
diff --git a/mongodb-1.8.1/tests/manager/manager-ctor-write_concern-error-002.phpt b/mongodb-1.9.0/tests/manager/manager-ctor-write_concern-error-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/manager/manager-ctor-write_concern-error-002.phpt
rename to mongodb-1.9.0/tests/manager/manager-ctor-write_concern-error-002.phpt
diff --git a/mongodb-1.8.1/tests/manager/manager-ctor-write_concern-error-003.phpt b/mongodb-1.9.0/tests/manager/manager-ctor-write_concern-error-003.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/manager/manager-ctor-write_concern-error-003.phpt
rename to mongodb-1.9.0/tests/manager/manager-ctor-write_concern-error-003.phpt
diff --git a/mongodb-1.8.1/tests/manager/manager-ctor-write_concern-error-005.phpt b/mongodb-1.9.0/tests/manager/manager-ctor-write_concern-error-005.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/manager/manager-ctor-write_concern-error-005.phpt
rename to mongodb-1.9.0/tests/manager/manager-ctor-write_concern-error-005.phpt
diff --git a/mongodb-1.8.1/tests/manager/manager-ctor-write_concern-error-006.phpt b/mongodb-1.9.0/tests/manager/manager-ctor-write_concern-error-006.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/manager/manager-ctor-write_concern-error-006.phpt
rename to mongodb-1.9.0/tests/manager/manager-ctor-write_concern-error-006.phpt
diff --git a/mongodb-1.8.1/tests/manager/manager-ctor-write_concern-error-007.phpt b/mongodb-1.9.0/tests/manager/manager-ctor-write_concern-error-007.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/manager/manager-ctor-write_concern-error-007.phpt
rename to mongodb-1.9.0/tests/manager/manager-ctor-write_concern-error-007.phpt
diff --git a/mongodb-1.9.0/tests/manager/manager-ctor_error-001.phpt b/mongodb-1.9.0/tests/manager/manager-ctor_error-001.phpt
new file mode 100644
index 00000000..f6f87e22
--- /dev/null
+++ b/mongodb-1.9.0/tests/manager/manager-ctor_error-001.phpt
@@ -0,0 +1,21 @@
+--TEST--
+MongoDB\Driver\Manager::__construct(): too many arguments
+--SKIPIF--
+<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
+<?php skip_if_php_version('>=', '7.99'); ?>
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+echo throws(function() {
+ $manager = new MongoDB\Driver\Manager(null, [], [], 1);
+}, MongoDB\Driver\Exception\InvalidArgumentException::class), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECTF--
+OK: Got MongoDB\Driver\Exception\InvalidArgumentException
+MongoDB\Driver\Manager::__construct() expects at most 3 %r(argument|parameter)%rs, 4 given
+===DONE===
diff --git a/mongodb-1.8.1/tests/manager/manager-ctor_error-002.phpt b/mongodb-1.9.0/tests/manager/manager-ctor_error-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/manager/manager-ctor_error-002.phpt
rename to mongodb-1.9.0/tests/manager/manager-ctor_error-002.phpt
diff --git a/mongodb-1.8.1/tests/manager/manager-ctor_error-003.phpt b/mongodb-1.9.0/tests/manager/manager-ctor_error-003.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/manager/manager-ctor_error-003.phpt
rename to mongodb-1.9.0/tests/manager/manager-ctor_error-003.phpt
diff --git a/mongodb-1.8.1/tests/manager/manager-ctor_error-004.phpt b/mongodb-1.9.0/tests/manager/manager-ctor_error-004.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/manager/manager-ctor_error-004.phpt
rename to mongodb-1.9.0/tests/manager/manager-ctor_error-004.phpt
diff --git a/mongodb-1.8.1/tests/manager/manager-ctor_error-005.phpt b/mongodb-1.9.0/tests/manager/manager-ctor_error-005.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/manager/manager-ctor_error-005.phpt
rename to mongodb-1.9.0/tests/manager/manager-ctor_error-005.phpt
diff --git a/mongodb-1.8.1/tests/manager/manager-debug-001.phpt b/mongodb-1.9.0/tests/manager/manager-debug-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/manager/manager-debug-001.phpt
rename to mongodb-1.9.0/tests/manager/manager-debug-001.phpt
diff --git a/mongodb-1.8.1/tests/manager/manager-debug-002.phpt b/mongodb-1.9.0/tests/manager/manager-debug-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/manager/manager-debug-002.phpt
rename to mongodb-1.9.0/tests/manager/manager-debug-002.phpt
diff --git a/mongodb-1.8.1/tests/manager/manager-debug-003.phpt b/mongodb-1.9.0/tests/manager/manager-debug-003.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/manager/manager-debug-003.phpt
rename to mongodb-1.9.0/tests/manager/manager-debug-003.phpt
diff --git a/mongodb-1.8.1/tests/manager/manager-destruct-001.phpt b/mongodb-1.9.0/tests/manager/manager-destruct-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/manager/manager-destruct-001.phpt
rename to mongodb-1.9.0/tests/manager/manager-destruct-001.phpt
diff --git a/mongodb-1.8.1/tests/manager/manager-executeBulkWrite-001.phpt b/mongodb-1.9.0/tests/manager/manager-executeBulkWrite-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/manager/manager-executeBulkWrite-001.phpt
rename to mongodb-1.9.0/tests/manager/manager-executeBulkWrite-001.phpt
diff --git a/mongodb-1.8.1/tests/manager/manager-executeBulkWrite-002.phpt b/mongodb-1.9.0/tests/manager/manager-executeBulkWrite-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/manager/manager-executeBulkWrite-002.phpt
rename to mongodb-1.9.0/tests/manager/manager-executeBulkWrite-002.phpt
diff --git a/mongodb-1.8.1/tests/manager/manager-executeBulkWrite-003.phpt b/mongodb-1.9.0/tests/manager/manager-executeBulkWrite-003.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/manager/manager-executeBulkWrite-003.phpt
rename to mongodb-1.9.0/tests/manager/manager-executeBulkWrite-003.phpt
diff --git a/mongodb-1.8.1/tests/manager/manager-executeBulkWrite-004.phpt b/mongodb-1.9.0/tests/manager/manager-executeBulkWrite-004.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/manager/manager-executeBulkWrite-004.phpt
rename to mongodb-1.9.0/tests/manager/manager-executeBulkWrite-004.phpt
diff --git a/mongodb-1.8.1/tests/manager/manager-executeBulkWrite-005.phpt b/mongodb-1.9.0/tests/manager/manager-executeBulkWrite-005.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/manager/manager-executeBulkWrite-005.phpt
rename to mongodb-1.9.0/tests/manager/manager-executeBulkWrite-005.phpt
diff --git a/mongodb-1.8.1/tests/manager/manager-executeBulkWrite-006.phpt b/mongodb-1.9.0/tests/manager/manager-executeBulkWrite-006.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/manager/manager-executeBulkWrite-006.phpt
rename to mongodb-1.9.0/tests/manager/manager-executeBulkWrite-006.phpt
diff --git a/mongodb-1.8.1/tests/manager/manager-executeBulkWrite-007.phpt b/mongodb-1.9.0/tests/manager/manager-executeBulkWrite-007.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/manager/manager-executeBulkWrite-007.phpt
rename to mongodb-1.9.0/tests/manager/manager-executeBulkWrite-007.phpt
diff --git a/mongodb-1.8.1/tests/manager/manager-executeBulkWrite-008.phpt b/mongodb-1.9.0/tests/manager/manager-executeBulkWrite-008.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/manager/manager-executeBulkWrite-008.phpt
rename to mongodb-1.9.0/tests/manager/manager-executeBulkWrite-008.phpt
diff --git a/mongodb-1.8.1/tests/manager/manager-executeBulkWrite-009.phpt b/mongodb-1.9.0/tests/manager/manager-executeBulkWrite-009.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/manager/manager-executeBulkWrite-009.phpt
rename to mongodb-1.9.0/tests/manager/manager-executeBulkWrite-009.phpt
diff --git a/mongodb-1.8.1/tests/manager/manager-executeBulkWrite-010.phpt b/mongodb-1.9.0/tests/manager/manager-executeBulkWrite-010.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/manager/manager-executeBulkWrite-010.phpt
rename to mongodb-1.9.0/tests/manager/manager-executeBulkWrite-010.phpt
diff --git a/mongodb-1.8.1/tests/manager/manager-executeBulkWrite-011.phpt b/mongodb-1.9.0/tests/manager/manager-executeBulkWrite-011.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/manager/manager-executeBulkWrite-011.phpt
rename to mongodb-1.9.0/tests/manager/manager-executeBulkWrite-011.phpt
diff --git a/mongodb-1.8.1/tests/manager/manager-executeBulkWrite-012.phpt b/mongodb-1.9.0/tests/manager/manager-executeBulkWrite-012.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/manager/manager-executeBulkWrite-012.phpt
rename to mongodb-1.9.0/tests/manager/manager-executeBulkWrite-012.phpt
diff --git a/mongodb-1.8.1/tests/manager/manager-executeBulkWrite-013.phpt b/mongodb-1.9.0/tests/manager/manager-executeBulkWrite-013.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/manager/manager-executeBulkWrite-013.phpt
rename to mongodb-1.9.0/tests/manager/manager-executeBulkWrite-013.phpt
diff --git a/mongodb-1.9.0/tests/manager/manager-executeBulkWrite-014.phpt b/mongodb-1.9.0/tests/manager/manager-executeBulkWrite-014.phpt
new file mode 100644
index 00000000..62203ac7
--- /dev/null
+++ b/mongodb-1.9.0/tests/manager/manager-executeBulkWrite-014.phpt
@@ -0,0 +1,36 @@
+--TEST--
+MongoDB\Driver\Manager::executeBulkWrite() write concern inheritance
+--SKIPIF--
+<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
+<?php skip_if_not_replica_set(); ?>
+<?php skip_if_not_enough_data_nodes(2); /* w:2 */ ?>
+<?php skip_if_not_clean(); ?>
+--FILE--
+<?php
+require_once __DIR__ . "/../utils/basic.inc";
+require_once __DIR__ . "/../utils/observer.php";
+
+$manager = new MongoDB\Driver\Manager(URI, ['w' => 2, 'wtimeoutms' => 1000]);
+
+(new CommandObserver)->observe(
+ function() use ($manager) {
+ $bulk = new MongoDB\Driver\BulkWrite;
+ $bulk->insert(['x' => 1]);
+ $manager->executeBulkWrite(NS, $bulk);
+
+ $bulk = new MongoDB\Driver\BulkWrite;
+ $bulk->insert(['x' => 1]);
+ $manager->executeBulkWrite(NS, $bulk, ['writeConcern' => new MongoDB\Driver\WriteConcern(1)]);
+ },
+ function(stdClass $command) {
+ echo json_encode($command->writeConcern), "\n";
+ }
+);
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+{"w":2,"wtimeout":1000}
+{"w":1}
+===DONE===
diff --git a/mongodb-1.8.1/tests/manager/manager-executeBulkWrite_error-001.phpt b/mongodb-1.9.0/tests/manager/manager-executeBulkWrite_error-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/manager/manager-executeBulkWrite_error-001.phpt
rename to mongodb-1.9.0/tests/manager/manager-executeBulkWrite_error-001.phpt
diff --git a/mongodb-1.8.1/tests/manager/manager-executeBulkWrite_error-002.phpt b/mongodb-1.9.0/tests/manager/manager-executeBulkWrite_error-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/manager/manager-executeBulkWrite_error-002.phpt
rename to mongodb-1.9.0/tests/manager/manager-executeBulkWrite_error-002.phpt
diff --git a/mongodb-1.8.1/tests/manager/manager-executeBulkWrite_error-003.phpt b/mongodb-1.9.0/tests/manager/manager-executeBulkWrite_error-003.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/manager/manager-executeBulkWrite_error-003.phpt
rename to mongodb-1.9.0/tests/manager/manager-executeBulkWrite_error-003.phpt
diff --git a/mongodb-1.8.1/tests/manager/manager-executeBulkWrite_error-004.phpt b/mongodb-1.9.0/tests/manager/manager-executeBulkWrite_error-004.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/manager/manager-executeBulkWrite_error-004.phpt
rename to mongodb-1.9.0/tests/manager/manager-executeBulkWrite_error-004.phpt
diff --git a/mongodb-1.8.1/tests/manager/manager-executeBulkWrite_error-005.phpt b/mongodb-1.9.0/tests/manager/manager-executeBulkWrite_error-005.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/manager/manager-executeBulkWrite_error-005.phpt
rename to mongodb-1.9.0/tests/manager/manager-executeBulkWrite_error-005.phpt
diff --git a/mongodb-1.8.1/tests/manager/manager-executeBulkWrite_error-006.phpt b/mongodb-1.9.0/tests/manager/manager-executeBulkWrite_error-006.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/manager/manager-executeBulkWrite_error-006.phpt
rename to mongodb-1.9.0/tests/manager/manager-executeBulkWrite_error-006.phpt
diff --git a/mongodb-1.8.1/tests/manager/manager-executeBulkWrite_error-007.phpt b/mongodb-1.9.0/tests/manager/manager-executeBulkWrite_error-007.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/manager/manager-executeBulkWrite_error-007.phpt
rename to mongodb-1.9.0/tests/manager/manager-executeBulkWrite_error-007.phpt
diff --git a/mongodb-1.8.1/tests/manager/manager-executeBulkWrite_error-008.phpt b/mongodb-1.9.0/tests/manager/manager-executeBulkWrite_error-008.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/manager/manager-executeBulkWrite_error-008.phpt
rename to mongodb-1.9.0/tests/manager/manager-executeBulkWrite_error-008.phpt
diff --git a/mongodb-1.8.1/tests/manager/manager-executeBulkWrite_error-009.phpt b/mongodb-1.9.0/tests/manager/manager-executeBulkWrite_error-009.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/manager/manager-executeBulkWrite_error-009.phpt
rename to mongodb-1.9.0/tests/manager/manager-executeBulkWrite_error-009.phpt
diff --git a/mongodb-1.8.1/tests/manager/manager-executeBulkWrite_error-010.phpt b/mongodb-1.9.0/tests/manager/manager-executeBulkWrite_error-010.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/manager/manager-executeBulkWrite_error-010.phpt
rename to mongodb-1.9.0/tests/manager/manager-executeBulkWrite_error-010.phpt
diff --git a/mongodb-1.8.1/tests/manager/manager-executeBulkWrite_error-011.phpt b/mongodb-1.9.0/tests/manager/manager-executeBulkWrite_error-011.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/manager/manager-executeBulkWrite_error-011.phpt
rename to mongodb-1.9.0/tests/manager/manager-executeBulkWrite_error-011.phpt
diff --git a/mongodb-1.8.1/tests/manager/manager-executeCommand-001.phpt b/mongodb-1.9.0/tests/manager/manager-executeCommand-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/manager/manager-executeCommand-001.phpt
rename to mongodb-1.9.0/tests/manager/manager-executeCommand-001.phpt
diff --git a/mongodb-1.8.1/tests/manager/manager-executeCommand-002.phpt b/mongodb-1.9.0/tests/manager/manager-executeCommand-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/manager/manager-executeCommand-002.phpt
rename to mongodb-1.9.0/tests/manager/manager-executeCommand-002.phpt
diff --git a/mongodb-1.8.1/tests/manager/manager-executeCommand-003.phpt b/mongodb-1.9.0/tests/manager/manager-executeCommand-003.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/manager/manager-executeCommand-003.phpt
rename to mongodb-1.9.0/tests/manager/manager-executeCommand-003.phpt
diff --git a/mongodb-1.8.1/tests/manager/manager-executeCommand-004.phpt b/mongodb-1.9.0/tests/manager/manager-executeCommand-004.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/manager/manager-executeCommand-004.phpt
rename to mongodb-1.9.0/tests/manager/manager-executeCommand-004.phpt
diff --git a/mongodb-1.8.1/tests/manager/manager-executeCommand-005.phpt b/mongodb-1.9.0/tests/manager/manager-executeCommand-005.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/manager/manager-executeCommand-005.phpt
rename to mongodb-1.9.0/tests/manager/manager-executeCommand-005.phpt
diff --git a/mongodb-1.8.1/tests/manager/manager-executeCommand-006.phpt b/mongodb-1.9.0/tests/manager/manager-executeCommand-006.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/manager/manager-executeCommand-006.phpt
rename to mongodb-1.9.0/tests/manager/manager-executeCommand-006.phpt
diff --git a/mongodb-1.9.0/tests/manager/manager-executeCommand-007.phpt b/mongodb-1.9.0/tests/manager/manager-executeCommand-007.phpt
new file mode 100644
index 00000000..47e12b06
--- /dev/null
+++ b/mongodb-1.9.0/tests/manager/manager-executeCommand-007.phpt
@@ -0,0 +1,47 @@
+--TEST--
+MongoDB\Driver\Manager::executeCommand() does not inherit read or write concern
+--SKIPIF--
+<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
+<?php skip_if_not_replica_set(); ?>
+<?php skip_if_not_enough_data_nodes(2); /* w:2 */ ?>
+<?php skip_if_server_version('<', '3.6'); /* readConcernLevel:available */ ?>
+<?php skip_if_not_clean(); ?>
+--FILE--
+<?php
+require_once __DIR__ . "/../utils/basic.inc";
+require_once __DIR__ . "/../utils/observer.php";
+
+$manager = new MongoDB\Driver\Manager(URI, ['readConcernLevel' => 'local', 'w' => 2, 'wtimeoutms' => 1000]);
+
+$command = new MongoDB\Driver\Command([
+ 'aggregate' => COLLECTION_NAME,
+ 'pipeline' => [
+ ['$group' => ['_id' => 1]],
+ ['$out' => COLLECTION_NAME . '.out'],
+ ],
+ 'cursor' => (object) [],
+]);
+
+(new CommandObserver)->observe(
+ function() use ($manager, $command) {
+ $manager->executeCommand(DATABASE_NAME, $command);
+ $manager->executeCommand(DATABASE_NAME, $command, [
+ 'readConcern' => new MongoDB\Driver\ReadConcern(MongoDB\Driver\ReadConcern::AVAILABLE),
+ 'writeConcern' => new MongoDB\Driver\WriteConcern(1),
+ ]);
+ },
+ function(stdClass $command) {
+ echo json_encode($command->readConcern ?? null), "\n";
+ echo json_encode($command->writeConcern ?? null), "\n";
+ }
+);
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+null
+null
+{"level":"available"}
+{"w":1}
+===DONE===
diff --git a/mongodb-1.8.1/tests/manager/manager-executeCommand_error-001.phpt b/mongodb-1.9.0/tests/manager/manager-executeCommand_error-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/manager/manager-executeCommand_error-001.phpt
rename to mongodb-1.9.0/tests/manager/manager-executeCommand_error-001.phpt
diff --git a/mongodb-1.8.1/tests/manager/manager-executeCommand_error-002.phpt b/mongodb-1.9.0/tests/manager/manager-executeCommand_error-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/manager/manager-executeCommand_error-002.phpt
rename to mongodb-1.9.0/tests/manager/manager-executeCommand_error-002.phpt
diff --git a/mongodb-1.8.1/tests/manager/manager-executeCommand_error-003.phpt b/mongodb-1.9.0/tests/manager/manager-executeCommand_error-003.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/manager/manager-executeCommand_error-003.phpt
rename to mongodb-1.9.0/tests/manager/manager-executeCommand_error-003.phpt
diff --git a/mongodb-1.8.1/tests/manager/manager-executeCommand_error-004.phpt b/mongodb-1.9.0/tests/manager/manager-executeCommand_error-004.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/manager/manager-executeCommand_error-004.phpt
rename to mongodb-1.9.0/tests/manager/manager-executeCommand_error-004.phpt
diff --git a/mongodb-1.8.1/tests/manager/manager-executeCommand_error-005.phpt b/mongodb-1.9.0/tests/manager/manager-executeCommand_error-005.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/manager/manager-executeCommand_error-005.phpt
rename to mongodb-1.9.0/tests/manager/manager-executeCommand_error-005.phpt
diff --git a/mongodb-1.8.1/tests/manager/manager-executeQuery-001.phpt b/mongodb-1.9.0/tests/manager/manager-executeQuery-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/manager/manager-executeQuery-001.phpt
rename to mongodb-1.9.0/tests/manager/manager-executeQuery-001.phpt
diff --git a/mongodb-1.8.1/tests/manager/manager-executeQuery-002.phpt b/mongodb-1.9.0/tests/manager/manager-executeQuery-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/manager/manager-executeQuery-002.phpt
rename to mongodb-1.9.0/tests/manager/manager-executeQuery-002.phpt
diff --git a/mongodb-1.8.1/tests/manager/manager-executeQuery-003.phpt b/mongodb-1.9.0/tests/manager/manager-executeQuery-003.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/manager/manager-executeQuery-003.phpt
rename to mongodb-1.9.0/tests/manager/manager-executeQuery-003.phpt
diff --git a/mongodb-1.8.1/tests/manager/manager-executeQuery-004.phpt b/mongodb-1.9.0/tests/manager/manager-executeQuery-004.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/manager/manager-executeQuery-004.phpt
rename to mongodb-1.9.0/tests/manager/manager-executeQuery-004.phpt
diff --git a/mongodb-1.8.1/tests/manager/manager-executeQuery-005.phpt b/mongodb-1.9.0/tests/manager/manager-executeQuery-005.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/manager/manager-executeQuery-005.phpt
rename to mongodb-1.9.0/tests/manager/manager-executeQuery-005.phpt
diff --git a/mongodb-1.9.0/tests/manager/manager-executeQuery-006.phpt b/mongodb-1.9.0/tests/manager/manager-executeQuery-006.phpt
new file mode 100644
index 00000000..9059a945
--- /dev/null
+++ b/mongodb-1.9.0/tests/manager/manager-executeQuery-006.phpt
@@ -0,0 +1,56 @@
+--TEST--
+MongoDB\Driver\Manager::executeQuery() pins transaction to server
+--SKIPIF--
+<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
+<?php skip_if_not_mongos_with_replica_set(); ?>
+<?php skip_if_server_version('<', '4.1.6'); ?>
+<?php skip_if_not_clean(); ?>
+--FILE--
+<?php
+require_once __DIR__ . "/../utils/basic.inc";
+
+$manager = new MongoDB\Driver\Manager(URI);
+
+/* Create collections as that can't be (automatically) done in a transaction */
+$manager->executeCommand(
+ DATABASE_NAME,
+ new \MongoDB\Driver\Command([ 'create' => COLLECTION_NAME ]),
+ [ 'writeConcern' => new \MongoDB\Driver\WriteConcern( \MongoDB\Driver\WriteConcern::MAJORITY ) ]
+);
+
+$session = $manager->startSession();
+var_dump($session->getServer() instanceof \MongoDB\Driver\Server);
+
+$session->startTransaction();
+var_dump($session->getServer() instanceof \MongoDB\Driver\Server);
+
+$query = new MongoDB\Driver\Query([]);
+$manager->executeQuery(NS, $query, ['session' => $session]);
+
+$pinnedServer = $session->getServer();
+var_dump($pinnedServer instanceof \MongoDB\Driver\Server);
+
+$bulk = new MongoDB\Driver\BulkWrite();
+$bulk->insert(['x' => 1]);
+$manager->executeBulkWrite(NS, $bulk, ['session' => $session]);
+
+$session->commitTransaction();
+
+var_dump($session->getServer() == $pinnedServer);
+
+$bulk = new MongoDB\Driver\BulkWrite();
+$bulk->insert(['x' => 1]);
+$manager->executeBulkWrite(NS, $bulk, ['session' => $session]);
+
+var_dump($session->getServer() instanceof \MongoDB\Driver\Server);
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+bool(false)
+bool(false)
+bool(true)
+bool(true)
+bool(false)
+===DONE===
diff --git a/mongodb-1.9.0/tests/manager/manager-executeQuery-007.phpt b/mongodb-1.9.0/tests/manager/manager-executeQuery-007.phpt
new file mode 100644
index 00000000..ac930980
--- /dev/null
+++ b/mongodb-1.9.0/tests/manager/manager-executeQuery-007.phpt
@@ -0,0 +1,33 @@
+--TEST--
+MongoDB\Driver\Manager::executeQuery() read concern inheritance
+--SKIPIF--
+<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
+<?php skip_if_not_replica_set(); ?>
+<?php skip_if_server_version('<', '3.6'); /* readConcernLevel:available */ ?>
+<?php skip_if_not_clean(); ?>
+--FILE--
+<?php
+require_once __DIR__ . "/../utils/basic.inc";
+require_once __DIR__ . "/../utils/observer.php";
+
+$manager = new MongoDB\Driver\Manager(URI, ['readConcernLevel' => 'local']);
+
+(new CommandObserver)->observe(
+ function() use ($manager) {
+ $manager->executeQuery(NS, new MongoDB\Driver\Query([]));
+ $manager->executeQuery(NS, new MongoDB\Driver\Query([], [
+ 'readConcern' => new MongoDB\Driver\ReadConcern(MongoDB\Driver\ReadConcern::AVAILABLE),
+ ]));
+ },
+ function(stdClass $command) {
+ echo json_encode($command->readConcern), "\n";
+ }
+);
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+{"level":"local"}
+{"level":"available"}
+===DONE===
diff --git a/mongodb-1.8.1/tests/manager/manager-executeQuery_error-001.phpt b/mongodb-1.9.0/tests/manager/manager-executeQuery_error-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/manager/manager-executeQuery_error-001.phpt
rename to mongodb-1.9.0/tests/manager/manager-executeQuery_error-001.phpt
diff --git a/mongodb-1.8.1/tests/manager/manager-executeQuery_error-002.phpt b/mongodb-1.9.0/tests/manager/manager-executeQuery_error-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/manager/manager-executeQuery_error-002.phpt
rename to mongodb-1.9.0/tests/manager/manager-executeQuery_error-002.phpt
diff --git a/mongodb-1.8.1/tests/manager/manager-executeQuery_error-003.phpt b/mongodb-1.9.0/tests/manager/manager-executeQuery_error-003.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/manager/manager-executeQuery_error-003.phpt
rename to mongodb-1.9.0/tests/manager/manager-executeQuery_error-003.phpt
diff --git a/mongodb-1.8.1/tests/manager/manager-executeReadCommand-001.phpt b/mongodb-1.9.0/tests/manager/manager-executeReadCommand-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/manager/manager-executeReadCommand-001.phpt
rename to mongodb-1.9.0/tests/manager/manager-executeReadCommand-001.phpt
diff --git a/mongodb-1.9.0/tests/manager/manager-executeReadCommand-002.phpt b/mongodb-1.9.0/tests/manager/manager-executeReadCommand-002.phpt
new file mode 100644
index 00000000..beb3ea55
--- /dev/null
+++ b/mongodb-1.9.0/tests/manager/manager-executeReadCommand-002.phpt
@@ -0,0 +1,60 @@
+--TEST--
+MongoDB\Driver\Manager::executeReadCommand() pins transaction to server
+--SKIPIF--
+<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
+<?php skip_if_not_mongos_with_replica_set(); ?>
+<?php skip_if_server_version('<', '4.1.6'); ?>
+<?php skip_if_not_clean(); ?>
+--FILE--
+<?php
+require_once __DIR__ . "/../utils/basic.inc";
+
+$manager = new MongoDB\Driver\Manager(URI);
+
+/* Create collections as that can't be (automatically) done in a transaction */
+$manager->executeCommand(
+ DATABASE_NAME,
+ new \MongoDB\Driver\Command([ 'create' => COLLECTION_NAME ]),
+ [ 'writeConcern' => new \MongoDB\Driver\WriteConcern( \MongoDB\Driver\WriteConcern::MAJORITY ) ]
+);
+
+$session = $manager->startSession();
+var_dump($session->getServer() instanceof \MongoDB\Driver\Server);
+
+$session->startTransaction();
+var_dump($session->getServer() instanceof \MongoDB\Driver\Server);
+
+$command = new MongoDB\Driver\Command([
+ 'aggregate' => COLLECTION_NAME,
+ 'pipeline' => [['$group' => ['_id' => 1]]],
+ 'cursor' => (object) []
+]);
+$manager->executeReadCommand(DATABASE_NAME, $command, ['session' => $session]);
+
+$pinnedServer = $session->getServer();
+var_dump($pinnedServer instanceof \MongoDB\Driver\Server);
+
+$bulk = new MongoDB\Driver\BulkWrite();
+$bulk->insert(['x' => 1]);
+$manager->executeBulkWrite(NS, $bulk, ['session' => $session]);
+
+$session->commitTransaction();
+
+var_dump($session->getServer() == $pinnedServer);
+
+$bulk = new MongoDB\Driver\BulkWrite();
+$bulk->insert(['x' => 1]);
+$manager->executeBulkWrite(NS, $bulk, ['session' => $session]);
+
+var_dump($session->getServer() instanceof \MongoDB\Driver\Server);
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+bool(false)
+bool(false)
+bool(true)
+bool(true)
+bool(false)
+===DONE===
diff --git a/mongodb-1.9.0/tests/manager/manager-executeReadCommand-003.phpt b/mongodb-1.9.0/tests/manager/manager-executeReadCommand-003.phpt
new file mode 100644
index 00000000..53fdf3ec
--- /dev/null
+++ b/mongodb-1.9.0/tests/manager/manager-executeReadCommand-003.phpt
@@ -0,0 +1,39 @@
+--TEST--
+MongoDB\Driver\Manager::executeReadCommand() read concern inheritance
+--SKIPIF--
+<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
+<?php skip_if_not_replica_set(); ?>
+<?php skip_if_server_version('<', '3.6'); /* readConcernLevel:available */ ?>
+<?php skip_if_not_clean(); ?>
+--FILE--
+<?php
+require_once __DIR__ . "/../utils/basic.inc";
+require_once __DIR__ . "/../utils/observer.php";
+
+$manager = new MongoDB\Driver\Manager(URI, ['readConcernLevel' => 'local']);
+
+$command = new MongoDB\Driver\Command([
+ 'aggregate' => COLLECTION_NAME,
+ 'pipeline' => [['$group' => ['_id' => 1]]],
+ 'cursor' => (object) [],
+]);
+
+(new CommandObserver)->observe(
+ function() use ($manager, $command) {
+ $manager->executeReadCommand(DATABASE_NAME, $command);
+ $manager->executeReadCommand(DATABASE_NAME, $command, [
+ 'readConcern' => new MongoDB\Driver\ReadConcern(MongoDB\Driver\ReadConcern::AVAILABLE),
+ ]);
+ },
+ function(stdClass $command) {
+ echo json_encode($command->readConcern), "\n";
+ }
+);
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+{"level":"local"}
+{"level":"available"}
+===DONE===
diff --git a/mongodb-1.8.1/tests/manager/manager-executeReadCommand_error-001.phpt b/mongodb-1.9.0/tests/manager/manager-executeReadCommand_error-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/manager/manager-executeReadCommand_error-001.phpt
rename to mongodb-1.9.0/tests/manager/manager-executeReadCommand_error-001.phpt
diff --git a/mongodb-1.9.0/tests/manager/manager-executeReadWriteCommand-001.phpt b/mongodb-1.9.0/tests/manager/manager-executeReadWriteCommand-001.phpt
new file mode 100644
index 00000000..d08835d8
--- /dev/null
+++ b/mongodb-1.9.0/tests/manager/manager-executeReadWriteCommand-001.phpt
@@ -0,0 +1,47 @@
+--TEST--
+MongoDB\Driver\Manager::executeReadWriteCommand()
+--SKIPIF--
+<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
+<?php skip_if_not_live(); ?>
+<?php skip_if_not_clean(); ?>
+<?php skip_if_server_version('<', '3.4'); /* aggregate write concern */ ?>
+--FILE--
+<?php
+require_once __DIR__ . "/../utils/basic.inc";
+require_once __DIR__ . "/../utils/observer.php";
+
+$manager = new MongoDB\Driver\Manager(URI);
+
+$command = new MongoDB\Driver\Command([
+ 'aggregate' => COLLECTION_NAME,
+ 'pipeline' => [
+ ['$group' => ['_id' => 1]],
+ ['$out' => COLLECTION_NAME . '.out'],
+ ],
+ 'cursor' => (object) [],
+]);
+
+(new CommandObserver)->observe(
+ function() use ($manager, $command) {
+ $manager->executeReadWriteCommand(
+ DATABASE_NAME,
+ $command,
+ [
+ 'readConcern' => new \MongoDB\Driver\ReadConcern(\MongoDB\Driver\ReadConcern::LOCAL),
+ 'writeConcern' => new \MongoDB\Driver\WriteConcern(\MongoDB\Driver\WriteConcern::MAJORITY),
+ ]
+ );
+ },
+ function(stdClass $command) {
+ echo "Read Concern: ", $command->readConcern->level, "\n";
+ echo "Write Concern: ", $command->writeConcern->w, "\n";
+ }
+);
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECTF--
+Read Concern: local
+Write Concern: majority
+===DONE===
diff --git a/mongodb-1.9.0/tests/manager/manager-executeReadWriteCommand-002.phpt b/mongodb-1.9.0/tests/manager/manager-executeReadWriteCommand-002.phpt
new file mode 100644
index 00000000..e7930300
--- /dev/null
+++ b/mongodb-1.9.0/tests/manager/manager-executeReadWriteCommand-002.phpt
@@ -0,0 +1,64 @@
+--TEST--
+MongoDB\Driver\Manager::executeReadWriteCommand() pins transaction to server
+--SKIPIF--
+<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
+<?php skip_if_not_mongos_with_replica_set(); ?>
+<?php skip_if_server_version('<', '4.1.6'); ?>
+<?php skip_if_not_clean(); ?>
+--FILE--
+<?php
+require_once __DIR__ . "/../utils/basic.inc";
+
+$manager = new MongoDB\Driver\Manager(URI);
+
+/* Create collections as that can't be (automatically) done in a transaction */
+$manager->executeCommand(
+ DATABASE_NAME,
+ new \MongoDB\Driver\Command([ 'create' => COLLECTION_NAME ]),
+ [ 'writeConcern' => new \MongoDB\Driver\WriteConcern( \MongoDB\Driver\WriteConcern::MAJORITY ) ]
+);
+
+$session = $manager->startSession();
+var_dump($session->getServer() instanceof \MongoDB\Driver\Server);
+
+$session->startTransaction();
+var_dump($session->getServer() instanceof \MongoDB\Driver\Server);
+
+$command = new MongoDB\Driver\Command([
+ 'aggregate' => COLLECTION_NAME,
+ 'pipeline' => [
+ ['$group' => ['_id' => 1]],
+ /* Note: $out cannot be used in a transaction. This is technically not a
+ * write command, but it works for the purposes of this test. */
+ ],
+ 'cursor' => (object) []
+]);
+$manager->executeReadWriteCommand(DATABASE_NAME, $command, ['session' => $session]);
+
+$pinnedServer = $session->getServer();
+var_dump($pinnedServer instanceof \MongoDB\Driver\Server);
+
+$bulk = new MongoDB\Driver\BulkWrite();
+$bulk->insert(['x' => 1]);
+$manager->executeBulkWrite(NS, $bulk, ['session' => $session]);
+
+$session->commitTransaction();
+
+var_dump($session->getServer() == $pinnedServer);
+
+$bulk = new MongoDB\Driver\BulkWrite();
+$bulk->insert(['x' => 1]);
+$manager->executeBulkWrite(NS, $bulk, ['session' => $session]);
+
+var_dump($session->getServer() instanceof \MongoDB\Driver\Server);
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+bool(false)
+bool(false)
+bool(true)
+bool(true)
+bool(false)
+===DONE===
diff --git a/mongodb-1.9.0/tests/manager/manager-executeReadWriteCommand-003.phpt b/mongodb-1.9.0/tests/manager/manager-executeReadWriteCommand-003.phpt
new file mode 100644
index 00000000..056af14f
--- /dev/null
+++ b/mongodb-1.9.0/tests/manager/manager-executeReadWriteCommand-003.phpt
@@ -0,0 +1,47 @@
+--TEST--
+MongoDB\Driver\Manager::executeReadWriteCommand() read and write concern inheritance
+--SKIPIF--
+<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
+<?php skip_if_not_replica_set(); ?>
+<?php skip_if_not_enough_data_nodes(2); /* w:2 */ ?>
+<?php skip_if_server_version('<', '3.6'); /* readConcernLevel:available */ ?>
+<?php skip_if_not_clean(); ?>
+--FILE--
+<?php
+require_once __DIR__ . "/../utils/basic.inc";
+require_once __DIR__ . "/../utils/observer.php";
+
+$manager = new MongoDB\Driver\Manager(URI, ['readConcernLevel' => 'local', 'w' => 2, 'wtimeoutms' => 1000]);
+
+$command = new MongoDB\Driver\Command([
+ 'aggregate' => COLLECTION_NAME,
+ 'pipeline' => [
+ ['$group' => ['_id' => 1]],
+ ['$out' => COLLECTION_NAME . '.out'],
+ ],
+ 'cursor' => (object) [],
+]);
+
+(new CommandObserver)->observe(
+ function() use ($manager, $command) {
+ $manager->executeReadWriteCommand(DATABASE_NAME, $command);
+ $manager->executeReadWriteCommand(DATABASE_NAME, $command, [
+ 'readConcern' => new MongoDB\Driver\ReadConcern(MongoDB\Driver\ReadConcern::AVAILABLE),
+ 'writeConcern' => new MongoDB\Driver\WriteConcern(1),
+ ]);
+ },
+ function(stdClass $command) {
+ echo json_encode($command->readConcern), "\n";
+ echo json_encode($command->writeConcern), "\n";
+ }
+);
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+{"level":"local"}
+{"w":2,"wtimeout":1000}
+{"level":"available"}
+{"w":1}
+===DONE===
diff --git a/mongodb-1.8.1/tests/manager/manager-executeReadWriteCommand_error-001.phpt b/mongodb-1.9.0/tests/manager/manager-executeReadWriteCommand_error-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/manager/manager-executeReadWriteCommand_error-001.phpt
rename to mongodb-1.9.0/tests/manager/manager-executeReadWriteCommand_error-001.phpt
diff --git a/mongodb-1.8.1/tests/manager/manager-executeReadWriteCommand_error-002.phpt b/mongodb-1.9.0/tests/manager/manager-executeReadWriteCommand_error-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/manager/manager-executeReadWriteCommand_error-002.phpt
rename to mongodb-1.9.0/tests/manager/manager-executeReadWriteCommand_error-002.phpt
diff --git a/mongodb-1.8.1/tests/manager/manager-executeWriteCommand-001.phpt b/mongodb-1.9.0/tests/manager/manager-executeWriteCommand-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/manager/manager-executeWriteCommand-001.phpt
rename to mongodb-1.9.0/tests/manager/manager-executeWriteCommand-001.phpt
diff --git a/mongodb-1.9.0/tests/manager/manager-executeWriteCommand-002.phpt b/mongodb-1.9.0/tests/manager/manager-executeWriteCommand-002.phpt
new file mode 100644
index 00000000..23f824a8
--- /dev/null
+++ b/mongodb-1.9.0/tests/manager/manager-executeWriteCommand-002.phpt
@@ -0,0 +1,62 @@
+--TEST--
+MongoDB\Driver\Manager::executeWriteCommand() pins transaction to server
+--SKIPIF--
+<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
+<?php skip_if_not_mongos_with_replica_set(); ?>
+<?php skip_if_server_version('<', '4.1.6'); ?>
+<?php skip_if_not_clean(); ?>
+--FILE--
+<?php
+require_once __DIR__ . "/../utils/basic.inc";
+
+$manager = new MongoDB\Driver\Manager(URI);
+
+/* Create collections as that can't be (automatically) done in a transaction */
+$manager->executeCommand(
+ DATABASE_NAME,
+ new \MongoDB\Driver\Command([ 'create' => COLLECTION_NAME ]),
+ [ 'writeConcern' => new \MongoDB\Driver\WriteConcern( \MongoDB\Driver\WriteConcern::MAJORITY ) ]
+);
+
+$session = $manager->startSession();
+var_dump($session->getServer() instanceof \MongoDB\Driver\Server);
+
+$session->startTransaction();
+var_dump($session->getServer() instanceof \MongoDB\Driver\Server);
+
+$command = new MongoDB\Driver\Command([
+ 'findAndModify' => COLLECTION_NAME,
+ 'query' => ['_id' => 'foo'],
+ 'upsert' => true,
+ 'new' => true,
+ 'update' => ['x' => 1]
+]);
+$manager->executeWriteCommand(DATABASE_NAME, $command, ['session' => $session]);
+
+$pinnedServer = $session->getServer();
+var_dump($pinnedServer instanceof \MongoDB\Driver\Server);
+
+$bulk = new MongoDB\Driver\BulkWrite();
+$bulk->insert(['x' => 1]);
+$manager->executeBulkWrite(NS, $bulk, ['session' => $session]);
+
+$session->commitTransaction();
+
+var_dump($session->getServer() == $pinnedServer);
+
+$bulk = new MongoDB\Driver\BulkWrite();
+$bulk->insert(['x' => 1]);
+$manager->executeBulkWrite(NS, $bulk, ['session' => $session]);
+
+var_dump($session->getServer() instanceof \MongoDB\Driver\Server);
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+bool(false)
+bool(false)
+bool(true)
+bool(true)
+bool(false)
+===DONE===
diff --git a/mongodb-1.9.0/tests/manager/manager-executeWriteCommand-003.phpt b/mongodb-1.9.0/tests/manager/manager-executeWriteCommand-003.phpt
new file mode 100644
index 00000000..9a747c48
--- /dev/null
+++ b/mongodb-1.9.0/tests/manager/manager-executeWriteCommand-003.phpt
@@ -0,0 +1,40 @@
+--TEST--
+MongoDB\Driver\Manager::executeWriteCommand() write concern inheritance
+--SKIPIF--
+<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
+<?php skip_if_not_replica_set(); ?>
+<?php skip_if_not_enough_data_nodes(2); /* w:2 */ ?>
+<?php skip_if_server_version('<', '3.2'); /* findAndModify writeConcern */ ?>
+<?php skip_if_not_clean(); ?>
+--FILE--
+<?php
+require_once __DIR__ . "/../utils/basic.inc";
+require_once __DIR__ . "/../utils/observer.php";
+
+$manager = new MongoDB\Driver\Manager(URI, ['w' => 2, 'wtimeoutms' => 1000]);
+
+$command = new MongoDB\Driver\Command([
+ 'findAndModify' => COLLECTION_NAME,
+ 'query' => ['x' => 1],
+ 'upsert' => true,
+ 'new' => true,
+ 'update' => ['$inc' => ['x' => 1]],
+]);
+
+(new CommandObserver)->observe(
+ function() use ($manager, $command) {
+ $manager->executeWriteCommand(DATABASE_NAME, $command);
+ $manager->executeWriteCommand(DATABASE_NAME, $command, ['writeConcern' => new MongoDB\Driver\WriteConcern(1)]);
+ },
+ function(stdClass $command) {
+ echo json_encode($command->writeConcern), "\n";
+ }
+);
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+{"w":2,"wtimeout":1000}
+{"w":1}
+===DONE===
diff --git a/mongodb-1.8.1/tests/manager/manager-executeWriteCommand_error-001.phpt b/mongodb-1.9.0/tests/manager/manager-executeWriteCommand_error-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/manager/manager-executeWriteCommand_error-001.phpt
rename to mongodb-1.9.0/tests/manager/manager-executeWriteCommand_error-001.phpt
diff --git a/mongodb-1.8.1/tests/manager/manager-executeWriteCommand_error-002.phpt b/mongodb-1.9.0/tests/manager/manager-executeWriteCommand_error-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/manager/manager-executeWriteCommand_error-002.phpt
rename to mongodb-1.9.0/tests/manager/manager-executeWriteCommand_error-002.phpt
diff --git a/mongodb-1.8.1/tests/manager/manager-executeWriteCommand_error-003.phpt b/mongodb-1.9.0/tests/manager/manager-executeWriteCommand_error-003.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/manager/manager-executeWriteCommand_error-003.phpt
rename to mongodb-1.9.0/tests/manager/manager-executeWriteCommand_error-003.phpt
diff --git a/mongodb-1.8.1/tests/manager/manager-executeWriteCommand_error-004.phpt b/mongodb-1.9.0/tests/manager/manager-executeWriteCommand_error-004.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/manager/manager-executeWriteCommand_error-004.phpt
rename to mongodb-1.9.0/tests/manager/manager-executeWriteCommand_error-004.phpt
diff --git a/mongodb-1.8.1/tests/manager/manager-getreadconcern-001.phpt b/mongodb-1.9.0/tests/manager/manager-getreadconcern-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/manager/manager-getreadconcern-001.phpt
rename to mongodb-1.9.0/tests/manager/manager-getreadconcern-001.phpt
diff --git a/mongodb-1.8.1/tests/manager/manager-getreadpreference-001.phpt b/mongodb-1.9.0/tests/manager/manager-getreadpreference-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/manager/manager-getreadpreference-001.phpt
rename to mongodb-1.9.0/tests/manager/manager-getreadpreference-001.phpt
diff --git a/mongodb-1.8.1/tests/manager/manager-getservers-001.phpt b/mongodb-1.9.0/tests/manager/manager-getservers-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/manager/manager-getservers-001.phpt
rename to mongodb-1.9.0/tests/manager/manager-getservers-001.phpt
diff --git a/mongodb-1.8.1/tests/manager/manager-getservers-002.phpt b/mongodb-1.9.0/tests/manager/manager-getservers-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/manager/manager-getservers-002.phpt
rename to mongodb-1.9.0/tests/manager/manager-getservers-002.phpt
diff --git a/mongodb-1.8.1/tests/manager/manager-getwriteconcern-001.phpt b/mongodb-1.9.0/tests/manager/manager-getwriteconcern-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/manager/manager-getwriteconcern-001.phpt
rename to mongodb-1.9.0/tests/manager/manager-getwriteconcern-001.phpt
diff --git a/mongodb-1.8.1/tests/manager/manager-invalidnamespace.phpt b/mongodb-1.9.0/tests/manager/manager-invalidnamespace.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/manager/manager-invalidnamespace.phpt
rename to mongodb-1.9.0/tests/manager/manager-invalidnamespace.phpt
diff --git a/mongodb-1.8.1/tests/manager/manager-selectserver-001.phpt b/mongodb-1.9.0/tests/manager/manager-selectserver-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/manager/manager-selectserver-001.phpt
rename to mongodb-1.9.0/tests/manager/manager-selectserver-001.phpt
diff --git a/mongodb-1.8.1/tests/manager/manager-selectserver_error-001.phpt b/mongodb-1.9.0/tests/manager/manager-selectserver_error-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/manager/manager-selectserver_error-001.phpt
rename to mongodb-1.9.0/tests/manager/manager-selectserver_error-001.phpt
diff --git a/mongodb-1.8.1/tests/manager/manager-set-uri-options-001.phpt b/mongodb-1.9.0/tests/manager/manager-set-uri-options-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/manager/manager-set-uri-options-001.phpt
rename to mongodb-1.9.0/tests/manager/manager-set-uri-options-001.phpt
diff --git a/mongodb-1.8.1/tests/manager/manager-set-uri-options-002.phpt b/mongodb-1.9.0/tests/manager/manager-set-uri-options-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/manager/manager-set-uri-options-002.phpt
rename to mongodb-1.9.0/tests/manager/manager-set-uri-options-002.phpt
diff --git a/mongodb-1.8.1/tests/manager/manager-set-uri-options-003.phpt b/mongodb-1.9.0/tests/manager/manager-set-uri-options-003.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/manager/manager-set-uri-options-003.phpt
rename to mongodb-1.9.0/tests/manager/manager-set-uri-options-003.phpt
diff --git a/mongodb-1.8.1/tests/manager/manager-var-dump-001.phpt b/mongodb-1.9.0/tests/manager/manager-var-dump-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/manager/manager-var-dump-001.phpt
rename to mongodb-1.9.0/tests/manager/manager-var-dump-001.phpt
diff --git a/mongodb-1.9.0/tests/manager/manager-wakeup.phpt b/mongodb-1.9.0/tests/manager/manager-wakeup.phpt
new file mode 100644
index 00000000..cf07dcc8
--- /dev/null
+++ b/mongodb-1.9.0/tests/manager/manager-wakeup.phpt
@@ -0,0 +1,29 @@
+--TEST--
+MongoDB\Driver\Manager: Manager cannot be woken up
+--SKIPIF--
+<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
+<?php skip_if_php_version('>=', '7.99'); ?>
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$manager = new MongoDB\Driver\Manager();
+
+echo throws(function() use ($manager) {
+ $manager->__wakeup();
+}, MongoDB\Driver\Exception\RuntimeException::class), "\n";
+
+echo throws(function() use ($manager) {
+ $manager->__wakeup(1, 2);
+}, MongoDB\Driver\Exception\InvalidArgumentException::class), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECTF--
+OK: Got MongoDB\Driver\Exception\RuntimeException
+MongoDB\Driver objects cannot be serialized
+OK: Got MongoDB\Driver\Exception\InvalidArgumentException
+MongoDB\Driver\Manager::__wakeup() expects exactly 0 %r(argument|parameter)%rs, 2 given
+===DONE===
diff --git a/mongodb-1.8.1/tests/manager/manager_error-001.phpt b/mongodb-1.9.0/tests/manager/manager_error-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/manager/manager_error-001.phpt
rename to mongodb-1.9.0/tests/manager/manager_error-001.phpt
diff --git a/mongodb-1.8.1/tests/query/bug0430-001.phpt b/mongodb-1.9.0/tests/query/bug0430-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/query/bug0430-001.phpt
rename to mongodb-1.9.0/tests/query/bug0430-001.phpt
diff --git a/mongodb-1.8.1/tests/query/bug0430-002.phpt b/mongodb-1.9.0/tests/query/bug0430-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/query/bug0430-002.phpt
rename to mongodb-1.9.0/tests/query/bug0430-002.phpt
diff --git a/mongodb-1.8.1/tests/query/bug0430-003.phpt b/mongodb-1.9.0/tests/query/bug0430-003.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/query/bug0430-003.phpt
rename to mongodb-1.9.0/tests/query/bug0430-003.phpt
diff --git a/mongodb-1.8.1/tests/query/bug0705-001.phpt b/mongodb-1.9.0/tests/query/bug0705-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/query/bug0705-001.phpt
rename to mongodb-1.9.0/tests/query/bug0705-001.phpt
diff --git a/mongodb-1.8.1/tests/query/bug0705-002.phpt b/mongodb-1.9.0/tests/query/bug0705-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/query/bug0705-002.phpt
rename to mongodb-1.9.0/tests/query/bug0705-002.phpt
diff --git a/mongodb-1.8.1/tests/query/query-ctor-001.phpt b/mongodb-1.9.0/tests/query/query-ctor-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/query/query-ctor-001.phpt
rename to mongodb-1.9.0/tests/query/query-ctor-001.phpt
diff --git a/mongodb-1.8.1/tests/query/query-ctor-002.phpt b/mongodb-1.9.0/tests/query/query-ctor-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/query/query-ctor-002.phpt
rename to mongodb-1.9.0/tests/query/query-ctor-002.phpt
diff --git a/mongodb-1.8.1/tests/query/query-ctor-003.phpt b/mongodb-1.9.0/tests/query/query-ctor-003.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/query/query-ctor-003.phpt
rename to mongodb-1.9.0/tests/query/query-ctor-003.phpt
diff --git a/mongodb-1.8.1/tests/query/query-ctor-004.phpt b/mongodb-1.9.0/tests/query/query-ctor-004.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/query/query-ctor-004.phpt
rename to mongodb-1.9.0/tests/query/query-ctor-004.phpt
diff --git a/mongodb-1.8.1/tests/query/query-ctor-005.phpt b/mongodb-1.9.0/tests/query/query-ctor-005.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/query/query-ctor-005.phpt
rename to mongodb-1.9.0/tests/query/query-ctor-005.phpt
diff --git a/mongodb-1.8.1/tests/query/query-ctor-006.phpt b/mongodb-1.9.0/tests/query/query-ctor-006.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/query/query-ctor-006.phpt
rename to mongodb-1.9.0/tests/query/query-ctor-006.phpt
diff --git a/mongodb-1.8.1/tests/query/query-ctor_error-001.phpt b/mongodb-1.9.0/tests/query/query-ctor_error-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/query/query-ctor_error-001.phpt
rename to mongodb-1.9.0/tests/query/query-ctor_error-001.phpt
diff --git a/mongodb-1.8.1/tests/query/query-ctor_error-002.phpt b/mongodb-1.9.0/tests/query/query-ctor_error-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/query/query-ctor_error-002.phpt
rename to mongodb-1.9.0/tests/query/query-ctor_error-002.phpt
diff --git a/mongodb-1.8.1/tests/query/query-ctor_error-003.phpt b/mongodb-1.9.0/tests/query/query-ctor_error-003.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/query/query-ctor_error-003.phpt
rename to mongodb-1.9.0/tests/query/query-ctor_error-003.phpt
diff --git a/mongodb-1.8.1/tests/query/query-ctor_error-004.phpt b/mongodb-1.9.0/tests/query/query-ctor_error-004.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/query/query-ctor_error-004.phpt
rename to mongodb-1.9.0/tests/query/query-ctor_error-004.phpt
diff --git a/mongodb-1.8.1/tests/query/query-ctor_error-005.phpt b/mongodb-1.9.0/tests/query/query-ctor_error-005.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/query/query-ctor_error-005.phpt
rename to mongodb-1.9.0/tests/query/query-ctor_error-005.phpt
diff --git a/mongodb-1.8.1/tests/query/query-ctor_error-006.phpt b/mongodb-1.9.0/tests/query/query-ctor_error-006.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/query/query-ctor_error-006.phpt
rename to mongodb-1.9.0/tests/query/query-ctor_error-006.phpt
diff --git a/mongodb-1.8.1/tests/query/query-debug-001.phpt b/mongodb-1.9.0/tests/query/query-debug-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/query/query-debug-001.phpt
rename to mongodb-1.9.0/tests/query/query-debug-001.phpt
diff --git a/mongodb-1.8.1/tests/query/query_error-001.phpt b/mongodb-1.9.0/tests/query/query_error-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/query/query_error-001.phpt
rename to mongodb-1.9.0/tests/query/query_error-001.phpt
diff --git a/mongodb-1.8.1/tests/readConcern/bug1598-001.phpt b/mongodb-1.9.0/tests/readConcern/bug1598-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/readConcern/bug1598-001.phpt
rename to mongodb-1.9.0/tests/readConcern/bug1598-001.phpt
diff --git a/mongodb-1.8.1/tests/readConcern/bug1598-002.phpt b/mongodb-1.9.0/tests/readConcern/bug1598-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/readConcern/bug1598-002.phpt
rename to mongodb-1.9.0/tests/readConcern/bug1598-002.phpt
diff --git a/mongodb-1.8.1/tests/readConcern/readconcern-bsonserialize-001.phpt b/mongodb-1.9.0/tests/readConcern/readconcern-bsonserialize-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/readConcern/readconcern-bsonserialize-001.phpt
rename to mongodb-1.9.0/tests/readConcern/readconcern-bsonserialize-001.phpt
diff --git a/mongodb-1.8.1/tests/readConcern/readconcern-bsonserialize-002.phpt b/mongodb-1.9.0/tests/readConcern/readconcern-bsonserialize-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/readConcern/readconcern-bsonserialize-002.phpt
rename to mongodb-1.9.0/tests/readConcern/readconcern-bsonserialize-002.phpt
diff --git a/mongodb-1.8.1/tests/readConcern/readconcern-constants.phpt b/mongodb-1.9.0/tests/readConcern/readconcern-constants.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/readConcern/readconcern-constants.phpt
rename to mongodb-1.9.0/tests/readConcern/readconcern-constants.phpt
diff --git a/mongodb-1.8.1/tests/readConcern/readconcern-ctor-001.phpt b/mongodb-1.9.0/tests/readConcern/readconcern-ctor-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/readConcern/readconcern-ctor-001.phpt
rename to mongodb-1.9.0/tests/readConcern/readconcern-ctor-001.phpt
diff --git a/mongodb-1.9.0/tests/readConcern/readconcern-ctor_error-001.phpt b/mongodb-1.9.0/tests/readConcern/readconcern-ctor_error-001.phpt
new file mode 100644
index 00000000..4c160a4d
--- /dev/null
+++ b/mongodb-1.9.0/tests/readConcern/readconcern-ctor_error-001.phpt
@@ -0,0 +1,20 @@
+--TEST--
+MongoDB\Driver\ReadConcern construction (invalid arguments)
+--SKIPIF--
+<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
+<?php skip_if_php_version('>=', '7.99'); ?>
+--FILE--
+<?php
+require_once __DIR__ . "/../utils/basic.inc";
+
+echo throws(function() {
+ new MongoDB\Driver\ReadConcern("string", 1);
+}, MongoDB\Driver\Exception\InvalidArgumentException::class), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECTF--
+OK: Got MongoDB\Driver\Exception\InvalidArgumentException
+MongoDB\Driver\ReadConcern::__construct() expects at most 1 %r(argument|parameter)%r, 2 given
+===DONE===
diff --git a/mongodb-1.9.0/tests/readConcern/readconcern-ctor_error-002.phpt b/mongodb-1.9.0/tests/readConcern/readconcern-ctor_error-002.phpt
new file mode 100644
index 00000000..48446ac7
--- /dev/null
+++ b/mongodb-1.9.0/tests/readConcern/readconcern-ctor_error-002.phpt
@@ -0,0 +1,29 @@
+--TEST--
+MongoDB\Driver\ReadConcern construction (invalid level type)
+--SKIPIF--
+<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
+<?php skip_if_php_version('>=', '7.99'); ?>
+--FILE--
+<?php
+require_once __DIR__ . "/../utils/basic.inc";
+
+$tests = [
+ [],
+ new stdClass,
+];
+
+foreach ($tests as $test) {
+ echo throws(function() use ($test) {
+ new MongoDB\Driver\ReadConcern($test);
+ }, 'MongoDB\Driver\Exception\InvalidArgumentException'), "\n";
+}
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECTF--
+OK: Got MongoDB\Driver\Exception\InvalidArgumentException
+%SMongoDB\Driver\ReadConcern::__construct()%sstring, array given
+OK: Got MongoDB\Driver\Exception\InvalidArgumentException
+%SMongoDB\Driver\ReadConcern::__construct()%sstring, %r(object|stdClass)%r given
+===DONE===
diff --git a/mongodb-1.8.1/tests/readConcern/readconcern-debug-001.phpt b/mongodb-1.9.0/tests/readConcern/readconcern-debug-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/readConcern/readconcern-debug-001.phpt
rename to mongodb-1.9.0/tests/readConcern/readconcern-debug-001.phpt
diff --git a/mongodb-1.8.1/tests/readConcern/readconcern-getlevel-001.phpt b/mongodb-1.9.0/tests/readConcern/readconcern-getlevel-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/readConcern/readconcern-getlevel-001.phpt
rename to mongodb-1.9.0/tests/readConcern/readconcern-getlevel-001.phpt
diff --git a/mongodb-1.8.1/tests/readConcern/readconcern-isdefault-001.phpt b/mongodb-1.9.0/tests/readConcern/readconcern-isdefault-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/readConcern/readconcern-isdefault-001.phpt
rename to mongodb-1.9.0/tests/readConcern/readconcern-isdefault-001.phpt
diff --git a/mongodb-1.8.1/tests/readConcern/readconcern-serialization-001.phpt b/mongodb-1.9.0/tests/readConcern/readconcern-serialization-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/readConcern/readconcern-serialization-001.phpt
rename to mongodb-1.9.0/tests/readConcern/readconcern-serialization-001.phpt
diff --git a/mongodb-1.8.1/tests/readConcern/readconcern-set_state-001.phpt b/mongodb-1.9.0/tests/readConcern/readconcern-set_state-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/readConcern/readconcern-set_state-001.phpt
rename to mongodb-1.9.0/tests/readConcern/readconcern-set_state-001.phpt
diff --git a/mongodb-1.8.1/tests/readConcern/readconcern-set_state_error-001.phpt b/mongodb-1.9.0/tests/readConcern/readconcern-set_state_error-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/readConcern/readconcern-set_state_error-001.phpt
rename to mongodb-1.9.0/tests/readConcern/readconcern-set_state_error-001.phpt
diff --git a/mongodb-1.8.1/tests/readConcern/readconcern-var_export-001.phpt b/mongodb-1.9.0/tests/readConcern/readconcern-var_export-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/readConcern/readconcern-var_export-001.phpt
rename to mongodb-1.9.0/tests/readConcern/readconcern-var_export-001.phpt
diff --git a/mongodb-1.8.1/tests/readConcern/readconcern_error-001.phpt b/mongodb-1.9.0/tests/readConcern/readconcern_error-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/readConcern/readconcern_error-001.phpt
rename to mongodb-1.9.0/tests/readConcern/readconcern_error-001.phpt
diff --git a/mongodb-1.8.1/tests/readPreference/bug0146-001.phpt b/mongodb-1.9.0/tests/readPreference/bug0146-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/readPreference/bug0146-001.phpt
rename to mongodb-1.9.0/tests/readPreference/bug0146-001.phpt
diff --git a/mongodb-1.8.1/tests/readPreference/bug0146-002.phpt b/mongodb-1.9.0/tests/readPreference/bug0146-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/readPreference/bug0146-002.phpt
rename to mongodb-1.9.0/tests/readPreference/bug0146-002.phpt
diff --git a/mongodb-1.8.1/tests/readPreference/bug0851-001.phpt b/mongodb-1.9.0/tests/readPreference/bug0851-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/readPreference/bug0851-001.phpt
rename to mongodb-1.9.0/tests/readPreference/bug0851-001.phpt
diff --git a/mongodb-1.8.1/tests/readPreference/bug1598-001.phpt b/mongodb-1.9.0/tests/readPreference/bug1598-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/readPreference/bug1598-001.phpt
rename to mongodb-1.9.0/tests/readPreference/bug1598-001.phpt
diff --git a/mongodb-1.8.1/tests/readPreference/bug1598-002.phpt b/mongodb-1.9.0/tests/readPreference/bug1598-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/readPreference/bug1598-002.phpt
rename to mongodb-1.9.0/tests/readPreference/bug1598-002.phpt
diff --git a/mongodb-1.9.0/tests/readPreference/bug1698-001.phpt b/mongodb-1.9.0/tests/readPreference/bug1698-001.phpt
new file mode 100644
index 00000000..46e5da30
--- /dev/null
+++ b/mongodb-1.9.0/tests/readPreference/bug1698-001.phpt
@@ -0,0 +1,86 @@
+--TEST--
+PHPC-1698: php_phongo_read_preference_prep_tagsets may leak in convert_to_object
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+$args = ['mode' => 'secondary', 'tags' => [['dc' => 'ny']]];
+var_dump(MongoDB\Driver\ReadPreference::__set_state($args));
+var_dump($args);
+
+$tagSets = [['dc' => 'ny']];
+var_dump(new MongoDB\Driver\ReadPreference('secondary', $tagSets));
+var_dump($tagSets);
+
+$uriTagSets = [['dc' => 'ny']];
+var_dump((new MongoDB\Driver\Manager(null, ['readPreference' => 'secondary', 'readPreferenceTags' => $uriTagSets]))->getReadPreference());
+var_dump($uriTagSets);
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECTF--
+object(MongoDB\Driver\ReadPreference)#%d (2) {
+ ["mode"]=>
+ string(9) "secondary"
+ ["tags"]=>
+ array(1) {
+ [0]=>
+ object(stdClass)#%d (1) {
+ ["dc"]=>
+ string(2) "ny"
+ }
+ }
+}
+array(2) {
+ ["mode"]=>
+ string(9) "secondary"
+ ["tags"]=>
+ array(1) {
+ [0]=>
+ array(1) {
+ ["dc"]=>
+ string(2) "ny"
+ }
+ }
+}
+object(MongoDB\Driver\ReadPreference)#%d (2) {
+ ["mode"]=>
+ string(9) "secondary"
+ ["tags"]=>
+ array(1) {
+ [0]=>
+ object(stdClass)#%d (1) {
+ ["dc"]=>
+ string(2) "ny"
+ }
+ }
+}
+array(1) {
+ [0]=>
+ array(1) {
+ ["dc"]=>
+ string(2) "ny"
+ }
+}
+object(MongoDB\Driver\ReadPreference)#%d (2) {
+ ["mode"]=>
+ string(9) "secondary"
+ ["tags"]=>
+ array(1) {
+ [0]=>
+ object(stdClass)#%d (1) {
+ ["dc"]=>
+ string(2) "ny"
+ }
+ }
+}
+array(1) {
+ [0]=>
+ array(1) {
+ ["dc"]=>
+ string(2) "ny"
+ }
+}
+===DONE===
diff --git a/mongodb-1.8.1/tests/readPreference/readpreference-bsonserialize-001.phpt b/mongodb-1.9.0/tests/readPreference/readpreference-bsonserialize-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/readPreference/readpreference-bsonserialize-001.phpt
rename to mongodb-1.9.0/tests/readPreference/readpreference-bsonserialize-001.phpt
diff --git a/mongodb-1.8.1/tests/readPreference/readpreference-bsonserialize-002.phpt b/mongodb-1.9.0/tests/readPreference/readpreference-bsonserialize-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/readPreference/readpreference-bsonserialize-002.phpt
rename to mongodb-1.9.0/tests/readPreference/readpreference-bsonserialize-002.phpt
diff --git a/mongodb-1.8.1/tests/readPreference/readpreference-constants.phpt b/mongodb-1.9.0/tests/readPreference/readpreference-constants.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/readPreference/readpreference-constants.phpt
rename to mongodb-1.9.0/tests/readPreference/readpreference-constants.phpt
diff --git a/mongodb-1.8.1/tests/readPreference/readpreference-ctor-001.phpt b/mongodb-1.9.0/tests/readPreference/readpreference-ctor-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/readPreference/readpreference-ctor-001.phpt
rename to mongodb-1.9.0/tests/readPreference/readpreference-ctor-001.phpt
diff --git a/mongodb-1.8.1/tests/readPreference/readpreference-ctor-002.phpt b/mongodb-1.9.0/tests/readPreference/readpreference-ctor-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/readPreference/readpreference-ctor-002.phpt
rename to mongodb-1.9.0/tests/readPreference/readpreference-ctor-002.phpt
diff --git a/mongodb-1.8.1/tests/readPreference/readpreference-ctor_error-001.phpt b/mongodb-1.9.0/tests/readPreference/readpreference-ctor_error-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/readPreference/readpreference-ctor_error-001.phpt
rename to mongodb-1.9.0/tests/readPreference/readpreference-ctor_error-001.phpt
diff --git a/mongodb-1.8.1/tests/readPreference/readpreference-ctor_error-002.phpt b/mongodb-1.9.0/tests/readPreference/readpreference-ctor_error-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/readPreference/readpreference-ctor_error-002.phpt
rename to mongodb-1.9.0/tests/readPreference/readpreference-ctor_error-002.phpt
diff --git a/mongodb-1.8.1/tests/readPreference/readpreference-ctor_error-003.phpt b/mongodb-1.9.0/tests/readPreference/readpreference-ctor_error-003.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/readPreference/readpreference-ctor_error-003.phpt
rename to mongodb-1.9.0/tests/readPreference/readpreference-ctor_error-003.phpt
diff --git a/mongodb-1.8.1/tests/readPreference/readpreference-ctor_error-004.phpt b/mongodb-1.9.0/tests/readPreference/readpreference-ctor_error-004.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/readPreference/readpreference-ctor_error-004.phpt
rename to mongodb-1.9.0/tests/readPreference/readpreference-ctor_error-004.phpt
diff --git a/mongodb-1.8.1/tests/readPreference/readpreference-ctor_error-005.phpt b/mongodb-1.9.0/tests/readPreference/readpreference-ctor_error-005.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/readPreference/readpreference-ctor_error-005.phpt
rename to mongodb-1.9.0/tests/readPreference/readpreference-ctor_error-005.phpt
diff --git a/mongodb-1.8.1/tests/readPreference/readpreference-ctor_error-006.phpt b/mongodb-1.9.0/tests/readPreference/readpreference-ctor_error-006.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/readPreference/readpreference-ctor_error-006.phpt
rename to mongodb-1.9.0/tests/readPreference/readpreference-ctor_error-006.phpt
diff --git a/mongodb-1.8.1/tests/readPreference/readpreference-ctor_error-007.phpt b/mongodb-1.9.0/tests/readPreference/readpreference-ctor_error-007.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/readPreference/readpreference-ctor_error-007.phpt
rename to mongodb-1.9.0/tests/readPreference/readpreference-ctor_error-007.phpt
diff --git a/mongodb-1.8.1/tests/readPreference/readpreference-debug-001.phpt b/mongodb-1.9.0/tests/readPreference/readpreference-debug-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/readPreference/readpreference-debug-001.phpt
rename to mongodb-1.9.0/tests/readPreference/readpreference-debug-001.phpt
diff --git a/mongodb-1.8.1/tests/readPreference/readpreference-getHedge-001.phpt b/mongodb-1.9.0/tests/readPreference/readpreference-getHedge-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/readPreference/readpreference-getHedge-001.phpt
rename to mongodb-1.9.0/tests/readPreference/readpreference-getHedge-001.phpt
diff --git a/mongodb-1.8.1/tests/readPreference/readpreference-getMaxStalenessMS-001.phpt b/mongodb-1.9.0/tests/readPreference/readpreference-getMaxStalenessMS-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/readPreference/readpreference-getMaxStalenessMS-001.phpt
rename to mongodb-1.9.0/tests/readPreference/readpreference-getMaxStalenessMS-001.phpt
diff --git a/mongodb-1.8.1/tests/readPreference/readpreference-getMaxStalenessMS-002.phpt b/mongodb-1.9.0/tests/readPreference/readpreference-getMaxStalenessMS-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/readPreference/readpreference-getMaxStalenessMS-002.phpt
rename to mongodb-1.9.0/tests/readPreference/readpreference-getMaxStalenessMS-002.phpt
diff --git a/mongodb-1.8.1/tests/readPreference/readpreference-getMode-001.phpt b/mongodb-1.9.0/tests/readPreference/readpreference-getMode-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/readPreference/readpreference-getMode-001.phpt
rename to mongodb-1.9.0/tests/readPreference/readpreference-getMode-001.phpt
diff --git a/mongodb-1.8.1/tests/readPreference/readpreference-getModeString-001.phpt b/mongodb-1.9.0/tests/readPreference/readpreference-getModeString-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/readPreference/readpreference-getModeString-001.phpt
rename to mongodb-1.9.0/tests/readPreference/readpreference-getModeString-001.phpt
diff --git a/mongodb-1.8.1/tests/readPreference/readpreference-getTagSets-001.phpt b/mongodb-1.9.0/tests/readPreference/readpreference-getTagSets-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/readPreference/readpreference-getTagSets-001.phpt
rename to mongodb-1.9.0/tests/readPreference/readpreference-getTagSets-001.phpt
diff --git a/mongodb-1.8.1/tests/readPreference/readpreference-getTagSets-002.phpt b/mongodb-1.9.0/tests/readPreference/readpreference-getTagSets-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/readPreference/readpreference-getTagSets-002.phpt
rename to mongodb-1.9.0/tests/readPreference/readpreference-getTagSets-002.phpt
diff --git a/mongodb-1.8.1/tests/readPreference/readpreference-serialization-001.phpt b/mongodb-1.9.0/tests/readPreference/readpreference-serialization-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/readPreference/readpreference-serialization-001.phpt
rename to mongodb-1.9.0/tests/readPreference/readpreference-serialization-001.phpt
diff --git a/mongodb-1.8.1/tests/readPreference/readpreference-set_state-001.phpt b/mongodb-1.9.0/tests/readPreference/readpreference-set_state-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/readPreference/readpreference-set_state-001.phpt
rename to mongodb-1.9.0/tests/readPreference/readpreference-set_state-001.phpt
diff --git a/mongodb-1.8.1/tests/readPreference/readpreference-set_state_error-001.phpt b/mongodb-1.9.0/tests/readPreference/readpreference-set_state_error-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/readPreference/readpreference-set_state_error-001.phpt
rename to mongodb-1.9.0/tests/readPreference/readpreference-set_state_error-001.phpt
diff --git a/mongodb-1.8.1/tests/readPreference/readpreference-set_state_error-002.phpt b/mongodb-1.9.0/tests/readPreference/readpreference-set_state_error-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/readPreference/readpreference-set_state_error-002.phpt
rename to mongodb-1.9.0/tests/readPreference/readpreference-set_state_error-002.phpt
diff --git a/mongodb-1.8.1/tests/readPreference/readpreference-var_export-001.phpt b/mongodb-1.9.0/tests/readPreference/readpreference-var_export-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/readPreference/readpreference-var_export-001.phpt
rename to mongodb-1.9.0/tests/readPreference/readpreference-var_export-001.phpt
diff --git a/mongodb-1.8.1/tests/readPreference/readpreference_error-001.phpt b/mongodb-1.9.0/tests/readPreference/readpreference_error-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/readPreference/readpreference_error-001.phpt
rename to mongodb-1.9.0/tests/readPreference/readpreference_error-001.phpt
diff --git a/mongodb-1.8.1/tests/replicaset/bug0155.phpt b/mongodb-1.9.0/tests/replicaset/bug0155.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/replicaset/bug0155.phpt
rename to mongodb-1.9.0/tests/replicaset/bug0155.phpt
diff --git a/mongodb-1.8.1/tests/replicaset/bug0898-001.phpt b/mongodb-1.9.0/tests/replicaset/bug0898-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/replicaset/bug0898-001.phpt
rename to mongodb-1.9.0/tests/replicaset/bug0898-001.phpt
diff --git a/mongodb-1.8.1/tests/replicaset/bug0898-002.phpt b/mongodb-1.9.0/tests/replicaset/bug0898-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/replicaset/bug0898-002.phpt
rename to mongodb-1.9.0/tests/replicaset/bug0898-002.phpt
diff --git a/mongodb-1.8.1/tests/replicaset/manager-getservers-001.phpt b/mongodb-1.9.0/tests/replicaset/manager-getservers-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/replicaset/manager-getservers-001.phpt
rename to mongodb-1.9.0/tests/replicaset/manager-getservers-001.phpt
diff --git a/mongodb-1.8.1/tests/replicaset/manager-selectserver-001.phpt b/mongodb-1.9.0/tests/replicaset/manager-selectserver-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/replicaset/manager-selectserver-001.phpt
rename to mongodb-1.9.0/tests/replicaset/manager-selectserver-001.phpt
diff --git a/mongodb-1.8.1/tests/replicaset/readconcern-001.phpt b/mongodb-1.9.0/tests/replicaset/readconcern-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/replicaset/readconcern-001.phpt
rename to mongodb-1.9.0/tests/replicaset/readconcern-001.phpt
diff --git a/mongodb-1.8.1/tests/replicaset/readconcern-002.phpt b/mongodb-1.9.0/tests/replicaset/readconcern-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/replicaset/readconcern-002.phpt
rename to mongodb-1.9.0/tests/replicaset/readconcern-002.phpt
diff --git a/mongodb-1.8.1/tests/replicaset/server-001.phpt b/mongodb-1.9.0/tests/replicaset/server-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/replicaset/server-001.phpt
rename to mongodb-1.9.0/tests/replicaset/server-001.phpt
diff --git a/mongodb-1.8.1/tests/replicaset/server-002.phpt b/mongodb-1.9.0/tests/replicaset/server-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/replicaset/server-002.phpt
rename to mongodb-1.9.0/tests/replicaset/server-002.phpt
diff --git a/mongodb-1.8.1/tests/replicaset/writeconcernerror-001.phpt b/mongodb-1.9.0/tests/replicaset/writeconcernerror-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/replicaset/writeconcernerror-001.phpt
rename to mongodb-1.9.0/tests/replicaset/writeconcernerror-001.phpt
diff --git a/mongodb-1.8.1/tests/replicaset/writeconcernerror-002.phpt b/mongodb-1.9.0/tests/replicaset/writeconcernerror-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/replicaset/writeconcernerror-002.phpt
rename to mongodb-1.9.0/tests/replicaset/writeconcernerror-002.phpt
diff --git a/mongodb-1.8.1/tests/replicaset/writeresult-getserver-001.phpt b/mongodb-1.9.0/tests/replicaset/writeresult-getserver-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/replicaset/writeresult-getserver-001.phpt
rename to mongodb-1.9.0/tests/replicaset/writeresult-getserver-001.phpt
diff --git a/mongodb-1.8.1/tests/replicaset/writeresult-getserver-002.phpt b/mongodb-1.9.0/tests/replicaset/writeresult-getserver-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/replicaset/writeresult-getserver-002.phpt
rename to mongodb-1.9.0/tests/replicaset/writeresult-getserver-002.phpt
diff --git a/mongodb-1.8.1/tests/retryable-reads/retryable-reads-001.phpt b/mongodb-1.9.0/tests/retryable-reads/retryable-reads-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/retryable-reads/retryable-reads-001.phpt
rename to mongodb-1.9.0/tests/retryable-reads/retryable-reads-001.phpt
diff --git a/mongodb-1.8.1/tests/retryable-reads/retryable-reads-002.phpt b/mongodb-1.9.0/tests/retryable-reads/retryable-reads-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/retryable-reads/retryable-reads-002.phpt
rename to mongodb-1.9.0/tests/retryable-reads/retryable-reads-002.phpt
diff --git a/mongodb-1.8.1/tests/retryable-reads/retryable-reads_error-001.phpt b/mongodb-1.9.0/tests/retryable-reads/retryable-reads_error-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/retryable-reads/retryable-reads_error-001.phpt
rename to mongodb-1.9.0/tests/retryable-reads/retryable-reads_error-001.phpt
diff --git a/mongodb-1.8.1/tests/retryable-reads/retryable-reads_error-002.phpt b/mongodb-1.9.0/tests/retryable-reads/retryable-reads_error-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/retryable-reads/retryable-reads_error-002.phpt
rename to mongodb-1.9.0/tests/retryable-reads/retryable-reads_error-002.phpt
diff --git a/mongodb-1.8.1/tests/retryable-writes/retryable-writes-001.phpt b/mongodb-1.9.0/tests/retryable-writes/retryable-writes-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/retryable-writes/retryable-writes-001.phpt
rename to mongodb-1.9.0/tests/retryable-writes/retryable-writes-001.phpt
diff --git a/mongodb-1.8.1/tests/retryable-writes/retryable-writes-002.phpt b/mongodb-1.9.0/tests/retryable-writes/retryable-writes-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/retryable-writes/retryable-writes-002.phpt
rename to mongodb-1.9.0/tests/retryable-writes/retryable-writes-002.phpt
diff --git a/mongodb-1.8.1/tests/retryable-writes/retryable-writes-003.phpt b/mongodb-1.9.0/tests/retryable-writes/retryable-writes-003.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/retryable-writes/retryable-writes-003.phpt
rename to mongodb-1.9.0/tests/retryable-writes/retryable-writes-003.phpt
diff --git a/mongodb-1.8.1/tests/retryable-writes/retryable-writes-004.phpt b/mongodb-1.9.0/tests/retryable-writes/retryable-writes-004.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/retryable-writes/retryable-writes-004.phpt
rename to mongodb-1.9.0/tests/retryable-writes/retryable-writes-004.phpt
diff --git a/mongodb-1.8.1/tests/retryable-writes/retryable-writes-005.phpt b/mongodb-1.9.0/tests/retryable-writes/retryable-writes-005.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/retryable-writes/retryable-writes-005.phpt
rename to mongodb-1.9.0/tests/retryable-writes/retryable-writes-005.phpt
diff --git a/mongodb-1.8.1/tests/retryable-writes/retryable-writes_error-001.phpt b/mongodb-1.9.0/tests/retryable-writes/retryable-writes_error-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/retryable-writes/retryable-writes_error-001.phpt
rename to mongodb-1.9.0/tests/retryable-writes/retryable-writes_error-001.phpt
diff --git a/mongodb-1.8.1/tests/server/bug0671-002.phpt b/mongodb-1.9.0/tests/server/bug0671-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/server/bug0671-002.phpt
rename to mongodb-1.9.0/tests/server/bug0671-002.phpt
diff --git a/mongodb-1.8.1/tests/server/server-constants.phpt b/mongodb-1.9.0/tests/server/server-constants.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/server/server-constants.phpt
rename to mongodb-1.9.0/tests/server/server-constants.phpt
diff --git a/mongodb-1.8.1/tests/server/server-construct-001.phpt b/mongodb-1.9.0/tests/server/server-construct-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/server/server-construct-001.phpt
rename to mongodb-1.9.0/tests/server/server-construct-001.phpt
diff --git a/mongodb-1.8.1/tests/server/server-debug.phpt b/mongodb-1.9.0/tests/server/server-debug.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/server/server-debug.phpt
rename to mongodb-1.9.0/tests/server/server-debug.phpt
diff --git a/mongodb-1.9.0/tests/server/server-errors.phpt b/mongodb-1.9.0/tests/server/server-errors.phpt
new file mode 100644
index 00000000..19f6f261
--- /dev/null
+++ b/mongodb-1.9.0/tests/server/server-errors.phpt
@@ -0,0 +1,61 @@
+--TEST--
+MongoDB\Driver\Server argument count errors
+--SKIPIF--
+<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
+<?php skip_if_php_version('>=', '7.99'); ?>
+<?php skip_if_not_live(); ?>
+<?php skip_if_not_clean(); ?>
+--FILE--
+<?php
+require_once __DIR__ . "/../utils/basic.inc";
+
+$manager = new MongoDB\Driver\Manager(URI);
+$server = $manager->executeQuery(NS, new MongoDB\Driver\Query(array()))->getServer();
+
+$methods = [
+ 'getHost',
+ 'getTags',
+ 'getInfo',
+ 'getLatency',
+ 'getPort',
+ 'getType',
+ 'isPrimary',
+ 'isSecondary',
+ 'isArbiter',
+ 'isHidden',
+ 'isPassive',
+];
+
+foreach ($methods as $method) {
+ echo throws(function() use ($server, $method) {
+ $server->{$method}(true);
+ }, MongoDB\Driver\Exception\InvalidArgumentException::class), "\n";
+}
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECTF--
+OK: Got MongoDB\Driver\Exception\InvalidArgumentException
+MongoDB\Driver\Server::getHost() expects exactly 0 %r(argument|parameter)%rs, 1 given
+OK: Got MongoDB\Driver\Exception\InvalidArgumentException
+MongoDB\Driver\Server::getTags() expects exactly 0 %r(argument|parameter)%rs, 1 given
+OK: Got MongoDB\Driver\Exception\InvalidArgumentException
+MongoDB\Driver\Server::getInfo() expects exactly 0 %r(argument|parameter)%rs, 1 given
+OK: Got MongoDB\Driver\Exception\InvalidArgumentException
+MongoDB\Driver\Server::getLatency() expects exactly 0 %r(argument|parameter)%rs, 1 given
+OK: Got MongoDB\Driver\Exception\InvalidArgumentException
+MongoDB\Driver\Server::getPort() expects exactly 0 %r(argument|parameter)%rs, 1 given
+OK: Got MongoDB\Driver\Exception\InvalidArgumentException
+MongoDB\Driver\Server::getType() expects exactly 0 %r(argument|parameter)%rs, 1 given
+OK: Got MongoDB\Driver\Exception\InvalidArgumentException
+MongoDB\Driver\Server::isPrimary() expects exactly 0 %r(argument|parameter)%rs, 1 given
+OK: Got MongoDB\Driver\Exception\InvalidArgumentException
+MongoDB\Driver\Server::isSecondary() expects exactly 0 %r(argument|parameter)%rs, 1 given
+OK: Got MongoDB\Driver\Exception\InvalidArgumentException
+MongoDB\Driver\Server::isArbiter() expects exactly 0 %r(argument|parameter)%rs, 1 given
+OK: Got MongoDB\Driver\Exception\InvalidArgumentException
+MongoDB\Driver\Server::isHidden() expects exactly 0 %r(argument|parameter)%rs, 1 given
+OK: Got MongoDB\Driver\Exception\InvalidArgumentException
+MongoDB\Driver\Server::isPassive() expects exactly 0 %r(argument|parameter)%rs, 1 given
+===DONE===
diff --git a/mongodb-1.8.1/tests/server/server-executeBulkWrite-001.phpt b/mongodb-1.9.0/tests/server/server-executeBulkWrite-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/server/server-executeBulkWrite-001.phpt
rename to mongodb-1.9.0/tests/server/server-executeBulkWrite-001.phpt
diff --git a/mongodb-1.8.1/tests/server/server-executeBulkWrite-002.phpt b/mongodb-1.9.0/tests/server/server-executeBulkWrite-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/server/server-executeBulkWrite-002.phpt
rename to mongodb-1.9.0/tests/server/server-executeBulkWrite-002.phpt
diff --git a/mongodb-1.8.1/tests/server/server-executeBulkWrite-003.phpt b/mongodb-1.9.0/tests/server/server-executeBulkWrite-003.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/server/server-executeBulkWrite-003.phpt
rename to mongodb-1.9.0/tests/server/server-executeBulkWrite-003.phpt
diff --git a/mongodb-1.8.1/tests/server/server-executeBulkWrite-004.phpt b/mongodb-1.9.0/tests/server/server-executeBulkWrite-004.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/server/server-executeBulkWrite-004.phpt
rename to mongodb-1.9.0/tests/server/server-executeBulkWrite-004.phpt
diff --git a/mongodb-1.8.1/tests/server/server-executeBulkWrite-005.phpt b/mongodb-1.9.0/tests/server/server-executeBulkWrite-005.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/server/server-executeBulkWrite-005.phpt
rename to mongodb-1.9.0/tests/server/server-executeBulkWrite-005.phpt
diff --git a/mongodb-1.8.1/tests/server/server-executeBulkWrite-006.phpt b/mongodb-1.9.0/tests/server/server-executeBulkWrite-006.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/server/server-executeBulkWrite-006.phpt
rename to mongodb-1.9.0/tests/server/server-executeBulkWrite-006.phpt
diff --git a/mongodb-1.8.1/tests/server/server-executeBulkWrite-007.phpt b/mongodb-1.9.0/tests/server/server-executeBulkWrite-007.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/server/server-executeBulkWrite-007.phpt
rename to mongodb-1.9.0/tests/server/server-executeBulkWrite-007.phpt
diff --git a/mongodb-1.8.1/tests/server/server-executeBulkWrite-008.phpt b/mongodb-1.9.0/tests/server/server-executeBulkWrite-008.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/server/server-executeBulkWrite-008.phpt
rename to mongodb-1.9.0/tests/server/server-executeBulkWrite-008.phpt
diff --git a/mongodb-1.9.0/tests/server/server-executeBulkWrite-009.phpt b/mongodb-1.9.0/tests/server/server-executeBulkWrite-009.phpt
new file mode 100644
index 00000000..ee879ffc
--- /dev/null
+++ b/mongodb-1.9.0/tests/server/server-executeBulkWrite-009.phpt
@@ -0,0 +1,37 @@
+--TEST--
+MongoDB\Driver\Server::executeBulkWrite() write concern inheritance
+--SKIPIF--
+<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
+<?php skip_if_not_replica_set(); ?>
+<?php skip_if_not_enough_data_nodes(2); /* w:2 */ ?>
+<?php skip_if_not_clean(); ?>
+--FILE--
+<?php
+require_once __DIR__ . "/../utils/basic.inc";
+require_once __DIR__ . "/../utils/observer.php";
+
+$manager = new MongoDB\Driver\Manager(URI, ['w' => 2, 'wtimeoutms' => 1000]);
+$server = $manager->selectServer(new MongoDB\Driver\ReadPreference('primary'));
+
+(new CommandObserver)->observe(
+ function() use ($server) {
+ $bulk = new MongoDB\Driver\BulkWrite;
+ $bulk->insert(['x' => 1]);
+ $server->executeBulkWrite(NS, $bulk);
+
+ $bulk = new MongoDB\Driver\BulkWrite;
+ $bulk->insert(['x' => 1]);
+ $server->executeBulkWrite(NS, $bulk, ['writeConcern' => new MongoDB\Driver\WriteConcern(1)]);
+ },
+ function(stdClass $command) {
+ echo json_encode($command->writeConcern), "\n";
+ }
+);
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+{"w":2,"wtimeout":1000}
+{"w":1}
+===DONE===
diff --git a/mongodb-1.8.1/tests/server/server-executeBulkWrite_error-001.phpt b/mongodb-1.9.0/tests/server/server-executeBulkWrite_error-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/server/server-executeBulkWrite_error-001.phpt
rename to mongodb-1.9.0/tests/server/server-executeBulkWrite_error-001.phpt
diff --git a/mongodb-1.8.1/tests/server/server-executeBulkWrite_error-002.phpt b/mongodb-1.9.0/tests/server/server-executeBulkWrite_error-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/server/server-executeBulkWrite_error-002.phpt
rename to mongodb-1.9.0/tests/server/server-executeBulkWrite_error-002.phpt
diff --git a/mongodb-1.8.1/tests/server/server-executeCommand-001.phpt b/mongodb-1.9.0/tests/server/server-executeCommand-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/server/server-executeCommand-001.phpt
rename to mongodb-1.9.0/tests/server/server-executeCommand-001.phpt
diff --git a/mongodb-1.8.1/tests/server/server-executeCommand-002.phpt b/mongodb-1.9.0/tests/server/server-executeCommand-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/server/server-executeCommand-002.phpt
rename to mongodb-1.9.0/tests/server/server-executeCommand-002.phpt
diff --git a/mongodb-1.8.1/tests/server/server-executeCommand-003.phpt b/mongodb-1.9.0/tests/server/server-executeCommand-003.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/server/server-executeCommand-003.phpt
rename to mongodb-1.9.0/tests/server/server-executeCommand-003.phpt
diff --git a/mongodb-1.8.1/tests/server/server-executeCommand-004.phpt b/mongodb-1.9.0/tests/server/server-executeCommand-004.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/server/server-executeCommand-004.phpt
rename to mongodb-1.9.0/tests/server/server-executeCommand-004.phpt
diff --git a/mongodb-1.8.1/tests/server/server-executeCommand-005.phpt b/mongodb-1.9.0/tests/server/server-executeCommand-005.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/server/server-executeCommand-005.phpt
rename to mongodb-1.9.0/tests/server/server-executeCommand-005.phpt
diff --git a/mongodb-1.8.1/tests/server/server-executeCommand-006.phpt b/mongodb-1.9.0/tests/server/server-executeCommand-006.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/server/server-executeCommand-006.phpt
rename to mongodb-1.9.0/tests/server/server-executeCommand-006.phpt
diff --git a/mongodb-1.8.1/tests/server/server-executeCommand-007.phpt b/mongodb-1.9.0/tests/server/server-executeCommand-007.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/server/server-executeCommand-007.phpt
rename to mongodb-1.9.0/tests/server/server-executeCommand-007.phpt
diff --git a/mongodb-1.8.1/tests/server/server-executeCommand-008.phpt b/mongodb-1.9.0/tests/server/server-executeCommand-008.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/server/server-executeCommand-008.phpt
rename to mongodb-1.9.0/tests/server/server-executeCommand-008.phpt
diff --git a/mongodb-1.8.1/tests/server/server-executeCommand-009.phpt b/mongodb-1.9.0/tests/server/server-executeCommand-009.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/server/server-executeCommand-009.phpt
rename to mongodb-1.9.0/tests/server/server-executeCommand-009.phpt
diff --git a/mongodb-1.9.0/tests/server/server-executeCommand-010.phpt b/mongodb-1.9.0/tests/server/server-executeCommand-010.phpt
new file mode 100644
index 00000000..16c1bf6d
--- /dev/null
+++ b/mongodb-1.9.0/tests/server/server-executeCommand-010.phpt
@@ -0,0 +1,48 @@
+--TEST--
+MongoDB\Driver\Server::executeCommand() does not inherit read or write concern
+--SKIPIF--
+<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
+<?php skip_if_not_replica_set(); ?>
+<?php skip_if_not_enough_data_nodes(2); /* w:2 */ ?>
+<?php skip_if_server_version('<', '3.6'); /* readConcernLevel:available */ ?>
+<?php skip_if_not_clean(); ?>
+--FILE--
+<?php
+require_once __DIR__ . "/../utils/basic.inc";
+require_once __DIR__ . "/../utils/observer.php";
+
+$manager = new MongoDB\Driver\Manager(URI, ['readConcernLevel' => 'local', 'w' => 2, 'wtimeoutms' => 1000]);
+$server = $manager->selectServer(new MongoDB\Driver\ReadPreference('primary'));
+
+$command = new MongoDB\Driver\Command([
+ 'aggregate' => COLLECTION_NAME,
+ 'pipeline' => [
+ ['$group' => ['_id' => 1]],
+ ['$out' => COLLECTION_NAME . '.out'],
+ ],
+ 'cursor' => (object) [],
+]);
+
+(new CommandObserver)->observe(
+ function() use ($server, $command) {
+ $server->executeCommand(DATABASE_NAME, $command);
+ $server->executeCommand(DATABASE_NAME, $command, [
+ 'readConcern' => new MongoDB\Driver\ReadConcern(MongoDB\Driver\ReadConcern::AVAILABLE),
+ 'writeConcern' => new MongoDB\Driver\WriteConcern(1),
+ ]);
+ },
+ function(stdClass $command) {
+ echo json_encode($command->readConcern ?? null), "\n";
+ echo json_encode($command->writeConcern ?? null), "\n";
+ }
+);
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+null
+null
+{"level":"available"}
+{"w":1}
+===DONE===
diff --git a/mongodb-1.8.1/tests/server/server-executeCommand_error-001.phpt b/mongodb-1.9.0/tests/server/server-executeCommand_error-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/server/server-executeCommand_error-001.phpt
rename to mongodb-1.9.0/tests/server/server-executeCommand_error-001.phpt
diff --git a/mongodb-1.8.1/tests/server/server-executeQuery-001.phpt b/mongodb-1.9.0/tests/server/server-executeQuery-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/server/server-executeQuery-001.phpt
rename to mongodb-1.9.0/tests/server/server-executeQuery-001.phpt
diff --git a/mongodb-1.8.1/tests/server/server-executeQuery-002.phpt b/mongodb-1.9.0/tests/server/server-executeQuery-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/server/server-executeQuery-002.phpt
rename to mongodb-1.9.0/tests/server/server-executeQuery-002.phpt
diff --git a/mongodb-1.8.1/tests/server/server-executeQuery-003.phpt b/mongodb-1.9.0/tests/server/server-executeQuery-003.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/server/server-executeQuery-003.phpt
rename to mongodb-1.9.0/tests/server/server-executeQuery-003.phpt
diff --git a/mongodb-1.8.1/tests/server/server-executeQuery-004.phpt b/mongodb-1.9.0/tests/server/server-executeQuery-004.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/server/server-executeQuery-004.phpt
rename to mongodb-1.9.0/tests/server/server-executeQuery-004.phpt
diff --git a/mongodb-1.8.1/tests/server/server-executeQuery-005.phpt b/mongodb-1.9.0/tests/server/server-executeQuery-005.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/server/server-executeQuery-005.phpt
rename to mongodb-1.9.0/tests/server/server-executeQuery-005.phpt
diff --git a/mongodb-1.8.1/tests/server/server-executeQuery-006.phpt b/mongodb-1.9.0/tests/server/server-executeQuery-006.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/server/server-executeQuery-006.phpt
rename to mongodb-1.9.0/tests/server/server-executeQuery-006.phpt
diff --git a/mongodb-1.8.1/tests/server/server-executeQuery-007.phpt b/mongodb-1.9.0/tests/server/server-executeQuery-007.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/server/server-executeQuery-007.phpt
rename to mongodb-1.9.0/tests/server/server-executeQuery-007.phpt
diff --git a/mongodb-1.8.1/tests/server/server-executeQuery-008.phpt b/mongodb-1.9.0/tests/server/server-executeQuery-008.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/server/server-executeQuery-008.phpt
rename to mongodb-1.9.0/tests/server/server-executeQuery-008.phpt
diff --git a/mongodb-1.8.1/tests/server/server-executeQuery-009.phpt b/mongodb-1.9.0/tests/server/server-executeQuery-009.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/server/server-executeQuery-009.phpt
rename to mongodb-1.9.0/tests/server/server-executeQuery-009.phpt
diff --git a/mongodb-1.8.1/tests/server/server-executeQuery-010.phpt b/mongodb-1.9.0/tests/server/server-executeQuery-010.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/server/server-executeQuery-010.phpt
rename to mongodb-1.9.0/tests/server/server-executeQuery-010.phpt
diff --git a/mongodb-1.8.1/tests/server/server-executeQuery-011.phpt b/mongodb-1.9.0/tests/server/server-executeQuery-011.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/server/server-executeQuery-011.phpt
rename to mongodb-1.9.0/tests/server/server-executeQuery-011.phpt
diff --git a/mongodb-1.9.0/tests/server/server-executeQuery-012.phpt b/mongodb-1.9.0/tests/server/server-executeQuery-012.phpt
new file mode 100644
index 00000000..f501fb3d
--- /dev/null
+++ b/mongodb-1.9.0/tests/server/server-executeQuery-012.phpt
@@ -0,0 +1,68 @@
+--TEST--
+MongoDB\Driver\Server::executeQuery() pins transaction to server
+--SKIPIF--
+<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
+<?php skip_if_not_mongos_with_replica_set(); ?>
+<?php skip_if_server_version('<', '4.1.6'); ?>
+<?php skip_if_not_clean(); ?>
+--FILE--
+<?php
+require_once __DIR__ . "/../utils/basic.inc";
+
+$manager = new MongoDB\Driver\Manager(URI);
+
+/* Create collections as that can't be (automatically) done in a transaction */
+$manager->executeCommand(
+ DATABASE_NAME,
+ new \MongoDB\Driver\Command([ 'create' => COLLECTION_NAME ]),
+ [ 'writeConcern' => new \MongoDB\Driver\WriteConcern( \MongoDB\Driver\WriteConcern::MAJORITY ) ]
+);
+
+$servers = $manager->getServers();
+$selectedServer = array_pop($servers);
+$wrongServer = array_pop($servers);
+var_dump($selectedServer != $wrongServer);
+
+$session = $manager->startSession();
+var_dump($session->getServer() instanceof \MongoDB\Driver\Server);
+
+$session->startTransaction();
+var_dump($session->getServer() instanceof \MongoDB\Driver\Server);
+
+$query = new MongoDB\Driver\Query([]);
+$selectedServer->executeQuery(NS, $query, ['session' => $session]);
+
+var_dump($session->getServer() == $selectedServer);
+
+$bulk = new MongoDB\Driver\BulkWrite();
+$bulk->insert(['x' => 1]);
+$selectedServer->executeBulkWrite(NS, $bulk, ['session' => $session]);
+
+echo throws(function () use ($wrongServer, $session) {
+ $query = new MongoDB\Driver\Query([]);
+ $wrongServer->executeQuery(NS, $query, ['session' => $session]);
+}, \MongoDB\Driver\Exception\RuntimeException::class), "\n";
+
+$session->commitTransaction();
+
+var_dump($session->getServer() == $selectedServer);
+
+$bulk = new MongoDB\Driver\BulkWrite();
+$bulk->insert(['x' => 1]);
+$selectedServer->executeBulkWrite(NS, $bulk, ['session' => $session]);
+
+var_dump($session->getServer() instanceof \MongoDB\Driver\Server);
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+bool(true)
+bool(false)
+bool(false)
+bool(true)
+OK: Got MongoDB\Driver\Exception\RuntimeException
+Requested server id does not matched pinned server id
+bool(true)
+bool(false)
+===DONE===
diff --git a/mongodb-1.9.0/tests/server/server-executeQuery-013.phpt b/mongodb-1.9.0/tests/server/server-executeQuery-013.phpt
new file mode 100644
index 00000000..a3324924
--- /dev/null
+++ b/mongodb-1.9.0/tests/server/server-executeQuery-013.phpt
@@ -0,0 +1,34 @@
+--TEST--
+MongoDB\Driver\Server::executeQuery() read concern inheritance
+--SKIPIF--
+<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
+<?php skip_if_not_replica_set(); ?>
+<?php skip_if_server_version('<', '3.6'); /* readConcernLevel:available */ ?>
+<?php skip_if_not_clean(); ?>
+--FILE--
+<?php
+require_once __DIR__ . "/../utils/basic.inc";
+require_once __DIR__ . "/../utils/observer.php";
+
+$manager = new MongoDB\Driver\Manager(URI, ['readConcernLevel' => 'local']);
+$server = $manager->selectServer(new MongoDB\Driver\ReadPreference('primary'));
+
+(new CommandObserver)->observe(
+ function() use ($server) {
+ $server->executeQuery(NS, new MongoDB\Driver\Query([]));
+ $server->executeQuery(NS, new MongoDB\Driver\Query([], [
+ 'readConcern' => new MongoDB\Driver\ReadConcern(MongoDB\Driver\ReadConcern::AVAILABLE),
+ ]));
+ },
+ function(stdClass $command) {
+ echo json_encode($command->readConcern), "\n";
+ }
+);
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+{"level":"local"}
+{"level":"available"}
+===DONE===
diff --git a/mongodb-1.8.1/tests/server/server-executeQuery_error-001.phpt b/mongodb-1.9.0/tests/server/server-executeQuery_error-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/server/server-executeQuery_error-001.phpt
rename to mongodb-1.9.0/tests/server/server-executeQuery_error-001.phpt
diff --git a/mongodb-1.8.1/tests/server/server-executeReadCommand-001.phpt b/mongodb-1.9.0/tests/server/server-executeReadCommand-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/server/server-executeReadCommand-001.phpt
rename to mongodb-1.9.0/tests/server/server-executeReadCommand-001.phpt
diff --git a/mongodb-1.9.0/tests/server/server-executeReadCommand-002.phpt b/mongodb-1.9.0/tests/server/server-executeReadCommand-002.phpt
new file mode 100644
index 00000000..8e5b3695
--- /dev/null
+++ b/mongodb-1.9.0/tests/server/server-executeReadCommand-002.phpt
@@ -0,0 +1,76 @@
+--TEST--
+MongoDB\Driver\Server::executeReadCommand() pins transaction to server
+--SKIPIF--
+<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
+<?php skip_if_not_mongos_with_replica_set(); ?>
+<?php skip_if_server_version('<', '4.1.6'); ?>
+<?php skip_if_not_clean(); ?>
+--FILE--
+<?php
+require_once __DIR__ . "/../utils/basic.inc";
+
+$manager = new MongoDB\Driver\Manager(URI);
+
+/* Create collections as that can't be (automatically) done in a transaction */
+$manager->executeCommand(
+ DATABASE_NAME,
+ new \MongoDB\Driver\Command([ 'create' => COLLECTION_NAME ]),
+ [ 'writeConcern' => new \MongoDB\Driver\WriteConcern( \MongoDB\Driver\WriteConcern::MAJORITY ) ]
+);
+
+$servers = $manager->getServers();
+$selectedServer = array_pop($servers);
+$wrongServer = array_pop($servers);
+var_dump($selectedServer != $wrongServer);
+
+$session = $manager->startSession();
+var_dump($session->getServer() instanceof \MongoDB\Driver\Server);
+
+$session->startTransaction();
+var_dump($session->getServer() instanceof \MongoDB\Driver\Server);
+
+$command = new MongoDB\Driver\Command([
+ 'aggregate' => COLLECTION_NAME,
+ 'pipeline' => [['$group' => ['_id' => 1]]],
+ 'cursor' => (object) []
+]);
+$selectedServer->executeReadCommand(DATABASE_NAME, $command, ['session' => $session]);
+
+var_dump($session->getServer() instanceof \MongoDB\Driver\Server);
+
+$bulk = new MongoDB\Driver\BulkWrite();
+$bulk->insert(['x' => 1]);
+$selectedServer->executeBulkWrite(NS, $bulk, ['session' => $session]);
+
+echo throws(function () use ($wrongServer, $session) {
+ $command = new MongoDB\Driver\Command([
+ 'aggregate' => COLLECTION_NAME,
+ 'pipeline' => [['$group' => ['_id' => 1]]],
+ 'cursor' => (object) []
+ ]);
+ $wrongServer->executeReadCommand(DATABASE_NAME, $command, ['session' => $session]);
+}, \MongoDB\Driver\Exception\RuntimeException::class), "\n";
+
+$session->commitTransaction();
+
+var_dump($session->getServer() instanceof \MongoDB\Driver\Server);
+
+$bulk = new MongoDB\Driver\BulkWrite();
+$bulk->insert(['x' => 1]);
+$selectedServer->executeBulkWrite(NS, $bulk, ['session' => $session]);
+
+var_dump($session->getServer() instanceof \MongoDB\Driver\Server);
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+bool(true)
+bool(false)
+bool(false)
+bool(true)
+OK: Got MongoDB\Driver\Exception\RuntimeException
+Requested server id does not matched pinned server id
+bool(true)
+bool(false)
+===DONE===
diff --git a/mongodb-1.9.0/tests/server/server-executeReadCommand-003.phpt b/mongodb-1.9.0/tests/server/server-executeReadCommand-003.phpt
new file mode 100644
index 00000000..aabccfb0
--- /dev/null
+++ b/mongodb-1.9.0/tests/server/server-executeReadCommand-003.phpt
@@ -0,0 +1,40 @@
+--TEST--
+MongoDB\Driver\Server::executeReadCommand() read concern inheritance
+--SKIPIF--
+<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
+<?php skip_if_not_replica_set(); ?>
+<?php skip_if_server_version('<', '3.6'); /* readConcernLevel:available */ ?>
+<?php skip_if_not_clean(); ?>
+--FILE--
+<?php
+require_once __DIR__ . "/../utils/basic.inc";
+require_once __DIR__ . "/../utils/observer.php";
+
+$manager = new MongoDB\Driver\Manager(URI, ['readConcernLevel' => 'local']);
+$server = $manager->selectServer(new MongoDB\Driver\ReadPreference('primary'));
+
+$command = new MongoDB\Driver\Command([
+ 'aggregate' => COLLECTION_NAME,
+ 'pipeline' => [['$group' => ['_id' => 1]]],
+ 'cursor' => (object) [],
+]);
+
+(new CommandObserver)->observe(
+ function() use ($server, $command) {
+ $server->executeReadCommand(DATABASE_NAME, $command);
+ $server->executeReadCommand(DATABASE_NAME, $command, [
+ 'readConcern' => new MongoDB\Driver\ReadConcern(MongoDB\Driver\ReadConcern::AVAILABLE),
+ ]);
+ },
+ function(stdClass $command) {
+ echo json_encode($command->readConcern), "\n";
+ }
+);
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+{"level":"local"}
+{"level":"available"}
+===DONE===
diff --git a/mongodb-1.8.1/tests/server/server-executeReadCommand_error-001.phpt b/mongodb-1.9.0/tests/server/server-executeReadCommand_error-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/server/server-executeReadCommand_error-001.phpt
rename to mongodb-1.9.0/tests/server/server-executeReadCommand_error-001.phpt
diff --git a/mongodb-1.8.1/tests/server/server-executeReadWriteCommand-001.phpt b/mongodb-1.9.0/tests/server/server-executeReadWriteCommand-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/server/server-executeReadWriteCommand-001.phpt
rename to mongodb-1.9.0/tests/server/server-executeReadWriteCommand-001.phpt
diff --git a/mongodb-1.9.0/tests/server/server-executeReadWriteCommand-002.phpt b/mongodb-1.9.0/tests/server/server-executeReadWriteCommand-002.phpt
new file mode 100644
index 00000000..de0347af
--- /dev/null
+++ b/mongodb-1.9.0/tests/server/server-executeReadWriteCommand-002.phpt
@@ -0,0 +1,76 @@
+--TEST--
+MongoDB\Driver\Server::executeReadWriteCommand() pins transaction to server
+--SKIPIF--
+<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
+<?php skip_if_not_mongos_with_replica_set(); ?>
+<?php skip_if_server_version('<', '4.1.6'); ?>
+<?php skip_if_not_clean(); ?>
+--FILE--
+<?php
+require_once __DIR__ . "/../utils/basic.inc";
+
+$manager = new MongoDB\Driver\Manager(URI);
+
+/* Create collections as that can't be (automatically) done in a transaction */
+$manager->executeReadWriteCommand(
+ DATABASE_NAME,
+ new \MongoDB\Driver\Command([ 'create' => COLLECTION_NAME ]),
+ [ 'writeConcern' => new \MongoDB\Driver\WriteConcern( \MongoDB\Driver\WriteConcern::MAJORITY ) ]
+);
+
+$servers = $manager->getServers();
+$selectedServer = array_pop($servers);
+$wrongServer = array_pop($servers);
+var_dump($selectedServer != $wrongServer);
+
+$session = $manager->startSession();
+var_dump($session->getServer() instanceof \MongoDB\Driver\Server);
+
+$session->startTransaction();
+var_dump($session->getServer() instanceof \MongoDB\Driver\Server);
+
+$command = new MongoDB\Driver\Command([
+ 'aggregate' => COLLECTION_NAME,
+ 'pipeline' => [['$group' => ['_id' => 1]]],
+ 'cursor' => (object) []
+]);
+$selectedServer->executeReadWriteCommand(DATABASE_NAME, $command, ['session' => $session]);
+
+var_dump($session->getServer() instanceof \MongoDB\Driver\Server);
+
+$bulk = new MongoDB\Driver\BulkWrite();
+$bulk->insert(['x' => 1]);
+$selectedServer->executeBulkWrite(NS, $bulk, ['session' => $session]);
+
+echo throws(function () use ($wrongServer, $session) {
+ $command = new MongoDB\Driver\Command([
+ 'aggregate' => COLLECTION_NAME,
+ 'pipeline' => [['$group' => ['_id' => 1]]],
+ 'cursor' => (object) []
+ ]);
+ $wrongServer->executeReadCommand(DATABASE_NAME, $command, ['session' => $session]);
+}, \MongoDB\Driver\Exception\RuntimeException::class), "\n";
+
+$session->commitTransaction();
+
+var_dump($session->getServer() instanceof \MongoDB\Driver\Server);
+
+$bulk = new MongoDB\Driver\BulkWrite();
+$bulk->insert(['x' => 1]);
+$selectedServer->executeBulkWrite(NS, $bulk, ['session' => $session]);
+
+var_dump($session->getServer() instanceof \MongoDB\Driver\Server);
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+bool(true)
+bool(false)
+bool(false)
+bool(true)
+OK: Got MongoDB\Driver\Exception\RuntimeException
+Requested server id does not matched pinned server id
+bool(true)
+bool(false)
+===DONE===
diff --git a/mongodb-1.9.0/tests/server/server-executeReadWriteCommand-003.phpt b/mongodb-1.9.0/tests/server/server-executeReadWriteCommand-003.phpt
new file mode 100644
index 00000000..594e4126
--- /dev/null
+++ b/mongodb-1.9.0/tests/server/server-executeReadWriteCommand-003.phpt
@@ -0,0 +1,48 @@
+--TEST--
+MongoDB\Driver\Server::executeReadWriteCommand() read and write concern inheritance
+--SKIPIF--
+<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
+<?php skip_if_not_replica_set(); ?>
+<?php skip_if_not_enough_data_nodes(2); /* w:2 */ ?>
+<?php skip_if_server_version('<', '3.6'); /* readConcernLevel:available */ ?>
+<?php skip_if_not_clean(); ?>
+--FILE--
+<?php
+require_once __DIR__ . "/../utils/basic.inc";
+require_once __DIR__ . "/../utils/observer.php";
+
+$manager = new MongoDB\Driver\Manager(URI, ['readConcernLevel' => 'local', 'w' => 2, 'wtimeoutms' => 1000]);
+$server = $manager->selectServer(new MongoDB\Driver\ReadPreference('primary'));
+
+$command = new MongoDB\Driver\Command([
+ 'aggregate' => COLLECTION_NAME,
+ 'pipeline' => [
+ ['$group' => ['_id' => 1]],
+ ['$out' => COLLECTION_NAME . '.out'],
+ ],
+ 'cursor' => (object) [],
+]);
+
+(new CommandObserver)->observe(
+ function() use ($server, $command) {
+ $server->executeReadWriteCommand(DATABASE_NAME, $command);
+ $server->executeReadWriteCommand(DATABASE_NAME, $command, [
+ 'readConcern' => new MongoDB\Driver\ReadConcern(MongoDB\Driver\ReadConcern::AVAILABLE),
+ 'writeConcern' => new MongoDB\Driver\WriteConcern(1),
+ ]);
+ },
+ function(stdClass $command) {
+ echo json_encode($command->readConcern), "\n";
+ echo json_encode($command->writeConcern), "\n";
+ }
+);
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+{"level":"local"}
+{"w":2,"wtimeout":1000}
+{"level":"available"}
+{"w":1}
+===DONE===
diff --git a/mongodb-1.8.1/tests/server/server-executeReadWriteCommand_error-001.phpt b/mongodb-1.9.0/tests/server/server-executeReadWriteCommand_error-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/server/server-executeReadWriteCommand_error-001.phpt
rename to mongodb-1.9.0/tests/server/server-executeReadWriteCommand_error-001.phpt
diff --git a/mongodb-1.8.1/tests/server/server-executeWriteCommand-001.phpt b/mongodb-1.9.0/tests/server/server-executeWriteCommand-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/server/server-executeWriteCommand-001.phpt
rename to mongodb-1.9.0/tests/server/server-executeWriteCommand-001.phpt
diff --git a/mongodb-1.9.0/tests/server/server-executeWriteCommand-002.phpt b/mongodb-1.9.0/tests/server/server-executeWriteCommand-002.phpt
new file mode 100644
index 00000000..c1cc8f18
--- /dev/null
+++ b/mongodb-1.9.0/tests/server/server-executeWriteCommand-002.phpt
@@ -0,0 +1,80 @@
+--TEST--
+MongoDB\Driver\Server::executeWriteCommand() pins transaction to server
+--SKIPIF--
+<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
+<?php skip_if_not_mongos_with_replica_set(); ?>
+<?php skip_if_server_version('<', '4.1.6'); ?>
+<?php skip_if_not_clean(); ?>
+--FILE--
+<?php
+require_once __DIR__ . "/../utils/basic.inc";
+
+$manager = new MongoDB\Driver\Manager(URI);
+
+/* Create collections as that can't be (automatically) done in a transaction */
+$manager->executeCommand(
+ DATABASE_NAME,
+ new \MongoDB\Driver\Command([ 'create' => COLLECTION_NAME ]),
+ [ 'writeConcern' => new \MongoDB\Driver\WriteConcern( \MongoDB\Driver\WriteConcern::MAJORITY ) ]
+);
+
+$servers = $manager->getServers();
+$selectedServer = array_pop($servers);
+$wrongServer = array_pop($servers);
+var_dump($selectedServer != $wrongServer);
+
+$session = $manager->startSession();
+var_dump($session->getServer() instanceof \MongoDB\Driver\Server);
+
+$session->startTransaction();
+var_dump($session->getServer() instanceof \MongoDB\Driver\Server);
+
+$command = new MongoDB\Driver\Command([
+ 'findAndModify' => COLLECTION_NAME,
+ 'query' => ['_id' => 'foo'],
+ 'upsert' => true,
+ 'new' => true,
+ 'update' => ['x' => 1]
+]);
+$selectedServer->executeWriteCommand(DATABASE_NAME, $command, ['session' => $session]);
+
+var_dump($session->getServer() instanceof \MongoDB\Driver\Server);
+
+$bulk = new MongoDB\Driver\BulkWrite();
+$bulk->insert(['x' => 1]);
+$selectedServer->executeBulkWrite(NS, $bulk, ['session' => $session]);
+
+echo throws(function () use ($wrongServer, $session) {
+ $command = new MongoDB\Driver\Command([
+ 'findAndModify' => COLLECTION_NAME,
+ 'query' => ['_id' => 'foo'],
+ 'upsert' => true,
+ 'new' => true,
+ 'update' => ['x' => 1]
+ ]);
+ $wrongServer->executeWriteCommand(DATABASE_NAME, $command, ['session' => $session]);
+}, \MongoDB\Driver\Exception\RuntimeException::class), "\n";
+
+$session->commitTransaction();
+
+var_dump($session->getServer() instanceof \MongoDB\Driver\Server);
+
+$bulk = new MongoDB\Driver\BulkWrite();
+$bulk->insert(['x' => 1]);
+$selectedServer->executeBulkWrite(NS, $bulk, ['session' => $session]);
+
+var_dump($session->getServer() instanceof \MongoDB\Driver\Server);
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+bool(true)
+bool(false)
+bool(false)
+bool(true)
+OK: Got MongoDB\Driver\Exception\RuntimeException
+Requested server id does not matched pinned server id
+bool(true)
+bool(false)
+===DONE===
diff --git a/mongodb-1.9.0/tests/server/server-executeWriteCommand-003.phpt b/mongodb-1.9.0/tests/server/server-executeWriteCommand-003.phpt
new file mode 100644
index 00000000..d1494dd1
--- /dev/null
+++ b/mongodb-1.9.0/tests/server/server-executeWriteCommand-003.phpt
@@ -0,0 +1,41 @@
+--TEST--
+MongoDB\Driver\Server::executeWriteCommand() write concern inheritance
+--SKIPIF--
+<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
+<?php skip_if_not_replica_set(); ?>
+<?php skip_if_not_enough_data_nodes(2); /* w:2 */ ?>
+<?php skip_if_server_version('<', '3.2'); /* findAndModify writeConcern */ ?>
+<?php skip_if_not_clean(); ?>
+--FILE--
+<?php
+require_once __DIR__ . "/../utils/basic.inc";
+require_once __DIR__ . "/../utils/observer.php";
+
+$manager = new MongoDB\Driver\Manager(URI, ['w' => 2, 'wtimeoutms' => 1000]);
+$server = $manager->selectServer(new MongoDB\Driver\ReadPreference('primary'));
+
+$command = new MongoDB\Driver\Command([
+ 'findAndModify' => COLLECTION_NAME,
+ 'query' => ['x' => 1],
+ 'upsert' => true,
+ 'new' => true,
+ 'update' => ['$inc' => ['x' => 1]],
+]);
+
+(new CommandObserver)->observe(
+ function() use ($server, $command) {
+ $server->executeWriteCommand(DATABASE_NAME, $command);
+ $server->executeWriteCommand(DATABASE_NAME, $command, ['writeConcern' => new MongoDB\Driver\WriteConcern(1)]);
+ },
+ function(stdClass $command) {
+ echo json_encode($command->writeConcern), "\n";
+ }
+);
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+{"w":2,"wtimeout":1000}
+{"w":1}
+===DONE===
diff --git a/mongodb-1.8.1/tests/server/server-executeWriteCommand_error-001.phpt b/mongodb-1.9.0/tests/server/server-executeWriteCommand_error-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/server/server-executeWriteCommand_error-001.phpt
rename to mongodb-1.9.0/tests/server/server-executeWriteCommand_error-001.phpt
diff --git a/mongodb-1.8.1/tests/server/server-getInfo-001.phpt b/mongodb-1.9.0/tests/server/server-getInfo-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/server/server-getInfo-001.phpt
rename to mongodb-1.9.0/tests/server/server-getInfo-001.phpt
diff --git a/mongodb-1.8.1/tests/server/server-getTags-001.phpt b/mongodb-1.9.0/tests/server/server-getTags-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/server/server-getTags-001.phpt
rename to mongodb-1.9.0/tests/server/server-getTags-001.phpt
diff --git a/mongodb-1.8.1/tests/server/server-getTags-002.phpt b/mongodb-1.9.0/tests/server/server-getTags-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/server/server-getTags-002.phpt
rename to mongodb-1.9.0/tests/server/server-getTags-002.phpt
diff --git a/mongodb-1.8.1/tests/server/server_error-001.phpt b/mongodb-1.9.0/tests/server/server_error-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/server/server_error-001.phpt
rename to mongodb-1.9.0/tests/server/server_error-001.phpt
diff --git a/mongodb-1.8.1/tests/session/bug1274-001.phpt b/mongodb-1.9.0/tests/session/bug1274-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/session/bug1274-001.phpt
rename to mongodb-1.9.0/tests/session/bug1274-001.phpt
diff --git a/mongodb-1.8.1/tests/session/bug1274-002.phpt b/mongodb-1.9.0/tests/session/bug1274-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/session/bug1274-002.phpt
rename to mongodb-1.9.0/tests/session/bug1274-002.phpt
diff --git a/mongodb-1.8.1/tests/session/bug1274-003.phpt b/mongodb-1.9.0/tests/session/bug1274-003.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/session/bug1274-003.phpt
rename to mongodb-1.9.0/tests/session/bug1274-003.phpt
diff --git a/mongodb-1.8.1/tests/session/session-001.phpt b/mongodb-1.9.0/tests/session/session-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/session/session-001.phpt
rename to mongodb-1.9.0/tests/session/session-001.phpt
diff --git a/mongodb-1.8.1/tests/session/session-002.phpt b/mongodb-1.9.0/tests/session/session-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/session/session-002.phpt
rename to mongodb-1.9.0/tests/session/session-002.phpt
diff --git a/mongodb-1.8.1/tests/session/session-003.phpt b/mongodb-1.9.0/tests/session/session-003.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/session/session-003.phpt
rename to mongodb-1.9.0/tests/session/session-003.phpt
diff --git a/mongodb-1.8.1/tests/session/session-advanceClusterTime-001.phpt b/mongodb-1.9.0/tests/session/session-advanceClusterTime-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/session/session-advanceClusterTime-001.phpt
rename to mongodb-1.9.0/tests/session/session-advanceClusterTime-001.phpt
diff --git a/mongodb-1.8.1/tests/session/session-advanceOperationTime-001.phpt b/mongodb-1.9.0/tests/session/session-advanceOperationTime-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/session/session-advanceOperationTime-001.phpt
rename to mongodb-1.9.0/tests/session/session-advanceOperationTime-001.phpt
diff --git a/mongodb-1.8.1/tests/session/session-advanceOperationTime-002.phpt b/mongodb-1.9.0/tests/session/session-advanceOperationTime-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/session/session-advanceOperationTime-002.phpt
rename to mongodb-1.9.0/tests/session/session-advanceOperationTime-002.phpt
diff --git a/mongodb-1.8.1/tests/session/session-advanceOperationTime-003.phpt b/mongodb-1.9.0/tests/session/session-advanceOperationTime-003.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/session/session-advanceOperationTime-003.phpt
rename to mongodb-1.9.0/tests/session/session-advanceOperationTime-003.phpt
diff --git a/mongodb-1.8.1/tests/session/session-advanceOperationTime_error-001.phpt b/mongodb-1.9.0/tests/session/session-advanceOperationTime_error-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/session/session-advanceOperationTime_error-001.phpt
rename to mongodb-1.9.0/tests/session/session-advanceOperationTime_error-001.phpt
diff --git a/mongodb-1.8.1/tests/session/session-commitTransaction-001.phpt b/mongodb-1.9.0/tests/session/session-commitTransaction-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/session/session-commitTransaction-001.phpt
rename to mongodb-1.9.0/tests/session/session-commitTransaction-001.phpt
diff --git a/mongodb-1.8.1/tests/session/session-constants.phpt b/mongodb-1.9.0/tests/session/session-constants.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/session/session-constants.phpt
rename to mongodb-1.9.0/tests/session/session-constants.phpt
diff --git a/mongodb-1.8.1/tests/session/session-debug-001.phpt b/mongodb-1.9.0/tests/session/session-debug-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/session/session-debug-001.phpt
rename to mongodb-1.9.0/tests/session/session-debug-001.phpt
diff --git a/mongodb-1.8.1/tests/session/session-debug-002.phpt b/mongodb-1.9.0/tests/session/session-debug-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/session/session-debug-002.phpt
rename to mongodb-1.9.0/tests/session/session-debug-002.phpt
diff --git a/mongodb-1.8.1/tests/session/session-debug-003.phpt b/mongodb-1.9.0/tests/session/session-debug-003.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/session/session-debug-003.phpt
rename to mongodb-1.9.0/tests/session/session-debug-003.phpt
diff --git a/mongodb-1.8.1/tests/session/session-debug-004.phpt b/mongodb-1.9.0/tests/session/session-debug-004.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/session/session-debug-004.phpt
rename to mongodb-1.9.0/tests/session/session-debug-004.phpt
diff --git a/mongodb-1.8.1/tests/session/session-debug-005.phpt b/mongodb-1.9.0/tests/session/session-debug-005.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/session/session-debug-005.phpt
rename to mongodb-1.9.0/tests/session/session-debug-005.phpt
diff --git a/mongodb-1.8.1/tests/session/session-endSession-001.phpt b/mongodb-1.9.0/tests/session/session-endSession-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/session/session-endSession-001.phpt
rename to mongodb-1.9.0/tests/session/session-endSession-001.phpt
diff --git a/mongodb-1.8.1/tests/session/session-endSession-002.phpt b/mongodb-1.9.0/tests/session/session-endSession-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/session/session-endSession-002.phpt
rename to mongodb-1.9.0/tests/session/session-endSession-002.phpt
diff --git a/mongodb-1.8.1/tests/session/session-getClusterTime-001.phpt b/mongodb-1.9.0/tests/session/session-getClusterTime-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/session/session-getClusterTime-001.phpt
rename to mongodb-1.9.0/tests/session/session-getClusterTime-001.phpt
diff --git a/mongodb-1.8.1/tests/session/session-getLogicalSessionId-001.phpt b/mongodb-1.9.0/tests/session/session-getLogicalSessionId-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/session/session-getLogicalSessionId-001.phpt
rename to mongodb-1.9.0/tests/session/session-getLogicalSessionId-001.phpt
diff --git a/mongodb-1.8.1/tests/session/session-getOperationTime-001.phpt b/mongodb-1.9.0/tests/session/session-getOperationTime-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/session/session-getOperationTime-001.phpt
rename to mongodb-1.9.0/tests/session/session-getOperationTime-001.phpt
diff --git a/mongodb-1.8.1/tests/session/session-getTransactionOptions-001.phpt b/mongodb-1.9.0/tests/session/session-getTransactionOptions-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/session/session-getTransactionOptions-001.phpt
rename to mongodb-1.9.0/tests/session/session-getTransactionOptions-001.phpt
diff --git a/mongodb-1.8.1/tests/session/session-getTransactionState-001.phpt b/mongodb-1.9.0/tests/session/session-getTransactionState-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/session/session-getTransactionState-001.phpt
rename to mongodb-1.9.0/tests/session/session-getTransactionState-001.phpt
diff --git a/mongodb-1.8.1/tests/session/session-isInTransaction-001.phpt b/mongodb-1.9.0/tests/session/session-isInTransaction-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/session/session-isInTransaction-001.phpt
rename to mongodb-1.9.0/tests/session/session-isInTransaction-001.phpt
diff --git a/mongodb-1.8.1/tests/session/session-startTransaction-001.phpt b/mongodb-1.9.0/tests/session/session-startTransaction-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/session/session-startTransaction-001.phpt
rename to mongodb-1.9.0/tests/session/session-startTransaction-001.phpt
diff --git a/mongodb-1.8.1/tests/session/session-startTransaction_error-001.phpt b/mongodb-1.9.0/tests/session/session-startTransaction_error-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/session/session-startTransaction_error-001.phpt
rename to mongodb-1.9.0/tests/session/session-startTransaction_error-001.phpt
diff --git a/mongodb-1.9.0/tests/session/session-startTransaction_error-002.phpt b/mongodb-1.9.0/tests/session/session-startTransaction_error-002.phpt
new file mode 100644
index 00000000..37c7e124
--- /dev/null
+++ b/mongodb-1.9.0/tests/session/session-startTransaction_error-002.phpt
@@ -0,0 +1,82 @@
+--TEST--
+MongoDB\Driver\Session::startTransaction() with wrong values in options array
+--SKIPIF--
+<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
+<?php skip_if_not_libmongoc_crypto() ?>
+<?php skip_if_no_transactions(); ?>
+--FILE--
+<?php
+require_once __DIR__ . "/../utils/basic.inc";
+
+$manager = new MongoDB\Driver\Manager(URI);
+$session = $manager->startSession();
+
+$options = [
+ [ 'maxCommitTimeMS' => -1 ],
+ [ 'readConcern' => 42 ],
+ [ 'readConcern' => new stdClass ],
+ [ 'readConcern' => new \MongoDB\Driver\WriteConcern( 2 ) ],
+ [ 'readPreference' => 42 ],
+ [ 'readPreference' => new stdClass ],
+ [ 'readPreference' => new \MongoDB\Driver\ReadConcern( \MongoDB\Driver\ReadConcern::LOCAL ) ],
+ [ 'writeConcern' => 42 ],
+ [ 'writeConcern' => new stdClass ],
+ [ 'writeConcern' => new \MongoDB\Driver\ReadPreference( \MongoDB\Driver\ReadPreference::RP_SECONDARY ) ],
+
+ [
+ 'readConcern' => new \MongoDB\Driver\ReadConcern( \MongoDB\Driver\ReadConcern::LOCAL ),
+ 'readPreference' => new \MongoDB\Driver\ReadConcern( \MongoDB\Driver\ReadConcern::LOCAL ),
+ ],
+ [
+ 'readConcern' => new \MongoDB\Driver\ReadConcern( \MongoDB\Driver\ReadConcern::LOCAL ),
+ 'writeConcern' => new \MongoDB\Driver\ReadPreference( \MongoDB\Driver\ReadPreference::RP_SECONDARY ),
+ ],
+ [
+ 'readPreference' => new \MongoDB\Driver\ReadPreference( \MongoDB\Driver\ReadPreference::RP_SECONDARY ),
+ 'writeConcern' => new \MongoDB\Driver\ReadPreference( \MongoDB\Driver\ReadPreference::RP_SECONDARY ),
+ ],
+];
+
+foreach ($options as $txnOptions) {
+ echo throws(function() use ($session, $txnOptions) {
+ $session->startTransaction($txnOptions);
+ }, 'MongoDB\Driver\Exception\InvalidArgumentException'), "\n";
+}
+
+echo raises(function() use ($session) {
+ $session->startTransaction([ 'maxCommitTimeMS' => new stdClass ]);
+}, E_NOTICE | E_WARNING), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECTF--
+OK: Got MongoDB\Driver\Exception\InvalidArgumentException
+Expected "maxCommitTimeMS" option to be >= 0, -1 given
+OK: Got MongoDB\Driver\Exception\InvalidArgumentException
+Expected "readConcern" option to be MongoDB\Driver\ReadConcern, int%S given
+OK: Got MongoDB\Driver\Exception\InvalidArgumentException
+Expected "readConcern" option to be MongoDB\Driver\ReadConcern, stdClass given
+OK: Got MongoDB\Driver\Exception\InvalidArgumentException
+Expected "readConcern" option to be MongoDB\Driver\ReadConcern, MongoDB\Driver\WriteConcern given
+OK: Got MongoDB\Driver\Exception\InvalidArgumentException
+Expected "readPreference" option to be MongoDB\Driver\ReadPreference, int%S given
+OK: Got MongoDB\Driver\Exception\InvalidArgumentException
+Expected "readPreference" option to be MongoDB\Driver\ReadPreference, stdClass given
+OK: Got MongoDB\Driver\Exception\InvalidArgumentException
+Expected "readPreference" option to be MongoDB\Driver\ReadPreference, MongoDB\Driver\ReadConcern given
+OK: Got MongoDB\Driver\Exception\InvalidArgumentException
+Expected "writeConcern" option to be MongoDB\Driver\WriteConcern, int%S given
+OK: Got MongoDB\Driver\Exception\InvalidArgumentException
+Expected "writeConcern" option to be MongoDB\Driver\WriteConcern, stdClass given
+OK: Got MongoDB\Driver\Exception\InvalidArgumentException
+Expected "writeConcern" option to be MongoDB\Driver\WriteConcern, MongoDB\Driver\ReadPreference given
+OK: Got MongoDB\Driver\Exception\InvalidArgumentException
+Expected "readPreference" option to be MongoDB\Driver\ReadPreference, MongoDB\Driver\ReadConcern given
+OK: Got MongoDB\Driver\Exception\InvalidArgumentException
+Expected "writeConcern" option to be MongoDB\Driver\WriteConcern, MongoDB\Driver\ReadPreference given
+OK: Got MongoDB\Driver\Exception\InvalidArgumentException
+Expected "writeConcern" option to be MongoDB\Driver\WriteConcern, MongoDB\Driver\ReadPreference given
+OK: Got %r(E_NOTICE|E_WARNING)%r
+Object of class stdClass could not be converted to int
+===DONE===
diff --git a/mongodb-1.9.0/tests/session/session-startTransaction_error-004.phpt b/mongodb-1.9.0/tests/session/session-startTransaction_error-004.phpt
new file mode 100644
index 00000000..4cb6a3ca
--- /dev/null
+++ b/mongodb-1.9.0/tests/session/session-startTransaction_error-004.phpt
@@ -0,0 +1,37 @@
+--TEST--
+MongoDB\Driver\Session::startTransaction() with wrong argument for options array (PHP 7)
+--SKIPIF--
+<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
+<?php skip_if_not_libmongoc_crypto() ?>
+<?php skip_if_no_transactions(); ?>
+<?php skip_if_php_version('>', '7.99'); ?>
+--FILE--
+<?php
+require_once __DIR__ . "/../utils/basic.inc";
+
+/* Note: PHP 7 throws a non-array TypeError based on arginfo, which happens
+ * before zpp and our proxying of errors with InvalidArgumentExceptions. */
+
+$manager = new MongoDB\Driver\Manager(URI);
+$session = $manager->startSession();
+
+$options = [
+ 2,
+ new stdClass,
+];
+
+foreach ($options as $txnOptions) {
+ echo throws(function () use ($session, $txnOptions) {
+ $session->startTransaction($txnOptions);
+ }, TypeError::class), "\n";
+}
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECTF--
+OK: Got TypeError
+Argument 1 passed to MongoDB\Driver\Session::startTransaction() must be of the type array%r( or null)?%r, int%S given
+OK: Got TypeError
+Argument 1 passed to MongoDB\Driver\Session::startTransaction() must be of the type array%r( or null)?%r, object given
+===DONE===
diff --git a/mongodb-1.9.0/tests/session/session-startTransaction_error-005.phpt b/mongodb-1.9.0/tests/session/session-startTransaction_error-005.phpt
new file mode 100644
index 00000000..6a86fc8d
--- /dev/null
+++ b/mongodb-1.9.0/tests/session/session-startTransaction_error-005.phpt
@@ -0,0 +1,36 @@
+--TEST--
+MongoDB\Driver\Session::startTransaction() with wrong argument for options array (PHP 8)
+--SKIPIF--
+<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
+<?php skip_if_not_libmongoc_crypto() ?>
+<?php skip_if_no_transactions(); ?>
+<?php skip_if_php_version('<', '7.99'); ?>
+--FILE--
+<?php
+require_once __DIR__ . "/../utils/basic.inc";
+
+/* Note: PHP 8 throws a TypeError during zpp (vs. arginfo in PHP 7) */
+
+$manager = new MongoDB\Driver\Manager(URI);
+$session = $manager->startSession();
+
+$options = [
+ 2,
+ new stdClass,
+];
+
+foreach ($options as $txnOptions) {
+ echo throws(function () use ($session, $txnOptions) {
+ $session->startTransaction($txnOptions);
+ }, TypeError::class), "\n";
+}
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECTF--
+OK: Got TypeError
+%SMongoDB\Driver\Session::startTransaction()%sarray, int given
+OK: Got TypeError
+%SMongoDB\Driver\Session::startTransaction()%sarray, %r(object|stdClass)%r given
+===DONE===
diff --git a/mongodb-1.8.1/tests/session/session-startTransaction_error-006.phpt b/mongodb-1.9.0/tests/session/session-startTransaction_error-006.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/session/session-startTransaction_error-006.phpt
rename to mongodb-1.9.0/tests/session/session-startTransaction_error-006.phpt
diff --git a/mongodb-1.8.1/tests/session/session-startTransaction_error-007.phpt b/mongodb-1.9.0/tests/session/session-startTransaction_error-007.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/session/session-startTransaction_error-007.phpt
rename to mongodb-1.9.0/tests/session/session-startTransaction_error-007.phpt
diff --git a/mongodb-1.9.0/tests/session/session_error-001.phpt b/mongodb-1.9.0/tests/session/session_error-001.phpt
new file mode 100644
index 00000000..067ea480
--- /dev/null
+++ b/mongodb-1.9.0/tests/session/session_error-001.phpt
@@ -0,0 +1,88 @@
+--TEST--
+MongoDB\Driver\Session with wrong defaultTransactionOptions
+--FILE--
+<?php
+require_once __DIR__ . "/../utils/basic.inc";
+
+$manager = new MongoDB\Driver\Manager();
+
+$options = [
+ [ 'maxCommitTimeMS' => -1 ],
+ [ 'readConcern' => 42 ],
+ [ 'readConcern' => new stdClass ],
+ [ 'readConcern' => new \MongoDB\Driver\WriteConcern( 2 ) ],
+ [ 'readPreference' => 42 ],
+ [ 'readPreference' => new stdClass ],
+ [ 'readPreference' => new \MongoDB\Driver\ReadConcern( \MongoDB\Driver\ReadConcern::LOCAL ) ],
+ [ 'writeConcern' => 42 ],
+ [ 'writeConcern' => new stdClass ],
+ [ 'writeConcern' => new \MongoDB\Driver\ReadPreference( \MongoDB\Driver\ReadPreference::RP_SECONDARY ) ],
+
+ [
+ 'readConcern' => new \MongoDB\Driver\ReadConcern( \MongoDB\Driver\ReadConcern::LOCAL ),
+ 'readPreference' => new \MongoDB\Driver\ReadConcern( \MongoDB\Driver\ReadConcern::LOCAL ),
+ ],
+ [
+ 'readConcern' => new \MongoDB\Driver\ReadConcern( \MongoDB\Driver\ReadConcern::LOCAL ),
+ 'writeConcern' => new \MongoDB\Driver\ReadPreference( \MongoDB\Driver\ReadPreference::RP_SECONDARY ),
+ ],
+ [
+ 'readPreference' => new \MongoDB\Driver\ReadPreference( \MongoDB\Driver\ReadPreference::RP_SECONDARY ),
+ 'writeConcern' => new \MongoDB\Driver\ReadPreference( \MongoDB\Driver\ReadPreference::RP_SECONDARY ),
+ ],
+
+ 42,
+ new stdClass,
+];
+
+foreach ($options as $txnOptions) {
+ echo throws(function() use ($manager, $txnOptions) {
+ $manager->startSession([
+ 'defaultTransactionOptions' => $txnOptions
+ ]);
+ }, 'MongoDB\Driver\Exception\InvalidArgumentException'), "\n";
+}
+
+echo raises(function() use ($manager) {
+ $manager->startSession([
+ 'defaultTransactionOptions' => [ 'maxCommitTimeMS' => new stdClass ]
+ ]);
+}, E_NOTICE | E_WARNING), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECTF--
+OK: Got MongoDB\Driver\Exception\InvalidArgumentException
+Expected "maxCommitTimeMS" option to be >= 0, -1 given
+OK: Got MongoDB\Driver\Exception\InvalidArgumentException
+Expected "readConcern" option to be MongoDB\Driver\ReadConcern, int%S given
+OK: Got MongoDB\Driver\Exception\InvalidArgumentException
+Expected "readConcern" option to be MongoDB\Driver\ReadConcern, stdClass given
+OK: Got MongoDB\Driver\Exception\InvalidArgumentException
+Expected "readConcern" option to be MongoDB\Driver\ReadConcern, MongoDB\Driver\WriteConcern given
+OK: Got MongoDB\Driver\Exception\InvalidArgumentException
+Expected "readPreference" option to be MongoDB\Driver\ReadPreference, int%S given
+OK: Got MongoDB\Driver\Exception\InvalidArgumentException
+Expected "readPreference" option to be MongoDB\Driver\ReadPreference, stdClass given
+OK: Got MongoDB\Driver\Exception\InvalidArgumentException
+Expected "readPreference" option to be MongoDB\Driver\ReadPreference, MongoDB\Driver\ReadConcern given
+OK: Got MongoDB\Driver\Exception\InvalidArgumentException
+Expected "writeConcern" option to be MongoDB\Driver\WriteConcern, int%S given
+OK: Got MongoDB\Driver\Exception\InvalidArgumentException
+Expected "writeConcern" option to be MongoDB\Driver\WriteConcern, stdClass given
+OK: Got MongoDB\Driver\Exception\InvalidArgumentException
+Expected "writeConcern" option to be MongoDB\Driver\WriteConcern, MongoDB\Driver\ReadPreference given
+OK: Got MongoDB\Driver\Exception\InvalidArgumentException
+Expected "readPreference" option to be MongoDB\Driver\ReadPreference, MongoDB\Driver\ReadConcern given
+OK: Got MongoDB\Driver\Exception\InvalidArgumentException
+Expected "writeConcern" option to be MongoDB\Driver\WriteConcern, MongoDB\Driver\ReadPreference given
+OK: Got MongoDB\Driver\Exception\InvalidArgumentException
+Expected "writeConcern" option to be MongoDB\Driver\WriteConcern, MongoDB\Driver\ReadPreference given
+OK: Got MongoDB\Driver\Exception\InvalidArgumentException
+Expected "defaultTransactionOptions" option to be an array, int%S given
+OK: Got MongoDB\Driver\Exception\InvalidArgumentException
+Expected "defaultTransactionOptions" option to be an array, stdClass given
+OK: Got %r(E_NOTICE|E_WARNING)%r
+Object of class stdClass could not be converted to int
+===DONE===
diff --git a/mongodb-1.9.0/tests/session/session_error-002.phpt b/mongodb-1.9.0/tests/session/session_error-002.phpt
new file mode 100644
index 00000000..3c7920f0
--- /dev/null
+++ b/mongodb-1.9.0/tests/session/session_error-002.phpt
@@ -0,0 +1,24 @@
+--TEST--
+MongoDB\Driver\Session with wrong defaultTransactionOptions
+--SKIPIF--
+<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
+<?php skip_if_php_version('>=', '7.99'); ?>
+--FILE--
+<?php
+require_once __DIR__ . "/../utils/basic.inc";
+
+$manager = new MongoDB\Driver\Manager();
+
+echo raises(function() use ($manager) {
+ $manager->startSession([
+ 'defaultTransactionOptions' => [ 'maxCommitTimeMS' => new stdClass ]
+ ]);
+}, E_NOTICE), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECTF--
+OK: Got E_NOTICE
+Object of class stdClass could not be converted to int
+===DONE===
diff --git a/mongodb-1.8.1/tests/session/transaction-integration-001.phpt b/mongodb-1.9.0/tests/session/transaction-integration-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/session/transaction-integration-001.phpt
rename to mongodb-1.9.0/tests/session/transaction-integration-001.phpt
diff --git a/mongodb-1.8.1/tests/session/transaction-integration-002.phpt b/mongodb-1.9.0/tests/session/transaction-integration-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/session/transaction-integration-002.phpt
rename to mongodb-1.9.0/tests/session/transaction-integration-002.phpt
diff --git a/mongodb-1.8.1/tests/session/transaction-integration-003.phpt b/mongodb-1.9.0/tests/session/transaction-integration-003.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/session/transaction-integration-003.phpt
rename to mongodb-1.9.0/tests/session/transaction-integration-003.phpt
diff --git a/mongodb-1.8.1/tests/session/transaction-integration_error-001.phpt b/mongodb-1.9.0/tests/session/transaction-integration_error-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/session/transaction-integration_error-001.phpt
rename to mongodb-1.9.0/tests/session/transaction-integration_error-001.phpt
diff --git a/mongodb-1.8.1/tests/session/transaction-integration_error-002.phpt b/mongodb-1.9.0/tests/session/transaction-integration_error-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/session/transaction-integration_error-002.phpt
rename to mongodb-1.9.0/tests/session/transaction-integration_error-002.phpt
diff --git a/mongodb-1.8.1/tests/session/transaction-integration_error-003.phpt b/mongodb-1.9.0/tests/session/transaction-integration_error-003.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/session/transaction-integration_error-003.phpt
rename to mongodb-1.9.0/tests/session/transaction-integration_error-003.phpt
diff --git a/mongodb-1.8.1/tests/session/transaction-integration_error-004.phpt b/mongodb-1.9.0/tests/session/transaction-integration_error-004.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/session/transaction-integration_error-004.phpt
rename to mongodb-1.9.0/tests/session/transaction-integration_error-004.phpt
diff --git a/mongodb-1.8.1/tests/standalone/bug0166.phpt b/mongodb-1.9.0/tests/standalone/bug0166.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/standalone/bug0166.phpt
rename to mongodb-1.9.0/tests/standalone/bug0166.phpt
diff --git a/mongodb-1.8.1/tests/standalone/bug0231.phpt b/mongodb-1.9.0/tests/standalone/bug0231.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/standalone/bug0231.phpt
rename to mongodb-1.9.0/tests/standalone/bug0231.phpt
diff --git a/mongodb-1.8.1/tests/standalone/bug0357.phpt b/mongodb-1.9.0/tests/standalone/bug0357.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/standalone/bug0357.phpt
rename to mongodb-1.9.0/tests/standalone/bug0357.phpt
diff --git a/mongodb-1.8.1/tests/standalone/bug0545.phpt b/mongodb-1.9.0/tests/standalone/bug0545.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/standalone/bug0545.phpt
rename to mongodb-1.9.0/tests/standalone/bug0545.phpt
diff --git a/mongodb-1.8.1/tests/standalone/bug0655.phpt b/mongodb-1.9.0/tests/standalone/bug0655.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/standalone/bug0655.phpt
rename to mongodb-1.9.0/tests/standalone/bug0655.phpt
diff --git a/mongodb-1.8.1/tests/standalone/command-aggregate-001.phpt b/mongodb-1.9.0/tests/standalone/command-aggregate-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/standalone/command-aggregate-001.phpt
rename to mongodb-1.9.0/tests/standalone/command-aggregate-001.phpt
diff --git a/mongodb-1.8.1/tests/standalone/connectiontimeoutexception-001.phpt b/mongodb-1.9.0/tests/standalone/connectiontimeoutexception-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/standalone/connectiontimeoutexception-001.phpt
rename to mongodb-1.9.0/tests/standalone/connectiontimeoutexception-001.phpt
diff --git a/mongodb-1.8.1/tests/standalone/executiontimeoutexception-001.phpt b/mongodb-1.9.0/tests/standalone/executiontimeoutexception-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/standalone/executiontimeoutexception-001.phpt
rename to mongodb-1.9.0/tests/standalone/executiontimeoutexception-001.phpt
diff --git a/mongodb-1.8.1/tests/standalone/executiontimeoutexception-002.phpt b/mongodb-1.9.0/tests/standalone/executiontimeoutexception-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/standalone/executiontimeoutexception-002.phpt
rename to mongodb-1.9.0/tests/standalone/executiontimeoutexception-002.phpt
diff --git a/mongodb-1.8.1/tests/standalone/manager-as-singleton.phpt b/mongodb-1.9.0/tests/standalone/manager-as-singleton.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/standalone/manager-as-singleton.phpt
rename to mongodb-1.9.0/tests/standalone/manager-as-singleton.phpt
diff --git a/mongodb-1.8.1/tests/standalone/query-errors.phpt b/mongodb-1.9.0/tests/standalone/query-errors.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/standalone/query-errors.phpt
rename to mongodb-1.9.0/tests/standalone/query-errors.phpt
diff --git a/mongodb-1.8.1/tests/standalone/update-multi-001.phpt b/mongodb-1.9.0/tests/standalone/update-multi-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/standalone/update-multi-001.phpt
rename to mongodb-1.9.0/tests/standalone/update-multi-001.phpt
diff --git a/mongodb-1.8.1/tests/standalone/write-error-001.phpt b/mongodb-1.9.0/tests/standalone/write-error-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/standalone/write-error-001.phpt
rename to mongodb-1.9.0/tests/standalone/write-error-001.phpt
diff --git a/mongodb-1.8.1/tests/standalone/writeresult-isacknowledged-001.phpt b/mongodb-1.9.0/tests/standalone/writeresult-isacknowledged-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/standalone/writeresult-isacknowledged-001.phpt
rename to mongodb-1.9.0/tests/standalone/writeresult-isacknowledged-001.phpt
diff --git a/mongodb-1.8.1/tests/standalone/writeresult-isacknowledged-002.phpt b/mongodb-1.9.0/tests/standalone/writeresult-isacknowledged-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/standalone/writeresult-isacknowledged-002.phpt
rename to mongodb-1.9.0/tests/standalone/writeresult-isacknowledged-002.phpt
diff --git a/mongodb-1.8.1/tests/standalone/writeresult-isacknowledged-003.phpt b/mongodb-1.9.0/tests/standalone/writeresult-isacknowledged-003.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/standalone/writeresult-isacknowledged-003.phpt
rename to mongodb-1.9.0/tests/standalone/writeresult-isacknowledged-003.phpt
diff --git a/mongodb-1.8.1/tests/utils/PHONGO-FIXTURES.json.gz b/mongodb-1.9.0/tests/utils/PHONGO-FIXTURES.json.gz
similarity index 100%
rename from mongodb-1.8.1/tests/utils/PHONGO-FIXTURES.json.gz
rename to mongodb-1.9.0/tests/utils/PHONGO-FIXTURES.json.gz
diff --git a/mongodb-1.8.1/tests/utils/basic-skipif.inc b/mongodb-1.9.0/tests/utils/basic-skipif.inc
similarity index 100%
rename from mongodb-1.8.1/tests/utils/basic-skipif.inc
rename to mongodb-1.9.0/tests/utils/basic-skipif.inc
diff --git a/mongodb-1.8.1/tests/utils/basic.inc b/mongodb-1.9.0/tests/utils/basic.inc
similarity index 100%
rename from mongodb-1.8.1/tests/utils/basic.inc
rename to mongodb-1.9.0/tests/utils/basic.inc
diff --git a/mongodb-1.8.1/tests/utils/classes.inc b/mongodb-1.9.0/tests/utils/classes.inc
similarity index 100%
rename from mongodb-1.8.1/tests/utils/classes.inc
rename to mongodb-1.9.0/tests/utils/classes.inc
diff --git a/mongodb-1.8.1/tests/utils/observer.php b/mongodb-1.9.0/tests/utils/observer.php
similarity index 100%
rename from mongodb-1.8.1/tests/utils/observer.php
rename to mongodb-1.9.0/tests/utils/observer.php
diff --git a/mongodb-1.8.1/tests/utils/skipif.php b/mongodb-1.9.0/tests/utils/skipif.php
similarity index 100%
rename from mongodb-1.8.1/tests/utils/skipif.php
rename to mongodb-1.9.0/tests/utils/skipif.php
diff --git a/mongodb-1.9.0/tests/utils/tools.php b/mongodb-1.9.0/tests/utils/tools.php
new file mode 100644
index 00000000..ab7b99ff
--- /dev/null
+++ b/mongodb-1.9.0/tests/utils/tools.php
@@ -0,0 +1,798 @@
+<?php
+
+use MongoDB\Driver\BulkWrite;
+use MongoDB\Driver\Command;
+use MongoDB\Driver\Manager;
+use MongoDB\Driver\ReadPreference;
+use MongoDB\Driver\Server;
+use MongoDB\Driver\WriteConcern;
+use MongoDB\Driver\WriteConcernError;
+use MongoDB\Driver\WriteError;
+use MongoDB\Driver\WriteResult;
+use MongoDB\Driver\Exception\ConnectionException;
+use MongoDB\Driver\Exception\RuntimeException;
+
+/**
+ * Appends an option to a URI string and returns a new URI.
+ *
+ * @param string $uri
+ * @param string $option
+ * @param string $value
+ * @return string
+ */
+function append_uri_option($uri, $option)
+{
+ // Append to existing query string
+ if (strpos($uri, '?') !== false) {
+ return $uri . '&' . $option;
+ }
+
+ // Terminate host list and append new query string
+ if (parse_url($uri, PHP_URL_PATH) === null) {
+ return $uri . '/?' . $option;
+ }
+
+ // Append query string after terminated host list and possible auth database
+ return $uri . '?' . $option;
+}
+
+/**
+ * Drops a collection on the primary server.
+ *
+ * @param string $uri Connection string
+ * @param string $databaseName Database name
+ * @param string $collectionName Collection name
+ * @throws RuntimeException
+ */
+function drop_collection($uri, $databaseName, $collectionName)
+{
+ $server = get_primary_server($uri);
+ $command = new Command(['drop' => $collectionName]);
+
+ try {
+ /* We need to use WriteConcern::MAJORITY here due to the issue
+ * explained in SERVER-35613: "drop" uses a two phase commit, and due
+ * to that, it is possible that a lock can't be acquired for a
+ * transaction that gets quickly started as the "drop" reaper hasn't
+ * completed yet. */
+ $server->executeCommand(
+ $databaseName,
+ $command,
+ ['writeConcern' => new WriteConcern(WriteConcern::MAJORITY)]
+ );
+ } catch (RuntimeException $e) {
+ if ($e->getMessage() !== 'ns not found') {
+ throw $e;
+ }
+ }
+}
+
+/**
+ * Returns the value of a module row from phpinfo(), or null if it's not found.
+ *
+ * @param string $row
+ * @return string|null
+ */
+function get_module_info($row)
+{
+ ob_start();
+ phpinfo(INFO_MODULES);
+ $info = ob_get_clean();
+
+ $pattern = sprintf('/^%s([\w ]+)$/m', preg_quote($row . ' => '));
+
+ if (preg_match($pattern, $info, $matches) !== 1) {
+ return null;
+ }
+
+ return $matches[1];
+}
+
+/**
+ * Returns the primary server.
+ *
+ * @param string $uri Connection string
+ * @return Server
+ * @throws ConnectionException
+ */
+function get_primary_server($uri)
+{
+ return (new Manager($uri))->selectServer(new ReadPreference('primary'));
+}
+
+/**
+ * Returns a secondary server.
+ *
+ * @param string $uri Connection string
+ * @return Server
+ * @throws ConnectionException
+ */
+function get_secondary_server($uri)
+{
+ return (new Manager($uri))->selectServer(new ReadPreference('secondary'));
+}
+
+/**
+ * Runs a command and returns whether an exception was thrown or not
+ *
+ * @param string $uri Connection string
+ * @param array|object $commandSpec
+ * @return bool
+ * @throws RuntimeException
+ */
+function command_works($uri, $commandSpec)
+{
+ $command = new Command($commandSpec);
+ $server = get_primary_server($uri);
+ try {
+ $cursor = $server->executeCommand('admin', $command);
+ return true;
+ } catch (Exception $e) {
+ return false;
+ }
+}
+
+/**
+ * Returns a parameter of the primary server.
+ *
+ * @param string $uri Connection string
+ * @return mixed
+ * @throws RuntimeException
+ */
+function get_server_parameter($uri, $parameter)
+{
+ $server = get_primary_server($uri);
+ $command = new Command(['getParameter' => 1, $parameter => 1]);
+ $cursor = $server->executeCommand('admin', $command);
+
+ return current($cursor->toArray())->$parameter;
+}
+
+/**
+ * Returns the storage engine of the primary server.
+ *
+ * @param string $uri Connection string
+ * @return string
+ * @throws RuntimeException
+ */
+function get_server_storage_engine($uri)
+{
+ $server = get_primary_server($uri);
+ $command = new Command(['serverStatus' => 1]);
+ $cursor = $server->executeCommand('admin', $command);
+
+ return current($cursor->toArray())->storageEngine->name;
+}
+
+/**
+ * Helper to return the version of a specific server.
+ *
+ * @param Server $server
+ * @return string
+ * @throws RuntimeException
+ */
+function get_server_version_from_server(Server $server)
+{
+ $command = new Command(['buildInfo' => 1]);
+ $cursor = $server->executeCommand('admin', $command);
+
+ return current($cursor->toArray())->version;
+}
+
+/**
+ * Returns the version of the primary server.
+ *
+ * @param string $uri Connection string
+ * @return string
+ * @throws RuntimeException
+ */
+function get_server_version($uri)
+{
+ $server = get_primary_server($uri);
+ return get_server_version_from_server($server);
+}
+
+/**
+ * Returns the value of a URI option, or null if it's not found.
+ *
+ * @param string $uri
+ * @return string|null
+ */
+function get_uri_option($uri, $option)
+{
+ $pattern = sprintf('/[?&]%s=([^&]+)/i', preg_quote($option));
+
+ if (preg_match($pattern, $uri, $matches) !== 1) {
+ return null;
+ }
+
+ return $matches[1];
+}
+
+/**
+ * Checks that the topology is a sharded cluster.
+ *
+ * @param string $uri
+ * @return boolean
+ */
+function is_mongos($uri)
+{
+ return get_primary_server($uri)->getType() === Server::TYPE_MONGOS;
+}
+
+/**
+ * Checks that the topology is a sharded cluster using a replica set
+ */
+function is_mongos_with_replica_set($uri)
+{
+ if (! is_mongos($uri)) {
+ return false;
+ }
+
+ $cursor = get_primary_server($uri)->executeQuery(
+ 'config.shards',
+ new \MongoDB\Driver\Query([], ['limit' => 1])
+ );
+
+ $cursor->setTypeMap(['root' => 'array', 'document' => 'array']);
+ $document = current($cursor->toArray());
+
+ if (! $document) {
+ return false;
+ }
+
+ /**
+ * Use regular expression to distinguish between standalone or replicaset:
+ * Without a replicaset: "host" : "localhost:4100"
+ * With a replicaset: "host" : "dec6d8a7-9bc1-4c0e-960c-615f860b956f/localhost:4400,localhost:4401"
+ */
+ return preg_match('@^.*/.*:\d+@', $document['host']);
+}
+
+/**
+ * Checks that the topology is a replica set.
+ *
+ * @param string $uri
+ * @return boolean
+ */
+function is_replica_set($uri)
+{
+ if (get_primary_server($uri)->getType() !== Server::TYPE_RS_PRIMARY) {
+ return false;
+ }
+
+ if (get_uri_option($uri, 'replicaSet') === NULL) {
+ return false;
+ }
+
+ return true;
+}
+
+/**
+ * Checks if the connection string uses authentication.
+ *
+ * @param string $uri
+ * @return boolean
+ */
+function is_auth($uri)
+{
+ if (stripos($uri, 'authmechanism=') !== false) {
+ return true;
+ }
+
+ if (strpos($uri, ':') !== false && strpos($uri, '@') !== false) {
+ return true;
+ }
+
+ return false;
+}
+
+/**
+ * Checks if the connection string uses SSL.
+ *
+ * @param string $uri
+ * @return boolean
+ */
+function is_ssl($uri)
+{
+ return stripos($uri, 'ssl=true') !== false || stripos($uri, 'tls=true') !== false;
+}
+
+/**
+ * Checks that the topology is a standalone.
+ *
+ * @param string $uri
+ * @return boolean
+ */
+function is_standalone($uri)
+{
+ return get_primary_server($uri)->getType() === Server::TYPE_STANDALONE;
+}
+
+/**
+ * Converts the server type constant to a string.
+ *
+ * @see http://php.net/manual/en/class.mongodb-driver-server.php
+ * @param integer $type
+ * @return string
+ */
+function server_type_as_string($type)
+{
+ switch ($type) {
+ case Server::TYPE_STANDALONE:
+ return 'Standalone';
+ case Server::TYPE_MONGOS:
+ return 'Mongos';
+ case Server::TYPE_POSSIBLE_PRIMARY:
+ return 'PossiblePrimary';
+ case Server::TYPE_RS_PRIMARY:
+ return 'RSPrimary';
+ case Server::TYPE_RS_SECONDARY:
+ return 'RSSecondary';
+ case Server::TYPE_RS_ARBITER:
+ return 'RSArbiter';
+ case Server::TYPE_RS_OTHER:
+ return 'RSOther';
+ case Server::TYPE_RS_GHOST:
+ return 'RSGhost';
+ default:
+ return 'Unknown';
+ }
+}
+
+/**
+ * Converts an errno number to a string.
+ *
+ * @see http://php.net/manual/en/errorfunc.constants.php
+ * @param integer $errno
+ * @param string
+ */
+function errno_as_string($errno)
+{
+ $errors = [
+ 'E_ERROR',
+ 'E_WARNING',
+ 'E_PARSE',
+ 'E_NOTICE',
+ 'E_CORE_ERROR',
+ 'E_CORE_WARNING',
+ 'E_COMPILE_ERROR',
+ 'E_COMPILE_WARNING',
+ 'E_USER_ERROR',
+ 'E_USER_WARNING',
+ 'E_USER_NOTICE',
+ 'E_STRICT',
+ 'E_RECOVERABLE_ERROR',
+ 'E_DEPRECATED',
+ 'E_USER_DEPRECATED',
+ 'E_ALL',
+ ];
+
+ foreach ($errors as $error) {
+ if ($errno === constant($error)) {
+ return $error;
+ }
+ }
+
+ return 'Unknown';
+}
+
+/**
+ * Prints a traditional hex dump of byte values and printable characters.
+ *
+ * @see http://stackoverflow.com/a/4225813/162228
+ * @param string $data Binary data
+ * @param integer $width Bytes displayed per line
+ */
+function hex_dump($data, $width = 16)
+{
+ static $pad = '.'; // Placeholder for non-printable characters
+ static $from = '';
+ static $to = '';
+
+ if ($from === '') {
+ for ($i = 0; $i <= 0xFF; $i++) {
+ $from .= chr($i);
+ $to .= ($i >= 0x20 && $i <= 0x7E) ? chr($i) : $pad;
+ }
+ }
+
+ $hex = str_split(bin2hex($data), $width * 2);
+ $chars = str_split(strtr($data, $from, $to), $width);
+
+ $offset = 0;
+ $length = $width * 3;
+
+ foreach ($hex as $i => $line) {
+ printf("%6X : %-{$length}s [%s]\n", $offset, implode(' ', str_split($line, 2)), $chars[$i]);
+ $offset += $width;
+ }
+}
+
+/**
+ * Canonicalizes a JSON string.
+ *
+ * @param string $json
+ * @return string
+ */
+function json_canonicalize($json)
+{
+ $json = json_encode(json_decode($json));
+
+ /* Versions of PHP before 7.1 replace empty JSON keys with "_empty_" when
+ * decoding to a stdClass (see: https://bugs.php.net/bug.php?id=46600). Work
+ * around this by replacing "_empty_" keys before returning.
+ */
+ $json = str_replace('"_empty_":', '"":', $json);
+
+ /* Canonicalize string values for $numberDouble to ensure they are converted
+ * the same as number literals in legacy and relaxed output. This is needed
+ * because the printf format in _bson_as_json_visit_double uses a high level
+ * of precision and may not produce the exponent notation expected by the
+ * BSON corpus tests. */
+ $json = preg_replace_callback(
+ '/{"\$numberDouble":"(-?\d+(\.\d+([eE]\+\d+)?)?)"}/',
+ function ($matches) {
+ return '{"$numberDouble":"' . json_encode(json_decode($matches[1])) . '"}';
+ },
+ $json
+ );
+
+ return $json;
+}
+
+/**
+ * Return a collection name to use for the test file.
+ *
+ * The filename will be stripped of the base path to the test suite (prefix) as
+ * well as the PHP file extension (suffix). Special characters (including hyphen
+ * for shell compatibility) will be replaced with underscores.
+ *
+ * @param string $filename
+ * @return string
+ */
+function makeCollectionNameFromFilename($filename)
+{
+ $filename = realpath($filename);
+ $prefix = realpath(dirname(__FILE__) . '/..') . DIRECTORY_SEPARATOR;
+
+ $replacements = array(
+ // Strip test path prefix
+ sprintf('/^%s/', preg_quote($prefix, '/')) => '',
+ // Strip file extension suffix
+ '/\.php$/' => '',
+ // SKIPIFs add ".skip" between base name and extension
+ '/\.skip$/' => '',
+ // Replace special characters with underscores
+ sprintf('/[%s]/', preg_quote('-$/\\', '/')) => '_',
+ );
+
+ return preg_replace(array_keys($replacements), array_values($replacements), $filename);
+}
+
+function NEEDS($configuration) {
+ if (!constant($configuration)) {
+ exit("skip -- need '$configuration' defined");
+ }
+}
+function SLOW() {
+ if (getenv("SKIP_SLOW_TESTS")) {
+ exit("skip SKIP_SLOW_TESTS");
+ }
+}
+
+function loadFixtures(Manager $manager, $dbname = DATABASE_NAME, $collname = COLLECTION_NAME, $filename = null)
+{
+ if (!$filename) {
+ $filename = "compress.zlib://" . __DIR__ . "/" . "PHONGO-FIXTURES.json.gz";
+ }
+
+ $bulk = new BulkWrite(['ordered' => false]);
+
+ $server = $manager->selectServer(new ReadPreference(ReadPreference::RP_PRIMARY));
+
+ $data = file_get_contents($filename);
+ $array = json_decode($data);
+
+ foreach($array as $document) {
+ $bulk->insert($document);
+ }
+
+ $retval = $server->executeBulkWrite("$dbname.$collname", $bulk);
+
+ if ($retval->getInsertedCount() !== count($array)) {
+ exit(sprintf('skip Fixtures were not loaded (expected: %d, actual: %d)', $total, $retval->getInsertedCount()));
+ }
+}
+
+function createTemporaryMongoInstance(array $options = [])
+{
+ $id = 'mo_' . COLLECTION_NAME;
+ $options += [
+ "name" => "mongod",
+ "id" => $id,
+ 'procParams' => [
+ 'logpath' => "/tmp/MO/phongo/{$id}.log",
+ 'ipv6' => true,
+ 'setParameter' => [ 'enableTestCommands' => 1 ],
+ ],
+ ];
+ $opts = array(
+ "http" => array(
+ "timeout" => 60,
+ "method" => "PUT",
+ "header" => "Accept: application/json\r\n" .
+ "Content-type: application/x-www-form-urlencoded",
+ "content" => json_encode($options),
+ "ignore_errors" => true,
+ ),
+ );
+ $ctx = stream_context_create($opts);
+ $json = file_get_contents(MONGO_ORCHESTRATION_URI . "/servers/$id", false, $ctx);
+ $result = json_decode($json, true);
+
+ /* Failed -- or was already started */
+ if (!isset($result["mongodb_uri"])) {
+ destroyTemporaryMongoInstance($id);
+ throw new Exception("Could not start temporary server instance\n");
+ } else {
+ return $result['mongodb_uri'];
+ }
+}
+
+function destroyTemporaryMongoInstance($id = NULL)
+{
+ if ($id == NULL) {
+ $id = 'mo_' . COLLECTION_NAME;
+ }
+
+ $opts = array(
+ "http" => array(
+ "timeout" => 60,
+ "method" => "DELETE",
+ "header" => "Accept: application/json\r\n",
+ "ignore_errors" => true,
+ ),
+ );
+ $ctx = stream_context_create($opts);
+ $json = file_get_contents(MONGO_ORCHESTRATION_URI . "/servers/$id", false, $ctx);
+}
+
+function severityToString($type) {
+ switch($type) {
+ case E_DEPRECATED:
+ return "E_DEPRECATED";
+ case E_RECOVERABLE_ERROR:
+ return "E_RECOVERABLE_ERROR";
+ case E_WARNING:
+ return "E_WARNING";
+ case E_NOTICE:
+ return "E_NOTICE";
+ default:
+ return "Some other #_$type";
+ }
+}
+function raises($function, $type, $infunction = null) {
+ $errhandler = function($severity, $message, $file, $line) {
+ throw new ErrorException($message, 0, $severity, $file, $line);
+ };
+
+ set_error_handler($errhandler, $type);
+ try {
+ $function();
+ } catch(Exception $e) {
+ $exceptionname = get_class($e);
+
+ if ($e instanceof ErrorException && $e->getSeverity() & $type) {
+ if ($infunction) {
+ $trace = $e->getTrace();
+ $function = $trace[0]["function"];
+ if (strcasecmp($function, $infunction) == 0) {
+ printf("OK: Got %s thrown from %s\n", $exceptionname, $infunction);
+ } else {
+ printf("ALMOST: Got %s - but was thrown in %s, not %s\n", $exceptionname, $function, $infunction);
+ }
+ restore_error_handler();
+ return $e->getMessage();
+ }
+ printf("OK: Got %s\n", severityToString($e->getSeverity()));
+ } else {
+ printf("ALMOST: Got %s - expected %s\n", get_class($e), $exceptionname);
+ }
+ restore_error_handler();
+ return $e->getMessage();
+ }
+
+ printf("FAILED: Expected %s thrown!\n", ErrorException::class);
+ restore_error_handler();
+}
+function throws($function, $exceptionname, $infunction = null) {
+ try {
+ $function();
+ } catch (Throwable $e) {
+ } catch (Exception $e) {
+ }
+
+ if (!isset($e)) {
+ echo "FAILED: Expected $exceptionname thrown, but no exception thrown!\n";
+ return;
+ }
+
+ $message = str_replace(array("\n", "\r"), ' ', $e->getMessage());
+ if ($e instanceof $exceptionname) {
+ if ($infunction) {
+ $trace = $e->getTrace();
+ $function = $trace[0]["function"];
+ if (strcasecmp($function, $infunction) == 0) {
+ printf("OK: Got %s thrown from %s\n", $exceptionname, $infunction);
+ } else {
+ printf("ALMOST: Got %s - but was thrown in %s, not %s (%s)\n", $exceptionname, $function, $infunction, $message);
+ }
+ return $e->getMessage();
+ }
+ printf("OK: Got %s\n", $exceptionname);
+ } else {
+ printf("ALMOST: Got %s (%s) - expected %s\n", get_class($e), $message, $exceptionname);
+ }
+
+ return $e->getMessage();
+}
+
+function printServer(Server $server)
+{
+ printf("server: %s:%d\n", $server->getHost(), $server->getPort());
+}
+
+function printWriteResult(WriteResult $result, $details = true)
+{
+ printServer($result->getServer());
+
+ printf("insertedCount: %d\n", $result->getInsertedCount());
+ printf("matchedCount: %d\n", $result->getMatchedCount());
+ printf("modifiedCount: %d\n", $result->getModifiedCount());
+ printf("upsertedCount: %d\n", $result->getUpsertedCount());
+ printf("deletedCount: %d\n", $result->getDeletedCount());
+
+ foreach ($result->getUpsertedIds() as $index => $id) {
+ printf("upsertedId[%d]: ", $index);
+ var_dump($id);
+ }
+
+ $writeConcernError = $result->getWriteConcernError();
+ printWriteConcernError($writeConcernError ? $writeConcernError : null, $details);
+
+ foreach ($result->getWriteErrors() as $writeError) {
+ printWriteError($writeError);
+ }
+}
+
+function printWriteConcernError(WriteConcernError $error = null, $details)
+{
+ if ($error) {
+ /* This stuff is generated by the server, no need for us to test it */
+ if (!$details) {
+ printf("writeConcernError: %s (%d)\n", $error->getMessage(), $error->getCode());
+ return;
+ }
+ var_dump($error);
+ printf("writeConcernError.message: %s\n", $error->getMessage());
+ printf("writeConcernError.code: %d\n", $error->getCode());
+ printf("writeConcernError.info: ");
+ var_dump($error->getInfo());
+ }
+}
+
+function printWriteError(WriteError $error)
+{
+ var_dump($error);
+ printf("writeError[%d].message: %s\n", $error->getIndex(), $error->getMessage());
+ printf("writeError[%d].code: %d\n", $error->getIndex(), $error->getCode());
+}
+
+function getInsertCount($retval) {
+ return $retval->getInsertedCount();
+}
+function getModifiedCount($retval) {
+ return $retval->getModifiedCount();
+}
+function getDeletedCount($retval) {
+ return $retval->getDeletedCount();
+}
+function getUpsertedCount($retval) {
+ return $retval->getUpsertedCount();
+}
+function getWriteErrors($retval) {
+ return (array)$retval->getWriteErrors();
+}
+
+function def($arr) {
+ foreach($arr as $const => $value) {
+ define($const, getenv("PHONGO_TEST_$const") ?: $value);
+ }
+}
+
+function configureFailPoint(Manager $manager, $failPoint, $mode, array $data = [])
+{
+ $doc = [
+ 'configureFailPoint' => $failPoint,
+ 'mode' => $mode,
+ ];
+ if ($data) {
+ $doc['data'] = $data;
+ }
+
+ $cmd = new Command($doc);
+ $manager->executeCommand('admin', $cmd);
+}
+
+function configureTargetedFailPoint(Server $server, $failPoint, $mode, array $data = [])
+{
+ $doc = array(
+ 'configureFailPoint' => $failPoint,
+ 'mode' => $mode,
+ );
+ if ($data) {
+ $doc['data'] = $data;
+ }
+
+ $cmd = new Command($doc);
+ $server->executeCommand('admin', $cmd);
+}
+
+function failMaxTimeMS(Server $server)
+{
+ configureTargetedFailPoint($server, 'maxTimeAlwaysTimeOut', [ 'times' => 1 ]);
+}
+
+function getMOPresetBase() {
+ if (!($BASE = getenv("mongodb_orchestration_base"))) {
+ $BASE = "/phongo/";
+ }
+
+ return $BASE;
+}
+
+function toPHP($var, $typemap = array()) {
+ return MongoDB\BSON\toPHP($var, $typemap);
+}
+function fromPHP($var) {
+ return MongoDB\BSON\fromPHP($var);
+}
+function toJSON($var) {
+ return MongoDB\BSON\toJSON($var);
+}
+function toCanonicalExtendedJSON($var) {
+ return MongoDB\BSON\toCanonicalExtendedJSON($var);
+}
+function toRelaxedExtendedJSON($var) {
+ return MongoDB\BSON\toRelaxedExtendedJSON($var);
+}
+function fromJSON($var) {
+ return MongoDB\BSON\fromJSON($var);
+}
+
+/* Note: this fail point may terminate the mongod process, so you may want to
+ * use this in conjunction with a throwaway server. */
+function failGetMore(Manager $manager)
+{
+ /* We need to do version detection here */
+ $primary = $manager->selectServer(new ReadPreference('primary'));
+ $version = get_server_version_from_server($primary);
+
+ if (version_compare($version, "3.2", "<")) {
+ configureFailPoint($manager, 'failReceivedGetmore', 'alwaysOn');
+ return;
+ }
+
+ if (version_compare($version, "4.0", ">=")) {
+ /* We use 237 here, as that's the same original code that MongoD would
+ * throw if a cursor had already gone by the time we call getMore. This
+ * allows us to make things consistent with the getMore OP behaviour
+ * from previous mongod versions. An errorCode is required here for the
+ * failPoint to work. */
+ configureFailPoint($manager, 'failCommand', 'alwaysOn', [ 'errorCode' => 237, 'failCommands' => ['getMore'] ]);
+ return;
+ }
+
+ throw new Exception("Trying to configure a getMore fail point for a server version ($version) that doesn't support it");
+}
diff --git a/mongodb-1.8.1/tests/writeConcern/bug1598-001.phpt b/mongodb-1.9.0/tests/writeConcern/bug1598-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/writeConcern/bug1598-001.phpt
rename to mongodb-1.9.0/tests/writeConcern/bug1598-001.phpt
diff --git a/mongodb-1.8.1/tests/writeConcern/bug1598-002.phpt b/mongodb-1.9.0/tests/writeConcern/bug1598-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/writeConcern/bug1598-002.phpt
rename to mongodb-1.9.0/tests/writeConcern/bug1598-002.phpt
diff --git a/mongodb-1.8.1/tests/writeConcern/writeconcern-bsonserialize-001.phpt b/mongodb-1.9.0/tests/writeConcern/writeconcern-bsonserialize-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/writeConcern/writeconcern-bsonserialize-001.phpt
rename to mongodb-1.9.0/tests/writeConcern/writeconcern-bsonserialize-001.phpt
diff --git a/mongodb-1.8.1/tests/writeConcern/writeconcern-bsonserialize-002.phpt b/mongodb-1.9.0/tests/writeConcern/writeconcern-bsonserialize-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/writeConcern/writeconcern-bsonserialize-002.phpt
rename to mongodb-1.9.0/tests/writeConcern/writeconcern-bsonserialize-002.phpt
diff --git a/mongodb-1.8.1/tests/writeConcern/writeconcern-bsonserialize-003.phpt b/mongodb-1.9.0/tests/writeConcern/writeconcern-bsonserialize-003.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/writeConcern/writeconcern-bsonserialize-003.phpt
rename to mongodb-1.9.0/tests/writeConcern/writeconcern-bsonserialize-003.phpt
diff --git a/mongodb-1.8.1/tests/writeConcern/writeconcern-bsonserialize-004.phpt b/mongodb-1.9.0/tests/writeConcern/writeconcern-bsonserialize-004.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/writeConcern/writeconcern-bsonserialize-004.phpt
rename to mongodb-1.9.0/tests/writeConcern/writeconcern-bsonserialize-004.phpt
diff --git a/mongodb-1.8.1/tests/writeConcern/writeconcern-constants.phpt b/mongodb-1.9.0/tests/writeConcern/writeconcern-constants.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/writeConcern/writeconcern-constants.phpt
rename to mongodb-1.9.0/tests/writeConcern/writeconcern-constants.phpt
diff --git a/mongodb-1.8.1/tests/writeConcern/writeconcern-ctor-001.phpt b/mongodb-1.9.0/tests/writeConcern/writeconcern-ctor-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/writeConcern/writeconcern-ctor-001.phpt
rename to mongodb-1.9.0/tests/writeConcern/writeconcern-ctor-001.phpt
diff --git a/mongodb-1.8.1/tests/writeConcern/writeconcern-ctor-002.phpt b/mongodb-1.9.0/tests/writeConcern/writeconcern-ctor-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/writeConcern/writeconcern-ctor-002.phpt
rename to mongodb-1.9.0/tests/writeConcern/writeconcern-ctor-002.phpt
diff --git a/mongodb-1.9.0/tests/writeConcern/writeconcern-ctor_error-001.phpt b/mongodb-1.9.0/tests/writeConcern/writeconcern-ctor_error-001.phpt
new file mode 100644
index 00000000..b03dfdaa
--- /dev/null
+++ b/mongodb-1.9.0/tests/writeConcern/writeconcern-ctor_error-001.phpt
@@ -0,0 +1,21 @@
+--TEST--
+MongoDB\Driver\WriteConcern construction (invalid arguments)
+--SKIPIF--
+<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
+<?php skip_if_php_version('>=', '7.99'); ?>
+--FILE--
+<?php
+
+require_once __DIR__ . '/../utils/tools.php';
+
+echo throws(function() {
+ new MongoDB\Driver\WriteConcern("string", 10000, false, 1);
+}, MongoDB\Driver\Exception\InvalidArgumentException::class), "\n";
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECTF--
+OK: Got MongoDB\Driver\Exception\InvalidArgumentException
+MongoDB\Driver\WriteConcern::__construct() expects at most 3 %r(argument|parameter)%rs, 4 given
+===DONE===
diff --git a/mongodb-1.8.1/tests/writeConcern/writeconcern-ctor_error-002.phpt b/mongodb-1.9.0/tests/writeConcern/writeconcern-ctor_error-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/writeConcern/writeconcern-ctor_error-002.phpt
rename to mongodb-1.9.0/tests/writeConcern/writeconcern-ctor_error-002.phpt
diff --git a/mongodb-1.8.1/tests/writeConcern/writeconcern-ctor_error-003.phpt b/mongodb-1.9.0/tests/writeConcern/writeconcern-ctor_error-003.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/writeConcern/writeconcern-ctor_error-003.phpt
rename to mongodb-1.9.0/tests/writeConcern/writeconcern-ctor_error-003.phpt
diff --git a/mongodb-1.8.1/tests/writeConcern/writeconcern-ctor_error-004.phpt b/mongodb-1.9.0/tests/writeConcern/writeconcern-ctor_error-004.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/writeConcern/writeconcern-ctor_error-004.phpt
rename to mongodb-1.9.0/tests/writeConcern/writeconcern-ctor_error-004.phpt
diff --git a/mongodb-1.8.1/tests/writeConcern/writeconcern-ctor_error-005.phpt b/mongodb-1.9.0/tests/writeConcern/writeconcern-ctor_error-005.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/writeConcern/writeconcern-ctor_error-005.phpt
rename to mongodb-1.9.0/tests/writeConcern/writeconcern-ctor_error-005.phpt
diff --git a/mongodb-1.8.1/tests/writeConcern/writeconcern-debug-001.phpt b/mongodb-1.9.0/tests/writeConcern/writeconcern-debug-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/writeConcern/writeconcern-debug-001.phpt
rename to mongodb-1.9.0/tests/writeConcern/writeconcern-debug-001.phpt
diff --git a/mongodb-1.8.1/tests/writeConcern/writeconcern-debug-002.phpt b/mongodb-1.9.0/tests/writeConcern/writeconcern-debug-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/writeConcern/writeconcern-debug-002.phpt
rename to mongodb-1.9.0/tests/writeConcern/writeconcern-debug-002.phpt
diff --git a/mongodb-1.8.1/tests/writeConcern/writeconcern-debug-003.phpt b/mongodb-1.9.0/tests/writeConcern/writeconcern-debug-003.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/writeConcern/writeconcern-debug-003.phpt
rename to mongodb-1.9.0/tests/writeConcern/writeconcern-debug-003.phpt
diff --git a/mongodb-1.8.1/tests/writeConcern/writeconcern-getjournal-001.phpt b/mongodb-1.9.0/tests/writeConcern/writeconcern-getjournal-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/writeConcern/writeconcern-getjournal-001.phpt
rename to mongodb-1.9.0/tests/writeConcern/writeconcern-getjournal-001.phpt
diff --git a/mongodb-1.8.1/tests/writeConcern/writeconcern-getw-001.phpt b/mongodb-1.9.0/tests/writeConcern/writeconcern-getw-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/writeConcern/writeconcern-getw-001.phpt
rename to mongodb-1.9.0/tests/writeConcern/writeconcern-getw-001.phpt
diff --git a/mongodb-1.8.1/tests/writeConcern/writeconcern-getwtimeout-001.phpt b/mongodb-1.9.0/tests/writeConcern/writeconcern-getwtimeout-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/writeConcern/writeconcern-getwtimeout-001.phpt
rename to mongodb-1.9.0/tests/writeConcern/writeconcern-getwtimeout-001.phpt
diff --git a/mongodb-1.8.1/tests/writeConcern/writeconcern-getwtimeout-002.phpt b/mongodb-1.9.0/tests/writeConcern/writeconcern-getwtimeout-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/writeConcern/writeconcern-getwtimeout-002.phpt
rename to mongodb-1.9.0/tests/writeConcern/writeconcern-getwtimeout-002.phpt
diff --git a/mongodb-1.8.1/tests/writeConcern/writeconcern-isdefault-001.phpt b/mongodb-1.9.0/tests/writeConcern/writeconcern-isdefault-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/writeConcern/writeconcern-isdefault-001.phpt
rename to mongodb-1.9.0/tests/writeConcern/writeconcern-isdefault-001.phpt
diff --git a/mongodb-1.8.1/tests/writeConcern/writeconcern-serialization-001.phpt b/mongodb-1.9.0/tests/writeConcern/writeconcern-serialization-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/writeConcern/writeconcern-serialization-001.phpt
rename to mongodb-1.9.0/tests/writeConcern/writeconcern-serialization-001.phpt
diff --git a/mongodb-1.8.1/tests/writeConcern/writeconcern-serialization_error-001.phpt b/mongodb-1.9.0/tests/writeConcern/writeconcern-serialization_error-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/writeConcern/writeconcern-serialization_error-001.phpt
rename to mongodb-1.9.0/tests/writeConcern/writeconcern-serialization_error-001.phpt
diff --git a/mongodb-1.8.1/tests/writeConcern/writeconcern-set_state-001.phpt b/mongodb-1.9.0/tests/writeConcern/writeconcern-set_state-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/writeConcern/writeconcern-set_state-001.phpt
rename to mongodb-1.9.0/tests/writeConcern/writeconcern-set_state-001.phpt
diff --git a/mongodb-1.8.1/tests/writeConcern/writeconcern-set_state_error-001.phpt b/mongodb-1.9.0/tests/writeConcern/writeconcern-set_state_error-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/writeConcern/writeconcern-set_state_error-001.phpt
rename to mongodb-1.9.0/tests/writeConcern/writeconcern-set_state_error-001.phpt
diff --git a/mongodb-1.8.1/tests/writeConcern/writeconcern-var_export-001.phpt b/mongodb-1.9.0/tests/writeConcern/writeconcern-var_export-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/writeConcern/writeconcern-var_export-001.phpt
rename to mongodb-1.9.0/tests/writeConcern/writeconcern-var_export-001.phpt
diff --git a/mongodb-1.8.1/tests/writeConcern/writeconcern_error-001.phpt b/mongodb-1.9.0/tests/writeConcern/writeconcern_error-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/writeConcern/writeconcern_error-001.phpt
rename to mongodb-1.9.0/tests/writeConcern/writeconcern_error-001.phpt
diff --git a/mongodb-1.8.1/tests/writeConcernError/writeconcernerror-debug-001.phpt b/mongodb-1.9.0/tests/writeConcernError/writeconcernerror-debug-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/writeConcernError/writeconcernerror-debug-001.phpt
rename to mongodb-1.9.0/tests/writeConcernError/writeconcernerror-debug-001.phpt
diff --git a/mongodb-1.8.1/tests/writeConcernError/writeconcernerror-debug-002.phpt b/mongodb-1.9.0/tests/writeConcernError/writeconcernerror-debug-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/writeConcernError/writeconcernerror-debug-002.phpt
rename to mongodb-1.9.0/tests/writeConcernError/writeconcernerror-debug-002.phpt
diff --git a/mongodb-1.8.1/tests/writeConcernError/writeconcernerror-getcode-001.phpt b/mongodb-1.9.0/tests/writeConcernError/writeconcernerror-getcode-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/writeConcernError/writeconcernerror-getcode-001.phpt
rename to mongodb-1.9.0/tests/writeConcernError/writeconcernerror-getcode-001.phpt
diff --git a/mongodb-1.8.1/tests/writeConcernError/writeconcernerror-getinfo-001.phpt b/mongodb-1.9.0/tests/writeConcernError/writeconcernerror-getinfo-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/writeConcernError/writeconcernerror-getinfo-001.phpt
rename to mongodb-1.9.0/tests/writeConcernError/writeconcernerror-getinfo-001.phpt
diff --git a/mongodb-1.8.1/tests/writeConcernError/writeconcernerror-getinfo-002.phpt b/mongodb-1.9.0/tests/writeConcernError/writeconcernerror-getinfo-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/writeConcernError/writeconcernerror-getinfo-002.phpt
rename to mongodb-1.9.0/tests/writeConcernError/writeconcernerror-getinfo-002.phpt
diff --git a/mongodb-1.8.1/tests/writeConcernError/writeconcernerror-getmessage-001.phpt b/mongodb-1.9.0/tests/writeConcernError/writeconcernerror-getmessage-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/writeConcernError/writeconcernerror-getmessage-001.phpt
rename to mongodb-1.9.0/tests/writeConcernError/writeconcernerror-getmessage-001.phpt
diff --git a/mongodb-1.8.1/tests/writeConcernError/writeconcernerror_error-001.phpt b/mongodb-1.9.0/tests/writeConcernError/writeconcernerror_error-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/writeConcernError/writeconcernerror_error-001.phpt
rename to mongodb-1.9.0/tests/writeConcernError/writeconcernerror_error-001.phpt
diff --git a/mongodb-1.8.1/tests/writeError/writeerror-debug-001.phpt b/mongodb-1.9.0/tests/writeError/writeerror-debug-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/writeError/writeerror-debug-001.phpt
rename to mongodb-1.9.0/tests/writeError/writeerror-debug-001.phpt
diff --git a/mongodb-1.8.1/tests/writeError/writeerror-getCode-001.phpt b/mongodb-1.9.0/tests/writeError/writeerror-getCode-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/writeError/writeerror-getCode-001.phpt
rename to mongodb-1.9.0/tests/writeError/writeerror-getCode-001.phpt
diff --git a/mongodb-1.8.1/tests/writeError/writeerror-getIndex-001.phpt b/mongodb-1.9.0/tests/writeError/writeerror-getIndex-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/writeError/writeerror-getIndex-001.phpt
rename to mongodb-1.9.0/tests/writeError/writeerror-getIndex-001.phpt
diff --git a/mongodb-1.8.1/tests/writeError/writeerror-getInfo-001.phpt b/mongodb-1.9.0/tests/writeError/writeerror-getInfo-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/writeError/writeerror-getInfo-001.phpt
rename to mongodb-1.9.0/tests/writeError/writeerror-getInfo-001.phpt
diff --git a/mongodb-1.8.1/tests/writeError/writeerror-getMessage-001.phpt b/mongodb-1.9.0/tests/writeError/writeerror-getMessage-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/writeError/writeerror-getMessage-001.phpt
rename to mongodb-1.9.0/tests/writeError/writeerror-getMessage-001.phpt
diff --git a/mongodb-1.8.1/tests/writeError/writeerror_error-001.phpt b/mongodb-1.9.0/tests/writeError/writeerror_error-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/writeError/writeerror_error-001.phpt
rename to mongodb-1.9.0/tests/writeError/writeerror_error-001.phpt
diff --git a/mongodb-1.8.1/tests/writeResult/bug0671-003.phpt b/mongodb-1.9.0/tests/writeResult/bug0671-003.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/writeResult/bug0671-003.phpt
rename to mongodb-1.9.0/tests/writeResult/bug0671-003.phpt
diff --git a/mongodb-1.8.1/tests/writeResult/writeresult-debug-001.phpt b/mongodb-1.9.0/tests/writeResult/writeresult-debug-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/writeResult/writeresult-debug-001.phpt
rename to mongodb-1.9.0/tests/writeResult/writeresult-debug-001.phpt
diff --git a/mongodb-1.8.1/tests/writeResult/writeresult-debug-002.phpt b/mongodb-1.9.0/tests/writeResult/writeresult-debug-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/writeResult/writeresult-debug-002.phpt
rename to mongodb-1.9.0/tests/writeResult/writeresult-debug-002.phpt
diff --git a/mongodb-1.8.1/tests/writeResult/writeresult-getdeletedcount-001.phpt b/mongodb-1.9.0/tests/writeResult/writeresult-getdeletedcount-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/writeResult/writeresult-getdeletedcount-001.phpt
rename to mongodb-1.9.0/tests/writeResult/writeresult-getdeletedcount-001.phpt
diff --git a/mongodb-1.8.1/tests/writeResult/writeresult-getdeletedcount-002.phpt b/mongodb-1.9.0/tests/writeResult/writeresult-getdeletedcount-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/writeResult/writeresult-getdeletedcount-002.phpt
rename to mongodb-1.9.0/tests/writeResult/writeresult-getdeletedcount-002.phpt
diff --git a/mongodb-1.8.1/tests/writeResult/writeresult-getinsertedcount-001.phpt b/mongodb-1.9.0/tests/writeResult/writeresult-getinsertedcount-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/writeResult/writeresult-getinsertedcount-001.phpt
rename to mongodb-1.9.0/tests/writeResult/writeresult-getinsertedcount-001.phpt
diff --git a/mongodb-1.8.1/tests/writeResult/writeresult-getinsertedcount-002.phpt b/mongodb-1.9.0/tests/writeResult/writeresult-getinsertedcount-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/writeResult/writeresult-getinsertedcount-002.phpt
rename to mongodb-1.9.0/tests/writeResult/writeresult-getinsertedcount-002.phpt
diff --git a/mongodb-1.8.1/tests/writeResult/writeresult-getmatchedcount-001.phpt b/mongodb-1.9.0/tests/writeResult/writeresult-getmatchedcount-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/writeResult/writeresult-getmatchedcount-001.phpt
rename to mongodb-1.9.0/tests/writeResult/writeresult-getmatchedcount-001.phpt
diff --git a/mongodb-1.8.1/tests/writeResult/writeresult-getmatchedcount-002.phpt b/mongodb-1.9.0/tests/writeResult/writeresult-getmatchedcount-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/writeResult/writeresult-getmatchedcount-002.phpt
rename to mongodb-1.9.0/tests/writeResult/writeresult-getmatchedcount-002.phpt
diff --git a/mongodb-1.8.1/tests/writeResult/writeresult-getmodifiedcount-001.phpt b/mongodb-1.9.0/tests/writeResult/writeresult-getmodifiedcount-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/writeResult/writeresult-getmodifiedcount-001.phpt
rename to mongodb-1.9.0/tests/writeResult/writeresult-getmodifiedcount-001.phpt
diff --git a/mongodb-1.8.1/tests/writeResult/writeresult-getmodifiedcount-002.phpt b/mongodb-1.9.0/tests/writeResult/writeresult-getmodifiedcount-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/writeResult/writeresult-getmodifiedcount-002.phpt
rename to mongodb-1.9.0/tests/writeResult/writeresult-getmodifiedcount-002.phpt
diff --git a/mongodb-1.8.1/tests/writeResult/writeresult-getserver-001.phpt b/mongodb-1.9.0/tests/writeResult/writeresult-getserver-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/writeResult/writeresult-getserver-001.phpt
rename to mongodb-1.9.0/tests/writeResult/writeresult-getserver-001.phpt
diff --git a/mongodb-1.8.1/tests/writeResult/writeresult-getupsertedcount-001.phpt b/mongodb-1.9.0/tests/writeResult/writeresult-getupsertedcount-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/writeResult/writeresult-getupsertedcount-001.phpt
rename to mongodb-1.9.0/tests/writeResult/writeresult-getupsertedcount-001.phpt
diff --git a/mongodb-1.8.1/tests/writeResult/writeresult-getupsertedcount-002.phpt b/mongodb-1.9.0/tests/writeResult/writeresult-getupsertedcount-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/writeResult/writeresult-getupsertedcount-002.phpt
rename to mongodb-1.9.0/tests/writeResult/writeresult-getupsertedcount-002.phpt
diff --git a/mongodb-1.8.1/tests/writeResult/writeresult-getupsertedids-001.phpt b/mongodb-1.9.0/tests/writeResult/writeresult-getupsertedids-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/writeResult/writeresult-getupsertedids-001.phpt
rename to mongodb-1.9.0/tests/writeResult/writeresult-getupsertedids-001.phpt
diff --git a/mongodb-1.8.1/tests/writeResult/writeresult-getupsertedids-002.phpt b/mongodb-1.9.0/tests/writeResult/writeresult-getupsertedids-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/writeResult/writeresult-getupsertedids-002.phpt
rename to mongodb-1.9.0/tests/writeResult/writeresult-getupsertedids-002.phpt
diff --git a/mongodb-1.8.1/tests/writeResult/writeresult-getwriteconcernerror-001.phpt b/mongodb-1.9.0/tests/writeResult/writeresult-getwriteconcernerror-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/writeResult/writeresult-getwriteconcernerror-001.phpt
rename to mongodb-1.9.0/tests/writeResult/writeresult-getwriteconcernerror-001.phpt
diff --git a/mongodb-1.8.1/tests/writeResult/writeresult-getwriteerrors-001.phpt b/mongodb-1.9.0/tests/writeResult/writeresult-getwriteerrors-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/writeResult/writeresult-getwriteerrors-001.phpt
rename to mongodb-1.9.0/tests/writeResult/writeresult-getwriteerrors-001.phpt
diff --git a/mongodb-1.8.1/tests/writeResult/writeresult-getwriteerrors-002.phpt b/mongodb-1.9.0/tests/writeResult/writeresult-getwriteerrors-002.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/writeResult/writeresult-getwriteerrors-002.phpt
rename to mongodb-1.9.0/tests/writeResult/writeresult-getwriteerrors-002.phpt
diff --git a/mongodb-1.8.1/tests/writeResult/writeresult-isacknowledged-001.phpt b/mongodb-1.9.0/tests/writeResult/writeresult-isacknowledged-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/writeResult/writeresult-isacknowledged-001.phpt
rename to mongodb-1.9.0/tests/writeResult/writeresult-isacknowledged-001.phpt
diff --git a/mongodb-1.8.1/tests/writeResult/writeresult_error-001.phpt b/mongodb-1.9.0/tests/writeResult/writeresult_error-001.phpt
similarity index 100%
rename from mongodb-1.8.1/tests/writeResult/writeresult_error-001.phpt
rename to mongodb-1.9.0/tests/writeResult/writeresult_error-001.phpt
diff --git a/package.xml b/package.xml
index 081eb4bf..8de32485 100644
--- a/package.xml
+++ b/package.xml
@@ -1,2565 +1,2610 @@
<?xml version="1.0" encoding="UTF-8"?>
<package packagerversion="1.10.12" 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 fundamental and performance-critical components
necessary to build a fully-functional MongoDB driver.</description>
<lead>
<name>Andreas Braun</name>
<user>alcaeus</user>
<email>alcaeus@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>no</active>
</lead>
<lead>
<name>Hannes Magnusson</name>
<user>bjori</user>
<email>bjori@php.net</email>
<active>no</active>
</lead>
<developer>
<name>Katherine Walker</name>
<user>kvwalker</user>
<email>kvwalker@php.net</email>
<active>no</active>
</developer>
- <date>2020-10-06</date>
- <time>11:11:23</time>
+ <date>2020-11-25</date>
+ <time>12:10:07</time>
<version>
- <release>1.8.1</release>
- <api>1.8.1</api>
+ <release>1.9.0</release>
+ <api>1.9.0</api>
</version>
<stability>
<release>stable</release>
<api>stable</api>
</stability>
<license uri="http://www.apache.org/licenses/LICENSE-2.0">Apache License</license>
<notes>
+** Epic
+ * [PHPC-1631] - Support PHP 8
+
+** New Feature
+ * [PHPC-1691] - Iterator implementation for MongoDB\Driver\Cursor
+
** Bug
-* [PHPC-1683] - Collect error labels from writeConcernErrors in libmongoc bulk write replies
-* [PHPC-1687] - Session::commitTransaction() leaks reply document on success
+ * [PHPC-1167] - executeBulkWrite() may leave dangling session pointer on BulkWrite object
+ * [PHPC-1693] - Fix MongoDB\BSON\Regex::__construct() arginfo
+ * [PHPC-1697] - Fix MongoDB\Driver\Command::__construct() arginfo
+ * [PHPC-1698] - prep_tagsets may leak in convert_to_object
+ * [PHPC-1700] - prep_tagsets may leak if calling method errors
+
+** Improvement
+ * [PHPC-479] - Print mongoc and libbson versions during configure
+ * [PHPC-1699] - Ensure all zpp errors are proxied by InvalidArgumentException
+ * [PHPC-1704] - Improve checks for built-in PHP extensions for Windows builds
+ * [PHPC-1706] - AIX platforms shouldn&apos;t try linking with libresolv
+
+** Task
+ * [PHPC-169] - Test read and write concern inheritance
+ * [PHPC-1652] - Add timestamp test with high-order bit set that&apos;s not 2^32-1
+ * [PHPC-1653] - Resync BSON corpus spec tests
+ * [PHPC-1655] - Add a bson corpus test with invalid type for $code when $scope is also present
+ * [PHPC-1660] - Always refer to explicit version in PECL example for non-stable release notes
+ * [PHPC-1689] - Allow driver to compile with PHP 8
+ * [PHPC-1692] - Test suite fixes for PHP 8
+ * [PHPC-1694] - Add PHP 8 nightly to Travis CI build matrix
+ * [PHPC-1695] - Add PHP 8 to AppVeyor build matrix
</notes>
<contents>
<dir name="/">
<file md5sum="c78c5e9b49b67a725e831823492642da" name="scripts/autotools/libbson/CheckAtomics.m4" role="src" />
<file md5sum="24efc529aa9f2b40d80cbec3bb635d01" name="scripts/autotools/libbson/CheckHeaders.m4" role="src" />
<file md5sum="fcce6a6a1e782b4482a50b18f78a2114" name="scripts/autotools/libbson/Endian.m4" role="src" />
<file md5sum="f1678968409f821893deb37ce58de6ee" name="scripts/autotools/libbson/FindDependencies.m4" role="src" />
<file md5sum="0ea5922bfcf826e14a5f3c0a5563e410" name="scripts/autotools/libbson/Versions.m4" role="src" />
<file md5sum="8ad59ded5a1ccc434742345553373cfd" name="scripts/autotools/libmongoc/CheckCompression.m4" role="src" />
<file md5sum="96ddbeccbaa3c00f367810f56df074e4" name="scripts/autotools/libmongoc/CheckICU.m4" role="src" />
- <file md5sum="3961221ff64e183bc4847fc4b02f3eb5" name="scripts/autotools/libmongoc/CheckResolv.m4" role="src" />
+ <file md5sum="79ffd99afdc875d93f016f693b787468" name="scripts/autotools/libmongoc/CheckResolv.m4" role="src" />
<file md5sum="1402931faf1e48f2159acbb7f0a36452" name="scripts/autotools/libmongoc/CheckSSL.m4" role="src" />
<file md5sum="39e1c1663469b0d6222b6babd183fb40" name="scripts/autotools/libmongoc/CheckSasl.m4" role="src" />
- <file md5sum="02def5697535eb19ab7be5b52b1da863" name="scripts/autotools/libmongoc/FindDependencies.m4" role="src" />
+ <file md5sum="416b3bbfdd1ade68dd3f8ec1ceda5186" name="scripts/autotools/libmongoc/FindDependencies.m4" role="src" />
<file md5sum="bba9dc2de93bdadc29dc0927676161c7" name="scripts/autotools/libmongoc/PlatformFlags.m4" role="src" />
<file md5sum="08214982201e2c7805b62a3a4ca915a6" name="scripts/autotools/libmongoc/Versions.m4" role="src" />
<file md5sum="76e2c1a2aa19f5fab3661c992ac603fa" name="scripts/autotools/libmongoc/WeakSymbols.m4" role="src" />
<file md5sum="906a71d7858713742f5febc043b9b51b" name="scripts/autotools/libmongocrypt/CheckSSL.m4" role="src" />
<file md5sum="471ed55586aaeef30e1d54a235133735" name="scripts/autotools/libmongocrypt/Version.m4" role="src" />
<file md5sum="0091c30d8927966e5ba54ce90b62bf6e" name="scripts/autotools/m4/as_var_copy.m4" role="src" />
<file md5sum="8d942f69b5f3c15ecae4b75bb7e80614" name="scripts/autotools/m4/ax_check_compile_flag.m4" role="src" />
<file md5sum="c2221efd4309e58ff7e2ef989c8e8ac4" name="scripts/autotools/m4/ax_prototype.m4" role="src" />
<file md5sum="b5114dfcf027b0f9a47b6e6841015be6" name="scripts/autotools/m4/ax_pthread.m4" role="src" />
<file md5sum="01a9faee79ca2be030b72f2046976b09" name="scripts/autotools/m4/php_mongodb.m4" role="src" />
<file md5sum="ad8d52d54e0f97c0e4e385376ea73bc0" name="scripts/autotools/m4/pkg.m4" role="src" />
<file md5sum="0601fcdfbdc1e25d6f5601cf78693669" name="scripts/autotools/CheckCompiler.m4" role="src" />
- <file md5sum="869012c9009774810bc6789022c110ff" name="scripts/autotools/CheckHost.m4" role="src" />
+ <file md5sum="51c4dd11458ad655113dcdb101640b49" name="scripts/autotools/CheckHost.m4" role="src" />
<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="a36639292f69b5a3ed651ce2b91c9e51" name="scripts/centos/ldap/ldapconfig.py" 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="0761d232dfeacdec8308a100bbc9d03d" name="scripts/presets/replicaset-30.json" role="test" />
<file md5sum="ae88260932ae81a57d01480056fc595b" name="scripts/presets/replicaset-dns.json" role="test" />
<file md5sum="2e1c24fc2047589c5c38c07f09ff5b16" name="scripts/presets/replicaset.json" role="test" />
<file md5sum="6174401ebaba915d51de6394e962f627" name="scripts/presets/standalone-30.json" role="test" />
<file md5sum="be430bb8913b8c397fb2c7ebe6bf95a4" name="scripts/presets/standalone-auth.json" role="test" />
<file md5sum="cb26affccf6b2fef9374fb7d74050258" name="scripts/presets/standalone-plain.json" role="test" />
<file md5sum="d44e450c347829ae55c229bd2e018181" name="scripts/presets/standalone-ssl.json" role="test" />
<file md5sum="88d003b1fa5efe0ad7c625bc43764bf6" name="scripts/presets/standalone-x509.json" role="test" />
<file md5sum="44f3827004245db36ccd5a9388fa9ac0" name="scripts/presets/standalone.json" role="test" />
<file md5sum="097ef755ecbaed0f3fe8495e4d56207e" name="scripts/ssl/ca.pem" role="test" />
<file md5sum="c2c6fbfad3c6623584171da4b486fb61" name="scripts/ssl/client.pem" role="test" />
<file md5sum="7b41860fa327d7c5cf5bc63b681efac2" name="scripts/ssl/crl.pem" role="test" />
<file md5sum="143c83fdfcd0f1d011e416c853e634de" 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="339ab9c62ab4b7f09ac5a7b3f6b62c73" 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="a914c0f8add31145700dfb8eceb44654" name="scripts/clang-format.sh" role="test" />
- <file md5sum="4f3d1683e946d021958f7d11a8a6c2e2" name="scripts/convert-bson-corpus-tests.php" role="test" />
+ <file md5sum="e231776492843ffbf847e1534f387887" name="scripts/convert-bson-corpus-tests.php" role="test" />
<file md5sum="35671ea9b24b02610710ef676bc539a2" name="scripts/list-servers.php" role="test" />
<file md5sum="59b4cf65e9412c174b2641a6a1602d95" name="scripts/run-tests-on.sh" role="test" />
<file md5sum="38d7db8918c49a4549e322d079e644b2" name="scripts/start-servers.php" role="test" />
- <file md5sum="282e5f5a621c16b1b63c17ea7cb5b5ac" name="src/BSON/Binary.c" role="src" />
+ <file md5sum="14f018b4e48d37894e710ed3e0904d4c" name="src/BSON/Binary.c" role="src" />
<file md5sum="753d0f9455e588bba1fbd3299be5510f" name="src/BSON/BinaryInterface.c" role="src" />
- <file md5sum="4b5ec5c04e9cae2a5dc42239de3a3237" name="src/BSON/DBPointer.c" role="src" />
- <file md5sum="6342ba898e0217e7fb109f12d079242c" name="src/BSON/Decimal128.c" role="src" />
+ <file md5sum="cb98cecdd972b33251487c97660fb109" name="src/BSON/DBPointer.c" role="src" />
+ <file md5sum="4ef3b2ed0493be06e3b174ba9fa97819" name="src/BSON/Decimal128.c" role="src" />
<file md5sum="584142c02500f54faf86325c5e2448b0" name="src/BSON/Decimal128Interface.c" role="src" />
- <file md5sum="78480e1b968d60a582a2be8a9bc48d16" name="src/BSON/Int64.c" role="src" />
- <file md5sum="75455bf1dc85097860ef6ff7c049e48e" name="src/BSON/Javascript.c" role="src" />
+ <file md5sum="845b49af9a2901b3bba106f60b37cb8f" name="src/BSON/Int64.c" role="src" />
+ <file md5sum="32fd4a64706223266d5c2c3c9b22c9c3" name="src/BSON/Javascript.c" role="src" />
<file md5sum="e9c148621825de0b94ab21c9f9a81bce" name="src/BSON/JavascriptInterface.c" role="src" />
- <file md5sum="adc76b241d20caaf36f7fcf5e60093a5" name="src/BSON/MaxKey.c" role="src" />
+ <file md5sum="eed349f0748e6c68d7811f3266f08854" name="src/BSON/MaxKey.c" role="src" />
<file md5sum="3b0cdc3c4ec44eff177dba33f3e41f7e" name="src/BSON/MaxKeyInterface.c" role="src" />
- <file md5sum="e4e8989d7beefdff34904e23ca1b48e6" name="src/BSON/MinKey.c" role="src" />
+ <file md5sum="3bd307e76f9983dffd893096594a1ca9" name="src/BSON/MinKey.c" role="src" />
<file md5sum="5ab20f03675dcaca3856fa33db3e7ff1" name="src/BSON/MinKeyInterface.c" role="src" />
- <file md5sum="42d3ec87dd9d342f8f05902276ab096e" name="src/BSON/ObjectId.c" role="src" />
+ <file md5sum="ec2eb808542966af5077f8e26ae163af" name="src/BSON/ObjectId.c" role="src" />
<file md5sum="ea65bbb2fc742f2b24a8d2f3da9cdcc7" name="src/BSON/ObjectIdInterface.c" role="src" />
<file md5sum="50ab8a7d60043030a9a1f0105db15ff7" name="src/BSON/Persistable.c" role="src" />
- <file md5sum="bd4eedadea9875ca0d8731f5539d3d65" name="src/BSON/Regex.c" role="src" />
+ <file md5sum="2dafd7b8b235fc1531031b8cecf2ca9c" name="src/BSON/Regex.c" role="src" />
<file md5sum="c71cec32f1d2eeae66761495dcadf829" name="src/BSON/RegexInterface.c" role="src" />
<file md5sum="80f92b8aa08d22e7dc6e60165b8f5c5b" name="src/BSON/Serializable.c" role="src" />
- <file md5sum="d760a27c00454c3356dfadd5e6fdcc40" name="src/BSON/Symbol.c" role="src" />
- <file md5sum="cfd13a1e63663e0d5cca3450f49f0250" name="src/BSON/Timestamp.c" role="src" />
+ <file md5sum="3861bd12a83b6a4fa42a66e1c8f86872" name="src/BSON/Symbol.c" role="src" />
+ <file md5sum="2594579fb0c0c94333b90236bca9fb4d" name="src/BSON/Timestamp.c" role="src" />
<file md5sum="c91de93de8f86abd5b014766d7dc5770" name="src/BSON/TimestampInterface.c" role="src" />
<file md5sum="d8555d9cdccc9964de9533a8eef9076b" name="src/BSON/Type.c" role="src" />
- <file md5sum="2f12c199b9dc79f9e481938af843ec96" name="src/BSON/UTCDateTime.c" role="src" />
+ <file md5sum="3e04134edfbf7da183690e5cb48eac4f" name="src/BSON/UTCDateTime.c" role="src" />
<file md5sum="6212def544f4d6287549215f9cbabaae" name="src/BSON/UTCDateTimeInterface.c" role="src" />
- <file md5sum="bd277005753f9ebf896a594d39acdc95" name="src/BSON/Undefined.c" role="src" />
+ <file md5sum="c4d1d75a8f4df3091f18c5638815b56e" name="src/BSON/Undefined.c" role="src" />
<file md5sum="38f7e902c9b91e23d217bb754094f390" name="src/BSON/Unserializable.c" role="src" />
- <file md5sum="0320a6c2b20570ac459c3a3d4c9de323" name="src/BSON/functions.c" role="src" />
+ <file md5sum="ae83ef5b76acf4dfdfcfb3f1d4949720" name="src/BSON/functions.c" role="src" />
<file md5sum="cb163d0a2877617c39259cb2ff7b70cb" name="src/BSON/functions.h" role="src" />
<file md5sum="92b58651c5db78439eeb26df9d486072" name="src/MongoDB/Exception/AuthenticationException.c" role="src" />
<file md5sum="9763969f4bdab61eb951363f47d7e63c" name="src/MongoDB/Exception/BulkWriteException.c" role="src" />
- <file md5sum="ab8a8227389c1a4fdd69d7b288fd044e" name="src/MongoDB/Exception/CommandException.c" role="src" />
+ <file md5sum="da49a3426802fffeee68315cd43faa23" name="src/MongoDB/Exception/CommandException.c" role="src" />
<file md5sum="a67ad8f0e59149c24e700a8c398c3506" name="src/MongoDB/Exception/ConnectionException.c" role="src" />
<file md5sum="fa22f93a40b27af930f516f2b0ff3f8d" name="src/MongoDB/Exception/ConnectionTimeoutException.c" role="src" />
<file md5sum="66b4bfffde44b1bf833a99ca5f1b917a" name="src/MongoDB/Exception/EncryptionException.c" role="src" />
<file md5sum="72a992cdeb7aba73e8b3ebb6db86aa46" name="src/MongoDB/Exception/Exception.c" role="src" />
<file md5sum="dcbe67280cd0405f57e1980ff04be7f3" name="src/MongoDB/Exception/ExecutionTimeoutException.c" role="src" />
<file md5sum="82d97ed975f9d392117a26ece5e1df70" name="src/MongoDB/Exception/InvalidArgumentException.c" role="src" />
<file md5sum="bd802cb7e6853f8dc10113a3c0ed38a2" name="src/MongoDB/Exception/LogicException.c" role="src" />
- <file md5sum="f9d609fac8651cd11b94a6bd79bf7104" name="src/MongoDB/Exception/RuntimeException.c" role="src" />
+ <file md5sum="b64ba6ff8ab88fbfea59d39561d60b8b" name="src/MongoDB/Exception/RuntimeException.c" role="src" />
<file md5sum="f0fda29946e70ef7dfcec126a64b49aa" name="src/MongoDB/Exception/SSLConnectionException.c" role="src" />
<file md5sum="c45b0e7d03183a663eca89403a015d82" name="src/MongoDB/Exception/ServerException.c" role="src" />
<file md5sum="fa4b5248d101c051f9cc036143e611d6" name="src/MongoDB/Exception/UnexpectedValueException.c" role="src" />
- <file md5sum="621ac99d75e3f9f7abf77d694d336e68" name="src/MongoDB/Exception/WriteException.c" role="src" />
- <file md5sum="33a8b49e625b80112eabef184e7d2e86" name="src/MongoDB/Monitoring/CommandFailedEvent.c" role="src" />
- <file md5sum="e9ec9552ba894fdfda9f80c17106c96f" name="src/MongoDB/Monitoring/CommandStartedEvent.c" role="src" />
+ <file md5sum="cf6442f022d806d0e2eae4802e12878f" name="src/MongoDB/Exception/WriteException.c" role="src" />
+ <file md5sum="f6a56224d387ae608064448aae595b75" name="src/MongoDB/Monitoring/CommandFailedEvent.c" role="src" />
+ <file md5sum="e0d091c69bd74a103ccdb791caf7a73d" name="src/MongoDB/Monitoring/CommandStartedEvent.c" role="src" />
<file md5sum="9aab545180e10364311c12aafc3ea832" name="src/MongoDB/Monitoring/CommandSubscriber.c" role="src" />
- <file md5sum="7533560097e3544941f8da491f431cd3" name="src/MongoDB/Monitoring/CommandSucceededEvent.c" role="src" />
+ <file md5sum="383be1120513798d9d47a53f3ca2b707" name="src/MongoDB/Monitoring/CommandSucceededEvent.c" role="src" />
<file md5sum="5001dc52cc2cc8e0ddedd0b987d455a0" name="src/MongoDB/Monitoring/Subscriber.c" role="src" />
- <file md5sum="ff5ec55e450f69e4636b30382e44a023" name="src/MongoDB/Monitoring/functions.c" role="src" />
+ <file md5sum="1422b3d377b23139ea02659e902eb410" name="src/MongoDB/Monitoring/functions.c" role="src" />
<file md5sum="c5ba2e385a5d6200f9646c7264c21651" name="src/MongoDB/Monitoring/functions.h" role="src" />
- <file md5sum="713b21367450df0cfb6227771cb803fa" name="src/MongoDB/BulkWrite.c" role="src" />
- <file md5sum="428be865cdd18de2733255d0610dc4e6" name="src/MongoDB/ClientEncryption.c" role="src" />
- <file md5sum="1f82ae4c7f3a4fe491a5e0d9f6bf2dea" name="src/MongoDB/Command.c" role="src" />
- <file md5sum="9e7a6ad9290fb82ac6c3e4df455c1597" name="src/MongoDB/Cursor.c" role="src" />
- <file md5sum="93d8879b503f579b2e89873d9893905b" name="src/MongoDB/CursorId.c" role="src" />
+ <file md5sum="1cfaf4be63787d667ff7a5212d7fc412" name="src/MongoDB/BulkWrite.c" role="src" />
+ <file md5sum="2daf1ecf9edb675888dab6f6857b23dc" name="src/MongoDB/ClientEncryption.c" role="src" />
+ <file md5sum="a25c63c79990daa2fd6b3e52e8db9b87" name="src/MongoDB/Command.c" role="src" />
+ <file md5sum="9e13d91e7d8cb0eb15da8ef8e7c9e640" name="src/MongoDB/Cursor.c" role="src" />
+ <file md5sum="2297c8291692d5fb78f4396762adf252" name="src/MongoDB/CursorId.c" role="src" />
<file md5sum="1ecb727f1b35198f55aec08445ed3c6b" name="src/MongoDB/CursorInterface.c" role="src" />
- <file md5sum="fb31996be10c6e4f4d7001e23950bcf4" name="src/MongoDB/Manager.c" role="src" />
- <file md5sum="0f3eacf1e4aade3d780050c402138f8c" name="src/MongoDB/Query.c" role="src" />
- <file md5sum="58ced21c764f4a004cca2dfe62b1816a" name="src/MongoDB/ReadConcern.c" role="src" />
- <file md5sum="97141e98e0817d36aedc8625d2f301d4" name="src/MongoDB/ReadPreference.c" role="src" />
- <file md5sum="b77c4a1b4c3d11c756492023ec00790c" name="src/MongoDB/Server.c" role="src" />
- <file md5sum="b329a02d90ee05cd652b9fbf7abcec16" name="src/MongoDB/Session.c" role="src" />
+ <file md5sum="c501d6b87a18fab099a7eadb6054a9c8" name="src/MongoDB/Manager.c" role="src" />
+ <file md5sum="e3e0e7ae01aba69d07a5f02757e9e24c" name="src/MongoDB/Query.c" role="src" />
+ <file md5sum="e50eccb04a283e927de5ad5d251350cd" name="src/MongoDB/ReadConcern.c" role="src" />
+ <file md5sum="09eb890c0a8abaef255d479b58fd6908" name="src/MongoDB/ReadPreference.c" role="src" />
+ <file md5sum="0f43672d81638b371c4a5424d69b0c16" name="src/MongoDB/Server.c" role="src" />
+ <file md5sum="e4a53f6daafd07ca6e3a2e1075289e66" name="src/MongoDB/Session.c" role="src" />
<file md5sum="ec2dee8130d73fef8a733f0f1bd4320d" name="src/MongoDB/Session.h" role="src" />
- <file md5sum="475931fbf7607e9ce5a635264faf4db1" name="src/MongoDB/WriteConcern.c" role="src" />
- <file md5sum="eba2079a0693ac010b93d3562080f4e0" name="src/MongoDB/WriteConcernError.c" role="src" />
- <file md5sum="7c16763c43943b70b7206d9597a27526" name="src/MongoDB/WriteError.c" role="src" />
- <file md5sum="6c6baa1383b4ac8d0a35ba25d000068a" name="src/MongoDB/WriteResult.c" role="src" />
+ <file md5sum="83d9a5488e0e724d246fe62756ce9702" name="src/MongoDB/WriteConcern.c" role="src" />
+ <file md5sum="65adff1613ab09bc4c67a28846ef55cb" name="src/MongoDB/WriteConcernError.c" role="src" />
+ <file md5sum="a2085943f23578f209c235a6e3e01ae7" name="src/MongoDB/WriteError.c" role="src" />
+ <file md5sum="1c03f3c13712868a6bd114b2e68c5650" name="src/MongoDB/WriteResult.c" role="src" />
<file md5sum="7bf0e8df986b3ec841060f4a37b8dac0" name="src/contrib/php_array_api.h" role="src" />
<file md5sum="d36f9ceb3ac1fc1c5a9e5add685cf12a" name="src/libmongoc/src/common/common-b64-private.h" role="src" />
<file md5sum="66f9014b39f05a20a26d288d51ab5485" name="src/libmongoc/src/common/common-b64.c" role="src" />
<file md5sum="de3c3dfa7949127b9ca6bced2928b728" name="src/libmongoc/src/common/common-config.h" role="src" />
<file md5sum="15b3cf122cbd4a57f4477169f367fde9" name="src/libmongoc/src/common/common-md5-private.h" role="src" />
<file md5sum="50917245079095c514f4955c8ea62687" name="src/libmongoc/src/common/common-md5.c" role="src" />
<file md5sum="0918456265baeddaf1234efe7c8ad055" name="src/libmongoc/src/common/common-prelude.h" role="src" />
<file md5sum="638f8dc3b4994c78e2f9028f1bab8e62" name="src/libmongoc/src/common/common-thread-private.h" role="src" />
<file md5sum="0a9df59d1044784dff42c5aaa4901ba3" name="src/libmongoc/src/common/common-thread.c" role="src" />
<file md5sum="6afe2ac1833309ef5337e5a04945b4d3" name="src/libmongoc/src/kms-message/src/kms_message/kms_b64.h" role="src" />
<file md5sum="d4883934913f8b0693f90207b21bcc8b" name="src/libmongoc/src/kms-message/src/kms_message/kms_caller_identity_request.h" role="src" />
<file md5sum="3a4c30c28593474cb53c81bb30c0b656" name="src/libmongoc/src/kms-message/src/kms_message/kms_decrypt_request.h" role="src" />
<file md5sum="c6dc01b044efe5c7ba582bd36b3f18e0" name="src/libmongoc/src/kms-message/src/kms_message/kms_encrypt_request.h" role="src" />
<file md5sum="9463d1727695035852304d5947d2e86a" name="src/libmongoc/src/kms-message/src/kms_message/kms_message.h" role="src" />
<file md5sum="d00d408056f02b5ad2bd515e6dda4450" name="src/libmongoc/src/kms-message/src/kms_message/kms_message_defines.h" role="src" />
<file md5sum="a3bc2896fca774b80db0c60cdd1ecb60" name="src/libmongoc/src/kms-message/src/kms_message/kms_request.h" role="src" />
<file md5sum="771832eae920dc27ee493a736dcd0f07" name="src/libmongoc/src/kms-message/src/kms_message/kms_request_opt.h" role="src" />
<file md5sum="5341a53253bb71fdde40ef2733eed413" name="src/libmongoc/src/kms-message/src/kms_message/kms_response.h" role="src" />
<file md5sum="5d8416124f251cd69c9b6c37305aed1e" name="src/libmongoc/src/kms-message/src/kms_message/kms_response_parser.h" role="src" />
<file md5sum="001504937a1c62a19d6c1b56fe353eb1" name="src/libmongoc/src/kms-message/src/hexlify.c" role="src" />
<file md5sum="3ae9830c7804a56d602283845ed86651" name="src/libmongoc/src/kms-message/src/hexlify.h" role="src" />
<file md5sum="e8a52f0b2bc3e28f7c64f0a777ce3770" name="src/libmongoc/src/kms-message/src/kms_b64.c" role="src" />
<file md5sum="9cb501a5bfed23a74f5e38be89c1a6d5" name="src/libmongoc/src/kms-message/src/kms_caller_identity_request.c" role="src" />
<file md5sum="9c64a953bbdfa8ba90cbdc1a1d4519c9" name="src/libmongoc/src/kms-message/src/kms_crypto.h" role="src" />
<file md5sum="f4c1b39c72e5f25c7660bd86d87ca85e" name="src/libmongoc/src/kms-message/src/kms_crypto_apple.c" role="src" />
<file md5sum="32436c05f4a3e55cd176a882e21e13ad" name="src/libmongoc/src/kms-message/src/kms_crypto_libcrypto.c" role="src" />
<file md5sum="74b56cf66ea6e9cff053efb192a29add" name="src/libmongoc/src/kms-message/src/kms_crypto_none.c" role="src" />
<file md5sum="37f833a2d0dbb40323de0ddbacd461d6" name="src/libmongoc/src/kms-message/src/kms_crypto_windows.c" role="src" />
<file md5sum="9142dedbdc54951149219e8d7d733e36" name="src/libmongoc/src/kms-message/src/kms_decrypt_request.c" role="src" />
<file md5sum="69ec5d3da1ee1f8d3185854c883cd707" name="src/libmongoc/src/kms-message/src/kms_encrypt_request.c" role="src" />
<file md5sum="2a7f41d0b533d839384c449f05db13c5" name="src/libmongoc/src/kms-message/src/kms_kv_list.c" role="src" />
<file md5sum="69e374f65d9b21695d194e3495941f37" name="src/libmongoc/src/kms-message/src/kms_kv_list.h" role="src" />
<file md5sum="c2189649bce27380a9b07897662901e0" name="src/libmongoc/src/kms-message/src/kms_message.c" role="src" />
<file md5sum="47167d6a5e423a441d7df65d9feda9d7" name="src/libmongoc/src/kms-message/src/kms_message_private.h" role="src" />
<file md5sum="7b246b6b0a5c36862b79364d8e336b2a" name="src/libmongoc/src/kms-message/src/kms_port.c" role="src" />
<file md5sum="52247eca34cb25b7d80aad345e393e81" name="src/libmongoc/src/kms-message/src/kms_port.h" role="src" />
<file md5sum="f38035514480120b10b4bcb2c334e2a0" name="src/libmongoc/src/kms-message/src/kms_request.c" role="src" />
<file md5sum="0e650d43199b0e12ffb08b38f54c9b90" name="src/libmongoc/src/kms-message/src/kms_request_opt.c" role="src" />
<file md5sum="4c851b149d17a8d3818de213af8f2d06" name="src/libmongoc/src/kms-message/src/kms_request_opt_private.h" role="src" />
<file md5sum="888bf715d142e373232463eccf0dffcf" name="src/libmongoc/src/kms-message/src/kms_request_str.c" role="src" />
<file md5sum="7d8d321cf69c6316096ca2aab4c9728c" name="src/libmongoc/src/kms-message/src/kms_request_str.h" role="src" />
<file md5sum="ea5d236af2499b31ad2d6b8820376313" name="src/libmongoc/src/kms-message/src/kms_response.c" role="src" />
<file md5sum="2253d59b564ae589d7f0bc6c41626ec2" name="src/libmongoc/src/kms-message/src/kms_response_parser.c" role="src" />
<file md5sum="dff15b5018efb6269a2a0269c5ddb798" name="src/libmongoc/src/kms-message/src/sort.c" role="src" />
<file md5sum="18f9bd055f6a60e7702603b6b8bf07d5" name="src/libmongoc/src/kms-message/src/sort.h" role="src" />
<file md5sum="a3954d2b3ca305d1b4e370d9f73f209d" name="src/libmongoc/src/libbson/src/bson/bcon.c" role="src" />
<file md5sum="af5d3c6890b4fec8709a349289f8f9d3" name="src/libmongoc/src/libbson/src/bson/bcon.h" role="src" />
<file md5sum="e15fbacfd4a96fb4802466e6c79900d9" name="src/libmongoc/src/libbson/src/bson/bson-atomic.c" role="src" />
<file md5sum="1aa97c2fb1c212edc233f3e254071b9f" name="src/libmongoc/src/libbson/src/bson/bson-atomic.h" role="src" />
<file md5sum="ef3d475df2f82f4fdd78daaf6d754a35" name="src/libmongoc/src/libbson/src/bson/bson-clock.c" role="src" />
<file md5sum="941aa21f16b18e768fd8072a15a4da71" name="src/libmongoc/src/libbson/src/bson/bson-clock.h" role="src" />
<file md5sum="b3fc50563b55173ae5a4f7cf10bcf05b" name="src/libmongoc/src/libbson/src/bson/bson-compat.h" role="src" />
<file md5sum="df183a682a0b8d89176519af026b43d0" name="src/libmongoc/src/libbson/src/bson/bson-config.h" role="src" />
<file md5sum="bbc8d38a5e5985912bcd454e7ca3320b" name="src/libmongoc/src/libbson/src/bson/bson-config.h.in" role="src" />
<file md5sum="5b655a3af4caa6c8369dd000e482292a" name="src/libmongoc/src/libbson/src/bson/bson-context-private.h" role="src" />
<file md5sum="bf5fced31d69326007d9c623223bf707" name="src/libmongoc/src/libbson/src/bson/bson-context.c" role="src" />
<file md5sum="ac370a2562029eaed0f8b97b0d6fe90f" name="src/libmongoc/src/libbson/src/bson/bson-context.h" role="src" />
<file md5sum="c4b84f454a6cabaee587d151f2365858" name="src/libmongoc/src/libbson/src/bson/bson-decimal128.c" role="src" />
<file md5sum="6700198519a93ee85b8c95bcddfced30" name="src/libmongoc/src/libbson/src/bson/bson-decimal128.h" role="src" />
<file md5sum="8bbf15ea4a0155435036722b564ed558" name="src/libmongoc/src/libbson/src/bson/bson-endian.h" role="src" />
<file md5sum="4f643560fbb549b900ea02d2a7b34484" name="src/libmongoc/src/libbson/src/bson/bson-error.c" role="src" />
<file md5sum="5ee55f4f9a3401900b82a0381ab8f2a8" name="src/libmongoc/src/libbson/src/bson/bson-error.h" role="src" />
<file md5sum="6910b34f7cf6d0b522f548aa2599b490" name="src/libmongoc/src/libbson/src/bson/bson-iso8601-private.h" role="src" />
<file md5sum="4d80e24fadedcfce63799efad8333489" name="src/libmongoc/src/libbson/src/bson/bson-iso8601.c" role="src" />
<file md5sum="e726ae34c8b34e8ab7e414032791160b" name="src/libmongoc/src/libbson/src/bson/bson-iter.c" role="src" />
<file md5sum="1d7b25e4b7051c95da6dda05e8703894" name="src/libmongoc/src/libbson/src/bson/bson-iter.h" role="src" />
<file md5sum="6e4804003eac5361111e2a13d97d58f4" name="src/libmongoc/src/libbson/src/bson/bson-json.c" role="src" />
<file md5sum="02c790fc48ff27f4735e20434650827b" name="src/libmongoc/src/libbson/src/bson/bson-json.h" role="src" />
<file md5sum="5addb8761faac2e8d52f4ded8ecdc0c0" name="src/libmongoc/src/libbson/src/bson/bson-keys.c" role="src" />
<file md5sum="e1973fc044b52bfc2bb35b440350d228" name="src/libmongoc/src/libbson/src/bson/bson-keys.h" role="src" />
<file md5sum="70274d21db33bd61716e95d66978bf70" name="src/libmongoc/src/libbson/src/bson/bson-macros.h" role="src" />
<file md5sum="69c9a5bd0fcdeacffadb994c6d2e9e57" name="src/libmongoc/src/libbson/src/bson/bson-md5.c" role="src" />
<file md5sum="64bfaad7b9c371ac3cc5b19ae0d88fb5" name="src/libmongoc/src/libbson/src/bson/bson-md5.h" role="src" />
<file md5sum="902e9d1538121524c6f9944c1198f1d7" name="src/libmongoc/src/libbson/src/bson/bson-memory.c" role="src" />
<file md5sum="a50cea3f9a11bd1a11448b2b865b656e" name="src/libmongoc/src/libbson/src/bson/bson-memory.h" role="src" />
<file md5sum="1d11c5001d5975fbed63e11b96edbf49" name="src/libmongoc/src/libbson/src/bson/bson-oid.c" role="src" />
<file md5sum="1fc22f6fb12d962ff23ba7eebad1c18e" name="src/libmongoc/src/libbson/src/bson/bson-oid.h" role="src" />
<file md5sum="1cf75fbb62bcbe7bfed5906fce7bd0cd" name="src/libmongoc/src/libbson/src/bson/bson-prelude.h" role="src" />
<file md5sum="9173795c678991efc29bec5c95e402b4" name="src/libmongoc/src/libbson/src/bson/bson-private.h" role="src" />
<file md5sum="b351f160949566778783d1ba7a5b4d60" name="src/libmongoc/src/libbson/src/bson/bson-reader.c" role="src" />
<file md5sum="eda7ef0c3380276709b2f8e833867689" name="src/libmongoc/src/libbson/src/bson/bson-reader.h" role="src" />
<file md5sum="fc1eb647810867d1db76dccb3ea3b663" name="src/libmongoc/src/libbson/src/bson/bson-string.c" role="src" />
<file md5sum="84bb7fecb29271e3a8fdc145cb33a77b" name="src/libmongoc/src/libbson/src/bson/bson-string.h" role="src" />
<file md5sum="f80c7197ff122c24f1a2642b083fb523" name="src/libmongoc/src/libbson/src/bson/bson-timegm-private.h" role="src" />
<file md5sum="cf1148af5b260d787b5a8de5ba82de77" name="src/libmongoc/src/libbson/src/bson/bson-timegm.c" role="src" />
<file md5sum="e19adc54059d2b8c212380250da2c1d0" name="src/libmongoc/src/libbson/src/bson/bson-types.h" role="src" />
<file md5sum="1465f0c3c893f194091f6de94583e8de" name="src/libmongoc/src/libbson/src/bson/bson-utf8.c" role="src" />
<file md5sum="f23b07d93c8c65df5c0142f8ede21612" name="src/libmongoc/src/libbson/src/bson/bson-utf8.h" role="src" />
<file md5sum="5db2801d1c52e5027937dd5facab1b3d" name="src/libmongoc/src/libbson/src/bson/bson-value.c" role="src" />
<file md5sum="6d175e5373d24e3f403416b7871be3ca" name="src/libmongoc/src/libbson/src/bson/bson-value.h" role="src" />
<file md5sum="0bcfe98e683ae4fa5a6321fd6cafd9cd" name="src/libmongoc/src/libbson/src/bson/bson-version-functions.c" role="src" />
<file md5sum="0f7724eca64476682b9fd7f7a970cc04" name="src/libmongoc/src/libbson/src/bson/bson-version-functions.h" role="src" />
- <file md5sum="9b7bc17c9ce9cca781d875328b4dc52e" name="src/libmongoc/src/libbson/src/bson/bson-version.h" role="src" />
+ <file md5sum="184ea11c4015c8605d154bfe1d3ae2b4" name="src/libmongoc/src/libbson/src/bson/bson-version.h" role="src" />
<file md5sum="1f473fea4d18c65e7bb00be8bf2e841c" name="src/libmongoc/src/libbson/src/bson/bson-version.h.in" role="src" />
<file md5sum="61ba6f5aa4028b691ee22ea27eb3c3c5" name="src/libmongoc/src/libbson/src/bson/bson-writer.c" role="src" />
<file md5sum="05d85f6ccc42974bc14cf0eab289ebce" name="src/libmongoc/src/libbson/src/bson/bson-writer.h" role="src" />
<file md5sum="39d715edb1b7fe0b3ee35e36dfcf6339" name="src/libmongoc/src/libbson/src/bson/bson.c" role="src" />
<file md5sum="fb771cd46e69dd1eec58588d3df4b68e" name="src/libmongoc/src/libbson/src/bson/bson.h" role="src" />
<file md5sum="cc8e625953a6cdb6147172f86f8d0c20" name="src/libmongoc/src/libbson/src/jsonsl/jsonsl.c" role="src" />
<file md5sum="cc4d69576f4fe9b87cd116d399309454" name="src/libmongoc/src/libbson/src/jsonsl/jsonsl.h" role="src" />
<file md5sum="715a53b77739b4f6d87b7236792b3501" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-aggregate-private.h" role="src" />
<file md5sum="3176cbf8be4a4eb647bd521841e6edfd" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-aggregate.c" role="src" />
<file md5sum="36583ab212f82ed579a3e36e013666d1" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-apm-private.h" role="src" />
<file md5sum="ebc6ee30f5a93b158da55b521362262a" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-apm.c" role="src" />
<file md5sum="6d3c2e100526a1207839a6660fc594ca" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-apm.h" role="src" />
<file md5sum="02429f357ecd89327482930aec8bf34b" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-array-private.h" role="src" />
<file md5sum="475df6bf5cd4e55e0d4b26db29ea71fc" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-array.c" role="src" />
<file md5sum="766374d866c30f32a4e5a313494d7cce" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-async-cmd-private.h" role="src" />
<file md5sum="9275b99cc55f52273efabce4f7766ee6" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-async-cmd.c" role="src" />
<file md5sum="6117af585e6f280e22535fee10458148" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-async-private.h" role="src" />
<file md5sum="571e48bba13f93f7961ac831ab84675b" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-async.c" role="src" />
<file md5sum="5e7c0de09a22745fce5b273d8e9e964c" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-buffer-private.h" role="src" />
<file md5sum="f4b3b177551d2703d24cd5be1add89e6" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-buffer.c" role="src" />
<file md5sum="d099437d7ea96ce3115170be386adceb" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-bulk-operation-private.h" role="src" />
<file md5sum="190e9e9843d5449a86ff5a6a14cb8737" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-bulk-operation.c" role="src" />
<file md5sum="1f9cab77495164df9578f99d391ba3ef" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-bulk-operation.h" role="src" />
<file md5sum="178d695599ed8eb98de6672aff1ca0bc" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-change-stream-private.h" role="src" />
<file md5sum="8d64ecc779913fde01ad5330d1113c47" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-change-stream.c" role="src" />
<file md5sum="a28176a567c6cd9b3e06246256c7ac7d" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-change-stream.h" role="src" />
<file md5sum="dd048997f3230e0f019ad17ecfcf9dfd" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-client-pool-private.h" role="src" />
<file md5sum="2c53d366cb44a111e999bcf4f45fffe0" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-client-pool.c" role="src" />
<file md5sum="3ec1fea991dad8b41a2ecb7c6d6f86ae" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-client-pool.h" role="src" />
- <file md5sum="27f95c7472939d6a53c24b589e322846" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-client-private.h" role="src" />
+ <file md5sum="cab19b734cc461ba65ea99879782fc3b" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-client-private.h" role="src" />
<file md5sum="40119cebb0dc6fda04ef8b67240f886e" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-client-session-private.h" role="src" />
<file md5sum="f81ae8d5060879358979383eda105973" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-client-session.c" role="src" />
<file md5sum="64160152789649758ff880c261539338" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-client-session.h" role="src" />
<file md5sum="829e08021e4b012a3df657e9d3745aed" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-client-side-encryption-private.h" role="src" />
<file md5sum="720fbcac1b58d2eb50572fb7167dba69" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-client-side-encryption.c" role="src" />
<file md5sum="b1cfdbcfe8e5667db5081df44f9a4bb3" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-client-side-encryption.h" role="src" />
- <file md5sum="625c7d1eee9720f344996c5829a6f940" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-client.c" role="src" />
+ <file md5sum="f7b7cc2ad86bdd4fcc3ec3f62185b8c3" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-client.c" role="src" />
<file md5sum="9a3aea3ba403fa4101870e76dcf95936" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-client.h" role="src" />
<file md5sum="ea98e4e4ae56c176e8286f3373b93872" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-cluster-aws-private.h" role="src" />
<file md5sum="579f3db57ff1657abe5e06309bf18abb" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-cluster-aws.c" role="src" />
<file md5sum="abc87a40623b01a2848a13483f55c0eb" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-cluster-cyrus-private.h" role="src" />
<file md5sum="b478b60e0f7175075b1bc8b30f455b0a" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-cluster-cyrus.c" role="src" />
<file md5sum="c75473fdc24e8351c9eb9d86a93e48da" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-cluster-private.h" role="src" />
<file md5sum="7b7c909f1fa7029ea48d4d06e18c23a1" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-cluster-sasl-private.h" role="src" />
<file md5sum="9c05f27fa8164bfdb5b9d9d2afd7c8ec" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-cluster-sasl.c" role="src" />
<file md5sum="820290eb3904bfc15d4b8bd246407472" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-cluster-sspi-private.h" role="src" />
<file md5sum="70f75a2c105330d0d52bf5a2e5acc686" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-cluster-sspi.c" role="src" />
<file md5sum="c4b437871980ffed7d8c25c7f4a26acc" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-cluster.c" role="src" />
<file md5sum="3c57358e51734daaa86c6b957a2009eb" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-cmd-private.h" role="src" />
<file md5sum="0fcc24a9452be8f69fb01f045724388c" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-cmd.c" role="src" />
<file md5sum="7be3fb1fffde65a0a4f9864cc666585f" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-collection-private.h" role="src" />
<file md5sum="228685e3395787418118a50b99b8aeef" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-collection.c" role="src" />
<file md5sum="631261c2b09625226e24063bffba8e25" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-collection.h" role="src" />
<file md5sum="51a5f2b055faf65386ed28d537af94e2" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-compression-private.h" role="src" />
<file md5sum="c8efb75e7a6278b654502ad1f16b5e50" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-compression.c" role="src" />
- <file md5sum="5abd61e60996869b2b6e3ea602b6ce50" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-config.h" role="src" />
+ <file md5sum="03c6460d755154fded122df4b1828810" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-config.h" role="src" />
<file md5sum="fb670b99174d436ab00fa4976585e9d1" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-config.h.in" role="src" />
<file md5sum="8a2612d3379fb68365a00c9e3f55ab17" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-counters-private.h" role="src" />
<file md5sum="c4aec9c96c3b5cc4bfcf610084b8c15d" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-counters.c" role="src" />
<file md5sum="04d57743da7337aaec4dfe958a5742b7" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-counters.defs" role="src" />
<file md5sum="b95275ee917d03dc554d0066309cfe32" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-crypt-private.h" role="src" />
<file md5sum="f7bb72504f490c9f3ff6a3a51250e64d" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-crypt.c" role="src" />
<file md5sum="92fd26e85664f6c9d2d369c0fadc025b" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-crypto-cng-private.h" role="src" />
<file md5sum="4962154517e614c682f72ec91a2dfb21" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-crypto-cng.c" role="src" />
<file md5sum="b3e1538050bff40cd2232ccc57978580" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-crypto-common-crypto-private.h" role="src" />
<file md5sum="05bc88780422e1fecf959938dba4f37c" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-crypto-common-crypto.c" role="src" />
<file md5sum="b8182112c242fe00bfb665e7b7af8d09" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-crypto-openssl-private.h" role="src" />
<file md5sum="0b30ddc797dd00fdcaf2a7d947d97c85" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-crypto-openssl.c" role="src" />
<file md5sum="d917683855b94173416b062df755d960" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-crypto-private.h" role="src" />
<file md5sum="2dc0df9846f851aead72d9fd4d734760" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-crypto.c" role="src" />
<file md5sum="f1f255dcc6c9c9abc06423b00553a660" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-cursor-array.c" role="src" />
<file md5sum="f39ea72235be77d77a30ad06c15be5b4" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-cursor-change-stream.c" role="src" />
<file md5sum="13772036c14fa28597bae438270f5494" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-cursor-cmd-deprecated.c" role="src" />
<file md5sum="f68c43de1d7d090b6d9dc0d8f73911f5" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-cursor-cmd.c" role="src" />
<file md5sum="436a0c9fea83bc37dfde5b82044db2de" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-cursor-find-cmd.c" role="src" />
<file md5sum="d4664b89578808b1581a6a971e47f49e" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-cursor-find-opquery.c" role="src" />
<file md5sum="d2e19c9e8b69b30b2cf19639975cd51b" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-cursor-find.c" role="src" />
<file md5sum="30a6da3936834f4bebc281896d8a8ba7" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-cursor-legacy.c" role="src" />
<file md5sum="6e20628e397d4ae87d1fce85a5d59308" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-cursor-private.h" role="src" />
<file md5sum="6d4724c59fda1ddbd8afc3d1b7ef8747" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-cursor.c" role="src" />
<file md5sum="ab02e4cb247e4dedbf49e30b4b02e193" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-cursor.h" role="src" />
<file md5sum="cf20c0277c2b973281325739721d635b" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-cyrus-private.h" role="src" />
<file md5sum="5c67ae23fe25b60c480c4955af75dfe2" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-cyrus.c" role="src" />
<file md5sum="31a9b3420812c03b4446dd9ab13f222d" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-database-private.h" role="src" />
<file md5sum="46104d074e3c88a22e968d7148d6f22a" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-database.c" role="src" />
<file md5sum="ce96a3034434133359550a3703170282" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-database.h" role="src" />
<file md5sum="28d90894b4e7c78bef2b1ca1834d0fcb" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-errno-private.h" role="src" />
<file md5sum="3380d631de0134a6991833edb118e45b" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-error-private.h" role="src" />
<file md5sum="7cdb9d484ed7ebf4e2fbcafabce069d6" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-error.c" role="src" />
<file md5sum="f9633431ef574b83b0bd17783fdc0992" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-error.h" role="src" />
<file md5sum="1ba39aca81a5d25857b77542e307b97b" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-find-and-modify-private.h" role="src" />
<file md5sum="d0253ef5feb5587064d86eeb19577a1c" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-find-and-modify.c" role="src" />
<file md5sum="1e2f790b08f8ddffc4d8b8f4c8d3971e" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-find-and-modify.h" role="src" />
<file md5sum="75af2dc3e1069036fb8d78c1a94ca3c8" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-flags-private.h" role="src" />
<file md5sum="8c187d85170153d453a851b3fa95a810" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-flags.h" role="src" />
<file md5sum="61a20bbf13213628a988af242bec479b" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-gridfs-bucket-file-private.h" role="src" />
<file md5sum="6a70f9e8dee7bae038fe63740011ed1b" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-gridfs-bucket-file.c" role="src" />
<file md5sum="58fcf3011bfd394f310f3daa9594855b" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-gridfs-bucket-private.h" role="src" />
<file md5sum="f889dd5343e0942b3b135a134eb30c1d" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-gridfs-bucket.c" role="src" />
<file md5sum="99c2dcfa8367a0d1e7cb894ddfd0abff" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-gridfs-bucket.h" role="src" />
<file md5sum="952b93d5ee76b7402ea500906809161b" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-gridfs-file-list-private.h" role="src" />
<file md5sum="8597d29f134e6d78cb6a34ea74423bab" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-gridfs-file-list.c" role="src" />
<file md5sum="6b303d070982631492f516b628d5198d" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-gridfs-file-list.h" role="src" />
<file md5sum="282f5e691bb325deb6b8891eb13149f2" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-gridfs-file-page-private.h" role="src" />
<file md5sum="6f0ed4d860816a02bfd98c9b50340227" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-gridfs-file-page.c" role="src" />
<file md5sum="3b932d73546d72dae9fcb918c41de57d" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-gridfs-file-page.h" role="src" />
<file md5sum="c03dd7e85d3095caf235744ebb562a0e" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-gridfs-file-private.h" role="src" />
<file md5sum="0a708de6ac97b858d9bf52cae92a660c" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-gridfs-file.c" role="src" />
<file md5sum="4391ad3ca3396e9fc9b4c0c4e5772bfb" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-gridfs-file.h" role="src" />
<file md5sum="ef7007f002b46c8354fee538e885de40" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-gridfs-private.h" role="src" />
<file md5sum="8a825992520617af35e9bddb0aabe9c6" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-gridfs.c" role="src" />
<file md5sum="c771faf5c6235f50c357861a4c8516d3" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-gridfs.h" role="src" />
<file md5sum="bbc260b536678d5331744aee0c186256" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-handshake-compiler-private.h" role="src" />
<file md5sum="67039f2c6bc58df9e35fcb0cab2c2dbc" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-handshake-os-private.h" role="src" />
<file md5sum="f1cb056de4ee6d23bea3b02a31597667" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-handshake-private.h" role="src" />
<file md5sum="3e3e2a2a5255d6f4099eebcc42958e2a" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-handshake.c" role="src" />
<file md5sum="68c985844829b5ff03f56f8eaeb9dd49" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-handshake.h" role="src" />
<file md5sum="4fb133fd139b69892eea86eec693fac2" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-host-list-private.h" role="src" />
<file md5sum="08a38ce358289afe1d3946fd121d2fa9" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-host-list.c" role="src" />
<file md5sum="5e2da30e912e909ed594a59683833f7d" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-host-list.h" role="src" />
<file md5sum="c1934ce90e02b46a05a9a4751dbc0262" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-http-private.h" role="src" />
<file md5sum="552f945bb02a4c698a66608dd30f1fe1" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-http.c" role="src" />
<file md5sum="5ac6b6febc5f47878215fbc74bd44de7" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-index.c" role="src" />
<file md5sum="dad1a4af8adf72a13809fd6c1c10afee" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-index.h" role="src" />
<file md5sum="9a065aa2944698f9d0f64496cd59c8bd" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-init.c" role="src" />
<file md5sum="747ea7ab1744daf2a7e42508780575b1" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-init.h" role="src" />
<file md5sum="b9ea61d69501bc6e3b602117298aefb6" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-interrupt-private.h" role="src" />
<file md5sum="3177cbfad1c5079952840fbb4c4dfbe4" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-interrupt.c" role="src" />
<file md5sum="c3d4de8405f528f15caf2ab7f847ca12" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-iovec.h" role="src" />
<file md5sum="c06c20bc7e775d6d8bced165cd04f8ee" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-libressl-private.h" role="src" />
<file md5sum="0c90387fd3fe9289c20cf4354d6bd87e" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-libressl.c" role="src" />
<file md5sum="8c0701b9c767f009ba52d7231059d12b" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-linux-distro-scanner-private.h" role="src" />
<file md5sum="54d78d18718c9b8705de0862b931f476" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-linux-distro-scanner.c" role="src" />
<file md5sum="88813fcf803fccf84966f26431b3b71a" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-list-private.h" role="src" />
<file md5sum="ab4d31b167f229b490faf5b71a714339" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-list.c" role="src" />
<file md5sum="be914702b66b1e1b8582cb9277239001" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-log-private.h" role="src" />
<file md5sum="561c4ab0461c102a43cd877014707da8" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-log.c" role="src" />
<file md5sum="1c741c1aed2b563cacb6bced8e97d0b0" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-log.h" role="src" />
<file md5sum="439f25680fbc4c8a7542502287e3675e" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-macros.h" role="src" />
<file md5sum="5a3506bda8c1638be4b76999c3c50f12" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-matcher-op-private.h" role="src" />
<file md5sum="e3555fc6a1007c07d55f4f210097d689" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-matcher-op.c" role="src" />
<file md5sum="dd1d23edde3907521792649267b48bc3" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-matcher-private.h" role="src" />
<file md5sum="cf91b7fcfb80ccaa33329d6bf14f8fbc" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-matcher.c" role="src" />
<file md5sum="05022e8ad5ea6da7158a0ce85c5f4762" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-matcher.h" role="src" />
<file md5sum="86736045e6dcc91d8c525c87720b2911" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-memcmp-private.h" role="src" />
<file md5sum="cc510669bc8cdbfab031f54e143085e2" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-memcmp.c" role="src" />
<file md5sum="a5d748bdf1c4b5cb845c6a81370d7961" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-ocsp-cache-private.h" role="src" />
<file md5sum="f2c3545733f228d2457f64373ee5831b" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-ocsp-cache.c" role="src" />
<file md5sum="14f209fb86ed514cdde4b187d35ac83b" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-opcode.h" role="src" />
<file md5sum="810df1337011be8f15d0719f1e03d798" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-openssl-private.h" role="src" />
<file md5sum="e429f31c6f1d66a0ac819f2a27adee72" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-openssl.c" role="src" />
<file md5sum="eb48d60cbcae6ce34b3b1b3edc3b9e73" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-opts-helpers-private.h" role="src" />
<file md5sum="abae85a1d96099484ea092abd7459a6a" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-opts-helpers.c" role="src" />
<file md5sum="385a9b6a01db91a6c61f545f7593a9f1" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-opts-private.h" role="src" />
<file md5sum="65409b32c9a9a497287e896586253873" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-opts.c" role="src" />
<file md5sum="a5a16bf330ec389692145c0a0f796d40" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-prelude.h" role="src" />
<file md5sum="9d479bd2f13f239d558616322f8b4fb6" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-queue-private.h" role="src" />
<file md5sum="7da2ed3fabbeee9a88c7ddeab9f11a20" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-queue.c" role="src" />
<file md5sum="fa9297dcbff7191c36b6fb2b2a5a9c91" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-rand-cng.c" role="src" />
<file md5sum="b8818c8c7c155272ab33a04dfb0c464c" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-rand-common-crypto.c" role="src" />
<file md5sum="9335fc967215cfdee64e6f884bccf4ac" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-rand-openssl.c" role="src" />
<file md5sum="d665e822fefc6c01c4dd9ee4d1a02f2b" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-rand-private.h" role="src" />
<file md5sum="41c7cd3177c60893f4eec6b144ceedc9" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-rand.h" role="src" />
<file md5sum="a9abe88c57feeade91e4617b1582ea84" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-read-concern-private.h" role="src" />
<file md5sum="f877494d6f2aacb31a7aab8f2e46c911" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-read-concern.c" role="src" />
<file md5sum="f64bc23a48898ac8785963d3b3487500" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-read-concern.h" role="src" />
<file md5sum="a200756c4228fc0675ab5e7057546068" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-read-prefs-private.h" role="src" />
<file md5sum="c1a6c7d063f92ab81983a728c97ff981" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-read-prefs.c" role="src" />
<file md5sum="be0fe246aac385340fd1ba746457d14e" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-read-prefs.h" role="src" />
<file md5sum="14d70d8935bf21f4c3239e45d86f4e6e" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-rpc-private.h" role="src" />
<file md5sum="7e6933c24f56c8d256f97f53bd443099" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-rpc.c" role="src" />
<file md5sum="02680a898c086020b12d6efdcefaef1b" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-sasl-private.h" role="src" />
<file md5sum="f12439745ff93ee7d533b34cdfd76fdf" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-sasl.c" role="src" />
<file md5sum="fb161be2bdaf05d53d5e8e4bb4760b0a" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-scram-private.h" role="src" />
<file md5sum="0dd217d6feb694507b2c572b4f2e0762" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-scram.c" role="src" />
<file md5sum="403a7ed029b8d805676c762b0943987b" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-secure-channel-private.h" role="src" />
<file md5sum="492c536792727c38324e34c104ba06d8" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-secure-channel.c" role="src" />
<file md5sum="a6abefa0bc83ec37be8176b2df7de977" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-secure-transport-private.h" role="src" />
<file md5sum="791823b6db4e4901f985450b553a65ca" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-secure-transport.c" role="src" />
<file md5sum="7cba69880edc0bdd8c7d5d97226c2c08" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-server-description-private.h" role="src" />
<file md5sum="78226ff7d018d717634ff56375f8873f" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-server-description.c" role="src" />
<file md5sum="c6ad195bdac20bc2d4e2ab55d940d6ba" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-server-description.h" role="src" />
<file md5sum="727708f6492f8876f9c4ce50e755c0cd" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-server-monitor-private.h" role="src" />
<file md5sum="7c4188b2631864a2a0431eec130c73f0" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-server-monitor.c" role="src" />
<file md5sum="03bd5c9d7835ffba2717baf8e565c98b" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-server-stream-private.h" role="src" />
<file md5sum="ffc10eef8451934a6ff8169a86b6bfa7" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-server-stream.c" role="src" />
<file md5sum="834b9ec65671da3137ec37da39624e06" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-set-private.h" role="src" />
<file md5sum="5c3f227bcc86c7209c4dd92591d3feaf" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-set.c" role="src" />
<file md5sum="37376243128180b5b0d7eacef659f3d6" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-socket-private.h" role="src" />
<file md5sum="98291bc054e2f0393dcbc5e61d4b226c" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-socket.c" role="src" />
<file md5sum="4d6b7ea27bd6cb3e617c7d91b598acd0" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-socket.h" role="src" />
<file md5sum="733fcb7eaca160fa809a7f7af70d6d15" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-ssl-private.h" role="src" />
<file md5sum="4d7d67e4da4e442e925ee3c8bfde4486" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-ssl.c" role="src" />
<file md5sum="42c133e3ad18a70058177091190401fd" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-ssl.h" role="src" />
<file md5sum="cc755861d5be912193591ad063bcad48" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-sspi-private.h" role="src" />
<file md5sum="11a45877cdfc2df905aa0d162bb493b7" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-sspi.c" role="src" />
<file md5sum="cc3fc77850ae4bea293bd74b4cf60a04" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-stream-buffered.c" role="src" />
<file md5sum="b44455c950215262d30cbda9dd67aafe" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-stream-buffered.h" role="src" />
<file md5sum="f25a6cc9eeb840f34847f81cc2f36b60" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-stream-file.c" role="src" />
<file md5sum="6bfdb2875153e01323b8853ce27748fe" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-stream-file.h" role="src" />
<file md5sum="dc85d644079ad2e79d9d9dbe49facf10" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-stream-gridfs-download-private.h" role="src" />
<file md5sum="131246e2d632381ce14d72fdbb1b3f21" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-stream-gridfs-download.c" role="src" />
<file md5sum="7c0cce0559efc51ffe81a5465aa41484" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-stream-gridfs-upload-private.h" role="src" />
<file md5sum="b2eb639aae1caed00f7032b27e73cfbd" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-stream-gridfs-upload.c" role="src" />
<file md5sum="d247dac07fdfffa79422f0682f546a77" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-stream-gridfs.c" role="src" />
<file md5sum="0f90b785538b99de38421f87da0f6ede" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-stream-gridfs.h" role="src" />
<file md5sum="fa30b8c754b1523186b0c0c19bf017dc" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-stream-private.h" role="src" />
<file md5sum="3dbc0c52c735d318b3efbedb25a6005e" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-stream-socket.c" role="src" />
<file md5sum="f97854cb90d4a5fc797e7282675db01f" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-stream-socket.h" role="src" />
<file md5sum="90ec84cb182c98c7fc8fa8af0e85bdf0" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-stream-tls-libressl-private.h" role="src" />
<file md5sum="116918bf8bb96c6f9165c13a4c1096a7" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-stream-tls-libressl.c" role="src" />
<file md5sum="4a2d1c22cf1e953cd86083246b0658bd" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-stream-tls-libressl.h" role="src" />
<file md5sum="3fd16580fa667309339b94b19a396b9e" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-stream-tls-openssl-bio-private.h" role="src" />
<file md5sum="f72dd2878dcd9333a138e6c62adcd971" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-stream-tls-openssl-bio.c" role="src" />
<file md5sum="377279ab2c57036be34ac0b8684d74c8" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-stream-tls-openssl-private.h" role="src" />
<file md5sum="5ebb1ca3d8f462fe51bc1b90e491fa60" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-stream-tls-openssl.c" role="src" />
<file md5sum="026fab63add25604f7f3361274d4f9b0" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-stream-tls-openssl.h" role="src" />
<file md5sum="cfdd7f4e9b7619ec17a2af509ca99714" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-stream-tls-private.h" role="src" />
<file md5sum="8df0fd4f5dc00181e9ebbe3eef3f321e" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-stream-tls-secure-channel-private.h" role="src" />
<file md5sum="bed127055504f1baf8036a3504560fa7" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-stream-tls-secure-channel.c" role="src" />
<file md5sum="21696a6ec3026b2dac7204bb5c162209" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-stream-tls-secure-channel.h" role="src" />
<file md5sum="0d18b0e579e693ff1e484632a7ffbe3c" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-stream-tls-secure-transport-private.h" role="src" />
<file md5sum="6c7f4e134ef9fbe5ece63ede7b34e618" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-stream-tls-secure-transport.c" role="src" />
<file md5sum="734df66c11a01ca83446d1d8b2b7edd0" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-stream-tls-secure-transport.h" role="src" />
<file md5sum="b4c2290ab76580b8428b18ada4760f53" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-stream-tls.c" role="src" />
<file md5sum="b78a04064f599351509bf2f136174abb" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-stream-tls.h" role="src" />
<file md5sum="77d9779c925cbdcc010c708ceff13495" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-stream.c" role="src" />
<file md5sum="e8a3b99226da0b724dd3e01f845f3207" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-stream.h" role="src" />
<file md5sum="33b2ffa7532ffe6b4437bc5968d887c4" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-thread-private.h" role="src" />
<file md5sum="22bc0560741c8e37666f3a941caa6358" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-topology-background-monitoring-private.h" role="src" />
- <file md5sum="c8fc6828f9bfd123af78b078da58c2ad" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-topology-background-monitoring.c" role="src" />
+ <file md5sum="c0017d12f4dc52701af1c6385f797df4" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-topology-background-monitoring.c" role="src" />
<file md5sum="395d5e3342ba5a943413926f65ccc9a1" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-topology-description-apm-private.h" role="src" />
<file md5sum="8f93b1626480c7c10b077d772ab35314" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-topology-description-apm.c" role="src" />
<file md5sum="d9fa72e278645b1cccae74412f132c66" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-topology-description-private.h" role="src" />
<file md5sum="c271c338c60b50ca78e663a5bef27cb6" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-topology-description.c" role="src" />
<file md5sum="f804c571d6036f2f7a67eb0ac0649c0b" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-topology-description.h" role="src" />
- <file md5sum="4043c4ee7b0eef35cd6cf68db2c53e96" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-topology-private.h" role="src" />
+ <file md5sum="6ae37d4a152c7600688ae3c36bb58be8" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-topology-private.h" role="src" />
<file md5sum="0bf98835a50b55c797366d798295fa8e" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-topology-scanner-private.h" role="src" />
<file md5sum="7ae3013d96f56128d06fb0a3bd6ed621" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-topology-scanner.c" role="src" />
- <file md5sum="5ec644145ce339e13e12d0820a47e4cd" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-topology.c" role="src" />
+ <file md5sum="e9bdffc006e24b6d9d97a49bae5c45fe" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-topology.c" role="src" />
<file md5sum="fa4f353bf23ccae90497d2ef82b8b35f" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-trace-private.h" role="src" />
<file md5sum="a8f81668d44a882a8032a8d85f869fd0" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-uri-private.h" role="src" />
<file md5sum="531001a289a41eab1645c67f5716f853" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-uri.c" role="src" />
<file md5sum="27e908418c27335ff155b8d04c335a62" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-uri.h" role="src" />
<file md5sum="b88d7fc07934f173ff6e8c1d57533803" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-util-private.h" role="src" />
<file md5sum="accae9f4575ca29d2d051da0d8efa0d9" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-util.c" role="src" />
<file md5sum="5c7c2a82e500e9a518fa596ff9c44021" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-version-functions.c" role="src" />
<file md5sum="c7cfe57411c17d6d3028ee180f1772e9" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-version-functions.h" role="src" />
- <file md5sum="a9ab2f20910eb06a7e1341cfc2535b78" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-version.h" role="src" />
+ <file md5sum="8c7a86fb73de515b4b41bb548cfa1e1f" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-version.h" role="src" />
<file md5sum="ff10fb268641d60f7b14f911208fb2b1" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-version.h.in" role="src" />
<file md5sum="0808798e16ae4d6d7d8d01df40a54052" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-write-command-legacy-private.h" role="src" />
<file md5sum="88645a2deae1b19c4de2d089e008407c" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-write-command-legacy.c" role="src" />
<file md5sum="ee107bf849dd6644a6453a395651c2d0" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-write-command-private.h" role="src" />
<file md5sum="c526d42415961800fb727d241b4863ea" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-write-command.c" role="src" />
<file md5sum="e5bce2b46dbf04b76fe5485db9de7e4e" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-write-concern-private.h" role="src" />
<file md5sum="2b01095b4919618f6d33b2c418c29455" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-write-concern.c" role="src" />
<file md5sum="6b44b7d7c834cd5ccbda4059d0a1fb1d" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc-write-concern.h" role="src" />
<file md5sum="22b9dfd9aacdbca888e8fb7a71dfe4f7" name="src/libmongoc/src/libmongoc/src/mongoc/mongoc.h" role="src" />
<file md5sum="f3e25b8f4865b4ff5ce5830870d8cec5" name="src/libmongoc/src/libmongoc/src/mongoc/op-compressed.def" role="src" />
<file md5sum="ed1890accd7d9a1426fdac121ed42ad4" name="src/libmongoc/src/libmongoc/src/mongoc/op-delete.def" role="src" />
<file md5sum="9af88adf2ef432761bbe81db2f9bdce7" name="src/libmongoc/src/libmongoc/src/mongoc/op-get-more.def" role="src" />
<file md5sum="242fff22640f143ae262e363e8552a7e" name="src/libmongoc/src/libmongoc/src/mongoc/op-header.def" role="src" />
<file md5sum="2efe34631dd0d540d0f1d2fdb2d57813" name="src/libmongoc/src/libmongoc/src/mongoc/op-insert.def" role="src" />
<file md5sum="79ab986cb49a47e7c9bccdc4005a9697" name="src/libmongoc/src/libmongoc/src/mongoc/op-kill-cursors.def" role="src" />
<file md5sum="7e1f1d29f10ca2b86aed48b4071b9800" name="src/libmongoc/src/libmongoc/src/mongoc/op-msg.def" role="src" />
<file md5sum="a986d22cb495d652dc6059d722bb3266" name="src/libmongoc/src/libmongoc/src/mongoc/op-query.def" role="src" />
<file md5sum="f82bc931404ce00b318675126572d667" name="src/libmongoc/src/libmongoc/src/mongoc/op-reply-header.def" role="src" />
<file md5sum="dd22bb15cb70d35fe25192f0f304871b" name="src/libmongoc/src/libmongoc/src/mongoc/op-reply.def" role="src" />
<file md5sum="03c6179a4fe8b51c606b03a763529d55" name="src/libmongoc/src/libmongoc/src/mongoc/op-update.def" role="src" />
<file md5sum="28e467e1c2bfe811edfcfc86662f3987" name="src/libmongoc/src/libmongoc/src/mongoc/utlist.h" role="src" />
<file md5sum="4dc406b7d1b6e49c22eee2e01177c195" name="src/libmongoc/src/zlib-1.2.11/adler32.c" role="src" />
<file md5sum="bca8dc2f982dfce8944aec9f4a83626c" name="src/libmongoc/src/zlib-1.2.11/compress.c" role="src" />
<file md5sum="f9a17af8e4efe8019fca94827ea1c0db" name="src/libmongoc/src/zlib-1.2.11/crc32.c" role="src" />
<file md5sum="f28d16b67efecdfafa0d816a7d982124" name="src/libmongoc/src/zlib-1.2.11/crc32.h" role="src" />
<file md5sum="9e645d2cc17f3e324028b90d25edc969" name="src/libmongoc/src/zlib-1.2.11/deflate.c" role="src" />
<file md5sum="c5839b3f66d79c5aa0daa5062de59bd5" name="src/libmongoc/src/zlib-1.2.11/deflate.h" role="src" />
<file md5sum="29d02cff161bde3e4e717b25a2ab7050" name="src/libmongoc/src/zlib-1.2.11/gzclose.c" role="src" />
<file md5sum="de472a3069a84c6e6b1eb083c3f91b53" name="src/libmongoc/src/zlib-1.2.11/gzguts.h" role="src" />
<file md5sum="2c08acd5014596272031fdd1a36d0f1c" name="src/libmongoc/src/zlib-1.2.11/gzlib.c" role="src" />
<file md5sum="a2a2f3a65c2891b1a8cf98be9b499e96" name="src/libmongoc/src/zlib-1.2.11/gzread.c" role="src" />
<file md5sum="92c3520553ac47aaa67f36ac9a571761" name="src/libmongoc/src/zlib-1.2.11/gzwrite.c" role="src" />
<file md5sum="f2adcadab3504b146be9c4928821f233" name="src/libmongoc/src/zlib-1.2.11/infback.c" role="src" />
<file md5sum="20d7b26f5ae64f4e8501f846beab550c" name="src/libmongoc/src/zlib-1.2.11/inffast.c" role="src" />
<file md5sum="f3669099d3f571dbc0426401ed5f50e3" name="src/libmongoc/src/zlib-1.2.11/inffast.h" role="src" />
<file md5sum="7fa3e91804601b6618c915b76a8dc332" name="src/libmongoc/src/zlib-1.2.11/inffixed.h" role="src" />
<file md5sum="c892c303a1be104ed0efb628e18ed85a" name="src/libmongoc/src/zlib-1.2.11/inflate.c" role="src" />
<file md5sum="12c1f3adaf005c8a4cfb629f2e266d30" name="src/libmongoc/src/zlib-1.2.11/inflate.h" role="src" />
<file md5sum="34a634c4c6e1de2e357f18c170e6b96c" name="src/libmongoc/src/zlib-1.2.11/inftrees.c" role="src" />
<file md5sum="ec87be89b9bcca8ced80a70f857e823b" name="src/libmongoc/src/zlib-1.2.11/inftrees.h" role="src" />
<file md5sum="fddcbf441ed0140dec23927ee34de9a7" name="src/libmongoc/src/zlib-1.2.11/trees.c" role="src" />
<file md5sum="51fdcb3e2ccf60ca13c06920c89296a3" name="src/libmongoc/src/zlib-1.2.11/trees.h" role="src" />
<file md5sum="dc210f08738914519d15edf1bb6e5141" name="src/libmongoc/src/zlib-1.2.11/uncompr.c" role="src" />
<file md5sum="66c6b3953f574eca8b709dd5f6865745" name="src/libmongoc/src/zlib-1.2.11/zconf.h" role="src" />
<file md5sum="66c6b3953f574eca8b709dd5f6865745" name="src/libmongoc/src/zlib-1.2.11/zconf.h.in" role="src" />
<file md5sum="0338828e9d00c94645648b1517108324" name="src/libmongoc/src/zlib-1.2.11/zlib.h" role="src" />
<file md5sum="69d0e0950d3ab5c1938d8566257c33a3" name="src/libmongoc/src/zlib-1.2.11/zutil.c" role="src" />
<file md5sum="b8a47cd8873cbfa8daf689f88dd62f75" name="src/libmongoc/src/zlib-1.2.11/zutil.h" role="src" />
<file md5sum="801dd41ee3301f2e0385658e8d409cb0" name="src/libmongocrypt-compat/mongocrypt/mongocrypt.h" role="src" />
<file md5sum="94b739a5ca4735c9efbef6c7c29c8e60" name="src/libmongocrypt-compat/mongocrypt-export.h" role="src" />
<file md5sum="6afe2ac1833309ef5337e5a04945b4d3" name="src/libmongocrypt/kms-message/src/kms_message/kms_b64.h" role="src" />
<file md5sum="d4883934913f8b0693f90207b21bcc8b" name="src/libmongocrypt/kms-message/src/kms_message/kms_caller_identity_request.h" role="src" />
<file md5sum="3a4c30c28593474cb53c81bb30c0b656" name="src/libmongocrypt/kms-message/src/kms_message/kms_decrypt_request.h" role="src" />
<file md5sum="c6dc01b044efe5c7ba582bd36b3f18e0" name="src/libmongocrypt/kms-message/src/kms_message/kms_encrypt_request.h" role="src" />
<file md5sum="9463d1727695035852304d5947d2e86a" name="src/libmongocrypt/kms-message/src/kms_message/kms_message.h" role="src" />
<file md5sum="d00d408056f02b5ad2bd515e6dda4450" name="src/libmongocrypt/kms-message/src/kms_message/kms_message_defines.h" role="src" />
<file md5sum="a3bc2896fca774b80db0c60cdd1ecb60" name="src/libmongocrypt/kms-message/src/kms_message/kms_request.h" role="src" />
<file md5sum="771832eae920dc27ee493a736dcd0f07" name="src/libmongocrypt/kms-message/src/kms_message/kms_request_opt.h" role="src" />
<file md5sum="5341a53253bb71fdde40ef2733eed413" name="src/libmongocrypt/kms-message/src/kms_message/kms_response.h" role="src" />
<file md5sum="5d8416124f251cd69c9b6c37305aed1e" name="src/libmongocrypt/kms-message/src/kms_message/kms_response_parser.h" role="src" />
<file md5sum="001504937a1c62a19d6c1b56fe353eb1" name="src/libmongocrypt/kms-message/src/hexlify.c" role="src" />
<file md5sum="3ae9830c7804a56d602283845ed86651" name="src/libmongocrypt/kms-message/src/hexlify.h" role="src" />
<file md5sum="e8a52f0b2bc3e28f7c64f0a777ce3770" name="src/libmongocrypt/kms-message/src/kms_b64.c" role="src" />
<file md5sum="9cb501a5bfed23a74f5e38be89c1a6d5" name="src/libmongocrypt/kms-message/src/kms_caller_identity_request.c" role="src" />
<file md5sum="9c64a953bbdfa8ba90cbdc1a1d4519c9" name="src/libmongocrypt/kms-message/src/kms_crypto.h" role="src" />
<file md5sum="f4c1b39c72e5f25c7660bd86d87ca85e" name="src/libmongocrypt/kms-message/src/kms_crypto_apple.c" role="src" />
<file md5sum="32436c05f4a3e55cd176a882e21e13ad" name="src/libmongocrypt/kms-message/src/kms_crypto_libcrypto.c" role="src" />
<file md5sum="74b56cf66ea6e9cff053efb192a29add" name="src/libmongocrypt/kms-message/src/kms_crypto_none.c" role="src" />
<file md5sum="37f833a2d0dbb40323de0ddbacd461d6" name="src/libmongocrypt/kms-message/src/kms_crypto_windows.c" role="src" />
<file md5sum="9142dedbdc54951149219e8d7d733e36" name="src/libmongocrypt/kms-message/src/kms_decrypt_request.c" role="src" />
<file md5sum="69ec5d3da1ee1f8d3185854c883cd707" name="src/libmongocrypt/kms-message/src/kms_encrypt_request.c" role="src" />
<file md5sum="2a7f41d0b533d839384c449f05db13c5" name="src/libmongocrypt/kms-message/src/kms_kv_list.c" role="src" />
<file md5sum="69e374f65d9b21695d194e3495941f37" name="src/libmongocrypt/kms-message/src/kms_kv_list.h" role="src" />
<file md5sum="c2189649bce27380a9b07897662901e0" name="src/libmongocrypt/kms-message/src/kms_message.c" role="src" />
<file md5sum="47167d6a5e423a441d7df65d9feda9d7" name="src/libmongocrypt/kms-message/src/kms_message_private.h" role="src" />
<file md5sum="f27094bd3cd0c6174a279875623af84e" name="src/libmongocrypt/kms-message/src/kms_port.c" role="src" />
<file md5sum="52247eca34cb25b7d80aad345e393e81" name="src/libmongocrypt/kms-message/src/kms_port.h" role="src" />
<file md5sum="f38035514480120b10b4bcb2c334e2a0" name="src/libmongocrypt/kms-message/src/kms_request.c" role="src" />
<file md5sum="0e650d43199b0e12ffb08b38f54c9b90" name="src/libmongocrypt/kms-message/src/kms_request_opt.c" role="src" />
<file md5sum="4c851b149d17a8d3818de213af8f2d06" name="src/libmongocrypt/kms-message/src/kms_request_opt_private.h" role="src" />
<file md5sum="888bf715d142e373232463eccf0dffcf" name="src/libmongocrypt/kms-message/src/kms_request_str.c" role="src" />
<file md5sum="7d8d321cf69c6316096ca2aab4c9728c" name="src/libmongocrypt/kms-message/src/kms_request_str.h" role="src" />
<file md5sum="ea5d236af2499b31ad2d6b8820376313" name="src/libmongocrypt/kms-message/src/kms_response.c" role="src" />
<file md5sum="2253d59b564ae589d7f0bc6c41626ec2" name="src/libmongocrypt/kms-message/src/kms_response_parser.c" role="src" />
<file md5sum="dff15b5018efb6269a2a0269c5ddb798" name="src/libmongocrypt/kms-message/src/sort.c" role="src" />
<file md5sum="18f9bd055f6a60e7702603b6b8bf07d5" name="src/libmongocrypt/kms-message/src/sort.h" role="src" />
<file md5sum="a791784364e86ef3029164fe8fafb4e7" name="src/libmongocrypt/src/crypto/cng.c" role="src" />
<file md5sum="53fc5575aff7106efd138447402987a0" name="src/libmongocrypt/src/crypto/commoncrypto.c" role="src" />
<file md5sum="977c2919c40b709e500db58b32cef614" name="src/libmongocrypt/src/crypto/libcrypto.c" role="src" />
<file md5sum="5f74a939598e843394ba5292069ace50" name="src/libmongocrypt/src/crypto/none.c" role="src" />
<file md5sum="39a4c1f631e35ead04f8ba13a11bba65" name="src/libmongocrypt/src/os_posix/os_mutex.c" role="src" />
<file md5sum="f36340408ed3b922617c53f5dc5570fb" name="src/libmongocrypt/src/os_posix/os_once.c" role="src" />
<file md5sum="f95d328d2484c7369dc938a5366cf846" name="src/libmongocrypt/src/os_win/os_mutex.c" role="src" />
<file md5sum="af647ade57dd876ee77cf5dd106035d4" name="src/libmongocrypt/src/os_win/os_once.c" role="src" />
<file md5sum="34e15d89ffa2a308ea86b1ae2cb0088f" name="src/libmongocrypt/src/mongocrypt-binary-private.h" role="src" />
<file md5sum="b81c6d7cb5e9526df940d94c813284e9" name="src/libmongocrypt/src/mongocrypt-binary.c" role="src" />
<file md5sum="109d64685929f58552226f26e709a3c8" name="src/libmongocrypt/src/mongocrypt-buffer-private.h" role="src" />
<file md5sum="4ac333f998d74213133f8bdc715f39ab" name="src/libmongocrypt/src/mongocrypt-buffer.c" role="src" />
<file md5sum="b5e9bc242b7d785f6c293d875c2d3c71" name="src/libmongocrypt/src/mongocrypt-cache-collinfo-private.h" role="src" />
<file md5sum="48c5eb499d93bd2e230d38b78515deaa" name="src/libmongocrypt/src/mongocrypt-cache-collinfo.c" role="src" />
<file md5sum="1b4df4f22323d029c972086c956926d4" name="src/libmongocrypt/src/mongocrypt-cache-key-private.h" role="src" />
<file md5sum="21c432424e1a3160a71c8daa03a64cb5" name="src/libmongocrypt/src/mongocrypt-cache-key.c" role="src" />
<file md5sum="56a3c0f20b220f11a18965282facea22" name="src/libmongocrypt/src/mongocrypt-cache-private.h" role="src" />
<file md5sum="cf785575cca4c00c45dac5de2251c0c3" name="src/libmongocrypt/src/mongocrypt-cache.c" role="src" />
<file md5sum="3ee978103ce2a2f53b87f03b5bf9c12f" name="src/libmongocrypt/src/mongocrypt-ciphertext-private.h" role="src" />
<file md5sum="bdecd2c011f4f816c8660e3324115ca1" name="src/libmongocrypt/src/mongocrypt-ciphertext.c" role="src" />
<file md5sum="58273e221efb6ea6b1a05bb7fab3f2f3" name="src/libmongocrypt/src/mongocrypt-compat.h" role="src" />
<file md5sum="26ae605bd0f5b975033a17a545226496" name="src/libmongocrypt/src/mongocrypt-config.h" role="src" />
<file md5sum="6f51385c8021d849d4338bec0a8d0afc" name="src/libmongocrypt/src/mongocrypt-config.h.in" role="src" />
<file md5sum="aaa9e9a34de1a2b596666a81afc9b5fc" name="src/libmongocrypt/src/mongocrypt-crypto-private.h" role="src" />
<file md5sum="f06b1bc334578372191b07780ff6d64d" name="src/libmongocrypt/src/mongocrypt-crypto.c" role="src" />
<file md5sum="edb1d5aefa10337daf12dc05f1fb2d06" name="src/libmongocrypt/src/mongocrypt-ctx-datakey.c" role="src" />
<file md5sum="502f446a79814987c271a6baa18b50d2" name="src/libmongocrypt/src/mongocrypt-ctx-decrypt.c" role="src" />
<file md5sum="82a23ae6e1401c7f6cd75b2cb1325322" name="src/libmongocrypt/src/mongocrypt-ctx-encrypt.c" role="src" />
<file md5sum="969dfbc519ffcbf6b6f44f268559df61" name="src/libmongocrypt/src/mongocrypt-ctx-private.h" role="src" />
<file md5sum="d3b1ba157d5812d2d7e6b3718caf3464" name="src/libmongocrypt/src/mongocrypt-ctx.c" role="src" />
<file md5sum="6dd978a3c40bcd51b6ef191b147eab28" name="src/libmongocrypt/src/mongocrypt-key-broker-private.h" role="src" />
<file md5sum="082494b90330dcd1be7613de57533a81" name="src/libmongocrypt/src/mongocrypt-key-broker.c" role="src" />
<file md5sum="504951fc20640d67bf2d390e5d1623dc" name="src/libmongocrypt/src/mongocrypt-key-private.h" role="src" />
<file md5sum="57c011fdd62e96863c641159853de440" name="src/libmongocrypt/src/mongocrypt-key.c" role="src" />
<file md5sum="d68fa0e4ade2b9098f2d097d89513957" name="src/libmongocrypt/src/mongocrypt-kms-ctx-private.h" role="src" />
<file md5sum="bed3f500eed93e4b640436e779b1f861" name="src/libmongocrypt/src/mongocrypt-kms-ctx.c" role="src" />
<file md5sum="abb8c5d911a57713225517247cc9bd2a" name="src/libmongocrypt/src/mongocrypt-log-private.h" role="src" />
<file md5sum="791498257b4fc5601a91792bdc55c2cc" name="src/libmongocrypt/src/mongocrypt-log.c" role="src" />
<file md5sum="0453849c026e5fd24e80ad50c1aef528" name="src/libmongocrypt/src/mongocrypt-marking-private.h" role="src" />
<file md5sum="2993cd22ed2359e653f753f6a6c7ee16" name="src/libmongocrypt/src/mongocrypt-marking.c" role="src" />
<file md5sum="de4411fc003a25f9dbcc9d3f8fe80c2c" name="src/libmongocrypt/src/mongocrypt-mutex-private.h" role="src" />
<file md5sum="d80f92cec8266d12c3b174275b73bf10" name="src/libmongocrypt/src/mongocrypt-opts-private.h" role="src" />
<file md5sum="6560d217fe3b8418d7be07f8cd83896e" name="src/libmongocrypt/src/mongocrypt-opts.c" role="src" />
<file md5sum="3a8ee36ad63019ebde0f9c405d23aefd" name="src/libmongocrypt/src/mongocrypt-os-private.h" role="src" />
<file md5sum="23c4cfada727dd1d85574be5b0b4081f" name="src/libmongocrypt/src/mongocrypt-private.h" role="src" />
<file md5sum="24df0f363dcc87eb3e4e95b5b178133a" name="src/libmongocrypt/src/mongocrypt-status-private.h" role="src" />
<file md5sum="1c8e297a73ac824dd442ac3bfe2e06b3" name="src/libmongocrypt/src/mongocrypt-status.c" role="src" />
<file md5sum="c532c0d6ed2d0d97df2ac1b2bb01f469" name="src/libmongocrypt/src/mongocrypt-traverse-util-private.h" role="src" />
<file md5sum="93bf9b4cec817a1b527ddcaf1ee4f812" name="src/libmongocrypt/src/mongocrypt-traverse-util.c" role="src" />
<file md5sum="a1db2c8dfb2c724606562b2a26a26fa8" name="src/libmongocrypt/src/mongocrypt.c" role="src" />
<file md5sum="47570a0d5dfb0d26bc49c526f020ac2c" name="src/libmongocrypt/src/mongocrypt.h" role="src" />
<file md5sum="b5a4f2ed22c33a7f2200eaecf835523a" name="src/libmongocrypt/src/mongocrypt.h.in" role="src" />
<file md5sum="c0879261b3ffe363f27a5d1a6bb5ffcd" name="src/LIBMONGOCRYPT_VERSION_CURRENT" role="src" />
- <file md5sum="6e8e7f4eecf00447cde2ef03edcd7a1c" name="src/LIBMONGOC_VERSION_CURRENT" role="src" />
- <file md5sum="758ea1dc0add2812f22f8455cf81fbbe" name="src/bson-encode.c" role="src" />
- <file md5sum="1faf61dc6c90ab73f9e1cd3bd43401f5" name="src/bson.c" role="src" />
+ <file md5sum="581a149be0810ea69a25bd5ff55fa70d" name="src/LIBMONGOC_VERSION_CURRENT" role="src" />
+ <file md5sum="4336fa71f39c8ced5227c3828d4a0cb4" name="src/bson-encode.c" role="src" />
+ <file md5sum="cf2ece9567f4eb66919150ae87f95f8e" name="src/bson.c" role="src" />
<file md5sum="66af17011d592df54d55aaa7ff58e990" name="tests/apm/bug0950-001.phpt" role="test" />
- <file md5sum="50f55a4c7b6155271ac7feb37e733ace" name="tests/apm/bug0950-002.phpt" role="test" />
+ <file md5sum="a01f5d09d186d5e1e39e120aafe851d5" name="tests/apm/bug0950-002.phpt" role="test" />
<file md5sum="69974d01892202ee399bdf181549d07e" name="tests/apm/monitoring-addSubscriber-001.phpt" role="test" />
<file md5sum="8668c64512a5b32920ad2c87df9837ed" name="tests/apm/monitoring-addSubscriber-002.phpt" role="test" />
<file md5sum="e3b6beac60751e5ba7f48fc281e27f02" name="tests/apm/monitoring-addSubscriber-003.phpt" role="test" />
<file md5sum="c4e170d9acb0601c93e6112acd58792c" name="tests/apm/monitoring-addSubscriber-004.phpt" role="test" />
<file md5sum="03763298999547b395da7846105548dc" name="tests/apm/monitoring-commandFailed-001.phpt" role="test" />
<file md5sum="4cbdad41408461b054ba05df30cbacd5" name="tests/apm/monitoring-commandFailed-002.phpt" role="test" />
<file md5sum="0c0b354d9a505d05f74afa927375e3cc" name="tests/apm/monitoring-commandFailed-003.phpt" role="test" />
<file md5sum="9852e55216b755f2c800d8b7858aaae0" name="tests/apm/monitoring-commandStarted-001.phpt" role="test" />
<file md5sum="4b17b33c0b87a7f3e4878de244e426cb" name="tests/apm/monitoring-commandSucceeded-001.phpt" role="test" />
<file md5sum="4ce57a2990551547600ff91a3e15b6bd" name="tests/apm/monitoring-commandSucceeded-002.phpt" role="test" />
<file md5sum="aa99e776d1102681cac9b13ce84069ea" name="tests/apm/monitoring-removeSubscriber-001.phpt" role="test" />
<file md5sum="837f04a6157bf2dac297467b3a3a3590" name="tests/apm/monitoring-removeSubscriber-002.phpt" role="test" />
<file md5sum="b6ee01ca55973b188b7d83d79884c946" name="tests/bson-corpus/array-decodeError-001.phpt" role="test" />
<file md5sum="83f8434bb60797b4c6de3a675082b2ee" name="tests/bson-corpus/array-decodeError-002.phpt" role="test" />
<file md5sum="a185b9e13f33a7a5e33deed198aa5c56" name="tests/bson-corpus/array-decodeError-003.phpt" role="test" />
- <file md5sum="5f7904f3ebaf38bb540b0b17e5ecd4d1" name="tests/bson-corpus/array-valid-001.phpt" role="test" />
- <file md5sum="e664e3621ec2bad95c47047ce680b611" name="tests/bson-corpus/array-valid-002.phpt" role="test" />
- <file md5sum="f2f189d6d98d8f54890c7a34c1ace17e" name="tests/bson-corpus/array-valid-003.phpt" role="test" />
- <file md5sum="2e5d6afbb5e696585540ea681e5233a5" name="tests/bson-corpus/array-valid-004.phpt" role="test" />
+ <file md5sum="9d70206b8e01a0ecc7b0a229d653e025" name="tests/bson-corpus/array-valid-001.phpt" role="test" />
+ <file md5sum="3dcb1926241a0892153899ff43774dd1" name="tests/bson-corpus/array-valid-002.phpt" role="test" />
+ <file md5sum="1949bd2b6019a04d3c0577cc796a3a5f" name="tests/bson-corpus/array-valid-003.phpt" role="test" />
+ <file md5sum="602b248800d647f6f8719fe9e5c2320d" name="tests/bson-corpus/array-valid-004.phpt" role="test" />
<file md5sum="a9ff631ef6d197c1882bbbeaeb3e9e5e" name="tests/bson-corpus/array-valid-005.phpt" role="test" />
<file md5sum="8e413f5cb807cde854a34cb13b3386fc" name="tests/bson-corpus/binary-decodeError-001.phpt" role="test" />
<file md5sum="634976ba21553985d6ad1b33c3c7a94d" name="tests/bson-corpus/binary-decodeError-002.phpt" role="test" />
<file md5sum="c3d1081f87b20c7eccc634cc1fbe64dc" name="tests/bson-corpus/binary-decodeError-003.phpt" role="test" />
<file md5sum="029e9562d5745fcc40f68fa1f418ec3b" name="tests/bson-corpus/binary-decodeError-004.phpt" role="test" />
<file md5sum="4b2fb55983642f27a35f5044b0636d91" name="tests/bson-corpus/binary-decodeError-005.phpt" role="test" />
- <file md5sum="42973b41103468bfafd3066be4bb7b48" name="tests/bson-corpus/binary-valid-001.phpt" role="test" />
- <file md5sum="f6e30233405b16c9b436ea008a85bfd6" name="tests/bson-corpus/binary-valid-002.phpt" role="test" />
- <file md5sum="3b4b3909abda591b158dd45ebdbe166b" name="tests/bson-corpus/binary-valid-003.phpt" role="test" />
- <file md5sum="7292866378520a3727a8e126bffa9ae3" name="tests/bson-corpus/binary-valid-004.phpt" role="test" />
- <file md5sum="2d3ff45f820fbc5b9338b5459de97866" name="tests/bson-corpus/binary-valid-005.phpt" role="test" />
- <file md5sum="11933cd51cd1cdcc3cd134464e0896cf" name="tests/bson-corpus/binary-valid-006.phpt" role="test" />
- <file md5sum="44569d1c0bf30bce454994a195f7823e" name="tests/bson-corpus/binary-valid-007.phpt" role="test" />
- <file md5sum="05a35df52abd6765a5189c128284fcb4" name="tests/bson-corpus/binary-valid-008.phpt" role="test" />
- <file md5sum="f84598efb7037482b132ac4fca5857e3" name="tests/bson-corpus/binary-valid-009.phpt" role="test" />
- <file md5sum="6c4f6905bb8e6863c96588bd3a645177" name="tests/bson-corpus/binary-valid-010.phpt" role="test" />
- <file md5sum="9a5f5e5d38089aaff6164dbc671e2246" name="tests/bson-corpus/binary-valid-011.phpt" role="test" />
+ <file md5sum="951671d05267fe7f0cc5f3236498c83b" name="tests/bson-corpus/binary-valid-001.phpt" role="test" />
+ <file md5sum="b7b5098337c67327867d4bb6df3bc2d2" name="tests/bson-corpus/binary-valid-002.phpt" role="test" />
+ <file md5sum="b692cd935502f8bfa723cb1f8bfefa5e" name="tests/bson-corpus/binary-valid-003.phpt" role="test" />
+ <file md5sum="e00e2bfe54fe20b7448e23612a225cd3" name="tests/bson-corpus/binary-valid-004.phpt" role="test" />
+ <file md5sum="9bc12f77c0820f17906fc990bd10c527" name="tests/bson-corpus/binary-valid-005.phpt" role="test" />
+ <file md5sum="38434ab6b7a18cb38929b169ef8f0355" name="tests/bson-corpus/binary-valid-006.phpt" role="test" />
+ <file md5sum="10e532f22b84065b3df34a458e18f993" name="tests/bson-corpus/binary-valid-007.phpt" role="test" />
+ <file md5sum="b1a5b32909c9fa72aa0426cb939cdfdc" name="tests/bson-corpus/binary-valid-008.phpt" role="test" />
+ <file md5sum="9758719d5bce6d1f5ce0a8adab5b8501" name="tests/bson-corpus/binary-valid-009.phpt" role="test" />
+ <file md5sum="5684fd10cc0e72484d893d0bbe6ca4d8" name="tests/bson-corpus/binary-valid-010.phpt" role="test" />
+ <file md5sum="b304f040e9268b273c9e0badda8b1fb7" name="tests/bson-corpus/binary-valid-011.phpt" role="test" />
<file md5sum="6acf60b8609adcb02a080fc2f2742acb" name="tests/bson-corpus/boolean-decodeError-001.phpt" role="test" />
<file md5sum="1b94fe0b7a11495dceaff6d1d2076082" name="tests/bson-corpus/boolean-decodeError-002.phpt" role="test" />
- <file md5sum="2e89a679f02e12daac8311602f83c58b" name="tests/bson-corpus/boolean-valid-001.phpt" role="test" />
- <file md5sum="fd64b1f664576a8cb9d5a8e96f883cdb" name="tests/bson-corpus/boolean-valid-002.phpt" role="test" />
+ <file md5sum="6c5944573c9257e0ec295292b431d16c" name="tests/bson-corpus/boolean-valid-001.phpt" role="test" />
+ <file md5sum="2e66771a95c7c2681e52e725c0d30261" name="tests/bson-corpus/boolean-valid-002.phpt" role="test" />
<file md5sum="cb2c63091ce618abb5033167e4759ad3" name="tests/bson-corpus/code-decodeError-001.phpt" role="test" />
<file md5sum="d31b0b0e2e4979a9b9ec4e4d5bbca6ab" name="tests/bson-corpus/code-decodeError-002.phpt" role="test" />
<file md5sum="def5a9221b25131693a1a53d31535fef" name="tests/bson-corpus/code-decodeError-003.phpt" role="test" />
<file md5sum="a5047a340325e20232ad5ed40afc870b" name="tests/bson-corpus/code-decodeError-004.phpt" role="test" />
<file md5sum="3b5e60f96e1a28845decd47a24d9e1c8" name="tests/bson-corpus/code-decodeError-005.phpt" role="test" />
<file md5sum="5a5f978ebc00be2e2fd3f05d3544ad78" name="tests/bson-corpus/code-decodeError-006.phpt" role="test" />
<file md5sum="67b521b59cf0cee700b27ad76ad3f97f" name="tests/bson-corpus/code-decodeError-007.phpt" role="test" />
- <file md5sum="4dd62a2936dc0d2a8b89d1e11727071c" name="tests/bson-corpus/code-valid-001.phpt" role="test" />
- <file md5sum="fbbeca71baad82db682358fe22b40f92" name="tests/bson-corpus/code-valid-002.phpt" role="test" />
- <file md5sum="39db4713192b7cf86eafaa9abc7fa35d" name="tests/bson-corpus/code-valid-003.phpt" role="test" />
- <file md5sum="d56a95f4ddc720c825a8af0a14e65112" name="tests/bson-corpus/code-valid-004.phpt" role="test" />
- <file md5sum="2fdd4dedb78278d264e22c3a059bae09" name="tests/bson-corpus/code-valid-005.phpt" role="test" />
- <file md5sum="72e0600d4fa803ed685315248b0f864d" name="tests/bson-corpus/code-valid-006.phpt" role="test" />
+ <file md5sum="f34444a8ab61d2631894abd393768894" name="tests/bson-corpus/code-valid-001.phpt" role="test" />
+ <file md5sum="6d0231522e1e377b6c77dce239f96ded" name="tests/bson-corpus/code-valid-002.phpt" role="test" />
+ <file md5sum="5a52344d0292eee3eee1ddc92ed0d1d9" name="tests/bson-corpus/code-valid-003.phpt" role="test" />
+ <file md5sum="6251b89db5c7beb6f2662d75aac4e469" name="tests/bson-corpus/code-valid-004.phpt" role="test" />
+ <file md5sum="4637f69dd7cd89c77f5400037f409122" name="tests/bson-corpus/code-valid-005.phpt" role="test" />
+ <file md5sum="4d54c3d4fbdcfd1857a2d2945530188d" name="tests/bson-corpus/code-valid-006.phpt" role="test" />
<file md5sum="7e7b00cd6ae321cd06b04696558b93f9" name="tests/bson-corpus/code_w_scope-decodeError-001.phpt" role="test" />
<file md5sum="f0cba92ca6f26e073d988f2748d8e776" name="tests/bson-corpus/code_w_scope-decodeError-002.phpt" role="test" />
<file md5sum="eb2b50f7a920cc3442398f8e19f67119" name="tests/bson-corpus/code_w_scope-decodeError-003.phpt" role="test" />
<file md5sum="589dbd0b51bbc31700dd9a2edfef75c3" name="tests/bson-corpus/code_w_scope-decodeError-004.phpt" role="test" />
<file md5sum="7a02aa94adfd1007367d25ad001455a7" name="tests/bson-corpus/code_w_scope-decodeError-005.phpt" role="test" />
<file md5sum="2f8df9fe573147aa9b4e8416ce52b678" name="tests/bson-corpus/code_w_scope-decodeError-006.phpt" role="test" />
<file md5sum="8c9dbdc9c9b15b05859e87fc720483e9" name="tests/bson-corpus/code_w_scope-decodeError-007.phpt" role="test" />
<file md5sum="1b538522ec683297f76a6f53d9bfc559" name="tests/bson-corpus/code_w_scope-decodeError-008.phpt" role="test" />
<file md5sum="722497f92c19465fef10be41e1cbe89e" name="tests/bson-corpus/code_w_scope-decodeError-009.phpt" role="test" />
<file md5sum="7122940f8a8170b4129a8cb164bdd069" name="tests/bson-corpus/code_w_scope-decodeError-010.phpt" role="test" />
<file md5sum="1d1e085d1b768af338c0820be8b11078" name="tests/bson-corpus/code_w_scope-decodeError-011.phpt" role="test" />
- <file md5sum="e51d958466aeeb7dbfd76347c3ac21e8" name="tests/bson-corpus/code_w_scope-valid-001.phpt" role="test" />
- <file md5sum="27bc43506ee0a8112ccebf1e6020eb17" name="tests/bson-corpus/code_w_scope-valid-002.phpt" role="test" />
- <file md5sum="a921c315930c5e272c2cd0ef6767bba2" name="tests/bson-corpus/code_w_scope-valid-003.phpt" role="test" />
- <file md5sum="841870f527f9a55d8b49271fe6fd1c59" name="tests/bson-corpus/code_w_scope-valid-004.phpt" role="test" />
- <file md5sum="5f945ba46fa191c856e73b76fd5ff451" name="tests/bson-corpus/code_w_scope-valid-005.phpt" role="test" />
+ <file md5sum="2e16813a6be906c632639eb76bc65e3b" name="tests/bson-corpus/code_w_scope-valid-001.phpt" role="test" />
+ <file md5sum="ed7ed0fec708d6c7120b75b0e597aa9d" name="tests/bson-corpus/code_w_scope-valid-002.phpt" role="test" />
+ <file md5sum="9328692481b47711ff9fabbf6919ec16" name="tests/bson-corpus/code_w_scope-valid-003.phpt" role="test" />
+ <file md5sum="4ab3ab7b2b567851394f226a9df5c2f4" name="tests/bson-corpus/code_w_scope-valid-004.phpt" role="test" />
+ <file md5sum="57771dde2e2caeaa7e9c34b4a4d1e464" name="tests/bson-corpus/code_w_scope-valid-005.phpt" role="test" />
<file md5sum="ce7213c4e3aae833d56812e57ca28cfa" name="tests/bson-corpus/datetime-decodeError-001.phpt" role="test" />
- <file md5sum="f7bfa0b5340ca943ff152c50b0e1bf04" name="tests/bson-corpus/datetime-valid-001.phpt" role="test" />
- <file md5sum="7b4a43c6d6f90fef8b7bca0a8c9a61e0" name="tests/bson-corpus/datetime-valid-002.phpt" role="test" />
- <file md5sum="471939bcb3717b9d784cbb41dff0b8b4" name="tests/bson-corpus/datetime-valid-003.phpt" role="test" />
- <file md5sum="0f753526142aad6abed8345951f3f90f" name="tests/bson-corpus/datetime-valid-004.phpt" role="test" />
+ <file md5sum="9e543f5565582e91d8395062d8864640" name="tests/bson-corpus/datetime-valid-001.phpt" role="test" />
+ <file md5sum="d4cae5b15658b9a4451322c831fdd08c" name="tests/bson-corpus/datetime-valid-002.phpt" role="test" />
+ <file md5sum="eee32d15def3d1734be8f2d75c09df26" name="tests/bson-corpus/datetime-valid-003.phpt" role="test" />
+ <file md5sum="7d738a5971d4b993816daa28cc0ec67c" name="tests/bson-corpus/datetime-valid-004.phpt" role="test" />
<file md5sum="395f1fa7b59716e26f51f7b2523f6115" name="tests/bson-corpus/datetime-valid-005.phpt" role="test" />
<file md5sum="093f74a124695331852c20f6ba4236ee" name="tests/bson-corpus/dbpointer-decodeError-001.phpt" role="test" />
<file md5sum="21c522b8b544870ad4982ca50dd1e7ae" name="tests/bson-corpus/dbpointer-decodeError-002.phpt" role="test" />
<file md5sum="0399ddebcb1fd2dd5764bd81425f6265" name="tests/bson-corpus/dbpointer-decodeError-003.phpt" role="test" />
<file md5sum="72e19565405e17ddd67b58a12f7fcde2" name="tests/bson-corpus/dbpointer-decodeError-004.phpt" role="test" />
<file md5sum="7579629d6cbaac8e1b3a0f5dddbea518" name="tests/bson-corpus/dbpointer-decodeError-005.phpt" role="test" />
<file md5sum="5f3222fe704bc140610288700005bbf1" name="tests/bson-corpus/dbpointer-decodeError-006.phpt" role="test" />
- <file md5sum="4fe16bf89fe5df9ccc78fe065d635d97" name="tests/bson-corpus/dbpointer-valid-001.phpt" role="test" />
- <file md5sum="2e8314da3bf0d89a6cc59aa05beab8d5" name="tests/bson-corpus/dbpointer-valid-002.phpt" role="test" />
- <file md5sum="03f8c4c2d67c9836b2bea4f3e6e01878" name="tests/bson-corpus/dbpointer-valid-003.phpt" role="test" />
- <file md5sum="f6a0d646f5f59227ab1a2a2d94fdf180" name="tests/bson-corpus/dbref-valid-001.phpt" role="test" />
- <file md5sum="0a9d842217ab322bffa873e492687737" name="tests/bson-corpus/dbref-valid-002.phpt" role="test" />
- <file md5sum="35045645543825eb1964601f4fe86cae" name="tests/bson-corpus/dbref-valid-003.phpt" role="test" />
- <file md5sum="6d08c11b156e71399412d2271dcc31ae" name="tests/bson-corpus/dbref-valid-004.phpt" role="test" />
- <file md5sum="c8bea39a89b0a90b84842ad6d3a96a11" name="tests/bson-corpus/dbref-valid-005.phpt" role="test" />
- <file md5sum="1be9664e30513a74507db5a31493d6ab" name="tests/bson-corpus/decimal128-1-valid-001.phpt" role="test" />
- <file md5sum="6211d74f1ce5b93637cb0a0649071866" name="tests/bson-corpus/decimal128-1-valid-002.phpt" role="test" />
- <file md5sum="6c3cc1a8b4342f226e53614aee46c850" name="tests/bson-corpus/decimal128-1-valid-003.phpt" role="test" />
- <file md5sum="1258eedd19348a86ddd31f21d1115d9c" name="tests/bson-corpus/decimal128-1-valid-004.phpt" role="test" />
- <file md5sum="ba2b9cf011c89650faa41c46503d6201" name="tests/bson-corpus/decimal128-1-valid-005.phpt" role="test" />
- <file md5sum="13646f18b50308a4816c3a2adb583433" name="tests/bson-corpus/decimal128-1-valid-006.phpt" role="test" />
- <file md5sum="e61f4ac46d6d11c7ff1e3eff3fead1bb" name="tests/bson-corpus/decimal128-1-valid-007.phpt" role="test" />
- <file md5sum="ed121eaa293ae98345e2632ce931d87e" name="tests/bson-corpus/decimal128-1-valid-008.phpt" role="test" />
- <file md5sum="38799d1515616bb61426710833d27a33" name="tests/bson-corpus/decimal128-1-valid-009.phpt" role="test" />
- <file md5sum="675915a04d0ccbe5e33c8cd191c49009" name="tests/bson-corpus/decimal128-1-valid-010.phpt" role="test" />
- <file md5sum="da13a23d8a366f64173469a48d34bf75" name="tests/bson-corpus/decimal128-1-valid-011.phpt" role="test" />
- <file md5sum="e53db0b3304cf22b40bd88648905b8b0" name="tests/bson-corpus/decimal128-1-valid-012.phpt" role="test" />
- <file md5sum="e0ea8c1c0af2018097e277766178af4d" name="tests/bson-corpus/decimal128-1-valid-013.phpt" role="test" />
- <file md5sum="683e01fbd575c916cf8318f79abe3e24" name="tests/bson-corpus/decimal128-1-valid-014.phpt" role="test" />
- <file md5sum="14e8fd8b30319c05b7b11bb36ca1d653" name="tests/bson-corpus/decimal128-1-valid-015.phpt" role="test" />
- <file md5sum="75c92b5d14312891ab5c3e16055743fa" name="tests/bson-corpus/decimal128-1-valid-016.phpt" role="test" />
- <file md5sum="8a7fa49d165fda74aa161fe86a462b76" name="tests/bson-corpus/decimal128-1-valid-017.phpt" role="test" />
- <file md5sum="ac80ba6121ddaa84a249b30ca2ea1872" name="tests/bson-corpus/decimal128-1-valid-018.phpt" role="test" />
- <file md5sum="5d01624977a5c30b7d119314f3aff184" name="tests/bson-corpus/decimal128-1-valid-019.phpt" role="test" />
- <file md5sum="8c3fcbbc3a7aa1640fe397c67a5cf899" name="tests/bson-corpus/decimal128-1-valid-020.phpt" role="test" />
- <file md5sum="53f02848dfab7990fd60b1e9d38b67ad" name="tests/bson-corpus/decimal128-1-valid-021.phpt" role="test" />
- <file md5sum="4361a2779601eba39c3636fe4083e6aa" name="tests/bson-corpus/decimal128-1-valid-022.phpt" role="test" />
- <file md5sum="aa5c274f7340aa5640db649637a2b598" name="tests/bson-corpus/decimal128-1-valid-023.phpt" role="test" />
- <file md5sum="cd2d62f86eefa21ed3515cf7331abebc" name="tests/bson-corpus/decimal128-1-valid-024.phpt" role="test" />
- <file md5sum="5bc00004cb90af3b3c96d94f874ee0d2" name="tests/bson-corpus/decimal128-1-valid-025.phpt" role="test" />
- <file md5sum="fcb960fc23592fae8d2ab1f043fe6d96" name="tests/bson-corpus/decimal128-1-valid-026.phpt" role="test" />
- <file md5sum="7b4e7a0b389b795a77b30f955488581d" name="tests/bson-corpus/decimal128-1-valid-027.phpt" role="test" />
- <file md5sum="03e0925896672089326dccfb5cdf3bb7" name="tests/bson-corpus/decimal128-1-valid-028.phpt" role="test" />
- <file md5sum="7e4e2525f124be41a89a73d26b7918a0" name="tests/bson-corpus/decimal128-1-valid-029.phpt" role="test" />
- <file md5sum="975e4fae01096e30dd2f99d8fae7e5ba" name="tests/bson-corpus/decimal128-1-valid-030.phpt" role="test" />
- <file md5sum="9082185cf22808c7e69dcb1da3c423d9" name="tests/bson-corpus/decimal128-1-valid-031.phpt" role="test" />
- <file md5sum="434f43477c58954f210d1af1fb6588c1" name="tests/bson-corpus/decimal128-1-valid-032.phpt" role="test" />
- <file md5sum="a052b5e7678dd60a7c7e7de744c87017" name="tests/bson-corpus/decimal128-1-valid-033.phpt" role="test" />
- <file md5sum="613ab4ac14503406b50607c19d273cb8" name="tests/bson-corpus/decimal128-1-valid-034.phpt" role="test" />
- <file md5sum="5c0d2131e7acbfaedc525a8f4c4f2d45" name="tests/bson-corpus/decimal128-1-valid-035.phpt" role="test" />
- <file md5sum="3fe40e8d661ebc168a849a2c45472477" name="tests/bson-corpus/decimal128-1-valid-036.phpt" role="test" />
- <file md5sum="ed25faa820a283907a32e179616f5334" name="tests/bson-corpus/decimal128-1-valid-037.phpt" role="test" />
- <file md5sum="8b29111ce0810339305ebb10f2bef961" name="tests/bson-corpus/decimal128-1-valid-038.phpt" role="test" />
- <file md5sum="b7a91a4e418cad9b65d56549fadbadc1" name="tests/bson-corpus/decimal128-1-valid-039.phpt" role="test" />
- <file md5sum="6bd56aaf565aa7aad486a0c6dd65e65a" name="tests/bson-corpus/decimal128-1-valid-040.phpt" role="test" />
- <file md5sum="e676d6b392e18ca3c128e53fcef060d7" name="tests/bson-corpus/decimal128-1-valid-041.phpt" role="test" />
- <file md5sum="442a9f5586ada55d3f140dffa1877de6" name="tests/bson-corpus/decimal128-1-valid-042.phpt" role="test" />
- <file md5sum="84ea678317f307cb585a66b5cc692a02" name="tests/bson-corpus/decimal128-1-valid-043.phpt" role="test" />
- <file md5sum="95d97fe1c10db4b55b011c14eef8a39d" name="tests/bson-corpus/decimal128-1-valid-044.phpt" role="test" />
- <file md5sum="403ac53597d14f2ccdede8493c078d2e" name="tests/bson-corpus/decimal128-1-valid-045.phpt" role="test" />
- <file md5sum="820b7afdb1489889b589672526912ba4" name="tests/bson-corpus/decimal128-1-valid-046.phpt" role="test" />
- <file md5sum="80ee524599f9f7e0642c7b37fd897e09" name="tests/bson-corpus/decimal128-1-valid-047.phpt" role="test" />
- <file md5sum="d8f2a7e25e4008b5d7819cd8b678fcb9" name="tests/bson-corpus/decimal128-1-valid-048.phpt" role="test" />
- <file md5sum="c238495574eeedc4cf8fd00573ea905e" name="tests/bson-corpus/decimal128-1-valid-049.phpt" role="test" />
- <file md5sum="0b0973d7ea834026c163a2011fbeb080" name="tests/bson-corpus/decimal128-1-valid-050.phpt" role="test" />
- <file md5sum="ec24828ca55a2bda0a2d66505b64936d" name="tests/bson-corpus/decimal128-1-valid-051.phpt" role="test" />
- <file md5sum="729441ba04ae3012c56930d4096717c5" name="tests/bson-corpus/decimal128-1-valid-052.phpt" role="test" />
- <file md5sum="8f95866d1d16ab43e97c7f2faa57ea28" name="tests/bson-corpus/decimal128-1-valid-053.phpt" role="test" />
- <file md5sum="c37788e500a3ffd5e4fe9de2c7beb8d2" name="tests/bson-corpus/decimal128-1-valid-054.phpt" role="test" />
- <file md5sum="75284b0772f6c51e3ddfac7b54b690fc" name="tests/bson-corpus/decimal128-1-valid-055.phpt" role="test" />
- <file md5sum="195bb4db3fe142ea2a5c18f42511fb98" name="tests/bson-corpus/decimal128-1-valid-056.phpt" role="test" />
- <file md5sum="ee3b5cfa0a47ab7816934bb3d910f865" name="tests/bson-corpus/decimal128-2-valid-001.phpt" role="test" />
- <file md5sum="5e408cdeb8c9bd64821c2036e297074b" name="tests/bson-corpus/decimal128-2-valid-002.phpt" role="test" />
- <file md5sum="14d41a31977b7f3f3117846057ba2601" name="tests/bson-corpus/decimal128-2-valid-003.phpt" role="test" />
- <file md5sum="b18a1b7373ede0724f2419af2589ba2c" name="tests/bson-corpus/decimal128-2-valid-004.phpt" role="test" />
- <file md5sum="66ff234efe9a92930a955012376426a8" name="tests/bson-corpus/decimal128-2-valid-005.phpt" role="test" />
- <file md5sum="2ebc1553235eb6940c8eb52511ffaa20" name="tests/bson-corpus/decimal128-2-valid-006.phpt" role="test" />
- <file md5sum="5b3c244258cc82c1518d8921c5968629" name="tests/bson-corpus/decimal128-2-valid-007.phpt" role="test" />
- <file md5sum="37c5c0137ab212c29589fbc3f933b6e8" name="tests/bson-corpus/decimal128-2-valid-008.phpt" role="test" />
- <file md5sum="0161b23d856375b66b5c609a0c11ab40" name="tests/bson-corpus/decimal128-2-valid-009.phpt" role="test" />
- <file md5sum="b9a07e0062873f860c2bc4883ef61bea" name="tests/bson-corpus/decimal128-2-valid-010.phpt" role="test" />
- <file md5sum="0d2c193c752e22363784d7f3fe8223cd" name="tests/bson-corpus/decimal128-2-valid-011.phpt" role="test" />
- <file md5sum="2bbf62a4f860531f268664ccc1ff04a7" name="tests/bson-corpus/decimal128-2-valid-012.phpt" role="test" />
- <file md5sum="8c7793815244ce46beb792fff2d5d9b2" name="tests/bson-corpus/decimal128-2-valid-013.phpt" role="test" />
- <file md5sum="a018ded9ca70adae810dd2a6e1e73ac0" name="tests/bson-corpus/decimal128-2-valid-014.phpt" role="test" />
- <file md5sum="33c3d1896d9a523f0dc3a6d17c7cd672" name="tests/bson-corpus/decimal128-2-valid-015.phpt" role="test" />
- <file md5sum="cee62aa6daacce199f4bcff29baaa770" name="tests/bson-corpus/decimal128-2-valid-016.phpt" role="test" />
- <file md5sum="8fb1a596f198f8dca07ad897ba785c44" name="tests/bson-corpus/decimal128-2-valid-017.phpt" role="test" />
- <file md5sum="0446235e9a03299e5056cc02af33710c" name="tests/bson-corpus/decimal128-2-valid-018.phpt" role="test" />
- <file md5sum="18f5d9e1b47d4a616382b538a8c96748" name="tests/bson-corpus/decimal128-2-valid-019.phpt" role="test" />
- <file md5sum="7687301937038736b52fabce10c4318d" name="tests/bson-corpus/decimal128-2-valid-020.phpt" role="test" />
- <file md5sum="f4e793063b75e6bdc63417fda9693333" name="tests/bson-corpus/decimal128-2-valid-021.phpt" role="test" />
- <file md5sum="9402b1bb065a1cd7e86b4926bf66b465" name="tests/bson-corpus/decimal128-2-valid-022.phpt" role="test" />
- <file md5sum="419293525c66ae26d2b20bb543814df4" name="tests/bson-corpus/decimal128-2-valid-023.phpt" role="test" />
- <file md5sum="2175c57d8e8cb92126c4c92b0ccfc488" name="tests/bson-corpus/decimal128-2-valid-024.phpt" role="test" />
- <file md5sum="0b1133406d9c82e15b84b85237be2bed" name="tests/bson-corpus/decimal128-2-valid-025.phpt" role="test" />
- <file md5sum="d466e879d9363723795783b4c4eb47ff" name="tests/bson-corpus/decimal128-2-valid-026.phpt" role="test" />
- <file md5sum="af2cd17bc30e18cbf53f942d8f362b47" name="tests/bson-corpus/decimal128-2-valid-027.phpt" role="test" />
- <file md5sum="6fbbd48bb5eb9f930e85fad5bead1519" name="tests/bson-corpus/decimal128-2-valid-028.phpt" role="test" />
- <file md5sum="15798456fa5e0d6452f1083b1fc5807b" name="tests/bson-corpus/decimal128-2-valid-029.phpt" role="test" />
- <file md5sum="de2f22e66df859f1013a9cfadfd6ba98" name="tests/bson-corpus/decimal128-2-valid-030.phpt" role="test" />
- <file md5sum="7eea0cf3baacbf61664f9d4daebcaba0" name="tests/bson-corpus/decimal128-2-valid-031.phpt" role="test" />
- <file md5sum="8854ca1f4536973749715dd8fc29c9da" name="tests/bson-corpus/decimal128-2-valid-032.phpt" role="test" />
- <file md5sum="7804c313c8e262224e2786cd658c5dfb" name="tests/bson-corpus/decimal128-2-valid-033.phpt" role="test" />
- <file md5sum="ecfcceb6d572ecc43d8f51f7b461052a" name="tests/bson-corpus/decimal128-2-valid-034.phpt" role="test" />
- <file md5sum="795cb7a559a455790f48b8d7099657e2" name="tests/bson-corpus/decimal128-2-valid-035.phpt" role="test" />
- <file md5sum="5294b8700c5b184ceeab7e3fdac9ac09" name="tests/bson-corpus/decimal128-2-valid-036.phpt" role="test" />
- <file md5sum="fa8c1f8e2471b1e88f70494e3d43a2a3" name="tests/bson-corpus/decimal128-2-valid-037.phpt" role="test" />
- <file md5sum="b26ceb09c9c9fb679ce2ae070b46e440" name="tests/bson-corpus/decimal128-2-valid-038.phpt" role="test" />
- <file md5sum="930c0a170ba388984e21ccc62befaa17" name="tests/bson-corpus/decimal128-2-valid-039.phpt" role="test" />
- <file md5sum="1fc738e64b9cadd5508a6eef087e9e6a" name="tests/bson-corpus/decimal128-2-valid-040.phpt" role="test" />
- <file md5sum="fd7e38aa78b293c936e6e30916154be2" name="tests/bson-corpus/decimal128-2-valid-041.phpt" role="test" />
- <file md5sum="f1a6c263b9f19ca118927987a3a3e960" name="tests/bson-corpus/decimal128-2-valid-042.phpt" role="test" />
- <file md5sum="dce7e447bd22e0e1b6ca368a0126f6c9" name="tests/bson-corpus/decimal128-2-valid-043.phpt" role="test" />
- <file md5sum="5250c400c16366276e85dd3a84a68464" name="tests/bson-corpus/decimal128-2-valid-044.phpt" role="test" />
- <file md5sum="d8ed4f32c9f21737c3db57d2ff9f517d" name="tests/bson-corpus/decimal128-2-valid-045.phpt" role="test" />
- <file md5sum="8da310bcd5248f1a4c788e57292fcbf3" name="tests/bson-corpus/decimal128-2-valid-046.phpt" role="test" />
- <file md5sum="b78100f032f9b07917f03f6f43b27032" name="tests/bson-corpus/decimal128-2-valid-047.phpt" role="test" />
- <file md5sum="fb9958f291c703f5c29a7f5572db3bcc" name="tests/bson-corpus/decimal128-2-valid-048.phpt" role="test" />
- <file md5sum="39f6a9f651550909f54aba9ce62ee4c5" name="tests/bson-corpus/decimal128-2-valid-049.phpt" role="test" />
- <file md5sum="de192bf93dc79e402aa334f45ba18b1e" name="tests/bson-corpus/decimal128-2-valid-050.phpt" role="test" />
- <file md5sum="3d67788e6781992107655e299446eddb" name="tests/bson-corpus/decimal128-2-valid-051.phpt" role="test" />
- <file md5sum="6e480e0a1b326ce956f40b40fb5ed094" name="tests/bson-corpus/decimal128-2-valid-052.phpt" role="test" />
- <file md5sum="b41ce0b1219941d0432219f37a710aa5" name="tests/bson-corpus/decimal128-2-valid-053.phpt" role="test" />
- <file md5sum="91b106e513924c9a611bc7a27919ce4b" name="tests/bson-corpus/decimal128-2-valid-054.phpt" role="test" />
- <file md5sum="4dfbe9e6347d72e4ba4403e722314b53" name="tests/bson-corpus/decimal128-2-valid-055.phpt" role="test" />
- <file md5sum="caf747e3fd2e28b322612199074487dd" name="tests/bson-corpus/decimal128-2-valid-056.phpt" role="test" />
- <file md5sum="30424dfa94cdaf355ca52920a787fd10" name="tests/bson-corpus/decimal128-2-valid-057.phpt" role="test" />
- <file md5sum="cf94d76866c57ff87907cafeb8fbe7e8" name="tests/bson-corpus/decimal128-2-valid-058.phpt" role="test" />
- <file md5sum="48e42590a32c360bb1861b691884c2a0" name="tests/bson-corpus/decimal128-2-valid-059.phpt" role="test" />
- <file md5sum="5eb9b793969b6fbf7adc222f285ad250" name="tests/bson-corpus/decimal128-2-valid-060.phpt" role="test" />
- <file md5sum="2365af956b837469db89cdbdc8778421" name="tests/bson-corpus/decimal128-2-valid-061.phpt" role="test" />
- <file md5sum="91d59d84d2ba39e6ba24ff68221d74f6" name="tests/bson-corpus/decimal128-2-valid-062.phpt" role="test" />
- <file md5sum="753a7e1af8e0a2d9975335e8ea3f140a" name="tests/bson-corpus/decimal128-2-valid-063.phpt" role="test" />
- <file md5sum="944e77c82029d92d3ff7140cf5dc5018" name="tests/bson-corpus/decimal128-2-valid-064.phpt" role="test" />
- <file md5sum="ea6e3558be75757726e0dd2e970c023c" name="tests/bson-corpus/decimal128-2-valid-065.phpt" role="test" />
- <file md5sum="ab5c5c8d5cdf13c31212a8b122a1f7d6" name="tests/bson-corpus/decimal128-2-valid-066.phpt" role="test" />
- <file md5sum="76a085cd5533ccb41e25c04ce208404d" name="tests/bson-corpus/decimal128-2-valid-067.phpt" role="test" />
- <file md5sum="4c038c0004299008f8530ee1905db50a" name="tests/bson-corpus/decimal128-2-valid-068.phpt" role="test" />
- <file md5sum="3f5cc49cc6ba45b816028b3cc92d264f" name="tests/bson-corpus/decimal128-2-valid-069.phpt" role="test" />
- <file md5sum="a7e88590454ce68e11ae15005f23082e" name="tests/bson-corpus/decimal128-2-valid-070.phpt" role="test" />
- <file md5sum="5bae02a95b54fd348d174eb3d85f04eb" name="tests/bson-corpus/decimal128-2-valid-071.phpt" role="test" />
- <file md5sum="ebd162d6f711b331e7accc7fa5c1d835" name="tests/bson-corpus/decimal128-2-valid-072.phpt" role="test" />
- <file md5sum="d235b6936bfecf314267d9c14953a7d4" name="tests/bson-corpus/decimal128-2-valid-073.phpt" role="test" />
- <file md5sum="c5ec17d328828052df60b7584bf38757" name="tests/bson-corpus/decimal128-2-valid-074.phpt" role="test" />
- <file md5sum="9ba36e27db6ecb0a0aa936a5b492b0b9" name="tests/bson-corpus/decimal128-2-valid-075.phpt" role="test" />
- <file md5sum="fb767d85a2edeae3c8bffa7d5760c10b" name="tests/bson-corpus/decimal128-2-valid-076.phpt" role="test" />
- <file md5sum="c6957d607d662ed2cc67330eb10f2402" name="tests/bson-corpus/decimal128-2-valid-077.phpt" role="test" />
- <file md5sum="681b2a2936c14f2004c7dec85d01b2e2" name="tests/bson-corpus/decimal128-2-valid-078.phpt" role="test" />
- <file md5sum="1b1f27774210373d6afcf151bbb07bca" name="tests/bson-corpus/decimal128-2-valid-079.phpt" role="test" />
- <file md5sum="e22ea399a7e6b673efbd0dc4c0888699" name="tests/bson-corpus/decimal128-2-valid-080.phpt" role="test" />
- <file md5sum="2788019eba5db7c958a9a1f2535c8c0d" name="tests/bson-corpus/decimal128-2-valid-081.phpt" role="test" />
- <file md5sum="e26769d5a2bde67c35f09c10a9de9dbf" name="tests/bson-corpus/decimal128-2-valid-082.phpt" role="test" />
- <file md5sum="5dcc949efe0bd05699a5600c8c7171b0" name="tests/bson-corpus/decimal128-2-valid-083.phpt" role="test" />
- <file md5sum="0c0e987a3230f753fe95372c7f90a32b" name="tests/bson-corpus/decimal128-2-valid-084.phpt" role="test" />
- <file md5sum="66c6528d392928c73aaee101bab0d4e7" name="tests/bson-corpus/decimal128-2-valid-085.phpt" role="test" />
- <file md5sum="4b4c6033d1cc69584ddc02d2cb61679c" name="tests/bson-corpus/decimal128-2-valid-086.phpt" role="test" />
- <file md5sum="9fef33369778b3b31af02f918bc940d1" name="tests/bson-corpus/decimal128-2-valid-087.phpt" role="test" />
- <file md5sum="83571d78ab83eb7d6f26039c06392f61" name="tests/bson-corpus/decimal128-2-valid-088.phpt" role="test" />
- <file md5sum="6f3abc25b06b28dd814748aefe26fbee" name="tests/bson-corpus/decimal128-2-valid-089.phpt" role="test" />
- <file md5sum="4bdd4a38167e036b0edc16fef1d0d7c0" name="tests/bson-corpus/decimal128-2-valid-090.phpt" role="test" />
- <file md5sum="f70773da403b020c400324ad86a7cef0" name="tests/bson-corpus/decimal128-2-valid-091.phpt" role="test" />
- <file md5sum="3b10869e9ebff2e3fe99adeb0932fb1c" name="tests/bson-corpus/decimal128-2-valid-092.phpt" role="test" />
- <file md5sum="0341f9cca69ca88f914acfa9c0b11dcd" name="tests/bson-corpus/decimal128-2-valid-093.phpt" role="test" />
- <file md5sum="5dd6ebcbd16e2d783fb924bc0168ced7" name="tests/bson-corpus/decimal128-2-valid-094.phpt" role="test" />
- <file md5sum="be4a8b9bec6e5e94d77ff089ff1d0ee1" name="tests/bson-corpus/decimal128-2-valid-095.phpt" role="test" />
- <file md5sum="442195cc8ef85c91e2fbef49122e628e" name="tests/bson-corpus/decimal128-2-valid-096.phpt" role="test" />
- <file md5sum="7b92d8695368b4974328d3bf221e46be" name="tests/bson-corpus/decimal128-2-valid-097.phpt" role="test" />
- <file md5sum="2e3ff697a3a2abd7b9ec13e52358ebb3" name="tests/bson-corpus/decimal128-2-valid-098.phpt" role="test" />
- <file md5sum="ec685a2e20a0ec15f6bf3ff73f360d85" name="tests/bson-corpus/decimal128-2-valid-099.phpt" role="test" />
- <file md5sum="4201a63bfd136d7e662938f67dd05254" name="tests/bson-corpus/decimal128-2-valid-100.phpt" role="test" />
- <file md5sum="2d08081f184061e053ebc445e5b8cd24" name="tests/bson-corpus/decimal128-2-valid-101.phpt" role="test" />
- <file md5sum="3a6ff963db42fcf64206e2de4ee780cc" name="tests/bson-corpus/decimal128-2-valid-102.phpt" role="test" />
- <file md5sum="540d5b91603c7357e8d89824d5719737" name="tests/bson-corpus/decimal128-2-valid-103.phpt" role="test" />
- <file md5sum="796fc26fd08560613f19d9083e020338" name="tests/bson-corpus/decimal128-2-valid-104.phpt" role="test" />
- <file md5sum="49df24fb744715760e55787d0957b5de" name="tests/bson-corpus/decimal128-2-valid-105.phpt" role="test" />
- <file md5sum="66855ccf81d802eb68391b0807feedaf" name="tests/bson-corpus/decimal128-2-valid-106.phpt" role="test" />
- <file md5sum="bbba9d352a373a719ccbe406d96ca835" name="tests/bson-corpus/decimal128-2-valid-107.phpt" role="test" />
- <file md5sum="52d7e75eec143dd82f2c90ef5d20dd73" name="tests/bson-corpus/decimal128-2-valid-108.phpt" role="test" />
- <file md5sum="b111889617eac3398d98dc2847efa454" name="tests/bson-corpus/decimal128-2-valid-109.phpt" role="test" />
- <file md5sum="25202c94a851caaa78be7cc01d338083" name="tests/bson-corpus/decimal128-2-valid-110.phpt" role="test" />
- <file md5sum="ac6afaac7a362f5418c78734fd34e8c0" name="tests/bson-corpus/decimal128-2-valid-111.phpt" role="test" />
- <file md5sum="b5900c5ed1adec986f86fa21bd0da84f" name="tests/bson-corpus/decimal128-2-valid-112.phpt" role="test" />
- <file md5sum="9cefd97e411d3ca7612875f1dc156f90" name="tests/bson-corpus/decimal128-2-valid-113.phpt" role="test" />
- <file md5sum="8aae5fee09f7e8a17a69c47bd1fee75e" name="tests/bson-corpus/decimal128-2-valid-114.phpt" role="test" />
- <file md5sum="e65ebb960f782a5013d39baaed48d41e" name="tests/bson-corpus/decimal128-2-valid-115.phpt" role="test" />
- <file md5sum="cac712953a826fb899b728b30e3cea8d" name="tests/bson-corpus/decimal128-2-valid-116.phpt" role="test" />
- <file md5sum="eff59a7472ca181c00839c6c7d87bd82" name="tests/bson-corpus/decimal128-2-valid-117.phpt" role="test" />
- <file md5sum="9320d637ed82864d61562da53a374d0a" name="tests/bson-corpus/decimal128-2-valid-118.phpt" role="test" />
- <file md5sum="5850b1ff7d5c26da1468534752e98ea3" name="tests/bson-corpus/decimal128-2-valid-119.phpt" role="test" />
- <file md5sum="5dcf443d0ccc15b32aa834069fa6c412" name="tests/bson-corpus/decimal128-2-valid-120.phpt" role="test" />
- <file md5sum="f85faa8be07f8d8173eb072a0570dc0e" name="tests/bson-corpus/decimal128-2-valid-121.phpt" role="test" />
- <file md5sum="573c4ccdfad6c9f0f59360c986ebd2c9" name="tests/bson-corpus/decimal128-2-valid-122.phpt" role="test" />
- <file md5sum="82c51a7042011e90499bf8170f28952d" name="tests/bson-corpus/decimal128-2-valid-123.phpt" role="test" />
- <file md5sum="b0d78129713054d1c026f070c1ba0dad" name="tests/bson-corpus/decimal128-2-valid-124.phpt" role="test" />
- <file md5sum="971f60d5191b863bd465b8cfe99fbb81" name="tests/bson-corpus/decimal128-2-valid-125.phpt" role="test" />
- <file md5sum="008c8b511828b32f4345e74f432f57a1" name="tests/bson-corpus/decimal128-2-valid-126.phpt" role="test" />
- <file md5sum="84014477bceff0f8d732a34e91400663" name="tests/bson-corpus/decimal128-2-valid-127.phpt" role="test" />
- <file md5sum="aa3df20a486284805f6633f613f4ff9c" name="tests/bson-corpus/decimal128-2-valid-128.phpt" role="test" />
- <file md5sum="8a0bb497bfac2faa7cee23cdc8d8a2c3" name="tests/bson-corpus/decimal128-2-valid-129.phpt" role="test" />
- <file md5sum="e880542c707e7fc3a0bb82ff519213ac" name="tests/bson-corpus/decimal128-2-valid-130.phpt" role="test" />
- <file md5sum="553bf9e872800102f95acd398629af64" name="tests/bson-corpus/decimal128-2-valid-131.phpt" role="test" />
- <file md5sum="77a7bcbcba9bd363342d9c7b830fae34" name="tests/bson-corpus/decimal128-2-valid-132.phpt" role="test" />
- <file md5sum="cff1328a6288da15f9350b68f8c5d489" name="tests/bson-corpus/decimal128-2-valid-133.phpt" role="test" />
- <file md5sum="0ee8ae38952b950651a7b43a57b8c60b" name="tests/bson-corpus/decimal128-2-valid-134.phpt" role="test" />
- <file md5sum="1ea5f4d4114b0706a6b8bd4ad46179c6" name="tests/bson-corpus/decimal128-2-valid-135.phpt" role="test" />
- <file md5sum="6330096fc3283f7ef5136caafa57b1bd" name="tests/bson-corpus/decimal128-2-valid-136.phpt" role="test" />
- <file md5sum="e6c4f50ff19a3e501ca6b573f3f47825" name="tests/bson-corpus/decimal128-2-valid-137.phpt" role="test" />
- <file md5sum="e3a7756627e40c90117bbd3e7e8d17a2" name="tests/bson-corpus/decimal128-2-valid-138.phpt" role="test" />
- <file md5sum="ba8acc01b63d6e8dd109c4c7997e2c6c" name="tests/bson-corpus/decimal128-2-valid-139.phpt" role="test" />
- <file md5sum="7fab66eb8d2f53b33375a0013a955d26" name="tests/bson-corpus/decimal128-2-valid-140.phpt" role="test" />
- <file md5sum="9f169b5e4371cbe24c056973cde84831" name="tests/bson-corpus/decimal128-2-valid-141.phpt" role="test" />
- <file md5sum="d5dfc064d6f4e5e448f42bd730fed054" name="tests/bson-corpus/decimal128-2-valid-142.phpt" role="test" />
- <file md5sum="fe97ba097b1d594eb1a09cd106a11854" name="tests/bson-corpus/decimal128-2-valid-143.phpt" role="test" />
- <file md5sum="867c2c7530dd452ba36f0fa0d7022d91" name="tests/bson-corpus/decimal128-2-valid-144.phpt" role="test" />
- <file md5sum="0bbc6e5d9a03298d265a72bddb8076b0" name="tests/bson-corpus/decimal128-2-valid-145.phpt" role="test" />
- <file md5sum="b4ba690f01910bca2af1d00954d80a9d" name="tests/bson-corpus/decimal128-2-valid-146.phpt" role="test" />
- <file md5sum="ea231b7006051408759096f712705fd7" name="tests/bson-corpus/decimal128-2-valid-147.phpt" role="test" />
- <file md5sum="df997d34321d8620ff8a35d810fd9b02" name="tests/bson-corpus/decimal128-2-valid-148.phpt" role="test" />
- <file md5sum="d4479dfa2cc526a133799b5e625181c3" name="tests/bson-corpus/decimal128-2-valid-149.phpt" role="test" />
- <file md5sum="a6a1e66f9c931b707885f8d094500ac9" name="tests/bson-corpus/decimal128-2-valid-150.phpt" role="test" />
- <file md5sum="3c92721f8d215a7c3fea8ac667706fba" name="tests/bson-corpus/decimal128-2-valid-151.phpt" role="test" />
- <file md5sum="8fd7c1533b61fe6eca0e58ea4a017cab" name="tests/bson-corpus/decimal128-2-valid-152.phpt" role="test" />
- <file md5sum="9748fe4d36fc0ceb9e72eb929748d760" name="tests/bson-corpus/decimal128-2-valid-153.phpt" role="test" />
- <file md5sum="8d6cb5244dd36b26cf92648de850307b" name="tests/bson-corpus/decimal128-2-valid-154.phpt" role="test" />
- <file md5sum="d9f95167b0f45e34bf472a405bb2cf11" name="tests/bson-corpus/decimal128-2-valid-155.phpt" role="test" />
- <file md5sum="d8a54fba958ab819f07e0addec0b977f" name="tests/bson-corpus/decimal128-2-valid-156.phpt" role="test" />
- <file md5sum="070b469361b80b8229357d23555aaf63" name="tests/bson-corpus/decimal128-2-valid-157.phpt" role="test" />
- <file md5sum="34ce63d06e50aa4944679b48de0de335" name="tests/bson-corpus/decimal128-3-valid-001.phpt" role="test" />
- <file md5sum="df328c1d2158b658942dce1a4c5bdfce" name="tests/bson-corpus/decimal128-3-valid-002.phpt" role="test" />
- <file md5sum="9bcf947760c6bb9a958234bc41afd4f4" name="tests/bson-corpus/decimal128-3-valid-003.phpt" role="test" />
- <file md5sum="180a4302dd151247a9a37cb5ce9d5d47" name="tests/bson-corpus/decimal128-3-valid-004.phpt" role="test" />
- <file md5sum="54b812360f1de0b104455a39c8889c9e" name="tests/bson-corpus/decimal128-3-valid-005.phpt" role="test" />
- <file md5sum="9f7c80841aacca871904857d6710cfa3" name="tests/bson-corpus/decimal128-3-valid-006.phpt" role="test" />
- <file md5sum="0293d8c4c2123f53c819c27730d86197" name="tests/bson-corpus/decimal128-3-valid-007.phpt" role="test" />
- <file md5sum="60e423b7c4a59f10532f6e10caf6e0ac" name="tests/bson-corpus/decimal128-3-valid-008.phpt" role="test" />
- <file md5sum="e19c736e10533f9fe6998ae25081d21c" name="tests/bson-corpus/decimal128-3-valid-009.phpt" role="test" />
- <file md5sum="965acf5ad70ef683da051811f71ad0bd" name="tests/bson-corpus/decimal128-3-valid-010.phpt" role="test" />
- <file md5sum="628c029a7d5c3d51b9d669f11741703e" name="tests/bson-corpus/decimal128-3-valid-011.phpt" role="test" />
- <file md5sum="05198752b5da78889234ed05f1be6993" name="tests/bson-corpus/decimal128-3-valid-012.phpt" role="test" />
- <file md5sum="2a19fe2d928be479d4da0d7b5fe8005f" name="tests/bson-corpus/decimal128-3-valid-013.phpt" role="test" />
- <file md5sum="3af90adbafbaa424d7b9f9318ff6db94" name="tests/bson-corpus/decimal128-3-valid-014.phpt" role="test" />
- <file md5sum="52114773cfeb41974cefc54e33ffa9fa" name="tests/bson-corpus/decimal128-3-valid-015.phpt" role="test" />
- <file md5sum="7076c929dbc5f535627e251811cb7187" name="tests/bson-corpus/decimal128-3-valid-016.phpt" role="test" />
- <file md5sum="e17cda3744c02f6a62114f0b9227ab49" name="tests/bson-corpus/decimal128-3-valid-017.phpt" role="test" />
- <file md5sum="61c8d58565c8d1224a9c0676d5513b4b" name="tests/bson-corpus/decimal128-3-valid-018.phpt" role="test" />
- <file md5sum="3baacae5cfebaa97ea82b6b86ca7f67f" name="tests/bson-corpus/decimal128-3-valid-019.phpt" role="test" />
- <file md5sum="6f0d7886b289c38462f5d73bab69429d" name="tests/bson-corpus/decimal128-3-valid-020.phpt" role="test" />
- <file md5sum="31733bfe4a02fd610b308f6ec295e011" name="tests/bson-corpus/decimal128-3-valid-021.phpt" role="test" />
- <file md5sum="848c7632ba9b923bf87fc62bd9f7d950" name="tests/bson-corpus/decimal128-3-valid-022.phpt" role="test" />
- <file md5sum="318f52f20af58648b597e5a0a84cb502" name="tests/bson-corpus/decimal128-3-valid-023.phpt" role="test" />
- <file md5sum="601d7464591e31244bf866bb08ed22b7" name="tests/bson-corpus/decimal128-3-valid-024.phpt" role="test" />
- <file md5sum="e8fff68562159a22cb3dd1cc18da37ae" name="tests/bson-corpus/decimal128-3-valid-025.phpt" role="test" />
- <file md5sum="1b3494487358e1a4f21d63a246e4d1d1" name="tests/bson-corpus/decimal128-3-valid-026.phpt" role="test" />
- <file md5sum="890ab1774515db8761dc156430f8d85c" name="tests/bson-corpus/decimal128-3-valid-027.phpt" role="test" />
- <file md5sum="e3eadea00725f55269ffca85c5f8c008" name="tests/bson-corpus/decimal128-3-valid-028.phpt" role="test" />
- <file md5sum="8fbb4f5ca491b489e81a7ce09d3949cb" name="tests/bson-corpus/decimal128-3-valid-029.phpt" role="test" />
- <file md5sum="f47494ab7e679e8818e1d6859bd5f127" name="tests/bson-corpus/decimal128-3-valid-030.phpt" role="test" />
- <file md5sum="2684997e4eb6f61274bf887accfeed4a" name="tests/bson-corpus/decimal128-3-valid-031.phpt" role="test" />
- <file md5sum="994338eb57c4179dd912901548d1f8ec" name="tests/bson-corpus/decimal128-3-valid-032.phpt" role="test" />
- <file md5sum="819721414a29a06d9955b0cad0f2125d" name="tests/bson-corpus/decimal128-3-valid-033.phpt" role="test" />
- <file md5sum="365a51312afc80e0fb501150c29e6459" name="tests/bson-corpus/decimal128-3-valid-034.phpt" role="test" />
- <file md5sum="e7a0116a4a1cc5505da6a5d9b57dabac" name="tests/bson-corpus/decimal128-3-valid-035.phpt" role="test" />
- <file md5sum="367042b8bc7cbc069a12e467b4ee808f" name="tests/bson-corpus/decimal128-3-valid-036.phpt" role="test" />
- <file md5sum="81a942f5107c4ff31de391acb675238a" name="tests/bson-corpus/decimal128-3-valid-037.phpt" role="test" />
- <file md5sum="18a0462849355e6152bfe9730c85bd62" name="tests/bson-corpus/decimal128-3-valid-038.phpt" role="test" />
- <file md5sum="9ac0dbafb449b20c8d4577134b3426b6" name="tests/bson-corpus/decimal128-3-valid-039.phpt" role="test" />
- <file md5sum="90ebcac3ae67c235aeb5238e1f4ec133" name="tests/bson-corpus/decimal128-3-valid-040.phpt" role="test" />
- <file md5sum="6251fd1a5f9e2c7fd74dfa63bbd62d7a" name="tests/bson-corpus/decimal128-3-valid-041.phpt" role="test" />
- <file md5sum="cca47ea381a8738e7b0099f460f2f8c0" name="tests/bson-corpus/decimal128-3-valid-042.phpt" role="test" />
- <file md5sum="f637d2f9517908f27030e3660196515b" name="tests/bson-corpus/decimal128-3-valid-043.phpt" role="test" />
- <file md5sum="bde96730654b79fd7b4078b07d282eef" name="tests/bson-corpus/decimal128-3-valid-044.phpt" role="test" />
- <file md5sum="ee71d0f43cd2f467813ca6a77dcf2d30" name="tests/bson-corpus/decimal128-3-valid-045.phpt" role="test" />
- <file md5sum="ff0e3aad7b641672842c802c49a958d6" name="tests/bson-corpus/decimal128-3-valid-046.phpt" role="test" />
- <file md5sum="94b54b1fb76f4b0eff34f4eb0e9f4405" name="tests/bson-corpus/decimal128-3-valid-047.phpt" role="test" />
- <file md5sum="52044d796ece83c2352f65673b6c1350" name="tests/bson-corpus/decimal128-3-valid-048.phpt" role="test" />
- <file md5sum="9ce69dba579892069c0e85917a7c8974" name="tests/bson-corpus/decimal128-3-valid-049.phpt" role="test" />
- <file md5sum="d8e88496d162ff5715f5501ef3c18b83" name="tests/bson-corpus/decimal128-3-valid-050.phpt" role="test" />
- <file md5sum="bac8d2811e73164fb379d31c0f913247" name="tests/bson-corpus/decimal128-3-valid-051.phpt" role="test" />
- <file md5sum="9e5fa37875831ef40eadf3c56ce823f2" name="tests/bson-corpus/decimal128-3-valid-052.phpt" role="test" />
- <file md5sum="798796c56a13185581d5ae58a64dbd46" name="tests/bson-corpus/decimal128-3-valid-053.phpt" role="test" />
- <file md5sum="29745eb4e3008772f3eb96a8eb9cee74" name="tests/bson-corpus/decimal128-3-valid-054.phpt" role="test" />
- <file md5sum="0d53d0dca5f8ef56e07f74b9961c9de5" name="tests/bson-corpus/decimal128-3-valid-055.phpt" role="test" />
- <file md5sum="369f39cc9176e7e5bf7771a5f41ee635" name="tests/bson-corpus/decimal128-3-valid-056.phpt" role="test" />
- <file md5sum="a5755fd2f1fd412503a52a8e71822f58" name="tests/bson-corpus/decimal128-3-valid-057.phpt" role="test" />
- <file md5sum="e70940764cd396ac7ba9ceca6869ae6c" name="tests/bson-corpus/decimal128-3-valid-058.phpt" role="test" />
- <file md5sum="81f941b52e9fb46279be381b17cd3382" name="tests/bson-corpus/decimal128-3-valid-059.phpt" role="test" />
- <file md5sum="34a9bfac2faf455c77e2eacff967eeac" name="tests/bson-corpus/decimal128-3-valid-060.phpt" role="test" />
- <file md5sum="359126abd17081eff11ce85b77b520f7" name="tests/bson-corpus/decimal128-3-valid-061.phpt" role="test" />
- <file md5sum="a648faf4b3d80ba1cfdc9babc6d1f2f4" name="tests/bson-corpus/decimal128-3-valid-062.phpt" role="test" />
- <file md5sum="ca9b3b5c19c652c7458b47d5d31d993c" name="tests/bson-corpus/decimal128-3-valid-063.phpt" role="test" />
- <file md5sum="476611f8de079cfd73a8ad165827b1e3" name="tests/bson-corpus/decimal128-3-valid-064.phpt" role="test" />
- <file md5sum="bb4d8b42a95eeff6952cf123aa8c50f7" name="tests/bson-corpus/decimal128-3-valid-065.phpt" role="test" />
- <file md5sum="1e49a8bddd4fb5d856a8946bfddedc72" name="tests/bson-corpus/decimal128-3-valid-066.phpt" role="test" />
- <file md5sum="63b3f358f5e98d0b14d8533570b94fbe" name="tests/bson-corpus/decimal128-3-valid-067.phpt" role="test" />
- <file md5sum="d7c9b5b0837ed0c9072a43c23f0ea79d" name="tests/bson-corpus/decimal128-3-valid-068.phpt" role="test" />
- <file md5sum="91642a109e973cb5ae8a6e73b8b383e5" name="tests/bson-corpus/decimal128-3-valid-069.phpt" role="test" />
- <file md5sum="2315a5f9acac305bd8c5b95b3e0504f1" name="tests/bson-corpus/decimal128-3-valid-070.phpt" role="test" />
- <file md5sum="d9d4d7744a2f7fd8a1503a3052db4ced" name="tests/bson-corpus/decimal128-3-valid-071.phpt" role="test" />
- <file md5sum="bf0656069ff0056699c12f9efafd1fdc" name="tests/bson-corpus/decimal128-3-valid-072.phpt" role="test" />
- <file md5sum="43fdb9db13d73a584253c80048aca85e" name="tests/bson-corpus/decimal128-3-valid-073.phpt" role="test" />
- <file md5sum="7f01cc48402ce9aa550f47f0085f5be6" name="tests/bson-corpus/decimal128-3-valid-074.phpt" role="test" />
- <file md5sum="56e888b90bb6d68d36a3420ab40fa2a2" name="tests/bson-corpus/decimal128-3-valid-075.phpt" role="test" />
- <file md5sum="c4747e234d72b0e9cf83de75e6e4596b" name="tests/bson-corpus/decimal128-3-valid-076.phpt" role="test" />
- <file md5sum="253e370c0292e398e2e2df3722030754" name="tests/bson-corpus/decimal128-3-valid-077.phpt" role="test" />
- <file md5sum="09da81d16a25a265188a09240668d394" name="tests/bson-corpus/decimal128-3-valid-078.phpt" role="test" />
- <file md5sum="9cf3e496ab05c2adfc02c39330a7445a" name="tests/bson-corpus/decimal128-3-valid-079.phpt" role="test" />
- <file md5sum="0518d4e8c881748990645a167f4f36cf" name="tests/bson-corpus/decimal128-3-valid-080.phpt" role="test" />
- <file md5sum="08eb0d3cad6adbb15a79456bfb2f026b" name="tests/bson-corpus/decimal128-3-valid-081.phpt" role="test" />
- <file md5sum="d6cb12e7bda8e841448e93b789b52dd6" name="tests/bson-corpus/decimal128-3-valid-082.phpt" role="test" />
- <file md5sum="bac369bafd38e7fafa2ba592e5d30489" name="tests/bson-corpus/decimal128-3-valid-083.phpt" role="test" />
- <file md5sum="7a48888dc58dbf811db159d2c10c843c" name="tests/bson-corpus/decimal128-3-valid-084.phpt" role="test" />
- <file md5sum="8e23f78cdac0b401de8262c3af50e356" name="tests/bson-corpus/decimal128-3-valid-085.phpt" role="test" />
- <file md5sum="be50c0aebd85dcbef025970c46cd913d" name="tests/bson-corpus/decimal128-3-valid-086.phpt" role="test" />
- <file md5sum="6751c5d768d4d52661269ece902566e1" name="tests/bson-corpus/decimal128-3-valid-087.phpt" role="test" />
- <file md5sum="9878d291035d1dc914bc82e1b5d5c584" name="tests/bson-corpus/decimal128-3-valid-088.phpt" role="test" />
- <file md5sum="0542decc55be115b2398094ae114ccc8" name="tests/bson-corpus/decimal128-3-valid-089.phpt" role="test" />
- <file md5sum="11e1ae724b83903286609d49928fd9d2" name="tests/bson-corpus/decimal128-3-valid-090.phpt" role="test" />
- <file md5sum="69676108995b60008c71a704eede26ce" name="tests/bson-corpus/decimal128-3-valid-091.phpt" role="test" />
- <file md5sum="73e811163a049f29878895044bc62a9d" name="tests/bson-corpus/decimal128-3-valid-092.phpt" role="test" />
- <file md5sum="f6ac7fd403b04684561c9fad043fc8ea" name="tests/bson-corpus/decimal128-3-valid-093.phpt" role="test" />
- <file md5sum="a8313d3d58d2d86ba3bc65e6ce8a4d26" name="tests/bson-corpus/decimal128-3-valid-094.phpt" role="test" />
- <file md5sum="2b5f4bf73e72166bdeeeadee235524c4" name="tests/bson-corpus/decimal128-3-valid-095.phpt" role="test" />
- <file md5sum="702c6144e3119b48c504f400434b9937" name="tests/bson-corpus/decimal128-3-valid-096.phpt" role="test" />
- <file md5sum="f1956970c8ad095e2121cababaad4374" name="tests/bson-corpus/decimal128-3-valid-097.phpt" role="test" />
- <file md5sum="c0d39b7a047fb6e79db8e8499acf7975" name="tests/bson-corpus/decimal128-3-valid-098.phpt" role="test" />
- <file md5sum="cd6605d45f8b50e1b912601c225b5aaa" name="tests/bson-corpus/decimal128-3-valid-099.phpt" role="test" />
- <file md5sum="3ae675145aa2e4fab775942feee47abd" name="tests/bson-corpus/decimal128-3-valid-100.phpt" role="test" />
- <file md5sum="3b464a872ae34247bdc420a98e8b0ed0" name="tests/bson-corpus/decimal128-3-valid-101.phpt" role="test" />
- <file md5sum="9ad48a9a8204c467f69b4513974b424d" name="tests/bson-corpus/decimal128-3-valid-102.phpt" role="test" />
- <file md5sum="ad81004f6f6dde066f37f2518d4276ad" name="tests/bson-corpus/decimal128-3-valid-103.phpt" role="test" />
- <file md5sum="8605780af705eed39e0a63687fbfabf8" name="tests/bson-corpus/decimal128-3-valid-104.phpt" role="test" />
- <file md5sum="03bd099aae2cd95304891a2024078d95" name="tests/bson-corpus/decimal128-3-valid-105.phpt" role="test" />
- <file md5sum="9b8753f1a0c682afc798e26f9bb7438c" name="tests/bson-corpus/decimal128-3-valid-106.phpt" role="test" />
- <file md5sum="287d867a9177b14f4a79675fe7de3a63" name="tests/bson-corpus/decimal128-3-valid-107.phpt" role="test" />
- <file md5sum="1fe640b7c1ce4fb9f1434668f924d291" name="tests/bson-corpus/decimal128-3-valid-108.phpt" role="test" />
- <file md5sum="04f4c79344465d3b97bf06af70f50fc9" name="tests/bson-corpus/decimal128-3-valid-109.phpt" role="test" />
- <file md5sum="135e27eb2013c1020a281dc274b5c5ad" name="tests/bson-corpus/decimal128-3-valid-110.phpt" role="test" />
- <file md5sum="b5b913cd09fa92954ef0f733ea75d034" name="tests/bson-corpus/decimal128-3-valid-111.phpt" role="test" />
- <file md5sum="5450dae06e8644a656e50f63aca7a59d" name="tests/bson-corpus/decimal128-3-valid-112.phpt" role="test" />
- <file md5sum="95d5dd6366600afad79399eadbf02d45" name="tests/bson-corpus/decimal128-3-valid-113.phpt" role="test" />
- <file md5sum="804eefe67a94dc093096379149d830ef" name="tests/bson-corpus/decimal128-3-valid-114.phpt" role="test" />
- <file md5sum="b2216f79aa2963b8125dc9255c216e9c" name="tests/bson-corpus/decimal128-3-valid-115.phpt" role="test" />
- <file md5sum="bcb72d39f0bbf6be1232811ada8b5452" name="tests/bson-corpus/decimal128-3-valid-116.phpt" role="test" />
- <file md5sum="9294200386f7d81ade24785c6adc6a4e" name="tests/bson-corpus/decimal128-3-valid-117.phpt" role="test" />
- <file md5sum="c2bba821bc6d48e512d277a8f9641e4e" name="tests/bson-corpus/decimal128-3-valid-118.phpt" role="test" />
- <file md5sum="6d0de9a32d83136fc3a6db0ca8783c6f" name="tests/bson-corpus/decimal128-3-valid-119.phpt" role="test" />
- <file md5sum="f870f22e48817f120623476ff39a9d5c" name="tests/bson-corpus/decimal128-3-valid-120.phpt" role="test" />
- <file md5sum="2b71fd8e044c4aa5874e789b4f8cacb6" name="tests/bson-corpus/decimal128-3-valid-121.phpt" role="test" />
- <file md5sum="4edc5e6640c225b79832bc2e0f48c726" name="tests/bson-corpus/decimal128-3-valid-122.phpt" role="test" />
- <file md5sum="d660ff8273614aaa01123cb5319d2fce" name="tests/bson-corpus/decimal128-3-valid-123.phpt" role="test" />
- <file md5sum="76ed3bc8e675cc584d1ecfd81874f0da" name="tests/bson-corpus/decimal128-3-valid-124.phpt" role="test" />
- <file md5sum="0e118b247fe378b22933eabce71addd5" name="tests/bson-corpus/decimal128-3-valid-125.phpt" role="test" />
- <file md5sum="ea4a57092893d65ebc6c10bd845f73da" name="tests/bson-corpus/decimal128-3-valid-126.phpt" role="test" />
- <file md5sum="033bd199b375c8d8edfc99557efb664c" name="tests/bson-corpus/decimal128-3-valid-127.phpt" role="test" />
- <file md5sum="b39431446dd3024d4586c5ee7a53a9c7" name="tests/bson-corpus/decimal128-3-valid-128.phpt" role="test" />
- <file md5sum="a5c5465e913593e71ebbdb9ddda2b7e0" name="tests/bson-corpus/decimal128-3-valid-129.phpt" role="test" />
- <file md5sum="48e9c801bc4e85c1b645c337484969dc" name="tests/bson-corpus/decimal128-3-valid-130.phpt" role="test" />
- <file md5sum="ff1fd438092fec37c43f5581074a8654" name="tests/bson-corpus/decimal128-3-valid-131.phpt" role="test" />
- <file md5sum="7a49e15bbe61c0f44f77032a0590dd08" name="tests/bson-corpus/decimal128-3-valid-132.phpt" role="test" />
- <file md5sum="41b5c0a8d472f19f445f18b1d2415103" name="tests/bson-corpus/decimal128-3-valid-133.phpt" role="test" />
- <file md5sum="ceedef671302bcfb2139ce9ec6f3d76d" name="tests/bson-corpus/decimal128-3-valid-134.phpt" role="test" />
- <file md5sum="102f119348c5131e67511ca4a826958f" name="tests/bson-corpus/decimal128-3-valid-135.phpt" role="test" />
- <file md5sum="93a232d6dd61f6b9c4c8385393ebdef4" name="tests/bson-corpus/decimal128-3-valid-136.phpt" role="test" />
- <file md5sum="f01d124d3b1b4174de15fa782ed5a8a6" name="tests/bson-corpus/decimal128-3-valid-137.phpt" role="test" />
- <file md5sum="919ce4fdde473d6479e43e9dfdb0e186" name="tests/bson-corpus/decimal128-3-valid-138.phpt" role="test" />
- <file md5sum="53b86c3935f6cd6af126b8218d94e160" name="tests/bson-corpus/decimal128-3-valid-139.phpt" role="test" />
- <file md5sum="7bd66fd3bffdeff24d9dd3ccd5b877a8" name="tests/bson-corpus/decimal128-3-valid-140.phpt" role="test" />
- <file md5sum="b6b0407bba7493ada8641c3ea20cb0f3" name="tests/bson-corpus/decimal128-3-valid-141.phpt" role="test" />
- <file md5sum="1f753ad00b8f28fbc904442a4a1c00d2" name="tests/bson-corpus/decimal128-3-valid-142.phpt" role="test" />
- <file md5sum="9c56975628864c07cdb1a987d32af308" name="tests/bson-corpus/decimal128-3-valid-143.phpt" role="test" />
- <file md5sum="46e1f60aea42cb626a6a8c6e2e8aed24" name="tests/bson-corpus/decimal128-3-valid-144.phpt" role="test" />
- <file md5sum="dfb1c9f2a6677a54b38e15a00a076206" name="tests/bson-corpus/decimal128-3-valid-145.phpt" role="test" />
- <file md5sum="483b6f3b8adbdffe6b2822d45ac27fdd" name="tests/bson-corpus/decimal128-3-valid-146.phpt" role="test" />
- <file md5sum="34280ee40ad731d5fd74e2896627bcfa" name="tests/bson-corpus/decimal128-3-valid-147.phpt" role="test" />
- <file md5sum="f50691f53242893865a5e7e8167efdf3" name="tests/bson-corpus/decimal128-3-valid-148.phpt" role="test" />
- <file md5sum="6caa2f259d2a4d4fec8bfae1c189cd29" name="tests/bson-corpus/decimal128-3-valid-149.phpt" role="test" />
- <file md5sum="a174e644ef93e3bbf40b9b1b22de211f" name="tests/bson-corpus/decimal128-3-valid-150.phpt" role="test" />
- <file md5sum="d5cdcd6aa65dff7129d65080a273b28d" name="tests/bson-corpus/decimal128-3-valid-151.phpt" role="test" />
- <file md5sum="aa21bd5fb048c7dcd081e666b2658a32" name="tests/bson-corpus/decimal128-3-valid-152.phpt" role="test" />
- <file md5sum="06d138aad451e764f3c5160374acc456" name="tests/bson-corpus/decimal128-3-valid-153.phpt" role="test" />
- <file md5sum="60ed7e43676c63a4f05eed0e23b97f21" name="tests/bson-corpus/decimal128-3-valid-154.phpt" role="test" />
- <file md5sum="698c194680b1a261a9040d05bcfdb6f0" name="tests/bson-corpus/decimal128-3-valid-155.phpt" role="test" />
- <file md5sum="8fca768c3428aea430c5307c80e72d7d" name="tests/bson-corpus/decimal128-3-valid-156.phpt" role="test" />
- <file md5sum="7ccffdab18207ff6ac931876e8819158" name="tests/bson-corpus/decimal128-3-valid-157.phpt" role="test" />
- <file md5sum="ff3d7be550b35a00d313cb74a1d2ae94" name="tests/bson-corpus/decimal128-3-valid-158.phpt" role="test" />
- <file md5sum="6313e9b84336ea9a22034df9f5ae4278" name="tests/bson-corpus/decimal128-3-valid-159.phpt" role="test" />
- <file md5sum="af457cac1c796d177c0ddced3cb7b507" name="tests/bson-corpus/decimal128-3-valid-160.phpt" role="test" />
- <file md5sum="5a3c16d9b930348d2f25feb9174b630d" name="tests/bson-corpus/decimal128-3-valid-161.phpt" role="test" />
- <file md5sum="78af9a90018a3174bd3225f806abc98c" name="tests/bson-corpus/decimal128-3-valid-162.phpt" role="test" />
- <file md5sum="bab6fe8749117af054525b4b3148b59b" name="tests/bson-corpus/decimal128-3-valid-163.phpt" role="test" />
- <file md5sum="e80be94522fe70a126623c4e347439fc" name="tests/bson-corpus/decimal128-3-valid-164.phpt" role="test" />
- <file md5sum="b1c1243a7a52aea8e15f685d03afefad" name="tests/bson-corpus/decimal128-3-valid-165.phpt" role="test" />
- <file md5sum="74d49b5f3409db69768e4daa20da44c6" name="tests/bson-corpus/decimal128-3-valid-166.phpt" role="test" />
- <file md5sum="12fc4d315fddfc77dac54e611710e35c" name="tests/bson-corpus/decimal128-3-valid-167.phpt" role="test" />
- <file md5sum="cf310a36aae9825fdd782acf3c16ba8a" name="tests/bson-corpus/decimal128-3-valid-168.phpt" role="test" />
- <file md5sum="453122b2d589ce01ad556a47bf49c83b" name="tests/bson-corpus/decimal128-3-valid-169.phpt" role="test" />
- <file md5sum="d741c0b4b531ca79835fbe40ac29f274" name="tests/bson-corpus/decimal128-3-valid-170.phpt" role="test" />
- <file md5sum="bb0ce34b58847ffa1c78d4146f7418a0" name="tests/bson-corpus/decimal128-3-valid-171.phpt" role="test" />
- <file md5sum="69f67ca42b68a6de8f8c3b1d40646dfc" name="tests/bson-corpus/decimal128-3-valid-172.phpt" role="test" />
- <file md5sum="b65a2e3284509b9c5e462a264627bcb9" name="tests/bson-corpus/decimal128-3-valid-173.phpt" role="test" />
- <file md5sum="c9bd868906728cabd730205804a164ab" name="tests/bson-corpus/decimal128-3-valid-174.phpt" role="test" />
- <file md5sum="b305dcd7417ad764dd2957e1027287c5" name="tests/bson-corpus/decimal128-3-valid-175.phpt" role="test" />
- <file md5sum="d5af17d98c8c607b0d5282bbf6182920" name="tests/bson-corpus/decimal128-3-valid-176.phpt" role="test" />
- <file md5sum="ea5fc2dd9f80691d17cac7f090f71d90" name="tests/bson-corpus/decimal128-3-valid-177.phpt" role="test" />
- <file md5sum="7952b43a5122c26a8ca2246fad1bb2ba" name="tests/bson-corpus/decimal128-3-valid-178.phpt" role="test" />
- <file md5sum="d85eb123995adc0d78b1740884ef2685" name="tests/bson-corpus/decimal128-3-valid-179.phpt" role="test" />
- <file md5sum="c728812d21d551ab4dff6408af92be0f" name="tests/bson-corpus/decimal128-3-valid-180.phpt" role="test" />
- <file md5sum="c76e2b2c5bdfe687573356e00a97fbdf" name="tests/bson-corpus/decimal128-3-valid-181.phpt" role="test" />
- <file md5sum="829e8f36fa61407de01d27bd9eeef27c" name="tests/bson-corpus/decimal128-3-valid-182.phpt" role="test" />
- <file md5sum="d3ccc5c3981cd94f355639c378e4677b" name="tests/bson-corpus/decimal128-3-valid-183.phpt" role="test" />
- <file md5sum="9504c6aa7b80b8db9184cb52474f6c85" name="tests/bson-corpus/decimal128-3-valid-184.phpt" role="test" />
- <file md5sum="2a9eeffd0beef95d467064de10f02de9" name="tests/bson-corpus/decimal128-3-valid-185.phpt" role="test" />
- <file md5sum="f47be02dfa343467cb9e6ee3417c3dd7" name="tests/bson-corpus/decimal128-3-valid-186.phpt" role="test" />
- <file md5sum="96d35bfcaa77ef683578e6c270758790" name="tests/bson-corpus/decimal128-3-valid-187.phpt" role="test" />
- <file md5sum="47e5c49caf081b6129518717e0963882" name="tests/bson-corpus/decimal128-3-valid-188.phpt" role="test" />
- <file md5sum="7a90df09c7c531d3faf54764b9033ccb" name="tests/bson-corpus/decimal128-3-valid-189.phpt" role="test" />
- <file md5sum="2564d7a605f7c459b57ed68b6e9a4fe0" name="tests/bson-corpus/decimal128-3-valid-190.phpt" role="test" />
- <file md5sum="164acbaf5bd1fb0285b44c1bbf869cf3" name="tests/bson-corpus/decimal128-3-valid-191.phpt" role="test" />
- <file md5sum="69f2c6581d8069f7eec36c31ee852d9c" name="tests/bson-corpus/decimal128-3-valid-192.phpt" role="test" />
- <file md5sum="347b7859ac548820b806f92a9baac4d8" name="tests/bson-corpus/decimal128-3-valid-193.phpt" role="test" />
- <file md5sum="6cace49760bbafb3fb3741e3e0de8b46" name="tests/bson-corpus/decimal128-3-valid-194.phpt" role="test" />
- <file md5sum="7d54c24b910eae152d58eb12fa151c32" name="tests/bson-corpus/decimal128-3-valid-195.phpt" role="test" />
- <file md5sum="429a273911a483c2c57755ad8e001d7b" name="tests/bson-corpus/decimal128-3-valid-196.phpt" role="test" />
- <file md5sum="2832812b1b6ce8d2fd9b5daac398ee49" name="tests/bson-corpus/decimal128-3-valid-197.phpt" role="test" />
- <file md5sum="27874826657d1ba50af6b3a8fffca76c" name="tests/bson-corpus/decimal128-3-valid-198.phpt" role="test" />
- <file md5sum="8b71ad45296b088c0dd63330a23ecd4f" name="tests/bson-corpus/decimal128-3-valid-199.phpt" role="test" />
- <file md5sum="92f0aa39dc57b06ac3c3ce0ce7ad610e" name="tests/bson-corpus/decimal128-3-valid-200.phpt" role="test" />
- <file md5sum="3d152e470dfc642c980ad1a432d0349f" name="tests/bson-corpus/decimal128-3-valid-201.phpt" role="test" />
- <file md5sum="c6f013f11312804349500ecc1e8a3351" name="tests/bson-corpus/decimal128-3-valid-202.phpt" role="test" />
- <file md5sum="6848f1bc8eca604b55c47fc8aa38fe75" name="tests/bson-corpus/decimal128-3-valid-203.phpt" role="test" />
- <file md5sum="d3caea6474c2e1bd8f654955fc64aa2e" name="tests/bson-corpus/decimal128-3-valid-204.phpt" role="test" />
- <file md5sum="0f8fc5ab722aa03bc3fc7e3860c9a077" name="tests/bson-corpus/decimal128-3-valid-205.phpt" role="test" />
- <file md5sum="8e24ccc73ba8342df00c84d031148604" name="tests/bson-corpus/decimal128-3-valid-206.phpt" role="test" />
- <file md5sum="ec75b7a5cffe375b83dd42d27a9e2d1b" name="tests/bson-corpus/decimal128-3-valid-207.phpt" role="test" />
- <file md5sum="f7c54531b297db29bb31515d63682bc1" name="tests/bson-corpus/decimal128-3-valid-208.phpt" role="test" />
- <file md5sum="a7f1b30a6a5b7c66173a83d7ee961929" name="tests/bson-corpus/decimal128-3-valid-209.phpt" role="test" />
- <file md5sum="c7684068a7e28cb83f38fbe8fa839817" name="tests/bson-corpus/decimal128-3-valid-210.phpt" role="test" />
- <file md5sum="f4b13a599e9a1472afc2e8d3fa9024ec" name="tests/bson-corpus/decimal128-3-valid-211.phpt" role="test" />
- <file md5sum="00958f5dc092ab03b9416901f2ca420f" name="tests/bson-corpus/decimal128-3-valid-212.phpt" role="test" />
- <file md5sum="bf9dad19e8fa0f2d0263a882a7bd8ff0" name="tests/bson-corpus/decimal128-3-valid-213.phpt" role="test" />
- <file md5sum="b56f4a4785368c98157a59d654511b09" name="tests/bson-corpus/decimal128-3-valid-214.phpt" role="test" />
- <file md5sum="ce4fdc35eb9250c5b9393f6bb8f3a1df" name="tests/bson-corpus/decimal128-3-valid-215.phpt" role="test" />
- <file md5sum="4f5f37a624b349a30d5d7db07bd7f8f1" name="tests/bson-corpus/decimal128-3-valid-216.phpt" role="test" />
- <file md5sum="0cc395f87f42a8aa0dcc4b12815d2be9" name="tests/bson-corpus/decimal128-3-valid-217.phpt" role="test" />
- <file md5sum="b930c8c6c6e6585035a1c66e22aa93eb" name="tests/bson-corpus/decimal128-3-valid-218.phpt" role="test" />
- <file md5sum="25b18102a0465f8eb725d60ed7804aae" name="tests/bson-corpus/decimal128-3-valid-219.phpt" role="test" />
- <file md5sum="9cdc0a1bae62b587da3359e7835df88c" name="tests/bson-corpus/decimal128-3-valid-220.phpt" role="test" />
- <file md5sum="e7507fadc34ba39c785caf3afb433124" name="tests/bson-corpus/decimal128-3-valid-221.phpt" role="test" />
- <file md5sum="e051c0f931bc32024c89135fd968a1eb" name="tests/bson-corpus/decimal128-3-valid-222.phpt" role="test" />
- <file md5sum="1323db4f58f17eff6aa0ed1d3e00fb30" name="tests/bson-corpus/decimal128-3-valid-223.phpt" role="test" />
- <file md5sum="45bdd12b7abcb5f8f89a63777da88f43" name="tests/bson-corpus/decimal128-3-valid-224.phpt" role="test" />
- <file md5sum="4396d4763a727c77b2f9a0b0863346b2" name="tests/bson-corpus/decimal128-3-valid-225.phpt" role="test" />
- <file md5sum="99b4a3961fbf77dc7acd6800ebca9c75" name="tests/bson-corpus/decimal128-3-valid-226.phpt" role="test" />
- <file md5sum="2369608b5fed1db23661d54259da490b" name="tests/bson-corpus/decimal128-3-valid-227.phpt" role="test" />
- <file md5sum="947d659f83807f67e858859a6b033ec4" name="tests/bson-corpus/decimal128-3-valid-228.phpt" role="test" />
- <file md5sum="30ae76f8a7f60a2398c3f510cb207f25" name="tests/bson-corpus/decimal128-3-valid-229.phpt" role="test" />
- <file md5sum="86f36843eca5e1ced0ef3444694aef0b" name="tests/bson-corpus/decimal128-3-valid-230.phpt" role="test" />
- <file md5sum="664bbaa8c107f0fce2767a088a12b791" name="tests/bson-corpus/decimal128-3-valid-231.phpt" role="test" />
- <file md5sum="0c4f8fb0b5c2a24119261dd8cb7c611c" name="tests/bson-corpus/decimal128-3-valid-232.phpt" role="test" />
- <file md5sum="d75b88a50714e5b2dde675bbecb5af67" name="tests/bson-corpus/decimal128-3-valid-233.phpt" role="test" />
- <file md5sum="50031e356b25cc6bcdc6ec6feabdbaaa" name="tests/bson-corpus/decimal128-3-valid-234.phpt" role="test" />
- <file md5sum="a25eb0e75c2af7bd90aada71bddd9320" name="tests/bson-corpus/decimal128-3-valid-235.phpt" role="test" />
- <file md5sum="89482d2a83c13c53346f59a5b5694125" name="tests/bson-corpus/decimal128-3-valid-236.phpt" role="test" />
- <file md5sum="4c9877820e4836a88496db7de7321f33" name="tests/bson-corpus/decimal128-3-valid-237.phpt" role="test" />
- <file md5sum="67cd9f43beb81a49ec625d536a271127" name="tests/bson-corpus/decimal128-3-valid-238.phpt" role="test" />
- <file md5sum="75cf91ed5d8caa16a200f8471c468f0f" name="tests/bson-corpus/decimal128-3-valid-239.phpt" role="test" />
- <file md5sum="1862658ccdb34e863796b317ce135d5d" name="tests/bson-corpus/decimal128-3-valid-240.phpt" role="test" />
- <file md5sum="95d2c1258eda3145275a8f042232d821" name="tests/bson-corpus/decimal128-3-valid-241.phpt" role="test" />
- <file md5sum="6f2a12b7c3346e02d8d9df70dbf24443" name="tests/bson-corpus/decimal128-3-valid-242.phpt" role="test" />
- <file md5sum="ca041a60616750c6fd631e785aecf06a" name="tests/bson-corpus/decimal128-3-valid-243.phpt" role="test" />
- <file md5sum="182f0e57202ed38f3b52deba31b7830a" name="tests/bson-corpus/decimal128-3-valid-244.phpt" role="test" />
- <file md5sum="8a00aadf85b1dd97fb7d432886d045aa" name="tests/bson-corpus/decimal128-3-valid-245.phpt" role="test" />
- <file md5sum="0461bbc97f686051b08e6a5bbb53b959" name="tests/bson-corpus/decimal128-3-valid-246.phpt" role="test" />
- <file md5sum="a4621259bd5fa3d8799066a099f83ee8" name="tests/bson-corpus/decimal128-3-valid-247.phpt" role="test" />
- <file md5sum="02d0781517ee131ac6824feda1ee3d06" name="tests/bson-corpus/decimal128-3-valid-248.phpt" role="test" />
- <file md5sum="70e8b607541f4be7e319abc6e7851d23" name="tests/bson-corpus/decimal128-3-valid-249.phpt" role="test" />
- <file md5sum="87ed40582612e5fb716b79cb35f4fd3f" name="tests/bson-corpus/decimal128-3-valid-250.phpt" role="test" />
- <file md5sum="8df6fd7da9c803f09e2123d8e908cf6f" name="tests/bson-corpus/decimal128-3-valid-251.phpt" role="test" />
- <file md5sum="303eca9da56f6fc952c57a349886a047" name="tests/bson-corpus/decimal128-3-valid-252.phpt" role="test" />
- <file md5sum="d5219e0fe85d9e20ee278e8b0df66164" name="tests/bson-corpus/decimal128-3-valid-253.phpt" role="test" />
- <file md5sum="c392834bd6a188890ca34ba35e3d1da5" name="tests/bson-corpus/decimal128-3-valid-254.phpt" role="test" />
- <file md5sum="74bff884a0f11350fda93122266b47de" name="tests/bson-corpus/decimal128-3-valid-255.phpt" role="test" />
- <file md5sum="a8aae300a1bbea5a59f982dd1d04a7d8" name="tests/bson-corpus/decimal128-3-valid-256.phpt" role="test" />
- <file md5sum="64d3badff7261c4f8c396180228e9263" name="tests/bson-corpus/decimal128-3-valid-257.phpt" role="test" />
- <file md5sum="72863a6b340184d2efc06bec4b0b1b52" name="tests/bson-corpus/decimal128-3-valid-258.phpt" role="test" />
- <file md5sum="1a18988ad9f4645ec716c5728de5123d" name="tests/bson-corpus/decimal128-3-valid-259.phpt" role="test" />
- <file md5sum="217fb1e340d68c7ebeed3b1812e75007" name="tests/bson-corpus/decimal128-3-valid-260.phpt" role="test" />
- <file md5sum="479050beb76594438da5e46d5b11ab1f" name="tests/bson-corpus/decimal128-3-valid-261.phpt" role="test" />
- <file md5sum="642266524c9f30a9883d406db25f962f" name="tests/bson-corpus/decimal128-3-valid-262.phpt" role="test" />
- <file md5sum="90c6819ad16d227ddc9bd08874a1a38f" name="tests/bson-corpus/decimal128-3-valid-263.phpt" role="test" />
- <file md5sum="9edb6624bcfcee4ab0ab3c70861e6429" name="tests/bson-corpus/decimal128-3-valid-264.phpt" role="test" />
- <file md5sum="865052b3dc114e727e94fe3ea35fe374" name="tests/bson-corpus/decimal128-3-valid-265.phpt" role="test" />
- <file md5sum="db8cedb3eb82fe29bbaa90e1971380ee" name="tests/bson-corpus/decimal128-3-valid-266.phpt" role="test" />
- <file md5sum="9f466e601b029010cc581ff0b5f6611b" name="tests/bson-corpus/decimal128-3-valid-267.phpt" role="test" />
- <file md5sum="390e8afe134fee7238646a72d5984ba1" name="tests/bson-corpus/decimal128-3-valid-268.phpt" role="test" />
- <file md5sum="a26942ae9397497efc6645fec446948f" name="tests/bson-corpus/decimal128-3-valid-269.phpt" role="test" />
- <file md5sum="73f302c571efdfa0718b66c8f0586e49" name="tests/bson-corpus/decimal128-3-valid-270.phpt" role="test" />
- <file md5sum="788c2ae67bbb0fe0ac1f184b2fad9b8f" name="tests/bson-corpus/decimal128-3-valid-271.phpt" role="test" />
- <file md5sum="a96eef0690ad802e3fd7055ce15dc8f2" name="tests/bson-corpus/decimal128-3-valid-272.phpt" role="test" />
- <file md5sum="670c9c570cd11238d78939b84fd3495d" name="tests/bson-corpus/decimal128-3-valid-273.phpt" role="test" />
- <file md5sum="d087bd4fb582aaf15cac1f6487e85f1b" name="tests/bson-corpus/decimal128-3-valid-274.phpt" role="test" />
- <file md5sum="bffaad4ce838bd0f05572805f4a792b3" name="tests/bson-corpus/decimal128-3-valid-275.phpt" role="test" />
- <file md5sum="69df3124a8fc7c86f5d6a8872a9ea53b" name="tests/bson-corpus/decimal128-3-valid-276.phpt" role="test" />
- <file md5sum="8c5513d50689ca1d35d1fb2c9df7bf2f" name="tests/bson-corpus/decimal128-3-valid-277.phpt" role="test" />
- <file md5sum="ee2b602524107eff28c4d72402773ba4" name="tests/bson-corpus/decimal128-3-valid-278.phpt" role="test" />
- <file md5sum="03db443213b04fa200cf3b7507796f32" name="tests/bson-corpus/decimal128-3-valid-279.phpt" role="test" />
- <file md5sum="ca8fbc712096a759a73bf075780e647f" name="tests/bson-corpus/decimal128-3-valid-280.phpt" role="test" />
- <file md5sum="5385fc73f83bbcfa4201c7783f496b72" name="tests/bson-corpus/decimal128-3-valid-281.phpt" role="test" />
- <file md5sum="a816d6cbd31c7707200bdf7eb936bff7" name="tests/bson-corpus/decimal128-3-valid-282.phpt" role="test" />
- <file md5sum="2f4497bacc3ff1d2b02833b0a295eaf4" name="tests/bson-corpus/decimal128-3-valid-283.phpt" role="test" />
- <file md5sum="5c661b0156dc44a6b91f314c4b0f2509" name="tests/bson-corpus/decimal128-3-valid-284.phpt" role="test" />
- <file md5sum="009d8193db88b5b9d866d712847fc389" name="tests/bson-corpus/decimal128-3-valid-285.phpt" role="test" />
- <file md5sum="f528d64653839930b2725b0295074e3d" name="tests/bson-corpus/decimal128-3-valid-286.phpt" role="test" />
- <file md5sum="e08f16db3d1d683b3e42f8b719c9a3ec" name="tests/bson-corpus/decimal128-3-valid-287.phpt" role="test" />
- <file md5sum="a2723797d475df77bfa469aafcd1c23f" name="tests/bson-corpus/decimal128-3-valid-288.phpt" role="test" />
- <file md5sum="7adc561fcc55c39f9b3952c1e642bc35" name="tests/bson-corpus/decimal128-3-valid-289.phpt" role="test" />
- <file md5sum="d9e1e6515ace82b87d62155d6f690302" name="tests/bson-corpus/decimal128-3-valid-290.phpt" role="test" />
- <file md5sum="56dc7d83c6e060c7b4307d0b7b9a6c0a" name="tests/bson-corpus/decimal128-3-valid-291.phpt" role="test" />
- <file md5sum="92c4a118b61e0f354fe29e2e3a190a30" name="tests/bson-corpus/decimal128-3-valid-292.phpt" role="test" />
- <file md5sum="74385ffc43126c1f584a31d022803ecf" name="tests/bson-corpus/decimal128-3-valid-293.phpt" role="test" />
- <file md5sum="6d7e8945e86aa6f43e34849ae7ca019f" name="tests/bson-corpus/decimal128-3-valid-294.phpt" role="test" />
- <file md5sum="19cc48ff2f3d7c0ac7463d051d546e5d" name="tests/bson-corpus/decimal128-3-valid-295.phpt" role="test" />
- <file md5sum="046aea2e28cffc3c5ebc17d570c93303" name="tests/bson-corpus/decimal128-3-valid-296.phpt" role="test" />
- <file md5sum="4a82366da632db80ae0d4ce74967849e" name="tests/bson-corpus/decimal128-3-valid-297.phpt" role="test" />
- <file md5sum="9be11a5077f99d2e967124da5be6966d" name="tests/bson-corpus/decimal128-3-valid-298.phpt" role="test" />
- <file md5sum="b952249c6ff1df0a12cf97167dea0761" name="tests/bson-corpus/decimal128-3-valid-299.phpt" role="test" />
- <file md5sum="1dbd6aa53f3fd22835c60700d768cc64" name="tests/bson-corpus/decimal128-3-valid-300.phpt" role="test" />
- <file md5sum="4a4333c5beba793ea2f9da8f3eead9cb" name="tests/bson-corpus/decimal128-3-valid-301.phpt" role="test" />
- <file md5sum="504ce3bd1b863d0a304e1bec32b16964" name="tests/bson-corpus/decimal128-3-valid-302.phpt" role="test" />
- <file md5sum="ddaef1de98c84dc697ebd60ee31d7c01" name="tests/bson-corpus/decimal128-3-valid-303.phpt" role="test" />
- <file md5sum="1b84be6a6b81415243b515b8606f38b4" name="tests/bson-corpus/decimal128-3-valid-304.phpt" role="test" />
- <file md5sum="1582fb1c5fcdeb152698567ce67c598e" name="tests/bson-corpus/decimal128-3-valid-305.phpt" role="test" />
- <file md5sum="18db5afa1316af3b9de7d839153df780" name="tests/bson-corpus/decimal128-3-valid-306.phpt" role="test" />
- <file md5sum="e66e488feb111d4d69ce77360329c898" name="tests/bson-corpus/decimal128-3-valid-307.phpt" role="test" />
- <file md5sum="ef802778b9b3518610ace5dd8ea6b74c" name="tests/bson-corpus/decimal128-3-valid-308.phpt" role="test" />
+ <file md5sum="d30a9716dfe9739fdc1b000f248606b0" name="tests/bson-corpus/dbpointer-valid-001.phpt" role="test" />
+ <file md5sum="aff692ece894dd3059c3e9234261b8ff" name="tests/bson-corpus/dbpointer-valid-002.phpt" role="test" />
+ <file md5sum="affccbb4fd19052bb1e469dff615a189" name="tests/bson-corpus/dbpointer-valid-003.phpt" role="test" />
+ <file md5sum="8fabeb0d7363bcb058e18e25f6eeb5ab" name="tests/bson-corpus/dbref-valid-001.phpt" role="test" />
+ <file md5sum="c01bfda7dff18e8508964a27e8517200" name="tests/bson-corpus/dbref-valid-002.phpt" role="test" />
+ <file md5sum="a711d0f08a0793cd1cfd4100d084fe49" name="tests/bson-corpus/dbref-valid-003.phpt" role="test" />
+ <file md5sum="a4b8ffa02a7cab67d501ba6802becd19" name="tests/bson-corpus/dbref-valid-004.phpt" role="test" />
+ <file md5sum="c027bfabe664062627b9684bce9ffb53" name="tests/bson-corpus/dbref-valid-005.phpt" role="test" />
+ <file md5sum="8acfe21edfce00b981b8060be5a2cb71" name="tests/bson-corpus/decimal128-1-valid-001.phpt" role="test" />
+ <file md5sum="82bb870b7ae9e6d4597404cb3cda63e8" name="tests/bson-corpus/decimal128-1-valid-002.phpt" role="test" />
+ <file md5sum="98bc334aa765e8789baee8655ff90d53" name="tests/bson-corpus/decimal128-1-valid-003.phpt" role="test" />
+ <file md5sum="9f643dad97453f768d795aef20acaad9" name="tests/bson-corpus/decimal128-1-valid-004.phpt" role="test" />
+ <file md5sum="c2a223ebb10fe5b48535e9f4fb3be4a8" name="tests/bson-corpus/decimal128-1-valid-005.phpt" role="test" />
+ <file md5sum="272a61be3c457e3823c5c7f6971a9b96" name="tests/bson-corpus/decimal128-1-valid-006.phpt" role="test" />
+ <file md5sum="5ee55c669cbbcc7d1ec5f958e5eb42b1" name="tests/bson-corpus/decimal128-1-valid-007.phpt" role="test" />
+ <file md5sum="5a4df210ea96496c3ed55660e4592e7c" name="tests/bson-corpus/decimal128-1-valid-008.phpt" role="test" />
+ <file md5sum="fddff19b57065ffa2e61b236e32b827d" name="tests/bson-corpus/decimal128-1-valid-009.phpt" role="test" />
+ <file md5sum="2bc74ffbd1aead02ff876c3e966d6555" name="tests/bson-corpus/decimal128-1-valid-010.phpt" role="test" />
+ <file md5sum="d26f0f7c83db5d038b7c74cb64a5dcb1" name="tests/bson-corpus/decimal128-1-valid-011.phpt" role="test" />
+ <file md5sum="42b5d2ffd0347f7fc514c5ce283f4505" name="tests/bson-corpus/decimal128-1-valid-012.phpt" role="test" />
+ <file md5sum="1ffd6796df38f3387342b255c229f890" name="tests/bson-corpus/decimal128-1-valid-013.phpt" role="test" />
+ <file md5sum="42027dc8d16bd1f6ced853d35f523275" name="tests/bson-corpus/decimal128-1-valid-014.phpt" role="test" />
+ <file md5sum="9a44107758f5e6f134ee978a604add9d" name="tests/bson-corpus/decimal128-1-valid-015.phpt" role="test" />
+ <file md5sum="655191509f0561fb4babb0278b34edb3" name="tests/bson-corpus/decimal128-1-valid-016.phpt" role="test" />
+ <file md5sum="4a9482da74a352e294f54b6651fabf8f" name="tests/bson-corpus/decimal128-1-valid-017.phpt" role="test" />
+ <file md5sum="fdcc95324224cfd03c8016c6c6950ea1" name="tests/bson-corpus/decimal128-1-valid-018.phpt" role="test" />
+ <file md5sum="2555e90589deb680d494c7ac59e35cfa" name="tests/bson-corpus/decimal128-1-valid-019.phpt" role="test" />
+ <file md5sum="661b16c4ab73676a877e050eba76873e" name="tests/bson-corpus/decimal128-1-valid-020.phpt" role="test" />
+ <file md5sum="4aea085709c1ac3213a3d1edb5c5069a" name="tests/bson-corpus/decimal128-1-valid-021.phpt" role="test" />
+ <file md5sum="b8e9beea859bbf112827221b4aad88a5" name="tests/bson-corpus/decimal128-1-valid-022.phpt" role="test" />
+ <file md5sum="8775226507cfd88f078fe592dabf108e" name="tests/bson-corpus/decimal128-1-valid-023.phpt" role="test" />
+ <file md5sum="c028f1cdd3e2a1836181e9af09183572" name="tests/bson-corpus/decimal128-1-valid-024.phpt" role="test" />
+ <file md5sum="703a29c0273657aa1fce1c85ba259c0c" name="tests/bson-corpus/decimal128-1-valid-025.phpt" role="test" />
+ <file md5sum="a3fa4d46b908e53d8f227226ce624893" name="tests/bson-corpus/decimal128-1-valid-026.phpt" role="test" />
+ <file md5sum="9a35001bbd068e432e0833f9e93d0aa7" name="tests/bson-corpus/decimal128-1-valid-027.phpt" role="test" />
+ <file md5sum="553448bdc1f3b8e07ab1405f218fbf7e" name="tests/bson-corpus/decimal128-1-valid-028.phpt" role="test" />
+ <file md5sum="0213b8bc44d855e40772b09a90f0ac9e" name="tests/bson-corpus/decimal128-1-valid-029.phpt" role="test" />
+ <file md5sum="e803f718be5c7ebbf3c333ee810123b6" name="tests/bson-corpus/decimal128-1-valid-030.phpt" role="test" />
+ <file md5sum="bf60c5ab4ac68f1748974b157ea07147" name="tests/bson-corpus/decimal128-1-valid-031.phpt" role="test" />
+ <file md5sum="95d94906ef78551e5cb982e6d55fa6eb" name="tests/bson-corpus/decimal128-1-valid-032.phpt" role="test" />
+ <file md5sum="dbaad4a70d0ac4c668b8a8e6f01cf585" name="tests/bson-corpus/decimal128-1-valid-033.phpt" role="test" />
+ <file md5sum="11fc98c4a9dce0052da71c407aa5238f" name="tests/bson-corpus/decimal128-1-valid-034.phpt" role="test" />
+ <file md5sum="13315d53e12eb40e96da66b5cc3d9eb3" name="tests/bson-corpus/decimal128-1-valid-035.phpt" role="test" />
+ <file md5sum="3cebadead1b7a891652ef149fc996974" name="tests/bson-corpus/decimal128-1-valid-036.phpt" role="test" />
+ <file md5sum="b4fcbce1cd1eec870856753ed67123e0" name="tests/bson-corpus/decimal128-1-valid-037.phpt" role="test" />
+ <file md5sum="5589d6137329dc49cb9e5ca53fc7f18f" name="tests/bson-corpus/decimal128-1-valid-038.phpt" role="test" />
+ <file md5sum="3d0b2634f6d07b69ca8ee523c5f11f12" name="tests/bson-corpus/decimal128-1-valid-039.phpt" role="test" />
+ <file md5sum="cb2cdbd98abc9b736c00b3540df478ce" name="tests/bson-corpus/decimal128-1-valid-040.phpt" role="test" />
+ <file md5sum="18da07dd42d3fbf9636f34c9348b18fe" name="tests/bson-corpus/decimal128-1-valid-041.phpt" role="test" />
+ <file md5sum="b59566351e6f1a5ecba600005f6630cd" name="tests/bson-corpus/decimal128-1-valid-042.phpt" role="test" />
+ <file md5sum="00479ba5ddd86106b1ad3aa99c29df38" name="tests/bson-corpus/decimal128-1-valid-043.phpt" role="test" />
+ <file md5sum="91188dca0b997ea07c0e1509edf45771" name="tests/bson-corpus/decimal128-1-valid-044.phpt" role="test" />
+ <file md5sum="58091eaa36e0601e06bbd5fc5c5e782a" name="tests/bson-corpus/decimal128-1-valid-045.phpt" role="test" />
+ <file md5sum="8e0f7e1d53c4ecbe24ccdd96e34289f7" name="tests/bson-corpus/decimal128-1-valid-046.phpt" role="test" />
+ <file md5sum="596d7bd3587449730b01d643010eb765" name="tests/bson-corpus/decimal128-1-valid-047.phpt" role="test" />
+ <file md5sum="01aac95a2486493f5bf141fbfb6dfec5" name="tests/bson-corpus/decimal128-1-valid-048.phpt" role="test" />
+ <file md5sum="4faf4289242b94331d2606d5b9a648a9" name="tests/bson-corpus/decimal128-1-valid-049.phpt" role="test" />
+ <file md5sum="fce2fb66554735b043d8d677b3fbb727" name="tests/bson-corpus/decimal128-1-valid-050.phpt" role="test" />
+ <file md5sum="5126cbab44facade048816105cf44cb1" name="tests/bson-corpus/decimal128-1-valid-051.phpt" role="test" />
+ <file md5sum="0a5ff6cb1a45fb2fc1e8ee3aa02f1f3f" name="tests/bson-corpus/decimal128-1-valid-052.phpt" role="test" />
+ <file md5sum="56edf8f78d54daebc405d2c1a431ed56" name="tests/bson-corpus/decimal128-1-valid-053.phpt" role="test" />
+ <file md5sum="489d94b68f10f50195a92eff1d3283a9" name="tests/bson-corpus/decimal128-1-valid-054.phpt" role="test" />
+ <file md5sum="8ebc92ae28ff9ed8431f84cf0c764913" name="tests/bson-corpus/decimal128-1-valid-055.phpt" role="test" />
+ <file md5sum="7457b060426e33949371279ab7725873" name="tests/bson-corpus/decimal128-1-valid-056.phpt" role="test" />
+ <file md5sum="c71485d8e570da2c179c003270c38815" name="tests/bson-corpus/decimal128-2-valid-001.phpt" role="test" />
+ <file md5sum="cf8f0eb0e6f758a97658c1078f7f4d44" name="tests/bson-corpus/decimal128-2-valid-002.phpt" role="test" />
+ <file md5sum="10b9ce094e57f1333d4fe561a459238d" name="tests/bson-corpus/decimal128-2-valid-003.phpt" role="test" />
+ <file md5sum="71233d71b3ae4d9a61cc420e6da77079" name="tests/bson-corpus/decimal128-2-valid-004.phpt" role="test" />
+ <file md5sum="be1dd54f06b2d1fa97c360e3b4d6b3a4" name="tests/bson-corpus/decimal128-2-valid-005.phpt" role="test" />
+ <file md5sum="fd3d5444c5ed2115120c001dd0fb7df0" name="tests/bson-corpus/decimal128-2-valid-006.phpt" role="test" />
+ <file md5sum="f6451ff09f07da449873cd2da545dd28" name="tests/bson-corpus/decimal128-2-valid-007.phpt" role="test" />
+ <file md5sum="af313c19690dfba4c0a346817e815f6a" name="tests/bson-corpus/decimal128-2-valid-008.phpt" role="test" />
+ <file md5sum="32dbb8c19eadaca6695483d62353e5fe" name="tests/bson-corpus/decimal128-2-valid-009.phpt" role="test" />
+ <file md5sum="109121fc4b4d3f2edc86510bc53d4608" name="tests/bson-corpus/decimal128-2-valid-010.phpt" role="test" />
+ <file md5sum="4ab6ab35ba1ae645237efb3f550c2256" name="tests/bson-corpus/decimal128-2-valid-011.phpt" role="test" />
+ <file md5sum="1486fe7d03c53fa4574cb7f31a0537c5" name="tests/bson-corpus/decimal128-2-valid-012.phpt" role="test" />
+ <file md5sum="99826b6a2c69315a8ca83f9410362354" name="tests/bson-corpus/decimal128-2-valid-013.phpt" role="test" />
+ <file md5sum="6d9ef58b7dc39760cd920708bf8bce71" name="tests/bson-corpus/decimal128-2-valid-014.phpt" role="test" />
+ <file md5sum="7dc2c171207827138ec1b0de7695e6bb" name="tests/bson-corpus/decimal128-2-valid-015.phpt" role="test" />
+ <file md5sum="11caa02f5213f348013e1a2c1fa1c299" name="tests/bson-corpus/decimal128-2-valid-016.phpt" role="test" />
+ <file md5sum="5f27e71667c3c15a3d5c1776ae010298" name="tests/bson-corpus/decimal128-2-valid-017.phpt" role="test" />
+ <file md5sum="b9852f992ce4a4191d17047ca54c6609" name="tests/bson-corpus/decimal128-2-valid-018.phpt" role="test" />
+ <file md5sum="8fd0d526a0eb2a9aa959aa99e8fcc86b" name="tests/bson-corpus/decimal128-2-valid-019.phpt" role="test" />
+ <file md5sum="a186709a5c1de9d10ee1601635efb10a" name="tests/bson-corpus/decimal128-2-valid-020.phpt" role="test" />
+ <file md5sum="01d84aa6052acb73ad2626762c1883e1" name="tests/bson-corpus/decimal128-2-valid-021.phpt" role="test" />
+ <file md5sum="c9a5d74e0fc333f5792ce319f9ecd388" name="tests/bson-corpus/decimal128-2-valid-022.phpt" role="test" />
+ <file md5sum="4e852be8112d2201d6f4ec80464d1132" name="tests/bson-corpus/decimal128-2-valid-023.phpt" role="test" />
+ <file md5sum="5d1b526c79de7bfe50b08b900ceffd7e" name="tests/bson-corpus/decimal128-2-valid-024.phpt" role="test" />
+ <file md5sum="61eff8d2194225619c0c4bb36f742a7b" name="tests/bson-corpus/decimal128-2-valid-025.phpt" role="test" />
+ <file md5sum="0a52cee23577ad03887fcb77fd05d8c7" name="tests/bson-corpus/decimal128-2-valid-026.phpt" role="test" />
+ <file md5sum="7e8c5f119698a9c5c325d1cadbc89f1b" name="tests/bson-corpus/decimal128-2-valid-027.phpt" role="test" />
+ <file md5sum="109545aa203098493ea6290c318a3862" name="tests/bson-corpus/decimal128-2-valid-028.phpt" role="test" />
+ <file md5sum="22126cb1cb6f6b591d331d04cdfe7676" name="tests/bson-corpus/decimal128-2-valid-029.phpt" role="test" />
+ <file md5sum="d4cf621715e1db8b7ffb9c4501811f2d" name="tests/bson-corpus/decimal128-2-valid-030.phpt" role="test" />
+ <file md5sum="522672614f65ac4ea6757837f1536956" name="tests/bson-corpus/decimal128-2-valid-031.phpt" role="test" />
+ <file md5sum="f20ce1c72093865debe029bc2b5cca3b" name="tests/bson-corpus/decimal128-2-valid-032.phpt" role="test" />
+ <file md5sum="6590012809a8d19b4a1f71fad999e3e2" name="tests/bson-corpus/decimal128-2-valid-033.phpt" role="test" />
+ <file md5sum="8efb3cf8e36035d68162e4af65762416" name="tests/bson-corpus/decimal128-2-valid-034.phpt" role="test" />
+ <file md5sum="63a20d910b6c05b357007d6bbb36dba7" name="tests/bson-corpus/decimal128-2-valid-035.phpt" role="test" />
+ <file md5sum="2af8c2a72f6365e96f0757de98394247" name="tests/bson-corpus/decimal128-2-valid-036.phpt" role="test" />
+ <file md5sum="0971ea1c58033729de2838b3e957691b" name="tests/bson-corpus/decimal128-2-valid-037.phpt" role="test" />
+ <file md5sum="062a676bc8927f95f133d9355e32124d" name="tests/bson-corpus/decimal128-2-valid-038.phpt" role="test" />
+ <file md5sum="9293073c8b6da2c3ed5c2a27e89a6a45" name="tests/bson-corpus/decimal128-2-valid-039.phpt" role="test" />
+ <file md5sum="c958437bc5e39fb0dee8341f8e9bdfcd" name="tests/bson-corpus/decimal128-2-valid-040.phpt" role="test" />
+ <file md5sum="995c5102df18cb3a342511656d8aabd5" name="tests/bson-corpus/decimal128-2-valid-041.phpt" role="test" />
+ <file md5sum="a157261ac456012f614128763c003792" name="tests/bson-corpus/decimal128-2-valid-042.phpt" role="test" />
+ <file md5sum="76022ce8827e4d40fa567d3193b66389" name="tests/bson-corpus/decimal128-2-valid-043.phpt" role="test" />
+ <file md5sum="152829d05529c28fecc8e86fe06fe183" name="tests/bson-corpus/decimal128-2-valid-044.phpt" role="test" />
+ <file md5sum="2bf2e3c36698880eb679becc9cbf0bf9" name="tests/bson-corpus/decimal128-2-valid-045.phpt" role="test" />
+ <file md5sum="5548939f48092066ff8fcf8e650ef8a3" name="tests/bson-corpus/decimal128-2-valid-046.phpt" role="test" />
+ <file md5sum="fca2befa4db2374e0b2512ae7f592dc4" name="tests/bson-corpus/decimal128-2-valid-047.phpt" role="test" />
+ <file md5sum="e50c6f8dc33fea06baeda641d7ad2bfd" name="tests/bson-corpus/decimal128-2-valid-048.phpt" role="test" />
+ <file md5sum="96c032fab194329a0d3efada2406ab1f" name="tests/bson-corpus/decimal128-2-valid-049.phpt" role="test" />
+ <file md5sum="37c1250db4786a0af44e9b5eabbe5f4d" name="tests/bson-corpus/decimal128-2-valid-050.phpt" role="test" />
+ <file md5sum="c4d1fb45e310b6873d8b45fcb79e5678" name="tests/bson-corpus/decimal128-2-valid-051.phpt" role="test" />
+ <file md5sum="43548678729b5fc998abd3ef8dbfbb36" name="tests/bson-corpus/decimal128-2-valid-052.phpt" role="test" />
+ <file md5sum="f722b943e7b2ce0f3437050cda235345" name="tests/bson-corpus/decimal128-2-valid-053.phpt" role="test" />
+ <file md5sum="ce295307ccd794708c3f6fed447a12ad" name="tests/bson-corpus/decimal128-2-valid-054.phpt" role="test" />
+ <file md5sum="6c8bcdc4f85b863b0b5fd3029984d5e7" name="tests/bson-corpus/decimal128-2-valid-055.phpt" role="test" />
+ <file md5sum="4a83c1f5f1e3f38ee36cf43e1f2f389e" name="tests/bson-corpus/decimal128-2-valid-056.phpt" role="test" />
+ <file md5sum="59c1e50f2ef9579846ccde02f21d4414" name="tests/bson-corpus/decimal128-2-valid-057.phpt" role="test" />
+ <file md5sum="3b824333fd27f1da2d0cad7c2f42a475" name="tests/bson-corpus/decimal128-2-valid-058.phpt" role="test" />
+ <file md5sum="d4af516c33d09f8200679ddae44fd1b7" name="tests/bson-corpus/decimal128-2-valid-059.phpt" role="test" />
+ <file md5sum="620646775a20a58cfddb73b6f72829d1" name="tests/bson-corpus/decimal128-2-valid-060.phpt" role="test" />
+ <file md5sum="096dcc08698804cde5af08d447628db9" name="tests/bson-corpus/decimal128-2-valid-061.phpt" role="test" />
+ <file md5sum="ef045f873a8c8c673071e565a3363449" name="tests/bson-corpus/decimal128-2-valid-062.phpt" role="test" />
+ <file md5sum="e708459021870b5649f8a51a63aa29e9" name="tests/bson-corpus/decimal128-2-valid-063.phpt" role="test" />
+ <file md5sum="008ff5b40597457a6720bf246036db85" name="tests/bson-corpus/decimal128-2-valid-064.phpt" role="test" />
+ <file md5sum="5048203c56feadcd85b15a639ef30638" name="tests/bson-corpus/decimal128-2-valid-065.phpt" role="test" />
+ <file md5sum="967a264b2d2f3c2fb18c4354a1950565" name="tests/bson-corpus/decimal128-2-valid-066.phpt" role="test" />
+ <file md5sum="cb0a140a094f70ba0a375b841353eccc" name="tests/bson-corpus/decimal128-2-valid-067.phpt" role="test" />
+ <file md5sum="0cb589b9e8abf1d2ec06653ed6ad1bb2" name="tests/bson-corpus/decimal128-2-valid-068.phpt" role="test" />
+ <file md5sum="b37eae3f8c3be34557d4a723c75a872c" name="tests/bson-corpus/decimal128-2-valid-069.phpt" role="test" />
+ <file md5sum="57490788f32e08a1c8f88c4aee971576" name="tests/bson-corpus/decimal128-2-valid-070.phpt" role="test" />
+ <file md5sum="30ade17a61d322c86602335186d7eb80" name="tests/bson-corpus/decimal128-2-valid-071.phpt" role="test" />
+ <file md5sum="a8b9f6fb3904d00850ab6f4e1cf4db81" name="tests/bson-corpus/decimal128-2-valid-072.phpt" role="test" />
+ <file md5sum="6b4d0d4623dac3dbb5d2702c61f1b373" name="tests/bson-corpus/decimal128-2-valid-073.phpt" role="test" />
+ <file md5sum="6170c38a978d2a37c0a6e529d908e4af" name="tests/bson-corpus/decimal128-2-valid-074.phpt" role="test" />
+ <file md5sum="99a3ec71cb56b2af3e2f63c0c2136673" name="tests/bson-corpus/decimal128-2-valid-075.phpt" role="test" />
+ <file md5sum="b19aea6f674b0353b2b9cead7a5222fb" name="tests/bson-corpus/decimal128-2-valid-076.phpt" role="test" />
+ <file md5sum="fca022b04d77116dd222f4451b057ae2" name="tests/bson-corpus/decimal128-2-valid-077.phpt" role="test" />
+ <file md5sum="1f125ded71fa4130b44b3d2d1473c176" name="tests/bson-corpus/decimal128-2-valid-078.phpt" role="test" />
+ <file md5sum="01f3e6d641273ecaaa561c07ac5ad48c" name="tests/bson-corpus/decimal128-2-valid-079.phpt" role="test" />
+ <file md5sum="3d43fe069afb86283a0a04ae112d9677" name="tests/bson-corpus/decimal128-2-valid-080.phpt" role="test" />
+ <file md5sum="bacfec1efd1823b1d724125f07e96b1f" name="tests/bson-corpus/decimal128-2-valid-081.phpt" role="test" />
+ <file md5sum="a6e02b619e06ab29ef311e2110a37492" name="tests/bson-corpus/decimal128-2-valid-082.phpt" role="test" />
+ <file md5sum="2313265eb47a9726f31d5b6b16a43670" name="tests/bson-corpus/decimal128-2-valid-083.phpt" role="test" />
+ <file md5sum="a76e6db426b90ec5a00ec82fe08266dc" name="tests/bson-corpus/decimal128-2-valid-084.phpt" role="test" />
+ <file md5sum="43082abaab2981cd15ce51502673a70b" name="tests/bson-corpus/decimal128-2-valid-085.phpt" role="test" />
+ <file md5sum="79a111409f6317dbf6d3994cd925b32e" name="tests/bson-corpus/decimal128-2-valid-086.phpt" role="test" />
+ <file md5sum="5a353899d7eb99346e6e76e81ed38ae5" name="tests/bson-corpus/decimal128-2-valid-087.phpt" role="test" />
+ <file md5sum="28b37a7d20b20054eca628832c3a5e8b" name="tests/bson-corpus/decimal128-2-valid-088.phpt" role="test" />
+ <file md5sum="bc34e91d015b34e146ce258d460e0a1b" name="tests/bson-corpus/decimal128-2-valid-089.phpt" role="test" />
+ <file md5sum="faec6b8f4bdc03c6907fbd3e05012a57" name="tests/bson-corpus/decimal128-2-valid-090.phpt" role="test" />
+ <file md5sum="b3bd257bc3045131317bd7de3b4e0b54" name="tests/bson-corpus/decimal128-2-valid-091.phpt" role="test" />
+ <file md5sum="8e951a4301ef2ad6d527da7b5a2eee9e" name="tests/bson-corpus/decimal128-2-valid-092.phpt" role="test" />
+ <file md5sum="c7389ad5cbd6dcad5d4e82fe11ad04a7" name="tests/bson-corpus/decimal128-2-valid-093.phpt" role="test" />
+ <file md5sum="d5becc710fd81bcf0aa9d7d7b8f38403" name="tests/bson-corpus/decimal128-2-valid-094.phpt" role="test" />
+ <file md5sum="7eb545960de6b704b0c55c0c7af79e06" name="tests/bson-corpus/decimal128-2-valid-095.phpt" role="test" />
+ <file md5sum="78c5c9bbab3f12c8cfc77b0fb39f0bef" name="tests/bson-corpus/decimal128-2-valid-096.phpt" role="test" />
+ <file md5sum="a5e5ecf92bb7e618b867c3b90c1e2b8b" name="tests/bson-corpus/decimal128-2-valid-097.phpt" role="test" />
+ <file md5sum="ef757b81efe9095f41b27bdb9c158d28" name="tests/bson-corpus/decimal128-2-valid-098.phpt" role="test" />
+ <file md5sum="c7f5e3f7afdb9b18c21429d958fbd469" name="tests/bson-corpus/decimal128-2-valid-099.phpt" role="test" />
+ <file md5sum="c1af3edda98d36a1ce76437a2006edc7" name="tests/bson-corpus/decimal128-2-valid-100.phpt" role="test" />
+ <file md5sum="54b27e89443c59004d993108b4ceebd2" name="tests/bson-corpus/decimal128-2-valid-101.phpt" role="test" />
+ <file md5sum="0f51823c24509748923598508d8d92f7" name="tests/bson-corpus/decimal128-2-valid-102.phpt" role="test" />
+ <file md5sum="dcab0a082d9c06fbe36dddfb2211148c" name="tests/bson-corpus/decimal128-2-valid-103.phpt" role="test" />
+ <file md5sum="9720fbc6bfd967f967c42542d6c9cbde" name="tests/bson-corpus/decimal128-2-valid-104.phpt" role="test" />
+ <file md5sum="ce11e4481711bfda216aa4355ba2ef42" name="tests/bson-corpus/decimal128-2-valid-105.phpt" role="test" />
+ <file md5sum="5595395e500eebabb75a352e4971824f" name="tests/bson-corpus/decimal128-2-valid-106.phpt" role="test" />
+ <file md5sum="ede4e403415c7fc2532c338646ff5aad" name="tests/bson-corpus/decimal128-2-valid-107.phpt" role="test" />
+ <file md5sum="a49c87a9c0df13bbfe965f43b302045f" name="tests/bson-corpus/decimal128-2-valid-108.phpt" role="test" />
+ <file md5sum="7784867cf59552fdcec3ea78861560c4" name="tests/bson-corpus/decimal128-2-valid-109.phpt" role="test" />
+ <file md5sum="1eaa2d6d92caa63e2a71383a432941b3" name="tests/bson-corpus/decimal128-2-valid-110.phpt" role="test" />
+ <file md5sum="e10c507ef7f50ce0d9a64db805b7d06f" name="tests/bson-corpus/decimal128-2-valid-111.phpt" role="test" />
+ <file md5sum="28bc11625e0f79c579952762d9515c67" name="tests/bson-corpus/decimal128-2-valid-112.phpt" role="test" />
+ <file md5sum="75ba52bfaeeb257eb553b73d0fe9e26e" name="tests/bson-corpus/decimal128-2-valid-113.phpt" role="test" />
+ <file md5sum="6e4ad6ea317f92c30c8f681eba3a11aa" name="tests/bson-corpus/decimal128-2-valid-114.phpt" role="test" />
+ <file md5sum="c1ab05a4dafaaf83dade29881cb01d1f" name="tests/bson-corpus/decimal128-2-valid-115.phpt" role="test" />
+ <file md5sum="033984751f4c2829c5c81382d99c2356" name="tests/bson-corpus/decimal128-2-valid-116.phpt" role="test" />
+ <file md5sum="caad4665ead8f30912fa0b5faf4f6947" name="tests/bson-corpus/decimal128-2-valid-117.phpt" role="test" />
+ <file md5sum="6a0114dcabe740abea6db34e10c0e3dc" name="tests/bson-corpus/decimal128-2-valid-118.phpt" role="test" />
+ <file md5sum="542acb6a162714b4644551e026b592ab" name="tests/bson-corpus/decimal128-2-valid-119.phpt" role="test" />
+ <file md5sum="91c19e80529a96ad1ac2bb8680ee616c" name="tests/bson-corpus/decimal128-2-valid-120.phpt" role="test" />
+ <file md5sum="e76000f912adddf36f4dde35af571e02" name="tests/bson-corpus/decimal128-2-valid-121.phpt" role="test" />
+ <file md5sum="902256677cdf9768e9b2038a460b1bc6" name="tests/bson-corpus/decimal128-2-valid-122.phpt" role="test" />
+ <file md5sum="5a07416c55072239ec2e911b287c7d10" name="tests/bson-corpus/decimal128-2-valid-123.phpt" role="test" />
+ <file md5sum="67328c4551923a581bf1c68e9baf253a" name="tests/bson-corpus/decimal128-2-valid-124.phpt" role="test" />
+ <file md5sum="c7fefc9f7461c442165560efa84f040d" name="tests/bson-corpus/decimal128-2-valid-125.phpt" role="test" />
+ <file md5sum="58f12da54e78a4d6f84cb57643534263" name="tests/bson-corpus/decimal128-2-valid-126.phpt" role="test" />
+ <file md5sum="85fb92f3bd9ae356762e315a3cb41971" name="tests/bson-corpus/decimal128-2-valid-127.phpt" role="test" />
+ <file md5sum="25991ee2ae6ac23f265ee58a5cb69e38" name="tests/bson-corpus/decimal128-2-valid-128.phpt" role="test" />
+ <file md5sum="878d6c52c00dcceeb3833ebc4f274b83" name="tests/bson-corpus/decimal128-2-valid-129.phpt" role="test" />
+ <file md5sum="2595e1d84d5d7b38d9e4d27a5ee3bb05" name="tests/bson-corpus/decimal128-2-valid-130.phpt" role="test" />
+ <file md5sum="06bbd819d4bae1a1f1f6709c863647e1" name="tests/bson-corpus/decimal128-2-valid-131.phpt" role="test" />
+ <file md5sum="e39ebbf78eb01f9cd49a56804fdec770" name="tests/bson-corpus/decimal128-2-valid-132.phpt" role="test" />
+ <file md5sum="fe6719dd42382f06a37bbf60d96f678a" name="tests/bson-corpus/decimal128-2-valid-133.phpt" role="test" />
+ <file md5sum="2139000cc23d5e4e22a8866301c79ae1" name="tests/bson-corpus/decimal128-2-valid-134.phpt" role="test" />
+ <file md5sum="efe6fa3f1f715c53c7593e6b7b483fc4" name="tests/bson-corpus/decimal128-2-valid-135.phpt" role="test" />
+ <file md5sum="e8f68ea98eb3504904b75ec5f12324ff" name="tests/bson-corpus/decimal128-2-valid-136.phpt" role="test" />
+ <file md5sum="fbb238746c24bb6d7ed3c432b21bb47f" name="tests/bson-corpus/decimal128-2-valid-137.phpt" role="test" />
+ <file md5sum="068db1c5130eced319d8010576274876" name="tests/bson-corpus/decimal128-2-valid-138.phpt" role="test" />
+ <file md5sum="60b6fa92afeed0ede6fd3d9ad60c0993" name="tests/bson-corpus/decimal128-2-valid-139.phpt" role="test" />
+ <file md5sum="5abc6e6c6025ef8fde275168ee33ee18" name="tests/bson-corpus/decimal128-2-valid-140.phpt" role="test" />
+ <file md5sum="30639c2659c248d5a6cc571525e30513" name="tests/bson-corpus/decimal128-2-valid-141.phpt" role="test" />
+ <file md5sum="9a26272cbfa3555bc3e134474a1ebd9c" name="tests/bson-corpus/decimal128-2-valid-142.phpt" role="test" />
+ <file md5sum="adcd72144caf654b8a27525912ced04b" name="tests/bson-corpus/decimal128-2-valid-143.phpt" role="test" />
+ <file md5sum="5ed7c31f48d336758c0e0a55531b80db" name="tests/bson-corpus/decimal128-2-valid-144.phpt" role="test" />
+ <file md5sum="892db5a8478594aafe2dd939212a6629" name="tests/bson-corpus/decimal128-2-valid-145.phpt" role="test" />
+ <file md5sum="ea7f7de5b6ef520450c922b108de42af" name="tests/bson-corpus/decimal128-2-valid-146.phpt" role="test" />
+ <file md5sum="54ff230ac9a1973509f3f2312b9419f1" name="tests/bson-corpus/decimal128-2-valid-147.phpt" role="test" />
+ <file md5sum="c7c75143bc25f744740f798dbcdc0e1c" name="tests/bson-corpus/decimal128-2-valid-148.phpt" role="test" />
+ <file md5sum="0f3ff0c368de1d390549fceb1f845b3a" name="tests/bson-corpus/decimal128-2-valid-149.phpt" role="test" />
+ <file md5sum="fe8ab24da23d716e55cefabf1fcc9b8d" name="tests/bson-corpus/decimal128-2-valid-150.phpt" role="test" />
+ <file md5sum="ba012bdba1eb5baf51145df64617e5ac" name="tests/bson-corpus/decimal128-2-valid-151.phpt" role="test" />
+ <file md5sum="f61d9a7c58a3dea79230ec1e889c692d" name="tests/bson-corpus/decimal128-2-valid-152.phpt" role="test" />
+ <file md5sum="56a1f35f2d1b72150f7325cc3293fa2e" name="tests/bson-corpus/decimal128-2-valid-153.phpt" role="test" />
+ <file md5sum="23ff4f771afe7ddbb8c3af63cdfe7aff" name="tests/bson-corpus/decimal128-2-valid-154.phpt" role="test" />
+ <file md5sum="629a785a6e1d6517bc4d189907f2c19e" name="tests/bson-corpus/decimal128-2-valid-155.phpt" role="test" />
+ <file md5sum="95d40b0d0b6d0692838f9bce2e54e3e6" name="tests/bson-corpus/decimal128-2-valid-156.phpt" role="test" />
+ <file md5sum="0d5171bb7a9d809291f23aea3c3d2998" name="tests/bson-corpus/decimal128-2-valid-157.phpt" role="test" />
+ <file md5sum="830cd0af212201a3f444629efc525127" name="tests/bson-corpus/decimal128-3-valid-001.phpt" role="test" />
+ <file md5sum="41292124735b352112019fd427f1d77e" name="tests/bson-corpus/decimal128-3-valid-002.phpt" role="test" />
+ <file md5sum="06d1411083c74d3a09b45f685a3d4cba" name="tests/bson-corpus/decimal128-3-valid-003.phpt" role="test" />
+ <file md5sum="eb99e6b67ea0a6ce171836e8d524107f" name="tests/bson-corpus/decimal128-3-valid-004.phpt" role="test" />
+ <file md5sum="fe386fd99160d0fdcd1bc3d4af2d4266" name="tests/bson-corpus/decimal128-3-valid-005.phpt" role="test" />
+ <file md5sum="65b78790d2644fb9b48ff7ae1822a97b" name="tests/bson-corpus/decimal128-3-valid-006.phpt" role="test" />
+ <file md5sum="0690989984d73aca659b6b7d80c0cc6f" name="tests/bson-corpus/decimal128-3-valid-007.phpt" role="test" />
+ <file md5sum="60d0a369de428c6fa5d90fff7416e8ec" name="tests/bson-corpus/decimal128-3-valid-008.phpt" role="test" />
+ <file md5sum="2ca7d5ccc5327de90fc5ccf9847c588e" name="tests/bson-corpus/decimal128-3-valid-009.phpt" role="test" />
+ <file md5sum="d8c8d6440fe01e314e7ab1fde462c165" name="tests/bson-corpus/decimal128-3-valid-010.phpt" role="test" />
+ <file md5sum="a06e3d0e83a0e1951b161d057d02519a" name="tests/bson-corpus/decimal128-3-valid-011.phpt" role="test" />
+ <file md5sum="046b82496549a2404edde420ebdba2f3" name="tests/bson-corpus/decimal128-3-valid-012.phpt" role="test" />
+ <file md5sum="f6e7d7a1077b828d6004b272bb399cb5" name="tests/bson-corpus/decimal128-3-valid-013.phpt" role="test" />
+ <file md5sum="6b049fa06ca0b037fcd9ab3d0613d424" name="tests/bson-corpus/decimal128-3-valid-014.phpt" role="test" />
+ <file md5sum="98ecfc2b7349e4c807c31d6f5982c242" name="tests/bson-corpus/decimal128-3-valid-015.phpt" role="test" />
+ <file md5sum="4b5ef061fd762b0031d890e10ce03349" name="tests/bson-corpus/decimal128-3-valid-016.phpt" role="test" />
+ <file md5sum="913bc7bd258f6423cbf37249331809aa" name="tests/bson-corpus/decimal128-3-valid-017.phpt" role="test" />
+ <file md5sum="320c592dc870bf730df63517c07751b5" name="tests/bson-corpus/decimal128-3-valid-018.phpt" role="test" />
+ <file md5sum="9916723386166b42f337c9820d6c0569" name="tests/bson-corpus/decimal128-3-valid-019.phpt" role="test" />
+ <file md5sum="a6ab9d495f031d6b9d44c99b47335c78" name="tests/bson-corpus/decimal128-3-valid-020.phpt" role="test" />
+ <file md5sum="ded187d425db72400ee4ceddd6d1dddc" name="tests/bson-corpus/decimal128-3-valid-021.phpt" role="test" />
+ <file md5sum="ad3077c9ff64f73babf9b6006d7628ae" name="tests/bson-corpus/decimal128-3-valid-022.phpt" role="test" />
+ <file md5sum="5ca2f084210591e07bbb2731bb00b3d1" name="tests/bson-corpus/decimal128-3-valid-023.phpt" role="test" />
+ <file md5sum="b867c3937adefa7012f5ca4cb3200e38" name="tests/bson-corpus/decimal128-3-valid-024.phpt" role="test" />
+ <file md5sum="8ab67870efa1effeb7dcbccccb7c3dcb" name="tests/bson-corpus/decimal128-3-valid-025.phpt" role="test" />
+ <file md5sum="fac3cd766cd5f4b1009e0758246c34eb" name="tests/bson-corpus/decimal128-3-valid-026.phpt" role="test" />
+ <file md5sum="a6c326bd59a93a88c2f1ca1e4157a870" name="tests/bson-corpus/decimal128-3-valid-027.phpt" role="test" />
+ <file md5sum="2d479f3df4fe47975416d574b3260414" name="tests/bson-corpus/decimal128-3-valid-028.phpt" role="test" />
+ <file md5sum="0249e5103a8d65065f57719dda465ad5" name="tests/bson-corpus/decimal128-3-valid-029.phpt" role="test" />
+ <file md5sum="303dfbf8f8f6d4c4b140f6ff0a6103cc" name="tests/bson-corpus/decimal128-3-valid-030.phpt" role="test" />
+ <file md5sum="e0822a4bee2d17982da91dd0a28661cf" name="tests/bson-corpus/decimal128-3-valid-031.phpt" role="test" />
+ <file md5sum="845b686269a62aa805c2669bdb6d9795" name="tests/bson-corpus/decimal128-3-valid-032.phpt" role="test" />
+ <file md5sum="ff042048b0eefa59002fa38c90afc433" name="tests/bson-corpus/decimal128-3-valid-033.phpt" role="test" />
+ <file md5sum="8536700db850bb8570b77a8f47160a42" name="tests/bson-corpus/decimal128-3-valid-034.phpt" role="test" />
+ <file md5sum="382048ef46239808f62b7eac82947cee" name="tests/bson-corpus/decimal128-3-valid-035.phpt" role="test" />
+ <file md5sum="1c40c93d8a797d0bb68b286878bce348" name="tests/bson-corpus/decimal128-3-valid-036.phpt" role="test" />
+ <file md5sum="0b483138fd0a3dbde0b3fc5aedc8fd84" name="tests/bson-corpus/decimal128-3-valid-037.phpt" role="test" />
+ <file md5sum="6221b1916fe243b654ba69f0a2981fb3" name="tests/bson-corpus/decimal128-3-valid-038.phpt" role="test" />
+ <file md5sum="a6a7d7adf4f2fd350ef9a81ab6af0bea" name="tests/bson-corpus/decimal128-3-valid-039.phpt" role="test" />
+ <file md5sum="f63c393456b4432cfdfd703c79531ca9" name="tests/bson-corpus/decimal128-3-valid-040.phpt" role="test" />
+ <file md5sum="4b139a05765344cd30787792a02ff93c" name="tests/bson-corpus/decimal128-3-valid-041.phpt" role="test" />
+ <file md5sum="e947f3e55ce88397dd486322f3a11db7" name="tests/bson-corpus/decimal128-3-valid-042.phpt" role="test" />
+ <file md5sum="9240ca9250e1ad75dd68bc9fe762e592" name="tests/bson-corpus/decimal128-3-valid-043.phpt" role="test" />
+ <file md5sum="936edbb82f7cfbdcaa7b27dd4e549be3" name="tests/bson-corpus/decimal128-3-valid-044.phpt" role="test" />
+ <file md5sum="0590d0bf0948fba5781b4b1698c26ed4" name="tests/bson-corpus/decimal128-3-valid-045.phpt" role="test" />
+ <file md5sum="fd76ef2855ff2bb567364f5b44dd53c0" name="tests/bson-corpus/decimal128-3-valid-046.phpt" role="test" />
+ <file md5sum="8aeaf53d854bb23010c892872df131f5" name="tests/bson-corpus/decimal128-3-valid-047.phpt" role="test" />
+ <file md5sum="7c51e08690027f2b9bf27975fe48b30a" name="tests/bson-corpus/decimal128-3-valid-048.phpt" role="test" />
+ <file md5sum="313e68b1a1f745d7b96ec21d16eaba72" name="tests/bson-corpus/decimal128-3-valid-049.phpt" role="test" />
+ <file md5sum="47e3c67484bdad0c057350cb76d1c8e4" name="tests/bson-corpus/decimal128-3-valid-050.phpt" role="test" />
+ <file md5sum="aca10f0cd8e32dae77658d07798c1bdc" name="tests/bson-corpus/decimal128-3-valid-051.phpt" role="test" />
+ <file md5sum="047a61c2a95e2167a92cfb46d41ebe09" name="tests/bson-corpus/decimal128-3-valid-052.phpt" role="test" />
+ <file md5sum="2617cf2e3f9f6bee113009c5fd5b5679" name="tests/bson-corpus/decimal128-3-valid-053.phpt" role="test" />
+ <file md5sum="7ee5baeb2e9ec80482fae2427e538b87" name="tests/bson-corpus/decimal128-3-valid-054.phpt" role="test" />
+ <file md5sum="ffd94efdb9a9eb3535417e2c757212b1" name="tests/bson-corpus/decimal128-3-valid-055.phpt" role="test" />
+ <file md5sum="2a794f9ccf1bdefddc7520110ceb4dad" name="tests/bson-corpus/decimal128-3-valid-056.phpt" role="test" />
+ <file md5sum="c8be661b90ffb01f5990347638f96e6d" name="tests/bson-corpus/decimal128-3-valid-057.phpt" role="test" />
+ <file md5sum="d768baac8f04d4178c5309ae51719eed" name="tests/bson-corpus/decimal128-3-valid-058.phpt" role="test" />
+ <file md5sum="7b9f281629b64d57f776c0fb8f834301" name="tests/bson-corpus/decimal128-3-valid-059.phpt" role="test" />
+ <file md5sum="54d589e1cbce83181091ad7dc4e8e286" name="tests/bson-corpus/decimal128-3-valid-060.phpt" role="test" />
+ <file md5sum="042432245e937597d211b77ffe2d69f0" name="tests/bson-corpus/decimal128-3-valid-061.phpt" role="test" />
+ <file md5sum="fd7150fa030dd392617025abf775a8a6" name="tests/bson-corpus/decimal128-3-valid-062.phpt" role="test" />
+ <file md5sum="e2dd638ed55f04612d4499138241082b" name="tests/bson-corpus/decimal128-3-valid-063.phpt" role="test" />
+ <file md5sum="50422fa22999ca6139798a426383af4c" name="tests/bson-corpus/decimal128-3-valid-064.phpt" role="test" />
+ <file md5sum="51e2329209a41b03c751c83b61d80e74" name="tests/bson-corpus/decimal128-3-valid-065.phpt" role="test" />
+ <file md5sum="94684af5bda1a7bfd222148765832d44" name="tests/bson-corpus/decimal128-3-valid-066.phpt" role="test" />
+ <file md5sum="84e8828bc9a138b9acdcf8194c329e84" name="tests/bson-corpus/decimal128-3-valid-067.phpt" role="test" />
+ <file md5sum="dec322b3b21f03ed74a1b1c274743117" name="tests/bson-corpus/decimal128-3-valid-068.phpt" role="test" />
+ <file md5sum="2ffb8f9cfd1ecacad14df499d4e2d933" name="tests/bson-corpus/decimal128-3-valid-069.phpt" role="test" />
+ <file md5sum="32758a0425cfdbe3af7494168bb182e5" name="tests/bson-corpus/decimal128-3-valid-070.phpt" role="test" />
+ <file md5sum="25315eac653361fc1595325e2ae38b33" name="tests/bson-corpus/decimal128-3-valid-071.phpt" role="test" />
+ <file md5sum="10ac78dcc3c01f71205717a670754490" name="tests/bson-corpus/decimal128-3-valid-072.phpt" role="test" />
+ <file md5sum="1c160deba668484e483fed407a0d3f34" name="tests/bson-corpus/decimal128-3-valid-073.phpt" role="test" />
+ <file md5sum="1ff762ed514f8e57a2722f8a2502cddf" name="tests/bson-corpus/decimal128-3-valid-074.phpt" role="test" />
+ <file md5sum="21c239322e818c660de4489bd5062b82" name="tests/bson-corpus/decimal128-3-valid-075.phpt" role="test" />
+ <file md5sum="c394feb23b280644e03c597fa57767bd" name="tests/bson-corpus/decimal128-3-valid-076.phpt" role="test" />
+ <file md5sum="f63d370f09d2b1ce9cbcb78af5bfebd0" name="tests/bson-corpus/decimal128-3-valid-077.phpt" role="test" />
+ <file md5sum="80735eace79590f5705ebdd64c342c17" name="tests/bson-corpus/decimal128-3-valid-078.phpt" role="test" />
+ <file md5sum="5252c3f1270eae08191ee7daf25a9c8a" name="tests/bson-corpus/decimal128-3-valid-079.phpt" role="test" />
+ <file md5sum="951b06ee5ccdee4d0df8998e33df7587" name="tests/bson-corpus/decimal128-3-valid-080.phpt" role="test" />
+ <file md5sum="6e0dfc98829462a7ab197c5f1ba577ec" name="tests/bson-corpus/decimal128-3-valid-081.phpt" role="test" />
+ <file md5sum="75383771f2b93a90675cbaf1b7cdcd3c" name="tests/bson-corpus/decimal128-3-valid-082.phpt" role="test" />
+ <file md5sum="6df55ca269004a29273eb5e3ea93f7c7" name="tests/bson-corpus/decimal128-3-valid-083.phpt" role="test" />
+ <file md5sum="73297f7b52208d65be9f19601a30a625" name="tests/bson-corpus/decimal128-3-valid-084.phpt" role="test" />
+ <file md5sum="270e75f65c144b009ccf853a36cf9788" name="tests/bson-corpus/decimal128-3-valid-085.phpt" role="test" />
+ <file md5sum="476c5ce75b263c36b0c4d4df154790d1" name="tests/bson-corpus/decimal128-3-valid-086.phpt" role="test" />
+ <file md5sum="423a459ff2c9f40621373d13c76412d2" name="tests/bson-corpus/decimal128-3-valid-087.phpt" role="test" />
+ <file md5sum="3d7dc9b0f33718b16cba95a9fa8123f9" name="tests/bson-corpus/decimal128-3-valid-088.phpt" role="test" />
+ <file md5sum="a1d687044b163d1a25a834f6611b8b75" name="tests/bson-corpus/decimal128-3-valid-089.phpt" role="test" />
+ <file md5sum="3d3dd336ffdbcf33dee17d0d9ca9741c" name="tests/bson-corpus/decimal128-3-valid-090.phpt" role="test" />
+ <file md5sum="638ab77583c9c5e4e9c871912570956d" name="tests/bson-corpus/decimal128-3-valid-091.phpt" role="test" />
+ <file md5sum="8a8d77fcd2901901778ad14dd429d4f9" name="tests/bson-corpus/decimal128-3-valid-092.phpt" role="test" />
+ <file md5sum="9e10fc1799fdfc7e3146cd959a90879c" name="tests/bson-corpus/decimal128-3-valid-093.phpt" role="test" />
+ <file md5sum="03ec8a5d9b418edfc9c64635e78184cb" name="tests/bson-corpus/decimal128-3-valid-094.phpt" role="test" />
+ <file md5sum="0cd7ab7514aec4a434044911417b7f20" name="tests/bson-corpus/decimal128-3-valid-095.phpt" role="test" />
+ <file md5sum="22ddfe6a9d6586d6663f5a457ce53939" name="tests/bson-corpus/decimal128-3-valid-096.phpt" role="test" />
+ <file md5sum="2950c953823e9dac7f0524615a5ea75b" name="tests/bson-corpus/decimal128-3-valid-097.phpt" role="test" />
+ <file md5sum="8bcce0d305a4e3267a2c3135ab6c3363" name="tests/bson-corpus/decimal128-3-valid-098.phpt" role="test" />
+ <file md5sum="c302c8fa96a0a4de868063509248ea4c" name="tests/bson-corpus/decimal128-3-valid-099.phpt" role="test" />
+ <file md5sum="46342935b3fe9490b0ca414602790a31" name="tests/bson-corpus/decimal128-3-valid-100.phpt" role="test" />
+ <file md5sum="3a7945190c82bd6c90a55a51739d3f20" name="tests/bson-corpus/decimal128-3-valid-101.phpt" role="test" />
+ <file md5sum="5531be2ce08a27ff9d41b84a6efec3da" name="tests/bson-corpus/decimal128-3-valid-102.phpt" role="test" />
+ <file md5sum="28b107bbdb4e18920f459e24321fa62d" name="tests/bson-corpus/decimal128-3-valid-103.phpt" role="test" />
+ <file md5sum="eef87f9b626d0d664d3658215d78aea9" name="tests/bson-corpus/decimal128-3-valid-104.phpt" role="test" />
+ <file md5sum="dadbf512c4b032d69064095c98d16796" name="tests/bson-corpus/decimal128-3-valid-105.phpt" role="test" />
+ <file md5sum="0367c7a5be13f0f9c5538e517f44c55f" name="tests/bson-corpus/decimal128-3-valid-106.phpt" role="test" />
+ <file md5sum="89bd11ac11fc33b6ab065b51096f3e6a" name="tests/bson-corpus/decimal128-3-valid-107.phpt" role="test" />
+ <file md5sum="0e274ef0f1fc68301fd451ca1d0e8182" name="tests/bson-corpus/decimal128-3-valid-108.phpt" role="test" />
+ <file md5sum="e60ae7a818bf4e2b4cc6440e70c995cd" name="tests/bson-corpus/decimal128-3-valid-109.phpt" role="test" />
+ <file md5sum="4a611b2f371b1e2dcd15ad6c5dea02bf" name="tests/bson-corpus/decimal128-3-valid-110.phpt" role="test" />
+ <file md5sum="792156b2e4e41665d310f36207f100be" name="tests/bson-corpus/decimal128-3-valid-111.phpt" role="test" />
+ <file md5sum="d14468035a861ab49d69ff18a73ce7ad" name="tests/bson-corpus/decimal128-3-valid-112.phpt" role="test" />
+ <file md5sum="85080b6fccdd3a050d4b7a334ec01a0d" name="tests/bson-corpus/decimal128-3-valid-113.phpt" role="test" />
+ <file md5sum="0e920ef2e236f1516579a4345fb7dea7" name="tests/bson-corpus/decimal128-3-valid-114.phpt" role="test" />
+ <file md5sum="14ea386736a1f07fa3f984b190159669" name="tests/bson-corpus/decimal128-3-valid-115.phpt" role="test" />
+ <file md5sum="e031831513f6230d917b9ab4fb9ef07a" name="tests/bson-corpus/decimal128-3-valid-116.phpt" role="test" />
+ <file md5sum="a7da0bd42af332a730ede9b47144693e" name="tests/bson-corpus/decimal128-3-valid-117.phpt" role="test" />
+ <file md5sum="cfdc4867121ceca2120fcd926519c333" name="tests/bson-corpus/decimal128-3-valid-118.phpt" role="test" />
+ <file md5sum="dfbfc9f1af2916c12c5701fc2c996af1" name="tests/bson-corpus/decimal128-3-valid-119.phpt" role="test" />
+ <file md5sum="9307f6c98fcea3ff196726a4492ddbc3" name="tests/bson-corpus/decimal128-3-valid-120.phpt" role="test" />
+ <file md5sum="d9138399671ee6b0e2fa4eeb4a49642a" name="tests/bson-corpus/decimal128-3-valid-121.phpt" role="test" />
+ <file md5sum="7f2b7c93f3b4550f65999f4510fc1d11" name="tests/bson-corpus/decimal128-3-valid-122.phpt" role="test" />
+ <file md5sum="255e4b9d87e52afd1353d66edec172ff" name="tests/bson-corpus/decimal128-3-valid-123.phpt" role="test" />
+ <file md5sum="2514ad5b4bc5234e917a4a86bf76b040" name="tests/bson-corpus/decimal128-3-valid-124.phpt" role="test" />
+ <file md5sum="3406b71b2dbba849bc1daa7b3eb7c21d" name="tests/bson-corpus/decimal128-3-valid-125.phpt" role="test" />
+ <file md5sum="b8f89f169053b9875ef542b5a9821960" name="tests/bson-corpus/decimal128-3-valid-126.phpt" role="test" />
+ <file md5sum="5973f2a9e7b56370a5dfaac3dbe7d4cf" name="tests/bson-corpus/decimal128-3-valid-127.phpt" role="test" />
+ <file md5sum="42f8a01da05eb16b624e3eafea395dba" name="tests/bson-corpus/decimal128-3-valid-128.phpt" role="test" />
+ <file md5sum="dcf41e7872d68b6318477d5a22d76f66" name="tests/bson-corpus/decimal128-3-valid-129.phpt" role="test" />
+ <file md5sum="c47200c007474ec7feb4f5c7d31f6bd3" name="tests/bson-corpus/decimal128-3-valid-130.phpt" role="test" />
+ <file md5sum="403cd5015193dc1359a234043c4c2d06" name="tests/bson-corpus/decimal128-3-valid-131.phpt" role="test" />
+ <file md5sum="87cf20cd2de390440b9fb0e68b44e145" name="tests/bson-corpus/decimal128-3-valid-132.phpt" role="test" />
+ <file md5sum="a4922dbf1ebfe1df4c13cbdbde5664c5" name="tests/bson-corpus/decimal128-3-valid-133.phpt" role="test" />
+ <file md5sum="6eec2683ac4790860386e6e455515fe4" name="tests/bson-corpus/decimal128-3-valid-134.phpt" role="test" />
+ <file md5sum="bec1b425b43bd056f525bca81d288a92" name="tests/bson-corpus/decimal128-3-valid-135.phpt" role="test" />
+ <file md5sum="25c116994473b94ffaf0c83c2147eb32" name="tests/bson-corpus/decimal128-3-valid-136.phpt" role="test" />
+ <file md5sum="74a76f817055a9b665782e042a6a36c2" name="tests/bson-corpus/decimal128-3-valid-137.phpt" role="test" />
+ <file md5sum="51a49db80fde9f5b7f96f6d13373b20a" name="tests/bson-corpus/decimal128-3-valid-138.phpt" role="test" />
+ <file md5sum="7c191d42ff20ecc517507b2ee4e687cc" name="tests/bson-corpus/decimal128-3-valid-139.phpt" role="test" />
+ <file md5sum="66f3873265883591bc6000ddbe75ff0b" name="tests/bson-corpus/decimal128-3-valid-140.phpt" role="test" />
+ <file md5sum="25e69bb7b160ee52e4d194dfb7cd54a8" name="tests/bson-corpus/decimal128-3-valid-141.phpt" role="test" />
+ <file md5sum="86d777e16bd1d1651a0d06d562c7d0af" name="tests/bson-corpus/decimal128-3-valid-142.phpt" role="test" />
+ <file md5sum="9a6cc3027b0e9e01f7c3c7a4bcebb63a" name="tests/bson-corpus/decimal128-3-valid-143.phpt" role="test" />
+ <file md5sum="0da0ce79702a02b7ba69ed3a5544520e" name="tests/bson-corpus/decimal128-3-valid-144.phpt" role="test" />
+ <file md5sum="d2a7a72b53bc6a7bf5ae3e415ebeae7c" name="tests/bson-corpus/decimal128-3-valid-145.phpt" role="test" />
+ <file md5sum="83ca17d95097da73ec05416030ddcbc4" name="tests/bson-corpus/decimal128-3-valid-146.phpt" role="test" />
+ <file md5sum="bb1661b9b9d7cadea80c57d87fa9ebca" name="tests/bson-corpus/decimal128-3-valid-147.phpt" role="test" />
+ <file md5sum="d87b51a08189a89c594d060c1371c851" name="tests/bson-corpus/decimal128-3-valid-148.phpt" role="test" />
+ <file md5sum="e496964f5418f257677aaef8cfa123cd" name="tests/bson-corpus/decimal128-3-valid-149.phpt" role="test" />
+ <file md5sum="84f2b34c1efe22f8e28c2582eeaa562c" name="tests/bson-corpus/decimal128-3-valid-150.phpt" role="test" />
+ <file md5sum="331228d231d00b039f6ee802a99b62bb" name="tests/bson-corpus/decimal128-3-valid-151.phpt" role="test" />
+ <file md5sum="d553044583e56c068fea77ee51baa1aa" name="tests/bson-corpus/decimal128-3-valid-152.phpt" role="test" />
+ <file md5sum="df8c48ed972da98710aa4a3e850ec593" name="tests/bson-corpus/decimal128-3-valid-153.phpt" role="test" />
+ <file md5sum="c5afcba344bb379047dc9a2aac1a6e38" name="tests/bson-corpus/decimal128-3-valid-154.phpt" role="test" />
+ <file md5sum="584b55c11cff38e79f5fb17a819a12e4" name="tests/bson-corpus/decimal128-3-valid-155.phpt" role="test" />
+ <file md5sum="3b988b7c8c981bf1cb497e9d2ff83db4" name="tests/bson-corpus/decimal128-3-valid-156.phpt" role="test" />
+ <file md5sum="a2d9f0fcfc471bd2fdff4fb494db0b13" name="tests/bson-corpus/decimal128-3-valid-157.phpt" role="test" />
+ <file md5sum="fed79abdd0c4023a0d8a4bab88ce8bf3" name="tests/bson-corpus/decimal128-3-valid-158.phpt" role="test" />
+ <file md5sum="68d65c65b413378135335314d5891090" name="tests/bson-corpus/decimal128-3-valid-159.phpt" role="test" />
+ <file md5sum="746f5e7a258b6807142cf7a622d44750" name="tests/bson-corpus/decimal128-3-valid-160.phpt" role="test" />
+ <file md5sum="e547bcc5d67e35e534286093b16fb478" name="tests/bson-corpus/decimal128-3-valid-161.phpt" role="test" />
+ <file md5sum="f55d3e7e3aebf8fa9aed5eaf2cbdb582" name="tests/bson-corpus/decimal128-3-valid-162.phpt" role="test" />
+ <file md5sum="35aed3a16616975685faa8b2ead8746e" name="tests/bson-corpus/decimal128-3-valid-163.phpt" role="test" />
+ <file md5sum="792dee2f5c70bc4f83e3e1f79ee8d51c" name="tests/bson-corpus/decimal128-3-valid-164.phpt" role="test" />
+ <file md5sum="90d0d7e41f41ce23c3c05939bccf8c4f" name="tests/bson-corpus/decimal128-3-valid-165.phpt" role="test" />
+ <file md5sum="23a5ce93fd58331668cba30415a3f1dc" name="tests/bson-corpus/decimal128-3-valid-166.phpt" role="test" />
+ <file md5sum="fd067cdd9411b798858948ecb13b9138" name="tests/bson-corpus/decimal128-3-valid-167.phpt" role="test" />
+ <file md5sum="defaaad2acfb0a97f598f91732870d85" name="tests/bson-corpus/decimal128-3-valid-168.phpt" role="test" />
+ <file md5sum="3f86b6f4ae735f3cf31313ad926f577d" name="tests/bson-corpus/decimal128-3-valid-169.phpt" role="test" />
+ <file md5sum="2e478f5b8dc88f23291f713773641eb7" name="tests/bson-corpus/decimal128-3-valid-170.phpt" role="test" />
+ <file md5sum="6c7a195b50cb0739fd10cc2d503d545e" name="tests/bson-corpus/decimal128-3-valid-171.phpt" role="test" />
+ <file md5sum="ffde31ef1db7bab79889c0fde63522f3" name="tests/bson-corpus/decimal128-3-valid-172.phpt" role="test" />
+ <file md5sum="6b9f8c0a2cfa0cb79124d12ee6f36e46" name="tests/bson-corpus/decimal128-3-valid-173.phpt" role="test" />
+ <file md5sum="24006cc13eb66107c64875ec6078f7e4" name="tests/bson-corpus/decimal128-3-valid-174.phpt" role="test" />
+ <file md5sum="08cfcf8db6640adb47417ae4fa5f3635" name="tests/bson-corpus/decimal128-3-valid-175.phpt" role="test" />
+ <file md5sum="a4bd4012d10f56e1bbaa372fecc455e0" name="tests/bson-corpus/decimal128-3-valid-176.phpt" role="test" />
+ <file md5sum="e4a2c912c37ebfddc1e9a073123d910b" name="tests/bson-corpus/decimal128-3-valid-177.phpt" role="test" />
+ <file md5sum="82fcd6bfd1993bb371ba2d677f6acdf5" name="tests/bson-corpus/decimal128-3-valid-178.phpt" role="test" />
+ <file md5sum="8af686fe3d18324b1408f98dc6c28e06" name="tests/bson-corpus/decimal128-3-valid-179.phpt" role="test" />
+ <file md5sum="5f239fa727a53d3f3aa9759f3b00e950" name="tests/bson-corpus/decimal128-3-valid-180.phpt" role="test" />
+ <file md5sum="f4c427a8e3dc41f1815823d157f02231" name="tests/bson-corpus/decimal128-3-valid-181.phpt" role="test" />
+ <file md5sum="6eb6a3bc58c86a2e5347bc80fc4e56ca" name="tests/bson-corpus/decimal128-3-valid-182.phpt" role="test" />
+ <file md5sum="6b1834febe21170031d55c513fa48875" name="tests/bson-corpus/decimal128-3-valid-183.phpt" role="test" />
+ <file md5sum="d752e16f975699f03b02a3fe77c13cf7" name="tests/bson-corpus/decimal128-3-valid-184.phpt" role="test" />
+ <file md5sum="ed50867144dd38763269f6c58c23ae40" name="tests/bson-corpus/decimal128-3-valid-185.phpt" role="test" />
+ <file md5sum="70571a95548710c4dd3196bc8979c530" name="tests/bson-corpus/decimal128-3-valid-186.phpt" role="test" />
+ <file md5sum="26e0f8746c7cc40ce6430c8fba76c078" name="tests/bson-corpus/decimal128-3-valid-187.phpt" role="test" />
+ <file md5sum="ff9770f368ea3012f9d67efd11d35cf6" name="tests/bson-corpus/decimal128-3-valid-188.phpt" role="test" />
+ <file md5sum="7bfebadce228cb6c47806baa5aec80db" name="tests/bson-corpus/decimal128-3-valid-189.phpt" role="test" />
+ <file md5sum="77311efb88b28c07e998fdec2f9fe6f8" name="tests/bson-corpus/decimal128-3-valid-190.phpt" role="test" />
+ <file md5sum="9adc7ecb9d6a71345da755957c57e581" name="tests/bson-corpus/decimal128-3-valid-191.phpt" role="test" />
+ <file md5sum="aa27f0de7adb28d0a25d1153be866039" name="tests/bson-corpus/decimal128-3-valid-192.phpt" role="test" />
+ <file md5sum="13ea9ce25312096e0d651fb1b13e85c2" name="tests/bson-corpus/decimal128-3-valid-193.phpt" role="test" />
+ <file md5sum="73c8ae44ed43cc9cb90150c7be8b9a6b" name="tests/bson-corpus/decimal128-3-valid-194.phpt" role="test" />
+ <file md5sum="2b7c0c6a1f77516033826635977ad798" name="tests/bson-corpus/decimal128-3-valid-195.phpt" role="test" />
+ <file md5sum="d77f65fb1fe5c04033fc1fdca9e80d87" name="tests/bson-corpus/decimal128-3-valid-196.phpt" role="test" />
+ <file md5sum="7483db75d6252a398a640d9b75026bea" name="tests/bson-corpus/decimal128-3-valid-197.phpt" role="test" />
+ <file md5sum="bb966953121447ed5bb150390c82786a" name="tests/bson-corpus/decimal128-3-valid-198.phpt" role="test" />
+ <file md5sum="a6a42fdd13f202390639599d76de304f" name="tests/bson-corpus/decimal128-3-valid-199.phpt" role="test" />
+ <file md5sum="57011a2e406dc06bdc60ef4a46f9c192" name="tests/bson-corpus/decimal128-3-valid-200.phpt" role="test" />
+ <file md5sum="5a2373accfa7082b87c7866b4f8b04fb" name="tests/bson-corpus/decimal128-3-valid-201.phpt" role="test" />
+ <file md5sum="c52261cd4fab0456e49873f3537bff89" name="tests/bson-corpus/decimal128-3-valid-202.phpt" role="test" />
+ <file md5sum="358a20efd6e7b3163b7a166d2115d97c" name="tests/bson-corpus/decimal128-3-valid-203.phpt" role="test" />
+ <file md5sum="a23dbb7169988953de34c7a5c1cae69b" name="tests/bson-corpus/decimal128-3-valid-204.phpt" role="test" />
+ <file md5sum="e149450d071bd1c3607bdc44ad6a0adc" name="tests/bson-corpus/decimal128-3-valid-205.phpt" role="test" />
+ <file md5sum="0bb6ce4f2444b4f51518a88e5f7fbb2c" name="tests/bson-corpus/decimal128-3-valid-206.phpt" role="test" />
+ <file md5sum="4376463be511cac5e85f0f69e966d90a" name="tests/bson-corpus/decimal128-3-valid-207.phpt" role="test" />
+ <file md5sum="f08219dd64c0a8a66f94b740f9880d5f" name="tests/bson-corpus/decimal128-3-valid-208.phpt" role="test" />
+ <file md5sum="10c157e27095e3d5335e60245cad434d" name="tests/bson-corpus/decimal128-3-valid-209.phpt" role="test" />
+ <file md5sum="858f8cdaf5204988a602fd8238cf49b6" name="tests/bson-corpus/decimal128-3-valid-210.phpt" role="test" />
+ <file md5sum="785e341f3ad65adc61e78766c3f688a3" name="tests/bson-corpus/decimal128-3-valid-211.phpt" role="test" />
+ <file md5sum="f57ac4ce709a0856e0cb775caf8e83f3" name="tests/bson-corpus/decimal128-3-valid-212.phpt" role="test" />
+ <file md5sum="262540246855633fed15d1d95c22fb9c" name="tests/bson-corpus/decimal128-3-valid-213.phpt" role="test" />
+ <file md5sum="deba324580e26250f0e478036afb75e7" name="tests/bson-corpus/decimal128-3-valid-214.phpt" role="test" />
+ <file md5sum="07e12693b7ba323edc65d0e871cfa6d1" name="tests/bson-corpus/decimal128-3-valid-215.phpt" role="test" />
+ <file md5sum="2219fe7ad004de2e4f9ad79aaa4b45c3" name="tests/bson-corpus/decimal128-3-valid-216.phpt" role="test" />
+ <file md5sum="15d1ea83871cb6c16079c05115ad5ba7" name="tests/bson-corpus/decimal128-3-valid-217.phpt" role="test" />
+ <file md5sum="537f90d02bdbc6d15b4eb3a4e0480e15" name="tests/bson-corpus/decimal128-3-valid-218.phpt" role="test" />
+ <file md5sum="44fedd06087ba3a94690c9b76a7cc81e" name="tests/bson-corpus/decimal128-3-valid-219.phpt" role="test" />
+ <file md5sum="9fb5763344ac237753e1ceedc0243dff" name="tests/bson-corpus/decimal128-3-valid-220.phpt" role="test" />
+ <file md5sum="60001b174df72ed710e1f4c1411e224a" name="tests/bson-corpus/decimal128-3-valid-221.phpt" role="test" />
+ <file md5sum="57edc16aba64f4b0ff91c23827f8800a" name="tests/bson-corpus/decimal128-3-valid-222.phpt" role="test" />
+ <file md5sum="7f8a98044eda3630a45a4e7b9b8c9e1c" name="tests/bson-corpus/decimal128-3-valid-223.phpt" role="test" />
+ <file md5sum="20b53f27aea7d0224ac5927d54583084" name="tests/bson-corpus/decimal128-3-valid-224.phpt" role="test" />
+ <file md5sum="91866fbd5e8e08d48de57298488bff53" name="tests/bson-corpus/decimal128-3-valid-225.phpt" role="test" />
+ <file md5sum="e88ca82028e583c128fb266ecbe184b1" name="tests/bson-corpus/decimal128-3-valid-226.phpt" role="test" />
+ <file md5sum="a04a4b8aee7961cb11315321a18bcb58" name="tests/bson-corpus/decimal128-3-valid-227.phpt" role="test" />
+ <file md5sum="42cb4d0bbfc93b67ff0094f144f83184" name="tests/bson-corpus/decimal128-3-valid-228.phpt" role="test" />
+ <file md5sum="252cfccb23c53daffaa7f9b7cd96957d" name="tests/bson-corpus/decimal128-3-valid-229.phpt" role="test" />
+ <file md5sum="b7c49d7e70e2b7a802ca331567ce707b" name="tests/bson-corpus/decimal128-3-valid-230.phpt" role="test" />
+ <file md5sum="ed5d09f39704e0c878f4cd7d0d95ab13" name="tests/bson-corpus/decimal128-3-valid-231.phpt" role="test" />
+ <file md5sum="a51d054198f8c0cdf32746127f4586fa" name="tests/bson-corpus/decimal128-3-valid-232.phpt" role="test" />
+ <file md5sum="d4c06976e263aac0987435c1e7cc5493" name="tests/bson-corpus/decimal128-3-valid-233.phpt" role="test" />
+ <file md5sum="b95cb024e678ad2c66b26466fc6f23ca" name="tests/bson-corpus/decimal128-3-valid-234.phpt" role="test" />
+ <file md5sum="56ed71ce5daad3044a738e739f6c8c63" name="tests/bson-corpus/decimal128-3-valid-235.phpt" role="test" />
+ <file md5sum="e60af68ee14f6f9b3f41e82736509a77" name="tests/bson-corpus/decimal128-3-valid-236.phpt" role="test" />
+ <file md5sum="37053f58cc00540d8c5e7550e34484c2" name="tests/bson-corpus/decimal128-3-valid-237.phpt" role="test" />
+ <file md5sum="526e643e4814fdc1e3dc5790a232bda1" name="tests/bson-corpus/decimal128-3-valid-238.phpt" role="test" />
+ <file md5sum="e553b6b4c09af73de4db3e08ba4b569b" name="tests/bson-corpus/decimal128-3-valid-239.phpt" role="test" />
+ <file md5sum="7e421c67ba313b30712b6357b3186d41" name="tests/bson-corpus/decimal128-3-valid-240.phpt" role="test" />
+ <file md5sum="bc4f5577cacd54bebce70d0f0f369111" name="tests/bson-corpus/decimal128-3-valid-241.phpt" role="test" />
+ <file md5sum="dbd079c3c21ec8469984afca99271dd3" name="tests/bson-corpus/decimal128-3-valid-242.phpt" role="test" />
+ <file md5sum="d1f9e0840bb92b11def2704298e4a986" name="tests/bson-corpus/decimal128-3-valid-243.phpt" role="test" />
+ <file md5sum="49cf42b9591564e11733c69706761c25" name="tests/bson-corpus/decimal128-3-valid-244.phpt" role="test" />
+ <file md5sum="55cc7c70fbb99e84e4771d292152c513" name="tests/bson-corpus/decimal128-3-valid-245.phpt" role="test" />
+ <file md5sum="e226d70a229f5249054275aee98e74c4" name="tests/bson-corpus/decimal128-3-valid-246.phpt" role="test" />
+ <file md5sum="3be73d8b2a3c2a7e74a31ff0bf5f17cc" name="tests/bson-corpus/decimal128-3-valid-247.phpt" role="test" />
+ <file md5sum="001a8239e9544572cebf6e0e953b99e2" name="tests/bson-corpus/decimal128-3-valid-248.phpt" role="test" />
+ <file md5sum="2b328bc1cd8bf1a778e7943fe35e847f" name="tests/bson-corpus/decimal128-3-valid-249.phpt" role="test" />
+ <file md5sum="b197dffbcfadee81b9b7bfada033b701" name="tests/bson-corpus/decimal128-3-valid-250.phpt" role="test" />
+ <file md5sum="2f74dff3f5a1db62076baa6daed46f14" name="tests/bson-corpus/decimal128-3-valid-251.phpt" role="test" />
+ <file md5sum="ac00284616ba749d49c588c10b835311" name="tests/bson-corpus/decimal128-3-valid-252.phpt" role="test" />
+ <file md5sum="0d68b01678c47576d3de2a7cd6a6c962" name="tests/bson-corpus/decimal128-3-valid-253.phpt" role="test" />
+ <file md5sum="753cbbec677ad4d04cef6a1b2cadfefb" name="tests/bson-corpus/decimal128-3-valid-254.phpt" role="test" />
+ <file md5sum="41c6ec49548629dfbac39e97c597b14c" name="tests/bson-corpus/decimal128-3-valid-255.phpt" role="test" />
+ <file md5sum="1b2f49765bff4de28e9235ed8ddfa459" name="tests/bson-corpus/decimal128-3-valid-256.phpt" role="test" />
+ <file md5sum="e6133a689f40fde8bdb174905a9032ef" name="tests/bson-corpus/decimal128-3-valid-257.phpt" role="test" />
+ <file md5sum="f697063681da22ed00d39f3ea228e69b" name="tests/bson-corpus/decimal128-3-valid-258.phpt" role="test" />
+ <file md5sum="1896768cec7c92ead8540f58885270ce" name="tests/bson-corpus/decimal128-3-valid-259.phpt" role="test" />
+ <file md5sum="1c8c59f29595e561ed64b36aa8fa1918" name="tests/bson-corpus/decimal128-3-valid-260.phpt" role="test" />
+ <file md5sum="e8ffc23e3a519e3c0b7de5dba175e3a6" name="tests/bson-corpus/decimal128-3-valid-261.phpt" role="test" />
+ <file md5sum="e0e662835106a30dc89f98e7df97329c" name="tests/bson-corpus/decimal128-3-valid-262.phpt" role="test" />
+ <file md5sum="25d8d67262bb54e54ce7abfcfc273d77" name="tests/bson-corpus/decimal128-3-valid-263.phpt" role="test" />
+ <file md5sum="8e745a770d2e19d8921ab64d3d61f4dc" name="tests/bson-corpus/decimal128-3-valid-264.phpt" role="test" />
+ <file md5sum="7e6f451258aa6e8672f1daba5a71d12b" name="tests/bson-corpus/decimal128-3-valid-265.phpt" role="test" />
+ <file md5sum="3ab50de542517e2ea33ea87539f77c66" name="tests/bson-corpus/decimal128-3-valid-266.phpt" role="test" />
+ <file md5sum="6b98a72d8148df6083664c00d017a5cb" name="tests/bson-corpus/decimal128-3-valid-267.phpt" role="test" />
+ <file md5sum="2dabb61eed99151b40311b5c8bc1b0b4" name="tests/bson-corpus/decimal128-3-valid-268.phpt" role="test" />
+ <file md5sum="2e664d57601586a1057b85edffd2aa1a" name="tests/bson-corpus/decimal128-3-valid-269.phpt" role="test" />
+ <file md5sum="d2f71baf5df4287d808d5d06076afee6" name="tests/bson-corpus/decimal128-3-valid-270.phpt" role="test" />
+ <file md5sum="84bc1e860500364265d966c8f75971ff" name="tests/bson-corpus/decimal128-3-valid-271.phpt" role="test" />
+ <file md5sum="bb00b6b0b3f767ba268c54b63fe1f257" name="tests/bson-corpus/decimal128-3-valid-272.phpt" role="test" />
+ <file md5sum="0d59a2985a349a2e29b5da7593ddc91b" name="tests/bson-corpus/decimal128-3-valid-273.phpt" role="test" />
+ <file md5sum="62bad24a1ba7abfdeafb1022ac68afef" name="tests/bson-corpus/decimal128-3-valid-274.phpt" role="test" />
+ <file md5sum="17ee833899f799343a37c84c67ff88fe" name="tests/bson-corpus/decimal128-3-valid-275.phpt" role="test" />
+ <file md5sum="db8c84d99c9006156fb0ee421cdcbeb3" name="tests/bson-corpus/decimal128-3-valid-276.phpt" role="test" />
+ <file md5sum="5dd07828be352b79c91fe0a9719ddfce" name="tests/bson-corpus/decimal128-3-valid-277.phpt" role="test" />
+ <file md5sum="8dc43ceaa6290e74f5bbf346915a1f96" name="tests/bson-corpus/decimal128-3-valid-278.phpt" role="test" />
+ <file md5sum="2bb4d0aa6309bca1c81544605832bdd3" name="tests/bson-corpus/decimal128-3-valid-279.phpt" role="test" />
+ <file md5sum="2f43dd06ad96ceb046de95748aeeecf4" name="tests/bson-corpus/decimal128-3-valid-280.phpt" role="test" />
+ <file md5sum="b20dd578e123ffcfe7e6e7d0b800ca6e" name="tests/bson-corpus/decimal128-3-valid-281.phpt" role="test" />
+ <file md5sum="8c08772fc879262792b5f34b59df20b9" name="tests/bson-corpus/decimal128-3-valid-282.phpt" role="test" />
+ <file md5sum="7c882123d776a9ab2d7b8ed4f9e63cc2" name="tests/bson-corpus/decimal128-3-valid-283.phpt" role="test" />
+ <file md5sum="a2a5b9e8e8f4518865e5ca07fa7883a9" name="tests/bson-corpus/decimal128-3-valid-284.phpt" role="test" />
+ <file md5sum="7fb820ecd88f027cfec7de76b8384f3b" name="tests/bson-corpus/decimal128-3-valid-285.phpt" role="test" />
+ <file md5sum="e7e29284cecc3beb27d9df6951ae37e8" name="tests/bson-corpus/decimal128-3-valid-286.phpt" role="test" />
+ <file md5sum="beaaeeeddcd5fc46154397865325eb19" name="tests/bson-corpus/decimal128-3-valid-287.phpt" role="test" />
+ <file md5sum="ba6da457f6ed9c989d1c9d59c52f9054" name="tests/bson-corpus/decimal128-3-valid-288.phpt" role="test" />
+ <file md5sum="6439910fd2f55b528eafe24a6acc5410" name="tests/bson-corpus/decimal128-3-valid-289.phpt" role="test" />
+ <file md5sum="ae1b6bf8c0be65f5fa9a32a0106aa542" name="tests/bson-corpus/decimal128-3-valid-290.phpt" role="test" />
+ <file md5sum="1c7fe306f17129aab76ce7b05ab1ca46" name="tests/bson-corpus/decimal128-3-valid-291.phpt" role="test" />
+ <file md5sum="af55e2796ba89db55d7b8b114fbc2539" name="tests/bson-corpus/decimal128-3-valid-292.phpt" role="test" />
+ <file md5sum="f617c7e2f4785b1d8094902989d983a8" name="tests/bson-corpus/decimal128-3-valid-293.phpt" role="test" />
+ <file md5sum="e37f5dc152cc1832c59f2d1af03aa772" name="tests/bson-corpus/decimal128-3-valid-294.phpt" role="test" />
+ <file md5sum="d6f6441f60cc061c99e8a61b598be6bd" name="tests/bson-corpus/decimal128-3-valid-295.phpt" role="test" />
+ <file md5sum="54791b21268f4ee8396270c92f280223" name="tests/bson-corpus/decimal128-3-valid-296.phpt" role="test" />
+ <file md5sum="9e37ff3ff72a39ffbb93b1ee1f131dce" name="tests/bson-corpus/decimal128-3-valid-297.phpt" role="test" />
+ <file md5sum="911a5ee66ae913691ddbaa594c83fc19" name="tests/bson-corpus/decimal128-3-valid-298.phpt" role="test" />
+ <file md5sum="594abe74d6b1a6389ccf2578c6ea8fd5" name="tests/bson-corpus/decimal128-3-valid-299.phpt" role="test" />
+ <file md5sum="09efda208cdd029578a3385c334b07cb" name="tests/bson-corpus/decimal128-3-valid-300.phpt" role="test" />
+ <file md5sum="b73dfa8e48e3c8acf2aa19e1e647cb2a" name="tests/bson-corpus/decimal128-3-valid-301.phpt" role="test" />
+ <file md5sum="2756e7e822a5dc1ac594719d41f5089f" name="tests/bson-corpus/decimal128-3-valid-302.phpt" role="test" />
+ <file md5sum="7a76f61639c1129fdc65fbcea8c610f8" name="tests/bson-corpus/decimal128-3-valid-303.phpt" role="test" />
+ <file md5sum="16728d2d184f4cb07c56da4db26dc55a" name="tests/bson-corpus/decimal128-3-valid-304.phpt" role="test" />
+ <file md5sum="967e325902aa46fd6b5a77aceb2ee4c2" name="tests/bson-corpus/decimal128-3-valid-305.phpt" role="test" />
+ <file md5sum="d0ddb6f2f1eed403a132600d4d1797a1" name="tests/bson-corpus/decimal128-3-valid-306.phpt" role="test" />
+ <file md5sum="0b099f8ee1182084e5c12a31753f0ba9" name="tests/bson-corpus/decimal128-3-valid-307.phpt" role="test" />
+ <file md5sum="578ac4d868f89d07030980898a51a5c0" name="tests/bson-corpus/decimal128-3-valid-308.phpt" role="test" />
<file md5sum="9ec3b1d0453a41981144d85b0f3eb575" name="tests/bson-corpus/decimal128-4-parseError-001.phpt" role="test" />
<file md5sum="506cd6ad521dacb23091429867c77f69" name="tests/bson-corpus/decimal128-4-parseError-002.phpt" role="test" />
<file md5sum="4d1c8bb08975e5f5689fddaeec8e8402" name="tests/bson-corpus/decimal128-4-parseError-003.phpt" role="test" />
<file md5sum="09a3731b634372e305ab1d20459a38b1" name="tests/bson-corpus/decimal128-4-parseError-004.phpt" role="test" />
<file md5sum="e6c661208cdfce2b594b7e438a5cb586" name="tests/bson-corpus/decimal128-4-parseError-005.phpt" role="test" />
<file md5sum="7abd53b9fd4b63103042469f1e712c51" name="tests/bson-corpus/decimal128-4-parseError-006.phpt" role="test" />
<file md5sum="a414cd52ef74a681a04bd08d174e07a4" name="tests/bson-corpus/decimal128-4-parseError-007.phpt" role="test" />
<file md5sum="93f7b286ece0c2cdc8ca80fb6deb3c29" name="tests/bson-corpus/decimal128-4-parseError-008.phpt" role="test" />
<file md5sum="a48bd5fa08ac0fd11524f9ed4349ea00" name="tests/bson-corpus/decimal128-4-parseError-009.phpt" role="test" />
<file md5sum="59db6e06cb969d386d2c4aff43789350" name="tests/bson-corpus/decimal128-4-parseError-010.phpt" role="test" />
<file md5sum="d5e93f9615e8a86ebb8406a5f06554d3" name="tests/bson-corpus/decimal128-4-parseError-011.phpt" role="test" />
<file md5sum="da29e2793f0f33cde882297f3ad93d16" name="tests/bson-corpus/decimal128-4-parseError-012.phpt" role="test" />
<file md5sum="bfa1678cd7627d4ffb33da8a97bc3291" name="tests/bson-corpus/decimal128-4-parseError-013.phpt" role="test" />
<file md5sum="e5ceaa080a31506dc370cb4eb584e5ce" name="tests/bson-corpus/decimal128-4-parseError-014.phpt" role="test" />
<file md5sum="7cc0cb86e19dacbd5a1950a36253bb9e" name="tests/bson-corpus/decimal128-4-parseError-015.phpt" role="test" />
<file md5sum="a0b16a86367ed7b6b0e708145d800cdf" name="tests/bson-corpus/decimal128-4-parseError-016.phpt" role="test" />
<file md5sum="fea774bacaf0b19b966a1cbf4eb7e495" name="tests/bson-corpus/decimal128-4-parseError-017.phpt" role="test" />
<file md5sum="0769502b551a8f55b21986d410a89bc4" name="tests/bson-corpus/decimal128-4-parseError-018.phpt" role="test" />
<file md5sum="f700e859506a827495b206157d0e79c1" name="tests/bson-corpus/decimal128-4-parseError-019.phpt" role="test" />
<file md5sum="15c4a2681de9e3e17634e0456dbb81f9" name="tests/bson-corpus/decimal128-4-parseError-020.phpt" role="test" />
- <file md5sum="3d6c296dd577cf2f6d2d6fe52a07be20" name="tests/bson-corpus/decimal128-4-valid-001.phpt" role="test" />
- <file md5sum="3b1e53207bff49057a875a76ceab1058" name="tests/bson-corpus/decimal128-4-valid-002.phpt" role="test" />
- <file md5sum="c32fa8265ce7a165b28270e91c6afcbb" name="tests/bson-corpus/decimal128-4-valid-003.phpt" role="test" />
- <file md5sum="fdcd72b9eed2a19ebbcdda5ffc0d3df6" name="tests/bson-corpus/decimal128-4-valid-004.phpt" role="test" />
- <file md5sum="1306105e2f10e6f78d184b092a953020" name="tests/bson-corpus/decimal128-4-valid-005.phpt" role="test" />
- <file md5sum="3d26a89dbcb3e20d41bbc7c4ea88bf18" name="tests/bson-corpus/decimal128-4-valid-006.phpt" role="test" />
- <file md5sum="564b1167b72d3ac047170a0055b63026" name="tests/bson-corpus/decimal128-4-valid-007.phpt" role="test" />
- <file md5sum="035a85fee0cd8c911c489b8e2d0d934e" name="tests/bson-corpus/decimal128-4-valid-008.phpt" role="test" />
- <file md5sum="4b7270c06d321789031e4ffd0339134d" name="tests/bson-corpus/decimal128-4-valid-009.phpt" role="test" />
- <file md5sum="12008e294dc7a4e60bbdbc86db43ef9a" name="tests/bson-corpus/decimal128-4-valid-010.phpt" role="test" />
- <file md5sum="36af20079f691c94fd97142c9db41f77" name="tests/bson-corpus/decimal128-4-valid-011.phpt" role="test" />
- <file md5sum="65841643c7443e84ee055d8fccff8fbe" name="tests/bson-corpus/decimal128-4-valid-012.phpt" role="test" />
- <file md5sum="59d23c843f648bd0c2f389758d9b966e" name="tests/bson-corpus/decimal128-4-valid-013.phpt" role="test" />
- <file md5sum="ae3f4157e8809fc7c378dad169f4b9f3" name="tests/bson-corpus/decimal128-5-valid-001.phpt" role="test" />
- <file md5sum="dff889d4075849339476305219f5a236" name="tests/bson-corpus/decimal128-5-valid-002.phpt" role="test" />
- <file md5sum="ba14ba6c016fdc18ff66f6db048fb0a3" name="tests/bson-corpus/decimal128-5-valid-003.phpt" role="test" />
- <file md5sum="ba9a44b79affe27f730a7ec433352389" name="tests/bson-corpus/decimal128-5-valid-004.phpt" role="test" />
- <file md5sum="5d5fcaa84d28796febd9b624c4ceced2" name="tests/bson-corpus/decimal128-5-valid-005.phpt" role="test" />
- <file md5sum="cac2941094fc213e304e669388f6de42" name="tests/bson-corpus/decimal128-5-valid-006.phpt" role="test" />
- <file md5sum="108213814aeceb9da7dae49085066aa9" name="tests/bson-corpus/decimal128-5-valid-007.phpt" role="test" />
- <file md5sum="6e3802a9c28479151b815ae05ffedf4a" name="tests/bson-corpus/decimal128-5-valid-008.phpt" role="test" />
- <file md5sum="e3a4f86c70897a071c52b8b63bd1ca72" name="tests/bson-corpus/decimal128-5-valid-009.phpt" role="test" />
- <file md5sum="b050d4ec02398e8937444491e2008168" name="tests/bson-corpus/decimal128-5-valid-010.phpt" role="test" />
- <file md5sum="b682adf6c7c93c0eb5ffe2482cbc86bb" name="tests/bson-corpus/decimal128-5-valid-011.phpt" role="test" />
- <file md5sum="f86b59299c66649e186813f5efef88bc" name="tests/bson-corpus/decimal128-5-valid-012.phpt" role="test" />
- <file md5sum="6a111849778a50875bb58ff1c139b78c" name="tests/bson-corpus/decimal128-5-valid-013.phpt" role="test" />
- <file md5sum="d437c772800f78e1ef3469753641bdbd" name="tests/bson-corpus/decimal128-5-valid-014.phpt" role="test" />
- <file md5sum="b3e546fc577e3d4eb0e148e9b7ebf07e" name="tests/bson-corpus/decimal128-5-valid-015.phpt" role="test" />
- <file md5sum="c760575aae19fc8c536c30d7242a6779" name="tests/bson-corpus/decimal128-5-valid-016.phpt" role="test" />
- <file md5sum="120f3057821b1a1ef4571c5d24f7a852" name="tests/bson-corpus/decimal128-5-valid-017.phpt" role="test" />
- <file md5sum="ff5f2fd4dd075787ee81fd9e5bb3d8af" name="tests/bson-corpus/decimal128-5-valid-018.phpt" role="test" />
- <file md5sum="972cbb598b739fe1e21d8b7058228c9e" name="tests/bson-corpus/decimal128-5-valid-019.phpt" role="test" />
- <file md5sum="3d202b50c8a32d0f8d37ca43d5d93614" name="tests/bson-corpus/decimal128-5-valid-020.phpt" role="test" />
- <file md5sum="e01b14a2a78c53e3a7b5a7eb4e4e8388" name="tests/bson-corpus/decimal128-5-valid-021.phpt" role="test" />
- <file md5sum="02246aa93b1389373755099887155461" name="tests/bson-corpus/decimal128-5-valid-022.phpt" role="test" />
- <file md5sum="ebed7e1c9008b272c3975fec979316ea" name="tests/bson-corpus/decimal128-5-valid-023.phpt" role="test" />
- <file md5sum="148ee3caa80bb3e2c6016fa26490dd9d" name="tests/bson-corpus/decimal128-5-valid-024.phpt" role="test" />
- <file md5sum="96915be6c733911d940e78b75da95d20" name="tests/bson-corpus/decimal128-5-valid-025.phpt" role="test" />
- <file md5sum="978fecb824df0768511946b796cde1a8" name="tests/bson-corpus/decimal128-5-valid-026.phpt" role="test" />
- <file md5sum="5e4607edd84ed63a80f860dd3a14a7a9" name="tests/bson-corpus/decimal128-5-valid-027.phpt" role="test" />
- <file md5sum="0a35f861c451aaeb7b6ac51791e991b0" name="tests/bson-corpus/decimal128-5-valid-028.phpt" role="test" />
- <file md5sum="c98cb2f14e20a5269154e87b51fc70bf" name="tests/bson-corpus/decimal128-5-valid-029.phpt" role="test" />
- <file md5sum="dbb0dcd9dcddbe13dad3ebad0313583e" name="tests/bson-corpus/decimal128-5-valid-030.phpt" role="test" />
- <file md5sum="365ca1ab11f99b25cb6429d7378edb56" name="tests/bson-corpus/decimal128-5-valid-031.phpt" role="test" />
- <file md5sum="93942e13b80c76e95467b9366f606feb" name="tests/bson-corpus/decimal128-5-valid-032.phpt" role="test" />
- <file md5sum="87f28f7c56eda1038b64ed8399c2e5ec" name="tests/bson-corpus/decimal128-5-valid-033.phpt" role="test" />
- <file md5sum="5771eda7663092952f6813ebb215215a" name="tests/bson-corpus/decimal128-5-valid-034.phpt" role="test" />
- <file md5sum="f17274f6b5d5a99ad0c967e95d22fa46" name="tests/bson-corpus/decimal128-5-valid-035.phpt" role="test" />
- <file md5sum="b4881b4d619085b5653467fde9421fd5" name="tests/bson-corpus/decimal128-5-valid-036.phpt" role="test" />
- <file md5sum="23c639715ea3612e866cf83d70d42ad9" name="tests/bson-corpus/decimal128-5-valid-037.phpt" role="test" />
- <file md5sum="cba440a1b64840a63c71396c610682f2" name="tests/bson-corpus/decimal128-5-valid-038.phpt" role="test" />
- <file md5sum="7a100539ca4b0e15127e30856ef8c472" name="tests/bson-corpus/decimal128-5-valid-039.phpt" role="test" />
- <file md5sum="3b531bd1f338838a6bbb73a57fc9427b" name="tests/bson-corpus/decimal128-5-valid-040.phpt" role="test" />
- <file md5sum="1df369ca39dc66acd2307b51f02391c7" name="tests/bson-corpus/decimal128-5-valid-041.phpt" role="test" />
- <file md5sum="29a4582d8e5df180ccb4cf39077ade55" name="tests/bson-corpus/decimal128-5-valid-042.phpt" role="test" />
- <file md5sum="9b6eefcc8964252e142dece5934c4b82" name="tests/bson-corpus/decimal128-5-valid-043.phpt" role="test" />
- <file md5sum="2488859070570a442172d73831d15c36" name="tests/bson-corpus/decimal128-5-valid-044.phpt" role="test" />
- <file md5sum="912be2cfedca3826ab13d326008a5e5f" name="tests/bson-corpus/decimal128-5-valid-045.phpt" role="test" />
- <file md5sum="20f9f115f762cf2b8892c93036f29ffc" name="tests/bson-corpus/decimal128-5-valid-046.phpt" role="test" />
- <file md5sum="209f1af4e3df9af67b83202cedddbcf1" name="tests/bson-corpus/decimal128-5-valid-047.phpt" role="test" />
- <file md5sum="e83ed0b68f24e69f71cc9a9edfd93baa" name="tests/bson-corpus/decimal128-5-valid-048.phpt" role="test" />
- <file md5sum="d984bf34b0053f704324c9ec0b9550cc" name="tests/bson-corpus/decimal128-5-valid-049.phpt" role="test" />
- <file md5sum="534a913c9076f73604d69aa89a3e2b7f" name="tests/bson-corpus/decimal128-5-valid-050.phpt" role="test" />
- <file md5sum="7fcc1d601ac8bb4f319d3013b2ff8d6f" name="tests/bson-corpus/decimal128-5-valid-051.phpt" role="test" />
- <file md5sum="52f3ec367d8b1fdc14ea55a024633eeb" name="tests/bson-corpus/decimal128-5-valid-052.phpt" role="test" />
- <file md5sum="6389fc0885e1671a6f4124876d7833b3" name="tests/bson-corpus/decimal128-5-valid-053.phpt" role="test" />
- <file md5sum="0353aefe4f579411272f1db12cb9fb3c" name="tests/bson-corpus/decimal128-5-valid-054.phpt" role="test" />
- <file md5sum="3259ba4a4500d16ed417c510ae39fb12" name="tests/bson-corpus/decimal128-5-valid-055.phpt" role="test" />
- <file md5sum="ec6605e6c62dcfa8b40755dc6a68d4b7" name="tests/bson-corpus/decimal128-5-valid-056.phpt" role="test" />
- <file md5sum="a80b45d66bb1b199ce676562aed98c8c" name="tests/bson-corpus/decimal128-5-valid-057.phpt" role="test" />
- <file md5sum="8be00241652618fafc467ee5f0921c21" name="tests/bson-corpus/decimal128-5-valid-058.phpt" role="test" />
- <file md5sum="69ecad834fe150b6af057e247f57d1ad" name="tests/bson-corpus/decimal128-5-valid-059.phpt" role="test" />
- <file md5sum="5ef10e88062b5e8db6d57f2b3e9189cd" name="tests/bson-corpus/decimal128-5-valid-060.phpt" role="test" />
- <file md5sum="e9b480a2bbb5a0840cef3a5c3b5b91c2" name="tests/bson-corpus/decimal128-5-valid-061.phpt" role="test" />
- <file md5sum="5dc42a6bf54856a4184eff9cf0c093c5" name="tests/bson-corpus/decimal128-5-valid-062.phpt" role="test" />
- <file md5sum="897f1d812ca47a431cf3bc5c17418290" name="tests/bson-corpus/decimal128-5-valid-063.phpt" role="test" />
- <file md5sum="f127d0bfefd67c56f891896b37a76d8b" name="tests/bson-corpus/decimal128-5-valid-064.phpt" role="test" />
- <file md5sum="221826b0f6273fb3f0858e521e0fe37e" name="tests/bson-corpus/decimal128-5-valid-065.phpt" role="test" />
- <file md5sum="7ee3050a25a8743e9ce67691d997d190" name="tests/bson-corpus/decimal128-5-valid-066.phpt" role="test" />
- <file md5sum="661f0ef7137987581e5fa6b93cdc06bb" name="tests/bson-corpus/decimal128-5-valid-067.phpt" role="test" />
+ <file md5sum="a070a50937cc67c268b668f31080d2c0" name="tests/bson-corpus/decimal128-4-valid-001.phpt" role="test" />
+ <file md5sum="7bb0441a158267d131aaeac00d74fb03" name="tests/bson-corpus/decimal128-4-valid-002.phpt" role="test" />
+ <file md5sum="7035e1f1d2118231f1d93bbe76bf31d2" name="tests/bson-corpus/decimal128-4-valid-003.phpt" role="test" />
+ <file md5sum="9c65594ee07b79ab470a437fe5a78b46" name="tests/bson-corpus/decimal128-4-valid-004.phpt" role="test" />
+ <file md5sum="c90d93271c8501c1273e2253854c17c6" name="tests/bson-corpus/decimal128-4-valid-005.phpt" role="test" />
+ <file md5sum="999458609f8ea777ea733dfea711b34b" name="tests/bson-corpus/decimal128-4-valid-006.phpt" role="test" />
+ <file md5sum="d3d42e894edced679b8113907e8571ca" name="tests/bson-corpus/decimal128-4-valid-007.phpt" role="test" />
+ <file md5sum="c6511aab45a2467d20cffa9e6e73bd76" name="tests/bson-corpus/decimal128-4-valid-008.phpt" role="test" />
+ <file md5sum="d00743fbf5446d016a63db752c18b8c1" name="tests/bson-corpus/decimal128-4-valid-009.phpt" role="test" />
+ <file md5sum="a1daa3b18629730d1a3a6f12ca076e84" name="tests/bson-corpus/decimal128-4-valid-010.phpt" role="test" />
+ <file md5sum="d55fb3650e7f29fcc4066539fd5c4ed6" name="tests/bson-corpus/decimal128-4-valid-011.phpt" role="test" />
+ <file md5sum="959e7fbb16a75561566bdb00c26cc92d" name="tests/bson-corpus/decimal128-4-valid-012.phpt" role="test" />
+ <file md5sum="a7774922d7250f4a0f84d749aa09f871" name="tests/bson-corpus/decimal128-4-valid-013.phpt" role="test" />
+ <file md5sum="6b87545ab373a8a9aa7bf08fbce973df" name="tests/bson-corpus/decimal128-5-valid-001.phpt" role="test" />
+ <file md5sum="a3767c9edb9ba610ac82cc39e351f943" name="tests/bson-corpus/decimal128-5-valid-002.phpt" role="test" />
+ <file md5sum="8ad008db9dd920e19b14c163b230d34c" name="tests/bson-corpus/decimal128-5-valid-003.phpt" role="test" />
+ <file md5sum="f4c97812ce009aa272f20c4d677c195c" name="tests/bson-corpus/decimal128-5-valid-004.phpt" role="test" />
+ <file md5sum="9ce5905aa2562a5e5f796b9d7c753469" name="tests/bson-corpus/decimal128-5-valid-005.phpt" role="test" />
+ <file md5sum="8e7b8f63f2b99c0a45763202fc2ce227" name="tests/bson-corpus/decimal128-5-valid-006.phpt" role="test" />
+ <file md5sum="8e25c67d407e8c10caa5e66090267d37" name="tests/bson-corpus/decimal128-5-valid-007.phpt" role="test" />
+ <file md5sum="649666a2780524768e8e2a2476df6167" name="tests/bson-corpus/decimal128-5-valid-008.phpt" role="test" />
+ <file md5sum="de367abdd2f921b728ce17260b369b1d" name="tests/bson-corpus/decimal128-5-valid-009.phpt" role="test" />
+ <file md5sum="705e3af5a57b840bd937d8c295dc3ac9" name="tests/bson-corpus/decimal128-5-valid-010.phpt" role="test" />
+ <file md5sum="61b392916b43db5415874a24ebb2195b" name="tests/bson-corpus/decimal128-5-valid-011.phpt" role="test" />
+ <file md5sum="a6ab52da3fa5547eb14aaa826559432c" name="tests/bson-corpus/decimal128-5-valid-012.phpt" role="test" />
+ <file md5sum="d906cb182592f9ad335892bff0f160e0" name="tests/bson-corpus/decimal128-5-valid-013.phpt" role="test" />
+ <file md5sum="281f914baebdd80dc066437f4db3c1b2" name="tests/bson-corpus/decimal128-5-valid-014.phpt" role="test" />
+ <file md5sum="f1ea2584b5ad95fae3ba3931bbf03510" name="tests/bson-corpus/decimal128-5-valid-015.phpt" role="test" />
+ <file md5sum="8b4cfbfd65945bfac1a16752a0bb9552" name="tests/bson-corpus/decimal128-5-valid-016.phpt" role="test" />
+ <file md5sum="ad51ac53316ee64bbaa24a513ef0f06e" name="tests/bson-corpus/decimal128-5-valid-017.phpt" role="test" />
+ <file md5sum="acef719e905b1bd41716dbf24f66e5f2" name="tests/bson-corpus/decimal128-5-valid-018.phpt" role="test" />
+ <file md5sum="90cd175de06071cff4c7edd3404b5182" name="tests/bson-corpus/decimal128-5-valid-019.phpt" role="test" />
+ <file md5sum="5ae6f97ab5ca39c265248688d438b5ab" name="tests/bson-corpus/decimal128-5-valid-020.phpt" role="test" />
+ <file md5sum="1d8b861ea5df635b925a16c9ae13a61d" name="tests/bson-corpus/decimal128-5-valid-021.phpt" role="test" />
+ <file md5sum="3849424c584b6e5791a231f4c0e295ba" name="tests/bson-corpus/decimal128-5-valid-022.phpt" role="test" />
+ <file md5sum="d42b076f7e91674b48ca3786536c639d" name="tests/bson-corpus/decimal128-5-valid-023.phpt" role="test" />
+ <file md5sum="493c81a4bfd82782ce608b338f947115" name="tests/bson-corpus/decimal128-5-valid-024.phpt" role="test" />
+ <file md5sum="55c44a0026e96b370d0d62438d697ed2" name="tests/bson-corpus/decimal128-5-valid-025.phpt" role="test" />
+ <file md5sum="a1f6da97547007e3bd8265d00031f4e4" name="tests/bson-corpus/decimal128-5-valid-026.phpt" role="test" />
+ <file md5sum="6682dd120dc167d57fd8f90ddc66cb0d" name="tests/bson-corpus/decimal128-5-valid-027.phpt" role="test" />
+ <file md5sum="b9b264f82951c29e2bb30ce155db0a8d" name="tests/bson-corpus/decimal128-5-valid-028.phpt" role="test" />
+ <file md5sum="3a2899240850ce9ed0c906aadc791d6a" name="tests/bson-corpus/decimal128-5-valid-029.phpt" role="test" />
+ <file md5sum="3ef1a85209aa2c38daed1773c6138e29" name="tests/bson-corpus/decimal128-5-valid-030.phpt" role="test" />
+ <file md5sum="8a64f1d79d9b73b78266a71f6bb410f4" name="tests/bson-corpus/decimal128-5-valid-031.phpt" role="test" />
+ <file md5sum="18801d2e2adfa239fc5c32be9fd276dc" name="tests/bson-corpus/decimal128-5-valid-032.phpt" role="test" />
+ <file md5sum="4ac646fded289a654f16d7326286c329" name="tests/bson-corpus/decimal128-5-valid-033.phpt" role="test" />
+ <file md5sum="b8e3431ba2c253b09eb25cfd52e8ddc8" name="tests/bson-corpus/decimal128-5-valid-034.phpt" role="test" />
+ <file md5sum="a9ae57bdf2b198e5644a24dc245828d5" name="tests/bson-corpus/decimal128-5-valid-035.phpt" role="test" />
+ <file md5sum="a9db92a9aaed7049eb55b7d5bc5a95e7" name="tests/bson-corpus/decimal128-5-valid-036.phpt" role="test" />
+ <file md5sum="38c5bc5bd9cc59df2acc7b7177e29373" name="tests/bson-corpus/decimal128-5-valid-037.phpt" role="test" />
+ <file md5sum="0ad2e1a66432d8b6a87a44d961065f51" name="tests/bson-corpus/decimal128-5-valid-038.phpt" role="test" />
+ <file md5sum="172605d2408c78656d30b151044007ba" name="tests/bson-corpus/decimal128-5-valid-039.phpt" role="test" />
+ <file md5sum="f828b67454bd858ae79e64abfb0bce6b" name="tests/bson-corpus/decimal128-5-valid-040.phpt" role="test" />
+ <file md5sum="50bd65a6c81e48b1460c0c82f1bf9c53" name="tests/bson-corpus/decimal128-5-valid-041.phpt" role="test" />
+ <file md5sum="4b6a5afe62d29ffa4600a43f46e479e0" name="tests/bson-corpus/decimal128-5-valid-042.phpt" role="test" />
+ <file md5sum="f5df94daa22cb216aacc86fcee9a681a" name="tests/bson-corpus/decimal128-5-valid-043.phpt" role="test" />
+ <file md5sum="0c25d3c0607ce195b5ac29dcb2078804" name="tests/bson-corpus/decimal128-5-valid-044.phpt" role="test" />
+ <file md5sum="c287782670357cde2d20871132ce46ab" name="tests/bson-corpus/decimal128-5-valid-045.phpt" role="test" />
+ <file md5sum="d06a9376cd0d4d0d7d5393d27405c847" name="tests/bson-corpus/decimal128-5-valid-046.phpt" role="test" />
+ <file md5sum="6113d4ad7b79c43f11753a048aa0e41f" name="tests/bson-corpus/decimal128-5-valid-047.phpt" role="test" />
+ <file md5sum="c349a38ae345307b81e79be34abf7e98" name="tests/bson-corpus/decimal128-5-valid-048.phpt" role="test" />
+ <file md5sum="31b688da028dc55dbbd4699083b917cf" name="tests/bson-corpus/decimal128-5-valid-049.phpt" role="test" />
+ <file md5sum="f7a9133550d224111af39cc56ce22f95" name="tests/bson-corpus/decimal128-5-valid-050.phpt" role="test" />
+ <file md5sum="63b377544e4c1ed783024f56f4528dc5" name="tests/bson-corpus/decimal128-5-valid-051.phpt" role="test" />
+ <file md5sum="8a5c448c545a467ba377c37fb3f43cfe" name="tests/bson-corpus/decimal128-5-valid-052.phpt" role="test" />
+ <file md5sum="ed30cecf18ae99be6ff128b47b038963" name="tests/bson-corpus/decimal128-5-valid-053.phpt" role="test" />
+ <file md5sum="d7ec0c1afe68ded8b8d873eaa0b727ac" name="tests/bson-corpus/decimal128-5-valid-054.phpt" role="test" />
+ <file md5sum="17916adec0d40092854fc61eb0b57ef3" name="tests/bson-corpus/decimal128-5-valid-055.phpt" role="test" />
+ <file md5sum="561e22a1f31f6997575a632f0a6bb9a9" name="tests/bson-corpus/decimal128-5-valid-056.phpt" role="test" />
+ <file md5sum="5effa2f434b1e8460512cae081fc12b0" name="tests/bson-corpus/decimal128-5-valid-057.phpt" role="test" />
+ <file md5sum="5e4db0ea68119982e1e9d6474a172d6b" name="tests/bson-corpus/decimal128-5-valid-058.phpt" role="test" />
+ <file md5sum="3c61bcf91efc76133848f29fbd7ca2dc" name="tests/bson-corpus/decimal128-5-valid-059.phpt" role="test" />
+ <file md5sum="2034d5791be2a522f9856986cfcb91a1" name="tests/bson-corpus/decimal128-5-valid-060.phpt" role="test" />
+ <file md5sum="c41d839ee5045ef8c2543f1a8a0aebfa" name="tests/bson-corpus/decimal128-5-valid-061.phpt" role="test" />
+ <file md5sum="dab6541050837891bf782a05b0966a0c" name="tests/bson-corpus/decimal128-5-valid-062.phpt" role="test" />
+ <file md5sum="9f3d0b6c91a405dad31e5134ac87121c" name="tests/bson-corpus/decimal128-5-valid-063.phpt" role="test" />
+ <file md5sum="f75181e054a892bf96780387c3ca107a" name="tests/bson-corpus/decimal128-5-valid-064.phpt" role="test" />
+ <file md5sum="2a7dd95bb38d14db3dcc6acdb7e93ca0" name="tests/bson-corpus/decimal128-5-valid-065.phpt" role="test" />
+ <file md5sum="557728866805665a1e160a9b2b0812cc" name="tests/bson-corpus/decimal128-5-valid-066.phpt" role="test" />
+ <file md5sum="5186af0257b5301a1bad7fd5facce2ad" name="tests/bson-corpus/decimal128-5-valid-067.phpt" role="test" />
<file md5sum="97fe7865f6b77af9761a310343fba415" name="tests/bson-corpus/decimal128-6-parseError-001.phpt" role="test" />
<file md5sum="9f575f6daff291e442343d44a3cac10a" name="tests/bson-corpus/decimal128-6-parseError-002.phpt" role="test" />
<file md5sum="4a66430c6a6a2f1a937f6eaab10f1f2c" name="tests/bson-corpus/decimal128-6-parseError-003.phpt" role="test" />
<file md5sum="6530b59f6a323ed20f911f87c0d6d5b9" name="tests/bson-corpus/decimal128-6-parseError-004.phpt" role="test" />
<file md5sum="b587d7e022d5ee929306a44f5e8f3666" name="tests/bson-corpus/decimal128-6-parseError-005.phpt" role="test" />
<file md5sum="1ce11e7590e301fe8cff91baf7f27299" name="tests/bson-corpus/decimal128-6-parseError-006.phpt" role="test" />
<file md5sum="f394f82562d15f669d1de267689cc95a" name="tests/bson-corpus/decimal128-6-parseError-007.phpt" role="test" />
<file md5sum="87032ec278bb9a13827a5b62cc2f21fc" name="tests/bson-corpus/decimal128-6-parseError-008.phpt" role="test" />
<file md5sum="e7ee4b1b929964e5ba5978dba60e098f" name="tests/bson-corpus/decimal128-6-parseError-009.phpt" role="test" />
<file md5sum="283726e643d46cbefb0b3641047756d4" name="tests/bson-corpus/decimal128-6-parseError-010.phpt" role="test" />
<file md5sum="4996d80b5d21cc5decb6036e0bcdc6ed" name="tests/bson-corpus/decimal128-6-parseError-011.phpt" role="test" />
<file md5sum="a9b27777c25778d465ab062981e80a46" name="tests/bson-corpus/decimal128-6-parseError-012.phpt" role="test" />
<file md5sum="d34cc4951df6044ca57808d9a7681b8e" name="tests/bson-corpus/decimal128-6-parseError-013.phpt" role="test" />
<file md5sum="539c801052840e099b620e31abb265e7" name="tests/bson-corpus/decimal128-6-parseError-014.phpt" role="test" />
<file md5sum="3f5e3afbd9eaceaf15480ec29c33e05e" name="tests/bson-corpus/decimal128-6-parseError-015.phpt" role="test" />
<file md5sum="c9bd1f761f82e17d1cad1a5e333c4d87" name="tests/bson-corpus/decimal128-6-parseError-016.phpt" role="test" />
<file md5sum="53493d03e0efa89d433e111d9e5b2c97" name="tests/bson-corpus/decimal128-6-parseError-017.phpt" role="test" />
<file md5sum="bac21d79cf24233a381256126e570e33" name="tests/bson-corpus/decimal128-6-parseError-018.phpt" role="test" />
<file md5sum="6f5805f1fdee72e416dcf3d6a2992407" name="tests/bson-corpus/decimal128-6-parseError-019.phpt" role="test" />
<file md5sum="3e2b85ba531690fb2e861dac542caccb" name="tests/bson-corpus/decimal128-6-parseError-020.phpt" role="test" />
<file md5sum="14bd678420d73ad4979dce95c78a1dcf" name="tests/bson-corpus/decimal128-6-parseError-021.phpt" role="test" />
<file md5sum="27966c70fc7cf6d78e2db4f1396c2f73" name="tests/bson-corpus/decimal128-6-parseError-022.phpt" role="test" />
<file md5sum="1f7d2bb1681215e34d5194410641de91" name="tests/bson-corpus/decimal128-6-parseError-023.phpt" role="test" />
<file md5sum="35ff6b7fde08867fd9585786b824a0d6" name="tests/bson-corpus/decimal128-6-parseError-024.phpt" role="test" />
<file md5sum="eb7fd03b97b7d1902619f4ddb2d432b8" name="tests/bson-corpus/decimal128-6-parseError-025.phpt" role="test" />
<file md5sum="e01b09664d43504f4edc73e33bfba3ca" name="tests/bson-corpus/decimal128-6-parseError-026.phpt" role="test" />
<file md5sum="deacc3d8fdfe797641fe0fe362404765" name="tests/bson-corpus/decimal128-6-parseError-027.phpt" role="test" />
<file md5sum="a0e8ac91c41ecf1eca07fb065f02d3ec" name="tests/bson-corpus/decimal128-6-parseError-028.phpt" role="test" />
<file md5sum="0bbefc7e842bfe89be81e8bf399d7d8a" name="tests/bson-corpus/decimal128-6-parseError-029.phpt" role="test" />
<file md5sum="d979bc87fec742e764e705eed2fed45b" name="tests/bson-corpus/decimal128-6-parseError-030.phpt" role="test" />
<file md5sum="f00357ca24f8844d4d7b22b3160e5e71" name="tests/bson-corpus/decimal128-6-parseError-031.phpt" role="test" />
<file md5sum="53f9d995d67a3762195fd07bb5f653d0" name="tests/bson-corpus/decimal128-7-parseError-001.phpt" role="test" />
<file md5sum="d29ed9186006eea15d635a9bacce926e" name="tests/bson-corpus/decimal128-7-parseError-002.phpt" role="test" />
<file md5sum="64d47b499c5cd564dd71d73cb85bb414" name="tests/bson-corpus/decimal128-7-parseError-003.phpt" role="test" />
<file md5sum="948ae3e82929bf3e4d0c997788a83900" name="tests/bson-corpus/decimal128-7-parseError-004.phpt" role="test" />
<file md5sum="94be2fca3acf9155613abc3e1310223c" name="tests/bson-corpus/decimal128-7-parseError-005.phpt" role="test" />
<file md5sum="d1f9e7f057df208e36759707aec45d3a" name="tests/bson-corpus/decimal128-7-parseError-006.phpt" role="test" />
<file md5sum="af5cb840cb6e880b7f4866225fb3ab8c" name="tests/bson-corpus/decimal128-7-parseError-007.phpt" role="test" />
<file md5sum="7c4945290e91d7d4ef142cd179866a72" name="tests/bson-corpus/decimal128-7-parseError-008.phpt" role="test" />
<file md5sum="ef3f78b87943a3af440e58adf83e762e" name="tests/bson-corpus/decimal128-7-parseError-009.phpt" role="test" />
<file md5sum="92b4275158b073a14953d9cd322a2202" name="tests/bson-corpus/decimal128-7-parseError-010.phpt" role="test" />
<file md5sum="a2d18ad0fdb146b6f2a142a8ea111ad5" name="tests/bson-corpus/decimal128-7-parseError-011.phpt" role="test" />
<file md5sum="535a7f455b7a9cbaaad113d915eae2ad" name="tests/bson-corpus/decimal128-7-parseError-012.phpt" role="test" />
<file md5sum="940f13a74a37c831f7b50e51ce03cb48" name="tests/bson-corpus/decimal128-7-parseError-013.phpt" role="test" />
<file md5sum="ee518aa3cd335ea1340cd660ac46c397" name="tests/bson-corpus/decimal128-7-parseError-014.phpt" role="test" />
<file md5sum="a18bb75fa65ab4364d3310dbc64b2d42" name="tests/bson-corpus/decimal128-7-parseError-015.phpt" role="test" />
<file md5sum="cdbb9254e8b5a8c2b61f0793e075bc21" name="tests/bson-corpus/decimal128-7-parseError-016.phpt" role="test" />
<file md5sum="e7c465fab5e7af09100cc0f2270e5ad4" name="tests/bson-corpus/decimal128-7-parseError-017.phpt" role="test" />
<file md5sum="ad9bded5d2d29d2f4cd40f3a98ad58ea" name="tests/bson-corpus/decimal128-7-parseError-018.phpt" role="test" />
<file md5sum="4fbef3e62555a42ecd78b5cd66c81569" name="tests/bson-corpus/decimal128-7-parseError-019.phpt" role="test" />
<file md5sum="d81d5065897fdef90dcad7be488f3188" name="tests/bson-corpus/decimal128-7-parseError-020.phpt" role="test" />
<file md5sum="db41dd01251ce000a5ecf40f762cf769" name="tests/bson-corpus/decimal128-7-parseError-021.phpt" role="test" />
<file md5sum="7f12e7dd1c939e2527470b1de6d34942" name="tests/bson-corpus/decimal128-7-parseError-022.phpt" role="test" />
<file md5sum="cd7219ff47cbc9fb57804486a944262f" name="tests/bson-corpus/decimal128-7-parseError-023.phpt" role="test" />
<file md5sum="bf34c189b0d7194e08307f081a1ffc10" name="tests/bson-corpus/decimal128-7-parseError-024.phpt" role="test" />
<file md5sum="b658af20fef19c777f878c7832b6a679" name="tests/bson-corpus/decimal128-7-parseError-025.phpt" role="test" />
<file md5sum="73a24ca42c6ae756ba56a06777610ef2" name="tests/bson-corpus/decimal128-7-parseError-026.phpt" role="test" />
<file md5sum="9a6d5b86647f571c6d4c89f96fa1f555" name="tests/bson-corpus/decimal128-7-parseError-027.phpt" role="test" />
<file md5sum="fd4263ac5a5a1dbdea4d02d607971c45" name="tests/bson-corpus/decimal128-7-parseError-028.phpt" role="test" />
<file md5sum="2b6d0739f6c91b9bad32353e19ac4db0" name="tests/bson-corpus/decimal128-7-parseError-029.phpt" role="test" />
<file md5sum="ec2592d9cf55680d54bda911b7237265" name="tests/bson-corpus/decimal128-7-parseError-030.phpt" role="test" />
<file md5sum="2c88d698f5abce5affb51f40c56cd79c" name="tests/bson-corpus/decimal128-7-parseError-031.phpt" role="test" />
<file md5sum="a1b55267e1f040cd47f234054fbd2bbc" name="tests/bson-corpus/decimal128-7-parseError-032.phpt" role="test" />
<file md5sum="ed2107f9aa466b5de70f274e7f4e9a50" name="tests/bson-corpus/decimal128-7-parseError-033.phpt" role="test" />
<file md5sum="131713b2aba97d35bb405f7c6e19f49f" name="tests/bson-corpus/decimal128-7-parseError-034.phpt" role="test" />
<file md5sum="23dd38e8a785335a2e580cb9cbd7f373" name="tests/bson-corpus/decimal128-7-parseError-035.phpt" role="test" />
<file md5sum="61c1fbba48138e7aa95dc619f1217e03" name="tests/bson-corpus/decimal128-7-parseError-036.phpt" role="test" />
<file md5sum="73448b46f4ebcfb371c3df67ffa25d70" name="tests/bson-corpus/decimal128-7-parseError-037.phpt" role="test" />
<file md5sum="ff7d44b3efcebe092a5be22db7500f93" name="tests/bson-corpus/decimal128-7-parseError-038.phpt" role="test" />
<file md5sum="958a9bc10f56cd9dabdae6b5382648be" name="tests/bson-corpus/decimal128-7-parseError-039.phpt" role="test" />
<file md5sum="a39fca304ccd2549988060852b9c2b60" name="tests/bson-corpus/decimal128-7-parseError-040.phpt" role="test" />
<file md5sum="21bcf3ea88275becb09488ce676ba256" name="tests/bson-corpus/decimal128-7-parseError-041.phpt" role="test" />
<file md5sum="a41810a881fd56479d50d1a2f10e4e15" name="tests/bson-corpus/decimal128-7-parseError-042.phpt" role="test" />
<file md5sum="b352d47eee76795c6d9cef4c1d42639a" name="tests/bson-corpus/decimal128-7-parseError-043.phpt" role="test" />
<file md5sum="0a6925324970b9215c46d629dc2ad648" name="tests/bson-corpus/decimal128-7-parseError-044.phpt" role="test" />
<file md5sum="7fd640f689e3b25e589449ce51762438" name="tests/bson-corpus/decimal128-7-parseError-045.phpt" role="test" />
<file md5sum="8965fa643c3177ba677b0a338c43935c" name="tests/bson-corpus/decimal128-7-parseError-046.phpt" role="test" />
<file md5sum="b89d1125f54520819d4780bb407751b1" name="tests/bson-corpus/decimal128-7-parseError-047.phpt" role="test" />
<file md5sum="29a49b24ce427755d4a5643a01f1e45e" name="tests/bson-corpus/decimal128-7-parseError-048.phpt" role="test" />
<file md5sum="15026f957644968579b0033b741ad521" name="tests/bson-corpus/decimal128-7-parseError-049.phpt" role="test" />
<file md5sum="bc10ad81fb524afbad5eb9f7e9354a24" name="tests/bson-corpus/decimal128-7-parseError-050.phpt" role="test" />
<file md5sum="a690c91d87cab939fd2c4b152e3d5a1f" name="tests/bson-corpus/decimal128-7-parseError-051.phpt" role="test" />
<file md5sum="cdfb6d264322fbd94013be733e93b7e2" name="tests/bson-corpus/decimal128-7-parseError-052.phpt" role="test" />
<file md5sum="b48b0f7abcdaef499f8dd6391a9e73be" name="tests/bson-corpus/decimal128-7-parseError-053.phpt" role="test" />
<file md5sum="51a21d680cf93ca8e61054d1798f3a6d" name="tests/bson-corpus/decimal128-7-parseError-054.phpt" role="test" />
<file md5sum="2fa0d96cc6ca037e731e8d73359254a1" name="tests/bson-corpus/decimal128-7-parseError-055.phpt" role="test" />
<file md5sum="3cb79692a3fff1a2965d633f583ffda1" name="tests/bson-corpus/decimal128-7-parseError-056.phpt" role="test" />
<file md5sum="31668df0a6ae44cd4b8c201b391b3c05" name="tests/bson-corpus/decimal128-7-parseError-057.phpt" role="test" />
<file md5sum="291870eebd18c55b40dd774a1250e6f2" name="tests/bson-corpus/decimal128-7-parseError-058.phpt" role="test" />
<file md5sum="8c8282547270d94ab76310662de33c5f" name="tests/bson-corpus/decimal128-7-parseError-059.phpt" role="test" />
<file md5sum="0a785c54b0e5874555867da3046d0544" name="tests/bson-corpus/decimal128-7-parseError-060.phpt" role="test" />
<file md5sum="8b00ab977fa43482b20fc6cc88923560" name="tests/bson-corpus/decimal128-7-parseError-061.phpt" role="test" />
<file md5sum="87b858d1e87a14f0f3f074a30bc428f4" name="tests/bson-corpus/decimal128-7-parseError-062.phpt" role="test" />
<file md5sum="93c4597cbcf092b83effe458587cab42" name="tests/bson-corpus/decimal128-7-parseError-063.phpt" role="test" />
<file md5sum="5604b3c00d90f38326b2caf587b75d39" name="tests/bson-corpus/decimal128-7-parseError-064.phpt" role="test" />
<file md5sum="7698f35a879199cc6cfbe2975766609a" name="tests/bson-corpus/decimal128-7-parseError-065.phpt" role="test" />
<file md5sum="8c780164635efc163d9e92df2b5fd778" name="tests/bson-corpus/decimal128-7-parseError-066.phpt" role="test" />
<file md5sum="f82b3d0a1e0617ede4d6516f1c34f63e" name="tests/bson-corpus/decimal128-7-parseError-067.phpt" role="test" />
<file md5sum="46d018c7f78ebd672e61f5761327f79e" name="tests/bson-corpus/decimal128-7-parseError-068.phpt" role="test" />
<file md5sum="c39afed94ddc79eacb39bcfde732e058" name="tests/bson-corpus/decimal128-7-parseError-069.phpt" role="test" />
<file md5sum="779aa919b0c83011517a57eb4c677c0a" name="tests/bson-corpus/decimal128-7-parseError-070.phpt" role="test" />
<file md5sum="4d74f03527230857d81b7b22c3a37091" name="tests/bson-corpus/decimal128-7-parseError-071.phpt" role="test" />
<file md5sum="678cdc4e6e63ef31974353cd80fb96b3" name="tests/bson-corpus/decimal128-7-parseError-072.phpt" role="test" />
<file md5sum="7ff4eeca58923e636f37286aea06224f" name="tests/bson-corpus/decimal128-7-parseError-073.phpt" role="test" />
<file md5sum="06cc4c867376e6ff2a138d94d839e521" name="tests/bson-corpus/decimal128-7-parseError-074.phpt" role="test" />
<file md5sum="b207d585456f86a2ff1fbc9934fafc65" name="tests/bson-corpus/decimal128-7-parseError-075.phpt" role="test" />
<file md5sum="e6eb3226d4e334bf082a32beb6f4640e" name="tests/bson-corpus/decimal128-7-parseError-076.phpt" role="test" />
<file md5sum="fc9d86339d2ec2a1fdccd6e13efdccdd" name="tests/bson-corpus/decimal128-7-parseError-077.phpt" role="test" />
<file md5sum="9ff5ca747749d6dd2cad6512ff0ba502" name="tests/bson-corpus/decimal128-7-parseError-078.phpt" role="test" />
<file md5sum="90fb79370f2b72ed1563d30b9015736f" name="tests/bson-corpus/decimal128-7-parseError-079.phpt" role="test" />
<file md5sum="2c7374986d5f75a2c14c2ff7b195a543" name="tests/bson-corpus/decimal128-7-parseError-080.phpt" role="test" />
<file md5sum="b4f5cfd8c1af72e086fcf2f53f911580" name="tests/bson-corpus/document-decodeError-001.phpt" role="test" />
<file md5sum="42b26e9ea5c826cd63b5a4ba2e01152e" name="tests/bson-corpus/document-decodeError-002.phpt" role="test" />
<file md5sum="3c60f26d3ab45610a6e214ca12926b57" name="tests/bson-corpus/document-decodeError-003.phpt" role="test" />
- <file md5sum="b71432e20fecfbbd136675551156717b" name="tests/bson-corpus/document-valid-001.phpt" role="test" />
- <file md5sum="b0b4b9c4d1d6ecd30899942cb293ffec" name="tests/bson-corpus/document-valid-002.phpt" role="test" />
- <file md5sum="b070130d8fcfe008b8b5fe72754e4b9e" name="tests/bson-corpus/document-valid-003.phpt" role="test" />
+ <file md5sum="47da71c8632bb293479de2ef3f9aee5f" name="tests/bson-corpus/document-valid-001.phpt" role="test" />
+ <file md5sum="2585a587e0a31e52c6a39935b61f6efd" name="tests/bson-corpus/document-valid-002.phpt" role="test" />
+ <file md5sum="072b972d415457ba149f92da477c9f74" name="tests/bson-corpus/document-valid-003.phpt" role="test" />
<file md5sum="5785f63d468dd3d263b6959d2d2f3231" name="tests/bson-corpus/double-decodeError-001.phpt" role="test" />
- <file md5sum="c25d9dd31322b620a29376e89b470b3e" name="tests/bson-corpus/double-valid-001.phpt" role="test" />
- <file md5sum="e27a84a58acd3483ceea6e8598f5e569" name="tests/bson-corpus/double-valid-002.phpt" role="test" />
- <file md5sum="3f094dfb468145dd39698d7008ade9b2" name="tests/bson-corpus/double-valid-003.phpt" role="test" />
- <file md5sum="37b83b39bfb17e9e6bbb9263c47b76b4" name="tests/bson-corpus/double-valid-004.phpt" role="test" />
- <file md5sum="176b1e8434a4c8319d7a9efe9023ae9a" name="tests/bson-corpus/double-valid-005.phpt" role="test" />
- <file md5sum="11650a7fffae73c77db77cc43da70156" name="tests/bson-corpus/double-valid-006.phpt" role="test" />
- <file md5sum="50d446cbe8475bbe34b3e3d60b6417b3" name="tests/bson-corpus/double-valid-007.phpt" role="test" />
- <file md5sum="7bc4cb4dbf62717fbc354069f6fc9243" name="tests/bson-corpus/double-valid-008.phpt" role="test" />
- <file md5sum="71ab6661b8790895c443b7c647bb53af" name="tests/bson-corpus/double-valid-009.phpt" role="test" />
- <file md5sum="93b5c5f2636dee82f24ffd42f2a74bee" name="tests/bson-corpus/double-valid-010.phpt" role="test" />
- <file md5sum="7a93dcfb31a7f1cc8b538a2b679153d5" name="tests/bson-corpus/double-valid-011.phpt" role="test" />
- <file md5sum="59f568be5cd5b412f61907013d0f64e9" name="tests/bson-corpus/double-valid-012.phpt" role="test" />
+ <file md5sum="55984cda849b4a64caaf2b4fb73a9ca1" name="tests/bson-corpus/double-valid-001.phpt" role="test" />
+ <file md5sum="a43186a7f66bb86dd1a008872ca94864" name="tests/bson-corpus/double-valid-002.phpt" role="test" />
+ <file md5sum="f7c17b0e372f0a693ca7c90fc6977bad" name="tests/bson-corpus/double-valid-003.phpt" role="test" />
+ <file md5sum="1adbde4a619732f838a61125edea2f77" name="tests/bson-corpus/double-valid-004.phpt" role="test" />
+ <file md5sum="5300d77c5b88e30823072a4c4d3e7a3a" name="tests/bson-corpus/double-valid-005.phpt" role="test" />
+ <file md5sum="352886b990f2319856ecb33a11bebae5" name="tests/bson-corpus/double-valid-006.phpt" role="test" />
+ <file md5sum="2c9af1b7e7b2048262ead0fbe07008de" name="tests/bson-corpus/double-valid-007.phpt" role="test" />
+ <file md5sum="baffab846d9bd7376ae7bf20dd23acf6" name="tests/bson-corpus/double-valid-008.phpt" role="test" />
+ <file md5sum="3e2d46cbf803ff1f605cdc83e7b2e2f0" name="tests/bson-corpus/double-valid-009.phpt" role="test" />
+ <file md5sum="9fae566aadd79104dde40de052c4f4f7" name="tests/bson-corpus/double-valid-010.phpt" role="test" />
+ <file md5sum="fa077c180ea8f26210622593f6607fcf" name="tests/bson-corpus/double-valid-011.phpt" role="test" />
+ <file md5sum="4e02ba70d5625441097f6dd4a911372a" name="tests/bson-corpus/double-valid-012.phpt" role="test" />
<file md5sum="0da998151b70c18c67a96d8bc28a01ce" name="tests/bson-corpus/int32-decodeError-001.phpt" role="test" />
- <file md5sum="5f47f37ecf54e332d98dd7f005d8bac7" name="tests/bson-corpus/int32-valid-001.phpt" role="test" />
- <file md5sum="8e71156bc821c7912aad8061dfae7fab" name="tests/bson-corpus/int32-valid-002.phpt" role="test" />
- <file md5sum="b6c5b826eca41d0ee00461d1992963f3" name="tests/bson-corpus/int32-valid-003.phpt" role="test" />
- <file md5sum="ce5cfdb10be3feb8adcee2f5edd557c1" name="tests/bson-corpus/int32-valid-004.phpt" role="test" />
- <file md5sum="b3d82bf44e3e6be968f38078e460a9ae" name="tests/bson-corpus/int32-valid-005.phpt" role="test" />
+ <file md5sum="17d3bb3ab9506bf0808303984edf3850" name="tests/bson-corpus/int32-valid-001.phpt" role="test" />
+ <file md5sum="a6e7e4f503792e0f952f58e0af528740" name="tests/bson-corpus/int32-valid-002.phpt" role="test" />
+ <file md5sum="91d42c54d52b5d522a8d8ed4f76e298f" name="tests/bson-corpus/int32-valid-003.phpt" role="test" />
+ <file md5sum="979f440303e7393bf33576dad93e9ab8" name="tests/bson-corpus/int32-valid-004.phpt" role="test" />
+ <file md5sum="0112655126b2879b99233002752d2f48" name="tests/bson-corpus/int32-valid-005.phpt" role="test" />
<file md5sum="d72c859a13ce93310c4f69b31e58e57e" name="tests/bson-corpus/int64-decodeError-001.phpt" role="test" />
- <file md5sum="a3f1a8c46052df6030a22b4268159e5b" name="tests/bson-corpus/int64-valid-001.phpt" role="test" />
- <file md5sum="b3cab1e750ec07ecca05dec4b0264cf2" name="tests/bson-corpus/int64-valid-002.phpt" role="test" />
- <file md5sum="9007c33064a22e5bfef713a954530c7a" name="tests/bson-corpus/int64-valid-003.phpt" role="test" />
- <file md5sum="84237b507c3cd8adad64bc33952689ab" name="tests/bson-corpus/int64-valid-004.phpt" role="test" />
- <file md5sum="09e51f0ab0b8ee6c11177b9bb198b14e" name="tests/bson-corpus/int64-valid-005.phpt" role="test" />
- <file md5sum="e20137603c2a90305bd4742f03ec48a1" name="tests/bson-corpus/maxkey-valid-001.phpt" role="test" />
- <file md5sum="9aac546a028d88f2044b49833eb210d5" name="tests/bson-corpus/minkey-valid-001.phpt" role="test" />
- <file md5sum="95c489156077919b60d71ea9641d3e9e" name="tests/bson-corpus/multi-type-deprecated-valid-001.phpt" role="test" />
- <file md5sum="bd81777656d4aa81d5d3f25175e9a920" name="tests/bson-corpus/multi-type-valid-001.phpt" role="test" />
- <file md5sum="b1333fa4f91e784ef53ccbf077c5dc42" name="tests/bson-corpus/null-valid-001.phpt" role="test" />
+ <file md5sum="383f453ae3de56874d696d569cf51a02" name="tests/bson-corpus/int64-valid-001.phpt" role="test" />
+ <file md5sum="6def3bc3f841140d47e5cd26dc7ef2bd" name="tests/bson-corpus/int64-valid-002.phpt" role="test" />
+ <file md5sum="8b3b4f4b55a6496fd377cae9139dcdb3" name="tests/bson-corpus/int64-valid-003.phpt" role="test" />
+ <file md5sum="528b2932fc2c892929b3fa802297a0df" name="tests/bson-corpus/int64-valid-004.phpt" role="test" />
+ <file md5sum="00d42d432bb8781e0518ae03e7864d07" name="tests/bson-corpus/int64-valid-005.phpt" role="test" />
+ <file md5sum="0a8be41312bc74cf65c75d9e07a0a796" name="tests/bson-corpus/maxkey-valid-001.phpt" role="test" />
+ <file md5sum="cc3807f719fe900a985089705b1dea21" name="tests/bson-corpus/minkey-valid-001.phpt" role="test" />
+ <file md5sum="32a97fff8b199fafae4e02269f61f62a" name="tests/bson-corpus/multi-type-deprecated-valid-001.phpt" role="test" />
+ <file md5sum="fb18f54ed9a72630d32a42c16c2a6e99" name="tests/bson-corpus/multi-type-valid-001.phpt" role="test" />
+ <file md5sum="b4b635ae4febdf6c4c84365eb0a8761d" name="tests/bson-corpus/null-valid-001.phpt" role="test" />
<file md5sum="042a55fe8b49061f91ac3f21c9720886" name="tests/bson-corpus/oid-decodeError-001.phpt" role="test" />
- <file md5sum="50101edf5a54969a5a8cf70253b50cb1" name="tests/bson-corpus/oid-valid-001.phpt" role="test" />
- <file md5sum="700450049438b9bd06520bf6a17c7788" name="tests/bson-corpus/oid-valid-002.phpt" role="test" />
- <file md5sum="f3546b078c40a068b7c250da016f9113" name="tests/bson-corpus/oid-valid-003.phpt" role="test" />
+ <file md5sum="44c0e30d2b8930719a6eb07cc8078fb0" name="tests/bson-corpus/oid-valid-001.phpt" role="test" />
+ <file md5sum="0993d2ec96b1ab526d7268fb7202d2fe" name="tests/bson-corpus/oid-valid-002.phpt" role="test" />
+ <file md5sum="cc9ff7e9a58f41fe1d0236c7bb02e8f8" name="tests/bson-corpus/oid-valid-003.phpt" role="test" />
<file md5sum="6d2bbf0542ddfb10dbc00c5c9fef742f" name="tests/bson-corpus/regex-decodeError-001.phpt" role="test" />
<file md5sum="0aec7965ead30a0e9bb1d6a9aac6073a" name="tests/bson-corpus/regex-decodeError-002.phpt" role="test" />
- <file md5sum="e2a22519ed22c6fd51a15f07cfea6574" name="tests/bson-corpus/regex-valid-001.phpt" role="test" />
- <file md5sum="ff971b74a615f126d1683ac064afb486" name="tests/bson-corpus/regex-valid-002.phpt" role="test" />
- <file md5sum="e032a9da471e7b8b7b6e214fdc502464" name="tests/bson-corpus/regex-valid-003.phpt" role="test" />
- <file md5sum="e32ff0d63d4e978140415c1ee00ec943" name="tests/bson-corpus/regex-valid-004.phpt" role="test" />
- <file md5sum="4d3c27a8c2a4f0d00d3bea4dd8fb1845" name="tests/bson-corpus/regex-valid-005.phpt" role="test" />
- <file md5sum="dff8cac5463447779eab36cca3dae8d1" name="tests/bson-corpus/regex-valid-006.phpt" role="test" />
- <file md5sum="2bab1b2abf90c557456afa3979c3e127" name="tests/bson-corpus/regex-valid-007.phpt" role="test" />
- <file md5sum="87257a9e6683539f0234ed1ae77bd366" name="tests/bson-corpus/regex-valid-008.phpt" role="test" />
- <file md5sum="dbf6860f5b827b502e1449d4184229e4" name="tests/bson-corpus/regex-valid-009.phpt" role="test" />
+ <file md5sum="b1c1b7b7500e063af11e315ab7928e8b" name="tests/bson-corpus/regex-valid-001.phpt" role="test" />
+ <file md5sum="6401c4ed523d30759d4ad34b4d898018" name="tests/bson-corpus/regex-valid-002.phpt" role="test" />
+ <file md5sum="52b4282d2217a5c956aafd8e0d01b7a6" name="tests/bson-corpus/regex-valid-003.phpt" role="test" />
+ <file md5sum="9a3615d1213f79fe9aef0ff1d8f797ab" name="tests/bson-corpus/regex-valid-004.phpt" role="test" />
+ <file md5sum="f11d6433a601a36792a0c3b21319bf30" name="tests/bson-corpus/regex-valid-005.phpt" role="test" />
+ <file md5sum="82e82ae11e82941087284d35c2dba347" name="tests/bson-corpus/regex-valid-006.phpt" role="test" />
+ <file md5sum="51c56822003aba5822f54aac66b1abfe" name="tests/bson-corpus/regex-valid-007.phpt" role="test" />
+ <file md5sum="75c7606255ff316e208fba7bf0a44607" name="tests/bson-corpus/regex-valid-008.phpt" role="test" />
+ <file md5sum="8c99d4925be488b752bfe76242637654" name="tests/bson-corpus/regex-valid-009.phpt" role="test" />
<file md5sum="0240e21ac7208bd577ad206545d9079b" name="tests/bson-corpus/string-decodeError-001.phpt" role="test" />
<file md5sum="1b49383dcd31b2fcfd08605d1e11224d" name="tests/bson-corpus/string-decodeError-002.phpt" role="test" />
<file md5sum="b9851ba430d845aa0d0cfbec06986420" name="tests/bson-corpus/string-decodeError-003.phpt" role="test" />
<file md5sum="c5c3e28b1702a4a526998998b65ae2b6" name="tests/bson-corpus/string-decodeError-004.phpt" role="test" />
<file md5sum="09e45dc9b3831b90438d42967d98e81f" name="tests/bson-corpus/string-decodeError-005.phpt" role="test" />
<file md5sum="aef88e1ff7d5b21c715f00a4ca3d44ff" name="tests/bson-corpus/string-decodeError-006.phpt" role="test" />
<file md5sum="d208f92291581f7319ecc9af5f3a0fb7" name="tests/bson-corpus/string-decodeError-007.phpt" role="test" />
- <file md5sum="b96f96eac724e666d73f4c7ce146e6d3" name="tests/bson-corpus/string-valid-001.phpt" role="test" />
- <file md5sum="c86edeb94cd259c3771c69cfccfe88ff" name="tests/bson-corpus/string-valid-002.phpt" role="test" />
- <file md5sum="b69c5ddf7866f0de81d3aaa9923452ba" name="tests/bson-corpus/string-valid-003.phpt" role="test" />
- <file md5sum="a09d1c006787d42d982e0a80f80a75e1" name="tests/bson-corpus/string-valid-004.phpt" role="test" />
- <file md5sum="f004f57e1908394a0f9d0018c177755c" name="tests/bson-corpus/string-valid-005.phpt" role="test" />
- <file md5sum="658c6b0e16fd679f5e7ef30c920e5da3" name="tests/bson-corpus/string-valid-006.phpt" role="test" />
- <file md5sum="b9263c54d0a92357a336ab5ff9544911" name="tests/bson-corpus/string-valid-007.phpt" role="test" />
+ <file md5sum="af33548865185e5c0eafe900dd9aae6f" name="tests/bson-corpus/string-valid-001.phpt" role="test" />
+ <file md5sum="2c793120da6a8b9ea337a7a4a44dcf01" name="tests/bson-corpus/string-valid-002.phpt" role="test" />
+ <file md5sum="994c306274060985090c9ccd1fcc14af" name="tests/bson-corpus/string-valid-003.phpt" role="test" />
+ <file md5sum="f0509fd7a1fd681b5e98398bb1a0a5cb" name="tests/bson-corpus/string-valid-004.phpt" role="test" />
+ <file md5sum="ce90d9660c364c28a42800d22d0a92a2" name="tests/bson-corpus/string-valid-005.phpt" role="test" />
+ <file md5sum="161433b692a38376eaa6897c4fbc7f6f" name="tests/bson-corpus/string-valid-006.phpt" role="test" />
+ <file md5sum="83b55e989eb1415ebfd7f54ac3fe0257" name="tests/bson-corpus/string-valid-007.phpt" role="test" />
<file md5sum="3d11be58c91b9a1f8d42c2fc4c264733" name="tests/bson-corpus/symbol-decodeError-001.phpt" role="test" />
<file md5sum="8b260ed51ddca45a69acc54bc10d767c" name="tests/bson-corpus/symbol-decodeError-002.phpt" role="test" />
<file md5sum="738ac24d3ec20630f7d29f904bae2209" name="tests/bson-corpus/symbol-decodeError-003.phpt" role="test" />
<file md5sum="35e3562d24a6378a65ce3d3de6b2091b" name="tests/bson-corpus/symbol-decodeError-004.phpt" role="test" />
<file md5sum="2211c7745a5ac3e3c4febf63b4dc827c" name="tests/bson-corpus/symbol-decodeError-005.phpt" role="test" />
<file md5sum="a44e30922c7764b57afff5395bbca126" name="tests/bson-corpus/symbol-decodeError-006.phpt" role="test" />
<file md5sum="097146230f60960a210ca20db243d8d8" name="tests/bson-corpus/symbol-decodeError-007.phpt" role="test" />
- <file md5sum="c91d5c1d3f675a8b77155c4863ae31d8" name="tests/bson-corpus/symbol-valid-001.phpt" role="test" />
- <file md5sum="d94d8b7c069f4707a0b5850a73c82bbd" name="tests/bson-corpus/symbol-valid-002.phpt" role="test" />
- <file md5sum="56dc191f2e7e6e54683fd8e06264e459" name="tests/bson-corpus/symbol-valid-003.phpt" role="test" />
- <file md5sum="77217526b5bc90ae8f1a0b7cf85128e0" name="tests/bson-corpus/symbol-valid-004.phpt" role="test" />
- <file md5sum="9813119cb30ddfdc73e4e34c9e0c3f12" name="tests/bson-corpus/symbol-valid-005.phpt" role="test" />
- <file md5sum="4ea56490f75638b65382afb9372f08f3" name="tests/bson-corpus/symbol-valid-006.phpt" role="test" />
+ <file md5sum="15efb4fdf8c41e83d2220bb9204a40f8" name="tests/bson-corpus/symbol-valid-001.phpt" role="test" />
+ <file md5sum="fd0afd6b77d698c6ba98c86d7ab852c6" name="tests/bson-corpus/symbol-valid-002.phpt" role="test" />
+ <file md5sum="e04df8dccb412934bbb93b40601aa38e" name="tests/bson-corpus/symbol-valid-003.phpt" role="test" />
+ <file md5sum="02878c50cc723d2fa6f5d8ddcb4ff2d7" name="tests/bson-corpus/symbol-valid-004.phpt" role="test" />
+ <file md5sum="f07584e6ca4bb085e2daa6d2c96aa84c" name="tests/bson-corpus/symbol-valid-005.phpt" role="test" />
+ <file md5sum="a6ce557c36ab8bb1fb1cfe258dc31fe9" name="tests/bson-corpus/symbol-valid-006.phpt" role="test" />
<file md5sum="267928a71cfe6e336a82eef0d3f5b239" name="tests/bson-corpus/timestamp-decodeError-001.phpt" role="test" />
- <file md5sum="5469f32d4d42a0d4f9ff2c5bed56a387" name="tests/bson-corpus/timestamp-valid-001.phpt" role="test" />
- <file md5sum="3fca07533f08d2fe9821b980afa8a2be" name="tests/bson-corpus/timestamp-valid-002.phpt" role="test" />
- <file md5sum="c93eb857dfeb49bf70a7bcc9c0f9a425" name="tests/bson-corpus/timestamp-valid-003.phpt" role="test" />
+ <file md5sum="085934f8eed7692395c1b7902ebbd546" name="tests/bson-corpus/timestamp-valid-001.phpt" role="test" />
+ <file md5sum="c62edab7562c720e97e32801669e4d48" name="tests/bson-corpus/timestamp-valid-002.phpt" role="test" />
+ <file md5sum="110e3848ea57d9315981cd29e9d8792f" name="tests/bson-corpus/timestamp-valid-003.phpt" role="test" />
+ <file md5sum="572d41b08892fdfb7ab5661227ba98b6" name="tests/bson-corpus/timestamp-valid-004.phpt" role="test" />
<file md5sum="17ce094686cb362b80cfe1bca51b7088" name="tests/bson-corpus/top-decodeError-001.phpt" role="test" />
<file md5sum="600cb83eacf159a50fce8ac90cdf74ad" name="tests/bson-corpus/top-decodeError-002.phpt" role="test" />
<file md5sum="05031bb2a71b66c4f7ddee2b6a28ddeb" name="tests/bson-corpus/top-decodeError-003.phpt" role="test" />
<file md5sum="9e10c5ae6ec32276e1fa8a1a4ee892fb" name="tests/bson-corpus/top-decodeError-004.phpt" role="test" />
<file md5sum="68283e51bd216fa7e1b2eb437c3e76d9" name="tests/bson-corpus/top-decodeError-005.phpt" role="test" />
<file md5sum="797ce39fad54934b9b0c0bd6b13511cd" name="tests/bson-corpus/top-decodeError-006.phpt" role="test" />
<file md5sum="ad427d8fe90a3a37af730cb6ed0ca872" name="tests/bson-corpus/top-decodeError-007.phpt" role="test" />
<file md5sum="cf6d4a73c4741f76969251dd6254ef75" name="tests/bson-corpus/top-decodeError-008.phpt" role="test" />
<file md5sum="3d9b849acd268ae10a2cc1658f7fdfed" name="tests/bson-corpus/top-decodeError-009.phpt" role="test" />
<file md5sum="249c629abd447efec58954be6d0bfd90" name="tests/bson-corpus/top-decodeError-010.phpt" role="test" />
<file md5sum="d86a4178bced6e0fc406be05e232f56b" name="tests/bson-corpus/top-decodeError-011.phpt" role="test" />
<file md5sum="6272048144f54d1c61e6dcc2a54577a0" name="tests/bson-corpus/top-decodeError-012.phpt" role="test" />
<file md5sum="e0c5a2f46b6bb5043b0b95a56c7bfc6b" name="tests/bson-corpus/top-decodeError-013.phpt" role="test" />
<file md5sum="bbe865333f4d9917795b2d097bbb2114" name="tests/bson-corpus/top-decodeError-014.phpt" role="test" />
- <file md5sum="f4b30ed02746f3520b83c6c680e849cf" name="tests/bson-corpus/top-parseError-001.phpt" role="test" />
- <file md5sum="91ff115679200da2479742be4c591690" name="tests/bson-corpus/top-parseError-002.phpt" role="test" />
+ <file md5sum="aa982193dd0086ff38a02d82986b4706" name="tests/bson-corpus/top-parseError-001.phpt" role="test" />
+ <file md5sum="689d00fb141378a751a2a17637678f9f" name="tests/bson-corpus/top-parseError-002.phpt" role="test" />
<file md5sum="6d9d8365254b5cc40f2bfdf0b474b614" name="tests/bson-corpus/top-parseError-003.phpt" role="test" />
<file md5sum="43e86b1dceb98cf74b2e55153cdb9198" name="tests/bson-corpus/top-parseError-004.phpt" role="test" />
- <file md5sum="2c97ee609289adb8f2f9a474c562ad14" name="tests/bson-corpus/top-parseError-005.phpt" role="test" />
+ <file md5sum="51eef3b071286f8176e5769066f65a2a" name="tests/bson-corpus/top-parseError-005.phpt" role="test" />
<file md5sum="2b8b22e19e96a1fce188857b269e80db" name="tests/bson-corpus/top-parseError-006.phpt" role="test" />
<file md5sum="63b0e2d0d4aca2dedadd7c77110b7472" name="tests/bson-corpus/top-parseError-007.phpt" role="test" />
<file md5sum="e8150597fe010182fc52036df6cfda73" name="tests/bson-corpus/top-parseError-008.phpt" role="test" />
<file md5sum="a4216bb01781440e2d893563d2a3e1fe" name="tests/bson-corpus/top-parseError-009.phpt" role="test" />
<file md5sum="23c04f804d78b680143362608b120559" name="tests/bson-corpus/top-parseError-010.phpt" role="test" />
<file md5sum="7aa72cf9cac3c52466857d9f06be03e6" name="tests/bson-corpus/top-parseError-011.phpt" role="test" />
<file md5sum="cf0d10a7ccb9b3cf057bfaf1155c7fe7" name="tests/bson-corpus/top-parseError-012.phpt" role="test" />
<file md5sum="f743225a927233df16827f1b284ec947" name="tests/bson-corpus/top-parseError-013.phpt" role="test" />
<file md5sum="3a3b29d65c4a35d5f27c78043701eff9" name="tests/bson-corpus/top-parseError-014.phpt" role="test" />
<file md5sum="6476201c23012606cc5741b93cdf3a98" name="tests/bson-corpus/top-parseError-015.phpt" role="test" />
<file md5sum="683bf02ff22e94e6b445b2184973bd61" name="tests/bson-corpus/top-parseError-016.phpt" role="test" />
<file md5sum="d08cb48900875f44cc0edcae2d367f54" name="tests/bson-corpus/top-parseError-017.phpt" role="test" />
<file md5sum="325077497c93dfd8f05868675a11156a" name="tests/bson-corpus/top-parseError-018.phpt" role="test" />
<file md5sum="3728e5b380d1342efe7509e86d831d99" name="tests/bson-corpus/top-parseError-019.phpt" role="test" />
<file md5sum="c8912c33f65fca26063d9fc102573667" name="tests/bson-corpus/top-parseError-020.phpt" role="test" />
<file md5sum="cc552f5c94e9381bfe83a2c69c9055e7" name="tests/bson-corpus/top-parseError-021.phpt" role="test" />
- <file md5sum="e5c8182e3897dceb743012ceb7d53078" name="tests/bson-corpus/top-parseError-022.phpt" role="test" />
- <file md5sum="2ae68a06cd5e15375bac8ba27f320b84" name="tests/bson-corpus/top-parseError-023.phpt" role="test" />
- <file md5sum="5fb8365ce1e7c8cc9ae704f1f3e09a49" name="tests/bson-corpus/top-parseError-024.phpt" role="test" />
- <file md5sum="182e2b40f8b1258916cab85e9f3b07ed" name="tests/bson-corpus/top-parseError-025.phpt" role="test" />
- <file md5sum="7d6ee218b88c852721423dd332a6d5c7" name="tests/bson-corpus/top-parseError-026.phpt" role="test" />
- <file md5sum="6b3cb7b036b3bdd2f096a06467321d84" name="tests/bson-corpus/top-parseError-027.phpt" role="test" />
- <file md5sum="2475d1436b8e3f8abbf8810d0c9cf20d" name="tests/bson-corpus/top-parseError-028.phpt" role="test" />
- <file md5sum="aa111516293dd649fbaf4422d45a7a50" name="tests/bson-corpus/top-parseError-029.phpt" role="test" />
- <file md5sum="03a9219928cfc54e7ba0740c5b6da4da" name="tests/bson-corpus/top-parseError-030.phpt" role="test" />
- <file md5sum="6ece98f8da86545a67fb6b746bf4bc0f" name="tests/bson-corpus/top-parseError-031.phpt" role="test" />
- <file md5sum="be3927befbcc2741e4063f6ad5b85b8a" name="tests/bson-corpus/top-parseError-032.phpt" role="test" />
- <file md5sum="0f9ab539216d28503c0e5e964f8ecf5a" name="tests/bson-corpus/top-parseError-033.phpt" role="test" />
- <file md5sum="39bc682fadb62d8600396ee6e7964442" name="tests/bson-corpus/top-parseError-034.phpt" role="test" />
- <file md5sum="73cc7317c62a4006f0eafeaaa512eda0" name="tests/bson-corpus/top-parseError-035.phpt" role="test" />
- <file md5sum="dea2b127c4421799656ac90ac5a8a19a" name="tests/bson-corpus/top-parseError-036.phpt" role="test" />
- <file md5sum="cd0ee19e16182cc19bc392cd9828753d" name="tests/bson-corpus/top-parseError-037.phpt" role="test" />
- <file md5sum="fa78aa1ba539ffb2af3554812ed1b89c" name="tests/bson-corpus/top-parseError-038.phpt" role="test" />
- <file md5sum="de6cb2dae694a93abcd0c55dd1e7e131" name="tests/bson-corpus/top-parseError-039.phpt" role="test" />
- <file md5sum="0bc5affa8185d39910c7210cec956be7" name="tests/bson-corpus/top-parseError-040.phpt" role="test" />
- <file md5sum="1898e62ad427e74c8ea17da283b99194" name="tests/bson-corpus/top-parseError-041.phpt" role="test" />
- <file md5sum="0065bb9e2c526be10241d62820459405" name="tests/bson-corpus/top-valid-001.phpt" role="test" />
- <file md5sum="5ec152da957dd51d5ee3fb6a719c2600" name="tests/bson-corpus/undefined-valid-001.phpt" role="test" />
+ <file md5sum="06765bf1ce6591366f83615d9e767bd7" name="tests/bson-corpus/top-parseError-022.phpt" role="test" />
+ <file md5sum="e5c8182e3897dceb743012ceb7d53078" name="tests/bson-corpus/top-parseError-023.phpt" role="test" />
+ <file md5sum="2ae68a06cd5e15375bac8ba27f320b84" name="tests/bson-corpus/top-parseError-024.phpt" role="test" />
+ <file md5sum="5fb8365ce1e7c8cc9ae704f1f3e09a49" name="tests/bson-corpus/top-parseError-025.phpt" role="test" />
+ <file md5sum="182e2b40f8b1258916cab85e9f3b07ed" name="tests/bson-corpus/top-parseError-026.phpt" role="test" />
+ <file md5sum="7d6ee218b88c852721423dd332a6d5c7" name="tests/bson-corpus/top-parseError-027.phpt" role="test" />
+ <file md5sum="6b3cb7b036b3bdd2f096a06467321d84" name="tests/bson-corpus/top-parseError-028.phpt" role="test" />
+ <file md5sum="2475d1436b8e3f8abbf8810d0c9cf20d" name="tests/bson-corpus/top-parseError-029.phpt" role="test" />
+ <file md5sum="aa111516293dd649fbaf4422d45a7a50" name="tests/bson-corpus/top-parseError-030.phpt" role="test" />
+ <file md5sum="03a9219928cfc54e7ba0740c5b6da4da" name="tests/bson-corpus/top-parseError-031.phpt" role="test" />
+ <file md5sum="6ece98f8da86545a67fb6b746bf4bc0f" name="tests/bson-corpus/top-parseError-032.phpt" role="test" />
+ <file md5sum="be3927befbcc2741e4063f6ad5b85b8a" name="tests/bson-corpus/top-parseError-033.phpt" role="test" />
+ <file md5sum="0f9ab539216d28503c0e5e964f8ecf5a" name="tests/bson-corpus/top-parseError-034.phpt" role="test" />
+ <file md5sum="39bc682fadb62d8600396ee6e7964442" name="tests/bson-corpus/top-parseError-035.phpt" role="test" />
+ <file md5sum="73cc7317c62a4006f0eafeaaa512eda0" name="tests/bson-corpus/top-parseError-036.phpt" role="test" />
+ <file md5sum="dea2b127c4421799656ac90ac5a8a19a" name="tests/bson-corpus/top-parseError-037.phpt" role="test" />
+ <file md5sum="cd0ee19e16182cc19bc392cd9828753d" name="tests/bson-corpus/top-parseError-038.phpt" role="test" />
+ <file md5sum="fa78aa1ba539ffb2af3554812ed1b89c" name="tests/bson-corpus/top-parseError-039.phpt" role="test" />
+ <file md5sum="de6cb2dae694a93abcd0c55dd1e7e131" name="tests/bson-corpus/top-parseError-040.phpt" role="test" />
+ <file md5sum="0bc5affa8185d39910c7210cec956be7" name="tests/bson-corpus/top-parseError-041.phpt" role="test" />
+ <file md5sum="1898e62ad427e74c8ea17da283b99194" name="tests/bson-corpus/top-parseError-042.phpt" role="test" />
+ <file md5sum="44d20d7a5da4f78818842aadd4b872db" name="tests/bson-corpus/top-valid-001.phpt" role="test" />
+ <file md5sum="ff8adbb23ccaaba1d16920a563927e96" name="tests/bson-corpus/undefined-valid-001.phpt" role="test" />
<file md5sum="3d80c1cedf3c4a5efa3796dd674c572f" name="tests/bson/bson-binary-001.phpt" role="test" />
<file md5sum="ed2ceadc61f469667f684a3156043661" name="tests/bson/bson-binary-clone-001.phpt" role="test" />
<file md5sum="78c016cd924e363fb8433ce673a76b6a" name="tests/bson/bson-binary-compare-001.phpt" role="test" />
<file md5sum="6eb6c83707dd7be5c718fa13b0427d6c" name="tests/bson/bson-binary-compare-002.phpt" role="test" />
<file md5sum="58e5df014bd86dd8f1313b3fb734a7ce" name="tests/bson/bson-binary-get_properties-001.phpt" role="test" />
<file md5sum="c61e1c8e4c5327f87674314fde6b5d2f" name="tests/bson/bson-binary-get_properties-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="325c3d210bfa4eb571a36ffa5f75c347" name="tests/bson/bson-binary-serialization_error-003.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="df1ccfb1bbd3562866bc851709320cd4" name="tests/bson/bson-binary-set_state_error-003.phpt" role="test" />
<file md5sum="2079c2a8ebed8e51c12a0fab40e42ab3" name="tests/bson/bson-binary-tostring-001.phpt" role="test" />
- <file md5sum="b347f8c2d418ca38cf19983ec7aa4f9d" name="tests/bson/bson-binary_error-001.phpt" role="test" />
+ <file md5sum="fad69ac7c76373da74f23ea218525bff" 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="c52d47c59fa41f83989f99d3b509bc4b" name="tests/bson/bson-binary_error-003.phpt" role="test" />
<file md5sum="47b5df8e7129de482422f2eda5f15be7" name="tests/bson/bson-binary_error-004.phpt" role="test" />
<file md5sum="fe638f713510cf803847a14a9109e6e7" name="tests/bson/bson-binaryinterface-001.phpt" role="test" />
<file md5sum="ccecb42fcff7a5c5ac18f3049f869367" name="tests/bson/bson-dbpointer-001.phpt" role="test" />
<file md5sum="a9eb173b6168b52f6f36a3c1ad230e03" name="tests/bson/bson-dbpointer-002.phpt" role="test" />
<file md5sum="9d2f5ce5b252da2c222cec4f2c9848e8" name="tests/bson/bson-dbpointer-clone-001.phpt" role="test" />
<file md5sum="d583aaa6c756bd85fbc18a1aea0c8375" name="tests/bson/bson-dbpointer-compare-001.phpt" role="test" />
<file md5sum="54a92286eef293b765b118e13c4c35c6" name="tests/bson/bson-dbpointer-get_properties-001.phpt" role="test" />
<file md5sum="7eb0a24e6d9fdb5ba682ed5b56d4e903" name="tests/bson/bson-dbpointer-get_properties-002.phpt" role="test" />
<file md5sum="080fc12205c5e3b7faac905c1492d430" name="tests/bson/bson-dbpointer-jsonserialize-001.phpt" role="test" />
<file md5sum="e5e353372466bdf22c21a2cf2b9d4b7e" name="tests/bson/bson-dbpointer-jsonserialize-003.phpt" role="test" />
<file md5sum="8f81f1d20a38681c86091496d0fbf318" name="tests/bson/bson-dbpointer-serialization-001.phpt" role="test" />
<file md5sum="2edafeb76539e7a390372cfabc097c69" name="tests/bson/bson-dbpointer-serialization_error-001.phpt" role="test" />
<file md5sum="3cc4a7fdb023213b9528558497fe03d4" name="tests/bson/bson-dbpointer-serialization_error-002.phpt" role="test" />
<file md5sum="9967c68c7c6be7228d00469feb0a1a44" name="tests/bson/bson-dbpointer-tostring-001.phpt" role="test" />
<file md5sum="b014e534e95c2a043f33d4e65fb876df" name="tests/bson/bson-dbpointer_error-002.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="0f6988e90559d6d9f1a55d433bd02e8a" name="tests/bson/bson-decimal128-clone-001.phpt" role="test" />
<file md5sum="49024c33887fe583b96d02a37d826015" name="tests/bson/bson-decimal128-get_properties-001.phpt" role="test" />
<file md5sum="2078cc54b51b316910e7724a9fd6a346" name="tests/bson/bson-decimal128-get_properties-002.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="d8f8e22c20591565326ca9049c000bd9" name="tests/bson/bson-decimal128_error-001.phpt" role="test" />
+ <file md5sum="72d3e853cf4428e5f953445b2b5f60b8" 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="a7dbd531a5dace1341acdf77d3821da3" name="tests/bson/bson-decimal128interface-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="c537992ae377109995cc650def0fbe31" name="tests/bson/bson-encode-001.phpt" role="test" />
<file md5sum="7d63ae8f6ffe1c3723de519a28c518a8" name="tests/bson/bson-encode-002.phpt" role="test" />
<file md5sum="d550fc4626346715c42734b53530214c" name="tests/bson/bson-encode-003.phpt" role="test" />
<file md5sum="3522dbb44d2bd025ab4af336ceedb5be" 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="729e16c01e1318e6a3e74c1a28139e5e" name="tests/bson/bson-fromJSON_error-001.phpt" role="test" />
<file md5sum="ef65020cde3e656d01e8dd4b70f5211e" name="tests/bson/bson-fromPHP-001.phpt" role="test" />
<file md5sum="06ede31fb02f0b324a717cadb4265039" name="tests/bson/bson-fromPHP-002.phpt" role="test" />
<file md5sum="5cd6e5efd2648c553440a51f3ad3598d" name="tests/bson/bson-fromPHP-003.phpt" role="test" />
<file md5sum="cdee70ad41d06ebf5433f0c123d8b473" name="tests/bson/bson-fromPHP-005.phpt" role="test" />
<file md5sum="fb00e3c73770eaa72d2c4042438a698a" name="tests/bson/bson-fromPHP-006.phpt" role="test" />
<file md5sum="37da86a86d36cd1daed3a9bfa248f70e" name="tests/bson/bson-fromPHP_error-001.phpt" role="test" />
<file md5sum="ef68d2538f8ba276e2c1f5d2cf2ddfc9" name="tests/bson/bson-fromPHP_error-002.phpt" role="test" />
<file md5sum="f993198bf3a01d40aa7b99bdde1ffdc5" name="tests/bson/bson-fromPHP_error-003.phpt" role="test" />
<file md5sum="1c04d76289edca5f11debc932a34d41a" name="tests/bson/bson-fromPHP_error-004.phpt" role="test" />
<file md5sum="25c8a2dce3c0bf744ea7299af0ec7566" name="tests/bson/bson-fromPHP_error-005.phpt" role="test" />
<file md5sum="770dc582943380506e71373bf2b7a26e" name="tests/bson/bson-fromPHP_error-006.phpt" role="test" />
<file md5sum="a2e0a4b52f68269b2438cd87a6f9cf60" name="tests/bson/bson-fromPHP_error-007.phpt" role="test" />
<file md5sum="b064e9510af10fb5bbd0ca9e8de7c17a" name="tests/bson/bson-fromPHP_error-008.phpt" role="test" />
<file md5sum="f6d0cd61c063f7a75cd28fb2532b3f23" name="tests/bson/bson-generate-document-id.phpt" role="test" />
<file md5sum="734a26320f6c21f4843d6b91bd986c92" name="tests/bson/bson-int64-001.phpt" role="test" />
<file md5sum="bb10023184831709486f50af335da27d" name="tests/bson/bson-int64-002.phpt" role="test" />
<file md5sum="a1a1f85b23be0c1715e8ec4144208ed9" name="tests/bson/bson-int64-003.phpt" role="test" />
<file md5sum="bc8258611a29335e873c4f9e2e071a5c" name="tests/bson/bson-int64-clone-001.phpt" role="test" />
<file md5sum="3e9447dc7f3c1f1d40741b8585fe7807" name="tests/bson/bson-int64-compare-001.phpt" role="test" />
<file md5sum="c213fa3095e2825c4743677d746b1439" name="tests/bson/bson-int64-debug-001.phpt" role="test" />
<file md5sum="9cf48adc54bdbcbcecb5a2d9fd7c83c5" name="tests/bson/bson-int64-get_properties-001.phpt" role="test" />
<file md5sum="4900dd4d57070508e00217e51f470024" name="tests/bson/bson-int64-get_properties-002.phpt" role="test" />
<file md5sum="3e267e9d9f2bd1c6e3cf496dc153291c" name="tests/bson/bson-int64-jsonserialize-001.phpt" role="test" />
<file md5sum="7ce34a4fb651813d599dc770d61ef203" name="tests/bson/bson-int64-jsonserialize-002.phpt" role="test" />
<file md5sum="2b72562264c5a073b5013b0a48bb36c5" name="tests/bson/bson-int64-serialization-001.phpt" role="test" />
<file md5sum="05cbed2ca31e86e60e51c93f5e008379" name="tests/bson/bson-int64-serialization_error-001.phpt" role="test" />
<file md5sum="b742b905af55fa62956722bc4ca9f3af" name="tests/bson/bson-int64-serialization_error-002.phpt" role="test" />
<file md5sum="d3d5527a1ed2efe91fa1772c9f4b9698" name="tests/bson/bson-int64-tostring-001.phpt" role="test" />
<file md5sum="bfc1487b2aaa119d7da844a767f76487" name="tests/bson/bson-int64_error-001.phpt" role="test" />
<file md5sum="3ee11e5db8d124bc21663bb2f306b983" name="tests/bson/bson-javascript-001.phpt" role="test" />
<file md5sum="9c91bd749fd0ab27a36d14394a5e424b" name="tests/bson/bson-javascript-002.phpt" role="test" />
<file md5sum="7251917701d3bbf22a6caba54c332bd4" name="tests/bson/bson-javascript-clone-001.phpt" role="test" />
<file md5sum="97e60e9d937e0545fdd93efbc9f78c7f" name="tests/bson/bson-javascript-compare-001.phpt" role="test" />
<file md5sum="6fa03185f5a88f493df843621065aeb9" 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="540de5d9a88362eb9f00555a1fb35597" name="tests/bson/bson-javascript-getScope-001.phpt" role="test" />
<file md5sum="e25c7ca28f41bf8785962a44c62b2159" name="tests/bson/bson-javascript-get_properties-001.phpt" role="test" />
<file md5sum="d422d8249db5a52a19a9fb2bf3e2b631" name="tests/bson/bson-javascript-get_properties-002.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="50f282c4901a3e1640c94fc927f714f0" name="tests/bson/bson-javascript-jsonserialize-003.phpt" role="test" />
<file md5sum="8b577cf09bca8e3fc9614d616c19860e" name="tests/bson/bson-javascript-jsonserialize-004.phpt" role="test" />
<file md5sum="6715a176827be6b7f3ef2226d9599063" 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="8b7ae41cc5888baaa121061c665ba301" 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="4a853962f168d677f3e9c2087766fa29" name="tests/bson/bson-javascript-tostring-001.phpt" role="test" />
- <file md5sum="7f3d6e574efcc98b4db1fbe543bdb12e" name="tests/bson/bson-javascript_error-001.phpt" role="test" />
+ <file md5sum="12d356f6de3a1b32f77ad10194dda94c" 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="91e37d158699b239d09f45bac8b3a237" name="tests/bson/bson-javascriptinterface-001.phpt" role="test" />
<file md5sum="726fe1860dfb685818b14c5a6be825ea" name="tests/bson/bson-maxkey-001.phpt" role="test" />
<file md5sum="99b4187d536dc839066a926b7d672f7a" name="tests/bson/bson-maxkey-clone-001.phpt" role="test" />
<file md5sum="1640c877e8ffab77ca2a49939721f325" 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="d9a42b06a0a7d9b8103ffee8a638c7b5" name="tests/bson/bson-maxkeyinterface-001.phpt" role="test" />
<file md5sum="62d2b76e5ddf5a724d21ae546b7561b1" name="tests/bson/bson-minkey-001.phpt" role="test" />
<file md5sum="5d69570131fe8a1649287c0369d31599" name="tests/bson/bson-minkey-clone-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="0a45023579316c69f78806f230ba106c" name="tests/bson/bson-minkeyinterface-001.phpt" role="test" />
- <file md5sum="6a98e167419823a2ae98732fbcdc16ef" name="tests/bson/bson-objectid-001.phpt" role="test" />
+ <file md5sum="37f3da4fdce222c2bfca4f723e49c12f" name="tests/bson/bson-objectid-001.phpt" role="test" />
<file md5sum="d1eae72097de3d1e1bd0ef60f4e35cd6" name="tests/bson/bson-objectid-002.phpt" role="test" />
<file md5sum="c994597716974e44d2586b1fd6abe4a8" name="tests/bson/bson-objectid-003.phpt" role="test" />
<file md5sum="b9a3a09dd645ff06e975d192c34ad587" name="tests/bson/bson-objectid-004.phpt" role="test" />
<file md5sum="bde3597cc2da978c6f610be4f4e0af99" name="tests/bson/bson-objectid-clone-001.phpt" role="test" />
<file md5sum="a777ad1f36f9f3ab61a31848e29fbda3" name="tests/bson/bson-objectid-compare-001.phpt" role="test" />
<file md5sum="45a5c909f831527ec527dc6dff83a41d" name="tests/bson/bson-objectid-compare-002.phpt" role="test" />
<file md5sum="5f4fc31b72fbf2946cabfbe801e1f8e5" name="tests/bson/bson-objectid-getTimestamp-001.phpt" role="test" />
<file md5sum="04c2bfef7d149d82b796f8257ae8d1ee" name="tests/bson/bson-objectid-getTimestamp-002.phpt" role="test" />
<file md5sum="cae2d6ff62f134db503c739f79da7516" name="tests/bson/bson-objectid-get_properties-001.phpt" role="test" />
<file md5sum="ce20450b15ec7489bc67392e0af50231" name="tests/bson/bson-objectid-get_properties-002.phpt" role="test" />
<file md5sum="2927bb3a1e8581dada0e53f8c701f30d" name="tests/bson/bson-objectid-jsonserialize-001.phpt" role="test" />
<file md5sum="d64b11cf175f975ebe964b1dd1684d52" name="tests/bson/bson-objectid-jsonserialize-002.phpt" role="test" />
<file md5sum="5e8370c65ccd9bd3af9268acbc0b2d32" name="tests/bson/bson-objectid-serialization-001.phpt" role="test" />
<file md5sum="147723e5365c43ef3947319b75374d05" name="tests/bson/bson-objectid-serialization_error-001.phpt" role="test" />
<file md5sum="30c5ef0be71cb20a6d59055090d4c360" name="tests/bson/bson-objectid-serialization_error-002.phpt" role="test" />
<file md5sum="5d2fd4b95c5120b2f79599dab1d8611f" name="tests/bson/bson-objectid-set_state-001.phpt" role="test" />
<file md5sum="1bd644e702a2bbd2524899eee772ec0c" name="tests/bson/bson-objectid-set_state_error-001.phpt" role="test" />
<file md5sum="67d3e6886da704de351a6aa49b256c74" name="tests/bson/bson-objectid-set_state_error-002.phpt" role="test" />
- <file md5sum="53f896b8b17ed91961848044f0c9a67f" name="tests/bson/bson-objectid_error-001.phpt" role="test" />
+ <file md5sum="78aecc49aff28c6a963279fc8d88c4d7" name="tests/bson/bson-objectid-tostring_error-001.phpt" role="test" />
+ <file md5sum="1b1ceb4183416ec6f5ce5be3f6b92d75" name="tests/bson/bson-objectid_error-001.phpt" role="test" />
<file md5sum="d89e2fd1b54762f478872976049633ec" name="tests/bson/bson-objectid_error-002.phpt" role="test" />
<file md5sum="51145ee580d4b4dced0c2f23f0fbbfca" name="tests/bson/bson-objectid_error-003.phpt" role="test" />
<file md5sum="94512cbf7a26273ee3b7191601600674" name="tests/bson/bson-objectidinterface-001.phpt" role="test" />
<file md5sum="36f88ff62e81bfc544a0f70a055a301b" name="tests/bson/bson-regex-001.phpt" role="test" />
<file md5sum="c6d502bd80b12b49bb86ca15cd80cb5d" name="tests/bson/bson-regex-002.phpt" role="test" />
<file md5sum="986da81902669ff49dd126f04122b14e" 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="343c27a913b443e296a90286b9da70e6" name="tests/bson/bson-regex-clone-001.phpt" role="test" />
<file md5sum="6f0accb9c2f47fd13f287b115e1fdb69" name="tests/bson/bson-regex-compare-001.phpt" role="test" />
<file md5sum="78e0fcaa87dc451f34f9ef119e1bd274" name="tests/bson/bson-regex-compare-002.phpt" role="test" />
<file md5sum="7b006f20fc2ac164fb4bdce2846da38b" name="tests/bson/bson-regex-get_properties-001.phpt" role="test" />
<file md5sum="6324a488905bb05b3d2e75375c69d88a" name="tests/bson/bson-regex-get_properties-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="3d8f867dcd7ff6f50b6d34aefd27b656" name="tests/bson/bson-regex_error-001.phpt" role="test" />
+ <file md5sum="f3baa23091b5b60d2c138a3f6d41ae11" 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="b3c02b3eb309f7bbf5a33523a120b43f" name="tests/bson/bson-regexinterface-001.phpt" role="test" />
<file md5sum="049265745d1c20d6a527d5ddb093e987" name="tests/bson/bson-symbol-001.phpt" role="test" />
<file md5sum="f9fa29cc20bb17cada126b73688f61ad" name="tests/bson/bson-symbol-clone-001.phpt" role="test" />
<file md5sum="a55dbbc77a3a9221810c032f38d25005" name="tests/bson/bson-symbol-compare-001.phpt" role="test" />
<file md5sum="e0b90e25e3507d77a97b7463ab76c0d4" name="tests/bson/bson-symbol-get_properties-001.phpt" role="test" />
<file md5sum="0648e9bf022072d2eb9343fb99f30a0a" name="tests/bson/bson-symbol-get_properties-002.phpt" role="test" />
<file md5sum="218eba280d32b6bbe135d24fb530ecb1" name="tests/bson/bson-symbol-jsonserialize-001.phpt" role="test" />
<file md5sum="380d842bbdea45f6a8582ec563d2b64e" name="tests/bson/bson-symbol-jsonserialize-002.phpt" role="test" />
<file md5sum="55905512f51a5e7e449576456797c704" name="tests/bson/bson-symbol-serialization-001.phpt" role="test" />
<file md5sum="e0b13e8d18c0df3daa074afa7586758f" name="tests/bson/bson-symbol-serialization_error-001.phpt" role="test" />
<file md5sum="d409f086553d6059c65972228ba02b9e" name="tests/bson/bson-symbol-serialization_error-002.phpt" role="test" />
<file md5sum="5753cdf389e2e3cb769eaa272f4a285e" name="tests/bson/bson-symbol-tostring-001.phpt" role="test" />
<file md5sum="660786fbe39ddfa70e3d471a551fc52b" name="tests/bson/bson-symbol_error-001.phpt" role="test" />
<file md5sum="fd6921fa653d75593cebefdee44f3a37" 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="7a9928568f2b6519cca73c412800c549" name="tests/bson/bson-timestamp-clone-001.phpt" role="test" />
<file md5sum="bf27f37b85d838f7f3601f1733674ebe" name="tests/bson/bson-timestamp-compare-001.phpt" role="test" />
<file md5sum="8d390960f78a0d4c874f1a9bea6f60e1" name="tests/bson/bson-timestamp-getIncrement-001.phpt" role="test" />
<file md5sum="dbc98d4c863f2edbd470a744569b8ebc" name="tests/bson/bson-timestamp-getTimestamp-001.phpt" role="test" />
<file md5sum="70cbe569659d4cd104ded6f0b3954697" name="tests/bson/bson-timestamp-get_properties-001.phpt" role="test" />
<file md5sum="1cb51102b60c196d34c7c1588b91ae78" name="tests/bson/bson-timestamp-get_properties-002.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="793354e47905c97cc4294d1b4be471e1" name="tests/bson/bson-timestamp_error-001.phpt" role="test" />
+ <file md5sum="45522389fc4fe6bcaee34a9b508354bd" 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="22a4db204fc36bb46ac9ec53c494bc8b" 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="f46e2440763b6497ffa907b66cf47752" name="tests/bson/bson-timestamp_error-006.phpt" role="test" />
<file md5sum="304b9fe634cafb1fb611d793197f60ec" name="tests/bson/bson-timestampinterface-001.phpt" role="test" />
<file md5sum="2473a1824e9801db25f815431426ca16" name="tests/bson/bson-toCanonicalJSON-001.phpt" role="test" />
<file md5sum="e39ea45b387e39515b840ec5b8a3135d" name="tests/bson/bson-toCanonicalJSON-002.phpt" role="test" />
<file md5sum="5c6650a3f73652dc05f756362b2447c2" name="tests/bson/bson-toCanonicalJSON_error-001.phpt" role="test" />
<file md5sum="e43ad22bbd940468212c5f138deedc2b" name="tests/bson/bson-toCanonicalJSON_error-002.phpt" role="test" />
<file md5sum="44685227625e78d0cc329a9c7f6e9c50" name="tests/bson/bson-toCanonicalJSON_error-003.phpt" role="test" />
<file md5sum="b3c4355b7d9dc5f2bd5897262e7f6072" name="tests/bson/bson-toJSON-001.phpt" role="test" />
<file md5sum="85790d6c33597dbc5185a551a6683141" name="tests/bson/bson-toJSON-002.phpt" role="test" />
<file md5sum="0a2207ba503d14dd271697e38ff60cbe" name="tests/bson/bson-toJSON_error-001.phpt" role="test" />
<file md5sum="9ddc7084c84ee21a184dc666a023049d" name="tests/bson/bson-toJSON_error-002.phpt" role="test" />
<file md5sum="177c53c68054489653d433bf0143a15e" name="tests/bson/bson-toJSON_error-003.phpt" role="test" />
<file md5sum="852eed0a106c82c454a8b567e01018bc" name="tests/bson/bson-toPHP-001.phpt" role="test" />
<file md5sum="2eb4b1aa39d8e6029fe79a7d87cb1101" name="tests/bson/bson-toPHP-002.phpt" role="test" />
<file md5sum="196ffa4a0c9763794b77551fc1114f79" name="tests/bson/bson-toPHP-003.phpt" role="test" />
<file md5sum="ee0bf59df01713d93b9efcc51b3a5edd" name="tests/bson/bson-toPHP-004.phpt" role="test" />
<file md5sum="4ccc17d46eda70ad34118644e960f18a" name="tests/bson/bson-toPHP-006.phpt" role="test" />
<file md5sum="a0b49d8b87a293efe7aa38950455b894" name="tests/bson/bson-toPHP-007.phpt" role="test" />
<file md5sum="ee6e525749af76f2ae9c761385ab330a" name="tests/bson/bson-toPHP-008.phpt" role="test" />
<file md5sum="6133bbf84603ad85a47a0c12990fc18e" name="tests/bson/bson-toPHP-009.phpt" role="test" />
<file md5sum="0f876fb762849183f99bf566dc0ac541" name="tests/bson/bson-toPHP-010.phpt" role="test" />
<file md5sum="021c453d17946caa7884add32eaef589" name="tests/bson/bson-toPHP-011.phpt" role="test" />
<file md5sum="365a4c9626dec315f8eddf0140c5b2e2" name="tests/bson/bson-toPHP_error-001.phpt" role="test" />
<file md5sum="7d296259645fb541f47952e8d528eba7" 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="ce74e8344d7e39ed56440643690aba00" name="tests/bson/bson-toPHP_error-004.phpt" role="test" />
<file md5sum="81f3916c20e89abdd32906b543a343ef" name="tests/bson/bson-toPHP_error-005.phpt" role="test" />
<file md5sum="70da79d6ebc4f973f5a39740c46d1530" name="tests/bson/bson-toPHP_error-006.phpt" role="test" />
<file md5sum="a9e58db0748ac3208b802941b30a389e" name="tests/bson/bson-toRelaxedJSON-001.phpt" role="test" />
<file md5sum="403af2cffe3eec241affea1737dd93f0" name="tests/bson/bson-toRelaxedJSON-002.phpt" role="test" />
<file md5sum="6a318442df977699b54c48460d713f4e" name="tests/bson/bson-toRelaxedJSON_error-001.phpt" role="test" />
<file md5sum="0d5c5385c5e6e52c3551503ad33cf19c" name="tests/bson/bson-toRelaxedJSON_error-002.phpt" role="test" />
<file md5sum="7bdb79435458303d103ea1f55c6fe7ad" name="tests/bson/bson-toRelaxedJSON_error-003.phpt" role="test" />
<file md5sum="f598ba4224ca96027f18c20bcf037b19" name="tests/bson/bson-undefined-001.phpt" role="test" />
<file md5sum="99d067198e5658f553c210a3785148b2" name="tests/bson/bson-undefined-clone-001.phpt" role="test" />
<file md5sum="dc74e078f67345758dbb837e9d1f0f6e" name="tests/bson/bson-undefined-compare-001.phpt" role="test" />
<file md5sum="286eaff5b548beb827ac4e7641bf0cf8" name="tests/bson/bson-undefined-jsonserialize-001.phpt" role="test" />
<file md5sum="afa7092fad05aa85063b74c4761670c1" name="tests/bson/bson-undefined-jsonserialize-002.phpt" role="test" />
<file md5sum="e48cf56855e1cb5778de9be4afb9db70" name="tests/bson/bson-undefined-serialization-001.phpt" role="test" />
<file md5sum="efc4ba473c747b5b0dc5b5ac7fbeb8c4" name="tests/bson/bson-undefined-tostring-001.phpt" role="test" />
<file md5sum="16fc8af65414cc3910a0d05478fbfeca" name="tests/bson/bson-undefined_error-001.phpt" role="test" />
<file md5sum="bb1d4baf6117f3219afe0f2dfafb6437" name="tests/bson/bson-unknown-001.phpt" role="test" />
<file md5sum="28b1517c06aad34ce7dd88be5aa80846" 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="982f7f8d65d0f7f222f9b2512786dc4c" name="tests/bson/bson-utcdatetime-006.phpt" role="test" />
<file md5sum="322715ac6f412974a9dacb1dc7a1ebc9" name="tests/bson/bson-utcdatetime-007.phpt" role="test" />
<file md5sum="d254384c4d47ea4242c61ded0e391d66" name="tests/bson/bson-utcdatetime-clone-001.phpt" role="test" />
<file md5sum="6728e628d6cd1def65b21b5d58c477b4" name="tests/bson/bson-utcdatetime-compare-001.phpt" role="test" />
<file md5sum="8272da2bda9a4289184e655f6822550c" name="tests/bson/bson-utcdatetime-get_properties-001.phpt" role="test" />
<file md5sum="334df91a905a2ca36f77b385271e77ab" name="tests/bson/bson-utcdatetime-get_properties-002.phpt" role="test" />
<file md5sum="87a0dfcedd4205a3da922c2f10a05e7e" name="tests/bson/bson-utcdatetime-int-size-001.phpt" role="test" />
<file md5sum="56191c433baac3e51c249dec24a34a5e" 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="1b9dd88668a06f402a8567d13d47dea7" 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="71574612145585e471c5777f97b4721e" 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="af38799ce8a8fdd05b703ba3c2a6f77d" name="tests/bson/bson-utcdatetime_error-004.phpt" role="test" />
<file md5sum="a67824badfe3e9a6cfb5aea0577edaad" name="tests/bson/bson-utcdatetimeinterface-001.phpt" role="test" />
<file md5sum="74978df74e164c08a7e98b2b00a850a6" name="tests/bson/bug0274.phpt" role="test" />
<file md5sum="9a2d16556ac49c2fa06a8dc043e45c47" 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="a65cb3e46f03654beb1cf483341abcea" name="tests/bson/bug0341.phpt" role="test" />
<file md5sum="4066bd0654a8969c42d6313aa8dca106" name="tests/bson/bug0347.phpt" role="test" />
<file md5sum="2888441736b763719632b0c3ab4d4288" name="tests/bson/bug0528.phpt" role="test" />
<file md5sum="f3533e9c7ff66e5288f9261921b01dba" name="tests/bson/bug0531-001.phpt" role="test" />
<file md5sum="98df395abbaf09fe313a1ccc6d5ed0a2" name="tests/bson/bug0544.phpt" role="test" />
<file md5sum="31d39a3e234f3a74213c42121098e6f4" name="tests/bson/bug0592.phpt" role="test" />
<file md5sum="a07657032dc64d3586c3a87c62edcc9c" name="tests/bson/bug0623.phpt" role="test" />
<file md5sum="e71fb1adaa9a59504527a072b8f0e971" name="tests/bson/bug0631.phpt" role="test" />
<file md5sum="3c0b0a89a373da7ef34ff8bd72a81b59" name="tests/bson/bug0672.phpt" role="test" />
<file md5sum="9264b5948771b436ed31cf559ade001a" 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="ebc9dd229bc5c7091808835c1dfa2b7c" name="tests/bson/bug0939-001.phpt" role="test" />
+ <file md5sum="455a94f4f8a0ff8fd27e52d96438fd59" name="tests/bson/bug0939-001.phpt" role="test" />
<file md5sum="6b3b90dfccbbd0107ef9233270f80ad7" name="tests/bson/bug0974-001.phpt" role="test" />
<file md5sum="99a8ae579b019a928d9a0885c2a1a85d" name="tests/bson/bug1006-001.phpt" role="test" />
<file md5sum="e352907224c2510f5b7c8bbebba323a3" name="tests/bson/bug1006-002.phpt" role="test" />
<file md5sum="22c30ca9d73e86406d2d6f74861366b7" name="tests/bson/bug1053.phpt" role="test" />
<file md5sum="b32de2d6a5a540a853ad9ae92b466e63" name="tests/bson/bug1067.phpt" role="test" />
<file md5sum="6e4cd77ba6ba82ebf68c6a366733094e" name="tests/bson/bug1266.phpt" role="test" />
<file md5sum="2cf98072672acfd21d0da25bad891ac6" name="tests/bson/bug1598-001.phpt" role="test" />
<file md5sum="14399bc891511ef249b27b2a377e7319" name="tests/bson/bug1598-002.phpt" role="test" />
<file md5sum="b5dddc9aa831f655bd6b3f948d469d9f" name="tests/bson/typemap-001.phpt" role="test" />
<file md5sum="265a8a0020cfa67f4b100d782e018821" name="tests/bson/typemap-002.phpt" role="test" />
<file md5sum="37cff187fd6fd685320304087a72b4c9" name="tests/bson/typemap-003.phpt" role="test" />
<file md5sum="2fc8da280efe2f7a6719a86c9f80b273" name="tests/bson/typemap-004.phpt" role="test" />
<file md5sum="dae81cf2389ecd32be4343cb445df533" name="tests/bson/typemap-005.phpt" role="test" />
<file md5sum="cbc87188adb0e9671a028a23b99ade23" name="tests/bson/typemap-006.phpt" role="test" />
<file md5sum="0fac0215f1a7d97e619aef2bf974c18e" name="tests/bson/typemap-007.phpt" role="test" />
<file md5sum="55f4be2106b3f9222216570cb4e53df8" name="tests/bulk/bug0667.phpt" role="test" />
<file md5sum="e64d115fba82e356ad50e008520a491f" name="tests/bulk/bulkwrite-count-001.phpt" role="test" />
<file md5sum="0a96053f6e2e81ba25f21c62ab6512fa" name="tests/bulk/bulkwrite-countable-001.phpt" role="test" />
- <file md5sum="a47d92a55b6eb204c1de84d6d5f239b1" name="tests/bulk/bulkwrite-debug-001.phpt" role="test" />
+ <file md5sum="d82fab930893ce11122510d6f27380c3" name="tests/bulk/bulkwrite-debug-001.phpt" role="test" />
+ <file md5sum="8857bf10bf52ec20596f6b2e0d7b3869" name="tests/bulk/bulkwrite-debug-002.phpt" role="test" />
<file md5sum="9689a2f68b62e23bc88cad87154f8912" name="tests/bulk/bulkwrite-delete-001.phpt" role="test" />
<file md5sum="da2e239725bacb438803aaabcb719dc4" name="tests/bulk/bulkwrite-delete-002.phpt" role="test" />
<file md5sum="e07f420ce5e7461ecf81bb60d7447943" name="tests/bulk/bulkwrite-delete_error-001.phpt" role="test" />
<file md5sum="2133bfa253805676feebf8b31b6488d4" name="tests/bulk/bulkwrite-delete_error-002.phpt" role="test" />
<file md5sum="2b697d8fc672fa4805bd218596d6839f" name="tests/bulk/bulkwrite-delete_error-003.phpt" role="test" />
<file md5sum="bea544612dcafa65a6c84720ceb27835" name="tests/bulk/bulkwrite-delete_error-004.phpt" role="test" />
<file md5sum="984a979319b95deb972e9c8b1fa66f09" name="tests/bulk/bulkwrite-delete_error-005.phpt" role="test" />
<file md5sum="2f31966f55b8d5f3140c3782d9c4578a" name="tests/bulk/bulkwrite-insert-001.phpt" role="test" />
<file md5sum="ca45e311267cfea1113089a50fb3e04a" name="tests/bulk/bulkwrite-insert-004.phpt" role="test" />
<file md5sum="68bcb0c4b874d1811af6e2c61f617b2a" name="tests/bulk/bulkwrite-insert_error-001.phpt" role="test" />
<file md5sum="886ba3ce266bbcd113232102b279a94c" name="tests/bulk/bulkwrite-insert_error-002.phpt" role="test" />
<file md5sum="371b44e7e9d22b7e74af719efdf39055" name="tests/bulk/bulkwrite-insert_error-003.phpt" role="test" />
<file md5sum="6eead56305c7efe949257787c48d13ff" name="tests/bulk/bulkwrite-update-001.phpt" role="test" />
<file md5sum="1ee69820fd6409210a1c9b15aa8b9bda" name="tests/bulk/bulkwrite-update-002.phpt" role="test" />
<file md5sum="09cd3b0145171df68d665a0bb798b4b9" name="tests/bulk/bulkwrite-update-003.phpt" role="test" />
<file md5sum="7ae783892615695e8c8f20739d089400" name="tests/bulk/bulkwrite-update-004.phpt" role="test" />
<file md5sum="bac4712bf1be74448b06b24fd19b14c1" name="tests/bulk/bulkwrite-update_error-001.phpt" role="test" />
<file md5sum="ad132ab85eaf886f513e0a378b095056" name="tests/bulk/bulkwrite-update_error-002.phpt" role="test" />
<file md5sum="0a7d9b81f777ee493aea7b2032e1701a" name="tests/bulk/bulkwrite-update_error-003.phpt" role="test" />
<file md5sum="6fca01de682f0aefeaa62cd2b8c6c840" name="tests/bulk/bulkwrite-update_error-004.phpt" role="test" />
<file md5sum="79f2ddb11b24ed4982a42ae45a824888" name="tests/bulk/bulkwrite-update_error-005.phpt" role="test" />
<file md5sum="876f91f66ea9eb35065748e11baf1b11" name="tests/bulk/bulkwrite-update_error-006.phpt" role="test" />
<file md5sum="3cabc5ebfa8cb23fc2b41b91ea752d44" name="tests/bulk/bulkwrite-update_error-007.phpt" role="test" />
<file md5sum="48826e05adbbce2e2c9c6810890141d9" name="tests/bulk/bulkwrite-update_error-008.phpt" role="test" />
<file md5sum="c117f84081a29441f2df90bf68b36308" name="tests/bulk/bulkwrite_error-001.phpt" role="test" />
<file md5sum="3c06f753a692d3a7dbfe22a1e8aaa697" name="tests/bulk/bulkwrite_error-002.phpt" role="test" />
- <file md5sum="5701ee82e28b2d1a30c5737744014ee9" name="tests/bulk/write-0001.phpt" role="test" />
- <file md5sum="1773338cd648c0370249748964a6c751" name="tests/bulk/write-0002.phpt" role="test" />
+ <file md5sum="bfb4b8860af692b23140bfe55176fbb9" name="tests/bulk/write-0001.phpt" role="test" />
+ <file md5sum="29d049385003eafc51f35c6040b93988" name="tests/bulk/write-0002.phpt" role="test" />
<file md5sum="901a76b67b727866c0ee7797468000a4" name="tests/causal-consistency/causal-consistency-001.phpt" role="test" />
<file md5sum="0db8fc24fbf4581335bf9906c9e639ad" name="tests/causal-consistency/causal-consistency-002.phpt" role="test" />
<file md5sum="acc424159afbf9abd819e6f4b3dc1cb9" name="tests/causal-consistency/causal-consistency-003.phpt" role="test" />
<file md5sum="bc9d7634f7ba40dece6b9eb5fcf8e6df" name="tests/causal-consistency/causal-consistency-004.phpt" role="test" />
<file md5sum="4a49856d3dab5e3459e776f4c033cc5d" name="tests/causal-consistency/causal-consistency-005.phpt" role="test" />
<file md5sum="5d924415516a9f4b80744494f77a33e1" name="tests/causal-consistency/causal-consistency-006.phpt" role="test" />
<file md5sum="5945124d0f7050059f05f703cc01942a" name="tests/causal-consistency/causal-consistency-007.phpt" role="test" />
<file md5sum="62769bf3d23ad4930c8b07eaa863fa84" name="tests/causal-consistency/causal-consistency-008.phpt" role="test" />
<file md5sum="0a4e806029bc07f088185ec716194deb" name="tests/causal-consistency/causal-consistency-009.phpt" role="test" />
<file md5sum="7caa537c84e59dbdf0ceff238530a1e6" name="tests/causal-consistency/causal-consistency-010.phpt" role="test" />
<file md5sum="4a16403162937ca8f6661599ec7ea191" name="tests/causal-consistency/causal-consistency-011.phpt" role="test" />
<file md5sum="366cfeafbe04d6e914dcd3302e0e05c3" name="tests/causal-consistency/causal-consistency-012.phpt" role="test" />
<file md5sum="f4f472cc8b013465c3fbb600ceaecc53" name="tests/clientEncryption/clientEncryption-constants.phpt" role="test" />
<file md5sum="2a43f19c7a0a438a0e8676b39f0edd5d" name="tests/clientEncryption/clientEncryption-createDataKey-001.phpt" role="test" />
<file md5sum="af475caa7ace9d5b5c95327412707ebe" name="tests/clientEncryption/clientEncryption-createDataKey_error-001.phpt" role="test" />
<file md5sum="2b11e1c7c28c96aa6f19761e139a1ef5" name="tests/clientEncryption/clientEncryption-decrypt-001.phpt" role="test" />
<file md5sum="057fab341de20c8057ee1b5063d8c5f6" name="tests/clientEncryption/clientEncryption-encrypt-001.phpt" role="test" />
<file md5sum="2fcc843a96b5a7017f141ea4eaef601d" name="tests/command/command-ctor-001.phpt" role="test" />
<file md5sum="1a71256d8141d7150c3efbb97e1a524a" name="tests/command/command_error-001.phpt" role="test" />
<file md5sum="0cccef5075f48d56e22cd86580093dbf" name="tests/command/cursor-batchsize-001.phpt" role="test" />
<file md5sum="f7a7fe65cf10a5360ca3a2d3a234f0c5" name="tests/command/cursor-batchsize-002.phpt" role="test" />
<file md5sum="60324bb545475e5d6f1a288085af6b24" name="tests/command/cursor-tailable-001.phpt" role="test" />
<file md5sum="f14cf22ea8f75cc0800a7cc080caed71" name="tests/command/findAndModify-001.phpt" role="test" />
<file md5sum="b2f0e323e8823b98306884f398a159be" name="tests/command/update-001.phpt" role="test" />
<file md5sum="fedfd02407ffbe2825b612aa84e84562" name="tests/connect/bug0720.phpt" role="test" />
<file md5sum="8c1dd350b0bcf69173885a169ded376f" name="tests/connect/bug1015.phpt" role="test" />
<file md5sum="6e4ba6c6e30d836b9495f200dd5ab3c7" name="tests/connect/bug1045.phpt" role="test" />
<file md5sum="d3e2b9f04909791abbd6bafba559896a" name="tests/connect/compression_error-001.phpt" role="test" />
<file md5sum="f94f489e2c3d2e51d39a057b8215616a" name="tests/connect/compression_error-002.phpt" role="test" />
<file md5sum="09cadd7b529ac15592d48c72aa33828b" name="tests/connect/replicaset-seedlist-001.phpt" role="test" />
<file md5sum="bda55d6aae7f3fbee4a1914b4ef0738f" name="tests/connect/replicaset-seedlist-002.phpt" role="test" />
<file md5sum="26a61cb56c97cd8427510647db36fd95" name="tests/connect/standalone-auth-001.phpt" role="test" />
<file md5sum="123a6ec334879b549877a8330bd632fe" name="tests/connect/standalone-auth_error-001.phpt" role="test" />
<file md5sum="f26f328b141d13db8c11ff637f64c432" name="tests/connect/standalone-plain-0001.phpt" role="test" />
<file md5sum="298d127e2589ac4a31d05ad1863466a2" name="tests/connect/standalone-plain-0002.phpt" role="test" />
<file md5sum="cfda03907f75ad8e518d55618162126c" name="tests/connect/standalone-ssl-no_verify-001.phpt" role="test" />
<file md5sum="3093aeb28dfc5873a97ace15d9d5e3d1" name="tests/connect/standalone-ssl-no_verify-002.phpt" role="test" />
<file md5sum="6d522fea1bfa02e93238078690a205fb" name="tests/connect/standalone-ssl-verify_cert-001.phpt" role="test" />
<file md5sum="f9c9becc920540043433aa090b537a44" name="tests/connect/standalone-ssl-verify_cert-002.phpt" role="test" />
<file md5sum="c863b3ba18aeb7675e8a2bd6dd5e2b22" name="tests/connect/standalone-ssl-verify_cert-error-001.phpt" role="test" />
<file md5sum="e7934eee9e58b70c85e1e03a996e9ab4" name="tests/connect/standalone-ssl-verify_cert-error-002.phpt" role="test" />
<file md5sum="d67dded952b5f36db36d003a13f61190" name="tests/connect/standalone-x509-auth-001.phpt" role="test" />
<file md5sum="ebe16753709665720793e887cdbe531c" name="tests/connect/standalone-x509-auth-002.phpt" role="test" />
<file md5sum="fd5baf924fc715cd7f2c1c77415c5077" name="tests/connect/standalone-x509-error-0001.phpt" role="test" />
<file md5sum="69179c043fbbff16bc7427f854cc4c93" name="tests/connect/standalone-x509-extract_username-001.phpt" role="test" />
<file md5sum="24f8c393372a78faf418ead494cf7642" name="tests/connect/standalone-x509-extract_username-002.phpt" role="test" />
<file md5sum="4b3ec023465d6f599dc6812e26f16ad2" name="tests/cursor/bug0671-001.phpt" role="test" />
<file md5sum="524244d50b3588736868d9d2f135ab33" name="tests/cursor/bug0732-001.phpt" role="test" />
<file md5sum="bbe3fa4ce74ef94ad5e9aca6dc351a6f" name="tests/cursor/bug0849-001.phpt" role="test" />
<file md5sum="56c27d634fe1a1d97be99671624f25f6" name="tests/cursor/bug0924-001.phpt" role="test" />
<file md5sum="eec44586301a9b8cd083fd8701925732" name="tests/cursor/bug0924-002.phpt" role="test" />
- <file md5sum="8e2e22ab7f136805e6605c6ccbf8b9f7" name="tests/cursor/bug1050-001.phpt" role="test" />
- <file md5sum="876563d42d69bd3ff8153cc17227f707" name="tests/cursor/bug1050-002.phpt" role="test" />
+ <file md5sum="8549d6f9d1e8fd368c5e4a0e95839f7a" name="tests/cursor/bug1050-001.phpt" role="test" />
+ <file md5sum="718f2525a82397b1ac59765c2b8fa75e" name="tests/cursor/bug1050-002.phpt" role="test" />
<file md5sum="474ef5823553b4484818d5bfd5cd21fa" name="tests/cursor/bug1151-001.phpt" role="test" />
<file md5sum="51ad1108e7a66e00267ef09991c5724a" name="tests/cursor/bug1151-002.phpt" role="test" />
<file md5sum="5ff240192903529edc723f6a58524ce7" name="tests/cursor/bug1151-003.phpt" role="test" />
<file md5sum="1db156ec62b98f4ed41815b8bf8ffbd9" name="tests/cursor/bug1151-004.phpt" role="test" />
<file md5sum="23feaaa3649e8ffbe642fde83f565f3f" name="tests/cursor/bug1152-001.phpt" role="test" />
<file md5sum="2320a6aa115b05ffc94bc03c3d80a80e" name="tests/cursor/bug1152-002.phpt" role="test" />
<file md5sum="eceedecd3662d1e1ca8004b07d9153df" name="tests/cursor/bug1162-001.phpt" role="test" />
<file md5sum="dc520ea2df1b82313c24a0d6f268dd47" name="tests/cursor/bug1274-001.phpt" role="test" />
<file md5sum="c3a2e319e6c79251918a8da4c3003280" name="tests/cursor/bug1274-002.phpt" role="test" />
<file md5sum="4a2e018800cf0cdfa7a48efd7ba422dc" name="tests/cursor/bug1274-003.phpt" role="test" />
<file md5sum="a65a7ac32a7e8f13ffefa43beef84b60" name="tests/cursor/bug1419-001.phpt" role="test" />
<file md5sum="03bc65d514988acceecd8b830c41f152" name="tests/cursor/cursor-001.phpt" role="test" />
<file md5sum="7c0410ba5a6e41fe743d9982cd6d02e0" name="tests/cursor/cursor-IteratorIterator-001.phpt" role="test" />
<file md5sum="bb0d309916633938dfa05d9f3af864da" name="tests/cursor/cursor-IteratorIterator-002.phpt" role="test" />
<file md5sum="0ed7eec3383fbae9cf671561b26899bd" name="tests/cursor/cursor-IteratorIterator-003.phpt" role="test" />
<file md5sum="7fba13f507848315e8e6e254e900ca24" name="tests/cursor/cursor-IteratorIterator-004.phpt" role="test" />
<file md5sum="9efe615e5928c3309c668f022239474e" name="tests/cursor/cursor-NoRewindIterator-001.phpt" role="test" />
<file md5sum="939767ddea3315dd68cbc737fb4941f1" name="tests/cursor/cursor-destruct-001.phpt" role="test" />
- <file md5sum="c229b405181889a015f169b6e43692e2" name="tests/cursor/cursor-get_iterator-001.phpt" role="test" />
- <file md5sum="0c5bcf30b509cbd02ec40b08a05728bd" name="tests/cursor/cursor-get_iterator-002.phpt" role="test" />
- <file md5sum="6b23937a3d2036d340d57a0d020b4619" name="tests/cursor/cursor-get_iterator-003.phpt" role="test" />
<file md5sum="5aa3b3c35507a9ab338f04e825c4f477" name="tests/cursor/cursor-getmore-001.phpt" role="test" />
<file md5sum="70b15d8f85e88d8347daa29e77b0a44e" name="tests/cursor/cursor-getmore-002.phpt" role="test" />
<file md5sum="7ce1dd001788a037780a27751f6e6316" name="tests/cursor/cursor-getmore-003.phpt" role="test" />
<file md5sum="d2634f26a6137197255118f5f7d9b110" name="tests/cursor/cursor-getmore-004.phpt" role="test" />
<file md5sum="3223830f882a253d05b2d7a0b3c71e9a" name="tests/cursor/cursor-getmore-005.phpt" role="test" />
<file md5sum="0d455054f75e9b7a6304688ef38792b9" name="tests/cursor/cursor-getmore-006.phpt" role="test" />
<file md5sum="c23542434327940c5c6d0355873c2070" name="tests/cursor/cursor-getmore-007.phpt" role="test" />
<file md5sum="bc396ff3c3029772f445eb8b7da637e8" name="tests/cursor/cursor-getmore-008.phpt" role="test" />
<file md5sum="db16c429ebdb76d3b753f0ae5bb7fd83" name="tests/cursor/cursor-isDead-001.phpt" role="test" />
<file md5sum="c7ca93a7828140200b4a04015a687104" name="tests/cursor/cursor-isDead-002.phpt" role="test" />
<file md5sum="035a777de95a979b6d7c2073e3733198" name="tests/cursor/cursor-isDead-003.phpt" role="test" />
<file md5sum="0e1be952d398b2d171bd06dae306c78f" name="tests/cursor/cursor-isDead-004.phpt" role="test" />
+ <file md5sum="06fc3e896b5bf1bd0cc29a930b31edde" name="tests/cursor/cursor-iterator-001.phpt" role="test" />
+ <file md5sum="44e3dd5db63b984d1b5520420f08bd57" name="tests/cursor/cursor-iterator-002.phpt" role="test" />
<file md5sum="fc0bd8479123c749a38ef0adcbebf3de" name="tests/cursor/cursor-iterator_handlers-001.phpt" role="test" />
<file md5sum="eb64a093d4088a07f989fb0e91322073" name="tests/cursor/cursor-rewind-001.phpt" role="test" />
<file md5sum="36e439ec289e714153e9ff58beaefd00" name="tests/cursor/cursor-session-001.phpt" role="test" />
<file md5sum="fcd89096cff4d61e660f598711aaf99d" name="tests/cursor/cursor-session-002.phpt" role="test" />
<file md5sum="1cb4aee3dd92582dde10f6cf55090161" name="tests/cursor/cursor-session-003.phpt" role="test" />
<file md5sum="40d880c42f27636bc1682bf02a654798" name="tests/cursor/cursor-session-004.phpt" role="test" />
<file md5sum="3cdc16f34a7e79dd63b192a3245349d5" name="tests/cursor/cursor-setTypeMap_error-001.phpt" role="test" />
<file md5sum="bd71fa980d79b8c89ea4af9a363c9f82" name="tests/cursor/cursor-setTypeMap_error-002.phpt" role="test" />
<file md5sum="d4fdb84e9efd4d8853cb8a8e9c25b541" name="tests/cursor/cursor-setTypeMap_error-003.phpt" role="test" />
<file md5sum="883cdb6d9684d4f4a75778d8aa641875" name="tests/cursor/cursor-setTypeMap_error-004.phpt" role="test" />
<file md5sum="a13fe8aa5f454d3c9a84b0f3b1238c1e" name="tests/cursor/cursor-tailable-001.phpt" role="test" />
<file md5sum="4798d1df7ac09fde475b9551d5d6cdba" name="tests/cursor/cursor-tailable-002.phpt" role="test" />
<file md5sum="219b719f4a6b5a00d25bbbba851718d2" name="tests/cursor/cursor-tailable-003.phpt" role="test" />
<file md5sum="df7250832938a3a7204d59688552d590" name="tests/cursor/cursor-tailable_error-001.phpt" role="test" />
<file md5sum="8b85e4c9583b80963a1a7739448698a5" name="tests/cursor/cursor-tailable_error-002.phpt" role="test" />
<file md5sum="41f0d76fe5c1d5bf7ed874a5aed1a36b" name="tests/cursor/cursor-toArray-001.phpt" role="test" />
<file md5sum="52f7368b650deecf36d6f782f9d66534" name="tests/cursor/cursor-toArray-002.phpt" role="test" />
<file md5sum="98ab429a6b6a19ea5848c83119784a3b" name="tests/cursor/cursor_error-001.phpt" role="test" />
<file md5sum="44738ce88a60fbb2fa2a1a7a426e5c2c" name="tests/cursor/cursorinterface-001.phpt" role="test" />
<file md5sum="d35e1eff5ad7b32efb76838dd4345d0e" name="tests/cursor/cursorinterface-002.phpt" role="test" />
+ <file md5sum="edc4273b932edaa535af383ec047ad31" name="tests/cursor/cursorinterface-003.phpt" role="test" />
<file md5sum="d79faab763a82a123c7ee9affb0321f3" name="tests/cursorid/cursorid-001.phpt" role="test" />
<file md5sum="e1c6552db05d0f32390dab6953a63399" name="tests/cursorid/cursorid-002.phpt" role="test" />
<file md5sum="754d7f2c950a695011824b6d48ad6bdc" name="tests/cursorid/cursorid-serialization-001.phpt" role="test" />
<file md5sum="c72707601edf6dd9e41b2c67b05d92ae" name="tests/cursorid/cursorid_error-001.phpt" role="test" />
<file md5sum="e9d41f8bd860cf7bc7aecf888a6e5f03" name="tests/exception/bulkwriteexception-getwriteresult-001.phpt" role="test" />
<file md5sum="0c742d44e6e7d6cc44043ff7c7d52dfd" name="tests/exception/bulkwriteexception-haserrorlabel-001.phpt" role="test" />
<file md5sum="559013f8d14f022aa69821f0b96fc21d" name="tests/exception/bulkwriteexception-haserrorlabel-002.phpt" role="test" />
<file md5sum="9affde6e5226e248967e3ee33a5feef0" name="tests/exception/bulkwriteexception-haserrorlabel_error-001.phpt" role="test" />
<file md5sum="9b577a17a9a125ab32ad48010d3b7909" name="tests/exception/commandexception-getresultdocument-001.phpt" role="test" />
<file md5sum="f517ae8a8ad62e3fa2fe69d282367ea4" name="tests/exception/commandexception-haserrorlabel-001.phpt" role="test" />
<file md5sum="69b64eec21ec54c479dfe557269598ab" name="tests/exception/commandexception-haserrorlabel_error-001.phpt" role="test" />
<file md5sum="6bcc1ed27df3ddbe16f549c82803d0cf" name="tests/exception/exception-001.phpt" role="test" />
<file md5sum="0f64ba7a9c355b2ee9a30d5f3f2241b8" name="tests/exception/runtimeexception-haserrorlabel-001.phpt" role="test" />
<file md5sum="98fe8f2b6fc815b91199a9d9fb9320f3" name="tests/exception/runtimeexception-haserrorlabel_error-001.phpt" role="test" />
<file md5sum="3dd7d094e945216ab896611686cf15e9" name="tests/functional/cursor-001.phpt" role="test" />
<file md5sum="4ffb80e523858bcb53cc938fe4e9f0d5" name="tests/functional/cursorid-001.phpt" role="test" />
<file md5sum="cf458375411ca8026f40990bcca820fe" name="tests/functional/phpinfo-1.phpt" role="test" />
<file md5sum="d77ed62417811ccf6d2d7feb0972bfc3" name="tests/functional/phpinfo-2.phpt" role="test" />
<file md5sum="27cf53aba7bbf1e22c32fb6b691c048d" name="tests/functional/query-sort-001.phpt" role="test" />
<file md5sum="b4a504f5f5be61568c645e307cfba097" name="tests/functional/query-sort-002.phpt" role="test" />
<file md5sum="b2cfb45cfca7ef52c97823c088cfa470" name="tests/functional/query-sort-003.phpt" role="test" />
<file md5sum="590e9fc57ad23f3b22c80017ae44c470" name="tests/functional/query-sort-004.phpt" role="test" />
<file md5sum="c1195325dce8f3e5fed51fa4cca7939a" name="tests/manager/bug0572.phpt" role="test" />
<file md5sum="f0346e6cd2ba9520eef5021167879c4e" name="tests/manager/bug0851-001.phpt" role="test" />
<file md5sum="d5af337dd2aa7220b61b71deacb2a0ef" name="tests/manager/bug0851-002.phpt" role="test" />
<file md5sum="36ca061b4e0eef92165a1150909f5293" name="tests/manager/bug0912-001.phpt" role="test" />
<file md5sum="28f893fc2a6942725c70ec36c4a4f066" name="tests/manager/bug0913-001.phpt" role="test" />
<file md5sum="581f3f676bb14c8f81e76890e69864f4" name="tests/manager/bug0940-001.phpt" role="test" />
<file md5sum="4a8161bfdfd6cc6611c33d7c22323e35" name="tests/manager/bug0940-002.phpt" role="test" />
<file md5sum="0772851b9d33b0cf98ca7574a9c9c8cf" name="tests/manager/bug1163-001.phpt" role="test" />
+ <file md5sum="ded65c482e65428ed27cb5843d0d986f" name="tests/manager/bug1701-001.phpt" role="test" />
<file md5sum="2787ed29d23447eead4f2e5b5fcbf3f5" name="tests/manager/manager-createClientEncryption-001.phpt" role="test" />
<file md5sum="8da08fb4b7677bf2029f7c304ef52901" name="tests/manager/manager-createClientEncryption-error-001.phpt" role="test" />
<file md5sum="32c86b6d904954e456d28eb593565877" name="tests/manager/manager-createClientEncryption-error-002.phpt" role="test" />
<file md5sum="d582d6ff744cdbf6f65a37e63faac924" name="tests/manager/manager-ctor-001.phpt" role="test" />
<file md5sum="ddb6ad56c0bddfdcddc28eac459c2ec7" name="tests/manager/manager-ctor-002.phpt" role="test" />
<file md5sum="bf482d24f1467be19b603557a6cb8e6c" name="tests/manager/manager-ctor-003.phpt" role="test" />
<file md5sum="cd62592a5c1c3b6c855b698735a1b9eb" name="tests/manager/manager-ctor-004.phpt" role="test" />
<file md5sum="fc9c0aeba95b987c080b27740bc4807f" name="tests/manager/manager-ctor-005.phpt" role="test" />
<file md5sum="1317f0fb54d0f321cb566484a347cfaf" name="tests/manager/manager-ctor-006.phpt" role="test" />
<file md5sum="9971491b14eee35b683cafca4df93f69" 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="0f29f362757476ecaa36f936d16a7c20" name="tests/manager/manager-ctor-auth_mechanism-001.phpt" role="test" />
<file md5sum="7e334d9c4f17adc4ec5be12d461207b6" name="tests/manager/manager-ctor-auth_mechanism-002.phpt" role="test" />
<file md5sum="90c734296f99cf087690ce5b3c971842" name="tests/manager/manager-ctor-auth_mechanism-error-001.phpt" role="test" />
<file md5sum="b36422d0897ec7f315fdb5f3391d7341" name="tests/manager/manager-ctor-auth_source-001.phpt" role="test" />
<file md5sum="85b83ea4ac48a57132906b006c01d8de" name="tests/manager/manager-ctor-auto_encryption-001.phpt" role="test" />
<file md5sum="e731e03841e0883f4ee751c7032513cf" name="tests/manager/manager-ctor-auto_encryption-error-001.phpt" role="test" />
<file md5sum="55231e67734f454c0d611e83e3eb223f" name="tests/manager/manager-ctor-auto_encryption-error-002.phpt" role="test" />
<file md5sum="765c62e3361c84850c07ab0ecf4022c4" name="tests/manager/manager-ctor-auto_encryption-error-003.phpt" role="test" />
<file md5sum="9097547b2339ca142d1c322666fd376d" name="tests/manager/manager-ctor-directconnection-001.phpt" role="test" />
<file md5sum="19d7f6abca6dd2cd228a14d469e16343" name="tests/manager/manager-ctor-directconnection-error-001.phpt" role="test" />
<file md5sum="cf82ac686119977b53c28c06884e74a2" name="tests/manager/manager-ctor-directconnection-error-002.phpt" role="test" />
<file md5sum="7914802b3c64e680dce7a36fb46fce50" name="tests/manager/manager-ctor-driver-metadata-001.phpt" role="test" />
<file md5sum="620dd66d04240a1cbfbc33373117085c" name="tests/manager/manager-ctor-duplicate-option-001.phpt" role="test" />
<file md5sum="9311bb62f8740436ef91ef7a0fe5c97a" name="tests/manager/manager-ctor-duplicate-option-002.phpt" role="test" />
<file md5sum="d6b52ffcafa9ceaf363ebdb07c10cc75" name="tests/manager/manager-ctor-duplicate-option-003.phpt" role="test" />
<file md5sum="7538039ec421e2ae634e91ba24999408" name="tests/manager/manager-ctor-duplicate-option-004.phpt" role="test" />
<file md5sum="ee7822e3b58b7abb5ccee0a87dc86e4d" name="tests/manager/manager-ctor-read_concern-001.phpt" role="test" />
<file md5sum="e0f1aac391b3a951064df7cae6234cb6" name="tests/manager/manager-ctor-read_concern-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="f79bc0bb4c539b3ca7d92289c5799928" name="tests/manager/manager-ctor-read_preference-004.phpt" role="test" />
<file md5sum="d34478e19a06621ab48134ad3e921cb5" name="tests/manager/manager-ctor-read_preference-error-001.phpt" role="test" />
<file md5sum="41eed52f397fb36e3fb504e9f56d7322" name="tests/manager/manager-ctor-read_preference-error-002.phpt" role="test" />
<file md5sum="33c909db248b8926649d82d481106abd" name="tests/manager/manager-ctor-read_preference-error-003.phpt" role="test" />
<file md5sum="cd42434868d062400d1acc99236c62a2" name="tests/manager/manager-ctor-read_preference-error-004.phpt" role="test" />
<file md5sum="d7708745e5025122ef406cd0782defee" name="tests/manager/manager-ctor-server.phpt" role="test" />
<file md5sum="0f5384a769df66ede31e0c1bcd91db3b" name="tests/manager/manager-ctor-ssl-001.phpt" role="test" />
<file md5sum="1fdfd08d1e55f063b61f2d885a761054" name="tests/manager/manager-ctor-ssl-002.phpt" role="test" />
<file md5sum="49e47e03ae62edbc4d1930a0f344f554" name="tests/manager/manager-ctor-ssl-003.phpt" role="test" />
<file md5sum="154a35441fb15f215da538454af5bc6d" name="tests/manager/manager-ctor-ssl-deprecated-001.phpt" role="test" />
<file md5sum="44edb9adf6690a82c276fd88671eb7b3" name="tests/manager/manager-ctor-ssl-deprecated-002.phpt" role="test" />
<file md5sum="fb412e73099879b0e80c876bcbfcc696" name="tests/manager/manager-ctor-tls-error-001.phpt" role="test" />
<file md5sum="ac19b3dbd632af113caa63ea3736e778" name="tests/manager/manager-ctor-wireversion.phpt" role="test" />
<file md5sum="f5f725515b3e0d3000a190ca90a48902" name="tests/manager/manager-ctor-write_concern-001.phpt" role="test" />
<file md5sum="f57f8e8063d723e1cd9e01a7e65cdcf6" name="tests/manager/manager-ctor-write_concern-002.phpt" role="test" />
<file md5sum="a795c0a05f3f14eee39dc899c6b8b353" name="tests/manager/manager-ctor-write_concern-003.phpt" role="test" />
<file md5sum="243320fdfc028f0156dab89e0a4111fd" name="tests/manager/manager-ctor-write_concern-004.phpt" role="test" />
<file md5sum="3082087d08245cfd506d8e9c065552eb" name="tests/manager/manager-ctor-write_concern-005.phpt" role="test" />
<file md5sum="19a3af22d908692a494ff19407488831" name="tests/manager/manager-ctor-write_concern-006.phpt" role="test" />
<file md5sum="930d34ab034a874b0d1bfdfb359f57a2" name="tests/manager/manager-ctor-write_concern-error-001.phpt" role="test" />
<file md5sum="961a3b93ec15395bf57bcc55c42af238" name="tests/manager/manager-ctor-write_concern-error-002.phpt" role="test" />
<file md5sum="ca05908ad81b3b535edd8da9a28227b4" name="tests/manager/manager-ctor-write_concern-error-003.phpt" role="test" />
<file md5sum="4ceba0f9bddd41670eafafcb2cdcf036" name="tests/manager/manager-ctor-write_concern-error-005.phpt" role="test" />
<file md5sum="d5375e39c52cfe38e226f28a72de528b" name="tests/manager/manager-ctor-write_concern-error-006.phpt" role="test" />
<file md5sum="327b953424cc1b3453185431059c50ff" name="tests/manager/manager-ctor-write_concern-error-007.phpt" role="test" />
- <file md5sum="dd2c31375156083cadd617d2f01a01cf" name="tests/manager/manager-ctor_error-001.phpt" role="test" />
+ <file md5sum="e807040598f0fad7dfb92b567853dd96" name="tests/manager/manager-ctor_error-001.phpt" role="test" />
<file md5sum="bc5dbc3dac6898f0ee0d6baccd0a7866" name="tests/manager/manager-ctor_error-002.phpt" role="test" />
<file md5sum="07074b4ac6d148d2c45fd2c6cf23f427" name="tests/manager/manager-ctor_error-003.phpt" role="test" />
<file md5sum="8e860028e777c320122fd32b8e674e4d" name="tests/manager/manager-ctor_error-004.phpt" role="test" />
<file md5sum="fe609749b9120c60524e70f35d434a16" name="tests/manager/manager-ctor_error-005.phpt" role="test" />
<file md5sum="be738dc790fc658a6ce32235b04b1d4b" name="tests/manager/manager-debug-001.phpt" role="test" />
<file md5sum="fed182f4305d260702f56990d7977c91" name="tests/manager/manager-debug-002.phpt" role="test" />
<file md5sum="b99cf3e782d7e1fba6a320e7815305f5" name="tests/manager/manager-debug-003.phpt" role="test" />
<file md5sum="be82f864c923bc9bff1156270aa6d4c4" name="tests/manager/manager-destruct-001.phpt" role="test" />
<file md5sum="37a4fd602a24f5a72289e451f192b492" name="tests/manager/manager-executeBulkWrite-001.phpt" role="test" />
<file md5sum="d02cd524c7f3bc05b51b7a2ccc778ea7" name="tests/manager/manager-executeBulkWrite-002.phpt" role="test" />
<file md5sum="4600431b5b3ad77bf8bceec091e5940f" name="tests/manager/manager-executeBulkWrite-003.phpt" role="test" />
<file md5sum="115cfabb0f82ccd4915ef27d57eba2c5" name="tests/manager/manager-executeBulkWrite-004.phpt" role="test" />
<file md5sum="193b327bd8996dca2f31780fcd00db02" name="tests/manager/manager-executeBulkWrite-005.phpt" role="test" />
<file md5sum="95879a94e1994a3166591ab8a9bdc0f8" name="tests/manager/manager-executeBulkWrite-006.phpt" role="test" />
<file md5sum="6ac99ac40f172cfe91bebb3b680d17fb" name="tests/manager/manager-executeBulkWrite-007.phpt" role="test" />
<file md5sum="99aab4ef28819e1ee25831b778306672" name="tests/manager/manager-executeBulkWrite-008.phpt" role="test" />
<file md5sum="ca20571d844c13b6715e29a9c2a3c56a" name="tests/manager/manager-executeBulkWrite-009.phpt" role="test" />
<file md5sum="5ab058d19d4282a2e40f2e93e07f8392" name="tests/manager/manager-executeBulkWrite-010.phpt" role="test" />
<file md5sum="f5594d4af26be91375b2b0c3359a9d99" name="tests/manager/manager-executeBulkWrite-011.phpt" role="test" />
<file md5sum="38bcd67bf01142405204cf785fa39a50" name="tests/manager/manager-executeBulkWrite-012.phpt" role="test" />
<file md5sum="f6888d16a579ba70fbc2699355d18d9f" name="tests/manager/manager-executeBulkWrite-013.phpt" role="test" />
+ <file md5sum="c061d3a8e185afcfaaac6c619e74f7a5" name="tests/manager/manager-executeBulkWrite-014.phpt" role="test" />
<file md5sum="50b50e510349d45121bb8693025c289b" name="tests/manager/manager-executeBulkWrite_error-001.phpt" role="test" />
<file md5sum="d432f702c365f82c27120254c5e9b240" name="tests/manager/manager-executeBulkWrite_error-002.phpt" role="test" />
<file md5sum="ad64ea876a6959cea64eb486feb556fa" name="tests/manager/manager-executeBulkWrite_error-003.phpt" role="test" />
<file md5sum="a6d4e1528ad9aee1f9d1870b8d854fd5" name="tests/manager/manager-executeBulkWrite_error-004.phpt" role="test" />
<file md5sum="5ff3bc58c098a387b12dd1f43642caa2" name="tests/manager/manager-executeBulkWrite_error-005.phpt" role="test" />
<file md5sum="2c180c572d2672f86d902952cc512339" name="tests/manager/manager-executeBulkWrite_error-006.phpt" role="test" />
<file md5sum="52db00924a47b5eaf3786570f1752e37" name="tests/manager/manager-executeBulkWrite_error-007.phpt" role="test" />
<file md5sum="76c87f395ccde1404e4d95d59c72daa2" name="tests/manager/manager-executeBulkWrite_error-008.phpt" role="test" />
<file md5sum="779777e6596fdf0ac60ef82cb456bdfe" name="tests/manager/manager-executeBulkWrite_error-009.phpt" role="test" />
<file md5sum="fda28235360691d16827ef93432069db" name="tests/manager/manager-executeBulkWrite_error-010.phpt" role="test" />
<file md5sum="f2cb4ea7930edd02193127d2e7ba906c" name="tests/manager/manager-executeBulkWrite_error-011.phpt" role="test" />
<file md5sum="aafb8b95f6c1bbd150bccb6dd7e3bc57" name="tests/manager/manager-executeCommand-001.phpt" role="test" />
<file md5sum="6dbcf61d66a0493d6d8df6bdd7578965" name="tests/manager/manager-executeCommand-002.phpt" role="test" />
<file md5sum="a7591fdbe2aa5ef921e1003927004968" name="tests/manager/manager-executeCommand-003.phpt" role="test" />
<file md5sum="41ce44fa9e3a2884805a6ffc25152ff5" name="tests/manager/manager-executeCommand-004.phpt" role="test" />
<file md5sum="5741b0a6160bcd5e02ec54644396e751" name="tests/manager/manager-executeCommand-005.phpt" role="test" />
<file md5sum="218be15aa69e000d88283b45328550b4" name="tests/manager/manager-executeCommand-006.phpt" role="test" />
+ <file md5sum="f97576f41e18bf92e1047d565424d230" name="tests/manager/manager-executeCommand-007.phpt" role="test" />
<file md5sum="54226b358783e1456d9ad86905ac68e9" name="tests/manager/manager-executeCommand_error-001.phpt" role="test" />
<file md5sum="893e7be482ea85b53fef7df7c420af96" name="tests/manager/manager-executeCommand_error-002.phpt" role="test" />
<file md5sum="e93a51f896f2d28e4a790aeb83edbf84" name="tests/manager/manager-executeCommand_error-003.phpt" role="test" />
<file md5sum="ebf6a1268b5819c8364d20cfd543a1e2" name="tests/manager/manager-executeCommand_error-004.phpt" role="test" />
<file md5sum="d20a3cc04c2e2e084b62d7574b97f959" name="tests/manager/manager-executeCommand_error-005.phpt" role="test" />
<file md5sum="2447fcf2f5dc9e1592ab26b14cf095f5" name="tests/manager/manager-executeQuery-001.phpt" role="test" />
<file md5sum="6645785c68bb34b8194c88ca1b784ad5" name="tests/manager/manager-executeQuery-002.phpt" role="test" />
<file md5sum="84473ebdaf73e71bd85ede11bb8e93b4" name="tests/manager/manager-executeQuery-003.phpt" role="test" />
<file md5sum="cca51ff672d601588ebac850c1a93d88" name="tests/manager/manager-executeQuery-004.phpt" role="test" />
<file md5sum="c92462fb5fbb4676e46cc229ee8023c9" name="tests/manager/manager-executeQuery-005.phpt" role="test" />
- <file md5sum="40a85322815629155580859956bd1bf6" name="tests/manager/manager-executeQuery-006.phpt" role="test" />
+ <file md5sum="fd2b689e725a2062fadf1e05773223a5" name="tests/manager/manager-executeQuery-006.phpt" role="test" />
+ <file md5sum="e6bb8f73b25efc178a5b7f1cce70f41a" name="tests/manager/manager-executeQuery-007.phpt" role="test" />
<file md5sum="f42311575c9bcbfbc67b8dbd10dbbaa7" name="tests/manager/manager-executeQuery_error-001.phpt" role="test" />
<file md5sum="7b31d0c0d68ba02a2faceb693af677b9" name="tests/manager/manager-executeQuery_error-002.phpt" role="test" />
<file md5sum="2425a02eeab9cbf1e1c9bf992092dd09" name="tests/manager/manager-executeQuery_error-003.phpt" role="test" />
<file md5sum="adb41c1b6c560be32f1f67bea783435b" name="tests/manager/manager-executeReadCommand-001.phpt" role="test" />
- <file md5sum="257032820b00d61ddd946ac7d9eed5ec" name="tests/manager/manager-executeReadCommand-002.phpt" role="test" />
+ <file md5sum="b34e5879bbfd57c9556f2e1d593a3714" name="tests/manager/manager-executeReadCommand-002.phpt" role="test" />
+ <file md5sum="f98fddaae863a18d9f1610acfe74fb13" name="tests/manager/manager-executeReadCommand-003.phpt" role="test" />
<file md5sum="af698c727b61a0580ce66a08e625c8d1" name="tests/manager/manager-executeReadCommand_error-001.phpt" role="test" />
- <file md5sum="9ef55f95e1a5d536163ddd8be039d617" name="tests/manager/manager-executeReadWriteCommand-001.phpt" role="test" />
- <file md5sum="07a665f5fef5cbd9a52bbf01b7dd50be" name="tests/manager/manager-executeReadWriteCommand-002.phpt" role="test" />
+ <file md5sum="a84309aaa7e826a0e7735d8bfccf12ac" name="tests/manager/manager-executeReadWriteCommand-001.phpt" role="test" />
+ <file md5sum="21e9f30fbc4c0514b006f0953a921c6b" name="tests/manager/manager-executeReadWriteCommand-002.phpt" role="test" />
+ <file md5sum="7f78da21dcf2c744b42fada59124e229" name="tests/manager/manager-executeReadWriteCommand-003.phpt" role="test" />
<file md5sum="2d92dfe9aea73ef5f5fb2c3d37df7be1" name="tests/manager/manager-executeReadWriteCommand_error-001.phpt" role="test" />
<file md5sum="472adf24949ec9cea47cc86ac4e834e7" name="tests/manager/manager-executeReadWriteCommand_error-002.phpt" role="test" />
<file md5sum="49d1f29f49e7f5a179c510e7987d9c71" name="tests/manager/manager-executeWriteCommand-001.phpt" role="test" />
- <file md5sum="a306a2a66e27ae315c48dc8ba180e509" name="tests/manager/manager-executeWriteCommand-002.phpt" role="test" />
+ <file md5sum="ae121b3b321bc5041902fa18f53bd200" name="tests/manager/manager-executeWriteCommand-002.phpt" role="test" />
+ <file md5sum="94bd699d9da4a25312cabfd0b69995bf" name="tests/manager/manager-executeWriteCommand-003.phpt" role="test" />
<file md5sum="223884a8c7d9d23e943fd9003fb41bd8" name="tests/manager/manager-executeWriteCommand_error-001.phpt" role="test" />
<file md5sum="1b8dc81a302c4025b33497363f463920" name="tests/manager/manager-executeWriteCommand_error-002.phpt" role="test" />
<file md5sum="721dc0ae6eb5cb397918b2f8a64faa5d" name="tests/manager/manager-executeWriteCommand_error-003.phpt" role="test" />
<file md5sum="5eedfce5f915c4b30a25bc4eb1accfea" name="tests/manager/manager-executeWriteCommand_error-004.phpt" role="test" />
<file md5sum="0c869cc5b61b1891fb9860b5c631797f" name="tests/manager/manager-getreadconcern-001.phpt" role="test" />
<file md5sum="f01ca8d5ec0497d3c83c20fbfbd78df9" name="tests/manager/manager-getreadpreference-001.phpt" role="test" />
<file md5sum="e47864f13ca7fe25e35f9e8baaa2cdb4" name="tests/manager/manager-getservers-001.phpt" role="test" />
<file md5sum="39c56a7a7608e2ab54aed5430c199a33" name="tests/manager/manager-getservers-002.phpt" role="test" />
<file md5sum="5cb96f5b8c994e360692ef80b430085d" name="tests/manager/manager-getwriteconcern-001.phpt" role="test" />
<file md5sum="316c963c709d2798c952d1f26ecfdcaf" name="tests/manager/manager-invalidnamespace.phpt" role="test" />
<file md5sum="594abcad7988e7af8992b58564c3053d" name="tests/manager/manager-selectserver-001.phpt" role="test" />
<file md5sum="a8165780917ad1de3e6b62a9d50893de" name="tests/manager/manager-selectserver_error-001.phpt" role="test" />
<file md5sum="c0a9cabc0b65b3d2148beb6a3647dabc" name="tests/manager/manager-set-uri-options-001.phpt" role="test" />
<file md5sum="3267666e2c1ec85975664d8db24d40f1" name="tests/manager/manager-set-uri-options-002.phpt" role="test" />
<file md5sum="0cf275d98e263adead46d915d4212d88" name="tests/manager/manager-set-uri-options-003.phpt" role="test" />
<file md5sum="78450543d70ac4092db50f3f34a0066c" name="tests/manager/manager-var-dump-001.phpt" role="test" />
- <file md5sum="f888f59a3fe5f9fdf3697f1424aaf38d" name="tests/manager/manager-wakeup.phpt" role="test" />
+ <file md5sum="56a8da4b1f3da7d8fa983a41c7c40830" name="tests/manager/manager-wakeup.phpt" role="test" />
<file md5sum="d9723d6bfe30a7e2691ecea5b69c2c13" name="tests/manager/manager_error-001.phpt" role="test" />
<file md5sum="2dd9863434c753dd55242243d48091c9" name="tests/query/bug0430-001.phpt" role="test" />
<file md5sum="6cfbe0ca5de33e4402bf779a44d64b4e" name="tests/query/bug0430-002.phpt" role="test" />
<file md5sum="6004d177d8ffc04a0a295eb824697e4a" name="tests/query/bug0430-003.phpt" role="test" />
<file md5sum="6a3a4c5c33296d0c57bf99eafdd2eac0" name="tests/query/bug0705-001.phpt" role="test" />
<file md5sum="760272a446ac993f8e97d21b6fe07667" name="tests/query/bug0705-002.phpt" role="test" />
<file md5sum="29108178991e9a305da2df846cf494b4" name="tests/query/query-ctor-001.phpt" role="test" />
<file md5sum="1cf3ecf0a05cc2c305042b47e712e351" name="tests/query/query-ctor-002.phpt" role="test" />
<file md5sum="739343c4dd6b03ab5c3dfec995fe6bff" name="tests/query/query-ctor-003.phpt" role="test" />
<file md5sum="c78b0601cac5a186e6e7c386f89ee4ef" name="tests/query/query-ctor-004.phpt" role="test" />
<file md5sum="71f1fa84dbf281b67d942863248f7e31" name="tests/query/query-ctor-005.phpt" role="test" />
<file md5sum="64bda823995da00efceed4b07627f18f" name="tests/query/query-ctor-006.phpt" role="test" />
<file md5sum="a8feb530a36c277f0c0e29bb9972f88c" name="tests/query/query-ctor_error-001.phpt" role="test" />
<file md5sum="1c2302cdb1b48a6c94776b928d27b68e" name="tests/query/query-ctor_error-002.phpt" role="test" />
<file md5sum="2238f34b7a0c1b93e6c1b1af5fc7b9b8" name="tests/query/query-ctor_error-003.phpt" role="test" />
<file md5sum="70af7d02949d0bfffa87729079871c74" name="tests/query/query-ctor_error-004.phpt" role="test" />
<file md5sum="21539cda062a422b388591fcda520ef3" name="tests/query/query-ctor_error-005.phpt" role="test" />
<file md5sum="07edfcf218e25dc4cf5fa8b677f6f636" name="tests/query/query-ctor_error-006.phpt" role="test" />
<file md5sum="8cf658f5cd18c7b5fc9b71e668699910" name="tests/query/query-debug-001.phpt" role="test" />
<file md5sum="623f5385c7016ba73c3be33c0e9a7b1e" name="tests/query/query_error-001.phpt" role="test" />
<file md5sum="a235c15b6d12006dd86cd3fc9d364abd" name="tests/readConcern/bug1598-001.phpt" role="test" />
<file md5sum="5b87f36784f6bfaf2d80fd5cd79c4571" name="tests/readConcern/bug1598-002.phpt" role="test" />
<file md5sum="dcbdfa9e8696be8baec22a8c09ec75d2" name="tests/readConcern/readconcern-bsonserialize-001.phpt" role="test" />
<file md5sum="e73ca4a826636a54ffe3ea853df7b0ef" name="tests/readConcern/readconcern-bsonserialize-002.phpt" role="test" />
<file md5sum="60e5d468a783ea7f28f43e261f9c4e15" name="tests/readConcern/readconcern-constants.phpt" role="test" />
<file md5sum="673f3d6d7729381139502491fd69dda4" name="tests/readConcern/readconcern-ctor-001.phpt" role="test" />
- <file md5sum="cc84842cd29ca9b34ed7febc8f9a0bae" name="tests/readConcern/readconcern-ctor_error-001.phpt" role="test" />
- <file md5sum="9a43b7910880283516d0594f881ca548" name="tests/readConcern/readconcern-ctor_error-002.phpt" role="test" />
+ <file md5sum="c1f4a3040b96c582e164b9d6aa50e12c" name="tests/readConcern/readconcern-ctor_error-001.phpt" role="test" />
+ <file md5sum="a745c3afbb8fe5d09d7207d0d0b4934d" name="tests/readConcern/readconcern-ctor_error-002.phpt" role="test" />
<file md5sum="32d628a71d398bd65e13d2bbe6b63b6c" name="tests/readConcern/readconcern-debug-001.phpt" role="test" />
<file md5sum="c6ecab3439c2b4249bedd2c6dc299dcf" name="tests/readConcern/readconcern-getlevel-001.phpt" role="test" />
<file md5sum="7bc12b0529eef007f25068e8a410d755" name="tests/readConcern/readconcern-isdefault-001.phpt" role="test" />
<file md5sum="79b0f4db273686ee4ff10f2e89f17124" name="tests/readConcern/readconcern-serialization-001.phpt" role="test" />
<file md5sum="bd2a1f13b5cf85270aa8085f46e0e48c" name="tests/readConcern/readconcern-set_state-001.phpt" role="test" />
<file md5sum="3fbc3e10cec34871c930e36227d39733" name="tests/readConcern/readconcern-set_state_error-001.phpt" role="test" />
<file md5sum="086b0444ec258c33779027b4b58e38b1" name="tests/readConcern/readconcern-var_export-001.phpt" role="test" />
<file md5sum="f773914d83286e225a75016f89b6eba6" name="tests/readConcern/readconcern_error-001.phpt" role="test" />
<file md5sum="c8c3b1d561bf4f39184476a28c23556d" name="tests/readPreference/bug0146-001.phpt" role="test" />
<file md5sum="917e360edc3fa8ffe58140b1a745d28c" name="tests/readPreference/bug0146-002.phpt" role="test" />
<file md5sum="5bbbd73884d0d64989109201e7e1bf3f" name="tests/readPreference/bug0851-001.phpt" role="test" />
<file md5sum="bdc1634fe23391ae15928e87da27e5dc" name="tests/readPreference/bug1598-001.phpt" role="test" />
<file md5sum="fd65990a31032d72fd2a97e4d9425ea4" name="tests/readPreference/bug1598-002.phpt" role="test" />
+ <file md5sum="f1b61f8771312a95c30f327d4553bc2a" name="tests/readPreference/bug1698-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="961998132bc79161663699fd64b369b2" name="tests/readPreference/readpreference-constants.phpt" role="test" />
<file md5sum="d8641784d6b9e66b8b44dfaa0328abd6" name="tests/readPreference/readpreference-ctor-001.phpt" role="test" />
<file md5sum="221ff341be838431d0b6aa95e1680e16" name="tests/readPreference/readpreference-ctor-002.phpt" role="test" />
<file md5sum="475a0c5eff5f7f7a211614819b886648" name="tests/readPreference/readpreference-ctor_error-001.phpt" role="test" />
<file md5sum="a0cdfd5d545b800d979e6610fa8f417a" name="tests/readPreference/readpreference-ctor_error-002.phpt" role="test" />
<file md5sum="ecc2c2b630fc509b9cc13cbaa180071e" 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="67904c50feea14b362824470d04a73ea" name="tests/readPreference/readpreference-ctor_error-005.phpt" role="test" />
<file md5sum="7f4fccdf7d3913833ddcb7c7a04feafd" name="tests/readPreference/readpreference-ctor_error-006.phpt" role="test" />
<file md5sum="151872a7a99973fc6c29b11d10bfd26f" name="tests/readPreference/readpreference-ctor_error-007.phpt" role="test" />
<file md5sum="611c1c5b2794b57db557b7eccdd602ce" name="tests/readPreference/readpreference-debug-001.phpt" role="test" />
<file md5sum="39dc737e5086a3eb1cffac1a5960fa58" name="tests/readPreference/readpreference-getHedge-001.phpt" role="test" />
<file md5sum="4a4e16d677e9a242b8e2429def65e565" name="tests/readPreference/readpreference-getMaxStalenessMS-001.phpt" role="test" />
<file md5sum="23c503e166045f34625abc42506b80db" name="tests/readPreference/readpreference-getMaxStalenessMS-002.phpt" role="test" />
<file md5sum="2300bc05051a0d0dc183ebe1d699190a" name="tests/readPreference/readpreference-getMode-001.phpt" role="test" />
<file md5sum="8114a801f07aafd9330c9143bb02672a" name="tests/readPreference/readpreference-getModeString-001.phpt" role="test" />
<file md5sum="2a58ca560ca933e763397fdecd6e1c22" name="tests/readPreference/readpreference-getTagSets-001.phpt" role="test" />
<file md5sum="74a95fd229d950e7116b5ff0fd78db56" name="tests/readPreference/readpreference-getTagSets-002.phpt" role="test" />
<file md5sum="0518414983b7662cada85c7815bd3a0b" name="tests/readPreference/readpreference-serialization-001.phpt" role="test" />
<file md5sum="50ed95b7fd36ec4aaa810ff93843733b" name="tests/readPreference/readpreference-set_state-001.phpt" role="test" />
<file md5sum="469960c5dbe3d362997a7498ceffe957" name="tests/readPreference/readpreference-set_state_error-001.phpt" role="test" />
<file md5sum="211bbe4ed835c63572432551b13e2bce" name="tests/readPreference/readpreference-set_state_error-002.phpt" role="test" />
<file md5sum="fdad20125292e0c2bde2ef25b61e7c28" name="tests/readPreference/readpreference-var_export-001.phpt" role="test" />
<file md5sum="56df736cc8af42557ae036e2eef910a8" name="tests/readPreference/readpreference_error-001.phpt" role="test" />
<file md5sum="3cf1afee6206f9de195b4791a6605123" name="tests/replicaset/bug0155.phpt" role="test" />
<file md5sum="96b4ca171bfa4d6e67c70f134dfd69ce" name="tests/replicaset/bug0898-001.phpt" role="test" />
<file md5sum="fe8e45640380677089d99101b5883978" name="tests/replicaset/bug0898-002.phpt" role="test" />
<file md5sum="8cf05460fd402ac17258be1326a0682a" name="tests/replicaset/manager-getservers-001.phpt" role="test" />
<file md5sum="42ae774904c6cb84873619f90d479999" name="tests/replicaset/manager-selectserver-001.phpt" role="test" />
<file md5sum="46383074e49b79c3ae027314d6df7d89" name="tests/replicaset/readconcern-001.phpt" role="test" />
<file md5sum="5dae0a9293aabc3c656349304a74ab46" name="tests/replicaset/readconcern-002.phpt" role="test" />
<file md5sum="3db976328d75135e29f81a749b3f11b4" name="tests/replicaset/server-001.phpt" role="test" />
<file md5sum="feafa6c44b637790e099b118027c7478" name="tests/replicaset/server-002.phpt" role="test" />
<file md5sum="05c06feede9e23ae255c3712812f4122" name="tests/replicaset/writeconcernerror-001.phpt" role="test" />
<file md5sum="efdbacd7538ec6dc9850d80a377f82d3" name="tests/replicaset/writeconcernerror-002.phpt" role="test" />
<file md5sum="880126db315e70c22a172ca3b82ab718" name="tests/replicaset/writeresult-getserver-001.phpt" role="test" />
<file md5sum="a4b61fd2d3ff6c2218c25506fa519cc8" name="tests/replicaset/writeresult-getserver-002.phpt" role="test" />
<file md5sum="f604c05218049fcf317d960d16c2b2cc" name="tests/retryable-reads/retryable-reads-001.phpt" role="test" />
<file md5sum="de129bc602ec27318658568eed322416" name="tests/retryable-reads/retryable-reads-002.phpt" role="test" />
<file md5sum="ea30a6e0fe482be5c9f4428b7f475d70" name="tests/retryable-reads/retryable-reads_error-001.phpt" role="test" />
<file md5sum="3b8aa211bff63115d7995c888befac0a" name="tests/retryable-reads/retryable-reads_error-002.phpt" role="test" />
<file md5sum="fc5c93b3587f7a38aa8bccc266ad0ef5" name="tests/retryable-writes/retryable-writes-001.phpt" role="test" />
<file md5sum="1e94c0321bb27b1e51244529dbd5a200" name="tests/retryable-writes/retryable-writes-002.phpt" role="test" />
<file md5sum="e233372e47b2f6885fbb93f321a47663" name="tests/retryable-writes/retryable-writes-003.phpt" role="test" />
<file md5sum="8ac30a3b5e2432c6b5b38d64c035b405" name="tests/retryable-writes/retryable-writes-004.phpt" role="test" />
<file md5sum="e612122e12f41490d3093d588ec24000" name="tests/retryable-writes/retryable-writes-005.phpt" role="test" />
<file md5sum="6e1a9844ce8b3040279040533ddc3fb2" name="tests/retryable-writes/retryable-writes_error-001.phpt" role="test" />
<file md5sum="2b8a8659f4a505c3677a747de6de7ec8" name="tests/server/bug0671-002.phpt" role="test" />
<file md5sum="ff8f474af054f3b378d6f5fd4b6b9000" name="tests/server/server-constants.phpt" role="test" />
<file md5sum="f6d00397b693b9e3f524369083d14ad5" name="tests/server/server-construct-001.phpt" role="test" />
<file md5sum="c2acd0e7641f5a35911b60891b6d7e67" name="tests/server/server-debug.phpt" role="test" />
- <file md5sum="f3abb90943c0c59f61897f0a20a8aae3" name="tests/server/server-errors.phpt" role="test" />
+ <file md5sum="20a048e09e3f5a857f42db55746fab02" name="tests/server/server-errors.phpt" role="test" />
<file md5sum="63806ee59d45516b6dc5d882fd8bbb8e" name="tests/server/server-executeBulkWrite-001.phpt" role="test" />
<file md5sum="64fe8867060b08da59fbce6e48d019da" name="tests/server/server-executeBulkWrite-002.phpt" role="test" />
<file md5sum="5df32910418b393b9acacb7f15efebdf" name="tests/server/server-executeBulkWrite-003.phpt" role="test" />
<file md5sum="4a2b33ad1d412a6afd184fa2f1501e80" name="tests/server/server-executeBulkWrite-004.phpt" role="test" />
<file md5sum="40a8ba3033c7ffc43b4021932fe3f783" name="tests/server/server-executeBulkWrite-005.phpt" role="test" />
<file md5sum="17d83387a16ae669e77129acb0916695" name="tests/server/server-executeBulkWrite-006.phpt" role="test" />
<file md5sum="624b24797c3d1cb8d54cd9e9cf405b22" name="tests/server/server-executeBulkWrite-007.phpt" role="test" />
<file md5sum="76ceeabf514f6a5f4adf15803005a69f" name="tests/server/server-executeBulkWrite-008.phpt" role="test" />
+ <file md5sum="e10604949262618aa0d60286bcba9134" name="tests/server/server-executeBulkWrite-009.phpt" role="test" />
<file md5sum="7bf168cb673fbcd4180a9b2f845a5488" name="tests/server/server-executeBulkWrite_error-001.phpt" role="test" />
<file md5sum="79244553626ae88124f93c5a5affb3a5" name="tests/server/server-executeBulkWrite_error-002.phpt" role="test" />
<file md5sum="e4271a12b01bdd5ea8aaf4b55cd44593" name="tests/server/server-executeCommand-001.phpt" role="test" />
<file md5sum="dc66ce61035c76ca671de5953da7b2a9" name="tests/server/server-executeCommand-002.phpt" role="test" />
<file md5sum="c42f82129f878752f19e5f75a852c225" name="tests/server/server-executeCommand-003.phpt" role="test" />
<file md5sum="cefa45c0633900d06eb8e76994a3fc29" name="tests/server/server-executeCommand-004.phpt" role="test" />
<file md5sum="81551df9208318dadb031c4076ffbd95" name="tests/server/server-executeCommand-005.phpt" role="test" />
<file md5sum="b7044ff1bcfade95c76418cada0e56f5" name="tests/server/server-executeCommand-006.phpt" role="test" />
<file md5sum="33c673f0982b40672eb5eade7eb49c81" name="tests/server/server-executeCommand-007.phpt" role="test" />
<file md5sum="4338862033ecb05c842a3bd331036578" name="tests/server/server-executeCommand-008.phpt" role="test" />
<file md5sum="29ee7b6f5a03852428a471fab21db52d" name="tests/server/server-executeCommand-009.phpt" role="test" />
+ <file md5sum="a24e7355307f3581232663248c7eff73" name="tests/server/server-executeCommand-010.phpt" role="test" />
<file md5sum="d3ecf35db4eee7f0019a9233b0b5b38e" name="tests/server/server-executeCommand_error-001.phpt" role="test" />
<file md5sum="80252724c53b8372b9ebe2e264ec7a58" name="tests/server/server-executeQuery-001.phpt" role="test" />
<file md5sum="8dfbcb094d44c59a17bc1d04cf239c2f" name="tests/server/server-executeQuery-002.phpt" role="test" />
<file md5sum="acde1eea432e4daf349f6f8a2339e573" name="tests/server/server-executeQuery-003.phpt" role="test" />
<file md5sum="391cb0318ab4bdb40d83e28e8d9951c9" name="tests/server/server-executeQuery-004.phpt" role="test" />
<file md5sum="e6b67a9a31145112f7796532006cc296" name="tests/server/server-executeQuery-005.phpt" role="test" />
<file md5sum="1f1cdc714fb4fc09a54c41efd785d366" name="tests/server/server-executeQuery-006.phpt" role="test" />
<file md5sum="8bbe2939e84d878696c64ff145e411f0" name="tests/server/server-executeQuery-007.phpt" role="test" />
<file md5sum="c3ba3846c961874e121c7171a80573d3" name="tests/server/server-executeQuery-008.phpt" role="test" />
<file md5sum="6eb6da9e63a1c00481498887f6743bfb" name="tests/server/server-executeQuery-009.phpt" role="test" />
<file md5sum="3d65377e8d570aaf0ffb95a1a85ddf96" name="tests/server/server-executeQuery-010.phpt" role="test" />
<file md5sum="113b6723ee01ef2bd9fa620693c30ab3" name="tests/server/server-executeQuery-011.phpt" role="test" />
- <file md5sum="c31c549e66c9d8f3c8a4756265f9690d" name="tests/server/server-executeQuery-012.phpt" role="test" />
+ <file md5sum="85f649b1eadecfd5d8e54e89264fa931" name="tests/server/server-executeQuery-012.phpt" role="test" />
+ <file md5sum="f394dec2625f8aeccd4c259297b1307e" name="tests/server/server-executeQuery-013.phpt" role="test" />
<file md5sum="f43cf4e01f89d67bcf211244385d1100" name="tests/server/server-executeQuery_error-001.phpt" role="test" />
<file md5sum="2b47225cdf8e0f9e68dbffa882c481b5" name="tests/server/server-executeReadCommand-001.phpt" role="test" />
- <file md5sum="022e8daf9bfeec99d765cc41e8d03504" name="tests/server/server-executeReadCommand-002.phpt" role="test" />
+ <file md5sum="9e60f8c942aa8ff32edb6feccb993ee2" name="tests/server/server-executeReadCommand-002.phpt" role="test" />
+ <file md5sum="23cebefdda9cec9ca461fa61d4a616a6" name="tests/server/server-executeReadCommand-003.phpt" role="test" />
<file md5sum="05e98dbeb736c1ed965e3f460ea5df64" name="tests/server/server-executeReadCommand_error-001.phpt" role="test" />
<file md5sum="0db31d3ee522f2013ce0e3a83b2a8c53" name="tests/server/server-executeReadWriteCommand-001.phpt" role="test" />
- <file md5sum="cf783828d11acca6e25557ee048a0e3d" name="tests/server/server-executeReadWriteCommand-002.phpt" role="test" />
+ <file md5sum="ea2fbde66208c76b3e36d13c0ade7bd9" name="tests/server/server-executeReadWriteCommand-002.phpt" role="test" />
+ <file md5sum="de221a6fbcfe8611a02da17fb1a9b3d8" name="tests/server/server-executeReadWriteCommand-003.phpt" role="test" />
<file md5sum="90eb8548a78789f802d23e009e813917" name="tests/server/server-executeReadWriteCommand_error-001.phpt" role="test" />
<file md5sum="a7fbf14b06d151ff4ff2c7710846ef27" name="tests/server/server-executeWriteCommand-001.phpt" role="test" />
- <file md5sum="0254f26bf9a337814293064204ee6da9" name="tests/server/server-executeWriteCommand-002.phpt" role="test" />
+ <file md5sum="9470c2be319b4bb7abf1dbb810fe930c" name="tests/server/server-executeWriteCommand-002.phpt" role="test" />
+ <file md5sum="7293273e2fef5352a9080fcf55db8e21" name="tests/server/server-executeWriteCommand-003.phpt" role="test" />
<file md5sum="2d4077a32f65cc4721d04d10a0a323c8" name="tests/server/server-executeWriteCommand_error-001.phpt" role="test" />
<file md5sum="560a414d45da81e5f0ab181f81492638" name="tests/server/server-getInfo-001.phpt" role="test" />
<file md5sum="fa45738e0a372064a1e977cce5e098a7" name="tests/server/server-getTags-001.phpt" role="test" />
<file md5sum="ed4ba9169d7b8395d1c1ff1196ca067b" name="tests/server/server-getTags-002.phpt" role="test" />
<file md5sum="9aefd9967eed1cb334069bc28d435b71" name="tests/server/server_error-001.phpt" role="test" />
<file md5sum="ad46a7559a26c836567ddd44773de48b" name="tests/session/bug1274-001.phpt" role="test" />
<file md5sum="f714efea637da9bad3c0c6db972f8607" name="tests/session/bug1274-002.phpt" role="test" />
<file md5sum="dc283d6d0443c19aae30034b23fa7cf7" name="tests/session/bug1274-003.phpt" role="test" />
<file md5sum="0fe9e9e9f4b22afb422cc73cf167df5d" name="tests/session/session-001.phpt" role="test" />
<file md5sum="7af7d6e79d92d1c96e49264e7ed033ed" name="tests/session/session-002.phpt" role="test" />
<file md5sum="882e75a08e382e51293cb93e7c338174" name="tests/session/session-003.phpt" role="test" />
<file md5sum="e2254f346cd7ae8ca11c3c6d0e923060" name="tests/session/session-advanceClusterTime-001.phpt" role="test" />
<file md5sum="a01993c77c1c241f3ccd23673d2a525c" name="tests/session/session-advanceOperationTime-001.phpt" role="test" />
<file md5sum="24e3cb8b13c5e1bd1227632b4b03839c" name="tests/session/session-advanceOperationTime-002.phpt" role="test" />
<file md5sum="627fae666642fe3e289c0ef2b569e11e" name="tests/session/session-advanceOperationTime-003.phpt" role="test" />
<file md5sum="47952ec7d197bb4ccc1fa2c41be6ab23" name="tests/session/session-advanceOperationTime_error-001.phpt" role="test" />
<file md5sum="65a1d6097e9a4b68a8a154b0176c7e74" name="tests/session/session-commitTransaction-001.phpt" role="test" />
<file md5sum="ae4075d8629d54ce74448dc56562af31" name="tests/session/session-constants.phpt" role="test" />
<file md5sum="d7d63d2f3a6a7eb838dfb0e6c9d52322" name="tests/session/session-debug-001.phpt" role="test" />
<file md5sum="3fcb23362cb2338d1e849febc02aa471" name="tests/session/session-debug-002.phpt" role="test" />
<file md5sum="7e9a3d5e7b740ea24af65fe8c08ed7c9" name="tests/session/session-debug-003.phpt" role="test" />
<file md5sum="62849f5a965ef2d2ca3cf2e12e24d4e9" name="tests/session/session-debug-004.phpt" role="test" />
<file md5sum="06cd05293d3d6cfa7341be647f998d7c" name="tests/session/session-debug-005.phpt" role="test" />
<file md5sum="4f5dcd685ab878798f0ad74dbdbab1be" name="tests/session/session-endSession-001.phpt" role="test" />
<file md5sum="6268cff15cfd8eeb0f96f00616812eca" name="tests/session/session-endSession-002.phpt" role="test" />
<file md5sum="4727641df2caa42900b2c3e78132276c" name="tests/session/session-getClusterTime-001.phpt" role="test" />
<file md5sum="80cf8d773cba1a17908b07ce7161c3bc" name="tests/session/session-getLogicalSessionId-001.phpt" role="test" />
<file md5sum="96a41fd301fb5aa28135abeefb9def5c" name="tests/session/session-getOperationTime-001.phpt" role="test" />
<file md5sum="c8ba6dba60f1ae46cba7f71360c55ed6" name="tests/session/session-getTransactionOptions-001.phpt" role="test" />
<file md5sum="d54de85742d6e5a1fef859f295eb3c07" name="tests/session/session-getTransactionState-001.phpt" role="test" />
<file md5sum="a0b3fffee98888621ca138b1077958a8" name="tests/session/session-isInTransaction-001.phpt" role="test" />
<file md5sum="2e266404ac1f83d906fa47302fddc4f6" name="tests/session/session-startTransaction-001.phpt" role="test" />
<file md5sum="b1f793dfdf9538a37f2e4e4aea83f89b" name="tests/session/session-startTransaction_error-001.phpt" role="test" />
- <file md5sum="1d5eacd6b5d32fcd27cc4504f9078fe3" name="tests/session/session-startTransaction_error-002.phpt" role="test" />
- <file md5sum="1ddbf1f3f69d92eedb67ec1c7df5f9e0" name="tests/session/session-startTransaction_error-004.phpt" role="test" />
- <file md5sum="40fea178eed89f96155406e7454e66ae" name="tests/session/session-startTransaction_error-005.phpt" role="test" />
+ <file md5sum="937353e4973d9d0154367f9e6aee36d9" name="tests/session/session-startTransaction_error-002.phpt" role="test" />
+ <file md5sum="55ed29b0b0663b87b9ddf54b39386741" name="tests/session/session-startTransaction_error-004.phpt" role="test" />
+ <file md5sum="4ab5fbc8689a215bba037cf2c038dce0" name="tests/session/session-startTransaction_error-005.phpt" role="test" />
<file md5sum="8083d8a3439a1bb5077c773179bf2bac" name="tests/session/session-startTransaction_error-006.phpt" role="test" />
<file md5sum="99efcb91c29c3173d76d965eecff97f0" name="tests/session/session-startTransaction_error-007.phpt" role="test" />
- <file md5sum="45e56e8802f0a23f022af36821045a87" name="tests/session/session_error-001.phpt" role="test" />
+ <file md5sum="da1f2afd07bfcc41e77d0b73e617c1ec" name="tests/session/session_error-001.phpt" role="test" />
+ <file md5sum="8827fc3baaf04602500b52f983cbe087" name="tests/session/session_error-002.phpt" role="test" />
<file md5sum="418a31e693d99470550772bb393c0195" name="tests/session/transaction-integration-001.phpt" role="test" />
<file md5sum="f0bd641948afbbc7e61a337723d39d5b" name="tests/session/transaction-integration-002.phpt" role="test" />
<file md5sum="dfadd390104f59283051fe0beb2e3925" name="tests/session/transaction-integration-003.phpt" role="test" />
<file md5sum="a7c9e16b70f3b8d3d9718984800c5377" name="tests/session/transaction-integration_error-001.phpt" role="test" />
<file md5sum="7def4e71fa83b9f89acce1282b4073c8" name="tests/session/transaction-integration_error-002.phpt" role="test" />
<file md5sum="b6e68398a74801cb94d85772a1896a8b" name="tests/session/transaction-integration_error-003.phpt" role="test" />
<file md5sum="bb21f9b365f3248f121541ae6578d3cc" name="tests/session/transaction-integration_error-004.phpt" role="test" />
<file md5sum="940383190d64230873ed7d5fd0ea4e83" name="tests/standalone/bug0166.phpt" role="test" />
<file md5sum="6663da2bef4308dda70d7e5536358fc0" name="tests/standalone/bug0231.phpt" role="test" />
<file md5sum="e960210e5b8a123f06b5b2f0f5dc9b1f" name="tests/standalone/bug0357.phpt" role="test" />
<file md5sum="895c0c02119818d6085e5d4b965284ce" name="tests/standalone/bug0545.phpt" role="test" />
<file md5sum="8e078a15babcfcd350ac6208da20858a" name="tests/standalone/bug0655.phpt" role="test" />
<file md5sum="c0e1dafb0b6072b56625cb46a9e8db8d" name="tests/standalone/command-aggregate-001.phpt" role="test" />
<file md5sum="30a58f9aae77077a886309ddaf4f5599" name="tests/standalone/connectiontimeoutexception-001.phpt" role="test" />
<file md5sum="bd525b744a97ecc68c9dcc25c49436ee" name="tests/standalone/executiontimeoutexception-001.phpt" role="test" />
<file md5sum="aba1a96e301df77d3f5b17b6954d5569" name="tests/standalone/executiontimeoutexception-002.phpt" role="test" />
<file md5sum="c25d1cb79ff39fc6ff20fac6ba555e05" name="tests/standalone/manager-as-singleton.phpt" role="test" />
<file md5sum="54dc16a86c37e04384e2c6454ef056b7" name="tests/standalone/query-errors.phpt" role="test" />
<file md5sum="12028d3707db221c7ab5089f0cb1b865" name="tests/standalone/update-multi-001.phpt" role="test" />
<file md5sum="ee76e8fbed51422613ea238569c1876e" name="tests/standalone/write-error-001.phpt" role="test" />
<file md5sum="fde81b755ba7215a4508686b93cd1d0c" name="tests/standalone/writeresult-isacknowledged-001.phpt" role="test" />
<file md5sum="6c5c3c9f27c366857c03bc0e2c1d1a86" name="tests/standalone/writeresult-isacknowledged-002.phpt" role="test" />
<file md5sum="cc33d3dbb588b0218ae6801d4598b448" name="tests/standalone/writeresult-isacknowledged-003.phpt" role="test" />
<file md5sum="59adebd29ef983f00c4d55cfc4b2d10d" name="tests/utils/PHONGO-FIXTURES.json.gz" role="test" />
<file md5sum="20bcdb186e464bebff08400730d55afd" name="tests/utils/basic-skipif.inc" role="test" />
<file md5sum="06d6c225875e223552130cd59da13350" name="tests/utils/basic.inc" role="test" />
<file md5sum="d45f34ff6fd0f526099f3131d5d17b11" name="tests/utils/classes.inc" role="test" />
<file md5sum="4134acafdc5eb51800213b41043116ba" name="tests/utils/observer.php" role="test" />
<file md5sum="017ec7dc3174e863cf94ece68093e26a" name="tests/utils/skipif.php" role="test" />
- <file md5sum="ca818bdd97304f37d99a0af4a165c5b1" name="tests/utils/tools.php" role="test" />
+ <file md5sum="498ae40a163d5d6a3fb4cd320e0c0aa4" name="tests/utils/tools.php" role="test" />
<file md5sum="64ee8e2ef24e46d681df686739aa4e69" name="tests/writeConcern/bug1598-001.phpt" role="test" />
<file md5sum="2627d7f0df83428223b79249b0223243" name="tests/writeConcern/bug1598-002.phpt" role="test" />
<file md5sum="cf5ae403507aa8f399bc6aeb35ed5b70" name="tests/writeConcern/writeconcern-bsonserialize-001.phpt" role="test" />
<file md5sum="073e73d11253900ad6d1e3e1b0656d20" name="tests/writeConcern/writeconcern-bsonserialize-002.phpt" role="test" />
<file md5sum="a02e1015d4bc797ff8a68613342f28c5" name="tests/writeConcern/writeconcern-bsonserialize-003.phpt" role="test" />
<file md5sum="64c7fb44e466938561d753546b82c22f" name="tests/writeConcern/writeconcern-bsonserialize-004.phpt" role="test" />
<file md5sum="08cc65bfe3d89314eca5a43616e12202" name="tests/writeConcern/writeconcern-constants.phpt" role="test" />
<file md5sum="3dbbdae846359bf00358aad47b0b7ae6" name="tests/writeConcern/writeconcern-ctor-001.phpt" role="test" />
<file md5sum="1f9f66d9446fa0f5ce954d88abe56e70" name="tests/writeConcern/writeconcern-ctor-002.phpt" role="test" />
- <file md5sum="14ed39149705e115f25a9e1fc0660e7f" name="tests/writeConcern/writeconcern-ctor_error-001.phpt" role="test" />
+ <file md5sum="cc81186f854cbdefd0b10eb4bfddc1b7" name="tests/writeConcern/writeconcern-ctor_error-001.phpt" role="test" />
<file md5sum="c2e8f1ec966e7bea7506086d3b078b0c" name="tests/writeConcern/writeconcern-ctor_error-002.phpt" role="test" />
<file md5sum="c2060d2d434822651642407ea58f43de" name="tests/writeConcern/writeconcern-ctor_error-003.phpt" role="test" />
<file md5sum="fe0f02fd98455f53bf423043f6d92925" name="tests/writeConcern/writeconcern-ctor_error-004.phpt" role="test" />
<file md5sum="95bb856337bc64ff047555b00549eaae" name="tests/writeConcern/writeconcern-ctor_error-005.phpt" role="test" />
<file md5sum="22dfaec3917fe798f71c15d857a36921" name="tests/writeConcern/writeconcern-debug-001.phpt" role="test" />
<file md5sum="56555f30c1e42233cb65ef12a0fb870b" name="tests/writeConcern/writeconcern-debug-002.phpt" role="test" />
<file md5sum="7feb66ce332c7b57016aa3f40e157480" name="tests/writeConcern/writeconcern-debug-003.phpt" role="test" />
<file md5sum="544bc7904161390cd99e1603b71eb0c6" name="tests/writeConcern/writeconcern-getjournal-001.phpt" role="test" />
<file md5sum="c64faac6dd9eeb55bb27b2d82acb7d86" name="tests/writeConcern/writeconcern-getw-001.phpt" role="test" />
<file md5sum="9ec2c850fc6202678ea402e96a56e530" name="tests/writeConcern/writeconcern-getwtimeout-001.phpt" role="test" />
<file md5sum="e4a511f7c2e842768495c5ebefa824e1" name="tests/writeConcern/writeconcern-getwtimeout-002.phpt" role="test" />
<file md5sum="7ac2556e20b9fda6524d291b695f9241" name="tests/writeConcern/writeconcern-isdefault-001.phpt" role="test" />
<file md5sum="c455191cb343f16c2e707eb067ac09a9" name="tests/writeConcern/writeconcern-serialization-001.phpt" role="test" />
<file md5sum="3929df39414066a6b692810915cf65d1" name="tests/writeConcern/writeconcern-serialization_error-001.phpt" role="test" />
<file md5sum="d114d86a919cd387a4f16d9c2f1308db" name="tests/writeConcern/writeconcern-set_state-001.phpt" role="test" />
<file md5sum="c75a8d672c6e6eddc31470b73e2234c5" name="tests/writeConcern/writeconcern-set_state_error-001.phpt" role="test" />
<file md5sum="898c846d82ef5860cad45d52ff82e31c" name="tests/writeConcern/writeconcern-var_export-001.phpt" role="test" />
<file md5sum="14ec52ea19befdf082e3ee270fa7d8ea" name="tests/writeConcern/writeconcern_error-001.phpt" role="test" />
<file md5sum="007f673dcf21440bc71f0d2cd160dc06" name="tests/writeConcernError/writeconcernerror-debug-001.phpt" role="test" />
<file md5sum="b6a48538944c72c534c810fa88029c26" name="tests/writeConcernError/writeconcernerror-debug-002.phpt" role="test" />
<file md5sum="4f11045704555562d06c761ea2743c3b" name="tests/writeConcernError/writeconcernerror-getcode-001.phpt" role="test" />
<file md5sum="8ad20b0efa584722e3fc5c7fbd368026" name="tests/writeConcernError/writeconcernerror-getinfo-001.phpt" role="test" />
<file md5sum="b072dec51460af51750d092810e6933b" name="tests/writeConcernError/writeconcernerror-getinfo-002.phpt" role="test" />
<file md5sum="31455bca8a9201347154b00f301e7090" name="tests/writeConcernError/writeconcernerror-getmessage-001.phpt" role="test" />
<file md5sum="69820b84c701fe8480e6e8014a14189c" name="tests/writeConcernError/writeconcernerror_error-001.phpt" role="test" />
<file md5sum="49dec43862f3c94413d798af07744c48" name="tests/writeError/writeerror-debug-001.phpt" role="test" />
<file md5sum="dfd0eb23f183022e4c8e3b090412b92e" name="tests/writeError/writeerror-getCode-001.phpt" role="test" />
<file md5sum="13c878a368e78176a5cdc7332704883b" name="tests/writeError/writeerror-getIndex-001.phpt" role="test" />
<file md5sum="eeecb795c9cd519549fa486460bc7458" name="tests/writeError/writeerror-getInfo-001.phpt" role="test" />
<file md5sum="33a6c89310fee726c12dd0113ab3e45b" name="tests/writeError/writeerror-getMessage-001.phpt" role="test" />
<file md5sum="ba12ea26054c04774c4d6a3f35094c28" name="tests/writeError/writeerror_error-001.phpt" role="test" />
<file md5sum="e1659c0daaebbf2324739990c3b7ce23" name="tests/writeResult/bug0671-003.phpt" role="test" />
<file md5sum="cc04e32b67b25545a84b9b2c568a9a5f" name="tests/writeResult/writeresult-debug-001.phpt" role="test" />
<file md5sum="99e759dc701153d6436484c106b33b20" name="tests/writeResult/writeresult-debug-002.phpt" role="test" />
<file md5sum="bea93768430dad4080e6dacfaf3d767d" name="tests/writeResult/writeresult-getdeletedcount-001.phpt" role="test" />
<file md5sum="8e98e22963c706d5dd639ad1ce7ce66f" name="tests/writeResult/writeresult-getdeletedcount-002.phpt" role="test" />
<file md5sum="d275cd76a8696ff44dbcd7b837f849bc" name="tests/writeResult/writeresult-getinsertedcount-001.phpt" role="test" />
<file md5sum="ae69602d2142ed4d45e63533f39836ac" name="tests/writeResult/writeresult-getinsertedcount-002.phpt" role="test" />
<file md5sum="daaf8b1c546b212e2fde05c2d8bb8b44" name="tests/writeResult/writeresult-getmatchedcount-001.phpt" role="test" />
<file md5sum="42e979f88d2f246953e9b6602a57c2f7" name="tests/writeResult/writeresult-getmatchedcount-002.phpt" role="test" />
<file md5sum="75c7961241c42185ce8d0d28fe9b521d" name="tests/writeResult/writeresult-getmodifiedcount-001.phpt" role="test" />
<file md5sum="774ba30e92e3ba4cd9783fd66739c669" name="tests/writeResult/writeresult-getmodifiedcount-002.phpt" role="test" />
<file md5sum="70e5f633cb3a6679cd2f336635d7d196" name="tests/writeResult/writeresult-getserver-001.phpt" role="test" />
<file md5sum="348f056b4388e6b1f8906b6d2b33f4b1" name="tests/writeResult/writeresult-getupsertedcount-001.phpt" role="test" />
<file md5sum="8a71a2cdf9c660c9bdce8472859ce7ed" name="tests/writeResult/writeresult-getupsertedcount-002.phpt" role="test" />
<file md5sum="dc301823a371a9844ad051f148e89540" name="tests/writeResult/writeresult-getupsertedids-001.phpt" role="test" />
<file md5sum="7f2a32e5a6fa6dccde7448ef0668e1bd" name="tests/writeResult/writeresult-getupsertedids-002.phpt" role="test" />
<file md5sum="3c5ab26b8cf18f85ccbbe5ce5e8a5604" name="tests/writeResult/writeresult-getwriteconcernerror-001.phpt" role="test" />
<file md5sum="eb245af82b8e8845a85d63e2620feb9a" name="tests/writeResult/writeresult-getwriteerrors-001.phpt" role="test" />
<file md5sum="3f4f8053a660b2a575338e96b4badf2a" name="tests/writeResult/writeresult-getwriteerrors-002.phpt" role="test" />
<file md5sum="700423c4500dc42f08187c2fdd13422c" name="tests/writeResult/writeresult-isacknowledged-001.phpt" role="test" />
<file md5sum="fdd3ef0a514427c85fb91ff8a1cff3f6" name="tests/writeResult/writeresult_error-001.phpt" role="test" />
- <file md5sum="b3a933056b7c0bf6369b2cbbfb99d833" name="CONTRIBUTING.md" role="doc" />
+ <file md5sum="57e609309e432ff95926d9cf809758aa" name="CONTRIBUTING.md" role="doc" />
<file md5sum="198d0ffaabbd88f77e9b9067b694ca10" name="CREDITS" role="doc" />
<file md5sum="b1e01b26bacfc2232046c90a330332b3" name="LICENSE" role="doc" />
<file md5sum="eacc64f242c8462914d179af5370b078" name="Makefile.frag" role="src" />
<file md5sum="52a347bc408e3b94f1fe5d7d6a78af3a" name="README.md" role="doc" />
<file md5sum="eadbe8ccffa540f5ac53ffc59e36a727" name="THIRD_PARTY_NOTICES" role="doc" />
<file md5sum="0962c850da28d6d16b471cc9e9c976d9" name="Vagrantfile" role="test" />
- <file md5sum="9da1a6110b74ccb6655cb70c75f262ba" name="config.m4" role="src" />
- <file md5sum="4d9d117bb9889cf6d292ee737f9861c7" name="config.w32" role="src" />
- <file md5sum="dda0618f33950b5b7613dc3af0aecc3c" name="phongo_compat.c" role="src" />
- <file md5sum="3ba4b84d903f9d6bc17d87fdce7a6a96" name="phongo_compat.h" role="src" />
- <file md5sum="5bc800c33eadb9a62afddaf6133c5d36" name="phongo_version.h" role="src" />
+ <file md5sum="3e56a8b63e941ad445466b3e7f18bd8d" name="config.m4" role="src" />
+ <file md5sum="54628b5fe83bac19f3759e919c876ab2" name="config.w32" role="src" />
+ <file md5sum="e8994ca60f1694cce4dd016f5b2a6cfc" name="phongo_compat.c" role="src" />
+ <file md5sum="d89d108698f6a4ba3b36a7b4c642417e" name="phongo_compat.h" role="src" />
+ <file md5sum="dc2972cd852f4fb59292b32797a94007" name="phongo_version.h" role="src" />
<file md5sum="3239fe58ab586acf0d942629fd210b90" name="php_bson.h" role="src" />
- <file md5sum="ef6c986a54b10ad2b8e07026d5264e93" name="php_phongo.c" role="src" />
+ <file md5sum="3e440c6fd6a8ee882cb6408cd893994e" name="php_phongo.c" role="src" />
<file md5sum="e4c3b3d58237efbe2eff962cf224a971" name="php_phongo.h" role="src" />
- <file md5sum="2a6d7e8c1627e96625a8e3d893a1a192" name="php_phongo_classes.h" role="src" />
- <file md5sum="d4285f6453217854e078d39dab046ebf" name="php_phongo_structs.h" role="src" />
+ <file md5sum="753d80b5d9b3ad7b90b6757da53bb109" name="php_phongo_classes.h" role="src" />
+ <file md5sum="910cc38a3b0057c9d2d4a0a4acd039cd" name="php_phongo_structs.h" role="src" />
</dir>
</contents>
<dependencies>
<required>
<php>
<min>7.0.0</min>
- <max>7.99.99</max>
+ <max>8.99.99</max>
</php>
<pearinstaller>
<min>1.4.8</min>
</pearinstaller>
</required>
</dependencies>
<providesextension>mongodb</providesextension>
<extsrcrelease />
</package>

File Metadata

Mime Type
application/octet-stream
Expires
Fri, Sep 12, 10:30 PM (1 d, 18 h)
Storage Engine
chunks
Storage Format
Chunks
Storage Handle
sSlkU53VGLIK
Default Alt Text
(4 MB)

Event Timeline