Commit Graph

283 Commits

Author SHA1 Message Date
Hannes Magnusson f912475b83 PHPC-512: Disable async stream connections
When doing async connections we can't properly determine if we should connect over IPv6 or IPv4. PHP will unfortunately default to connecting over IPv6 (when compiled in support, with minor runtime check), while mongod does not support IPv6 by default.

When then creating the IPv6 connection asynchronously, PHP hits EINPROGRESS and will happily return the socket as valid.

There currently is no way to configure these functions to prefer IPv4. The best we can do for now is to not connect asynchronously as then we'll properly discover that the IPv6 socket failed, and then continue through the list of addrinfo and next pickup the IPv4 address which works.

Fixes #133
2015-12-14 14:58:00 -05:00
Jeremy Mikola 3ad2ace6f2 PHPC-508: Construct valid stream URI for IPv6 literals 2015-12-14 13:21:38 -05:00
Jeremy Mikola 12e6907e41 PHPC-448: Support readConcern option on Query 2015-12-11 15:22:55 -05:00
Jeremy Mikola 92348caffc PHPC-448: Implement ReadConcern class 2015-12-11 14:44:59 -05:00
Derick Rethans 76fce748c4 Use more descriptive unused value 2015-12-10 11:14:36 +00:00
Hannes Magnusson 85b437a1f7 Fixed PHPC-502: bson_init_static(): precondition failed: data 2015-12-10 11:14:12 +00:00
Hannes Magnusson 49225e1dc7 PHPC-495: Upgrade bundled libbson and libmongoc to 1.3.0 2015-12-02 18:11:46 +00:00
Derick Rethans e529d3007b Renamed struct members due to changes in libmongoc 2015-12-02 18:11:46 +00:00
Derick Rethans 74ed943585 mongoc_cursor_cursorid_init takes an extra bson_error 2015-12-02 18:11:46 +00:00
Hannes Magnusson eaeb31e297 PHPC-487: Reverse logic in check_closed stream handler
The return value of the check_closed handler is true if the stream is closed.
2015-11-30 12:28:40 -05:00
Jeremy Mikola 70c092f379 PHPC-465: Remove WriteConcernException and WriteErrorException
These exceptions were only used by the single write methods.
2015-10-21 23:42:40 -04:00
Jeremy Mikola fe9fb63267 PHPC-465: Remove Manager's single write methods
Existing tests for single write methods were ported to executeBulkWrite() tests.
2015-10-21 19:32:42 -04:00
Jeremy Mikola 011c0c264c PHPC-440: WriteErrorException extends abstract WriteException
This makes WriteException a common base class of WriteConcernException and WriteErrorException. BulkWriteException, which may contain multiple write and/or write concern errors, will continue to inherit WriteException.
2015-10-21 19:32:42 -04:00
Jeremy Mikola 15a9f709d2 PHPC-462: Remove unused DuplicateKeyException
This class was not being used, since executeBulkWrite() uses BulkWriteException and the single write methods use WriteException and WriteConcernException exclusively.
2015-10-20 12:23:38 -04:00
Hannes Magnusson 98dc85a140 PHPC-256: Productions debug logs 2015-10-07 14:15:54 -07:00
Hannes Magnusson 9c0d40424f Make sure we have the X509 declaration we need 2015-10-07 13:41:51 -07:00
Hannes Magnusson 3740eaa9e0 No need for TSRMLS here -- no calls to PHP at all 2015-10-07 13:41:51 -07:00
Jeremy Mikola 59177872a8 Avoid nested macros when reporting runtime version in debug mode
This appeared to work in GCC but caused compilation errors on Windows. Related to: 2f750b0c141a814a6455f666583c28601be1c29d
2015-10-06 01:45:33 -04:00
Remi Collet aeb2bc4669 PHPC-442: report PHP version in debug info 2015-10-05 17:28:23 -04:00
Remi Collet efde19a1de report runtime version in debug mode 2015-10-05 17:28:23 -04:00
Remi Collet 064c8a2e4e rename macros 2015-10-05 17:28:23 -04:00
Remi Collet 2415a9c0b3 report libraries runtime versions 2015-10-05 17:28:23 -04:00
Jeremy Mikola 5732362b8b PHPC-436: Handle new writeConcernErrors array in mongoc_write_result_t 2015-10-05 12:22:46 -04:00
Hannes Magnusson 3a91948e55 PHPC-415: SSL/TLS already set-up for this stream
When closing a stream we can't free the base_stream, only our stream.
Which also means, when destroying a stream we may not always have a wrapping stream
2015-10-01 15:22:20 -04:00
Hannes Magnusson ff3061d4ce Don't provide server_id when we have none 2015-10-01 15:22:03 -04:00
Hannes Magnusson ec3e1cc895 PHPC-377: Eliminate object casting and whole lot of zend hash helpers
Use BSON for all this parsing as that is the target format anyway

Conflicts:
	php_phongo.c
	php_phongo.h
	src/MongoDB/Query.c
2015-09-23 14:57:47 -04:00
Hannes Magnusson 9c0b84801f PHPC-373: Get rid of MAKE_STD_ZVAL() and use bson_t instead 2015-09-23 14:51:20 -04:00
Jeremy Mikola dcbf5ae6ba PHPC-428: Remove support for WriteConcern fsync option 2015-09-23 11:47:53 -04:00
Jeremy Mikola a6932d59e0 PHPC-423: WriteConcern should report default "w" option as null 2015-09-22 14:07:23 -04:00
Jeremy Mikola 1e126e500d Move PHONGO_WRITE_CONCERN_W_MAJORITY definition to php_phongo.h 2015-09-16 17:37:14 -04:00
Jeremy Mikola 81c763442b PHPC-417: Return value objects from Manager RP/WC getters 2015-09-15 15:19:35 -04:00
Jeremy Mikola fb2ab50d5e Declare phongo_cursor_init() statically
This isn't used outside of php_phongo.c
2015-09-15 14:48:34 -04:00
Jeremy Mikola b8a8f89913 Include unknown error domain in log messages 2015-09-04 16:04:32 -04:00
Jeremy Mikola 04df99287e Fall back to driver's RuntimeException instead of SPL 2015-09-04 16:04:19 -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 a3f4b2427f Trim #includes, since src/contrib is already an include path 2015-08-13 15:40:39 -04:00
Derick Rethans dead06a80b PHPC-357: "invalid namespace" exception should report the namespace 2015-08-05 21:47:08 -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
Hannes Magnusson d017a80ea0 PHPC-229: Support options array in second parameter of Manager ctor 2015-07-22 13:47:43 -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
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 adbb54c87c Remove redundant array conversions in phongo_query_init()
The modifiers and selector zvals are both arrays or objects by this point and zval_to_bson() will handle either. Each will be serialized as a BSON document since zval_to_bson() merely appends fields to the structure we initialize with bson_new().
2015-07-06 15:46:50 -04:00
Jeremy Mikola 8cd6db686f PHPC-317: Ensure "sort" query option serializes as BSON object 2015-07-06 15:46:06 -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