205 Commits

Author SHA1 Message Date
Hannes Magnusson
0562092ef1 Simplify hash and fix windows build 2015-04-09 15:17:35 -07:00
Hannes Magnusson
d1e937794d Rename the compat header - its much more then PHP5.3 issues now 2015-04-09 15:11:59 -07:00
Hannes Magnusson
c6d29b3220 Fix warning, return in noreturn function 2015-04-09 15:09:30 -07:00
Hannes Magnusson
68caa686ba Fix zts build 2015-04-09 15:09:19 -07:00
Hannes Magnusson
5494b86255 Apparently there is a function for this! 2015-04-08 14:40:45 -07:00
Hannes Magnusson
6d8f7e9ed2 Fix zts build.. TSRMLS_FETCH_FROM_CTX declares variables and therefore must come first 2015-04-08 12:59:38 -07:00
Hannes Magnusson
69fe06ace8 Remove noop log handler 2015-04-08 12:58:05 -07:00
Hannes Magnusson
0ea1c5e863 PHPC-231: Manager instances should not free streams that are still in use 2015-04-08 12:58:05 -07:00
Jeremy Mikola
c32a7cc646 Remove unnecessary php_phongo_cursor_free_current() call
The current element is already freed at the top of this function. After that point, the element could only be intialized from first_batch_iter (after which we return immediately) or if mongoc_cursor_next() returns true (in which case we wouldn't be in this else clause).
2015-04-06 17:31:56 -04:00
Jeremy Mikola
efd91816da Re-use cursor_free_current() in cursor_free()
With this change, all visitor_data.zchild freeing is now done through the same function.
2015-04-06 17:30:21 -04:00
Jeremy Mikola
c454d27d95 PHPC-215: Fix Cursor iteration through IteratorIterator
This removes the invalidate_current handler. Due to SPL's implementation, our handler was being invoked between rewinding and checking if the current position was valid. Given that our validity check depends on inspecting a pointer to the current element (like MySQLi's result iterator), we cannot use invalidate_current.

The current element must still be freed during iteration, so we will instead call a php_phongo_cursor_free_current() function as needed. Additionally, we should track a reference to the Cursor object zval on the iterator itself, which will ensure it is not garbage-collected during iteration (demonstrated in the segfault backtrace in PHPC-215).

Lastly, this commit renames the Cursor object and iterator structs and related functions to be more consistent with implementions in PHP core.
2015-04-06 15:45:19 -04:00
Jeremy Mikola
66193e83bc PHPC-224: Consolidate Result and Cursor classes into one
This class is now simply Traversable (no longer IteratorAggregate) and adds isDead() and getId() methods from the original Cursor class.
2015-04-06 15:45:19 -04:00
Hannes Magnusson
1ab97b3bc3 PHPC-191 && PHPC-192: Add verify_expiry && verify_peer_name certificate verify options 2015-04-03 12:19:44 -07:00
Hannes Magnusson
ee9e33148a PHPC-223: Use explicit SSL options rather then stream context
This also adds support for PHPC-185
2015-04-02 16:15:22 -07:00
Hannes Magnusson
22ca99673b Fix setting debug logging as part of the driverOptions 2015-04-02 16:12:52 -07:00
Hannes Magnusson
e1e763f88b Fix compile warning on 32bit 2015-04-01 16:15:48 -07:00
Hannes Magnusson
ab8d22c7ff PHPC-219 - BSON\Javascript segfaults on Ubuntu Precise 32bit 2015-04-01 14:52:24 -07:00
Jeremy Mikola
1f9f7716d9 PHPC-214: Result does not need custom iterator classes
Wrapping a cursor can already be accomplished with IteratorIterator.
2015-03-31 15:29:19 -04:00
Hannes Magnusson
eb3aa9f939 PHPC-216: PHP5.5 change the prototype of get_current_key leading to
very strange and hard to track down segfaults
2015-03-30 17:03:29 -07:00
Hannes Magnusson
48d96546f9 PHPC-175: Fix header includes on Windows 2015-03-25 13:40:38 -07:00
Hannes Magnusson
3b78578ba3 Allow mongoc_init() to not use our mm
There is a shutdown race condition in the mongoc counters segment
allocation where zend mm will free the counters during RSHUTDOWN.
This happens as there is no "persistent alloc" callback from the bson
allocators that we can pemalloc() for.
Instead, we'll let mongoc_init use its own alloctors -- but we have to
remember to reset the alloc callbacks before mongoc_cleanup()
2015-03-25 13:22:37 -07:00
Hannes Magnusson
c5a0711972 PHPC-200: Don't set stream initiator when creating client fails 2015-03-25 08:55:30 -07:00
Hannes Magnusson
c21eb74f29 Simplify
It originally was used for more then just plain result, but now we
always have the cursor so no need to pass the server_id
2015-03-24 09:31:50 -07:00
Hannes Magnusson
809e99d7b8 PHPC-174: Rename module registration, constants and so on to mongodb 2015-03-23 16:37:38 -07:00
Hannes Magnusson
4daeefa3a5 Remove char * casting, the macro soup leads to incorrect sizeof 2015-03-23 12:46:55 -07:00
Hannes Magnusson
7ccd38c870 Fix zts 2015-03-20 16:49:34 -07:00
Hannes Magnusson
b40a98e677 PHPC-183: Fix compiler warnings with -Wdeclaration-after-statement
This also increases the chances of successful Windows build :)
2015-03-20 15:37:24 -07:00
Hannes Magnusson
5f8d990b53 PHPC-24 PHPC-77 PHPC-69 Provide a functioning Server object 2015-03-20 11:33:46 -07:00
Hannes Magnusson
d53c90ce94 PHPC-106: Connect asynchronouslyish 2015-03-19 14:20:44 -07:00
Hannes Magnusson
b825395d18 PHPC-106: Implement the new poll callback 2015-03-19 14:20:44 -07:00
Hannes Magnusson
50fe097841 Store the original mongoc_uri_t not just the options bson 2015-03-19 14:20:44 -07:00
Hannes Magnusson
14533db5d8 Add a little tracing love 2015-03-18 11:50:35 -07:00
Hannes Magnusson
57ed2c92fb Properly block on socket writes
If a socket write returns EWOULDBLOCK PHP will poll() using the socket
read timeout.
This is only an issue when writing crazy amount of data to a
non-blocking socket in multiple iterations... which we do.
2015-03-18 11:40:04 -07:00
Hannes Magnusson
ddc558e32a Fix null pointer exception 2015-03-18 11:39:14 -07:00
Hannes Magnusson
b6b6e9636f Unhide this 2015-03-18 11:30:26 -07:00
Jeremy Mikola
aa5903790a Return const struct pointers from zval getters 2015-03-17 16:17:24 -04:00
Jeremy Mikola
b5f8c34dae PHPC-181: Discard const qualifiers for PHP API 2015-03-17 16:14:27 -04:00
Jeremy Mikola
00f2da72f8 PHPC-181: Use const for pointer args where applicable 2015-03-17 16:10:04 -04:00
Jeremy Mikola
ae0219d69e PHPC-168: Implement WriteResult::isAcknowledged()
We copy the write concern struct rather than store an is_acknowledged boolean, which allows us to include the write concern in the debug output. Down the line, we may decide to implement a getWriteConcern() method to help users in handling/logging write concern errors.
2015-03-13 02:26:51 -04:00
Jeremy Mikola
9298ad8153 PHPC-170: Don't set write concern on bulk unnecessarily 2015-03-13 02:26:51 -04:00
Jeremy Mikola
70715516b5 PHPC-177: Include all fields in WriteConcern debug output
This mainly removes logic where no fields were included in the debug output if "w" was equal to MONGOC_WRITE_CONCERN_W_DEFAULT.

Although the "wmajority" boolean exists, we can still report the actual "w" value, which will be sent to the server.
2015-03-13 02:26:51 -04:00
Hannes Magnusson
88ae5da011 Fixed missing type specifier warning 2015-03-12 10:16:47 -07:00
Hannes Magnusson
bfccc982d8 PHPC-171: SSL Doesn't work in PHP5.6 2015-03-11 09:53:55 -07:00
Hannes Magnusson
8d70199272 Add micro-optimization tip for the future 2015-03-03 15:35:29 -08:00
Hannes Magnusson
5a4778f928 PHPC-163: Throw BulkWriteException on BulkWrite failure
For execute[Insert|Update|Delete]() we unroll the BulkWrite exception
and throw the inner errors.

Note: WriteConcern failure now throws WriteConcernException!
2015-03-03 10:21:37 -08:00
Hannes Magnusson
457b6452fa PHPC-165: Rename WriteBatch to BulkWrite 2015-02-20 15:05:29 -08:00
Hannes Magnusson
4cf9536f96 PHPC-164: Throw MongoDB\Driver\ConnectionTimeoutException 2015-02-19 15:02:49 -08:00
Hannes Magnusson
dad5d51b12 PHPC-107: Throw ExecutionTimeoutException for maxTimeMs 2015-02-19 13:15:04 -08:00
Hannes Magnusson
713dc5a78c PHPC-159: memleak on failed path resolving 2015-02-18 12:01:47 -08:00
Hannes Magnusson
ced7c408f3 PHPC-158: Split queryFlags bitmask option into specific options 2015-02-18 11:46:10 -08:00