* 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
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 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.
* 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
* Replace client pointers on object structs with Manager references
* Request-scoped Manager registry for APM events
* Ensure Manager is registered regardless of persistent client
* Reset request-scoped clients when forking
* Test for freeing Manager during RSHUTDOWN via subscriber reference
Co-authored-by: Andreas Braun <git@alcaeus.org>
Check PID before creating/freeing a session or cursor to avoid interfering with resources owned by a parent process. Additionally, prohibit resetting a client multiple times to avoid cases where child resources may not be cleaned up.
For serialization, 64-bit wtimeout values will always be encoded as strings for portability. Debug output and bsonSerialize() can always use integers on 64-bit platforms and can fall back to strings and Int64 objects on 32-bit platforms, respectively.
This allows executeQuery() to throw a CommandException, which exposes the error document.
In 1.6+, it will also ensure that error labels are set on any RuntimeException thrown during cursor iteration, which is relevant for transactions.
executeBulkWrite() will now throw a BulkWriteException on top of any previous exception to ensure that a WriteResult can be attached. InvalidArgumentException is excluded, since that is only thrown before mongoc_bulk_operation_execute does IO (e.g. batch is empty).
This corrects the function signatures to return a boolean indicating success instead of an integer (which was cast from a boolean).
Additionally, it restructures phongo_execute_command() to use a cleanup label, in anticipation of implicit session changes.