Skip to content

Commit ae2eafe

Browse files
authored
Deprecate setting GridFS disableMD5 to false explicitly (#1205)
1 parent 92e0a10 commit ae2eafe

5 files changed

+11
-4
lines changed

docs/reference/method/MongoDBDatabase-selectGridFSBucket.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ Parameters
4848
- boolean
4949
- Whether to disable automatic MD5 generation when storing files.
5050

51-
Defaults to ``false``.
51+
Defaults to ``false``. Only ``true`` will be supported in 2.0.
5252

5353
.. versionadded: 1.4
5454

docs/reference/method/MongoDBGridFSBucket-openUploadStream.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ Parameters
5555
- boolean
5656
- Whether to disable automatic MD5 generation when storing files.
5757

58-
Defaults to ``false``.
58+
Defaults to ``false``. Only ``true`` will be supported in 2.0.
5959

6060
.. versionadded: 1.4
6161

docs/reference/method/MongoDBGridFSBucket-uploadFromStream.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ Parameters
5959
- boolean
6060
- Whether to disable automatic MD5 generation when storing files.
6161

62-
Defaults to ``false``.
62+
Defaults to ``false``. Only ``true`` will be supported in 2.0.
6363

6464
.. versionadded: 1.4
6565

docs/reference/method/MongoDBGridFSBucket__construct.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ Parameters
5959
- boolean
6060
- Whether to disable automatic MD5 generation when storing files.
6161

62-
Defaults to ``false``.
62+
Defaults to ``false``. Only ``true`` will be supported in 2.0.
6363

6464
.. versionadded: 1.4
6565

src/GridFS/Bucket.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,11 @@
6161
use function stream_copy_to_stream;
6262
use function stream_get_meta_data;
6363
use function stream_get_wrappers;
64+
use function trigger_error;
6465
use function urlencode;
6566

67+
use const E_USER_DEPRECATED;
68+
6669
/**
6770
* Bucket provides a public API for interacting with the GridFS files and chunks
6871
* collections.
@@ -132,6 +135,10 @@ class Bucket
132135
*/
133136
public function __construct(Manager $manager, string $databaseName, array $options = [])
134137
{
138+
if (isset($options['disableMD5']) && $options['disableMD5'] === false) {
139+
@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);
140+
}
141+
135142
$options += [
136143
'bucketName' => self::DEFAULT_BUCKET_NAME,
137144
'chunkSizeBytes' => self::DEFAULT_CHUNK_SIZE_BYTES,

0 commit comments

Comments
 (0)