Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit cedff47

Browse 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 cedff47

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

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

Lines 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)