From 3f013a473ad8c2f1fe100b7fcec4a097e5867225 Mon Sep 17 00:00:00 2001 From: raplider Date: Thu, 26 Jul 2018 16:17:24 +0300 Subject: [PATCH] remove unnecessary instanceof in MongoDbSessionHandler --- .../Storage/Handler/MongoDbSessionHandler.php | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/MongoDbSessionHandler.php b/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/MongoDbSessionHandler.php index 9cc7055e98..853b0bc723 100644 --- a/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/MongoDbSessionHandler.php +++ b/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/MongoDbSessionHandler.php @@ -24,7 +24,7 @@ class MongoDbSessionHandler extends AbstractSessionHandler private $mongo; /** - * @var \MongoCollection + * @var \MongoDB\Collection */ private $collection; @@ -143,21 +143,12 @@ class MongoDbSessionHandler extends AbstractSessionHandler { $expiry = new \MongoDB\BSON\UTCDateTime((time() + (int) ini_get('session.gc_maxlifetime')) * 1000); - if ($this->mongo instanceof \MongoDB\Client) { - $methodName = 'updateOne'; - $options = array(); - } else { - $methodName = 'update'; - $options = array('multiple' => false); - } - - $this->getCollection()->$methodName( + $this->getCollection()->updateOne( array($this->options['id_field'] => $sessionId), array('$set' => array( $this->options['time_field'] => new \MongoDB\BSON\UTCDateTime(), $this->options['expiry_field'] => $expiry, - )), - $options + )) ); return true; @@ -181,7 +172,7 @@ class MongoDbSessionHandler extends AbstractSessionHandler } /** - * @return \MongoCollection + * @return \MongoDB\Collection */ private function getCollection() {