Commit Graph

418 Commits

Author SHA1 Message Date
Jeremy Mikola 4a64b3d300 Merge branch 'v1.1' 2016-03-29 15:56:46 -04:00
Jeremy Mikola e097a0934c PHPC-655: Use case insensitive parsing for Manager connectTimeoutMS array option 2016-03-29 15:55:59 -04:00
Jeremy Mikola 4d593c7970 Merge branch 'v1.1' 2016-03-21 13:47:22 -04:00
Jeremy Mikola d1079cfabb PHPC-564, PHPC-626: WriteResult should use libmongoc's public API
This changes WriteResult to encapsulate a bson_t, which is populated by mongoc_bulk_operation_execute(), instead of the private mongoc_write_result_t struct. This entailed significant changes to the WriteResult debug handler, so new tests have been added for it.

With phongo_execute_write() modified to populate a bson_t reply, we also changed error handling to pull a BulkWriteException message from bson_error_t (PHPC-626). That change required several error tests to be modified for the new message format.
2016-03-21 11:42:28 -04:00
Jeremy Mikola 06d1c73fc9 Fix title for PHPC-155 regression test 2016-03-21 11:42:28 -04:00
Jeremy Mikola 6915ffd37f DRIVERS-289: Test iteration on live command cursor with empty first batch 2016-03-14 13:52:42 -04:00
Jeremy Mikola 3bb5cd81b6 PHPC-620: Lowercase hexadecimal strings in ObjectID ctor
Normalize input arguments to lowercase since libmongoc requires it.

Fixes #253
2016-03-10 11:38:08 -05:00
Jeremy Mikola ccf9136420 Fix test title 2016-03-10 11:38:08 -05:00
Jeremy Mikola 3c5363e581 PHPC-623: Fix 64-bit integer conversion for BSON keys
Fixes #256
2016-03-09 15:09:15 -05:00
Jeremy Mikola 4e2ab1b619 Skip PHPC-545 test on HHVM due to __pclass encoding order 2016-03-04 11:27:40 -05:00
Jeremy Mikola 9168392c27 Improve comment in bson-toJSON_error-001.phpt 2016-03-04 11:18:17 -05:00
Jeremy Mikola 246226b743 PHPC-613: toJSON() should throw if bson_as_json() fails 2016-03-04 11:18:17 -05:00
Jeremy Mikola fbd29313a4 PHPC-615: Return after throwing for bson_reader_read() error
This adds additional error tests for toJSON(), which demonstrate the problem when both exceptions might have been thrown.

Additionally, this ensures that the bson_reader_t is freed before returning. Previously, the code relied on the free after the second exception was thrown.
2016-03-04 11:18:17 -05:00
Jeremy Mikola 3da1aa6e85 PHPC-616: Document and array visitors should throw for corrupt BSON 2016-03-04 10:59:41 -05:00
Jeremy Mikola e9679a4145 PHPC-531: Fix double free in corrupt BSON visitor
Freeing the current zval in the corrupt BSON visitor causes a segfault if done for the root document, since phongo_bson_to_zval_ex() expects the calling code to initialize and free that zval on success or error.

That said, we should free when encountering an error via the document or array visitors (i.e. nested context), which would have just been initialized.
2016-03-04 10:59:01 -05:00
Jeremy Mikola ff2709dbbd toPHP() regression tests for bson_reader_read() errors
These test cases are derived from PHPC-615.
2016-03-02 16:11:38 -05:00
Derick Rethans 5c366ee5b4 Fixed PHPC-506: Use more descriptive messages in WriteExceptions 2016-03-01 14:07:54 +00:00
Jeremy Mikola e497c0155c PHPC-414: Combine 32-bit and 64-bit UTCDateTime debug handler tests
This removes a SKIPIF from the 32-bit test but leaves the 64-bit test in place, since it tests construction from a 64-bit integer type instead of a string.
2016-02-29 12:51:20 -05: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 4d8e3e304a PHPC-595: Throw exception if wtimeout > INT32_MAX
This also defines a compatility constant for printing phongo_long, which may vary by PHP version and architecture.
2016-02-29 12:43:34 -05:00
Jeremy Mikola 6bcba59cb5 PHPC-544: Consult SIZEOF_ZEND_LONG for 64-bit integer support
Define phongo_long and SIZEOF_PHONGO_LONG in compatibility header. On PHP 7, this will ensure we use zend_long and SIZEOF_ZEND_LONG instead of relying on long and SIZEOF_LONG.

Additionally, this adds an else condition to report a build error if the architecture is neither 32-bit nor 64-bit.
2016-02-29 12:27:52 -05:00
Jeremy Mikola bf34b20217 PHPC-592: ADD_ASSOC_STRINGL() can only be used with string literals
The previous macro uses ZEND_STRL(), which calculates the string length via sizeof() and makes it suitable only for string literals. Since this code is utilized by php_phongo_bson_visit_int64(), we must rely on strlen() to compute the field name length.
2016-02-29 12:27:52 -05:00
Jeremy Mikola e430814221 Revert "Merge pull request #241"
This reverts commit f5edbe2665, reversing
changes made to 6aaa45d380.
2016-02-29 12:27:11 -05:00
Jeremy Mikola f1c7be8318 wip 2016-02-25 10:14:47 -05:00
Jeremy Mikola ba83c54cfe PHPC-545: Regression test for Peristable bug report 2016-02-15 12:49:00 -05:00
Jeremy Mikola b6c9b45add PHPC-550: Always encode ODS field when serializing Persistable documents
The modified ODS tests return atomic modifiers through bsonSerialize(), which conflicts with __pclass injection (the resulting newObj is neither an update nor a replacement document). Rather than delete these tests, we'll mark them as expecting failure until we allow such functionality in another interface down the line.
2016-02-15 12:49:00 -05:00
Jeremy Mikola 54740a6685 Regression test for executing BulkWrite multiple times 2016-02-15 12:49:00 -05:00
Jeremy Mikola 08394895f5 Fix test title 2016-02-15 12:49:00 -05:00
Jeremy Mikola 71b597cfa4 Tests should use and cleanup their own collection 2016-02-15 12:49:00 -05:00
Jeremy Mikola 016eaf8aa0 PHPC-581: Use ConnectionTimeoutException for server selection failures 2016-02-15 12:41:28 -05:00
Jeremy Mikola a287ded536 PHPC-553: Relax expected output patterns for HHVM 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 2930c348db PHPC-566: Remove request_id from Manager::__debugInfo() 2016-02-15 12:09:17 -05:00
Derick Rethans dba417c29a Skip this test on HHVM, as its DateTime class is ancient and behaves differently 2016-02-12 12:19:57 +00:00
Jeremy Mikola d9674b5bd0 PHPC-523: Parse readconcernlevel in URI options array 2016-02-11 17:21:18 -05:00
Jeremy Mikola 20e601a853 PHPC-539: Include read concern in Query debug output 2016-02-10 10:37:51 -05:00
Jeremy Mikola 2fa57d7d05 Regression test for extending final classes 2016-02-09 15:25:14 -05:00
Jeremy Mikola 41cadec19b PHPC-538: ObjectID should not abort on null ctor arg 2016-02-08 20:42:58 -05:00
Jeremy Mikola 5b00e22101 PHPC-515: Test that negative cursor limits return one batch 2016-02-03 10:35:57 -05:00
Derick Rethans b67a090c18 Fixed PHPC-543: MongoDB\BSON\UTCDateTime on 32 bit platforms parse argument wrong 2016-02-03 10:31:45 +00:00
Derick Rethans 8e61bb78a5 Skip and fix test for HHVM with ReadConcerns 2016-01-12 16:43:03 +00:00
Jeremy Mikola b6d0908ada PHPC-528: Support zval references when appending BSON 2015-12-30 16:16:06 -05:00
Derick Rethans 9aad2931d3 Fixed test case, where PHP 5 and PHP 7 call the type differently 2015-12-18 16:15:40 +00:00
Derick Rethans c0d4f60a1d Fixed issues with PHP 7 and the new ReadConcern 2015-12-18 16:15:40 +00:00
Hannes Magnusson 97429ea258 PHPC-431: Add the testcase from the report 2015-12-16 10:22:58 +00:00
Jeremy Mikola 9d04bcd69c PHPC-509: Default Manager URI to "mongodb://localhost:27017/" 2015-12-14 18:01:31 -05:00
Jeremy Mikola 90d438e626 PHPC-448: Manager::getReadConcern() and URI test 2015-12-11 15:22:55 -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