Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit ee9786a

Browse filesBrowse files
committed
feature #24438 [Session][VarDumper] Deprecate accepting legacy mongo extension (Tobion)
This PR was squashed before being merged into the 3.4 branch (closes #24438). Discussion ---------- [Session][VarDumper] Deprecate accepting legacy mongo extension | Q | A | ------------- | --- | Branch? | 3.4 | Bug fix? | no | New feature? | no <!-- don't forget to update src/**/CHANGELOG.md files --> | BC breaks? | no | Deprecations? | yes | Tests pass? | yes | Fixed tickets | | License | MIT | Doc PR | The old ext-mongo is deprecated and does not work with PHP 7. See http://php.net/manual/en/mongo.setup.php People should use mongodb/mongodb and ext-mongodb instead. This deprecates functionality using the old ext-mongo classes. Commits ------- d535ff6 [VarDumper] deprecate MongoCaster 6651af0 [HttpFoundation] deprecate using with the legacy mongo extension; use it with the mongodb/mongodb package and ext-mongodb instead
2 parents 575ba15 + d535ff6 commit ee9786a
Copy full SHA for ee9786a

File tree

6 files changed

+23
-2
lines changed
Filter options

6 files changed

+23
-2
lines changed

‎UPGRADE-3.4.md

Copy file name to clipboardExpand all lines: UPGRADE-3.4.md
+3Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,9 @@ HttpFoundation
240240
* `NativeSessionStorage::setSaveHandler()` now takes an instance of `\SessionHandlerInterface` as argument.
241241
Not passing it is deprecated and will throw a `TypeError` in 4.0.
242242

243+
* Using `Symfony\Component\HttpFoundation\Session\Storage\Handler\MongoDbSessionHandler` with the legacy mongo extension
244+
has been deprecated and will be removed in 4.0. Use it with the mongodb/mongodb package and ext-mongodb instead.
245+
243246
HttpKernel
244247
----------
245248

‎UPGRADE-4.0.md

Copy file name to clipboardExpand all lines: UPGRADE-4.0.md
+3Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -542,6 +542,9 @@ HttpFoundation
542542

543543
* `NativeSessionStorage::setSaveHandler()` now requires an instance of `\SessionHandlerInterface` as argument.
544544

545+
* The `Symfony\Component\HttpFoundation\Session\Storage\Handler\MongoDbSessionHandler` does not work with the legacy
546+
mongo extension anymore. It requires mongodb/mongodb package and ext-mongodb.
547+
545548
HttpKernel
546549
----------
547550

‎src/Symfony/Component/HttpFoundation/CHANGELOG.md

Copy file name to clipboardExpand all lines: src/Symfony/Component/HttpFoundation/CHANGELOG.md
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ CHANGELOG
77
* deprecated the `NativeSessionHandler` class,
88
* deprecated the `AbstractProxy`, `NativeProxy` and `SessionHandlerProxy` classes,
99
* deprecated setting session save handlers that do not implement `\SessionHandlerInterface` in `NativeSessionStorage::setSaveHandler()`
10+
* deprecated using `MongoDbSessionHandler` with the legacy mongo extension; use it with the mongodb/mongodb package and ext-mongodb instead
1011

1112
3.3.0
1213
-----

‎src/Symfony/Component/HttpFoundation/Session/Storage/Handler/MongoDbSessionHandler.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/HttpFoundation/Session/Storage/Handler/MongoDbSessionHandler.php
+11-2Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,12 @@
1212
namespace Symfony\Component\HttpFoundation\Session\Storage\Handler;
1313

1414
/**
15+
* Session handler using the mongodb/mongodb package and MongoDB driver extension.
16+
*
1517
* @author Markus Bachmann <markus.bachmann@bachi.biz>
18+
*
19+
* @see https://packagist.org/packages/mongodb/mongodb
20+
* @see http://php.net/manual/en/set.mongodb.php
1621
*/
1722
class MongoDbSessionHandler implements \SessionHandlerInterface
1823
{
@@ -57,14 +62,18 @@ class MongoDbSessionHandler implements \SessionHandlerInterface
5762
* If you use such an index, you can drop `gc_probability` to 0 since
5863
* no garbage-collection is required.
5964
*
60-
* @param \Mongo|\MongoClient|\MongoDB\Client $mongo A MongoDB\Client, MongoClient or Mongo instance
61-
* @param array $options An associative array of field options
65+
* @param \MongoDB\Client $mongo A MongoDB\Client instance
66+
* @param array $options An associative array of field options
6267
*
6368
* @throws \InvalidArgumentException When MongoClient or Mongo instance not provided
6469
* @throws \InvalidArgumentException When "database" or "collection" not provided
6570
*/
6671
public function __construct($mongo, array $options)
6772
{
73+
if ($mongo instanceof \MongoClient || $mongo instanceof \Mongo) {
74+
@trigger_error(sprintf('Using %s with the legacy mongo extension is deprecated as of 3.4 and will be removed in 4.0. Use it with the mongodb/mongodb package and ext-mongodb instead.', __CLASS__), E_USER_DEPRECATED);
75+
}
76+
6877
if (!($mongo instanceof \MongoDB\Client || $mongo instanceof \MongoClient || $mongo instanceof \Mongo)) {
6978
throw new \InvalidArgumentException('MongoClient or Mongo instance required');
7079
}

‎src/Symfony/Component/VarDumper/CHANGELOG.md

Copy file name to clipboardExpand all lines: src/Symfony/Component/VarDumper/CHANGELOG.md
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ CHANGELOG
55
-----
66

77
* added `AbstractCloner::setMinDepth()` function to ensure minimum tree depth
8+
* deprecated `MongoCaster`
89

910
2.7.0
1011
-----

‎src/Symfony/Component/VarDumper/Caster/MongoCaster.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/VarDumper/Caster/MongoCaster.php
+4Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,14 @@
1313

1414
use Symfony\Component\VarDumper\Cloner\Stub;
1515

16+
@trigger_error('The '.__NAMESPACE__.'\MongoCaster class is deprecated since version 3.4 and will be removed in 4.0.', E_USER_DEPRECATED);
17+
1618
/**
1719
* Casts classes from the MongoDb extension to array representation.
1820
*
1921
* @author Nicolas Grekas <p@tchwork.com>
22+
*
23+
* @deprecated since version 3.4, to be removed in 4.0.
2024
*/
2125
class MongoCaster
2226
{

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.