diff vendor/symfony/http-foundation/Session/Session.php @ 17:129ea1e6d783

Update, including to Drupal core 8.6.10
author Chris Cannam
date Thu, 28 Feb 2019 13:21:36 +0000
parents c2387f117808
children
line wrap: on
line diff
--- a/vendor/symfony/http-foundation/Session/Session.php	Tue Jul 10 15:07:59 2018 +0100
+++ b/vendor/symfony/http-foundation/Session/Session.php	Thu Feb 28 13:21:36 2019 +0000
@@ -11,12 +11,12 @@
 
 namespace Symfony\Component\HttpFoundation\Session;
 
-use Symfony\Component\HttpFoundation\Session\Storage\SessionStorageInterface;
 use Symfony\Component\HttpFoundation\Session\Attribute\AttributeBag;
 use Symfony\Component\HttpFoundation\Session\Attribute\AttributeBagInterface;
 use Symfony\Component\HttpFoundation\Session\Flash\FlashBag;
 use Symfony\Component\HttpFoundation\Session\Flash\FlashBagInterface;
 use Symfony\Component\HttpFoundation\Session\Storage\NativeSessionStorage;
+use Symfony\Component\HttpFoundation\Session\Storage\SessionStorageInterface;
 
 /**
  * @author Fabien Potencier <fabien@symfony.com>
@@ -28,7 +28,7 @@
 
     private $flashName;
     private $attributeName;
-    private $data = array();
+    private $data = [];
     private $usageIndex = 0;
 
     /**
@@ -54,8 +54,6 @@
      */
     public function start()
     {
-        ++$this->usageIndex;
-
         return $this->storage->start();
     }
 
@@ -140,7 +138,7 @@
      */
     public function count()
     {
-        return count($this->getAttributeBag()->all());
+        return \count($this->getAttributeBag()->all());
     }
 
     /**
@@ -160,7 +158,9 @@
      */
     public function isEmpty()
     {
-        ++$this->usageIndex;
+        if ($this->isStarted()) {
+            ++$this->usageIndex;
+        }
         foreach ($this->data as &$data) {
             if (!empty($data)) {
                 return false;
@@ -185,8 +185,6 @@
      */
     public function migrate($destroy = false, $lifetime = null)
     {
-        ++$this->usageIndex;
-
         return $this->storage->regenerate($destroy, $lifetime);
     }
 
@@ -195,8 +193,6 @@
      */
     public function save()
     {
-        ++$this->usageIndex;
-
         $this->storage->save();
     }
 
@@ -213,7 +209,9 @@
      */
     public function setId($id)
     {
-        $this->storage->setId($id);
+        if ($this->storage->getId() !== $id) {
+            $this->storage->setId($id);
+        }
     }
 
     /**