* 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
* 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.
* Re-enable PHP 8.1 build on GH Actions
* Work around different error wording in PHP 8.1
* Limit failing tests to PHP < 8.1
* Add tests for PHPC-1839 for PHP >= 8.1
* Add __serialize and __unserialize methods to Serializable classes
These methods will be used on PHP 7.4+ when available. Implementing them is required to suppress a deprecation notice on PHP 8.1+.
This commit also renames is_debug parameter for get_properties_hash utility functions (and related macros) to more accurately reflect its purpose of allocating a new HashTable instead of using an internal props table.
* Explicitly handle serialize output in php_phongo_cursorid_get_properties_hash
* Explicitly handle serialize output in php_phongo_writeconcern_get_properties_hash
* Note maxStalenessSeconds handling in php_phongo_readpreference_get_properties_hash
* CursorId should always serialize id as string
* 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
The ReadConcern, ReadPreference, WriteConcern, and BSON classes have no properties beyond pointers to libmongoc/libbson structs; however, all of these classes use get_properties to report fields for var_export (PHPC-850, PHPC-460).
The standard get_gc handler defers to get_properties to collect other zvals for GC inspection. This is problematic for the aforementioned get_properties handlers, since a HashTable of zvals intended for debugging will be returned and those properties will already be freed by our free_object handler (via FREE_HASHTABLE).
Having each class define its own get_gc handler is the first step to fixing this issue. The BSON classes already defined their own get_gc handlers, but erroneously returned the internally cached properties directly.
The second step to fixing this issue is ensuring that get_gc delegates to zend_std_get_properties, as is done in various PHP core extensions. Doing so ensures that we do not leak other zvals that may be assigned as public properties by the application (covered by the second regression test), since zend_std_get_properties will return those for GC inspection.
Execute options are now parsed via php_array functions, which makes the options case-sensitive.
A helper function is now used to convert legacy options for the original three execute methods into an array. This simplifies option parsing in php_phongo.c.
Additionally, Manager methods now perform their own server selection, which means that execute functions in php_phongo.c can rely on a server_id being provided.
Tests have been updated to expect a serverId option when relevant (e.g. query opts). Additionally, error tests for execute methods have been improved so that invalid values for all known options are tested.
This primarily fixes a bug introduced in 6d46d62577 for PHPC-359, since we convert tag sets from arrays to objects to ensure proper BSON serialization. Not only was the array mutation visible to calling contexts, but a crash could occur if the array was immutable due to OPcache.
For Manager's $driverOptions, a comment in 1060cb8ba4 for PHPC-433 indicated that we should have separated its zval due to possible modification, but the appropriate zend_parse_parameters() flag was never used.
This adds an options array to the ReadPreference constructor, which accepts a maxStalenessMS option. The option is also exposed via a getter method and in debug output.
This adds common validation for read preference tag sets when specified through either the Manager constructor's URI options array or ReadPreference constructor.
An additional test case for a malformed tag set has been added to the Manager::__construct() error test for read preference options. Additionally, the ReadPreference::__construct() error test has been split up to test for mode and tagSet errors separately.
Note: we cannot test for the exceptions for bson_init_static() and mongoc_read_prefs_is_valid(), since those points will never be hit in normal operation.
This also entails a change to done/end_of_event cursor field assertions. These are internal libmongoc cursor fields and their values aren't relevant to the tests. In the future, we may consider removing them from the Cursor's dump output.