Previous initialization during MINIT and using the accessor macro was causing crashes in Apache.
This also declares externs for TSRMLS_CACHE, as is done in other extensions.
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.
Clients will be hashed by Manager constructor arguments. Since they must persist between requests, the Manager destructor will no longer free the client and we'll need to start using persistent memory allocation for libbson and libmongoc.
BSON conversion of uriOptions moves to phongo_manager_init(). Merging of stream context options into driverOptions and removal of the context resource is now done in the Manager constructor.
phongo_manager_init() now has zvals for both uriOptions and driverOptions and will be able to serialize them with the URI string for a client hash.
This function was only used by UTCDateTime::toDateTime(), so it does not need to be in php_phongo.c. Additionally, this commit removes the platform-specific spprintf patterns in favor of the portable PRId64 pattern.
This adds range checking to Timestamp's constructor and changes Timestamp::__toString() to print the components as unsigned 32-bit integers. Internal structs and functions were changed to use uint32_t for readability.
32-bit platforms will be limited to the range of signed 32-bit integers, since PHP has no unsigned integer type. This will be documented in PHPC-599.