322 Commits

Author SHA1 Message Date
Jeremy Mikola fd356f3fd7 Prevent duplication and reduce strlen() usage 2016-03-02 11:04:49 +00:00
Derick Rethans 5c366ee5b4 Fixed PHPC-506: Use more descriptive messages in WriteExceptions 2016-03-01 14:07:54 +00:00
Jeremy Mikola 9f93fbd2c0 PHPC-593: Binary type is an unsigned 8-bit integer
This adds range checking to Binary's constructor. Internal structs and functions were changed to use uint8_t for readability.
2016-02-29 12:43:34 -05:00
Jeremy Mikola c6574fab72 PHPC-594: Timestamp components are unsigned 32-bit integers
This adds range checking to Timestamp's constructor and changes Timestamp::__toString() to print the components as unsigned 32-bit integers. Internal structs and functions were changed to use uint32_t for readability.

32-bit platforms will be limited to the range of signed 32-bit integers, since PHP has no unsigned integer type. This will be documented in PHPC-599.
2016-02-29 12:43:34 -05:00
Jeremy Mikola 016eaf8aa0 PHPC-581: Use ConnectionTimeoutException for server selection failures 2016-02-15 12:41:28 -05:00
Jeremy Mikola 19bfb1a8a3 PHPC-553: Check for connection exceptions in exec and SS methods
executeCommand(), executeQuery(), and selectServer() did not check for a global exception after executing via libmongoc, which meant that connection and SSL exceptions might end up as the previous exception where they could be easily ignored.

This makes these methods consistent with executeBulkWrite(), which happens to be used in our SSL tests where we check for such exceptions.
2016-02-15 12:36:51 -05:00
Jeremy Mikola cca7d04fef PHPC-553: Suppress warnings during stream creation
This allows PHP's warnings during connection initialization (e.g. unresolvable host names) to be captured into the bson_error_t, which is later used to throw an exception.
2016-02-15 12:36:51 -05:00
Jeremy Mikola d9674b5bd0 PHPC-523: Parse readconcernlevel in URI options array 2016-02-11 17:21:18 -05:00
Jeremy Mikola bd44cc6826 PHPC-563: Remove undocumented Manager "hosts" URI option 2016-02-10 17:57:02 -05:00
Jeremy Mikola 24ed8326b9 PHPC-529: Prefix BSON functions to avoid symbol conflicts 2016-01-06 13:57:42 -05:00
Derick Rethans c0d4f60a1d Fixed issues with PHP 7 and the new ReadConcern 2015-12-18 16:15:40 +00:00
Joe Watkins c4f69e810c fix leaks and logical errors for PHP 7 2015-12-18 16:15:40 +00:00
Jeremy Mikola 9047b3d27b PHPC-390: Fix OnUpdateString calls within OnUpdateDebug 2015-12-16 10:22:58 +00:00
Jeremy Mikola 29bf3381e5 PHPC-374: zend_string updates for OnUpdateDebug 2015-12-16 10:22:58 +00:00
Jeremy Mikola df74d6dae1 PHPC-404: Additional hash API changes
Since ADD_ASSOC_STRINGL() always duplicates, use a static buffer in UTCDateTime's debug handler when converting milliseconds to a string on 32-bit platforms.
2015-12-16 10:22:58 +00:00
Jeremy Mikola 52e5bb9e01 PHPC-369: Additional Z_<CLASSNAME>_OBJ_P() macros 2015-12-16 10:22:58 +00:00
Hannes Magnusson 46f60021b9 PHPC-431: Segfault when using Manager through singleton class 2015-12-16 10:22:58 +00:00
Hannes Magnusson 75ceeaf7c1 PHPC-391 & PHPC-389: Stream and SSL API changes 2015-12-16 10:22:58 +00:00
Hannes Magnusson f1372c8361 PHPC-387: Properly init the iterator, and don't free it on dtor 2015-12-16 10:22:58 +00:00
Hannes Magnusson 6f6900fee9 PHPC-405: zval drop a level; zval*->zval, zval**->zval* 2015-12-16 10:22:58 +00:00
Hannes Magnusson 390b6fca5a PHPC-404: off-by-one hash api changes 2015-12-16 10:22:58 +00:00
Hannes Magnusson 615ce0c87d PHPC-390: php.ini updates 2015-12-16 10:21:33 +00:00
Hannes Magnusson e8ba12bd2b hash API changes, off-by-ones 2015-12-16 10:21:33 +00:00
Hannes Magnusson 3c19775997 PHPC-385: Remove leftover braces 2015-12-16 10:19:30 +00:00
Hannes Magnusson 41ede51ea1 Sprinkle TODOs -- it compiles now! 2015-12-16 10:19:30 +00:00
Hannes Magnusson 07b81a68ed PHPC-374: php_stream_xport_create() now wants zend_string 2015-12-16 10:19:30 +00:00
Hannes Magnusson 4920cd7cfd PHPC-388 - dtor on bson_to_zval() failure 2015-12-16 10:19:30 +00:00
Hannes Magnusson 720cc357b1 PHPC-387: Iterator API changes 2015-12-16 10:19:30 +00:00
Hannes Magnusson d1ad604c11 PHPC-386: Forward port Z_PHPDATE_P() to get php_date_obj 2015-12-16 10:19:30 +00:00
Hannes Magnusson 4cdad82540 PHPC-385: add_assoc_string_ex() doesn't have a duplicate param in PHP7 2015-12-16 10:19:30 +00:00
Hannes Magnusson 5d6d0d1a2c PHPC-384: php_stream's no longer have resource ids 2015-12-16 10:19:30 +00:00
Hannes Magnusson 8ee01788d1 PHPC-376: Cursor var_dump() is weird
Refactor so it mimicks all the other <type>_to_zval()
Also gets rid of MAKE_STD_ZVAL() for PHPC-373
2015-12-16 10:19:30 +00:00
Hannes Magnusson 342c62747c PHPC-373: Remove MAKE_STD_ZVAL() usage
This simplifies calling bson_to_zval() quite a bit.

bson_to_zval() now takes empty zval*
bson_to_zval_ex() now takes php_phongo_bson_state (with empty zval*)

bson_to_zval() will always alloc and init state.zchild
2015-12-16 10:15:28 +00:00
Hannes Magnusson 8d97a3a4eb PHPC-374: zend_string* vs char* PHP API changes (1/many) 2015-12-16 10:15:28 +00:00
Hannes Magnusson 846a92f46d PHPC-375: TSRMLS_FETCH_FROM_CTX() not applicable in PHP7
TSRMLS_FETCH_FROM_CTX() still dose the assignment in PHP7, which leads
to compiler warning since we don't actually use it
2015-12-16 10:15:28 +00:00
Hannes Magnusson 61e43e3b87 PHPC-372: zend_throw_exception() return value changes 2015-12-16 10:15:28 +00:00
Hannes Magnusson 7f9343a877 PHPC-371: Prep for PHP7 resource changes 2015-12-16 10:15:28 +00:00
Hannes Magnusson 13a256e2a9 PHPC-369: Use the new Z_<CLASSNAME>_OBJ_P() macros 2015-12-16 10:13:51 +00:00
Hannes Magnusson 4c918b8e02 PHPC-368: Refactor MongoDB\Driver\Manager ctor 2015-12-16 10:10:31 +00:00
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