From 97d9ea82698ee6e7a9bf0ab6f7cd4f3793821975 Mon Sep 17 00:00:00 2001 From: Helmut Januschka Date: Mon, 5 Mar 2018 12:54:46 +0100 Subject: [PATCH] fix the handling of timestamp in the MongoDBSessionHandler --- .../Session/Storage/Handler/MongoDbSessionHandler.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/MongoDbSessionHandler.php b/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/MongoDbSessionHandler.php index edc0149f99..9cc7055e98 100644 --- a/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/MongoDbSessionHandler.php +++ b/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/MongoDbSessionHandler.php @@ -141,7 +141,7 @@ class MongoDbSessionHandler extends AbstractSessionHandler */ public function updateTimestamp($sessionId, $data) { - $expiry = $this->createDateTime(time() + (int) ini_get('session.gc_maxlifetime')); + $expiry = new \MongoDB\BSON\UTCDateTime((time() + (int) ini_get('session.gc_maxlifetime')) * 1000); if ($this->mongo instanceof \MongoDB\Client) { $methodName = 'updateOne'; @@ -154,7 +154,7 @@ class MongoDbSessionHandler extends AbstractSessionHandler $this->getCollection()->$methodName( array($this->options['id_field'] => $sessionId), array('$set' => array( - $this->options['time_field'] => $this->createDateTime(), + $this->options['time_field'] => new \MongoDB\BSON\UTCDateTime(), $this->options['expiry_field'] => $expiry, )), $options