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 f5858a2

Browse filesBrowse files
committed
Bug Fix : [Component][HttpFoundation][Session][Storage][Handler][MongoDbSessionHandler] ref:http://mongodb.github.io/mongo-php-library/api/class-MongoDB.Collection.html
1 parent ea9d6e7 commit f5858a2
Copy full SHA for f5858a2

File tree

1 file changed

+4
-4
lines changed
Filter options

1 file changed

+4
-4
lines changed

‎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
+4-4Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ class MongoDbSessionHandler implements \SessionHandlerInterface
6969
*/
7070
public function __construct($mongo, array $options)
7171
{
72-
if (!($mongo instanceof \MongoClient || $mongo instanceof \Mongo)) {
72+
if (!($mongo instanceof \MongoClient || $mongo instanceof \Mongo || $mongo instanceof \MongoDB\Client)) {
7373
throw new \InvalidArgumentException('MongoClient or Mongo instance required');
7474
}
7575

@@ -108,7 +108,7 @@ public function close()
108108
*/
109109
public function destroy($sessionId)
110110
{
111-
$this->getCollection()->remove(array(
111+
$this->getCollection()->deleteOne(array(
112112
$this->options['id_field'] => $sessionId,
113113
));
114114

@@ -120,7 +120,7 @@ public function destroy($sessionId)
120120
*/
121121
public function gc($maxlifetime)
122122
{
123-
$this->getCollection()->remove(array(
123+
$this->getCollection()->deleteMany(array(
124124
$this->options['expiry_field'] => array('$lt' => new \MongoDate()),
125125
));
126126

@@ -140,7 +140,7 @@ public function write($sessionId, $data)
140140
$this->options['expiry_field'] => $expiry,
141141
);
142142

143-
$this->getCollection()->update(
143+
$this->getCollection()->updateOne(
144144
array($this->options['id_field'] => $sessionId),
145145
array('$set' => $fields),
146146
array('upsert' => true, 'multiple' => false)

0 commit comments

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