411 Commits

Author SHA1 Message Date
Jeremy Mikola
5864a6306d PHPC-931: Ensure php_phongo_pclient_t is freed during MSHUTDOWN 2017-03-10 09:46:45 -05:00
Jeremy Mikola
06778c6928 PHPC-901: False slaveOk URI option should be ignored 2017-03-06 12:14:44 -05:00
Jeremy Mikola
600db56bd8 PHPC-912: Do not destroy persisted clients created by other processes 2017-03-06 12:13:33 -05:00
Jeremy Mikola
b55ea81fd6 PHPC-913: Child process should not re-use mongoc_client_t objects from parent 2017-02-13 17:21:39 -05:00
Jeremy Mikola
3ff292cbb8 PHPC-879: Remove dependency on php_date_get_immutable_ce() 2017-01-11 11:14:20 -05:00
Jeremy Mikola
997fe40f9c PHPC-878: Remove dependency on php_json_serializable_ce symbol
Since JsonSerializable is required, this also adds a helpful startup error message if json.so is not already loaded.
2017-01-11 11:14:20 -05:00
Jeremy Mikola
e9271bf8a9 PHPC-885: Alphabetize Regex flags when instantiating from BSON 2017-01-09 09:33:04 -05:00
Jeremy Mikola
2efc183b38 PHPC-890: Add license header copypasta 2017-01-06 15:41:58 -05:00
Jeremy Mikola
1badc1bcbb PHPC-633: Include libmongoc SSL, crypto, and SASL details in phpinfo() 2016-12-20 11:37:25 -05:00
Jeremy Mikola
b0192b29d6 Reorder libbson and libmongoc output in phpinfo() 2016-12-19 14:32:08 -05:00
Jeremy Mikola
2c4a1edd98 More descriptive labels for ext/dep versions in phpinfo() 2016-12-19 14:03:50 -05:00
Jeremy Mikola
2599607b47 PHPC-635: WriteResult debug handler should return objects 2016-12-19 09:40:29 -05:00
Jeremy Mikola
49e09578b7 Valid read preference tag sets should always be documents
This function was originally implemented in PHPC-424, before we started preparing tag sets in PHPC-359 to ensure that they serialized as BSON documents. There is no longer any reason to allow array types here.
2016-12-12 19:31:46 -05:00
Jeremy Mikola
120b270377 PHPC-851: Separate argument zvals before modification
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.
2016-12-12 19:31:45 -05:00
Jeremy Mikola
32b93dba33 Move cursor iterator handlers into Cursor.c 2016-12-12 12:59:00 -05:00
Jeremy Mikola
0bf726420b Use zend_hash ptr functions for PHP7 2016-12-12 12:57:41 -05:00
Jeremy Mikola
3daf370d4b PHPC-854: Initialize persistent client hash directly in GINIT
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.
2016-12-12 12:57:41 -05:00
Derick Rethans
c50d63d74f PHPC-533: Remove PHONGO_API macro for exported functions 2016-11-28 11:47:13 +00:00
Derick Rethans
43b06f0ca3 PHPC-827: Update Max Staleness implementation 2016-11-28 11:32:01 +00:00
Jeremy Mikola
6dc41c409f PHPC-676: Do not allow BulkWrite objects to be executed multiple times 2016-11-22 11:10:02 -05:00
Jeremy Mikola
342b7de4a9 PHPC-718: Define extension dependencies 2016-11-08 13:28:42 -05:00
Jeremy Mikola
6d46d62577 PHPC-359: Ensure RP tag sets serialize as documents 2016-09-26 10:53:21 -04:00
Jeremy Mikola
f37f589bbc PHPC-783: Use mongoc_collection_find_with_opts() for Query exec
Query struct fields have been consolidated to a filter and opts BSON documents.

This also changes the Query debug output significantly.
2016-09-20 16:57:20 -04:00
Jeremy Mikola
0160871af6 PHPC-752: Validate range of maxStalenessMS Manager option
This also adds various tests for parsing of read preference Manager options.
2016-09-19 16:54:48 -04:00
Jeremy Mikola
77209dd65d PHPC-752: Add maxStalenessMS to ReadPreference class
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.
2016-09-19 16:54:48 -04:00
Jeremy Mikola
467b981f95 Move (char *) casting to ADD_ASSOC_STRING macro
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.
2016-09-19 16:13:05 -04:00
Derick Rethans
8f9e6c8c53 PHPC-498: ReadPreference, ReadConcern, and WriteConcern should serialize to BSON 2016-09-19 20:33:14 +01:00
Jeremy Mikola
56d8b77b15 PHPC-424: Validate that RP tag set is an array of documents
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.
2016-09-15 12:40:27 -04:00
Derick Rethans
2cbbd69404 PHPC-786: Support appname in URI array options 2016-09-14 18:21:13 +01:00
Jeremy Mikola
8fbf0fa4db PHPC-605: Remove unused php-ssl.c contrib code 2016-09-14 10:29:36 -04:00
Jeremy Mikola
9717d5cac6 PHPC-605: crl_file is not supported by LibreSSL or Secure Transport 2016-09-08 11:10:35 -04:00
Jeremy Mikola
a5667e6c9a PHPC-605: Split exceptions for unsupported ca_dir and capath options 2016-09-08 11:10:34 -04:00
Jeremy Mikola
3036797f41 Use consistent memory allocation for write error messages
These strings were released with efree() in the object destructors and should be allocated with emalloc().
2016-09-08 11:10:34 -04:00
Jeremy Mikola
29e5121cb7 PHPC-433: Persist mongoc_client_t objects in a HashTable
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.
2016-09-08 11:10:34 -04:00
Jeremy Mikola
1060cb8ba4 PHPC-433: Refactor phongo_manager_init() option handling
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.
2016-09-07 18:08:19 -04:00
Jeremy Mikola
e5db9dd2ff PHPC-605: Fix exception logic for unsupported ca_dir option 2016-09-07 18:08:19 -04:00
Jeremy Mikola
c673e0aee2 PHPC-704: Do not set mongodb.debug from driver options
The mongodb.debug INI option is a global setting and should not be set based on a single Manager's constructor argument.
2016-09-07 18:08:19 -04:00
Derick Rethans
0ab5d5c74c PHPC-752: Allow users to set a limit on acceptable staleness 2016-08-31 14:41:58 -04:00
Derick Rethans
91aaf65b9d PHPC-757: Implement The MongoDB Handshake Protocol 2016-08-31 19:20:44 +01:00
Derick Rethans
24b65ca159 PHPC-619: Implement Decimal128 type (again) 2016-08-31 17:13:17 +01:00
Derick Rethans
7f761be64f Upgrade libbson and libmongoc to latest master (1.5.0-dev) 2016-08-31 12:28:02 +01:00
Jeremy Mikola
f7e2b09165 PHPC-605: Rely on libmongoc for socket IO and TLS 2016-08-30 14:04:56 -04:00
Jeremy Mikola
a6e7202498 PHPC-761: Remove BSON_NAMESPACE constant 2016-08-05 14:06:58 -04:00
ian boros
e545a5d52b PHPC-755: Remove include of private mongoc-trace.h 2016-07-29 18:13:58 -04:00
Jeremy Mikola
ff79f64177 PHPC-758: Disable Decimal128 for bundled libbson and libmongoc 1.4.0 2016-07-29 18:11:41 -04:00
Jeremy Mikola
5c65399eca Define ZSTR_VAL() for PHP 5 and remove phongo_str() macro 2016-07-14 11:27:18 -04:00
Jeremy Mikola
b3298a0efe PHPC-739: Rename "javascript" to "code" in Javascript BSON class
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.
2016-07-13 10:32:45 -04:00
Jeremy Mikola
10e1879357 PHPC-460: UTCDateTime serialization and var_export 2016-07-12 16:30:43 -04:00
Jeremy Mikola
0a32ce98fb PHPC-460: Timestamp serialization and var_export 2016-07-12 16:30:43 -04:00
Jeremy Mikola
4be966906a PHPC-460: Decimal128 serialization and var_export 2016-07-12 16:30:42 -04:00