Commit Graph

1003 Commits

Author SHA1 Message Date
Jeremy Mikola f72b71be57 Merge pull request #78 2015-08-14 01:30:58 -04:00
Jeremy Mikola 0d73e362f9 PHPC-271: Server::executeBulkWrite() should take a write concern 2015-08-14 01:08:58 -04:00
Jeremy Mikola 9943341983 Merge pull request #77 2015-08-13 17:43:25 -04:00
Jeremy Mikola 960c51ace7 Split out Manager constructor error tests
The extra arguments test can be skipped for HHVM (as was done in #74).

The read preference and write concern tests attempt to cover all permutations of invalid arguments. Detailed exceptions are only possible where we apply array options to the structures, since libmongoc currently provides no detailed errors when URI parsing fails (see: CDRIVER-782).
2015-08-13 16:12:33 -04:00
Jeremy Mikola 17e6ff1950 Manager should check client pointer before destroying it 2015-08-13 16:12:33 -04:00
Jeremy Mikola 3b7f42b83d PHPC-196: Implement Manager getters for WC and RP 2015-08-13 16:12:33 -04:00
Jeremy Mikola 145ddda493 PHPC-353: Return early when there are no options to apply
This avoids copying the client's existing RP or WC struct for no reason.
2015-08-13 16:12:33 -04:00
Jeremy Mikola 01564891f9 PHPC-353: Support RP and WC in Manager options array
The read preference and write concern are complex structures, so we can't simply set their options on the URI as we do for other things (e.g. auth credentials).
2015-08-13 16:12:33 -04:00
Jeremy Mikola 490e5653bf Manager constructor should check if URI or client creation fails
If the URI cannot be parsed, we should throw an InvalidArgumentException. Failing to initialize the client from a valid URI can remain a RuntimeException.
2015-08-13 16:12:33 -04:00
Jeremy Mikola 47619dbffb Fix memory leak in _phongo_debug_bson()
The string returned by bson_as_json() must be freed.
2015-08-13 16:12:33 -04:00
Jeremy Mikola 6f82d0e386 Merge pull request #79 2015-08-13 16:12:06 -04:00
Jeremy Mikola a3f4b2427f Trim #includes, since src/contrib is already an include path 2015-08-13 15:40:39 -04:00
Jeremy Mikola 2436e158c9 Merge pull request #75 2015-08-05 21:57:32 -04:00
Jeremy Mikola e61b67809e PHPC-357: Revise test and relocate to standalone group 2015-08-05 21:56:56 -04:00
Derick Rethans dead06a80b PHPC-357: "invalid namespace" exception should report the namespace 2015-08-05 21:47:08 -04:00
Jeremy Mikola c4d03423d7 Merge pull request #74 2015-08-05 21:12:37 -04:00
Derick Rethans b31ad7c271 PHPC-129: Split out WriteConcern constructor error test
The error test should be skipped for HHVM, since it currently has inconsistent error handling.
2015-08-05 21:11:16 -04:00
Derick Rethans 8a62862f95 Merged pull request #73 2015-08-04 10:43:10 +01:00
Derick Rethans 89caf72c6a Rename BSON\Binary's subType field and getSubType() method to type and getType() 2015-08-04 10:42:45 +01:00
Derick Rethans 802b9b46c5 Merged pull request #72 2015-08-04 10:42:29 +01:00
Derick Rethans 651257063d Temporary fix for the NULL vs null issue 2015-08-04 10:41:41 +01:00
Hannes Magnusson 640c9b232e Make the relative path work 2015-08-03 13:57:22 -07:00
Hannes Magnusson 321ab56138 Skip test when not using the test vms 2015-08-03 13:57:22 -07:00
Jeremy Mikola cc4c95c181 Merge pull request #69 2015-07-30 15:27:14 -04:00
Jeremy Mikola 21fc1d0305 PHPC-350: Bump libmongoc submodule for updated headers 2015-07-30 15:15:38 -04:00
Jeremy Mikola 25a6cfc60b Merge pull request #68 2015-07-30 13:27:48 -04:00
Jeremy Mikola 4aec536060 bson_to_zval() should always initialize state->zchild
This avoids a possible segfault in calling code, were it to zval_ptr_dtor() state->zchild before initialization (i.e. bson_to_zval() returns early on error).
2015-07-30 13:17:37 -04:00
Jeremy Mikola 6173e60345 Update extension filename in Travis scripts 2015-07-29 17:28:04 -04:00
Jeremy Mikola 07387fae46 PHPC-347: bson_to_zval() leaks when buffer contains no documents 2015-07-29 16:14:44 -04:00
Jeremy Mikola 8d6c17da9b PHPC-345: bson_to_zval() should throw exceptions instead of warnings 2015-07-29 16:14:44 -04:00
Jeremy Mikola fa19ed8364 Merge pull request #67 2015-07-29 12:46:09 -04:00
Jeremy Mikola 972c5e4a96 PHPC-334: Split hex_dump() test case
The original test was problematic for HHVM, since it injects the __pclass value differently. Although changing the bsonSerialize() field order should ensure identical hex_dump() output on HHVM, we'll split the test cases.

See: fddd88ff9d
2015-07-29 11:59:58 -04:00
Jeremy Mikola 9d7bb9adaa Merge pull request #64 2015-07-29 11:59:00 -04:00
Jeremy Mikola 888b5dc56e PHP 5.3 compatibility for tools.php 2015-07-29 11:24:43 -04:00
Jeremy Mikola bfb1b8692b Define str_efree() macro for PHP 5.3 compatibility 2015-07-29 11:24:43 -04:00
Jeremy Mikola 80b9f3e8a3 Compile with no-cast-qual for PHP 5.3 2015-07-28 15:38:08 -04:00
Jeremy Mikola c5eb198c2b PHPC-344: Allow non-root Serializable to encode as BSON array 2015-07-28 15:38:08 -04:00
Jeremy Mikola dea4ff9250 PHPC-343: Allow bsonSerialize() to return a stdClass
This revises the UnexpectedValueException message for an invalid return value (PHPC-331).

Additionally, we consolidated the previous BSON-encoding error tests.
2015-07-28 15:38:08 -04:00
Jeremy Mikola 2824214f6d PHPC-331: Tests for BSON deserialization errors 2015-07-28 15:38:08 -04:00
Jeremy Mikola 7fb6ab829c PHPC-329: bson_to_zval() serialization spec compatibility
ODM behavior should override only the default type map and named class. Array and stdClass object modes still take precedence.

The PHONGO_TYPEMAP_CLASS switch cases were simplified, since we can trust that the root/document or ODM class implements Unserializable (thanks to php_phongo_bson_typemap_to_state() and php_phongo_bson_visit_binary(), respectively).
2015-07-28 15:38:08 -04:00
Jeremy Mikola 2551570dcd PHPC-329: __pclass must be both instantiatable and Persistable 2015-07-28 15:38:08 -04:00
Jeremy Mikola a2b71a6a05 PHPC-329: Apply more validation to type map class
Per the serialization spec, we should check that the class (1) exists, (2), is instantiatable, and (3) implements Unserializable.

Additionally, this refactors some code duplication out of apply_classname_to_state(). We should also always check to free classname, since an empty string might have been allocated (i.e. classname_len is zero).
2015-07-28 15:38:08 -04:00
Jeremy Mikola 802e2ae10d PHPC-336: BSON\Binary debug handler 2015-07-28 14:50:44 -04:00
Jeremy Mikola 914aabab04 Merge pull request #66 2015-07-28 13:12:32 -04:00
Derick Rethans fddd88ff9d Assert what the tests want, and not more
HHVM has the __pclass property last, and not first. That doesn't matter
functionality wise, but it impacts the hexdump.
2015-07-28 17:44:51 +01:00
Derick Rethans ee9622a096 HHVM does not include the function name, and has two lines of extra stack trace 2015-07-28 17:44:51 +01:00
Jeremy Mikola d5c8a12ff5 Merge pull request #63 2015-07-24 15:27:51 -04:00
Jeremy Mikola d2cd75143e PHPC-341: Ensure bson_t is freed after decoding JSON 2015-07-24 14:58:41 -04:00
Jeremy Mikola faa8e05cfb Merge pull request #62 2015-07-22 13:50:57 -04:00
Jeremy Mikola b3234e79a1 PHPC-333: Implement MongoDB\BSON\Binary::getData() 2015-07-22 13:50:43 -04:00