566 Commits

Author SHA1 Message Date
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
Jeremy Mikola 7e895d5f04 Require REPLICASET test environment before using its constant 2016-10-24 14:17:25 -04:00
Jeremy Mikola 9ca935d9d0 PHPC-653: Tests for WriteResult methods 2016-10-24 14:17:25 -04:00
Jeremy Mikola e4b535b6aa PHPC-653: Tests for WriteError debug handler and methods 2016-10-24 10:02:28 -04:00
Jeremy Mikola c9a662d822 PHPC-653: Tests for WriteConcernError debug handler and methods 2016-10-24 10:02:28 -04:00
Jeremy Mikola b7dbc99be7 PHPC-805: Query "partial" option is now "allowPartialResults" 2016-10-20 16:07:26 -04:00
Derick Rethans 22a39d68f3 PHPC-313: BSON should throw when encountering 64-bit integer on 32-bit platform 2016-10-18 11:20:15 +01:00
Derick Rethans eb35da1c2c PHPC-788: Timestamp on 32-bit platforms breaks 2016-10-18 10:51:31 +01:00
Jeremy Mikola a267e05eb8 Comprehensive tests for RC, RP, and WC debug output and BSON serialization 2016-09-26 10:53:21 -04:00
Jeremy Mikola 6d46d62577 PHPC-359: Ensure RP tag sets serialize as documents 2016-09-26 10:53:21 -04:00
Jeremy Mikola 103aabed31 Add missing extends tests 2016-09-21 16:32:39 -04:00
Jeremy Mikola 1fabf41a57 Fix Manager extends test, which previously duplicated Query 2016-09-21 16:32:39 -04:00
Jeremy Mikola 97a26a18e7 Remove unnecessary SKIPIFs from extends tests 2016-09-21 16:32:39 -04:00
Jeremy Mikola eeb962c3a4 PHPC-734: Test for BulkWrite::delete() collation option error 2016-09-21 15:48:45 -04:00
Jeremy Mikola 5c1ca63957 Use EXPECTF pattern for stdClass ID 2016-09-21 15:33:53 -04:00
Jeremy Mikola 8d70686031 PHPC-705: Regression tests for superfluous $query wrapping 2016-09-21 12:09:46 -04:00
Jeremy Mikola 887f0670b8 PHPC-734: BulkWrite update and delete "collation" option 2016-09-21 10:57:29 -04:00
Jeremy Mikola 943a00ec43 PHPC-794: BulkWrite::update() should throw for invalid replace ops 2016-09-21 10:57:29 -04:00
Jeremy Mikola d6d4b1eeb4 PHPC-734: Query "collation" option 2016-09-20 16:57:20 -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
Derick Rethans 53dec68a77 Disable test for HHVM, as we don't have logging for this 2016-09-20 15:00:36 +01:00
Derick Rethans 4509d0f6f0 Skip this test on HHVM, as the timezone is 'UTC' there 2016-09-20 15:00:35 +01:00
Derick Rethans c2fe3b2089 Fixed __set_state whitespace compatibility issue with PHPC/HHVM tests 2016-09-20 15:00:22 +01:00
Jeremy Mikola 6ec5348957 Test that read preference options of the wrong type are ignored 2016-09-19 16:54:48 -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 eeb7c04d04 Remove unnecessary SKIPIFs from Manager ctor tests 2016-09-19 16:54:48 -04:00
Jeremy Mikola 701e07f9e5 Rename Manager ctor read preference and write concern tests 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