diff --git a/src/MongoDB/Query.c b/src/MongoDB/Query.c index b92b1938f..362ec622c 100644 --- a/src/MongoDB/Query.c +++ b/src/MongoDB/Query.c @@ -337,6 +337,8 @@ bool phongo_query_init(zval* return_value, zval* filter, zval* options) phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Expected \"modifiers\" option to be array, %s given", PHONGO_ZVAL_CLASS_OR_TYPE_NAME_P(modifiers)); return false; } + + php_error_docref(NULL, E_DEPRECATED, "The \"modifiers\" option is deprecated and will be removed in a future release"); } PHONGO_QUERY_OPT_BOOL("allowDiskUse", options, "allowDiskUse") diff --git a/tests/query/query-ctor-003.phpt b/tests/query/query-ctor-003.phpt index 947e0f18d..e68baeeed 100644 --- a/tests/query/query-ctor-003.phpt +++ b/tests/query/query-ctor-003.phpt @@ -39,6 +39,8 @@ var_dump(new MongoDB\Driver\Query( ===DONE=== --EXPECTF-- +Deprecated: MongoDB\Driver\Query::__construct(): The "modifiers" option is deprecated and will be removed in a future release in %s on line %d + Deprecated: MongoDB\Driver\Query::__construct(): The "$maxScan" option is deprecated and will be removed in a future release in %s on line %d Deprecated: MongoDB\Driver\Query::__construct(): The "$snapshot" option is deprecated and will be removed in a future release in %s on line %d @@ -81,6 +83,8 @@ object(MongoDB\Driver\Query)#%d (%d) { ["readConcern"]=> NULL } + +Deprecated: MongoDB\Driver\Query::__construct(): The "modifiers" option is deprecated and will be removed in a future release in %s on line %d object(MongoDB\Driver\Query)#%d (%d) { ["filter"]=> object(stdClass)#%d (%d) { @@ -95,6 +99,8 @@ object(MongoDB\Driver\Query)#%d (%d) { ["readConcern"]=> NULL } + +Deprecated: MongoDB\Driver\Query::__construct(): The "modifiers" option is deprecated and will be removed in a future release in %s on line %d object(MongoDB\Driver\Query)#%d (%d) { ["filter"]=> object(stdClass)#%d (%d) { @@ -109,6 +115,8 @@ object(MongoDB\Driver\Query)#%d (%d) { ["readConcern"]=> NULL } + +Deprecated: MongoDB\Driver\Query::__construct(): The "modifiers" option is deprecated and will be removed in a future release in %s on line %d object(MongoDB\Driver\Query)#%d (%d) { ["filter"]=> object(stdClass)#%d (%d) { diff --git a/tests/query/query-ctor-004.phpt b/tests/query/query-ctor-004.phpt index ea111175f..42b148d3d 100644 --- a/tests/query/query-ctor-004.phpt +++ b/tests/query/query-ctor-004.phpt @@ -49,6 +49,8 @@ var_dump(new MongoDB\Driver\Query( ===DONE=== --EXPECTF-- +Deprecated: MongoDB\Driver\Query::__construct(): The "modifiers" option is deprecated and will be removed in a future release in %s on line %d + Deprecated: MongoDB\Driver\Query::__construct(): The "maxScan" option is deprecated and will be removed in a future release in %s on line %d Deprecated: MongoDB\Driver\Query::__construct(): The "snapshot" option is deprecated and will be removed in a future release in %s on line %d @@ -91,6 +93,8 @@ object(MongoDB\Driver\Query)#%d (%d) { ["readConcern"]=> NULL } + +Deprecated: MongoDB\Driver\Query::__construct(): The "modifiers" option is deprecated and will be removed in a future release in %s on line %d object(MongoDB\Driver\Query)#%d (%d) { ["filter"]=> object(stdClass)#%d (%d) { @@ -105,6 +109,8 @@ object(MongoDB\Driver\Query)#%d (%d) { ["readConcern"]=> NULL } + +Deprecated: MongoDB\Driver\Query::__construct(): The "modifiers" option is deprecated and will be removed in a future release in %s on line %d object(MongoDB\Driver\Query)#%d (%d) { ["filter"]=> object(stdClass)#%d (%d) { diff --git a/tests/query/query-ctor_error-002.phpt b/tests/query/query-ctor_error-002.phpt index 790fc1abd..830cd20bc 100644 --- a/tests/query/query-ctor_error-002.phpt +++ b/tests/query/query-ctor_error-002.phpt @@ -28,7 +28,7 @@ foreach ($tests as $options) { ?> ===DONE=== ---EXPECT-- +--EXPECTF-- OK: Got MongoDB\Driver\Exception\InvalidArgumentException Expected "modifiers" option to be array, int given @@ -50,15 +50,23 @@ 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 given + +Deprecated: MongoDB\Driver\Query::__construct(): The "modifiers" option is deprecated and will be removed in a future release in %s on line %d OK: Got MongoDB\Driver\Exception\InvalidArgumentException Expected "$hint" modifier to be string, array, or object, int given + +Deprecated: MongoDB\Driver\Query::__construct(): The "modifiers" option is deprecated and will be removed in a future release in %s on line %d OK: Got MongoDB\Driver\Exception\InvalidArgumentException Expected "$max" modifier to be array or object, int given + +Deprecated: MongoDB\Driver\Query::__construct(): The "modifiers" option is deprecated and will be removed in a future release in %s on line %d OK: Got MongoDB\Driver\Exception\InvalidArgumentException Expected "$min" modifier to be array or object, int given + +Deprecated: MongoDB\Driver\Query::__construct(): The "modifiers" option is deprecated and will be removed in a future release in %s on line %d OK: Got MongoDB\Driver\Exception\InvalidArgumentException Expected "$orderby" modifier to be array or object, int given diff --git a/tests/query/query-ctor_error-004.phpt b/tests/query/query-ctor_error-004.phpt index 9c2936c3d..2b74f8181 100644 --- a/tests/query/query-ctor_error-004.phpt +++ b/tests/query/query-ctor_error-004.phpt @@ -31,7 +31,7 @@ foreach ($tests as $test) { ?> ===DONE=== ---EXPECT-- +--EXPECTF-- OK: Got MongoDB\Driver\Exception\InvalidArgumentException Cannot use empty keys in filter document OK: Got MongoDB\Driver\Exception\InvalidArgumentException @@ -48,12 +48,20 @@ OK: Got MongoDB\Driver\Exception\InvalidArgumentException Cannot use empty keys in "projection" option OK: Got MongoDB\Driver\Exception\InvalidArgumentException Cannot use empty keys in "sort" option + +Deprecated: MongoDB\Driver\Query::__construct(): The "modifiers" option is deprecated and will be removed in a future release in %s on line %d OK: Got MongoDB\Driver\Exception\InvalidArgumentException Cannot use empty keys in "$hint" modifier + +Deprecated: MongoDB\Driver\Query::__construct(): The "modifiers" option is deprecated and will be removed in a future release in %s on line %d OK: Got MongoDB\Driver\Exception\InvalidArgumentException Cannot use empty keys in "$max" modifier + +Deprecated: MongoDB\Driver\Query::__construct(): The "modifiers" option is deprecated and will be removed in a future release in %s on line %d OK: Got MongoDB\Driver\Exception\InvalidArgumentException Cannot use empty keys in "$min" modifier + +Deprecated: MongoDB\Driver\Query::__construct(): The "modifiers" option is deprecated and will be removed in a future release in %s on line %d OK: Got MongoDB\Driver\Exception\InvalidArgumentException Cannot use empty keys in "$orderby" modifier ===DONE=== diff --git a/tests/query/query-ctor_error-007.phpt b/tests/query/query-ctor_error-007.phpt index 4766d6364..d6111bcae 100644 --- a/tests/query/query-ctor_error-007.phpt +++ b/tests/query/query-ctor_error-007.phpt @@ -30,7 +30,7 @@ foreach ($tests as $options) { ?> ===DONE=== ---EXPECT-- +--EXPECTF-- OK: Got MongoDB\Driver\Exception\UnexpectedValueException MongoDB\BSON\PackedArray cannot be serialized as a root document OK: Got MongoDB\Driver\Exception\UnexpectedValueException @@ -45,10 +45,16 @@ OK: Got MongoDB\Driver\Exception\UnexpectedValueException MongoDB\BSON\PackedArray cannot be serialized as a root document OK: Got MongoDB\Driver\Exception\UnexpectedValueException MongoDB\BSON\PackedArray cannot be serialized as a root document + +Deprecated: MongoDB\Driver\Query::__construct(): The "modifiers" option is deprecated and will be removed in a future release in %s on line %d OK: Got MongoDB\Driver\Exception\UnexpectedValueException MongoDB\BSON\PackedArray cannot be serialized as a root document + +Deprecated: MongoDB\Driver\Query::__construct(): The "modifiers" option is deprecated and will be removed in a future release in %s on line %d OK: Got MongoDB\Driver\Exception\UnexpectedValueException MongoDB\BSON\PackedArray cannot be serialized as a root document + +Deprecated: MongoDB\Driver\Query::__construct(): The "modifiers" option is deprecated and will be removed in a future release in %s on line %d OK: Got MongoDB\Driver\Exception\UnexpectedValueException MongoDB\BSON\PackedArray cannot be serialized as a root document ===DONE=== diff --git a/tests/query/query-debug-001.phpt b/tests/query/query-debug-001.phpt index a043b540f..ff6f566b5 100644 --- a/tests/query/query-debug-001.phpt +++ b/tests/query/query-debug-001.phpt @@ -22,6 +22,7 @@ var_dump(new MongoDB\Driver\Query( ===DONE=== --EXPECTF-- +Deprecated: MongoDB\Driver\Query::__construct(): The "modifiers" option is deprecated and will be removed in a future release in %s on line %d object(MongoDB\Driver\Query)#%d (%d) { ["filter"]=> object(stdClass)#%d (%d) { diff --git a/tests/query/query-debug-003.phpt b/tests/query/query-debug-003.phpt index dee480a8a..c8ed9f16b 100644 --- a/tests/query/query-debug-003.phpt +++ b/tests/query/query-debug-003.phpt @@ -32,6 +32,8 @@ object(MongoDB\Driver\Query)#%d (%d) { ["readConcern"]=> NULL } + +Deprecated: MongoDB\Driver\Query::__construct(): The "modifiers" option is deprecated and will be removed in a future release in %s on line %d object(MongoDB\Driver\Query)#%d (%d) { ["filter"]=> object(stdClass)#%d (0) { diff --git a/tests/server/server-executeQuery-003.phpt b/tests/server/server-executeQuery-003.phpt index 942aa7cfd..5f09daab5 100644 --- a/tests/server/server-executeQuery-003.phpt +++ b/tests/server/server-executeQuery-003.phpt @@ -29,6 +29,7 @@ var_dump(iterator_to_array($cursor)); ===DONE=== --EXPECTF-- +Deprecated: MongoDB\Driver\Query::__construct(): The "modifiers" option is deprecated and will be removed in a future release in %s on line %d bool(true) bool(true) array(3) { diff --git a/tests/standalone/executiontimeoutexception-001.phpt b/tests/standalone/executiontimeoutexception-001.phpt index 8c35546dd..44d41dbd8 100644 --- a/tests/standalone/executiontimeoutexception-001.phpt +++ b/tests/standalone/executiontimeoutexception-001.phpt @@ -16,9 +16,7 @@ $server = $manager->selectServer(new \MongoDB\Driver\ReadPreference('primary')); $query = new MongoDB\Driver\Query(array("company" => "Smith, Carter and Buckridge"), array( 'projection' => array('_id' => 0, 'username' => 1), 'sort' => array('phoneNumber' => 1), - 'modifiers' => array( - '$maxTimeMS' => 1, - ), + 'maxTimeMS' => 1, )); failMaxTimeMS($server);