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 is necessary since PHP's add_assoc_string_ex() declares the argument as char *, even though it never modifies the string contents and later assigns it to a const char * internally. Since we always duplicate the string for PHP 5.x and it is never modified in PHP 7, there is no harm in this cast.
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 changes behavior of var_dump(), var_export(), and serialization.
Additionally, this renames the internal struct fields to be consistent with the publicized property names.
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.