* Extract bson to json conversion logic
* PHPC-326: Add class to represent raw BSON document
* PHPC-326: Add class to represent raw BSON array
* Typemaps now support raw BSON type
* Short-circuit encoding of BSON zvals
* PHPC-324: Add BSONIterator class
* Polyfill zend_array_is_list on PHP < 8.1
* Add offset accessors to BSON classes
* Add more tests around iterators and fetching offsets
* Remove compare handler for BSONIterator
* Rename BSONArray to ArrayList
* Rename BSONDocument to Document
* Rename BSONIterator to Iterator
* Implement Document::fromBSONString
* Test BSON document in bson-corpus tests
* Fix ArrayList handling of BSON arrays with wrong keys
* Address code review for bson-corpus tests
* Address code review in ArrayList
* Address code review for Document
* Address code review for Iterator
* Allow BSON iterators to be rewound
* Address code review in tests
* Fix comment explaining php_phongo_bson_append_object
* Remove obsolete php_phongo_bson_append_zval
* More review changes to tests
* Return base64 encoded data when debugging BSON classes
* Allow serialisation of Document and ArrayList
* Add test for iterating past the end of a structure
* Update exception message to contain class name
* Make BSON pclass handling test more complete
* Fix wrong handling of type map in nested structures
* Ensure objects are backed by actual memory
* Validate UTF-8 BSON data before returning it
* Allow ArrayList::toPHP() to accept a different root type map
* Ignore null return type for invalid BSON iterators on PHP < 8
* Throw when calling get on non-existing BSON offsets
* Remove unnecessary length from serialised output
* Refactor names around type map handling
* Use short array syntax in new tests
* Improve test descriptions
* Restructure BSON iterator tests
* Expand BSON class serialisation tests
* Throw exception when iterator is exhausted
The previous method relied on the type system of PHP to throw an exception when accessing the key of an exhausted iterator, but this does not work on non-debug versions of PHP.
* Update test description
* Rename ArrayList class to PackedArray
Revert previous enum instantiation behavior and PersistableEnum trait from de5f1e5a93
Backed enums will be encoded as their case value. Non-backed cannot be encoded and no enums can be encoded at the root level.
Prohibit enums from implementing Persistable and Unserializable.
Enums serialize like PHP objects with a "name" property (BackedEnum instance will also have a "value") and thus become BSON documents. In order for a document to unserialize back to an enum, it must implement either Unserializable or Persistable. The bsonUnserialize() method serves no purpose for initialization, but it will still be invoked.
This introduces a PersistableEnum trait, which can be used for both Unserializable or Persistable implementations.
Co-authored-by: Sara Golemon <pollita@php.net>
* Define additional constants in mongocrypt-export.h
* PHPC-2104: ClientEncryption::QUERY_TYPE_EQUALITY is a string
Downstream change since MONGOC_ENCRYPT_QUERY_TYPE_EQUALITY was changed to a string type.
Bumps libmongocrypt submodule to 1.5.0-rc2. Related to this bump, mongocrypt.h is no longer generated.
Bumps libmongoc submodule to 1.22-dev.
* PHPC-2049: Bump libmongoc and libmongocrypt submodules
libmongoc master (1.22-dev) now depends on libmongocrypt master (1.5-dev).
libmongoc's bundled zlib library was updated to 1.2.12.
* PHPC-2049: BulkWrite and Query support comment option of any type
MongoDB 4.4+ allows a comment option of any type on most commands. Previously, find required a string type and write commands did not support comment at all. The driver does not validate the option and relies on the server to raise an error.
* Fix title and variable access in BulkWrite and Query let option tests
* Fix grammar in php_phongo_bulkwrite_delete_apply_options comment
* Undefine additional Query option macros
This also cleans up header includes throughout the project. The order follows: libbson, libmongoc, libmongocrypt, PHP, contrib (e.g. PHP array API), internal modules (e.g. php_phongo.h, phongo_bson.h), and class headers. Quoted strings are used for all but PHP includes, which are always sourced from system directories.
php_phongo.h is now responsible for including config.h and assigning the default logging domain.
* PHPC-1805: Implement ServerDescription class
* PHPC-1910: Implement Server::getServerDescription()
* PHPC-1934: Check for uninitialized intern in ServerDescription get_properties_hash
* PHPC-1925: Change ServerDescription::getType() to return a string
* PHPC-1891: Implement TopologyDescription class
* PHPC-1892: Implement SDAMSubscriber interface
* PHPC-1893: Implement SDAM event classes
* Revise server and topology event classes and tests
Use phongo_objectid_init in getTopologyId() methods. Report topologyId as an ObjectId in debug info. Report TopologyDescription servers as ServerDescription in debug info.
Copy parameters in phongo_serverdescription_init and phongo_topologydescription_init for consistency with other functions (e.g. phongo_readconcern_init). This also creates phongo_serverdescription_init_ex for when we want to skip copying in Server::getServerDescription().
* PHPC-1953: Add tests for debug handlers
* PHPC-1959: Utilize Manager::addSubscriber() in tests
Skip TopologyClosedEvent test (pending PHPC-2023)
* PHPC-1958: Assert same topologyId for SDAM events
* PHPC-2025: Support load balancer in ServerDescription and TopologyDescription
* PHPC-2026: Handle 64-bit lastUpdateTime for 32-bit platforms
Co-authored-by: Tanli Su <46271307+tanlisu@users.noreply.github.com>
Co-authored-by: Andreas Braun <git@alcaeus.org>
Co-authored-by: Tanli Su <tanli.su@gmail.com>
This allows PHPC to defer entirely to libmongoc for cross-option URI validation
Bump libmongoc to 1.21-dev
Build changes are ported from upstream CMake changes (see: CDRIVER-4249)
This also consolidates INI functions (and trace logging) into a separate file and ensure that mongoc logging is disabled during GSHUTDOWN (avoiding a potential segfault).
Enable service ID mocking when testing load balancers with HAProxy.
* Bump libmongoc to 1.19-dev
* PHPC-1890: Constant for ReadConcern snapshot level
* Move Manager::startSession() error test and delete obsolete test
The deleted error test was redundant. It was originally created in ca4c52eb1c to work around changes in PHP 8, but 60febd0f28 subsequently reintroduced a portable version of the test case.
Also adds missing SKIPIF to startSession test.
* PHPC-1889: Session snapshot option
* PHPC-1875: Session with snapshot=true cannot perform writes
* PHPC-1876: Session with snapshot=true requires MongoDB 5.0+
* Use zend_exception_ce instead of zend_exception_get_default()
zend_exception_get_default() has been deprecated since PHP 7.0. See: php/php-src@f9e9d3a437
* Check retval from php_phongo_set_monitoring_callbacks
This ensures that php_phongo_client_register is never called in the event this method fails (however unlikely).
* Index subscriber HashTable by numeric object handles
This also updates add/removeSubscriber to use the new argument parsing macros from deead9687e.
* PHPC-1804: Manager::addSubscriber and removeSubscriber
Implements per-client event subscribers. Moves existing APM code to a new phongo_apm.c module and adds logic to coordinate dispatching between global and per-client subscribers.
* Introduce MongoDB\Driver\ServerApi
* Accept serverApi driver option
* Introduce create_test_manager factory to create manager
A centralised entry point is required to inject the API_VERSION env variable later.
* Add build variant to test with requireApiVersion=true
* Fix wrong configuration for auth variable
This changed when migrating from our own scripts to drivers-evergreen-tools and was not updated properly, causing all tests to run with auth disabled.
* Declare ZEND_PARSE_PARAMETERS_NONE macro
This macro is missing on PHP < 7.3
* Remove duplicated API param storage
* Add missing semicolons
* Add ZEND_PARSE_PARAMETERS_NON_EX macro
* Extract error handling functionality to separate macros
* Throw if internal mongoc_server_api_t is already initialised
* Use imported namespaces in tools file
* Fix type info for reflection
* Use American English spelling
* Only use typed serialize signature on PHP 8+
* Update PHONGO_PARSE_PARAMETERS_NONE macro for PHP < 7.3
* Remove usage of ZEND_STRL within zend_hash_str_add
This causes compile failures on PHP < 7.3 that I have yet to understand.
* Fix errors in new PHONGO_PARSE_PARAMETERS macros
* PHPC-1704: Check for standard and date extensions on Windows builds
In PHP 8, PHP 7.3.25+, and PHP 7.4.13+, ADD_EXTENSION_DEP can correctly check for the date and standard extensions. On older versions, we have to continue to assume that these extensions are in fact installed.
* Be more "adventurous" with version checks
Co-authored-by: Christoph M. Becker <cmbecker69@gmx.de>
Co-authored-by: Christoph M. Becker <cmbecker69@gmx.de>
* PHPC-1420: Fix stack smashing when using mixed replica set config
* Support new debug assertion switch for libmongoc
* Only set MONGOC_ENABLE_DEBUG_ASSERTIONS when compiling against bundled libs
FSO.CreateFolder does not create parent directories if they do not exist, which means generate_files() (from configure.js) can fail for sources in nested paths.
Use int64_t API for wTimeoutMS. The initial commit for CDRIVER-3087 deprecated the int32_t API for wTimeoutMS. Migrate to the int64_t API to avoid deprecation warnings. Note: PHPC (and libmongoc's URI parsing) still require 32-bit values for wTimeoutMS, so this does not affect users. Having said that, PHPC-1411 may introduce support for 64-bit values and necessitate changes to the code where we read wTimeoutMS values.
Use mongoc_uri_get_tls to read tls/ssl URI option. As part of CDRIVER-2869, libmongoc deprecated mongoc_uri_get_ssl and introduced a "tls" alias. Migrate to the new API to avoid deprecation warnings.
Expect lowercase URI option in error. As part of CDRIVER-2869, libmongoc does case-folding on option keys to facilitate deduplication.
Per src/libmongoc/doc/installing.rst, the VERSION_CURRENT and VERSION_RELEASED files must now be generated. This requires Python and the GitPython pip module to run src/libmongoc/build/calc_release_version.py. A new libmongoc-version-current Makefile target has been added.