diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index 3242db31a..a270c58b6 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -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" diff --git a/lib/Doctrine/ODM/MongoDB/SchemaManager.php b/lib/Doctrine/ODM/MongoDB/SchemaManager.php index 54c26a0e0..e17ee4a57 100644 --- a/lib/Doctrine/ODM/MongoDB/SchemaManager.php +++ b/lib/Doctrine/ODM/MongoDB/SchemaManager.php @@ -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;