diff --git a/docs/reference/method/MongoDBDatabase-selectGridFSBucket.txt b/docs/reference/method/MongoDBDatabase-selectGridFSBucket.txt index 0d115d9b9..c2154a530 100644 --- a/docs/reference/method/MongoDBDatabase-selectGridFSBucket.txt +++ b/docs/reference/method/MongoDBDatabase-selectGridFSBucket.txt @@ -48,7 +48,7 @@ Parameters - boolean - Whether to disable automatic MD5 generation when storing files. - Defaults to ``false``. + Defaults to ``false``. Only ``true`` will be supported in 2.0. .. versionadded: 1.4 diff --git a/docs/reference/method/MongoDBGridFSBucket-openUploadStream.txt b/docs/reference/method/MongoDBGridFSBucket-openUploadStream.txt index 2870b5445..18fb3361c 100644 --- a/docs/reference/method/MongoDBGridFSBucket-openUploadStream.txt +++ b/docs/reference/method/MongoDBGridFSBucket-openUploadStream.txt @@ -55,7 +55,7 @@ Parameters - boolean - Whether to disable automatic MD5 generation when storing files. - Defaults to ``false``. + Defaults to ``false``. Only ``true`` will be supported in 2.0. .. versionadded: 1.4 diff --git a/docs/reference/method/MongoDBGridFSBucket-uploadFromStream.txt b/docs/reference/method/MongoDBGridFSBucket-uploadFromStream.txt index 89cb8d2f3..adcadaefc 100644 --- a/docs/reference/method/MongoDBGridFSBucket-uploadFromStream.txt +++ b/docs/reference/method/MongoDBGridFSBucket-uploadFromStream.txt @@ -59,7 +59,7 @@ Parameters - boolean - Whether to disable automatic MD5 generation when storing files. - Defaults to ``false``. + Defaults to ``false``. Only ``true`` will be supported in 2.0. .. versionadded: 1.4 diff --git a/docs/reference/method/MongoDBGridFSBucket__construct.txt b/docs/reference/method/MongoDBGridFSBucket__construct.txt index 25271e0cb..40472f0c0 100644 --- a/docs/reference/method/MongoDBGridFSBucket__construct.txt +++ b/docs/reference/method/MongoDBGridFSBucket__construct.txt @@ -59,7 +59,7 @@ Parameters - boolean - Whether to disable automatic MD5 generation when storing files. - Defaults to ``false``. + Defaults to ``false``. Only ``true`` will be supported in 2.0. .. versionadded: 1.4 diff --git a/src/GridFS/Bucket.php b/src/GridFS/Bucket.php index 763d8392f..7c63c3a69 100644 --- a/src/GridFS/Bucket.php +++ b/src/GridFS/Bucket.php @@ -61,8 +61,11 @@ use function stream_copy_to_stream; use function stream_get_meta_data; use function stream_get_wrappers; +use function trigger_error; use function urlencode; +use const E_USER_DEPRECATED; + /** * Bucket provides a public API for interacting with the GridFS files and chunks * collections. @@ -132,6 +135,10 @@ class Bucket */ public function __construct(Manager $manager, string $databaseName, array $options = []) { + if (isset($options['disableMD5']) && $options['disableMD5'] === false) { + @trigger_error('Setting GridFS "disableMD5" option to "false" is deprecated since mongodb/mongodb 1.18 and will not be supported in version 2.0.', E_USER_DEPRECATED); + } + $options += [ 'bucketName' => self::DEFAULT_BUCKET_NAME, 'chunkSizeBytes' => self::DEFAULT_CHUNK_SIZE_BYTES,