599 Commits

Author SHA1 Message Date
Jeremy Mikola 1d70e1a3f5 PHPC-1683: Collect WCE error labels in libmongoc bulk write replies
Also adds additional type and error checking to phongo_exception_append_error_labels.
2020-09-16 11:59:54 -04:00
Jeremy Mikola 09a8b87b31 clang-format changes 2020-07-08 13:57:10 -04:00
Jeremy Mikola 36d3e70982 PHPC-1648: Validate directConnection in URI options array 2020-07-08 13:55:30 -04:00
Jeremy Mikola 354bcc9441 PHPC-1598: Fix get_gc handlers for classes with get_properties
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.
2020-05-19 18:14:53 -04:00
Andreas Braun 607b91cefd PHPC-1533: Handle OCSP URI options 2020-05-19 20:21:50 +02:00
Jeremy Mikola d97a66a545 PHPC-1313: Support Zstandard compression 2020-05-13 10:56:14 -04:00
Jeremy Mikola b9627c91dd PHPC-1614: Consult SIZEOF_ZEND_LONG instead of SIZEOF_LONG 2020-05-11 17:43:08 -04:00
Andreas Braun 0fa7df90f4 Fix wrong exception when using external auth source 2020-04-29 12:55:53 +02:00
Andreas Braun cc5d7697b7 PHPC-1591: Add tests for allowed cases when authSource is given but username is not 2020-04-22 12:39:34 +02:00
Andreas Braun 0f7fb930d8 PHPC-1494: Fix wrong platform version in handshake 2020-03-25 13:20:41 +01:00
Andreas Braun 895fcf4bbc PHPC-1494: Add driver option to pass additional handshake data 2020-03-20 14:26:38 +01:00
Andreas Braun 8b031b5e5c PHPC-1494: Defer appending handshake data until manager creation 2020-03-19 16:06:50 +01:00
Andreas Braun 339ddb5204 PHPC-1510: Expose error labels from write concern errors 2020-03-09 19:43:00 +01:00
Andreas Braun 6ae4d9d387 PHPC-1483: Add support for MONGODB-AWS auth mechanism 2020-03-09 13:07:13 +01:00
Andreas Braun 707da29722 PHPC-1442: Remove empty TSRMLS macros 2020-02-11 14:06:10 +01:00
Andreas Braun b7e4a8e718 PHPC-1442: Remove obsolete macros from phongo_compat.h 2020-02-11 14:06:10 +01:00
Andreas Braun 0a97306bc3 PHPC-1442: Remove obsolete str_efree macro 2020-02-11 14:06:10 +01:00
Andreas Braun 394c325081 PHPC-1442: Drop conditionals for PHP 5 support 2020-02-11 14:06:10 +01:00
Remi Collet 6b0210999d PHPC-1551: Fix build with system libraries 2020-02-04 19:18:47 +01:00
Andreas Braun b8c8523e1c PHPC-1545: Improve checks for invalid encryption option types 2020-01-30 15:00:17 +01:00
Andreas Braun 78fb41572d PHPC-1540: Destroy persistent clients in reverse order to prevent segmentation faults 2020-01-27 20:35:47 +01:00
Andreas Braun 78638e019c PHPC-1539: Use mongoc error types over generic int 2020-01-27 19:31:39 +01:00
Andreas Braun 4a9eecfbd6 PHPC-1539: Introduce EncryptionException class 2020-01-27 19:31:39 +01:00
Andreas Braun f0372a50c5 PHPC-1499: Implement ClientEncryption::decrypt 2020-01-22 08:18:32 +01:00
Andreas Braun 4d7b35ee69 PHPC-1499: Implement ClientEncryption::encrypt 2020-01-22 08:18:32 +01:00
Andreas Braun e65a933c8f PHPC-1499: Implement ClientEncryption::createDataKey 2020-01-22 08:18:32 +01:00
Andreas Braun 4923bdd97b PHPC-1499: Add empty ClientEncryption class 2020-01-22 08:18:32 +01:00
Andreas Braun 08bac1e5ec PHPC-1498: Throw exception when configuring autoEncryption options without FLE 2020-01-16 09:23:25 +01:00
Andreas Braun 123f9b0b88 PHPC-1498: Read auto encryption options from driverOptions 2020-01-16 09:23:12 +01:00
Andreas Braun a19fdb0fbd PHPC-1500: Replace manager instance with client hash for hashing 2020-01-16 09:04:30 +01:00
Andreas Braun b65ee367cb PHPC-1500: Store client hash in manager struct 2020-01-16 09:04:29 +01:00
Jeremy Mikola 9ecb50a7e6 PHPC-1274: Reset client after forking for Cursor and Session
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.
2020-01-10 17:28:48 -05:00
Andreas Braun 94bb265ec9 Run clang-format on existing sources 2020-01-08 13:41:53 +01:00
Andreas Braun 7cea21a25a PHPC-1496: Add support for compiling with libmongocrypt 2020-01-08 12:41:41 +01:00
Jeremy Mikola 366dcbe7d2 PHPC-1411: Prefer integer types for wtimeout when possible
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.
2019-12-19 06:51:06 +01:00
Andreas Braun cdff70faf6 PHPC-1411: Accept 64-bit integers for wTimeoutMS 2019-12-19 06:50:41 +01:00
Andreas Braun 20db35ac2d PHPC-1446: Implicitly enable TLS when any TLS-related driver option is set 2019-11-14 09:02:22 +01:00
Andreas Braun 0cee16306c PHPC-1472: Return status of php_phongo_server_to_zval 2019-11-07 07:16:49 +01:00
Andreas Braun 2f88011450 PHPC-348: Check for errors after calling bson_to_zval() 2019-10-28 15:37:12 +01:00
Andreas Braun fafe50330e PHPC-1074: Refactor php_phongo_bson_state initializers 2019-10-25 10:46:28 +02:00
Andreas Braun 5e53ac9aab PHPC-1430: Deprecate obsolete driver options 2019-10-25 10:45:51 +02:00
Andreas Braun bacb0feb55 PHPC-952: Move BSON type initiators to bson.c 2019-10-21 09:52:46 +02:00
Andreas Braun 0dbadbb4e8 PHPC-1347: Do not allow empty string for replicaSet 2019-10-21 07:39:13 +02:00
Andreas Braun 56a9f43ab6 PHPC-870: Use ZEND_HASH_FOREACH indirect macros where applicable 2019-10-17 15:56:38 -04:00
Andreas Braun 8b5553f66a PHPC-966: Explicitly initialize fields for internal class structs 2019-10-07 16:22:15 +02:00
Andreas Braun 4fa3d850a5 PHPC-991: Override safe and slaveok options correctly 2019-09-30 11:07:15 +02:00
Andreas Braun 42a674c9af PHPC-991: Handle duplicates in URI options array 2019-09-30 11:07:15 +02:00
Andreas Braun c1f3c909f1 Remove unnecessary parameter from php_phongo_make_uri 2019-09-30 11:07:15 +02:00
Andreas Braun d03f36227e PHPC-1290: Adapt server selection logic to respect session pinning 2019-08-28 20:10:46 +02:00
Andreas Braun ef16f97f6c PHPC-1288: Add checks for conflicting TLS options 2019-08-28 07:34:07 +02:00