Skip to content

PHPC-2440: Remove deprecated Query constructor options #1707

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Oct 2, 2024

Conversation

jmikola
Copy link
Member

@jmikola jmikola commented Oct 1, 2024

https://jira.mongodb.org/browse/PHPC-2440

Removes "partial", "maxScan", "modifiers", "oplogReplay", and "snapshot" options.

Removes negative "limit" implying true for "singleBatch".

Removes "partial", "maxScan", "modifiers", "oplogReplay", and "snapshot" options.

Removes negative "limit" implying true for "singleBatch".
@jmikola jmikola requested a review from alcaeus October 1, 2024 01:29
@@ -1,37 +0,0 @@
--TEST--
MongoDB\Driver\Query: Invalid types
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

query-ctor_error-002.phpt makes this test redundant, as it covers these types and more.

@@ -1,5 +1,5 @@
--TEST--
MongoDB\Driver\Server::executeQuery() with negative limit returns a single batch
MongoDB\Driver\Server::executeQuery() with limit and single batch
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Decided to repurpose this test instead of delete it, as we didn't have any other PHPC tests for singleBatch: true.

@@ -3,19 +3,13 @@ MongoDB\Driver\Query construction with negative limit
--FILE--
<?php

/* The server expects a non-negative limit, but neither PHPC nor libmongoc
* performs any validation. The option is passed as-is. */
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As mentioned in this comment in PHPC-2440, the server will raise an error. I decided to leave this test in place just to demonstrate that we no longer have validation.

I wasn't interested in adding a functional test for the server behavior.

@@ -80,13 +72,13 @@ object(MongoDB\Driver\Query)#%d (%d) {
string(3) "foo"
["exhaust"]=>
bool(false)
["limit"]=>
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed php_phongo_query_init_limit_and_singlebatch(), so these options are now parsed alphabetically alongside other options. Since those parsing macros are responsible for appending them to the cursor's BSON options, it impacted the debug output order (where we dump the options document as-is).

* and default singleBatch to true. */
static bool php_phongo_query_init_limit_and_singlebatch(php_phongo_query_t* intern, zval* options)
{
if (php_array_fetchc_long(options, "limit") < 0) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Noted that we'll add a deprecation for this in PHPC-2464.

* `MongoDB\Driver\Query` removes the following options: `partial` (use
`allowPartialResults` instead), `maxScan`, `modifiers` (use alternative
top-level options instead), `oplogReplay`, and `snapshot`. Support for
negative `limit` values has been removed (use `singleBatch` instead).
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@alcaeus: I realized I forgot to add upgrade notes before merging. Doing so now and will merge this down once CI comes back green.

@jmikola jmikola merged commit db06619 into mongodb:v2.x Oct 2, 2024
59 checks passed
@jmikola jmikola deleted the 2.0-phpc-2440 branch October 2, 2024 13:31
alcaeus added a commit that referenced this pull request Oct 29, 2024
* v2.x: (22 commits)
  PHPC-2441: Remove deprecated Manager constructor options (#1719)
  PHPC-990: Strict type validation for boolean URI options (#1713)
  PHPC-2440: Remove deprecated Query constructor options (#1707)
  PHPC-2459: Remove support for float arg in UTCDateTime ctor (#1709)
  Remove obsolete test
  PHPC-2344 Remove SSLConnectionException (#1696)
  PHPC-2144 Throw a LogicException when getting info from unacknowledged write result (#1687)
  PHPC-2454: Remove --enable-system-ciphers configure option (#1681)
  PHPC-2348 Remove `WriteException` and move `getWriteResult` to `BulkWriteException` (#1685)
  PHPC-2417 Add UTCDateTimeInterface::toDateTimeImmutable() (#1684)
  PHPC-2309: Remove --with-openssl-dir configure option (#1676)
  PHPC-2444: Remove support for string arguments in UTCDateTime constructor (#1662)
  PHPC-2248: Remove Serializable implementations (#1663)
  Update version for 2.x branch (#1672)
  PHPC-1021: Remove support for ReadPreference integer modes (#1666)
  PHPC-2342: Remove --with-libbson and --with-libmongoc configure options (#1667)
  PHPC-2351: Remove CursorId class (#1664)
  PHPC-2140: Make tentative return types definitive (#1658)
  PHPC-2402: Remove range_preview constants (#1665)
  PHPC-2346: Remove deprecated BSON functions (#1653)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants