diff --git a/src/Symfony/Component/HttpFoundation/Session/Session.php b/src/Symfony/Component/HttpFoundation/Session/Session.php index f0379c1697..31da54c73e 100644 --- a/src/Symfony/Component/HttpFoundation/Session/Session.php +++ b/src/Symfony/Component/HttpFoundation/Session/Session.php @@ -160,7 +160,9 @@ class Session implements SessionInterface, \IteratorAggregate, \Countable */ public function isEmpty() { - ++$this->usageIndex; + if ($this->isStarted()) { + ++$this->usageIndex; + } foreach ($this->data as &$data) { if (!empty($data)) { return false; @@ -185,8 +187,6 @@ class Session implements SessionInterface, \IteratorAggregate, \Countable */ public function migrate($destroy = false, $lifetime = null) { - ++$this->usageIndex; - return $this->storage->regenerate($destroy, $lifetime); } @@ -195,8 +195,6 @@ class Session implements SessionInterface, \IteratorAggregate, \Countable */ public function save() { - ++$this->usageIndex; - $this->storage->save(); } diff --git a/src/Symfony/Component/HttpFoundation/Session/SessionBagProxy.php b/src/Symfony/Component/HttpFoundation/Session/SessionBagProxy.php index 88005ee092..d6b242d4ee 100644 --- a/src/Symfony/Component/HttpFoundation/Session/SessionBagProxy.php +++ b/src/Symfony/Component/HttpFoundation/Session/SessionBagProxy.php @@ -44,8 +44,6 @@ final class SessionBagProxy implements SessionBagInterface */ public function isEmpty() { - ++$this->usageIndex; - return empty($this->data[$this->bag->getStorageKey()]); } @@ -81,8 +79,6 @@ final class SessionBagProxy implements SessionBagInterface */ public function clear() { - ++$this->usageIndex; - return $this->bag->clear(); } }