[HttpFoundation] fix session tracking counter

This commit is contained in:
Nicolas Grekas 2018-06-27 13:18:14 +02:00
parent c36f8cb21b
commit 26fc4e683f
2 changed files with 3 additions and 9 deletions

View File

@ -160,7 +160,9 @@ class Session implements SessionInterface, \IteratorAggregate, \Countable
*/ */
public function isEmpty() public function isEmpty()
{ {
++$this->usageIndex; if ($this->isStarted()) {
++$this->usageIndex;
}
foreach ($this->data as &$data) { foreach ($this->data as &$data) {
if (!empty($data)) { if (!empty($data)) {
return false; return false;
@ -185,8 +187,6 @@ class Session implements SessionInterface, \IteratorAggregate, \Countable
*/ */
public function migrate($destroy = false, $lifetime = null) public function migrate($destroy = false, $lifetime = null)
{ {
++$this->usageIndex;
return $this->storage->regenerate($destroy, $lifetime); return $this->storage->regenerate($destroy, $lifetime);
} }
@ -195,8 +195,6 @@ class Session implements SessionInterface, \IteratorAggregate, \Countable
*/ */
public function save() public function save()
{ {
++$this->usageIndex;
$this->storage->save(); $this->storage->save();
} }

View File

@ -44,8 +44,6 @@ final class SessionBagProxy implements SessionBagInterface
*/ */
public function isEmpty() public function isEmpty()
{ {
++$this->usageIndex;
return empty($this->data[$this->bag->getStorageKey()]); return empty($this->data[$this->bag->getStorageKey()]);
} }
@ -81,8 +79,6 @@ final class SessionBagProxy implements SessionBagInterface
*/ */
public function clear() public function clear()
{ {
++$this->usageIndex;
return $this->bag->clear(); return $this->bag->clear();
} }
} }