593 Commits

Author SHA1 Message Date
Jeremy Mikola 06778c6928 PHPC-901: False slaveOk URI option should be ignored 2017-03-06 12:14:44 -05:00
Jeremy Mikola 0c5d4f36f3 Regression tests for slaveOk URI option 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 0244d19cd3 PHPC-923: Use zend_string_release() to free class names 2017-03-03 09:41:58 -05:00
Jeremy Mikola 139ad8e12c PHPC-924: Avoid unnecessary BSON conversion in Cursor::setTypeMap() 2017-03-03 09:23:02 -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 59dc7c7ebf Remove obsolete tests for PHPC-487
These tests were originally written with the PHP stream handler in mind, which is no longer used in 1.2.0+.
2017-02-08 14:19:43 -05:00
Jeremy Mikola 44ac5c4889 Manager debug ouput tests should not depend on libmongoc tracing
These tests were fragile and could fail when using libmongoc as a system library where tracing may not be enabled.
2017-02-07 18:43:23 -05:00
Jeremy Mikola 6ed6a34f5b Only assert mongodb.debug INI in phpinfo() tests
The current phpinfo() tests were fragile and not compatible when build against libbson/libmongoc system libraries, which might also have different SSL options.
2017-02-07 16:37:12 -05:00
Jeremy Mikola 04bd60be63 Make JavaScript::jsonSerialize() tests portable for libbson 1.5 and 1.6 2017-02-07 16:34:10 -05:00
Jeremy Mikola 8edd0c9034 Do not assert error message in fromJSON() error test
libbson 1.6.0 switched JSON parsers, which means this test fails when compiled against libbson 1.6.0 as a system library. Removing the error message assertion keeps the test portable.
2017-02-07 16:31:54 -05:00
Jeremy Mikola e3c4439ae3 Remove Manager::executeBulkWrite() insert error test
In libmongoc 1.6.0, insert documents are validated during BulkWrite::insert(). This is a fragile test that fails when v1.2 is compiled against libmongoc 1.6.0 as a system library.
2017-02-07 16:30:04 -05:00
Jeremy Mikola 77be3df93d Manager::executeQuery() without assignment test is obsolete
Testing query execution without return value assignment is already handled by tests/query/bug0705-001.phpt.
2017-02-07 16:28:41 -05:00
Jeremy Mikola 1cfffa5589 Use exactly representable floating point numbers in tests
CDRIVER-1945 increased the precision when rendering floating point numbers in JavaScript. Using numbers that can be exactly represented in floating point will allow us to keep the expected output consistent with our input.
2017-02-07 15:22:54 -05:00
Jeremy Mikola 0d0561a022 PHPC-898: Regression tests for readConcern option and getMore 2017-01-30 17:12:42 -05:00
Jeremy Mikola 8456780ac9 PHPC-894: Implement get_gc handlers for BSON classes
This addresses a memory leak if gc_possible_root() were to invoke the existing get_properties handlers.
2017-01-23 20:39:57 -05:00
Jeremy Mikola 937a2c2b37 PHPC-714: Expected failures for BSON corpus tests 2017-01-13 15:05:42 -05:00
Jeremy Mikola 44f54d9717 PHPC-714: Generate BSON corpus tests
Generated from mongodb/specifications@784379e0c1
2017-01-13 15:05:41 -05:00
Jeremy Mikola 56f3a9da74 PHPC-714: Script to convert BSON corpus tests 2017-01-13 15:05:41 -05:00
Jeremy Mikola 84dbfe07f7 PHPC-891: BSON encoding should throw if PHP keys contain null bytes
Since PHP uses leading null bytes in object properties to denote protected and private members, we ignore those keys in lieu of throwing an exception.
2017-01-10 12:00:49 -05:00
Jeremy Mikola caa4650f73 PHPC-886: Always recalculate field name length when encoding BSON 2017-01-10 12:00:49 -05:00
Jeremy Mikola b3b3a550e4 PHPC-884: Do not skip public property with empty string name during BSON encoding
This removes our is_public_property() helper function in favor of a simpler check on the mangled property name (as done by PHP's json_encode() function).
2017-01-10 12:00:49 -05:00
Jeremy Mikola 3a4da1c74c PHPC-883: BSON array keys should be disregarded during visitation 2017-01-09 11:15:39 -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 3beadc7c12 DateTime from current time now includes microseconds in PHP 7.1 2016-12-13 15:02:35 -05:00
Jeremy Mikola 081331ee2b Update closed socket test for libmongoc stream handling
The previous error message was based on PHP's stream handlers, which are no longer used in 1.2.x.
2016-12-13 14:29:00 -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 0dd057d4d7 PHPC-849: Fix leaking of current element in setTypeMap() 2016-12-12 12:59:00 -05:00
Jeremy Mikola 99f4cbc673 Merge branch 'v1.1' 2016-12-07 12:26:07 -05:00
Jeremy Mikola 129753881a PHPC-848: Consult ZEND_HASH_APPLY_PROTECTION() in PHP7
When a numeric array was encoded to BSON, the hash's apply counter was incremented and decremented irrespective of whether apply protection was enabled. This was not compatible with immutable arrays, which may be created by OPcache. We now consult ZEND_HASH_APPLY_PROTECTION() whenever an apply counter might be modified.

Previously, object_to_bson() incremented the apply counter when converting a MongoDB\BSON\Type instance. Associative arrays and other objects were not protected. This patch adds recursion checking for those types.

Since PHP7 already has macros for working with the apply counter, this patch adds equivalent macros for PHP 5.x.
2016-12-07 10:55:59 -05:00
Jeremy Mikola 8b173d90d9 PHPC-654: Javascript comparison handler 2016-11-28 12:49:12 +01:00
Jeremy Mikola ae987ca82f PHPC-654: UTCDateTime comparison handler 2016-11-28 12:49:12 +01:00
Jeremy Mikola 7a12b863ba PHPC-654: Timestamp comparison handler 2016-11-28 12:49:12 +01:00
Jeremy Mikola bdb5f3c6ba PHPC-654: Regex comparison handler 2016-11-28 12:49:12 +01:00
Jeremy Mikola 994a1dac7b PHPC-654: Binary comparison handler 2016-11-28 12:49:12 +01:00
Jeremy Mikola 94666833cc PHPC-654: Regression tests for MaxKey and MinKey comparisons 2016-11-28 12:49:12 +01:00
Jeremy Mikola 70d7186d63 PHPC-654: Regression tests for ObjectID comparisons 2016-11-28 12:49:12 +01:00
Jeremy Mikola 5c63b8d229 PHPC-838: Preserve scope when serializing Javascript to BSON 2016-11-28 11:32:01 +00:00
Jeremy Mikola 9eb4a80d2e PHPC-459: Update Javascript::jsonSerialize() tests for CDRIVER-1335
The expected output of bson-javascript-jsonserialize-004.phpt is logically incorrect because of an outstanding bug where Javascript objects are always serialized to BSON code types, irrespective of their scope property. That issue will be fixed by PHPC-838.
2016-11-28 11:32:01 +00:00
Derick Rethans 43b06f0ca3 PHPC-827: Update Max Staleness implementation 2016-11-28 11:32:01 +00:00
Jeremy Mikola a916713e4a Remove 64-bit platform requirement 2016-11-23 13:06:24 -05:00
Jeremy Mikola 6fd69afc1f PHPC-790: UTCDateTime constructor should truncate floats 2016-11-23 13:06:24 -05:00
Jeremy Mikola 8d7e358330 PHPC-804: Relax zpp types in Timestamp and UTCDateTime constructors
Changing "s" to "z" in zend_parse_parameters() allows integers to be accepted in strict types mode. If all necessary parameters are integers, we can also skip conversion to a string and back to a 64-bit integer.
2016-11-23 12:15:37 -05:00
Jeremy Mikola 1f785d2cb1 Use consistent string parsing for Timestamp and UTCDateTime init
bson_ascii_strtoll() will support range checking in libbson 1.5.0 (CDRIVER-1377), so there is no longer any benefit of using _atoi64() on Windows. This will make parsing consistent across both platforms, since _atoi64() does not report errors for non-integer strings (e.g. "1.2").
2016-11-22 15:32:32 -05: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 dd1a758f00 PHPC-829: BSON Regex flags must be alphabetically ordered
We do not test that MongoDB\BSON\fromJSON() alphabetizes the flags, as that will be handled by CDRIVER-1883.
2016-11-22 11:09:01 -05:00
Jeremy Mikola 96f24c9d61 PHPC-459: BSON types implement JsonSerializable 2016-11-16 12:09:34 -05:00