* 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
* Fix APM and CSFLE tests for Windows CI
* Add Windows to GitHub CI and build DLLs for releases
* Add --enable-debug-pack configure opt to generate PDB files
* Reminder to check for Windows build artifacts before publishing releases
* Revise advice on publicizing releases
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.
Prohibit uninstantiatable classes in type maps, and ignore them when processing __pclass fields.
Utilize zend_get_object_type_case from PHP 8.2 for more helpful error messages in php_phongo_bson_state_fetch_class.
v1.14 pointed to libmongoc 1.14.2, which was released some time after the submodule target in the master branch (a dev commit before libmongoc 1.23.0). To resolve this conflict, the libmongoc submodule has been bumped to 1.23.0.
Note: a libmongoc 1.23.1 tag also exists, but that bump can be done in a subsequent PHPC ticket related to the libmongoc changes therein.
This also adds a section to CONTRIBUTING.md to provide guidance on resolving submodule merge conflicts.
* PHPC-2121: Skip failing test
* Add todo comment to SKIPIF check
Co-authored-by: Jeremy Mikola <jmikola@gmail.com>
Co-authored-by: Jeremy Mikola <jmikola@gmail.com>
* Match error message variations between libmongoc 1.23+ and older
This typo was corrected in mongodb/mongo-c-driver@1d7229f0e9 and will appear in the 1.23.0 release.
* PHPC-2103: Report loaded crypt_shared version in phpinfo()
* PHPC-2132: Fix pattern for matching phpinfo() values
This also fixes the injection logic in create_test_manager(), which should only kick in when "autoEncryption" opts are specified (as PHPLIB does) and check for a valid $driverOptions structure (to accomodate manager-ctor error tests).
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>
* Test on PHP 8.2
* Fix tests relating to dynamic properties
* Fix tests failing due to different __set_state output
* Duplicate clone test without dynamic properties for PHP >= 8.2
* Add missing macros for declaring arguments
* Add macros to define disabled constructor and __wakeup
* Define arginfo via stubs for BSON classes
* Declare tentative return types in interfaces
* Add correct return type for __set_state methods
* Generate class entries for BSON classes
* Declare Binary class constants in stub file
* Use stubs in exception classes
* Add stubs for monitoring classes
* Fix wrong JsonSerializable class in BSON stubs
* Disable declaration-after-statement
This is necessary to let the generated arginfo files compile
* Use stubs for driver classes
* Fix deprecation messages in tests
* Add missing macro
* Fix tests relying on value injection
* Parse parameters in disabled constructor/wakup function
* Add note about arginfo files to contribution docs
* Add GitHub action to check generated arginfo files
* PHPC-2115: Use DateTimeInterface in UTCDateTime constructor signature
* Don't install mongodb extension in GitHub actions workflows
* Change indentation in stub files
* Use individual #if conditions for each stub method
* Make disabled constructor/wakeup methods static
* Fix bulkWrite parameter name
* Use %d to match property count in tests
* Ensure all classes with disabled serialisation declare __wakeup
* 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.
* Use non-breaking space in OS axis labels
* Revise titles and Manager construction in autoEncryption tests
* Define CSFLE_KEY_VAULT_NS and CSFLE_LOCAL_KEY constants
The value for CSFLE_KEY_VAULT_NS is based on the example from PHPLIB-826. This was not required but helps makes all tests consistent and will make it easier if we need to add functionality to a helper to drop the key vault collection before a test.
Using CSFLE_LOCAL_KEY allows removal of a duplicated string literal in various CSFLE tests. Although the new constant wasn't required for all tests (empty strings worked fine to satisfy option validation), using a constant helps ensure consistency across the test suite.
Also use create_test_manager() in more places when basic.inc is included. The remaining instances of direct Manager construction should only be in tests where basic.inc isn't used.
* 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
* Remove pre-3.6 server versions from Evergreen matrix
* Remove skipped tests for pre-3.6 servers
* Remove old mongo-orchestration configs and Evergreen tasks
* Remove flaky replica set tests
These tests assume a particular replica set member is always the primary, so tag assertions may fail if a different member is elected. The server-getTags-002.phpt test has more flexible assertions for replica set tags, so we can safely remove these tests.
"nocache" output from skip_if_not_clean may cause "skip" output from other functions to be ignored. Changing the order so that skip_if_not_clean is always called last will fix this in most cases (excluding tests that call skip_if_not_clean multiple times).
* PHPC-2047: Update load balancer testing config
Upstream changes in drivers-evergreen-tools now require passing LOAD_BALANCER to run-orchestration.sh. Additionally, service ID mocking is no longer required as of server version 5.1.
* Add missing live server checks in tests
* PHPC-2023: Allow observation of TopologyClosedEvent
Observation is only possible for non-persistent clients freed before RSHUTDOWN. This change also allows for reliable testing of ServerClosedEvent.
* PHPC-2030: Test observation of commands issued during client destruction
Command monitoring events can only be observed for non-persistent clients freed before RSHUTDOWN.