Skip to content

Drop metadata collection when an encrypted collection is dropped but encryptedFieldsMap is not configured #2797

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

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,14 @@ jobs:
dependencies: "highest"
symfony-version: "stable"
proxy: "lazy-ghost"
# Test with a 8.0 replica set (Queryable Encryption requirement)
- topology: "replica_set"
php-version: "8.2"
mongodb-version: "8.0"
driver-version: "stable"
dependencies: "highest"
symfony-version: "stable"
proxy: "lazy-ghost"
# Test with ProxyManager
- php-version: "8.2"
mongodb-version: "6.0"
Expand Down
11 changes: 10 additions & 1 deletion lib/Doctrine/ODM/MongoDB/SchemaManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -699,7 +699,16 @@ public function dropDocumentCollection(string $documentName, ?int $maxTimeMs = n

$options = $this->getWriteOptions($maxTimeMs, $writeConcern);

$this->dm->getDocumentCollection($documentName)->drop($options);
$collection = $this->dm->getDocumentCollection($documentName);
$driverOptions = $this->dm->getConfiguration()->getDriverOptions();
// Ensure that metadata collections are dropped if the collection is encrypted
// This should be automatically handled by the driver
// @see https://jira.mongodb.org/browse/PHPLIB-1702
if (isset($driverOptions['autoEncryption']) && ! isset($driverOptions['encryptedFieldsMap'][$collection->getNamespace()])) {
$options['encryptedFields'] = [];
}

$collection->drop($options);

if (! $class->isFile) {
return;
Expand Down
Loading