Commit Graph

314 Commits

Author SHA1 Message Date
Jeremy Mikola 0d73e362f9 PHPC-271: Server::executeBulkWrite() should take a write concern 2015-08-14 01:08:58 -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 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 a3f4b2427f Trim #includes, since src/contrib is already an include path 2015-08-13 15:40:39 -04: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
Jeremy Mikola 21fc1d0305 PHPC-350: Bump libmongoc submodule for updated headers 2015-07-30 15:15:38 -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 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 bfb1b8692b Define str_efree() macro for PHP 5.3 compatibility 2015-07-29 11:24:43 -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 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 d2cd75143e PHPC-341: Ensure bson_t is freed after decoding JSON 2015-07-24 14:58:41 -04:00
Jeremy Mikola b3234e79a1 PHPC-333: Implement MongoDB\BSON\Binary::getData() 2015-07-22 13:50:43 -04:00
Jeremy Mikola 880012510d Fix proto for Binary::getSubType() 2015-07-22 13:50:43 -04:00
Hannes Magnusson d017a80ea0 PHPC-229: Support options array in second parameter of Manager ctor 2015-07-22 13:47:43 -04:00
Jeremy Mikola cf59c4aaa4 PHPC-334: Don't produce BSON with multiple __pclass fields 2015-07-21 18:13:14 -04:00
Jeremy Mikola 2f19451180 PHPC-330: Always include __pclass property when unserializing BSON 2015-07-20 16:37:49 -04:00
Hannes Magnusson 810ac48dcb Move the php_array to contrib/ and rename to _api
The current name conflicted with PHP own php_array.h :]
2015-07-15 15:00:18 -07:00
Hannes Magnusson 47039b34d3 We are tracking 1.2.0-dev, not master!
ProTip: git submodule update --remote --merge
2015-07-15 15:00:18 -07:00
Jeremy Mikola 04cd180f33 Fix from/toJSON() protos 2015-07-14 19:52:24 -04:00
Jeremy Mikola 194bbbd164 PHPC-311: Rename from/toArray() functions to from/toPHP() 2015-07-14 19:52:24 -04:00
Jeremy Mikola 965f8c3db4 PHPC-315: Support "root" type mapping for top-level documents 2015-07-14 19:52:24 -04:00
Jeremy Mikola 6eb0944565 PHPC-319: Convert top-level documents to stdClass by default
Update tests to expect stdClass for documents. Debug handlers and the Server getter methods will still decode documents as native arrays.
2015-07-11 00:38:05 -04:00
Jeremy Mikola e40e31ae34 Fix WriteResult::getWriteConcernError() proto 2015-07-10 23:52:01 -04:00
Hannes Magnusson d8632d6a66 PHPC-303: Cannot connect to healthy Replica Set if seedlist only contains a secondary 2015-07-07 12:43:56 -07:00
Jeremy Mikola 041c6caac3 PHPC-325: bson_to_zval() leaks when buffer contains multiple documents 2015-07-07 14:11:13 -04:00
Jeremy Mikola 6894ecc9a5 Bump libbson and libmongoc submodules 2015-07-06 19:04:42 -04:00
Hannes Magnusson 803f4317f1 PHPC-321: UTCDatetime -> UTCDateTime 2015-06-30 10:29:57 -07:00
Hannes Magnusson 61c4432921 PHPC-309: Move the BSON namespace under MongoDB\ namespace
Having seperate MongoDB\Driver\ and BSON\ namespace was overruled :(

However, when you install pecl/bson seperately, it can be in the BSON
namespace, as it is a standalone package just wrapping libbson.

Since pecl/bson will be maintained in the same source as phongo, and I'd
like to share the testcases etc, we introduce a compile flag to detect
if we are compiling phongo or just bson, and set the namespace
appropriately
2015-06-30 09:54:21 -07:00
Hannes Magnusson 2ab93e2c5e bump submodule, hopfully fixing build 2015-06-09 20:33:06 -07:00
Hannes Magnusson f41dc80601 PHPC-308: Failed getmore should throw exception 2015-06-09 16:12:43 -07:00
Remi Collet ee84f4a743 PHPC-305: add --with-libmongo option 2015-05-20 14:43:50 +02:00
Hannes Magnusson e26a2580bf PHPC-75: Improve coverage 2015-05-13 20:31:46 -07:00
Hannes Magnusson 060f143040 PHPC-301: var_dump()ing Manager should show debug info 2015-05-13 18:38:46 -07:00
Hannes Magnusson c09dc2ff4d PHPC-300: Add var_dump() debug info for Server 2015-05-13 18:38:03 -07:00
Hannes Magnusson 5d862ad0c1 bump submodules 2015-05-12 15:39:47 -07:00
Jeremy Mikola 5bf6e2ccfd PHPC-284: Create MongoDB\Driver\Exception\LogicException class 2015-05-04 16:15:17 -04:00
Jeremy Mikola 7add8aec00 Use common return for zval_to_bson() bsonSerialize() error path
This also initializes ht_data to NULL just to be safe.
2015-05-04 14:41:23 -04:00
Jeremy Mikola 0b987982fa PHPC-283: UnexpectedValueException for invalid bsonSerialize() return value 2015-05-04 14:34:01 -04:00
Jeremy Mikola fa3618e1d0 PHPC-280: WriteConcern should always set journal/fsync boolean args 2015-05-04 14:24:37 -04:00
Jeremy Mikola 70c2b95a19 Document WriteConcern $w param as integer|string 2015-05-04 14:24:37 -04:00
Jeremy Mikola 047bea5705 PHPC-275: object_to_bson() handling for invalid bsonSerialize() retval
This also refactors the handling to be consistent with zval_to_bson().
2015-05-04 14:23:44 -04:00
Jeremy Mikola 9e59cee9d0 PHPC-274: Fix zval_to_bson() encoding of BSON\Serializable objects
Previously, only BSON\Persistable objects were handled.
2015-05-04 14:23:44 -04:00