Skip to content
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

PHPLIB-1325 Deprecate setting disableMD5 to false when using GridFS #1205

Merged
merged 1 commit into from
Jan 8, 2024
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion docs/reference/method/MongoDBGridFSBucket__construct.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
7 changes: 7 additions & 0 deletions src/GridFS/Bucket.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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,
Expand Down