diff --git a/src/MongoDB/Manager.c b/src/MongoDB/Manager.c index 78f25e33e..f24a383fe 100644 --- a/src/MongoDB/Manager.c +++ b/src/MongoDB/Manager.c @@ -280,7 +280,6 @@ static PHP_METHOD(MongoDB_Driver_Manager, executeCommand) size_t db_len; zval* command; zval* options = NULL; - bool free_options = false; zval* zreadPreference = NULL; zval* zsession = NULL; uint32_t server_id = 0; @@ -294,21 +293,19 @@ static PHP_METHOD(MongoDB_Driver_Manager, executeCommand) intern = Z_MANAGER_OBJ_P(getThis()); - options = php_phongo_prep_legacy_option(options, "readPreference", &free_options); - if (!phongo_parse_session(options, intern->client, NULL, &zsession)) { /* Exception should already have been thrown */ - goto cleanup; + return; } if (!phongo_parse_read_preference(options, &zreadPreference)) { /* Exception should already have been thrown */ - goto cleanup; + return; } if (!php_phongo_manager_select_server(false, false, zreadPreference, zsession, intern->client, &server_id)) { /* Exception should already have been thrown */ - goto cleanup; + return; } /* If the Manager was created in a different process, reset the client so @@ -317,11 +314,6 @@ static PHP_METHOD(MongoDB_Driver_Manager, executeCommand) PHONGO_RESET_CLIENT_IF_PID_DIFFERS(intern, intern); phongo_execute_command(getThis(), PHONGO_COMMAND_RAW, db, command, options, server_id, return_value); - -cleanup: - if (free_options) { - php_phongo_prep_legacy_option_free(options); - } } /* Execute a ReadCommand */ @@ -452,7 +444,6 @@ static PHP_METHOD(MongoDB_Driver_Manager, executeQuery) size_t namespace_len; zval* query; zval* options = NULL; - bool free_options = false; zval* zreadPreference = NULL; uint32_t server_id = 0; zval* zsession = NULL; @@ -466,21 +457,19 @@ static PHP_METHOD(MongoDB_Driver_Manager, executeQuery) intern = Z_MANAGER_OBJ_P(getThis()); - options = php_phongo_prep_legacy_option(options, "readPreference", &free_options); - if (!phongo_parse_session(options, intern->client, NULL, &zsession)) { /* Exception should already have been thrown */ - goto cleanup; + return; } if (!phongo_parse_read_preference(options, &zreadPreference)) { /* Exception should already have been thrown */ - goto cleanup; + return; } if (!php_phongo_manager_select_server(false, true, zreadPreference, zsession, intern->client, &server_id)) { /* Exception should already have been thrown */ - goto cleanup; + return; } /* If the Manager was created in a different process, reset the client so @@ -489,11 +478,6 @@ static PHP_METHOD(MongoDB_Driver_Manager, executeQuery) PHONGO_RESET_CLIENT_IF_PID_DIFFERS(intern, intern); phongo_execute_query(getThis(), namespace, query, options, server_id, return_value); - -cleanup: - if (free_options) { - php_phongo_prep_legacy_option_free(options); - } } /* Executes a BulkWrite (i.e. any number of insert, update, and delete ops) */ @@ -504,10 +488,9 @@ static PHP_METHOD(MongoDB_Driver_Manager, executeBulkWrite) size_t namespace_len; zval* zbulk; php_phongo_bulkwrite_t* bulk; - zval* options = NULL; - bool free_options = false; - uint32_t server_id = 0; - zval* zsession = NULL; + zval* options = NULL; + uint32_t server_id = 0; + zval* zsession = NULL; PHONGO_PARSE_PARAMETERS_START(2, 3) Z_PARAM_STRING_OR_NULL(namespace, namespace_len) @@ -519,8 +502,6 @@ static PHP_METHOD(MongoDB_Driver_Manager, executeBulkWrite) intern = Z_MANAGER_OBJ_P(getThis()); bulk = Z_BULKWRITE_OBJ_P(zbulk); - options = php_phongo_prep_legacy_option(options, "writeConcern", &free_options); - if (!phongo_parse_session(options, intern->client, NULL, &zsession)) { /* Exception should already have been thrown */ return; @@ -528,7 +509,7 @@ static PHP_METHOD(MongoDB_Driver_Manager, executeBulkWrite) if (!php_phongo_manager_select_server(true, false, NULL, zsession, intern->client, &server_id)) { /* Exception should already have been thrown */ - goto cleanup; + return; } /* If the Server was created in a different process, reset the client so @@ -536,11 +517,6 @@ static PHP_METHOD(MongoDB_Driver_Manager, executeBulkWrite) PHONGO_RESET_CLIENT_IF_PID_DIFFERS(intern, intern); phongo_execute_bulk_write(getThis(), namespace, bulk, options, server_id, return_value); - -cleanup: - if (free_options) { - php_phongo_prep_legacy_option_free(options); - } } /* Returns the autoEncryption.encryptedFieldsMap driver option */ diff --git a/src/MongoDB/Manager.stub.php b/src/MongoDB/Manager.stub.php index b07d01aae..b421e8bae 100644 --- a/src/MongoDB/Manager.stub.php +++ b/src/MongoDB/Manager.stub.php @@ -16,11 +16,11 @@ final public function addSubscriber(Monitoring\Subscriber $subscriber): void {} final public function createClientEncryption(array $options): ClientEncryption {} - final public function executeBulkWrite(string $namespace, BulkWrite $bulk, array|WriteConcern|null $options = null): WriteResult {} + final public function executeBulkWrite(string $namespace, BulkWrite $bulk, array|null $options = null): WriteResult {} - final public function executeCommand(string $db, Command $command, array|ReadPreference|null $options = null): CursorInterface {} + final public function executeCommand(string $db, Command $command, array|null $options = null): CursorInterface {} - final public function executeQuery(string $namespace, Query $query, array|ReadPreference|null $options = null): CursorInterface {} + final public function executeQuery(string $namespace, Query $query, array|null $options = null): CursorInterface {} final public function executeReadCommand(string $db, Command $command, ?array $options = null): CursorInterface {} diff --git a/src/MongoDB/Manager_arginfo.h b/src/MongoDB/Manager_arginfo.h index c2fc74944..5c1532250 100644 --- a/src/MongoDB/Manager_arginfo.h +++ b/src/MongoDB/Manager_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: a1a1a6c333ba1919fd648a8786f41d9817850a13 */ + * Stub hash: 0e0470a95648b0188bcb59270f976b298596c1a4 */ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_Driver_Manager___construct, 0, 0, 0) ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, uri, IS_STRING, 1, "null") @@ -18,30 +18,26 @@ ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_MongoDB_Driver_Manager_executeBulkWrite, 0, 2, MongoDB\\Driver\\WriteResult, 0) ZEND_ARG_TYPE_INFO(0, namespace, IS_STRING, 0) ZEND_ARG_OBJ_INFO(0, bulk, MongoDB\\Driver\\BulkWrite, 0) - ZEND_ARG_OBJ_TYPE_MASK(0, options, MongoDB\\Driver\\WriteConcern, MAY_BE_ARRAY|MAY_BE_NULL, "null") + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, options, IS_ARRAY, 1, "null") ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_MongoDB_Driver_Manager_executeCommand, 0, 2, MongoDB\\Driver\\CursorInterface, 0) ZEND_ARG_TYPE_INFO(0, db, IS_STRING, 0) ZEND_ARG_OBJ_INFO(0, command, MongoDB\\Driver\\Command, 0) - ZEND_ARG_OBJ_TYPE_MASK(0, options, MongoDB\\Driver\\ReadPreference, MAY_BE_ARRAY|MAY_BE_NULL, "null") + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, options, IS_ARRAY, 1, "null") ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_MongoDB_Driver_Manager_executeQuery, 0, 2, MongoDB\\Driver\\CursorInterface, 0) ZEND_ARG_TYPE_INFO(0, namespace, IS_STRING, 0) ZEND_ARG_OBJ_INFO(0, query, MongoDB\\Driver\\Query, 0) - ZEND_ARG_OBJ_TYPE_MASK(0, options, MongoDB\\Driver\\ReadPreference, MAY_BE_ARRAY|MAY_BE_NULL, "null") -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_MongoDB_Driver_Manager_executeReadCommand, 0, 2, MongoDB\\Driver\\CursorInterface, 0) - ZEND_ARG_TYPE_INFO(0, db, IS_STRING, 0) - ZEND_ARG_OBJ_INFO(0, command, MongoDB\\Driver\\Command, 0) ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, options, IS_ARRAY, 1, "null") ZEND_END_ARG_INFO() -#define arginfo_class_MongoDB_Driver_Manager_executeReadWriteCommand arginfo_class_MongoDB_Driver_Manager_executeReadCommand +#define arginfo_class_MongoDB_Driver_Manager_executeReadCommand arginfo_class_MongoDB_Driver_Manager_executeCommand + +#define arginfo_class_MongoDB_Driver_Manager_executeReadWriteCommand arginfo_class_MongoDB_Driver_Manager_executeCommand -#define arginfo_class_MongoDB_Driver_Manager_executeWriteCommand arginfo_class_MongoDB_Driver_Manager_executeReadCommand +#define arginfo_class_MongoDB_Driver_Manager_executeWriteCommand arginfo_class_MongoDB_Driver_Manager_executeCommand ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_class_MongoDB_Driver_Manager_getEncryptedFieldsMap, 0, 0, MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_NULL) ZEND_END_ARG_INFO() diff --git a/src/MongoDB/Server.c b/src/MongoDB/Server.c index e500c7b16..c318c3112 100644 --- a/src/MongoDB/Server.c +++ b/src/MongoDB/Server.c @@ -42,8 +42,7 @@ static PHP_METHOD(MongoDB_Driver_Server, executeCommand) char* db; size_t db_len; zval* command; - zval* options = NULL; - bool free_options = false; + zval* options = NULL; intern = Z_SERVER_OBJ_P(getThis()); @@ -54,18 +53,12 @@ static PHP_METHOD(MongoDB_Driver_Server, executeCommand) Z_PARAM_ZVAL_OR_NULL(options) PHONGO_PARSE_PARAMETERS_END(); - options = php_phongo_prep_legacy_option(options, "readPreference", &free_options); - /* If the Server was created in a different process, reset the client so * that cursors created by this process can be differentiated and its * session pool is cleared. */ PHONGO_RESET_CLIENT_IF_PID_DIFFERS(intern, Z_MANAGER_OBJ_P(&intern->manager)); phongo_execute_command(&intern->manager, PHONGO_COMMAND_RAW, db, command, options, intern->server_id, return_value); - - if (free_options) { - php_phongo_prep_legacy_option_free(options); - } } /* Executes a ReadCommand on this Server */ @@ -153,8 +146,7 @@ static PHP_METHOD(MongoDB_Driver_Server, executeQuery) char* namespace; size_t namespace_len; zval* query; - zval* options = NULL; - bool free_options = false; + zval* options = NULL; intern = Z_SERVER_OBJ_P(getThis()); @@ -165,18 +157,12 @@ static PHP_METHOD(MongoDB_Driver_Server, executeQuery) Z_PARAM_ZVAL_OR_NULL(options) PHONGO_PARSE_PARAMETERS_END(); - options = php_phongo_prep_legacy_option(options, "readPreference", &free_options); - /* If the Server was created in a different process, reset the client so * that cursors created by this process can be differentiated and its * session pool is cleared. */ PHONGO_RESET_CLIENT_IF_PID_DIFFERS(intern, Z_MANAGER_OBJ_P(&intern->manager)); phongo_execute_query(&intern->manager, namespace, query, options, intern->server_id, return_value); - - if (free_options) { - php_phongo_prep_legacy_option_free(options); - } } /* Executes a BulkWrite (i.e. any number of insert, update, and delete ops) on @@ -188,8 +174,7 @@ static PHP_METHOD(MongoDB_Driver_Server, executeBulkWrite) size_t namespace_len; zval* zbulk; php_phongo_bulkwrite_t* bulk; - zval* options = NULL; - bool free_options = false; + zval* options = NULL; intern = Z_SERVER_OBJ_P(getThis()); @@ -202,17 +187,11 @@ static PHP_METHOD(MongoDB_Driver_Server, executeBulkWrite) bulk = Z_BULKWRITE_OBJ_P(zbulk); - options = php_phongo_prep_legacy_option(options, "writeConcern", &free_options); - /* If the Server was created in a different process, reset the client so * that its session pool is cleared. */ PHONGO_RESET_CLIENT_IF_PID_DIFFERS(intern, Z_MANAGER_OBJ_P(&intern->manager)); phongo_execute_bulk_write(&intern->manager, namespace, bulk, options, intern->server_id, return_value); - - if (free_options) { - php_phongo_prep_legacy_option_free(options); - } } /* Returns the hostname for this Server */ diff --git a/src/MongoDB/Server.stub.php b/src/MongoDB/Server.stub.php index d629e8ca2..9f2bb134c 100644 --- a/src/MongoDB/Server.stub.php +++ b/src/MongoDB/Server.stub.php @@ -72,11 +72,11 @@ final class Server final private function __construct() {} - final public function executeBulkWrite(string $namespace, BulkWrite $bulkWrite, array|WriteConcern|null $options = null): WriteResult {} + final public function executeBulkWrite(string $namespace, BulkWrite $bulkWrite, array|null $options = null): WriteResult {} - final public function executeCommand(string $db, Command $command, array|ReadPreference|null $options = null): CursorInterface {} + final public function executeCommand(string $db, Command $command, array|null $options = null): CursorInterface {} - final public function executeQuery(string $namespace, Query $query, array|ReadPreference|null $options = null): CursorInterface {} + final public function executeQuery(string $namespace, Query $query, array|null $options = null): CursorInterface {} final public function executeReadCommand(string $db, Command $command, ?array $options = null): CursorInterface {} diff --git a/src/MongoDB/Server_arginfo.h b/src/MongoDB/Server_arginfo.h index eea3f618a..03c68fed1 100644 --- a/src/MongoDB/Server_arginfo.h +++ b/src/MongoDB/Server_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 63542fe1821e8a9016e8514924f6aec30e4ea20e */ + * Stub hash: 4b3c108555c3548cf604852b1f0f334ada52a276 */ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_Driver_Server___construct, 0, 0, 0) ZEND_END_ARG_INFO() @@ -7,30 +7,26 @@ ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_MongoDB_Driver_Server_executeBulkWrite, 0, 2, MongoDB\\Driver\\WriteResult, 0) ZEND_ARG_TYPE_INFO(0, namespace, IS_STRING, 0) ZEND_ARG_OBJ_INFO(0, bulkWrite, MongoDB\\Driver\\BulkWrite, 0) - ZEND_ARG_OBJ_TYPE_MASK(0, options, MongoDB\\Driver\\WriteConcern, MAY_BE_ARRAY|MAY_BE_NULL, "null") + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, options, IS_ARRAY, 1, "null") ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_MongoDB_Driver_Server_executeCommand, 0, 2, MongoDB\\Driver\\CursorInterface, 0) ZEND_ARG_TYPE_INFO(0, db, IS_STRING, 0) ZEND_ARG_OBJ_INFO(0, command, MongoDB\\Driver\\Command, 0) - ZEND_ARG_OBJ_TYPE_MASK(0, options, MongoDB\\Driver\\ReadPreference, MAY_BE_ARRAY|MAY_BE_NULL, "null") + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, options, IS_ARRAY, 1, "null") ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_MongoDB_Driver_Server_executeQuery, 0, 2, MongoDB\\Driver\\CursorInterface, 0) ZEND_ARG_TYPE_INFO(0, namespace, IS_STRING, 0) ZEND_ARG_OBJ_INFO(0, query, MongoDB\\Driver\\Query, 0) - ZEND_ARG_OBJ_TYPE_MASK(0, options, MongoDB\\Driver\\ReadPreference, MAY_BE_ARRAY|MAY_BE_NULL, "null") -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_MongoDB_Driver_Server_executeReadCommand, 0, 2, MongoDB\\Driver\\CursorInterface, 0) - ZEND_ARG_TYPE_INFO(0, db, IS_STRING, 0) - ZEND_ARG_OBJ_INFO(0, command, MongoDB\\Driver\\Command, 0) ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, options, IS_ARRAY, 1, "null") ZEND_END_ARG_INFO() -#define arginfo_class_MongoDB_Driver_Server_executeReadWriteCommand arginfo_class_MongoDB_Driver_Server_executeReadCommand +#define arginfo_class_MongoDB_Driver_Server_executeReadCommand arginfo_class_MongoDB_Driver_Server_executeCommand + +#define arginfo_class_MongoDB_Driver_Server_executeReadWriteCommand arginfo_class_MongoDB_Driver_Server_executeCommand -#define arginfo_class_MongoDB_Driver_Server_executeWriteCommand arginfo_class_MongoDB_Driver_Server_executeReadCommand +#define arginfo_class_MongoDB_Driver_Server_executeWriteCommand arginfo_class_MongoDB_Driver_Server_executeCommand ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_Driver_Server_getHost, 0, 0, IS_STRING, 0) ZEND_END_ARG_INFO() diff --git a/src/phongo_util.c b/src/phongo_util.c index 3c3c639fd..eb520afc2 100644 --- a/src/phongo_util.c +++ b/src/phongo_util.c @@ -73,39 +73,6 @@ const char* php_phongo_bson_type_to_string(bson_type_t type) } } -/* If options is not an array, insert it as a field in a newly allocated array. - * This may be used to convert legacy options (e.g. ReadPreference option for - * an executeQuery method) into an options array. - * - * A pointer to the array zval will always be returned. If allocated is set to - * true, php_phongo_prep_legacy_option_free() should be used to free the array - * zval later. */ -zval* php_phongo_prep_legacy_option(zval* options, const char* key, bool* allocated) -{ - *allocated = false; - - if (options && Z_TYPE_P(options) != IS_ARRAY) { - zval* new_options = ecalloc(1, sizeof(zval)); - - array_init_size(new_options, 1); - add_assoc_zval(new_options, key, options); - Z_ADDREF_P(options); - *allocated = true; - - php_error_docref(NULL, E_DEPRECATED, "Passing the \"%s\" option directly is deprecated and will be removed in ext-mongodb 2.0", key); - - return new_options; - } - - return options; -} - -void php_phongo_prep_legacy_option_free(zval* options) -{ - zval_ptr_dtor(options); - efree(options); -} - bool php_phongo_parse_int64(int64_t* retval, const char* data, size_t data_len) { int64_t value; diff --git a/src/phongo_util.h b/src/phongo_util.h index 1d61be4d2..d68ae66a2 100644 --- a/src/phongo_util.h +++ b/src/phongo_util.h @@ -21,9 +21,6 @@ const char* php_phongo_bson_type_to_string(bson_type_t type); -zval* php_phongo_prep_legacy_option(zval* options, const char* key, bool* allocated); -void php_phongo_prep_legacy_option_free(zval* options); - bool php_phongo_parse_int64(int64_t* retval, const char* data, size_t data_len); bool phongo_split_namespace(const char* namespace, char** dbname, char** cname); diff --git a/tests/manager/manager-executeBulkWrite-015.phpt b/tests/manager/manager-executeBulkWrite-015.phpt deleted file mode 100644 index 4f6754820..000000000 --- a/tests/manager/manager-executeBulkWrite-015.phpt +++ /dev/null @@ -1,23 +0,0 @@ ---TEST-- -MongoDB\Driver\Manager::executeBulkWrite() explicit WriteConcern argument is deprecated ---SKIPIF-- - - - ---FILE-- -insert(['_id' => 1]); -$manager->executeBulkWrite(NS, $bulk, new MongoDB\Driver\WriteConcern(0)); - -?> -===DONE=== - ---EXPECTF-- -Deprecated: MongoDB\Driver\Manager::executeBulkWrite(): Passing the "writeConcern" option directly is deprecated and will be removed in ext-mongodb 2.0%s -===DONE=== diff --git a/tests/manager/manager-executeCommand-003.phpt b/tests/manager/manager-executeCommand-003.phpt deleted file mode 100644 index 788a4896b..000000000 --- a/tests/manager/manager-executeCommand-003.phpt +++ /dev/null @@ -1,46 +0,0 @@ ---TEST-- -MongoDB\Driver\Manager::executeCommand() takes a read preference as legacy option ---SKIPIF-- - - - - ---FILE-- - 1]); -$cursor = $manager->executeCommand(DATABASE_NAME, $command, $primary); - -echo "is_primary: ", $cursor->getServer()->isPrimary() ? 'true' : 'false', "\n"; -echo "is_secondary: ", $cursor->getServer()->isSecondary() ? 'true' : 'false', "\n\n"; - -echo "Testing secondary:\n"; -$command = new MongoDB\Driver\Command(['ping' => 1]); -$cursor = $manager->executeCommand(DATABASE_NAME, $command, $secondary); - -echo "is_primary: ", $cursor->getServer()->isPrimary() ? 'true' : 'false', "\n"; -echo "is_secondary: ", $cursor->getServer()->isSecondary() ? 'true' : 'false', "\n\n"; -?> -===DONE=== - ---EXPECTF-- -Testing primary: - -Deprecated: MongoDB\Driver\Manager::executeCommand(): Passing the "readPreference" option directly is deprecated and will be removed in ext-mongodb 2.0%s -is_primary: true -is_secondary: false - -Testing secondary: - -Deprecated: MongoDB\Driver\Manager::executeCommand(): Passing the "readPreference" option directly is deprecated and will be removed in ext-mongodb 2.0%s -is_primary: false -is_secondary: true - -===DONE=== diff --git a/tests/manager/manager-executeQuery-004.phpt b/tests/manager/manager-executeQuery-004.phpt deleted file mode 100644 index 362a9fc85..000000000 --- a/tests/manager/manager-executeQuery-004.phpt +++ /dev/null @@ -1,51 +0,0 @@ ---TEST-- -MongoDB\Driver\Manager::executeQuery() takes a read preference as legacy option ---SKIPIF-- - - - - ---FILE-- -insert(['_id' => 1, 'x' => 2, 'y' => 3]); -$manager->executeBulkWrite(NS, $bulk); - -$primary = new MongoDB\Driver\ReadPreference(MongoDB\Driver\ReadPreference::PRIMARY); -$secondary = new MongoDB\Driver\ReadPreference(MongoDB\Driver\ReadPreference::SECONDARY); - -echo "Testing primary:\n"; -$query = new MongoDB\Driver\Query(['x' => 3], ['projection' => ['y' => 1]]); -$cursor = $manager->executeQuery(NS, $query, $primary); - -echo "is_primary: ", $cursor->getServer()->isPrimary() ? 'true' : 'false', "\n"; -echo "is_secondary: ", $cursor->getServer()->isSecondary() ? 'true' : 'false', "\n\n"; - -echo "Testing secondary:\n"; -$query = new MongoDB\Driver\Query(['x' => 3], ['projection' => ['y' => 1]]); -$cursor = $manager->executeQuery(NS, $query, $secondary); - -echo "is_primary: ", $cursor->getServer()->isPrimary() ? 'true' : 'false', "\n"; -echo "is_secondary: ", $cursor->getServer()->isSecondary() ? 'true' : 'false', "\n\n"; -?> -===DONE=== - ---EXPECTF-- -Testing primary: - -Deprecated: MongoDB\Driver\Manager::executeQuery(): Passing the "readPreference" option directly is deprecated and will be removed in ext-mongodb 2.0%s -is_primary: true -is_secondary: false - -Testing secondary: - -Deprecated: MongoDB\Driver\Manager::executeQuery(): Passing the "readPreference" option directly is deprecated and will be removed in ext-mongodb 2.0%s -is_primary: false -is_secondary: true - -===DONE=== diff --git a/tests/server/server-executeBulkWrite-010.phpt b/tests/server/server-executeBulkWrite-010.phpt deleted file mode 100644 index 16af463c4..000000000 --- a/tests/server/server-executeBulkWrite-010.phpt +++ /dev/null @@ -1,24 +0,0 @@ ---TEST-- -MongoDB\Driver\Server::executeBulkWrite() explicit WriteConcern argument is deprecated ---SKIPIF-- - - - ---FILE-- -selectServer(); - -$bulk = new MongoDB\Driver\BulkWrite(); -$bulk->insert(['_id' => 1]); -$server->executeBulkWrite(NS, $bulk, new MongoDB\Driver\WriteConcern(0)); - -?> -===DONE=== - ---EXPECTF-- -Deprecated: MongoDB\Driver\Server::executeBulkWrite(): Passing the "writeConcern" option directly is deprecated and will be removed in ext-mongodb 2.0%s -===DONE=== diff --git a/tests/server/server-executeCommand-005.phpt b/tests/server/server-executeCommand-005.phpt deleted file mode 100644 index 6f24e31da..000000000 --- a/tests/server/server-executeCommand-005.phpt +++ /dev/null @@ -1,49 +0,0 @@ ---TEST-- -MongoDB\Driver\Server::executeCommand() takes a read preference as legacy option ---SKIPIF-- - - - - ---FILE-- -selectServer($primaryRp); -$secondary = $manager->selectServer($secondaryRp); - -echo "Testing primary:\n"; -$command = new MongoDB\Driver\Command(['ping' => 1]); -$cursor = $primary->executeCommand(DATABASE_NAME, $command, $primaryRp); - -echo "is_primary: ", $cursor->getServer()->isPrimary() ? 'true' : 'false', "\n"; -echo "is_secondary: ", $cursor->getServer()->isSecondary() ? 'true' : 'false', "\n\n"; - -echo "Testing secondary:\n"; -$command = new MongoDB\Driver\Command(['ping' => 1]); -$cursor = $secondary->executeCommand(DATABASE_NAME, $command, $secondaryRp); - -echo "is_primary: ", $cursor->getServer()->isPrimary() ? 'true' : 'false', "\n"; -echo "is_secondary: ", $cursor->getServer()->isSecondary() ? 'true' : 'false', "\n\n"; -?> -===DONE=== - ---EXPECTF-- -Testing primary: - -Deprecated: MongoDB\Driver\Server::executeCommand(): Passing the "readPreference" option directly is deprecated and will be removed in ext-mongodb 2.0%s -is_primary: true -is_secondary: false - -Testing secondary: - -Deprecated: MongoDB\Driver\Server::executeCommand(): Passing the "readPreference" option directly is deprecated and will be removed in ext-mongodb 2.0%s -is_primary: false -is_secondary: true - -===DONE=== diff --git a/tests/server/server-executeQuery-010.phpt b/tests/server/server-executeQuery-010.phpt deleted file mode 100644 index 7eb3d74f4..000000000 --- a/tests/server/server-executeQuery-010.phpt +++ /dev/null @@ -1,54 +0,0 @@ ---TEST-- -MongoDB\Driver\Server::executeQuery() takes a read preference as legacy option ---SKIPIF-- - - - - ---FILE-- -insert(['_id' => 1, 'x' => 2, 'y' => 3]); -$manager->executeBulkWrite(NS, $bulk); - -$primaryRp = new MongoDB\Driver\ReadPreference(MongoDB\Driver\ReadPreference::PRIMARY); -$secondaryRp = new MongoDB\Driver\ReadPreference(MongoDB\Driver\ReadPreference::SECONDARY); - -$primary = $manager->selectServer($primaryRp); -$secondary = $manager->selectServer($secondaryRp); - -echo "Testing primary:\n"; -$query = new MongoDB\Driver\Query(['x' => 3], ['projection' => ['y' => 1]]); -$cursor = $primary->executeQuery(NS, $query, $primaryRp); - -echo "is_primary: ", $cursor->getServer()->isPrimary() ? 'true' : 'false', "\n"; -echo "is_secondary: ", $cursor->getServer()->isSecondary() ? 'true' : 'false', "\n\n"; - -echo "Testing secondary:\n"; -$query = new MongoDB\Driver\Query(['x' => 3], ['projection' => ['y' => 1]]); -$cursor = $secondary->executeQuery(NS, $query, $secondaryRp); - -echo "is_primary: ", $cursor->getServer()->isPrimary() ? 'true' : 'false', "\n"; -echo "is_secondary: ", $cursor->getServer()->isSecondary() ? 'true' : 'false', "\n\n"; -?> -===DONE=== - ---EXPECTF-- -Testing primary: - -Deprecated: MongoDB\Driver\Server::executeQuery(): Passing the "readPreference" option directly is deprecated and will be removed in ext-mongodb 2.0%s -is_primary: true -is_secondary: false - -Testing secondary: - -Deprecated: MongoDB\Driver\Server::executeQuery(): Passing the "readPreference" option directly is deprecated and will be removed in ext-mongodb 2.0%s -is_primary: false -is_secondary: true - -===DONE===