From 0c7a349405ab25b519bb77dc80f8b5ef223febb8 Mon Sep 17 00:00:00 2001 From: Andreas Braun Date: Mon, 31 Jul 2023 13:18:52 +0200 Subject: [PATCH 1/8] PHPC-2230: Drop support for PHP 7.2 and 7.3 --- .evergreen/config.yml | 14 +++----------- .github/workflows/tests.yml | 12 ++---------- .github/workflows/windows-release-build.yml | 2 +- config.m4 | 4 ++-- config.w32 | 5 ++--- 5 files changed, 10 insertions(+), 27 deletions(-) diff --git a/.evergreen/config.yml b/.evergreen/config.yml index f657712db..ff96fe822 100644 --- a/.evergreen/config.yml +++ b/.evergreen/config.yml @@ -1100,14 +1100,6 @@ axes: display_name: "PHP 7.4" variables: PHP_VERSION: "7.4" - - id: "7.3" - display_name: "PHP 7.3" - variables: - PHP_VERSION: "7.3" - - id: "7.2" - display_name: "PHP 7.2" - variables: - PHP_VERSION: "7.2" - id: php-edge-versions display_name: PHP Version @@ -1117,9 +1109,9 @@ axes: variables: PHP_VERSION: "8.2" - id: "oldest-supported" - display_name: "PHP 7.2" + display_name: "PHP 7.4" variables: - PHP_VERSION: "7.2" + PHP_VERSION: "7.4" - id: os display_name: OS @@ -1231,7 +1223,7 @@ buildvariants: # Exclude "latest-stable" PHP version for Debian 11 (see: test-mongodb-versions matrix) - { "os": "debian11", "mongodb-edge-versions": "*", "php-versions": "8.2" } # Exclude PHP versions older than 8.1 on RHEL 9 and Ubuntu 22.04 (OpenSSL 3 is only supported on PHP 8.1+) - - { "os": ["rhel90", "ubuntu2204-arm64", "ubuntu2204"], "mongodb-edge-versions": "*", "php-versions": ["7.2", "7.3", "7.4", "8.0"] } + - { "os": ["rhel90", "ubuntu2204-arm64", "ubuntu2204"], "mongodb-edge-versions": "*", "php-versions": ["7.4", "8.0"] } tasks: - name: "test-standalone-ssl" - name: "test-replicaset-auth" diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 688d4ea22..fa4fdbf6e 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -81,7 +81,7 @@ jobs: windows-tests: name: "Windows Tests" - runs-on: ${{ matrix.os }} + runs-on: windows-2022 defaults: run: shell: cmd @@ -89,17 +89,9 @@ jobs: strategy: fail-fast: true matrix: - os: [ windows-2019, windows-2022 ] - php: [ "7.2", "7.3", "7.4", "8.0", "8.1", "8.2" ] + php: [ "7.4", "8.0", "8.1", "8.2" ] arch: [ x64, x86 ] ts: [ ts, nts ] - exclude: - - { os: windows-2019, php: "8.2" } - - { os: windows-2019, php: "8.1" } - - { os: windows-2019, php: "8.0" } - - { os: windows-2019, php: "7.4" } - - { os: windows-2019, php: "7.3" } - - { os: windows-2022, php: "7.2" } steps: - uses: actions/checkout@v3 diff --git a/.github/workflows/windows-release-build.yml b/.github/workflows/windows-release-build.yml index 20c650930..103a5c048 100644 --- a/.github/workflows/windows-release-build.yml +++ b/.github/workflows/windows-release-build.yml @@ -10,7 +10,7 @@ jobs: fail-fast: false matrix: # Note: keep this in sync with the Windows matrix in tests.yml - php: [ "7.2", "7.3", "7.4", "8.0", "8.1", "8.2" ] + php: [ "7.4", "8.0", "8.1", "8.2" ] arch: [ x64, x86 ] ts: [ ts, nts ] runs-on: ubuntu-latest diff --git a/config.m4 b/config.m4 index fb4348049..ec1257d66 100644 --- a/config.m4 +++ b/config.m4 @@ -27,8 +27,8 @@ if test "$PHP_MONGODB" != "no"; then fi AC_MSG_RESULT($PHP_MONGODB_PHP_VERSION) - if test "$PHP_MONGODB_PHP_VERSION_ID" -lt "70200"; then - AC_MSG_ERROR([not supported. Need a PHP version >= 7.2.0 (found $PHP_MONGODB_PHP_VERSION)]) + if test "$PHP_MONGODB_PHP_VERSION_ID" -lt "70400"; then + AC_MSG_ERROR([not supported. Need a PHP version >= 7.4.0 (found $PHP_MONGODB_PHP_VERSION)]) fi PHP_ARG_ENABLE([mongodb-developer-flags], diff --git a/config.w32 b/config.w32 index f42c8f3e7..af451325c 100644 --- a/config.w32 +++ b/config.w32 @@ -66,11 +66,10 @@ ARG_WITH("mongodb-client-side-encryption", "MongoDB: Enable client-side encrypti if (PHP_MONGODB != "no") { /* Note: ADD_EXTENSION_DEP() only reports the date and standard extensions as - * installed in PHP 7.3.25+, 7.4.13+, and 8.0.0+). On other versions, assume - * that they're always enabled. */ + * installed in PHP 7.4.13+ and 8.0.0+). On other versions, assume that + * they're always enabled. */ if ( PHP_VERSION >= 8 || - (PHP_VERSION == 7 && PHP_MINOR_VERSION == 3 && PHP_RELEASE_VERSION >= 25) || (PHP_VERSION == 7 && PHP_MINOR_VERSION == 4 && PHP_RELEASE_VERSION >= 13) ) { ADD_EXTENSION_DEP("mongodb", "date", false); From 26f81d806d2987dbaff783c5026714d0ab752c73 Mon Sep 17 00:00:00 2001 From: Andreas Braun Date: Mon, 31 Jul 2023 13:19:06 +0200 Subject: [PATCH 2/8] Remove compatibility code for PHP < 7.4 --- src/BSON/Document.c | 2 +- src/BSON/Int64.c | 2 -- src/BSON/functions.c | 2 +- src/MongoDB/BulkWrite.c | 8 +++--- src/MongoDB/ClientEncryption.c | 2 +- src/MongoDB/Command.c | 2 +- src/MongoDB/Query.c | 2 +- src/MongoDB/Session.c | 2 +- src/phongo_compat.c | 30 ----------------------- src/phongo_compat.h | 45 ---------------------------------- 10 files changed, 10 insertions(+), 87 deletions(-) diff --git a/src/BSON/Document.c b/src/BSON/Document.c index e92652eb4..fb32046bb 100644 --- a/src/BSON/Document.c +++ b/src/BSON/Document.c @@ -153,7 +153,7 @@ static PHP_METHOD(MongoDB_BSON_Document, fromPHP) zval* data; PHONGO_PARSE_PARAMETERS_START(1, 1) - PHONGO_PARAM_ARRAY_OR_OBJECT(data) + Z_PARAM_ARRAY_OR_OBJECT(data) PHONGO_PARSE_PARAMETERS_END(); object_init_ex(&zv, php_phongo_document_ce); diff --git a/src/BSON/Int64.c b/src/BSON/Int64.c index fc64b4c44..4a1f9fa7c 100644 --- a/src/BSON/Int64.c +++ b/src/BSON/Int64.c @@ -294,9 +294,7 @@ static zend_result php_phongo_int64_cast_object(phongo_compat_object_handler_typ return SUCCESS; case IS_LONG: -#if PHP_VERSION_ID >= 70300 case _IS_NUMBER: -#endif #if SIZEOF_ZEND_LONG == 4 if (intern->integer > INT32_MAX || intern->integer < INT32_MIN) { zend_error(E_WARNING, "Truncating 64-bit integer value %" PRId64 " to 32 bits", intern->integer); diff --git a/src/BSON/functions.c b/src/BSON/functions.c index 8ebe54ba4..bb4804622 100644 --- a/src/BSON/functions.c +++ b/src/BSON/functions.c @@ -29,7 +29,7 @@ PHP_FUNCTION(fromPHP) bson_t* bson; PHONGO_PARSE_PARAMETERS_START(1, 1) - PHONGO_PARAM_ARRAY_OR_OBJECT(data) + Z_PARAM_ARRAY_OR_OBJECT(data) PHONGO_PARSE_PARAMETERS_END(); bson = bson_new(); diff --git a/src/MongoDB/BulkWrite.c b/src/MongoDB/BulkWrite.c index 8bf1e4855..3a094a996 100644 --- a/src/MongoDB/BulkWrite.c +++ b/src/MongoDB/BulkWrite.c @@ -387,7 +387,7 @@ static PHP_METHOD(MongoDB_Driver_BulkWrite, insert) intern = Z_BULKWRITE_OBJ_P(getThis()); PHONGO_PARSE_PARAMETERS_START(1, 1) - PHONGO_PARAM_ARRAY_OR_OBJECT(zdocument) + Z_PARAM_ARRAY_OR_OBJECT(zdocument) PHONGO_PARSE_PARAMETERS_END(); bson_flags |= PHONGO_BSON_RETURN_ID; @@ -429,8 +429,8 @@ static PHP_METHOD(MongoDB_Driver_BulkWrite, update) intern = Z_BULKWRITE_OBJ_P(getThis()); PHONGO_PARSE_PARAMETERS_START(2, 3) - PHONGO_PARAM_ARRAY_OR_OBJECT(zquery) - PHONGO_PARAM_ARRAY_OR_OBJECT(zupdate) + Z_PARAM_ARRAY_OR_OBJECT(zquery) + Z_PARAM_ARRAY_OR_OBJECT(zupdate) Z_PARAM_OPTIONAL Z_PARAM_ARRAY_OR_NULL(zoptions) PHONGO_PARSE_PARAMETERS_END(); @@ -494,7 +494,7 @@ static PHP_METHOD(MongoDB_Driver_BulkWrite, delete) intern = Z_BULKWRITE_OBJ_P(getThis()); PHONGO_PARSE_PARAMETERS_START(1, 2) - PHONGO_PARAM_ARRAY_OR_OBJECT(zquery) + Z_PARAM_ARRAY_OR_OBJECT(zquery) Z_PARAM_OPTIONAL Z_PARAM_ARRAY_OR_NULL(zoptions) PHONGO_PARSE_PARAMETERS_END(); diff --git a/src/MongoDB/ClientEncryption.c b/src/MongoDB/ClientEncryption.c index 05e2b1e43..39ed78ae1 100644 --- a/src/MongoDB/ClientEncryption.c +++ b/src/MongoDB/ClientEncryption.c @@ -408,7 +408,7 @@ static PHP_METHOD(MongoDB_Driver_ClientEncryption, rewrapManyDataKey) const bson_t* bulk_write_result; PHONGO_PARSE_PARAMETERS_START(1, 2) - PHONGO_PARAM_ARRAY_OR_OBJECT(zfilter) + Z_PARAM_ARRAY_OR_OBJECT(zfilter) Z_PARAM_OPTIONAL Z_PARAM_ARRAY_OR_NULL(options) PHONGO_PARSE_PARAMETERS_END(); diff --git a/src/MongoDB/Command.c b/src/MongoDB/Command.c index 9402eff65..a027a4c97 100644 --- a/src/MongoDB/Command.c +++ b/src/MongoDB/Command.c @@ -107,7 +107,7 @@ static PHP_METHOD(MongoDB_Driver_Command, __construct) intern = Z_COMMAND_OBJ_P(getThis()); PHONGO_PARSE_PARAMETERS_START(1, 2) - PHONGO_PARAM_ARRAY_OR_OBJECT(document) + Z_PARAM_ARRAY_OR_OBJECT(document) Z_PARAM_OPTIONAL Z_PARAM_ARRAY_OR_NULL(options) PHONGO_PARSE_PARAMETERS_END(); diff --git a/src/MongoDB/Query.c b/src/MongoDB/Query.c index 35fabb2db..172b1501b 100644 --- a/src/MongoDB/Query.c +++ b/src/MongoDB/Query.c @@ -414,7 +414,7 @@ static PHP_METHOD(MongoDB_Driver_Query, __construct) zval* options = NULL; PHONGO_PARSE_PARAMETERS_START(1, 2) - PHONGO_PARAM_ARRAY_OR_OBJECT(filter) + Z_PARAM_ARRAY_OR_OBJECT(filter) Z_PARAM_OPTIONAL Z_PARAM_ARRAY_OR_NULL(options) PHONGO_PARSE_PARAMETERS_END(); diff --git a/src/MongoDB/Session.c b/src/MongoDB/Session.c index e73f02f52..01039b483 100644 --- a/src/MongoDB/Session.c +++ b/src/MongoDB/Session.c @@ -169,7 +169,7 @@ static PHP_METHOD(MongoDB_Driver_Session, advanceClusterTime) SESSION_CHECK_LIVELINESS(intern, "advanceClusterTime") PHONGO_PARSE_PARAMETERS_START(1, 1) - PHONGO_PARAM_ARRAY_OR_OBJECT(zcluster_time) + Z_PARAM_ARRAY_OR_OBJECT(zcluster_time) PHONGO_PARSE_PARAMETERS_END(); php_phongo_zval_to_bson(zcluster_time, PHONGO_BSON_NONE, &cluster_time, NULL); diff --git a/src/phongo_compat.c b/src/phongo_compat.c index bcac620aa..bb5a0fa15 100644 --- a/src/phongo_compat.c +++ b/src/phongo_compat.c @@ -18,35 +18,6 @@ #include "phongo_compat.h" -#ifdef ZEND_HASH_GET_APPLY_COUNT /* PHP 7.2 or earlier recursion protection */ -zend_bool php_phongo_zend_hash_apply_protection_begin(HashTable* ht) -{ - if (!ht) { - return 1; - } - if (ZEND_HASH_GET_APPLY_COUNT(ht) > 0) { - return 0; - } - if (ZEND_HASH_APPLY_PROTECTION(ht)) { - ZEND_HASH_INC_APPLY_COUNT(ht); - } - return 1; -} - -zend_bool php_phongo_zend_hash_apply_protection_end(HashTable* ht) -{ - if (!ht) { - return 1; - } - if (ZEND_HASH_GET_APPLY_COUNT(ht) == 0) { - return 0; - } - if (ZEND_HASH_APPLY_PROTECTION(ht)) { - ZEND_HASH_DEC_APPLY_COUNT(ht); - } - return 1; -} -#else /* PHP 7.3 or later */ zend_bool php_phongo_zend_hash_apply_protection_begin(zend_array* ht) { if (GC_IS_RECURSIVE(ht)) { @@ -68,7 +39,6 @@ zend_bool php_phongo_zend_hash_apply_protection_end(zend_array* ht) } return 1; } -#endif /* ZEND_HASH_GET_APPLY_COUNT */ #if PHP_VERSION_ID < 80200 const char* zend_get_object_type_case(const zend_class_entry* ce, zend_bool upper_case) diff --git a/src/phongo_compat.h b/src/phongo_compat.h index 976ac33c9..4ea2ad0e3 100644 --- a/src/phongo_compat.h +++ b/src/phongo_compat.h @@ -86,10 +86,6 @@ #error Unsupported architecture (integers are neither 32-bit nor 64-bit) #endif -#if PHP_VERSION_ID < 70300 -#define zend_object_alloc(obj_size, ce) ecalloc(1, obj_size + zend_object_properties_size(ce)) -#endif - #define ADD_ASSOC_STR(_zv, _key, _value) add_assoc_string_ex(_zv, ZEND_STRL(_key), (char*) ZSTR_VAL(_value)); #define ADD_ASSOC_STRING(_zv, _key, _value) add_assoc_string_ex(_zv, ZEND_STRL(_key), (char*) (_value)); #define ADD_ASSOC_STRINGL(_zv, _key, _value, _len) add_assoc_stringl_ex(_zv, ZEND_STRL(_key), (char*) (_value), _len); @@ -176,37 +172,6 @@ #error Unsupported architecture (integers are neither 32-bit nor 64-bit) #endif /* SIZEOF_ZEND_LONG */ -#if PHP_VERSION_ID < 70300 -#define ZVAL_COPY_DEREF(z, v) \ - do { \ - zval* _z3 = (v); \ - if (Z_OPT_REFCOUNTED_P(_z3)) { \ - if (UNEXPECTED(Z_OPT_ISREF_P(_z3))) { \ - _z3 = Z_REFVAL_P(_z3); \ - if (Z_OPT_REFCOUNTED_P(_z3)) { \ - Z_ADDREF_P(_z3); \ - } \ - } else { \ - Z_ADDREF_P(_z3); \ - } \ - } \ - ZVAL_COPY_VALUE(z, _z3); \ - } while (0) -#endif /* PHP_VERSION_ID < 70300 */ - -#if PHP_VERSION_ID < 70300 -static inline zend_bool zend_ini_parse_bool(zend_string* str) -{ - if (zend_string_equals_literal_ci(str, "true") || - zend_string_equals_literal_ci(str, "yes") || - zend_string_equals_literal_ci(str, "on")) { - return 1; - } else { - return atoi(ZSTR_VAL(str)) != 0; - } -} -#endif /* PHP_VERSION_ID < 70300 */ - /* Compatibility macros to override error handling logic */ #define PHONGO_PARSE_PARAMETERS_START(min_num_args, max_num_args) \ do { \ @@ -275,16 +240,6 @@ static inline zend_bool zend_ini_parse_bool(zend_string* str) Z_PARAM_ZVAL_EX(dest, 1, 0) #endif -/* Z_PARAM_ARRAY_OR_OBJECT requires 3 arguments in PHP < 7.3. - * See: https://github.com/php/php-src/commit/a595b0f75bf8bc0d3da8ca5cb03f8b1a694d26b2 */ -#if PHP_VERSION_ID < 70300 -#define PHONGO_PARAM_ARRAY_OR_OBJECT(dest) \ - Z_PARAM_ARRAY_OR_OBJECT(dest, 0, 0) -#else -#define PHONGO_PARAM_ARRAY_OR_OBJECT(dest) \ - Z_PARAM_ARRAY_OR_OBJECT(dest) -#endif - /* ZEND_ABSTRACT_ME_WITH_FLAGS was introduced in PHP 8.0. */ #ifndef ZEND_ABSTRACT_ME_WITH_FLAGS #define ZEND_ABSTRACT_ME_WITH_FLAGS(classname, name, arg_info, flags) ZEND_RAW_FENTRY(#name, NULL, arg_info, flags) From 5c0ad96bb4af4164e2c44846ad415c2d7552ad25 Mon Sep 17 00:00:00 2001 From: Andreas Braun Date: Mon, 31 Jul 2023 13:24:54 +0200 Subject: [PATCH 3/8] Drop tests for legacy PHP serialization behaviour --- tests/bson/bson-binary-serialization-001.phpt | 100 --------- tests/bson/bson-binary-serialization-002.phpt | 3 - .../bson-binary-serialization_error-004.phpt | 3 - .../bson-binary-serialization_error-005.phpt | 3 - .../bson-binary-serialization_error-006.phpt | 3 - .../bson-dbpointer-serialization-001.phpt | 34 --- .../bson-dbpointer-serialization-002.phpt | 3 - ...son-dbpointer-serialization_error-003.phpt | 3 - ...son-dbpointer-serialization_error-004.phpt | 3 - .../bson-decimal128-serialization-001.phpt | 78 ------- .../bson-decimal128-serialization-002.phpt | 3 - ...on-decimal128-serialization_error-003.phpt | 3 - ...on-decimal128-serialization_error-004.phpt | 3 - .../bson/bson-document-serialization-001.phpt | 85 ------- .../bson/bson-document-serialization-002.phpt | 3 - .../bson-document-unserialize_error-001.phpt | 52 ----- .../bson-document-unserialize_error-002.phpt | 3 - tests/bson/bson-int64-serialization-001.phpt | 56 ----- tests/bson/bson-int64-serialization-002.phpt | 3 - .../bson-int64-serialization_error-003.phpt | 3 - .../bson-int64-serialization_error-004.phpt | 3 - .../bson-javascript-serialization-001.phpt | 105 --------- .../bson-javascript-serialization-002.phpt | 3 - ...on-javascript-serialization_error-004.phpt | 3 - ...on-javascript-serialization_error-005.phpt | 3 - ...on-javascript-serialization_error-006.phpt | 3 - tests/bson/bson-maxkey-serialization-001.phpt | 22 -- tests/bson/bson-maxkey-serialization-002.phpt | 3 - tests/bson/bson-minkey-serialization-001.phpt | 22 -- tests/bson/bson-minkey-serialization-002.phpt | 3 - .../bson/bson-objectid-serialization-001.phpt | 26 --- .../bson/bson-objectid-serialization-002.phpt | 3 - ...bson-objectid-serialization_error-003.phpt | 3 - ...bson-objectid-serialization_error-004.phpt | 3 - .../bson-packedarray-serialization-001.phpt | 65 ------ .../bson-packedarray-serialization-002.phpt | 3 - ...son-packedarray-unserialize_error-001.phpt | 52 ----- ...son-packedarray-unserialize_error-002.phpt | 3 - tests/bson/bson-regex-serialization-001.phpt | 30 --- tests/bson/bson-regex-serialization-002.phpt | 30 --- tests/bson/bson-regex-serialization-004.phpt | 3 - tests/bson/bson-regex-serialization-005.phpt | 3 - tests/bson/bson-regex-serialization-006.phpt | 3 - .../bson-regex-serialization_error-003.phpt | 3 - .../bson-regex-serialization_error-004.phpt | 3 - tests/bson/bson-symbol-serialization-001.phpt | 28 --- tests/bson/bson-symbol-serialization-002.phpt | 3 - .../bson-symbol-serialization_error-003.phpt | 3 - .../bson-symbol-serialization_error-004.phpt | 3 - .../bson-timestamp-serialization-001.phpt | 70 ------ .../bson-timestamp-serialization-002.phpt | 56 ----- .../bson-timestamp-serialization-003.phpt | 3 - .../bson-timestamp-serialization-004.phpt | 2 - ...son-timestamp-serialization_error-005.phpt | 3 - ...son-timestamp-serialization_error-006.phpt | 3 - ...son-timestamp-serialization_error-007.phpt | 2 - ...son-timestamp-serialization_error-008.phpt | 3 - .../bson-undefined-serialization-001.phpt | 22 -- .../bson-undefined-serialization-002.phpt | 3 - .../bson-utcdatetime-serialization-001.phpt | 56 ----- .../bson-utcdatetime-serialization-002.phpt | 46 ---- .../bson-utcdatetime-serialization-003.phpt | 3 - .../bson-utcdatetime-serialization-004.phpt | 2 - ...n-utcdatetime-serialization_error-003.phpt | 3 - ...n-utcdatetime-serialization_error-004.phpt | 3 - .../cursorid/cursorid-serialization-001.phpt | 50 ----- .../cursorid/cursorid-serialization-002.phpt | 3 - .../cursorid-serialization_error-002.phpt | 3 - .../readconcern-serialization-001.phpt | 46 ---- .../readconcern-serialization-002.phpt | 3 - .../readconcern-serialization_error-002.phpt | 3 - .../readpreference-serialization-001.phpt | 212 ------------------ .../readpreference-serialization-002.phpt | 3 - ...eadpreference-serialization_error-002.phpt | 3 - .../serverApi-serialization-001.phpt | 106 --------- .../serverApi-serialization-002.phpt | 3 - .../serverApi-serialization_error-002.phpt | 3 - .../writeconcern-serialization-001.phpt | 212 ------------------ .../writeconcern-serialization-002.phpt | 3 - .../writeconcern-serialization_error-002.phpt | 3 - 80 files changed, 1823 deletions(-) delete mode 100644 tests/bson/bson-binary-serialization-001.phpt delete mode 100644 tests/bson/bson-dbpointer-serialization-001.phpt delete mode 100644 tests/bson/bson-decimal128-serialization-001.phpt delete mode 100644 tests/bson/bson-document-serialization-001.phpt delete mode 100644 tests/bson/bson-document-unserialize_error-001.phpt delete mode 100644 tests/bson/bson-int64-serialization-001.phpt delete mode 100644 tests/bson/bson-javascript-serialization-001.phpt delete mode 100644 tests/bson/bson-maxkey-serialization-001.phpt delete mode 100644 tests/bson/bson-minkey-serialization-001.phpt delete mode 100644 tests/bson/bson-objectid-serialization-001.phpt delete mode 100644 tests/bson/bson-packedarray-serialization-001.phpt delete mode 100644 tests/bson/bson-packedarray-unserialize_error-001.phpt delete mode 100644 tests/bson/bson-regex-serialization-001.phpt delete mode 100644 tests/bson/bson-regex-serialization-002.phpt delete mode 100644 tests/bson/bson-symbol-serialization-001.phpt delete mode 100644 tests/bson/bson-timestamp-serialization-001.phpt delete mode 100644 tests/bson/bson-timestamp-serialization-002.phpt delete mode 100644 tests/bson/bson-undefined-serialization-001.phpt delete mode 100644 tests/bson/bson-utcdatetime-serialization-001.phpt delete mode 100644 tests/bson/bson-utcdatetime-serialization-002.phpt delete mode 100644 tests/cursorid/cursorid-serialization-001.phpt delete mode 100644 tests/readConcern/readconcern-serialization-001.phpt delete mode 100644 tests/readPreference/readpreference-serialization-001.phpt delete mode 100644 tests/serverApi/serverApi-serialization-001.phpt delete mode 100644 tests/writeConcern/writeconcern-serialization-001.phpt diff --git a/tests/bson/bson-binary-serialization-001.phpt b/tests/bson/bson-binary-serialization-001.phpt deleted file mode 100644 index 018999f5f..000000000 --- a/tests/bson/bson-binary-serialization-001.phpt +++ /dev/null @@ -1,100 +0,0 @@ ---TEST-- -MongoDB\BSON\Binary serialization (Serializable interface) ---SKIPIF-- - -=', '7.4.0'); ?> ---FILE-- - -===DONE=== - ---EXPECTF-- -object(MongoDB\BSON\Binary)#%d (%d) { - ["data"]=> - string(6) "foobar" - ["type"]=> - int(0) -} -string(77) "C:19:"MongoDB\BSON\Binary":45:{a:2:{s:4:"data";s:6:"foobar";s:4:"type";i:0;}}" -object(MongoDB\BSON\Binary)#%d (%d) { - ["data"]=> - string(6) "foobar" - ["type"]=> - int(0) -} - -object(MongoDB\BSON\Binary)#%d (%d) { - ["data"]=> - string(0) "" - ["type"]=> - int(0) -} -string(71) "C:19:"MongoDB\BSON\Binary":39:{a:2:{s:4:"data";s:0:"";s:4:"type";i:0;}}" -object(MongoDB\BSON\Binary)#%d (%d) { - ["data"]=> - string(0) "" - ["type"]=> - int(0) -} - -object(MongoDB\BSON\Binary)#%d (%d) { - ["data"]=> - string(4) "%sfoo" - ["type"]=> - int(0) -} -string(75) "C:19:"MongoDB\BSON\Binary":43:{a:2:{s:4:"data";s:4:"%sfoo";s:4:"type";i:0;}}" -object(MongoDB\BSON\Binary)#%d (%d) { - ["data"]=> - string(4) "%sfoo" - ["type"]=> - int(0) -} - -object(MongoDB\BSON\Binary)#%d (%d) { - ["data"]=> - string(16) "%s" - ["type"]=> - int(4) -} -string(88) "C:19:"MongoDB\BSON\Binary":56:{a:2:{s:4:"data";s:16:"%s";s:4:"type";i:4;}}" -object(MongoDB\BSON\Binary)#%d (%d) { - ["data"]=> - string(16) "%s" - ["type"]=> - int(4) -} - -object(MongoDB\BSON\Binary)#%d (%d) { - ["data"]=> - string(16) "%s" - ["type"]=> - int(5) -} -string(88) "C:19:"MongoDB\BSON\Binary":56:{a:2:{s:4:"data";s:16:"%s";s:4:"type";i:5;}}" -object(MongoDB\BSON\Binary)#%d (%d) { - ["data"]=> - string(16) "%s" - ["type"]=> - int(5) -} - -===DONE=== diff --git a/tests/bson/bson-binary-serialization-002.phpt b/tests/bson/bson-binary-serialization-002.phpt index 76df52118..1fe9be000 100644 --- a/tests/bson/bson-binary-serialization-002.phpt +++ b/tests/bson/bson-binary-serialization-002.phpt @@ -1,8 +1,5 @@ --TEST-- MongoDB\BSON\Binary serialization (__serialize and __unserialize) ---SKIPIF-- - - --FILE-- - --FILE-- - --FILE-- - --FILE-- -=', '7.4.0'); ?> ---FILE-- -dbref; - -var_dump($test); -var_dump($s = serialize($test)); -var_dump(unserialize($s)); -echo "\n"; - -?> -===DONE=== - ---EXPECTF-- -object(MongoDB\BSON\DBPointer)#1 (2) { - ["ref"]=> - string(11) "phongo.test" - ["id"]=> - string(24) "5a2e78accd485d55b4050000" -} -string(111) "C:22:"MongoDB\BSON\DBPointer":76:{a:2:{s:3:"ref";s:11:"phongo.test";s:2:"id";s:24:"5a2e78accd485d55b4050000";}}" -object(MongoDB\BSON\DBPointer)#2 (2) { - ["ref"]=> - string(11) "phongo.test" - ["id"]=> - string(24) "5a2e78accd485d55b4050000" -} - -===DONE=== diff --git a/tests/bson/bson-dbpointer-serialization-002.phpt b/tests/bson/bson-dbpointer-serialization-002.phpt index 11b6ce74e..815ccd05f 100644 --- a/tests/bson/bson-dbpointer-serialization-002.phpt +++ b/tests/bson/bson-dbpointer-serialization-002.phpt @@ -1,8 +1,5 @@ --TEST-- MongoDB\BSON\DBPointer serialization (__serialize and __unserialize) ---SKIPIF-- - - --FILE-- - --FILE-- - --FILE-- -=', '7.4.0'); ?> ---FILE-- - -===DONE=== - ---EXPECTF-- -object(MongoDB\BSON\Decimal128)#%d (%d) { - ["dec"]=> - string(9) "1234.5678" -} -string(68) "C:23:"MongoDB\BSON\Decimal128":32:{a:1:{s:3:"dec";s:9:"1234.5678";}}" -object(MongoDB\BSON\Decimal128)#%d (%d) { - ["dec"]=> - string(9) "1234.5678" -} - -object(MongoDB\BSON\Decimal128)#%d (%d) { - ["dec"]=> - string(10) "-1234.5678" -} -string(70) "C:23:"MongoDB\BSON\Decimal128":34:{a:1:{s:3:"dec";s:10:"-1234.5678";}}" -object(MongoDB\BSON\Decimal128)#%d (%d) { - ["dec"]=> - string(10) "-1234.5678" -} - -object(MongoDB\BSON\Decimal128)#%d (%d) { - ["dec"]=> - string(11) "1.23456E-75" -} -string(71) "C:23:"MongoDB\BSON\Decimal128":35:{a:1:{s:3:"dec";s:11:"1.23456E-75";}}" -object(MongoDB\BSON\Decimal128)#%d (%d) { - ["dec"]=> - string(11) "1.23456E-75" -} - -object(MongoDB\BSON\Decimal128)#%d (%d) { - ["dec"]=> - string(8) "Infinity" -} -string(67) "C:23:"MongoDB\BSON\Decimal128":31:{a:1:{s:3:"dec";s:8:"Infinity";}}" -object(MongoDB\BSON\Decimal128)#%d (%d) { - ["dec"]=> - string(8) "Infinity" -} - -object(MongoDB\BSON\Decimal128)#%d (%d) { - ["dec"]=> - string(3) "NaN" -} -string(62) "C:23:"MongoDB\BSON\Decimal128":26:{a:1:{s:3:"dec";s:3:"NaN";}}" -object(MongoDB\BSON\Decimal128)#%d (%d) { - ["dec"]=> - string(3) "NaN" -} - -===DONE=== diff --git a/tests/bson/bson-decimal128-serialization-002.phpt b/tests/bson/bson-decimal128-serialization-002.phpt index 17bd32126..b099a8a20 100644 --- a/tests/bson/bson-decimal128-serialization-002.phpt +++ b/tests/bson/bson-decimal128-serialization-002.phpt @@ -1,8 +1,5 @@ --TEST-- MongoDB\BSON\Decimal128 serialization (__serialize and __unserialize) ---SKIPIF-- - - --FILE-- - --FILE-- - --FILE-- -=', '7.4.0'); ?> ---FILE-- - 1, 'array' => [0, 1, 'foo'], 'document' => ['foo' => 'bar']]); -var_dump($document); -var_dump($s = serialize($document)); -var_dump(unserialize($s)); - -?> -===DONE=== - ---EXPECTF-- -object(MongoDB\BSON\Document)#%d (%d) { - ["data"]=> - string(108) "TwAAABBfaWQAAQAAAARhcnJheQAeAAAAEDAAAAAAABAxAAEAAAACMgAEAAAAZm9vAAADZG9jdW1lbnQAEgAAAAJmb28ABAAAAGJhcgAAAA==" - ["value"]=> - object(stdClass)#%d (%d) { - ["_id"]=> - int(1) - ["array"]=> - object(MongoDB\BSON\PackedArray)#%d (%d) { - ["data"]=> - string(40) "HgAAABAwAAAAAAAQMQABAAAAAjIABAAAAGZvbwAA" - ["value"]=> - array(3) { - [0]=> - int(0) - [1]=> - int(1) - [2]=> - string(3) "foo" - } - } - ["document"]=> - object(MongoDB\BSON\Document)#%d (%d) { - ["data"]=> - string(24) "EgAAAAJmb28ABAAAAGJhcgAA" - ["value"]=> - object(stdClass)#%d (%d) { - ["foo"]=> - string(3) "bar" - } - } - } -} -string(169) "C:21:"MongoDB\BSON\Document":134:{a:1:{s:4:"data";s:108:"TwAAABBfaWQAAQAAAARhcnJheQAeAAAAEDAAAAAAABAxAAEAAAACMgAEAAAAZm9vAAADZG9jdW1lbnQAEgAAAAJmb28ABAAAAGJhcgAAAA==";}}" -object(MongoDB\BSON\Document)#%d (%d) { - ["data"]=> - string(108) "TwAAABBfaWQAAQAAAARhcnJheQAeAAAAEDAAAAAAABAxAAEAAAACMgAEAAAAZm9vAAADZG9jdW1lbnQAEgAAAAJmb28ABAAAAGJhcgAAAA==" - ["value"]=> - object(stdClass)#%d (%d) { - ["_id"]=> - int(1) - ["array"]=> - object(MongoDB\BSON\PackedArray)#%d (%d) { - ["data"]=> - string(40) "HgAAABAwAAAAAAAQMQABAAAAAjIABAAAAGZvbwAA" - ["value"]=> - array(3) { - [0]=> - int(0) - [1]=> - int(1) - [2]=> - string(3) "foo" - } - } - ["document"]=> - object(MongoDB\BSON\Document)#%d (%d) { - ["data"]=> - string(24) "EgAAAAJmb28ABAAAAGJhcgAA" - ["value"]=> - object(stdClass)#%d (%d) { - ["foo"]=> - string(3) "bar" - } - } - } -} -===DONE=== diff --git a/tests/bson/bson-document-serialization-002.phpt b/tests/bson/bson-document-serialization-002.phpt index b55a5b540..765ff1f00 100644 --- a/tests/bson/bson-document-serialization-002.phpt +++ b/tests/bson/bson-document-serialization-002.phpt @@ -1,8 +1,5 @@ --TEST-- MongoDB\BSON\Document serialization (__serialize and __unserialize) ---SKIPIF-- - - --FILE-- -=', '7.4.0'); ?> ---FILE-- - '', - 'Last byte is non-zero' => pack( - 'VCa*xVa*', - 4 + 1 + 4 + 4 + 2, // Size: 4 bytes for size, 1 byte for type, 4 bytes for key, 4 bytes for string length, 2 bytes for string - 0x02, - 'foo', - 2, - 'a' - ), - 'Length does not match document length' => pack('VCa*Va*xx', 7, 0x02, 'foo', 1, 'a'), -]; - -foreach ($tests as $test) { - echo throws(function() use ($test) { - $data = base64_encode($test); - $dataLength = strlen($data); - - $payload = sprintf( - 'C:%d:"%s":%d:{a:1:{s:4:"data";s:%d:"%s";}}', - strlen(MongoDB\BSON\Document::class), - MongoDB\BSON\Document::class, - $dataLength + 23 + strlen((string) $dataLength), // 23 characters for everything besides the number of bytes in the payload - $dataLength, - $data - ); - - unserialize($payload); - }, MongoDB\Driver\Exception\InvalidArgumentException::class), "\n"; -} - -?> -===DONE=== - ---EXPECTF-- -OK: Got MongoDB\Driver\Exception\InvalidArgumentException -MongoDB\BSON\Document initialization requires valid BSON -OK: Got MongoDB\Driver\Exception\InvalidArgumentException -MongoDB\BSON\Document initialization requires valid BSON -OK: Got MongoDB\Driver\Exception\InvalidArgumentException -MongoDB\BSON\Document initialization requires valid BSON -===DONE=== diff --git a/tests/bson/bson-document-unserialize_error-002.phpt b/tests/bson/bson-document-unserialize_error-002.phpt index d4ed2284a..97fe37a37 100644 --- a/tests/bson/bson-document-unserialize_error-002.phpt +++ b/tests/bson/bson-document-unserialize_error-002.phpt @@ -1,8 +1,5 @@ --TEST-- MongoDB\BSON\Document::__unserialize() throws on errors ---SKIPIF-- - - --FILE-- -=', '7.4.0'); ?> ---FILE-- - -===DONE=== - ---EXPECTF-- -object(MongoDB\BSON\Int64)#%d (%d) { - ["integer"]=> - string(19) "9223372036854775807" -} -string(78) "C:18:"MongoDB\BSON\Int64":47:{a:1:{s:7:"integer";s:19:"9223372036854775807";}}" -object(MongoDB\BSON\Int64)#%d (%d) { - ["integer"]=> - string(19) "9223372036854775807" -} - -object(MongoDB\BSON\Int64)#%d (%d) { - ["integer"]=> - string(20) "-9223372036854775808" -} -string(79) "C:18:"MongoDB\BSON\Int64":48:{a:1:{s:7:"integer";s:20:"-9223372036854775808";}}" -object(MongoDB\BSON\Int64)#%d (%d) { - ["integer"]=> - string(20) "-9223372036854775808" -} - -object(MongoDB\BSON\Int64)#%d (%d) { - ["integer"]=> - string(1) "0" -} -string(59) "C:18:"MongoDB\BSON\Int64":28:{a:1:{s:7:"integer";s:1:"0";}}" -object(MongoDB\BSON\Int64)#%d (%d) { - ["integer"]=> - string(1) "0" -} - -===DONE=== diff --git a/tests/bson/bson-int64-serialization-002.phpt b/tests/bson/bson-int64-serialization-002.phpt index 746300573..c0195a8c3 100644 --- a/tests/bson/bson-int64-serialization-002.phpt +++ b/tests/bson/bson-int64-serialization-002.phpt @@ -1,8 +1,5 @@ --TEST-- MongoDB\BSON\Int64 serialization (__serialize and __unserialize) ---SKIPIF-- - - --FILE-- - --FILE-- - --FILE-- -=', '7.4.0'); ?> ---FILE-- - 42]], - ['function foo() { return id; }', ['id' => new MongoDB\BSON\ObjectId('53e2a1c40640fd72175d4603')]], -]; - -foreach ($tests as $test) { - list($code, $scope) = $test; - - var_dump($js = new MongoDB\BSON\Javascript($code, $scope)); - var_dump($s = serialize($js)); - var_dump(unserialize($s)); - echo "\n"; -} - -?> -===DONE=== - ---EXPECTF-- -object(MongoDB\BSON\Javascript)#%d (%d) { - ["code"]=> - string(33) "function foo(bar) { return bar; }" - ["scope"]=> - NULL -} -string(108) "C:23:"MongoDB\BSON\Javascript":72:{a:2:{s:4:"code";s:33:"function foo(bar) { return bar; }";s:5:"scope";N;}}" -object(MongoDB\BSON\Javascript)#%d (%d) { - ["code"]=> - string(33) "function foo(bar) { return bar; }" - ["scope"]=> - NULL -} - -object(MongoDB\BSON\Javascript)#%d (%d) { - ["code"]=> - string(33) "function foo(bar) { return bar; }" - ["scope"]=> - object(stdClass)#%d (%d) { - } -} -string(125) "C:23:"MongoDB\BSON\Javascript":89:{a:2:{s:4:"code";s:33:"function foo(bar) { return bar; }";s:5:"scope";O:8:"stdClass":0:{}}}" -object(MongoDB\BSON\Javascript)#%d (%d) { - ["code"]=> - string(33) "function foo(bar) { return bar; }" - ["scope"]=> - object(stdClass)#%d (%d) { - } -} - -object(MongoDB\BSON\Javascript)#%d (%d) { - ["code"]=> - string(30) "function foo() { return foo; }" - ["scope"]=> - object(stdClass)#%d (%d) { - ["foo"]=> - int(42) - } -} -string(138) "C:23:"MongoDB\BSON\Javascript":101:{a:2:{s:4:"code";s:30:"function foo() { return foo; }";s:5:"scope";O:8:"stdClass":1:{s:3:"foo";i:42;}}}" -object(MongoDB\BSON\Javascript)#%d (%d) { - ["code"]=> - string(30) "function foo() { return foo; }" - ["scope"]=> - object(stdClass)#%d (%d) { - ["foo"]=> - int(42) - } -} - -object(MongoDB\BSON\Javascript)#%d (%d) { - ["code"]=> - string(29) "function foo() { return id; }" - ["scope"]=> - object(stdClass)#%d (%d) { - ["id"]=> - object(MongoDB\BSON\ObjectId)#%d (%d) { - ["oid"]=> - string(24) "53e2a1c40640fd72175d4603" - } - } -} -string(213) "C:23:"MongoDB\BSON\Javascript":176:{a:2:{s:4:"code";s:29:"function foo() { return id; }";s:5:"scope";O:8:"stdClass":1:{s:2:"id";C:21:"MongoDB\BSON\ObjectId":48:{a:1:{s:3:"oid";s:24:"53e2a1c40640fd72175d4603";}}}}}" -object(MongoDB\BSON\Javascript)#%d (%d) { - ["code"]=> - string(29) "function foo() { return id; }" - ["scope"]=> - object(stdClass)#%d (%d) { - ["id"]=> - object(MongoDB\BSON\ObjectId)#%d (%d) { - ["oid"]=> - string(24) "53e2a1c40640fd72175d4603" - } - } -} - -===DONE=== diff --git a/tests/bson/bson-javascript-serialization-002.phpt b/tests/bson/bson-javascript-serialization-002.phpt index 49befc971..147750fca 100644 --- a/tests/bson/bson-javascript-serialization-002.phpt +++ b/tests/bson/bson-javascript-serialization-002.phpt @@ -1,8 +1,5 @@ --TEST-- MongoDB\BSON\Javascript serialization (__serialize and __unserialize) ---SKIPIF-- - - --FILE-- - --FILE-- - --FILE-- - --FILE-- -=', '7.4.0'); ?> ---FILE-- - -===DONE=== - ---EXPECTF-- -object(MongoDB\BSON\MaxKey)#%d (%d) { -} -string(31) "C:19:"MongoDB\BSON\MaxKey":0:{}" -object(MongoDB\BSON\MaxKey)#%d (%d) { -} -===DONE=== diff --git a/tests/bson/bson-maxkey-serialization-002.phpt b/tests/bson/bson-maxkey-serialization-002.phpt index 125f9b4f4..0aa770f60 100644 --- a/tests/bson/bson-maxkey-serialization-002.phpt +++ b/tests/bson/bson-maxkey-serialization-002.phpt @@ -1,8 +1,5 @@ --TEST-- MongoDB\BSON\MaxKey serialization (__serialize and __unserialize) ---SKIPIF-- - - --FILE-- -=', '7.4.0'); ?> ---FILE-- - -===DONE=== - ---EXPECTF-- -object(MongoDB\BSON\MinKey)#%d (%d) { -} -string(31) "C:19:"MongoDB\BSON\MinKey":0:{}" -object(MongoDB\BSON\MinKey)#%d (%d) { -} -===DONE=== diff --git a/tests/bson/bson-minkey-serialization-002.phpt b/tests/bson/bson-minkey-serialization-002.phpt index 3b648668c..3a8aa17af 100644 --- a/tests/bson/bson-minkey-serialization-002.phpt +++ b/tests/bson/bson-minkey-serialization-002.phpt @@ -1,8 +1,5 @@ --TEST-- MongoDB\BSON\MinKey serialization (__serialize and __unserialize) ---SKIPIF-- - - --FILE-- -=', '7.4.0'); ?> ---FILE-- - -===DONE=== - ---EXPECTF-- -object(MongoDB\BSON\ObjectId)#%d (%d) { - ["oid"]=> - string(24) "576c25db6118fd406e6e6471" -} -string(82) "C:21:"MongoDB\BSON\ObjectId":48:{a:1:{s:3:"oid";s:24:"576c25db6118fd406e6e6471";}}" -object(MongoDB\BSON\ObjectId)#%d (%d) { - ["oid"]=> - string(24) "576c25db6118fd406e6e6471" -} -===DONE=== diff --git a/tests/bson/bson-objectid-serialization-002.phpt b/tests/bson/bson-objectid-serialization-002.phpt index 31eafa9ef..cf2cbf644 100644 --- a/tests/bson/bson-objectid-serialization-002.phpt +++ b/tests/bson/bson-objectid-serialization-002.phpt @@ -1,8 +1,5 @@ --TEST-- MongoDB\BSON\ObjectId serialization (__serialize and __unserialize) ---SKIPIF-- - - --FILE-- - --FILE-- - --FILE-- -=', '7.4.0'); ?> ---FILE-- - 'bar']]); -var_dump($array); -var_dump($s = serialize($array)); -var_dump(unserialize($s)); - -?> -===DONE=== - ---EXPECTF-- -object(MongoDB\BSON\PackedArray)#%d (%d) { - ["data"]=> - string(68) "MwAAABAwAAAAAAAQMQABAAAAAjIABAAAAGZvbwADMwASAAAAAmZvbwAEAAAAYmFyAAAA" - ["value"]=> - array(4) { - [0]=> - int(0) - [1]=> - int(1) - [2]=> - string(3) "foo" - [3]=> - object(MongoDB\BSON\Document)#%d (%d) { - ["data"]=> - string(24) "EgAAAAJmb28ABAAAAGJhcgAA" - ["value"]=> - object(stdClass)#%d (%d) { - ["foo"]=> - string(3) "bar" - } - } - } -} -string(130) "C:24:"MongoDB\BSON\PackedArray":93:{a:1:{s:4:"data";s:68:"MwAAABAwAAAAAAAQMQABAAAAAjIABAAAAGZvbwADMwASAAAAAmZvbwAEAAAAYmFyAAAA";}}" -object(MongoDB\BSON\PackedArray)#%d (%d) { - ["data"]=> - string(68) "MwAAABAwAAAAAAAQMQABAAAAAjIABAAAAGZvbwADMwASAAAAAmZvbwAEAAAAYmFyAAAA" - ["value"]=> - array(4) { - [0]=> - int(0) - [1]=> - int(1) - [2]=> - string(3) "foo" - [3]=> - object(MongoDB\BSON\Document)#%d (%d) { - ["data"]=> - string(24) "EgAAAAJmb28ABAAAAGJhcgAA" - ["value"]=> - object(stdClass)#%d (%d) { - ["foo"]=> - string(3) "bar" - } - } - } -} -===DONE=== diff --git a/tests/bson/bson-packedarray-serialization-002.phpt b/tests/bson/bson-packedarray-serialization-002.phpt index 3c4e686a3..7ed819599 100644 --- a/tests/bson/bson-packedarray-serialization-002.phpt +++ b/tests/bson/bson-packedarray-serialization-002.phpt @@ -1,8 +1,5 @@ --TEST-- MongoDB\BSON\PackedArray serialization (__serialize and __unserialize) ---SKIPIF-- - - --FILE-- -=', '7.4.0'); ?> ---FILE-- - '', - 'Last byte is non-zero' => pack( - 'VCa*xVa*', - 4 + 1 + 2 + 4 + 2, // Size: 4 bytes for size, 1 byte for type, 2 bytes for key, 4 bytes for string length, 2 bytes for string - 0x02, - '0', - 2, - 'a' - ), - 'Length does not match document length' => pack('VCa*Va*xx', 7, 0x02, '0', 1, 'a'), -]; - -foreach ($tests as $test) { - echo throws(function() use ($test) { - $data = base64_encode($test); - $dataLength = strlen($data); - - $payload = sprintf( - 'C:%d:"%s":%d:{a:1:{s:4:"data";s:%d:"%s";}}', - strlen(MongoDB\BSON\PackedArray::class), - MongoDB\BSON\PackedArray::class, - $dataLength + 23 + strlen((string) $dataLength), // 23 characters for everything besides the number of bytes in the payload - $dataLength, - $data - ); - - unserialize($payload); - }, MongoDB\Driver\Exception\InvalidArgumentException::class), "\n"; -} - -?> -===DONE=== - ---EXPECTF-- -OK: Got MongoDB\Driver\Exception\InvalidArgumentException -MongoDB\BSON\PackedArray initialization requires valid BSON -OK: Got MongoDB\Driver\Exception\InvalidArgumentException -MongoDB\BSON\PackedArray initialization requires valid BSON -OK: Got MongoDB\Driver\Exception\InvalidArgumentException -MongoDB\BSON\PackedArray initialization requires valid BSON -===DONE=== diff --git a/tests/bson/bson-packedarray-unserialize_error-002.phpt b/tests/bson/bson-packedarray-unserialize_error-002.phpt index 7ecfdb1aa..7b4edbbe5 100644 --- a/tests/bson/bson-packedarray-unserialize_error-002.phpt +++ b/tests/bson/bson-packedarray-unserialize_error-002.phpt @@ -1,8 +1,5 @@ --TEST-- MongoDB\BSON\PackedArray::__unserialize() throws on errors ---SKIPIF-- - - --FILE-- -=', '7.4.0'); ?> ---FILE-- - -===DONE=== - ---EXPECTF-- -object(MongoDB\BSON\Regex)#%d (%d) { - ["pattern"]=> - string(6) "regexp" - ["flags"]=> - string(1) "i" -} -string(84) "C:18:"MongoDB\BSON\Regex":53:{a:2:{s:7:"pattern";s:6:"regexp";s:5:"flags";s:1:"i";}}" -object(MongoDB\BSON\Regex)#%d (%d) { - ["pattern"]=> - string(6) "regexp" - ["flags"]=> - string(1) "i" -} -===DONE=== diff --git a/tests/bson/bson-regex-serialization-002.phpt b/tests/bson/bson-regex-serialization-002.phpt deleted file mode 100644 index a27add257..000000000 --- a/tests/bson/bson-regex-serialization-002.phpt +++ /dev/null @@ -1,30 +0,0 @@ ---TEST-- -MongoDB\BSON\Regex serialization with flags omitted (Serializable interface) ---SKIPIF-- - -=', '7.4.0'); ?> ---FILE-- - -===DONE=== - ---EXPECTF-- -object(MongoDB\BSON\Regex)#%d (%d) { - ["pattern"]=> - string(6) "regexp" - ["flags"]=> - string(0) "" -} -string(83) "C:18:"MongoDB\BSON\Regex":52:{a:2:{s:7:"pattern";s:6:"regexp";s:5:"flags";s:0:"";}}" -object(MongoDB\BSON\Regex)#%d (%d) { - ["pattern"]=> - string(6) "regexp" - ["flags"]=> - string(0) "" -} -===DONE=== diff --git a/tests/bson/bson-regex-serialization-004.phpt b/tests/bson/bson-regex-serialization-004.phpt index 0c8ad2f81..41ac5440f 100644 --- a/tests/bson/bson-regex-serialization-004.phpt +++ b/tests/bson/bson-regex-serialization-004.phpt @@ -1,8 +1,5 @@ --TEST-- MongoDB\BSON\Regex serialization (__serialize and __unserialize) ---SKIPIF-- - - --FILE-- - --FILE-- - --FILE-- - --FILE-- - --FILE-- -=', '7.4.0'); ?> ---FILE-- -symbol; - -var_dump($symbol = $test); -var_dump($s = serialize($symbol)); -var_dump(unserialize($s)); - -?> -===DONE=== - ---EXPECTF-- -object(MongoDB\BSON\Symbol)#%d (%d) { - ["symbol"]=> - string(11) "symbolValue" -} -string(70) "C:19:"MongoDB\BSON\Symbol":38:{a:1:{s:6:"symbol";s:11:"symbolValue";}}" -object(MongoDB\BSON\Symbol)#%d (%d) { - ["symbol"]=> - string(11) "symbolValue" -} -===DONE=== diff --git a/tests/bson/bson-symbol-serialization-002.phpt b/tests/bson/bson-symbol-serialization-002.phpt index 29a49507d..dfc66847c 100644 --- a/tests/bson/bson-symbol-serialization-002.phpt +++ b/tests/bson/bson-symbol-serialization-002.phpt @@ -1,8 +1,5 @@ --TEST-- MongoDB\BSON\Symbol serialization (__serialize and __unserialize) ---SKIPIF-- - - --FILE-- - --FILE-- - --FILE-- -=', '7.4.0'); ?> ---FILE-- - -===DONE=== - ---EXPECTF-- -object(MongoDB\BSON\Timestamp)#%d (%d) { - ["increment"]=> - string(4) "1234" - ["timestamp"]=> - string(4) "5678" -} -string(95) "C:22:"MongoDB\BSON\Timestamp":60:{a:2:{s:9:"increment";s:4:"1234";s:9:"timestamp";s:4:"5678";}}" -object(MongoDB\BSON\Timestamp)#%d (%d) { - ["increment"]=> - string(4) "1234" - ["timestamp"]=> - string(4) "5678" -} - -object(MongoDB\BSON\Timestamp)#%d (%d) { - ["increment"]=> - string(10) "2147483647" - ["timestamp"]=> - string(1) "0" -} -string(99) "C:22:"MongoDB\BSON\Timestamp":64:{a:2:{s:9:"increment";s:10:"2147483647";s:9:"timestamp";s:1:"0";}}" -object(MongoDB\BSON\Timestamp)#%d (%d) { - ["increment"]=> - string(10) "2147483647" - ["timestamp"]=> - string(1) "0" -} - -object(MongoDB\BSON\Timestamp)#%d (%d) { - ["increment"]=> - string(1) "0" - ["timestamp"]=> - string(10) "2147483647" -} -string(99) "C:22:"MongoDB\BSON\Timestamp":64:{a:2:{s:9:"increment";s:1:"0";s:9:"timestamp";s:10:"2147483647";}}" -object(MongoDB\BSON\Timestamp)#%d (%d) { - ["increment"]=> - string(1) "0" - ["timestamp"]=> - string(10) "2147483647" -} - -===DONE=== diff --git a/tests/bson/bson-timestamp-serialization-002.phpt b/tests/bson/bson-timestamp-serialization-002.phpt deleted file mode 100644 index 742a8274f..000000000 --- a/tests/bson/bson-timestamp-serialization-002.phpt +++ /dev/null @@ -1,56 +0,0 @@ ---TEST-- -MongoDB\BSON\Timestamp serialization (Serializable interface) (64-bit) ---SKIPIF-- - - -=', '7.4.0'); ?> ---FILE-- - -===DONE=== - ---EXPECTF-- -object(MongoDB\BSON\Timestamp)#%d (%d) { - ["increment"]=> - string(10) "4294967295" - ["timestamp"]=> - string(1) "0" -} -string(99) "C:22:"MongoDB\BSON\Timestamp":64:{a:2:{s:9:"increment";s:10:"4294967295";s:9:"timestamp";s:1:"0";}}" -object(MongoDB\BSON\Timestamp)#%d (%d) { - ["increment"]=> - string(10) "4294967295" - ["timestamp"]=> - string(1) "0" -} - -object(MongoDB\BSON\Timestamp)#%d (%d) { - ["increment"]=> - string(1) "0" - ["timestamp"]=> - string(10) "4294967295" -} -string(99) "C:22:"MongoDB\BSON\Timestamp":64:{a:2:{s:9:"increment";s:1:"0";s:9:"timestamp";s:10:"4294967295";}}" -object(MongoDB\BSON\Timestamp)#%d (%d) { - ["increment"]=> - string(1) "0" - ["timestamp"]=> - string(10) "4294967295" -} - -===DONE=== diff --git a/tests/bson/bson-timestamp-serialization-003.phpt b/tests/bson/bson-timestamp-serialization-003.phpt index adb871b01..6394021f3 100644 --- a/tests/bson/bson-timestamp-serialization-003.phpt +++ b/tests/bson/bson-timestamp-serialization-003.phpt @@ -1,8 +1,5 @@ --TEST-- MongoDB\BSON\Timestamp serialization (__serialize and __unserialize) ---SKIPIF-- - - --FILE-- - --FILE-- - --FILE-- - --FILE-- - --FILE-- - --FILE-- -=', '7.4.0'); ?> ---FILE-- -undefined); -var_dump($s = serialize($undefined)); -var_dump(unserialize($s)); - -?> -===DONE=== - ---EXPECTF-- -object(MongoDB\BSON\Undefined)#%d (%d) { -} -string(34) "C:22:"MongoDB\BSON\Undefined":0:{}" -object(MongoDB\BSON\Undefined)#%d (%d) { -} -===DONE=== diff --git a/tests/bson/bson-undefined-serialization-002.phpt b/tests/bson/bson-undefined-serialization-002.phpt index ac0634400..8804dfd2f 100644 --- a/tests/bson/bson-undefined-serialization-002.phpt +++ b/tests/bson/bson-undefined-serialization-002.phpt @@ -1,8 +1,5 @@ --TEST-- MongoDB\BSON\Undefined serialization (__serialize and __unserialize) ---SKIPIF-- - - --FILE-- -=', '7.4.0'); ?> ---FILE-- - -===DONE=== - ---EXPECTF-- -object(MongoDB\BSON\UTCDateTime)#%d (%d) { - ["milliseconds"]=> - string(1) "0" -} -string(71) "C:24:"MongoDB\BSON\UTCDateTime":34:{a:1:{s:12:"milliseconds";s:1:"0";}}" -object(MongoDB\BSON\UTCDateTime)#%d (%d) { - ["milliseconds"]=> - string(1) "0" -} - -object(MongoDB\BSON\UTCDateTime)#%d (%d) { - ["milliseconds"]=> - string(14) "-1416445411987" -} -string(85) "C:24:"MongoDB\BSON\UTCDateTime":48:{a:1:{s:12:"milliseconds";s:14:"-1416445411987";}}" -object(MongoDB\BSON\UTCDateTime)#%d (%d) { - ["milliseconds"]=> - string(14) "-1416445411987" -} - -object(MongoDB\BSON\UTCDateTime)#%d (%d) { - ["milliseconds"]=> - string(13) "1416445411987" -} -string(84) "C:24:"MongoDB\BSON\UTCDateTime":47:{a:1:{s:12:"milliseconds";s:13:"1416445411987";}}" -object(MongoDB\BSON\UTCDateTime)#%d (%d) { - ["milliseconds"]=> - string(13) "1416445411987" -} - -===DONE=== diff --git a/tests/bson/bson-utcdatetime-serialization-002.phpt b/tests/bson/bson-utcdatetime-serialization-002.phpt deleted file mode 100644 index dcab455ba..000000000 --- a/tests/bson/bson-utcdatetime-serialization-002.phpt +++ /dev/null @@ -1,46 +0,0 @@ ---TEST-- -MongoDB\BSON\UTCDateTime serialization (unserialize 32-bit data on 64-bit) (Serializable interface) ---SKIPIF-- - - -=', '7.4.0'); ?> ---FILE-- - -===DONE=== - ---EXPECTF-- -string(71) "C:24:"MongoDB\BSON\UTCDateTime":34:{a:1:{s:12:"milliseconds";s:1:"0";}}" -object(MongoDB\BSON\UTCDateTime)#%d (%d) { - ["milliseconds"]=> - string(1) "0" -} - -string(85) "C:24:"MongoDB\BSON\UTCDateTime":48:{a:1:{s:12:"milliseconds";s:14:"-1416445411987";}}" -object(MongoDB\BSON\UTCDateTime)#%d (%d) { - ["milliseconds"]=> - string(14) "-1416445411987" -} - -string(84) "C:24:"MongoDB\BSON\UTCDateTime":47:{a:1:{s:12:"milliseconds";s:13:"1416445411987";}}" -object(MongoDB\BSON\UTCDateTime)#%d (%d) { - ["milliseconds"]=> - string(13) "1416445411987" -} - -===DONE=== diff --git a/tests/bson/bson-utcdatetime-serialization-003.phpt b/tests/bson/bson-utcdatetime-serialization-003.phpt index 51e9135a6..941057adf 100644 --- a/tests/bson/bson-utcdatetime-serialization-003.phpt +++ b/tests/bson/bson-utcdatetime-serialization-003.phpt @@ -1,8 +1,5 @@ --TEST-- MongoDB\BSON\UTCDateTime serialization (__serialize and __unserialize) ---SKIPIF-- - - --FILE-- - --FILE-- - --FILE-- - --FILE-- -=', '7.4.0'); ?> ---FILE-- - -===DONE=== - ---EXPECTF-- -object(MongoDB\Driver\CursorId)#%d (%d) { - ["id"]=> - %rint\(7250031947823432848\)|string\(19\) "7250031947823432848"%r -} -bool(true) -C:23:"MongoDB\Driver\CursorId":42:{a:1:{s:2:"id";s:19:"7250031947823432848";}} -object(MongoDB\Driver\CursorId)#%d (%d) { - ["id"]=> - %rint\(7250031947823432848\)|string\(19\) "7250031947823432848"%r -} - -object(MongoDB\Driver\CursorId)#%d (%d) { - ["id"]=> - int(0) -} -bool(true) -C:23:"MongoDB\Driver\CursorId":23:{a:1:{s:2:"id";s:1:"0";}} -object(MongoDB\Driver\CursorId)#%d (%d) { - ["id"]=> - int(0) -} - -===DONE=== diff --git a/tests/cursorid/cursorid-serialization-002.phpt b/tests/cursorid/cursorid-serialization-002.phpt index 1d8c2008a..26bc6e220 100644 --- a/tests/cursorid/cursorid-serialization-002.phpt +++ b/tests/cursorid/cursorid-serialization-002.phpt @@ -1,8 +1,5 @@ --TEST-- MongoDB\Driver\CursorId serialization (__serialize and __unserialize) ---SKIPIF-- - - --FILE-- - --FILE-- -=', '7.4.0'); ?> ---FILE-- - -===DONE=== - ---EXPECTF-- -object(MongoDB\Driver\ReadConcern)#%d (%d) { -} -bool(true) -C:26:"MongoDB\Driver\ReadConcern":0:{} -object(MongoDB\Driver\ReadConcern)#%d (%d) { -} - -object(MongoDB\Driver\ReadConcern)#%d (%d) { - ["level"]=> - string(5) "local" -} -bool(true) -C:26:"MongoDB\Driver\ReadConcern":30:{a:1:{s:5:"level";s:5:"local";}} -object(MongoDB\Driver\ReadConcern)#%d (%d) { - ["level"]=> - string(5) "local" -} - -===DONE=== diff --git a/tests/readConcern/readconcern-serialization-002.phpt b/tests/readConcern/readconcern-serialization-002.phpt index d65080ec5..c53c4b311 100644 --- a/tests/readConcern/readconcern-serialization-002.phpt +++ b/tests/readConcern/readconcern-serialization-002.phpt @@ -1,8 +1,5 @@ --TEST-- MongoDB\Driver\ReadConcern serialization (__serialize and __unserialize) ---SKIPIF-- - - --FILE-- - --FILE-- -=', '7.4.0'); ?> ---FILE-- - 'ny']]), - new MongoDB\Driver\ReadPreference(MongoDB\Driver\ReadPreference::RP_SECONDARY, [['dc' => 'ny'], ['dc' => 'sf', 'use' => 'reporting'], []]), - new MongoDB\Driver\ReadPreference(MongoDB\Driver\ReadPreference::RP_SECONDARY, null, ['maxStalenessSeconds' => 1000]), - new MongoDB\Driver\ReadPreference(MongoDB\Driver\ReadPreference::RP_SECONDARY, null, ['hedge' => ['enabled' => true]]), -]; - -foreach ($tests as $test) { - var_dump($test); - var_dump($test instanceof Serializable); - echo $s = serialize($test), "\n"; - var_dump(unserialize($s)); - echo "\n"; -} - -?> -===DONE=== - ---EXPECTF-- -object(MongoDB\Driver\ReadPreference)#%d (%d) { - ["mode"]=> - string(7) "primary" -} -bool(true) -C:29:"MongoDB\Driver\ReadPreference":31:{a:1:{s:4:"mode";s:7:"primary";}} -object(MongoDB\Driver\ReadPreference)#%d (%d) { - ["mode"]=> - string(7) "primary" -} - -object(MongoDB\Driver\ReadPreference)#%d (%d) { - ["mode"]=> - string(16) "primaryPreferred" -} -bool(true) -C:29:"MongoDB\Driver\ReadPreference":41:{a:1:{s:4:"mode";s:16:"primaryPreferred";}} -object(MongoDB\Driver\ReadPreference)#%d (%d) { - ["mode"]=> - string(16) "primaryPreferred" -} - -object(MongoDB\Driver\ReadPreference)#%d (%d) { - ["mode"]=> - string(9) "secondary" -} -bool(true) -C:29:"MongoDB\Driver\ReadPreference":33:{a:1:{s:4:"mode";s:9:"secondary";}} -object(MongoDB\Driver\ReadPreference)#%d (%d) { - ["mode"]=> - string(9) "secondary" -} - -object(MongoDB\Driver\ReadPreference)#%d (%d) { - ["mode"]=> - string(18) "secondaryPreferred" -} -bool(true) -C:29:"MongoDB\Driver\ReadPreference":43:{a:1:{s:4:"mode";s:18:"secondaryPreferred";}} -object(MongoDB\Driver\ReadPreference)#%d (%d) { - ["mode"]=> - string(18) "secondaryPreferred" -} - -object(MongoDB\Driver\ReadPreference)#%d (%d) { - ["mode"]=> - string(7) "nearest" -} -bool(true) -C:29:"MongoDB\Driver\ReadPreference":31:{a:1:{s:4:"mode";s:7:"nearest";}} -object(MongoDB\Driver\ReadPreference)#%d (%d) { - ["mode"]=> - string(7) "nearest" -} - -object(MongoDB\Driver\ReadPreference)#%d (%d) { - ["mode"]=> - string(9) "secondary" -} -bool(true) -C:29:"MongoDB\Driver\ReadPreference":33:{a:1:{s:4:"mode";s:9:"secondary";}} -object(MongoDB\Driver\ReadPreference)#%d (%d) { - ["mode"]=> - string(9) "secondary" -} - -object(MongoDB\Driver\ReadPreference)#%d (%d) { - ["mode"]=> - string(9) "secondary" - ["tags"]=> - array(1) { - [0]=> - object(stdClass)#%d (%d) { - ["dc"]=> - string(2) "ny" - } - } -} -bool(true) -C:29:"MongoDB\Driver\ReadPreference":78:{a:2:{s:4:"mode";s:9:"secondary";s:4:"tags";a:1:{i:0;a:1:{s:2:"dc";s:2:"ny";}}}} -object(MongoDB\Driver\ReadPreference)#%d (%d) { - ["mode"]=> - string(9) "secondary" - ["tags"]=> - array(1) { - [0]=> - object(stdClass)#%d (%d) { - ["dc"]=> - string(2) "ny" - } - } -} - -object(MongoDB\Driver\ReadPreference)#%d (%d) { - ["mode"]=> - string(9) "secondary" - ["tags"]=> - array(3) { - [0]=> - object(stdClass)#%d (%d) { - ["dc"]=> - string(2) "ny" - } - [1]=> - object(stdClass)#%d (%d) { - ["dc"]=> - string(2) "sf" - ["use"]=> - string(9) "reporting" - } - [2]=> - object(stdClass)#%d (%d) { - } - } -} -bool(true) -C:29:"MongoDB\Driver\ReadPreference":142:{a:2:{s:4:"mode";s:9:"secondary";s:4:"tags";a:3:{i:0;a:1:{s:2:"dc";s:2:"ny";}i:1;a:2:{s:2:"dc";s:2:"sf";s:3:"use";s:9:"reporting";}i:2;a:0:{}}}} -object(MongoDB\Driver\ReadPreference)#%d (%d) { - ["mode"]=> - string(9) "secondary" - ["tags"]=> - array(3) { - [0]=> - object(stdClass)#%d (%d) { - ["dc"]=> - string(2) "ny" - } - [1]=> - object(stdClass)#%d (%d) { - ["dc"]=> - string(2) "sf" - ["use"]=> - string(9) "reporting" - } - [2]=> - object(stdClass)#%d (%d) { - } - } -} - -object(MongoDB\Driver\ReadPreference)#%d (%d) { - ["mode"]=> - string(9) "secondary" - ["maxStalenessSeconds"]=> - int(1000) -} -bool(true) -C:29:"MongoDB\Driver\ReadPreference":67:{a:2:{s:4:"mode";s:9:"secondary";s:19:"maxStalenessSeconds";i:1000;}} -object(MongoDB\Driver\ReadPreference)#%d (%d) { - ["mode"]=> - string(9) "secondary" - ["maxStalenessSeconds"]=> - int(1000) -} - -object(MongoDB\Driver\ReadPreference)#%d (%d) { - ["mode"]=> - string(9) "secondary" - ["hedge"]=> - object(stdClass)#%d (%d) { - ["enabled"]=> - bool(true) - } -} -bool(true) -C:29:"MongoDB\Driver\ReadPreference":82:{a:2:{s:4:"mode";s:9:"secondary";s:5:"hedge";O:8:"stdClass":1:{s:7:"enabled";b:1;}}} -object(MongoDB\Driver\ReadPreference)#%d (%d) { - ["mode"]=> - string(9) "secondary" - ["hedge"]=> - object(stdClass)#%d (%d) { - ["enabled"]=> - bool(true) - } -} - -===DONE=== diff --git a/tests/readPreference/readpreference-serialization-002.phpt b/tests/readPreference/readpreference-serialization-002.phpt index e87e6ebc3..f08da8dc4 100644 --- a/tests/readPreference/readpreference-serialization-002.phpt +++ b/tests/readPreference/readpreference-serialization-002.phpt @@ -1,8 +1,5 @@ --TEST-- MongoDB\Driver\ReadPreference serialization (__serialize and __unserialize) ---SKIPIF-- - - --FILE-- - --FILE-- -=', '7.4.0'); ?> ---FILE-- - -===DONE=== - ---EXPECTF-- -object(MongoDB\Driver\ServerApi)#%d (%d) { - ["version"]=> - string(1) "1" - ["strict"]=> - NULL - ["deprecationErrors"]=> - NULL -} -bool(true) -C:24:"MongoDB\Driver\ServerApi":70:{a:3:{s:7:"version";s:1:"1";s:6:"strict";N;s:17:"deprecationErrors";N;}} -object(MongoDB\Driver\ServerApi)#5 (3) { - ["version"]=> - string(1) "1" - ["strict"]=> - NULL - ["deprecationErrors"]=> - NULL -} - -object(MongoDB\Driver\ServerApi)#%d (%d) { - ["version"]=> - string(1) "1" - ["strict"]=> - bool(true) - ["deprecationErrors"]=> - NULL -} -bool(true) -C:24:"MongoDB\Driver\ServerApi":72:{a:3:{s:7:"version";s:1:"1";s:6:"strict";b:1;s:17:"deprecationErrors";N;}} -object(MongoDB\Driver\ServerApi)#5 (3) { - ["version"]=> - string(1) "1" - ["strict"]=> - bool(true) - ["deprecationErrors"]=> - NULL -} - -object(MongoDB\Driver\ServerApi)#%d (%d) { - ["version"]=> - string(1) "1" - ["strict"]=> - NULL - ["deprecationErrors"]=> - bool(true) -} -bool(true) -C:24:"MongoDB\Driver\ServerApi":72:{a:3:{s:7:"version";s:1:"1";s:6:"strict";N;s:17:"deprecationErrors";b:1;}} -object(MongoDB\Driver\ServerApi)#5 (3) { - ["version"]=> - string(1) "1" - ["strict"]=> - NULL - ["deprecationErrors"]=> - bool(true) -} - -object(MongoDB\Driver\ServerApi)#%d (%d) { - ["version"]=> - string(1) "1" - ["strict"]=> - bool(false) - ["deprecationErrors"]=> - bool(false) -} -bool(true) -C:24:"MongoDB\Driver\ServerApi":74:{a:3:{s:7:"version";s:1:"1";s:6:"strict";b:0;s:17:"deprecationErrors";b:0;}} -object(MongoDB\Driver\ServerApi)#5 (3) { - ["version"]=> - string(1) "1" - ["strict"]=> - bool(false) - ["deprecationErrors"]=> - bool(false) -} - -===DONE=== diff --git a/tests/serverApi/serverApi-serialization-002.phpt b/tests/serverApi/serverApi-serialization-002.phpt index d5c28f6bb..f1b73bb72 100644 --- a/tests/serverApi/serverApi-serialization-002.phpt +++ b/tests/serverApi/serverApi-serialization-002.phpt @@ -1,8 +1,5 @@ --TEST-- MongoDB\Driver\ServerApi serialization (__serialize and __unserialize) ---SKIPIF-- - - --FILE-- - --FILE-- -=', '7.4.0'); ?> ---FILE-- - 1 - new MongoDB\Driver\WriteConcern(-2, 1000), - // 64-bit wtimeout is always encoded as as string - MongoDB\Driver\WriteConcern::__set_state(['w' => 2, 'wtimeout' => '2147483648']), -]; - -foreach ($tests as $test) { - var_dump($test); - var_dump($test instanceof Serializable); - echo $s = serialize($test), "\n"; - var_dump(unserialize($s)); - echo "\n"; -} - -?> -===DONE=== - ---EXPECTF-- -object(MongoDB\Driver\WriteConcern)#%d (%d) { - ["w"]=> - string(8) "majority" -} -bool(true) -C:27:"MongoDB\Driver\WriteConcern":29:{a:1:{s:1:"w";s:8:"majority";}} -object(MongoDB\Driver\WriteConcern)#%d (%d) { - ["w"]=> - string(8) "majority" -} - -object(MongoDB\Driver\WriteConcern)#%d (%d) { -} -bool(true) -C:27:"MongoDB\Driver\WriteConcern":6:{a:0:{}} -object(MongoDB\Driver\WriteConcern)#%d (%d) { -} - -object(MongoDB\Driver\WriteConcern)#%d (%d) { - ["w"]=> - int(-1) -} -bool(true) -C:27:"MongoDB\Driver\WriteConcern":19:{a:1:{s:1:"w";i:-1;}} -object(MongoDB\Driver\WriteConcern)#%d (%d) { - ["w"]=> - int(-1) -} - -object(MongoDB\Driver\WriteConcern)#%d (%d) { - ["w"]=> - int(0) -} -bool(true) -C:27:"MongoDB\Driver\WriteConcern":18:{a:1:{s:1:"w";i:0;}} -object(MongoDB\Driver\WriteConcern)#%d (%d) { - ["w"]=> - int(0) -} - -object(MongoDB\Driver\WriteConcern)#%d (%d) { - ["w"]=> - int(1) -} -bool(true) -C:27:"MongoDB\Driver\WriteConcern":18:{a:1:{s:1:"w";i:1;}} -object(MongoDB\Driver\WriteConcern)#%d (%d) { - ["w"]=> - int(1) -} - -object(MongoDB\Driver\WriteConcern)#%d (%d) { - ["w"]=> - string(8) "majority" -} -bool(true) -C:27:"MongoDB\Driver\WriteConcern":29:{a:1:{s:1:"w";s:8:"majority";}} -object(MongoDB\Driver\WriteConcern)#%d (%d) { - ["w"]=> - string(8) "majority" -} - -object(MongoDB\Driver\WriteConcern)#%d (%d) { - ["w"]=> - string(3) "tag" -} -bool(true) -C:27:"MongoDB\Driver\WriteConcern":24:{a:1:{s:1:"w";s:3:"tag";}} -object(MongoDB\Driver\WriteConcern)#%d (%d) { - ["w"]=> - string(3) "tag" -} - -object(MongoDB\Driver\WriteConcern)#%d (%d) { - ["w"]=> - int(1) -} -bool(true) -C:27:"MongoDB\Driver\WriteConcern":18:{a:1:{s:1:"w";i:1;}} -object(MongoDB\Driver\WriteConcern)#%d (%d) { - ["w"]=> - int(1) -} - -object(MongoDB\Driver\WriteConcern)#%d (%d) { - ["w"]=> - int(1) - ["j"]=> - bool(false) -} -bool(true) -C:27:"MongoDB\Driver\WriteConcern":30:{a:2:{s:1:"w";i:1;s:1:"j";b:0;}} -object(MongoDB\Driver\WriteConcern)#%d (%d) { - ["w"]=> - int(1) - ["j"]=> - bool(false) -} - -object(MongoDB\Driver\WriteConcern)#%d (%d) { - ["w"]=> - int(1) - ["wtimeout"]=> - int(1000) -} -bool(true) -C:27:"MongoDB\Driver\WriteConcern":40:{a:2:{s:1:"w";i:1;s:8:"wtimeout";i:1000;}} -object(MongoDB\Driver\WriteConcern)#%d (%d) { - ["w"]=> - int(1) - ["wtimeout"]=> - int(1000) -} - -object(MongoDB\Driver\WriteConcern)#%d (%d) { - ["w"]=> - int(1) - ["j"]=> - bool(true) - ["wtimeout"]=> - int(1000) -} -bool(true) -C:27:"MongoDB\Driver\WriteConcern":52:{a:3:{s:1:"w";i:1;s:1:"j";b:1;s:8:"wtimeout";i:1000;}} -object(MongoDB\Driver\WriteConcern)#%d (%d) { - ["w"]=> - int(1) - ["j"]=> - bool(true) - ["wtimeout"]=> - int(1000) -} - -object(MongoDB\Driver\WriteConcern)#%d (%d) { - ["j"]=> - bool(true) -} -bool(true) -C:27:"MongoDB\Driver\WriteConcern":18:{a:1:{s:1:"j";b:1;}} -object(MongoDB\Driver\WriteConcern)#%d (%d) { - ["j"]=> - bool(true) -} - -object(MongoDB\Driver\WriteConcern)#%d (%d) { - ["wtimeout"]=> - int(1000) -} -bool(true) -C:27:"MongoDB\Driver\WriteConcern":28:{a:1:{s:8:"wtimeout";i:1000;}} -object(MongoDB\Driver\WriteConcern)#%d (%d) { - ["wtimeout"]=> - int(1000) -} - -object(MongoDB\Driver\WriteConcern)#%d (%d) { - ["w"]=> - int(2) - ["wtimeout"]=> - %rint\(2147483648\)|string\(10\) "2147483648"%r -} -bool(true) -C:27:"MongoDB\Driver\WriteConcern":51:{a:2:{s:1:"w";i:2;s:8:"wtimeout";s:10:"2147483648";}} -object(MongoDB\Driver\WriteConcern)#%d (%d) { - ["w"]=> - int(2) - ["wtimeout"]=> - %rint\(2147483648\)|string\(10\) "2147483648"%r -} - -===DONE=== diff --git a/tests/writeConcern/writeconcern-serialization-002.phpt b/tests/writeConcern/writeconcern-serialization-002.phpt index 8f8cce0dc..288419cbd 100644 --- a/tests/writeConcern/writeconcern-serialization-002.phpt +++ b/tests/writeConcern/writeconcern-serialization-002.phpt @@ -1,8 +1,5 @@ --TEST-- MongoDB\Driver\WriteConcern serialization (__serialize and __unserialize) ---SKIPIF-- - - --FILE-- - --FILE-- Date: Tue, 1 Aug 2023 08:54:44 +0200 Subject: [PATCH 4/8] Remove type match regexes in tests --- tests/bson/bson-fromPHP_error-001.phpt | 14 +++++------ tests/bson/bson-timestamp_error-006.phpt | 14 +++++------ tests/bson/bson-utcdatetime_error-004.phpt | 4 ++-- tests/bulk/bulkwrite-ctor-let_error-001.phpt | 6 ++--- tests/bulk/bulkwrite-delete_error-001.phpt | 6 ++--- tests/bulk/bulkwrite-update_error-003.phpt | 10 ++++---- ...entEncryption-createDataKey_error-002.phpt | 4 ++-- .../manager-startSession_error-001.phpt | 8 +++---- tests/query/query-ctor-let_error-001.phpt | 6 ++--- tests/query/query-ctor_error-001.phpt | 10 ++++---- tests/query/query-ctor_error-002.phpt | 24 +++++++++---------- .../readpreference-ctor_error-006.phpt | 4 ++-- .../session-startTransaction_error-002.phpt | 6 ++--- .../session-startTransaction_error-004.phpt | 2 +- .../writeconcern-ctor_error-002.phpt | 8 +++---- 15 files changed, 63 insertions(+), 63 deletions(-) diff --git a/tests/bson/bson-fromPHP_error-001.phpt b/tests/bson/bson-fromPHP_error-001.phpt index 6e722b7cb..5f9352573 100644 --- a/tests/bson/bson-fromPHP_error-001.phpt +++ b/tests/bson/bson-fromPHP_error-001.phpt @@ -46,18 +46,18 @@ foreach ($invalidValues as $invalidValue) { ?> ===DONE=== ---EXPECTF-- +--EXPECT-- Testing top-level objects -Expected MyDocument::bsonSerialize() to return an array, stdClass, MongoDB\BSON\Document, or MongoDB\BSON\PackedArray, %r(null|NULL)%r given -Expected MyDocument::bsonSerialize() to return an array, stdClass, MongoDB\BSON\Document, or MongoDB\BSON\PackedArray, int%S given +Expected MyDocument::bsonSerialize() to return an array, stdClass, MongoDB\BSON\Document, or MongoDB\BSON\PackedArray, null given +Expected MyDocument::bsonSerialize() to return an array, stdClass, MongoDB\BSON\Document, or MongoDB\BSON\PackedArray, int given Expected MyDocument::bsonSerialize() to return an array, stdClass, MongoDB\BSON\Document, or MongoDB\BSON\PackedArray, string given -Expected MyDocument::bsonSerialize() to return an array, stdClass, MongoDB\BSON\Document, or MongoDB\BSON\PackedArray, bool%S given +Expected MyDocument::bsonSerialize() to return an array, stdClass, MongoDB\BSON\Document, or MongoDB\BSON\PackedArray, bool given Expected MyDocument::bsonSerialize() to return an array, stdClass, MongoDB\BSON\Document, or MongoDB\BSON\PackedArray, MyDocument given Testing nested objects -Expected MyDocument::bsonSerialize() to return an array, stdClass, MongoDB\BSON\Document, or MongoDB\BSON\PackedArray, %r(null|NULL)%r given -Expected MyDocument::bsonSerialize() to return an array, stdClass, MongoDB\BSON\Document, or MongoDB\BSON\PackedArray, int%S given +Expected MyDocument::bsonSerialize() to return an array, stdClass, MongoDB\BSON\Document, or MongoDB\BSON\PackedArray, null given +Expected MyDocument::bsonSerialize() to return an array, stdClass, MongoDB\BSON\Document, or MongoDB\BSON\PackedArray, int given Expected MyDocument::bsonSerialize() to return an array, stdClass, MongoDB\BSON\Document, or MongoDB\BSON\PackedArray, string given -Expected MyDocument::bsonSerialize() to return an array, stdClass, MongoDB\BSON\Document, or MongoDB\BSON\PackedArray, bool%S given +Expected MyDocument::bsonSerialize() to return an array, stdClass, MongoDB\BSON\Document, or MongoDB\BSON\PackedArray, bool given Expected MyDocument::bsonSerialize() to return an array, stdClass, MongoDB\BSON\Document, or MongoDB\BSON\PackedArray, MyDocument given ===DONE=== diff --git a/tests/bson/bson-timestamp_error-006.phpt b/tests/bson/bson-timestamp_error-006.phpt index e78f6f6f3..17c8e4e13 100644 --- a/tests/bson/bson-timestamp_error-006.phpt +++ b/tests/bson/bson-timestamp_error-006.phpt @@ -22,23 +22,23 @@ foreach ($invalidValues as $invalidValue) { ?> ===DONE=== ---EXPECTF-- +--EXPECT-- OK: Got MongoDB\Driver\Exception\InvalidArgumentException -Expected increment to be an unsigned 32-bit integer or string, %r(null|NULL)%r given +Expected increment to be an unsigned 32-bit integer or string, null given OK: Got MongoDB\Driver\Exception\InvalidArgumentException -Expected increment to be an unsigned 32-bit integer or string, %r(double|float)%r given +Expected increment to be an unsigned 32-bit integer or string, float given OK: Got MongoDB\Driver\Exception\InvalidArgumentException -Expected increment to be an unsigned 32-bit integer or string, bool%S given +Expected increment to be an unsigned 32-bit integer or string, bool given OK: Got MongoDB\Driver\Exception\InvalidArgumentException Expected increment to be an unsigned 32-bit integer or string, array given OK: Got MongoDB\Driver\Exception\InvalidArgumentException Expected increment to be an unsigned 32-bit integer or string, stdClass given OK: Got MongoDB\Driver\Exception\InvalidArgumentException -Expected timestamp to be an unsigned 32-bit integer or string, %r(null|NULL)%r given +Expected timestamp to be an unsigned 32-bit integer or string, null given OK: Got MongoDB\Driver\Exception\InvalidArgumentException -Expected timestamp to be an unsigned 32-bit integer or string, %r(double|float)%r given +Expected timestamp to be an unsigned 32-bit integer or string, float given OK: Got MongoDB\Driver\Exception\InvalidArgumentException -Expected timestamp to be an unsigned 32-bit integer or string, bool%S given +Expected timestamp to be an unsigned 32-bit integer or string, bool given OK: Got MongoDB\Driver\Exception\InvalidArgumentException Expected timestamp to be an unsigned 32-bit integer or string, array given OK: Got MongoDB\Driver\Exception\InvalidArgumentException diff --git a/tests/bson/bson-utcdatetime_error-004.phpt b/tests/bson/bson-utcdatetime_error-004.phpt index 47b2fbc4c..3ac92dea1 100644 --- a/tests/bson/bson-utcdatetime_error-004.phpt +++ b/tests/bson/bson-utcdatetime_error-004.phpt @@ -19,9 +19,9 @@ foreach ($invalidValues as $invalidValue) { ?> ===DONE=== ---EXPECTF-- +--EXPECT-- OK: Got MongoDB\Driver\Exception\InvalidArgumentException -Expected integer or string, bool%S given +Expected integer or string, bool given OK: Got MongoDB\Driver\Exception\InvalidArgumentException Expected integer or string, array given ===DONE=== diff --git a/tests/bulk/bulkwrite-ctor-let_error-001.phpt b/tests/bulk/bulkwrite-ctor-let_error-001.phpt index 8579fbd91..f2d613f20 100644 --- a/tests/bulk/bulkwrite-ctor-let_error-001.phpt +++ b/tests/bulk/bulkwrite-ctor-let_error-001.phpt @@ -16,11 +16,11 @@ foreach ($invalidValues as $invalidValue) { ?> ===DONE=== ---EXPECTF-- +--EXPECT-- OK: Got MongoDB\Driver\Exception\InvalidArgumentException -Expected "let" option to be array or object, %r(bool|boolean)%r given +Expected "let" option to be array or object, bool given OK: Got MongoDB\Driver\Exception\InvalidArgumentException -Expected "let" option to be array or object, %r(int|integer)%r given +Expected "let" option to be array or object, int given OK: Got MongoDB\Driver\Exception\InvalidArgumentException Expected "let" option to be array or object, string given OK: Got MongoDB\Driver\Exception\InvalidArgumentException diff --git a/tests/bulk/bulkwrite-delete_error-001.phpt b/tests/bulk/bulkwrite-delete_error-001.phpt index 9ae9c0402..eb6906f22 100644 --- a/tests/bulk/bulkwrite-delete_error-001.phpt +++ b/tests/bulk/bulkwrite-delete_error-001.phpt @@ -18,10 +18,10 @@ echo throws(function() use ($bulk) { ?> ===DONE=== ---EXPECTF-- +--EXPECT-- OK: Got MongoDB\Driver\Exception\InvalidArgumentException -Expected "collation" option to be array or object, int%S given +Expected "collation" option to be array or object, int given OK: Got MongoDB\Driver\Exception\InvalidArgumentException -Expected "hint" option to be string, array, or object, int%S given +Expected "hint" option to be string, array, or object, int given ===DONE=== diff --git a/tests/bulk/bulkwrite-update_error-003.phpt b/tests/bulk/bulkwrite-update_error-003.phpt index 7ff3b8a03..a6924f058 100644 --- a/tests/bulk/bulkwrite-update_error-003.phpt +++ b/tests/bulk/bulkwrite-update_error-003.phpt @@ -34,22 +34,22 @@ echo throws(function() use ($bulk) { ?> ===DONE=== ---EXPECTF-- +--EXPECT-- OK: Got MongoDB\Driver\Exception\InvalidArgumentException Replacement document conflicts with true "multi" option OK: Got MongoDB\Driver\Exception\InvalidArgumentException -Expected "collation" option to be array or object, int%S given +Expected "collation" option to be array or object, int given OK: Got MongoDB\Driver\Exception\InvalidArgumentException -Expected "collation" option to be array or object, int%S given +Expected "collation" option to be array or object, int given OK: Got MongoDB\Driver\Exception\InvalidArgumentException -Expected "arrayFilters" option to be array or object, int%S given +Expected "arrayFilters" option to be array or object, int given OK: Got MongoDB\Driver\Exception\InvalidArgumentException "arrayFilters" option has invalid keys for a BSON array OK: Got MongoDB\Driver\Exception\InvalidArgumentException -Expected "hint" option to be string, array, or object, int%S given +Expected "hint" option to be string, array, or object, int given ===DONE=== diff --git a/tests/clientEncryption/clientEncryption-createDataKey_error-002.phpt b/tests/clientEncryption/clientEncryption-createDataKey_error-002.phpt index bae01480c..8d999cdc2 100644 --- a/tests/clientEncryption/clientEncryption-createDataKey_error-002.phpt +++ b/tests/clientEncryption/clientEncryption-createDataKey_error-002.phpt @@ -29,9 +29,9 @@ foreach ($tests as $opts) { ?> ===DONE=== ---EXPECTF-- +--EXPECT-- OK: Got MongoDB\Driver\Exception\InvalidArgumentException -Expected "keyMaterial" option to be MongoDB\BSON\Binary, %r(int|integer)%r given +Expected "keyMaterial" option to be MongoDB\BSON\Binary, int given OK: Got MongoDB\Driver\Exception\InvalidArgumentException Expected "keyMaterial" option to be MongoDB\BSON\Binary, stdClass given ===DONE=== diff --git a/tests/manager/manager-startSession_error-001.phpt b/tests/manager/manager-startSession_error-001.phpt index 9e6ed1b4a..e84418b06 100644 --- a/tests/manager/manager-startSession_error-001.phpt +++ b/tests/manager/manager-startSession_error-001.phpt @@ -60,19 +60,19 @@ echo raises(function() use ($manager) { OK: Got MongoDB\Driver\Exception\InvalidArgumentException Expected "maxCommitTimeMS" option to be >= 0, -1 given OK: Got MongoDB\Driver\Exception\InvalidArgumentException -Expected "readConcern" option to be MongoDB\Driver\ReadConcern, int%S given +Expected "readConcern" option to be MongoDB\Driver\ReadConcern, int given OK: Got MongoDB\Driver\Exception\InvalidArgumentException Expected "readConcern" option to be MongoDB\Driver\ReadConcern, stdClass given OK: Got MongoDB\Driver\Exception\InvalidArgumentException Expected "readConcern" option to be MongoDB\Driver\ReadConcern, MongoDB\Driver\WriteConcern given OK: Got MongoDB\Driver\Exception\InvalidArgumentException -Expected "readPreference" option to be MongoDB\Driver\ReadPreference, int%S given +Expected "readPreference" option to be MongoDB\Driver\ReadPreference, int given OK: Got MongoDB\Driver\Exception\InvalidArgumentException Expected "readPreference" option to be MongoDB\Driver\ReadPreference, stdClass given OK: Got MongoDB\Driver\Exception\InvalidArgumentException Expected "readPreference" option to be MongoDB\Driver\ReadPreference, MongoDB\Driver\ReadConcern given OK: Got MongoDB\Driver\Exception\InvalidArgumentException -Expected "writeConcern" option to be MongoDB\Driver\WriteConcern, int%S given +Expected "writeConcern" option to be MongoDB\Driver\WriteConcern, int given OK: Got MongoDB\Driver\Exception\InvalidArgumentException Expected "writeConcern" option to be MongoDB\Driver\WriteConcern, stdClass given OK: Got MongoDB\Driver\Exception\InvalidArgumentException @@ -84,7 +84,7 @@ Expected "writeConcern" option to be MongoDB\Driver\WriteConcern, MongoDB\Driver OK: Got MongoDB\Driver\Exception\InvalidArgumentException Expected "writeConcern" option to be MongoDB\Driver\WriteConcern, MongoDB\Driver\ReadPreference given OK: Got MongoDB\Driver\Exception\InvalidArgumentException -Expected "defaultTransactionOptions" option to be an array, int%S given +Expected "defaultTransactionOptions" option to be an array, int given OK: Got MongoDB\Driver\Exception\InvalidArgumentException Expected "defaultTransactionOptions" option to be an array, stdClass given OK: Got %r(E_NOTICE|E_WARNING)%r diff --git a/tests/query/query-ctor-let_error-001.phpt b/tests/query/query-ctor-let_error-001.phpt index bb5599cde..1d99828eb 100644 --- a/tests/query/query-ctor-let_error-001.phpt +++ b/tests/query/query-ctor-let_error-001.phpt @@ -16,11 +16,11 @@ foreach ($invalidValues as $invalidValue) { ?> ===DONE=== ---EXPECTF-- +--EXPECT-- OK: Got MongoDB\Driver\Exception\InvalidArgumentException -Expected "let" option to be array or object, %r(bool|boolean)%r given +Expected "let" option to be array or object, bool given OK: Got MongoDB\Driver\Exception\InvalidArgumentException -Expected "let" option to be array or object, %r(int|integer)%r given +Expected "let" option to be array or object, int given OK: Got MongoDB\Driver\Exception\InvalidArgumentException Expected "let" option to be array or object, string given OK: Got MongoDB\Driver\Exception\InvalidArgumentException diff --git a/tests/query/query-ctor_error-001.phpt b/tests/query/query-ctor_error-001.phpt index 566c4b4cc..db1917076 100644 --- a/tests/query/query-ctor_error-001.phpt +++ b/tests/query/query-ctor_error-001.phpt @@ -23,19 +23,19 @@ foreach ($tests as $test) { ?> ===DONE=== ---EXPECTF-- +--EXPECT-- OK: Got MongoDB\Driver\Exception\InvalidArgumentException -Expected "readConcern" option to be MongoDB\Driver\ReadConcern, int%S given +Expected "readConcern" option to be MongoDB\Driver\ReadConcern, int given OK: Got MongoDB\Driver\Exception\InvalidArgumentException -Expected "readConcern" option to be MongoDB\Driver\ReadConcern, %r(double|float)%r given +Expected "readConcern" option to be MongoDB\Driver\ReadConcern, float given OK: Got MongoDB\Driver\Exception\InvalidArgumentException Expected "readConcern" option to be MongoDB\Driver\ReadConcern, string given OK: Got MongoDB\Driver\Exception\InvalidArgumentException -Expected "readConcern" option to be MongoDB\Driver\ReadConcern, bool%S given +Expected "readConcern" option to be MongoDB\Driver\ReadConcern, bool given OK: Got MongoDB\Driver\Exception\InvalidArgumentException Expected "readConcern" option to be MongoDB\Driver\ReadConcern, array given OK: Got MongoDB\Driver\Exception\InvalidArgumentException Expected "readConcern" option to be MongoDB\Driver\ReadConcern, stdClass given OK: Got MongoDB\Driver\Exception\InvalidArgumentException -Expected "readConcern" option to be MongoDB\Driver\ReadConcern, %r(null|NULL)%r given +Expected "readConcern" option to be MongoDB\Driver\ReadConcern, null given ===DONE=== diff --git a/tests/query/query-ctor_error-002.phpt b/tests/query/query-ctor_error-002.phpt index d92be1991..790fc1abd 100644 --- a/tests/query/query-ctor_error-002.phpt +++ b/tests/query/query-ctor_error-002.phpt @@ -28,38 +28,38 @@ foreach ($tests as $options) { ?> ===DONE=== ---EXPECTF-- +--EXPECT-- OK: Got MongoDB\Driver\Exception\InvalidArgumentException -Expected "modifiers" option to be array, int%S given +Expected "modifiers" option to be array, int given OK: Got MongoDB\Driver\Exception\InvalidArgumentException -Expected "collation" option to be array or object, int%S given +Expected "collation" option to be array or object, int given OK: Got MongoDB\Driver\Exception\InvalidArgumentException -Expected "hint" option to be string, array, or object, int%S given +Expected "hint" option to be string, array, or object, int given OK: Got MongoDB\Driver\Exception\InvalidArgumentException -Expected "max" option to be array or object, int%S given +Expected "max" option to be array or object, int given OK: Got MongoDB\Driver\Exception\InvalidArgumentException -Expected "min" option to be array or object, int%S given +Expected "min" option to be array or object, int given OK: Got MongoDB\Driver\Exception\InvalidArgumentException -Expected "projection" option to be array or object, int%S given +Expected "projection" option to be array or object, int given OK: Got MongoDB\Driver\Exception\InvalidArgumentException -Expected "sort" option to be array or object, int%S given +Expected "sort" option to be array or object, int given OK: Got MongoDB\Driver\Exception\InvalidArgumentException -Expected "$hint" modifier to be string, array, or object, int%S given +Expected "$hint" modifier to be string, array, or object, int given OK: Got MongoDB\Driver\Exception\InvalidArgumentException -Expected "$max" modifier to be array or object, int%S given +Expected "$max" modifier to be array or object, int given OK: Got MongoDB\Driver\Exception\InvalidArgumentException -Expected "$min" modifier to be array or object, int%S given +Expected "$min" modifier to be array or object, int given OK: Got MongoDB\Driver\Exception\InvalidArgumentException -Expected "$orderby" modifier to be array or object, int%S given +Expected "$orderby" modifier to be array or object, int given ===DONE=== diff --git a/tests/readPreference/readpreference-ctor_error-006.phpt b/tests/readPreference/readpreference-ctor_error-006.phpt index a422e6003..99d32421e 100644 --- a/tests/readPreference/readpreference-ctor_error-006.phpt +++ b/tests/readPreference/readpreference-ctor_error-006.phpt @@ -12,7 +12,7 @@ echo throws(function() { ?> ===DONE=== ---EXPECTF-- +--EXPECT-- OK: Got MongoDB\Driver\Exception\InvalidArgumentException -Expected mode to be integer or string, %r(double|float)%r given +Expected mode to be integer or string, float given ===DONE=== diff --git a/tests/session/session-startTransaction_error-002.phpt b/tests/session/session-startTransaction_error-002.phpt index 9c51c1ed9..c89f72a0c 100644 --- a/tests/session/session-startTransaction_error-002.phpt +++ b/tests/session/session-startTransaction_error-002.phpt @@ -54,19 +54,19 @@ echo raises(function() use ($session) { OK: Got MongoDB\Driver\Exception\InvalidArgumentException Expected "maxCommitTimeMS" option to be >= 0, -1 given OK: Got MongoDB\Driver\Exception\InvalidArgumentException -Expected "readConcern" option to be MongoDB\Driver\ReadConcern, int%S given +Expected "readConcern" option to be MongoDB\Driver\ReadConcern, int given OK: Got MongoDB\Driver\Exception\InvalidArgumentException Expected "readConcern" option to be MongoDB\Driver\ReadConcern, stdClass given OK: Got MongoDB\Driver\Exception\InvalidArgumentException Expected "readConcern" option to be MongoDB\Driver\ReadConcern, MongoDB\Driver\WriteConcern given OK: Got MongoDB\Driver\Exception\InvalidArgumentException -Expected "readPreference" option to be MongoDB\Driver\ReadPreference, int%S given +Expected "readPreference" option to be MongoDB\Driver\ReadPreference, int given OK: Got MongoDB\Driver\Exception\InvalidArgumentException Expected "readPreference" option to be MongoDB\Driver\ReadPreference, stdClass given OK: Got MongoDB\Driver\Exception\InvalidArgumentException Expected "readPreference" option to be MongoDB\Driver\ReadPreference, MongoDB\Driver\ReadConcern given OK: Got MongoDB\Driver\Exception\InvalidArgumentException -Expected "writeConcern" option to be MongoDB\Driver\WriteConcern, int%S given +Expected "writeConcern" option to be MongoDB\Driver\WriteConcern, int given OK: Got MongoDB\Driver\Exception\InvalidArgumentException Expected "writeConcern" option to be MongoDB\Driver\WriteConcern, stdClass given OK: Got MongoDB\Driver\Exception\InvalidArgumentException diff --git a/tests/session/session-startTransaction_error-004.phpt b/tests/session/session-startTransaction_error-004.phpt index 967a3f820..baaf8d8bb 100644 --- a/tests/session/session-startTransaction_error-004.phpt +++ b/tests/session/session-startTransaction_error-004.phpt @@ -31,7 +31,7 @@ foreach ($options as $txnOptions) { --EXPECTF-- OK: Got TypeError -Argument 1 passed to MongoDB\Driver\Session::startTransaction() must be of the type array%r( or null)?%r, int%S given +Argument 1 passed to MongoDB\Driver\Session::startTransaction() must be of the type array%r( or null)?%r, int given OK: Got TypeError Argument 1 passed to MongoDB\Driver\Session::startTransaction() must be of the type array%r( or null)?%r, object given ===DONE=== diff --git a/tests/writeConcern/writeconcern-ctor_error-002.phpt b/tests/writeConcern/writeconcern-ctor_error-002.phpt index 780c9d85a..2e245883a 100644 --- a/tests/writeConcern/writeconcern-ctor_error-002.phpt +++ b/tests/writeConcern/writeconcern-ctor_error-002.phpt @@ -22,15 +22,15 @@ foreach ($tests as $test) { ?> ===DONE=== ---EXPECTF-- +--EXPECT-- OK: Got MongoDB\Driver\Exception\InvalidArgumentException -Expected w to be integer or string, %r(double|float)%r given +Expected w to be integer or string, float given OK: Got MongoDB\Driver\Exception\InvalidArgumentException -Expected w to be integer or string, bool%S given +Expected w to be integer or string, bool given OK: Got MongoDB\Driver\Exception\InvalidArgumentException Expected w to be integer or string, array given OK: Got MongoDB\Driver\Exception\InvalidArgumentException Expected w to be integer or string, stdClass given OK: Got MongoDB\Driver\Exception\InvalidArgumentException -Expected w to be integer or string, %r(null|NULL)%r given +Expected w to be integer or string, null given ===DONE=== From 9511ddff980e8952dca5831accde2431a3ec0d14 Mon Sep 17 00:00:00 2001 From: Andreas Braun Date: Tue, 1 Aug 2023 08:56:48 +0200 Subject: [PATCH 5/8] Match object properties as strings --- tests/bson/bson-encode-004.phpt | 2 +- tests/bson/bson-toPHP-004.phpt | 32 ++++++++++++++-------------- tests/bson/bug0974-001.phpt | 14 ++++++------ tests/functional/query-sort-004.phpt | 2 +- 4 files changed, 25 insertions(+), 25 deletions(-) diff --git a/tests/bson/bson-encode-004.phpt b/tests/bson/bson-encode-004.phpt index 890b7f3ba..0608748ea 100644 --- a/tests/bson/bson-encode-004.phpt +++ b/tests/bson/bson-encode-004.phpt @@ -92,7 +92,7 @@ Test { "0" : { "__pclass" : { "$binary" : "UGVyc29u", "$type" : "80" }, "name" : 110 : 00 04 66 72 69 65 6e 64 73 00 05 00 00 00 00 00 [..friends.......] 120 : 00 00 00 [...] object(stdClass)#%d (1) { - [%r(0|"0")%r]=> + ["0"]=> object(Person)#%d (5) { ["name":protected]=> string(6) "Hannes" diff --git a/tests/bson/bson-toPHP-004.phpt b/tests/bson/bson-toPHP-004.phpt index 58387d06f..18f7f1e1c 100644 --- a/tests/bson/bson-toPHP-004.phpt +++ b/tests/bson/bson-toPHP-004.phpt @@ -67,7 +67,7 @@ object(stdClass)#%d (1) { object(stdClass)#%d (1) { ["x"]=> object(stdClass)#%d (1) { - [%r(0|"0")%r]=> + ["0"]=> NULL } } @@ -93,7 +93,7 @@ object(stdClass)#%d (1) { object(stdClass)#%d (1) { ["x"]=> object(stdClass)#%d (1) { - [%r(0|"0")%r]=> + ["0"]=> bool(true) } } @@ -119,7 +119,7 @@ object(stdClass)#%d (1) { object(stdClass)#%d (1) { ["x"]=> object(stdClass)#%d (1) { - [%r(0|"0")%r]=> + ["0"]=> int(1) } } @@ -145,7 +145,7 @@ object(stdClass)#%d (1) { object(stdClass)#%d (1) { ["x"]=> object(stdClass)#%d (1) { - [%r(0|"0")%r]=> + ["0"]=> float(4.125) } } @@ -171,7 +171,7 @@ object(stdClass)#%d (1) { object(stdClass)#%d (1) { ["x"]=> object(stdClass)#%d (1) { - [%r(0|"0")%r]=> + ["0"]=> string(3) "foo" } } @@ -198,7 +198,7 @@ object(stdClass)#%d (1) { object(stdClass)#%d (1) { ["x"]=> object(stdClass)#%d (1) { - [%r(0|"0")%r]=> + ["0"]=> object(stdClass)#%d (0) { } } @@ -230,7 +230,7 @@ object(stdClass)#%d (1) { object(stdClass)#%d (1) { ["x"]=> object(stdClass)#%d (1) { - [%r(0|"0")%r]=> + ["0"]=> object(stdClass)#%d (0) { } } @@ -263,7 +263,7 @@ object(stdClass)#%d (1) { object(stdClass)#%d (1) { ["x"]=> object(stdClass)#%d (1) { - [%r(0|"0")%r]=> + ["0"]=> object(MongoDB\BSON\Binary)#%d (2) { ["data"]=> string(3) "foo" @@ -302,7 +302,7 @@ object(stdClass)#%d (1) { object(stdClass)#%d (1) { ["x"]=> object(stdClass)#%d (1) { - [%r(0|"0")%r]=> + ["0"]=> object(MongoDB\BSON\Decimal128)#%d (1) { ["dec"]=> string(4) "3.14" @@ -339,7 +339,7 @@ object(stdClass)#%d (1) { object(stdClass)#%d (1) { ["x"]=> object(stdClass)#%d (1) { - [%r(0|"0")%r]=> + ["0"]=> object(MongoDB\BSON\Javascript)#%d (2) { ["code"]=> string(12) "function(){}" @@ -376,7 +376,7 @@ object(stdClass)#%d (1) { object(stdClass)#%d (1) { ["x"]=> object(stdClass)#%d (1) { - [%r(0|"0")%r]=> + ["0"]=> object(MongoDB\BSON\MaxKey)#%d (0) { } } @@ -405,7 +405,7 @@ object(stdClass)#%d (1) { object(stdClass)#%d (1) { ["x"]=> object(stdClass)#%d (1) { - [%r(0|"0")%r]=> + ["0"]=> object(MongoDB\BSON\MinKey)#%d (0) { } } @@ -436,7 +436,7 @@ object(stdClass)#%d (1) { object(stdClass)#%d (1) { ["x"]=> object(stdClass)#%d (1) { - [%r(0|"0")%r]=> + ["0"]=> object(MongoDB\BSON\ObjectId)#%d (1) { ["oid"]=> string(24) "586c18d86118fd6c9012dec1" @@ -473,7 +473,7 @@ object(stdClass)#%d (1) { object(stdClass)#%d (1) { ["x"]=> object(stdClass)#%d (1) { - [%r(0|"0")%r]=> + ["0"]=> object(MongoDB\BSON\Regex)#%d (2) { ["pattern"]=> string(3) "foo" @@ -514,7 +514,7 @@ object(stdClass)#%d (1) { object(stdClass)#%d (1) { ["x"]=> object(stdClass)#%d (1) { - [%r(0|"0")%r]=> + ["0"]=> object(MongoDB\BSON\Timestamp)#%d (2) { ["increment"]=> string(4) "1234" @@ -553,7 +553,7 @@ object(stdClass)#%d (1) { object(stdClass)#%d (1) { ["x"]=> object(stdClass)#%d (1) { - [%r(0|"0")%r]=> + ["0"]=> object(MongoDB\BSON\UTCDateTime)#%d (1) { ["milliseconds"]=> string(13) "1483479256924" diff --git a/tests/bson/bug0974-001.phpt b/tests/bson/bug0974-001.phpt index d5930a405..e05583134 100644 --- a/tests/bson/bug0974-001.phpt +++ b/tests/bson/bug0974-001.phpt @@ -31,25 +31,25 @@ object(stdClass)#%d (%d) { } } object(stdClass)#%d (%d) { - [%r(0|"0")%r]=> + ["0"]=> int(1) - [%r(1|"1")%r]=> + ["1"]=> int(2) - [%r(2|"2")%r]=> + ["2"]=> int(3) - [%r(3|"3")%r]=> + ["3"]=> object(MongoDB\BSON\UTCDateTime)#%d (%d) { ["milliseconds"]=> string(13) "1497352886906" } } -object(stdClass)#3 (2) { - [%r(0|"0")%r]=> +object(stdClass)#%d (%d) { + ["0"]=> object(MongoDB\BSON\ObjectId)#%d (%d) { ["oid"]=> string(24) "55f2b3f1f657b3fa97c9c0a2" } - [%r(1|"1")%r]=> + ["1"]=> object(MongoDB\BSON\UTCDateTime)#%d (%d) { ["milliseconds"]=> string(13) "1497352886906" diff --git a/tests/functional/query-sort-004.phpt b/tests/functional/query-sort-004.phpt index 366d1292f..f9bb00210 100644 --- a/tests/functional/query-sort-004.phpt +++ b/tests/functional/query-sort-004.phpt @@ -49,7 +49,7 @@ object(MongoDB\Driver\Query)#%d (%d) { object(stdClass)#%d (%d) { ["sort"]=> object(stdClass)#%d (%d) { - [%r(0|"0")%r]=> + ["0"]=> int(1) } } From e0cbf37bf20cd080a48720d0f73e78762811062e Mon Sep 17 00:00:00 2001 From: Andreas Braun Date: Tue, 1 Aug 2023 09:10:07 +0200 Subject: [PATCH 6/8] Fix var_export format in tests --- tests/bson/bson-binary-set_state-001.phpt | 20 +++++----- tests/bson/bson-dbpointer-set_state-001.phpt | 4 +- tests/bson/bson-decimal128-set_state-001.phpt | 12 +++--- tests/bson/bson-document-set_state-001.phpt | 2 +- tests/bson/bson-int64-set_state-001.phpt | 2 +- tests/bson/bson-javascript-set_state-001.phpt | 38 +++++++++---------- tests/bson/bson-objectid-set_state-001.phpt | 2 +- .../bson/bson-packedarray-set_state-001.phpt | 2 +- tests/bson/bson-regex-set_state-001.phpt | 4 +- tests/bson/bson-regex-set_state-002.phpt | 4 +- tests/bson/bson-symbol-set_state-001.phpt | 2 +- tests/bson/bson-timestamp-set_state-001.phpt | 12 +++--- tests/bson/bson-timestamp-set_state-002.phpt | 8 ++-- .../bson/bson-utcdatetime-set_state-001.phpt | 6 +-- .../bson/bson-utcdatetime-set_state-002.phpt | 6 +-- .../readpreference-set_state-001.phpt | 28 +++++++------- .../readpreference-var_export-001.phpt | 28 +++++++------- .../serverDescription-var_export-001.phpt | 2 +- 18 files changed, 91 insertions(+), 91 deletions(-) diff --git a/tests/bson/bson-binary-set_state-001.phpt b/tests/bson/bson-binary-set_state-001.phpt index b7ac0b53b..84f2468f2 100644 --- a/tests/bson/bson-binary-set_state-001.phpt +++ b/tests/bson/bson-binary-set_state-001.phpt @@ -26,28 +26,28 @@ foreach ($tests as $test) { --EXPECTF-- %r\\?%rMongoDB\BSON\Binary::__set_state(array( -%w'data' => 'foobar', -%w'type' => 0, + 'data' => 'foobar', + 'type' => 0, )) %r\\?%rMongoDB\BSON\Binary::__set_state(array( -%w'data' => '', -%w'type' => 0, + 'data' => '', + 'type' => 0, )) %r\\?%rMongoDB\BSON\Binary::__set_state(array( -%w'data' => '' . "\0" . 'foo', -%w'type' => 0, + 'data' => '' . "\0" . 'foo', + 'type' => 0, )) %r\\?%rMongoDB\BSON\Binary::__set_state(array( -%w'data' => '>Egè›Ó¤VBfUD' . "\0" . '' . "\0" . '', -%w'type' => 4, + 'data' => '>Egè›Ó¤VBfUD' . "\0" . '' . "\0" . '', + 'type' => 4, )) %r\\?%rMongoDB\BSON\Binary::__set_state(array( -%w'data' => '8Xö"0¬<‘_0 fCÆ?', -%w'type' => 5, + 'data' => '8Xö"0¬<‘_0 fCÆ?', + 'type' => 5, )) ===DONE=== diff --git a/tests/bson/bson-dbpointer-set_state-001.phpt b/tests/bson/bson-dbpointer-set_state-001.phpt index 497a3fe53..6383db1cc 100644 --- a/tests/bson/bson-dbpointer-set_state-001.phpt +++ b/tests/bson/bson-dbpointer-set_state-001.phpt @@ -15,8 +15,8 @@ var_dump(eval('return ' . $s . ';')); --EXPECTF-- %r\\?%rMongoDB\BSON\DBPointer::__set_state(array( -%w'ref' => 'phongo.test', -%w'id' => '5a2e78accd485d55b4050000', + 'ref' => 'phongo.test', + 'id' => '5a2e78accd485d55b4050000', )) object(MongoDB\BSON\DBPointer)#%d (%d) { ["ref"]=> diff --git a/tests/bson/bson-decimal128-set_state-001.phpt b/tests/bson/bson-decimal128-set_state-001.phpt index 79d5f42ba..dbb9d4519 100644 --- a/tests/bson/bson-decimal128-set_state-001.phpt +++ b/tests/bson/bson-decimal128-set_state-001.phpt @@ -24,27 +24,27 @@ foreach ($tests as $value) { --EXPECTF-- %r\\?%rMongoDB\BSON\Decimal128::__set_state(array( -%w'dec' => '1234.5678', + 'dec' => '1234.5678', )) %r\\?%rMongoDB\BSON\Decimal128::__set_state(array( -%w'dec' => '-1234.5678', + 'dec' => '-1234.5678', )) %r\\?%rMongoDB\BSON\Decimal128::__set_state(array( -%w'dec' => 'Infinity', + 'dec' => 'Infinity', )) %r\\?%rMongoDB\BSON\Decimal128::__set_state(array( -%w'dec' => 'Infinity', + 'dec' => 'Infinity', )) %r\\?%rMongoDB\BSON\Decimal128::__set_state(array( -%w'dec' => 'NaN', + 'dec' => 'NaN', )) %r\\?%rMongoDB\BSON\Decimal128::__set_state(array( -%w'dec' => 'NaN', + 'dec' => 'NaN', )) ===DONE=== diff --git a/tests/bson/bson-document-set_state-001.phpt b/tests/bson/bson-document-set_state-001.phpt index 165eaae25..b4c4047b8 100644 --- a/tests/bson/bson-document-set_state-001.phpt +++ b/tests/bson/bson-document-set_state-001.phpt @@ -20,7 +20,7 @@ var_dump($o == $document); --EXPECTF-- %r\\?%rMongoDB\BSON\Document::__set_state(array( -%w'data' => 'TwAAABBfaWQAAQAAAARhcnJheQAeAAAAEDAAAAAAABAxAAEAAAACMgAEAAAAZm9vAAADZG9jdW1lbnQAEgAAAAJmb28ABAAAAGJhcgAAAA==', + 'data' => 'TwAAABBfaWQAAQAAAARhcnJheQAeAAAAEDAAAAAAABAxAAEAAAACMgAEAAAAZm9vAAADZG9jdW1lbnQAEgAAAAJmb28ABAAAAGJhcgAAAA==', )) object(MongoDB\BSON\Document)#%d (%d) { ["data"]=> diff --git a/tests/bson/bson-int64-set_state-001.phpt b/tests/bson/bson-int64-set_state-001.phpt index a2f9e4a99..fd2618cc3 100644 --- a/tests/bson/bson-int64-set_state-001.phpt +++ b/tests/bson/bson-int64-set_state-001.phpt @@ -15,7 +15,7 @@ var_dump(eval('return ' . $s . ';')); --EXPECTF-- %r\\?%rMongoDB\BSON\Int64::__set_state(array( -%w'integer' => '2', + 'integer' => '2', )) object(MongoDB\BSON\Int64)#%d (%d) { ["integer"]=> diff --git a/tests/bson/bson-javascript-set_state-001.phpt b/tests/bson/bson-javascript-set_state-001.phpt index c20e75b93..611950631 100644 --- a/tests/bson/bson-javascript-set_state-001.phpt +++ b/tests/bson/bson-javascript-set_state-001.phpt @@ -31,39 +31,39 @@ echo "\n\n"; --EXPECTF-- %r\\?%rMongoDB\BSON\Javascript::__set_state(array( -%w'code' => 'function foo(bar) { return bar; }', -%w'scope' => NULL, + 'code' => 'function foo(bar) { return bar; }', + 'scope' => NULL, )) %r\\?%rMongoDB\BSON\Javascript::__set_state(array( -%w'code' => 'function foo(bar) { return bar; }', -%w'scope' => - %Sarray( - %S), + 'code' => 'function foo(bar) { return bar; }', + 'scope' =>%w + %r\(object\)? %rarray( + %r\)?%r), )) %r\\?%rMongoDB\BSON\Javascript::__set_state(array( -%w'code' => 'function foo() { return foo; }', -%w'scope' => - %Sarray( - %w'foo' => 42, - %S), + 'code' => 'function foo() { return foo; }', + 'scope' =>%w + %r\(object\)? %rarray( + 'foo' => 42, + %r\)?%r), )) %r\\?%rMongoDB\BSON\Javascript::__set_state(array( -%w'code' => 'function foo() { return id; }', -%w'scope' => - %Sarray( - %w'id' => + 'code' => 'function foo() { return id; }', + 'scope' =>%w + %r\(object\)? %rarray( + 'id' =>%w %r\\?%rMongoDB\BSON\ObjectId::__set_state(array( - %w'oid' => '53e2a1c40640fd72175d4603', + 'oid' => '53e2a1c40640fd72175d4603', )), - %S), + %r\)?%r), )) %r\\?%rMongoDB\BSON\Javascript::__set_state(array( -%w'code' => 'function foo(bar) { return bar; }', -%w'scope' => NULL, + 'code' => 'function foo(bar) { return bar; }', + 'scope' => NULL, )) ===DONE=== diff --git a/tests/bson/bson-objectid-set_state-001.phpt b/tests/bson/bson-objectid-set_state-001.phpt index e137d1814..4c335e0ec 100644 --- a/tests/bson/bson-objectid-set_state-001.phpt +++ b/tests/bson/bson-objectid-set_state-001.phpt @@ -13,6 +13,6 @@ echo "\n"; --EXPECTF-- %r\\?%rMongoDB\BSON\ObjectId::__set_state(array( -%w'oid' => '576c25db6118fd406e6e6471', + 'oid' => '576c25db6118fd406e6e6471', )) ===DONE=== diff --git a/tests/bson/bson-packedarray-set_state-001.phpt b/tests/bson/bson-packedarray-set_state-001.phpt index 34e3dcd2b..6392b396b 100644 --- a/tests/bson/bson-packedarray-set_state-001.phpt +++ b/tests/bson/bson-packedarray-set_state-001.phpt @@ -20,7 +20,7 @@ var_dump($a == $array); --EXPECTF-- %r\\?%rMongoDB\BSON\PackedArray::__set_state(array( -%w'data' => 'MwAAABAwAAAAAAAQMQABAAAAAjIABAAAAGZvbwADMwASAAAAAmZvbwAEAAAAYmFyAAAA', + 'data' => 'MwAAABAwAAAAAAAQMQABAAAAAjIABAAAAGZvbwADMwASAAAAAmZvbwAEAAAAYmFyAAAA', )) object(MongoDB\BSON\PackedArray)#%d (%d) { ["data"]=> diff --git a/tests/bson/bson-regex-set_state-001.phpt b/tests/bson/bson-regex-set_state-001.phpt index 47f92a922..838c08539 100644 --- a/tests/bson/bson-regex-set_state-001.phpt +++ b/tests/bson/bson-regex-set_state-001.phpt @@ -14,7 +14,7 @@ echo "\n"; --EXPECTF-- %r\\?%rMongoDB\BSON\Regex::__set_state(array( -%w'pattern' => 'regexp', -%w'flags' => 'i', + 'pattern' => 'regexp', + 'flags' => 'i', )) ===DONE=== diff --git a/tests/bson/bson-regex-set_state-002.phpt b/tests/bson/bson-regex-set_state-002.phpt index 1233e53c6..50a856044 100644 --- a/tests/bson/bson-regex-set_state-002.phpt +++ b/tests/bson/bson-regex-set_state-002.phpt @@ -14,7 +14,7 @@ echo "\n"; --EXPECTF-- %r\\?%rMongoDB\BSON\Regex::__set_state(array( -%w'pattern' => 'regexp', -%w'flags' => 'ilmsux', + 'pattern' => 'regexp', + 'flags' => 'ilmsux', )) ===DONE=== diff --git a/tests/bson/bson-symbol-set_state-001.phpt b/tests/bson/bson-symbol-set_state-001.phpt index b60ae03fb..ee28f5f62 100644 --- a/tests/bson/bson-symbol-set_state-001.phpt +++ b/tests/bson/bson-symbol-set_state-001.phpt @@ -15,7 +15,7 @@ var_dump(eval('return ' . $s . ';')); --EXPECTF-- %r\\?%rMongoDB\BSON\Symbol::__set_state(array( -%w'symbol' => 'test', + 'symbol' => 'test', )) object(MongoDB\BSON\Symbol)#%d (%d) { ["symbol"]=> diff --git a/tests/bson/bson-timestamp-set_state-001.phpt b/tests/bson/bson-timestamp-set_state-001.phpt index 64de42600..d946ec2e9 100644 --- a/tests/bson/bson-timestamp-set_state-001.phpt +++ b/tests/bson/bson-timestamp-set_state-001.phpt @@ -24,18 +24,18 @@ foreach ($tests as $test) { --EXPECTF-- %r\\?%rMongoDB\BSON\Timestamp::__set_state(array( -%w'increment' => '1234', -%w'timestamp' => '5678', + 'increment' => '1234', + 'timestamp' => '5678', )) %r\\?%rMongoDB\BSON\Timestamp::__set_state(array( -%w'increment' => '2147483647', -%w'timestamp' => '0', + 'increment' => '2147483647', + 'timestamp' => '0', )) %r\\?%rMongoDB\BSON\Timestamp::__set_state(array( -%w'increment' => '0', -%w'timestamp' => '2147483647', + 'increment' => '0', + 'timestamp' => '2147483647', )) ===DONE=== diff --git a/tests/bson/bson-timestamp-set_state-002.phpt b/tests/bson/bson-timestamp-set_state-002.phpt index 1439ab0fb..205d666b4 100644 --- a/tests/bson/bson-timestamp-set_state-002.phpt +++ b/tests/bson/bson-timestamp-set_state-002.phpt @@ -25,13 +25,13 @@ foreach ($tests as $test) { --EXPECTF-- %r\\?%rMongoDB\BSON\Timestamp::__set_state(array( -%w'increment' => '4294967295', -%w'timestamp' => '0', + 'increment' => '4294967295', + 'timestamp' => '0', )) %r\\?%rMongoDB\BSON\Timestamp::__set_state(array( -%w'increment' => '0', -%w'timestamp' => '4294967295', + 'increment' => '0', + 'timestamp' => '4294967295', )) ===DONE=== diff --git a/tests/bson/bson-utcdatetime-set_state-001.phpt b/tests/bson/bson-utcdatetime-set_state-001.phpt index 688a10c9a..ef5a1d7c8 100644 --- a/tests/bson/bson-utcdatetime-set_state-001.phpt +++ b/tests/bson/bson-utcdatetime-set_state-001.phpt @@ -21,15 +21,15 @@ foreach ($tests as $milliseconds) { --EXPECTF-- %r\\?%rMongoDB\BSON\UTCDateTime::__set_state(array( -%w'milliseconds' => '0', + 'milliseconds' => '0', )) %r\\?%rMongoDB\BSON\UTCDateTime::__set_state(array( -%w'milliseconds' => '-1416445411987', + 'milliseconds' => '-1416445411987', )) %r\\?%rMongoDB\BSON\UTCDateTime::__set_state(array( -%w'milliseconds' => '1416445411987', + 'milliseconds' => '1416445411987', )) ===DONE=== diff --git a/tests/bson/bson-utcdatetime-set_state-002.phpt b/tests/bson/bson-utcdatetime-set_state-002.phpt index 62b95b35b..76e295898 100644 --- a/tests/bson/bson-utcdatetime-set_state-002.phpt +++ b/tests/bson/bson-utcdatetime-set_state-002.phpt @@ -23,15 +23,15 @@ foreach ($tests as $milliseconds) { --EXPECTF-- %r\\?%rMongoDB\BSON\UTCDateTime::__set_state(array( -%w'milliseconds' => '0', + 'milliseconds' => '0', )) %r\\?%rMongoDB\BSON\UTCDateTime::__set_state(array( -%w'milliseconds' => '-1416445411987', + 'milliseconds' => '-1416445411987', )) %r\\?%rMongoDB\BSON\UTCDateTime::__set_state(array( -%w'milliseconds' => '1416445411987', + 'milliseconds' => '1416445411987', )) ===DONE=== diff --git a/tests/readPreference/readpreference-set_state-001.phpt b/tests/readPreference/readpreference-set_state-001.phpt index b8b957684..1efeb4534 100644 --- a/tests/readPreference/readpreference-set_state-001.phpt +++ b/tests/readPreference/readpreference-set_state-001.phpt @@ -48,31 +48,31 @@ foreach ($tests as $fields) { %r\\?%rMongoDB\Driver\ReadPreference::__set_state(array( 'mode' => 'secondary', - 'tags' => + 'tags' =>%w array ( - 0 => - %Sarray( + 0 =>%w + %r\(object\)? %rarray( 'dc' => 'ny', - %S), + %r\)?%r), ), )) %r\\?%rMongoDB\Driver\ReadPreference::__set_state(array( 'mode' => 'secondary', - 'tags' => + 'tags' =>%w array ( - 0 => - %Sarray( + 0 =>%w + %r\(object\)? %rarray( 'dc' => 'ny', - %S), - 1 => - %Sarray( + %r\)?%r), + 1 =>%w + %r\(object\)? %rarray( 'dc' => 'sf', 'use' => 'reporting', - %S), - 2 => - %Sarray( - %S), + %r\)?%r), + 2 =>%w + %r\(object\)? %rarray( + %r\)?%r), ), )) diff --git a/tests/readPreference/readpreference-var_export-001.phpt b/tests/readPreference/readpreference-var_export-001.phpt index 4ee9be0b1..1d66e74f7 100644 --- a/tests/readPreference/readpreference-var_export-001.phpt +++ b/tests/readPreference/readpreference-var_export-001.phpt @@ -45,30 +45,30 @@ foreach ($tests as $test) { )) %r\\?%rMongoDB\Driver\ReadPreference::__set_state(array( 'mode' => 'secondary', - 'tags' => + 'tags' =>%w array ( - 0 => - %Sarray( + 0 =>%w + %r\(object\)? %rarray( 'dc' => 'ny', - %S), + %r\)?%r), ), )) %r\\?%rMongoDB\Driver\ReadPreference::__set_state(array( 'mode' => 'secondary', - 'tags' => + 'tags' =>%w array ( - 0 => - %Sarray( + 0 =>%w + %r\(object\)? %rarray( 'dc' => 'ny', - %S), - 1 => - %Sarray( + %r\)?%r), + 1 =>%w + %r\(object\)? %rarray( 'dc' => 'sf', 'use' => 'reporting', - %S), - 2 => - %Sarray( - %S), + %r\)?%r), + 2 =>%w + %r\(object\)? %rarray( + %r\)?%r), ), )) %r\\?%rMongoDB\Driver\ReadPreference::__set_state(array( diff --git a/tests/serverDescription/serverDescription-var_export-001.phpt b/tests/serverDescription/serverDescription-var_export-001.phpt index 9b21f0242..4b5258e38 100644 --- a/tests/serverDescription/serverDescription-var_export-001.phpt +++ b/tests/serverDescription/serverDescription-var_export-001.phpt @@ -21,7 +21,7 @@ echo var_export($server->getServerDescription(), true), "\n"; 'host' => '%s', 'port' => %d, 'type' => '%r(Standalone|Mongos|RSPrimary|LoadBalancer)%r', - 'hello_response' => + 'hello_response' =>%w array (%A ), 'last_update_time' => %r('\d+'|\d+)%r, From ba5154218e21e02889fb33ad11784fccab381ef1 Mon Sep 17 00:00:00 2001 From: Andreas Braun Date: Wed, 2 Aug 2023 08:29:20 +0200 Subject: [PATCH 7/8] Use wildcards when matching object properties --- tests/bson/bson-dbpointer-002.phpt | 2 +- tests/bson/bson-dbpointer-serialization-002.phpt | 4 ++-- tests/serverApi/serverApi-serialization-002.phpt | 8 ++++---- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/tests/bson/bson-dbpointer-002.phpt b/tests/bson/bson-dbpointer-002.phpt index 065a776a8..58c37cb2c 100644 --- a/tests/bson/bson-dbpointer-002.phpt +++ b/tests/bson/bson-dbpointer-002.phpt @@ -10,7 +10,7 @@ var_dump($dbptr->dbref); ===DONE=== --EXPECTF-- -object(MongoDB\BSON\DBPointer)#1 (2) { +object(MongoDB\BSON\DBPointer)#%d (%d) { ["ref"]=> string(11) "phongo.test" ["id"]=> diff --git a/tests/bson/bson-dbpointer-serialization-002.phpt b/tests/bson/bson-dbpointer-serialization-002.phpt index 815ccd05f..8668f2154 100644 --- a/tests/bson/bson-dbpointer-serialization-002.phpt +++ b/tests/bson/bson-dbpointer-serialization-002.phpt @@ -14,14 +14,14 @@ echo "\n"; ===DONE=== --EXPECTF-- -object(MongoDB\BSON\DBPointer)#1 (2) { +object(MongoDB\BSON\DBPointer)#%d (%d) { ["ref"]=> string(11) "phongo.test" ["id"]=> string(24) "5a2e78accd485d55b4050000" } string(104) "O:22:"MongoDB\BSON\DBPointer":2:{s:3:"ref";s:11:"phongo.test";s:2:"id";s:24:"5a2e78accd485d55b4050000";}" -object(MongoDB\BSON\DBPointer)#2 (2) { +object(MongoDB\BSON\DBPointer)#%d (%d) { ["ref"]=> string(11) "phongo.test" ["id"]=> diff --git a/tests/serverApi/serverApi-serialization-002.phpt b/tests/serverApi/serverApi-serialization-002.phpt index f1b73bb72..1476f0057 100644 --- a/tests/serverApi/serverApi-serialization-002.phpt +++ b/tests/serverApi/serverApi-serialization-002.phpt @@ -32,7 +32,7 @@ object(MongoDB\Driver\ServerApi)#%d (%d) { NULL } O:24:"MongoDB\Driver\ServerApi":3:{s:7:"version";s:1:"1";s:6:"strict";N;s:17:"deprecationErrors";N;} -object(MongoDB\Driver\ServerApi)#5 (3) { +object(MongoDB\Driver\ServerApi)#%d (%d) { ["version"]=> string(1) "1" ["strict"]=> @@ -50,7 +50,7 @@ object(MongoDB\Driver\ServerApi)#%d (%d) { NULL } O:24:"MongoDB\Driver\ServerApi":3:{s:7:"version";s:1:"1";s:6:"strict";b:1;s:17:"deprecationErrors";N;} -object(MongoDB\Driver\ServerApi)#5 (3) { +object(MongoDB\Driver\ServerApi)#%d (%d) { ["version"]=> string(1) "1" ["strict"]=> @@ -68,7 +68,7 @@ object(MongoDB\Driver\ServerApi)#%d (%d) { bool(true) } O:24:"MongoDB\Driver\ServerApi":3:{s:7:"version";s:1:"1";s:6:"strict";N;s:17:"deprecationErrors";b:1;} -object(MongoDB\Driver\ServerApi)#5 (3) { +object(MongoDB\Driver\ServerApi)#%d (%d) { ["version"]=> string(1) "1" ["strict"]=> @@ -86,7 +86,7 @@ object(MongoDB\Driver\ServerApi)#%d (%d) { bool(false) } O:24:"MongoDB\Driver\ServerApi":3:{s:7:"version";s:1:"1";s:6:"strict";b:0;s:17:"deprecationErrors";b:0;} -object(MongoDB\Driver\ServerApi)#5 (3) { +object(MongoDB\Driver\ServerApi)#%d (%d) { ["version"]=> string(1) "1" ["strict"]=> From 45ed3d60637b3201334b23a7f237220dad1a41a6 Mon Sep 17 00:00:00 2001 From: Andreas Braun Date: Fri, 4 Aug 2023 08:44:12 +0200 Subject: [PATCH 8/8] Remove unnecessary matching pattern in __set_state tests --- tests/bson/bson-javascript-set_state-001.phpt | 12 ++++++------ .../readpreference-set_state-001.phpt | 16 ++++++++-------- .../readpreference-var_export-001.phpt | 16 ++++++++-------- 3 files changed, 22 insertions(+), 22 deletions(-) diff --git a/tests/bson/bson-javascript-set_state-001.phpt b/tests/bson/bson-javascript-set_state-001.phpt index 611950631..8bb1268d1 100644 --- a/tests/bson/bson-javascript-set_state-001.phpt +++ b/tests/bson/bson-javascript-set_state-001.phpt @@ -38,27 +38,27 @@ echo "\n\n"; %r\\?%rMongoDB\BSON\Javascript::__set_state(array( 'code' => 'function foo(bar) { return bar; }', 'scope' =>%w - %r\(object\)? %rarray( - %r\)?%r), + (object) array( + ), )) %r\\?%rMongoDB\BSON\Javascript::__set_state(array( 'code' => 'function foo() { return foo; }', 'scope' =>%w - %r\(object\)? %rarray( + (object) array( 'foo' => 42, - %r\)?%r), + ), )) %r\\?%rMongoDB\BSON\Javascript::__set_state(array( 'code' => 'function foo() { return id; }', 'scope' =>%w - %r\(object\)? %rarray( + (object) array( 'id' =>%w %r\\?%rMongoDB\BSON\ObjectId::__set_state(array( 'oid' => '53e2a1c40640fd72175d4603', )), - %r\)?%r), + ), )) %r\\?%rMongoDB\BSON\Javascript::__set_state(array( diff --git a/tests/readPreference/readpreference-set_state-001.phpt b/tests/readPreference/readpreference-set_state-001.phpt index 1efeb4534..d3bf8dce3 100644 --- a/tests/readPreference/readpreference-set_state-001.phpt +++ b/tests/readPreference/readpreference-set_state-001.phpt @@ -51,9 +51,9 @@ foreach ($tests as $fields) { 'tags' =>%w array ( 0 =>%w - %r\(object\)? %rarray( + (object) array( 'dc' => 'ny', - %r\)?%r), + ), ), )) @@ -62,17 +62,17 @@ foreach ($tests as $fields) { 'tags' =>%w array ( 0 =>%w - %r\(object\)? %rarray( + (object) array( 'dc' => 'ny', - %r\)?%r), + ), 1 =>%w - %r\(object\)? %rarray( + (object) array( 'dc' => 'sf', 'use' => 'reporting', - %r\)?%r), + ), 2 =>%w - %r\(object\)? %rarray( - %r\)?%r), + (object) array( + ), ), )) diff --git a/tests/readPreference/readpreference-var_export-001.phpt b/tests/readPreference/readpreference-var_export-001.phpt index 1d66e74f7..f26425256 100644 --- a/tests/readPreference/readpreference-var_export-001.phpt +++ b/tests/readPreference/readpreference-var_export-001.phpt @@ -48,9 +48,9 @@ foreach ($tests as $test) { 'tags' =>%w array ( 0 =>%w - %r\(object\)? %rarray( + (object) array( 'dc' => 'ny', - %r\)?%r), + ), ), )) %r\\?%rMongoDB\Driver\ReadPreference::__set_state(array( @@ -58,17 +58,17 @@ foreach ($tests as $test) { 'tags' =>%w array ( 0 =>%w - %r\(object\)? %rarray( + (object) array( 'dc' => 'ny', - %r\)?%r), + ), 1 =>%w - %r\(object\)? %rarray( + (object) array( 'dc' => 'sf', 'use' => 'reporting', - %r\)?%r), + ), 2 =>%w - %r\(object\)? %rarray( - %r\)?%r), + (object) array( + ), ), )) %r\\?%rMongoDB\Driver\ReadPreference::__set_state(array(