Skip to content
Snippets Groups Projects
Commit b50e38fe authored by Dimitris Bozelos's avatar Dimitris Bozelos
Browse files

Issue #3343859 Session storage methods should not rely on cache

parent 1b98cb8b
No related branches found
No related tags found
No related merge requests found
......@@ -88,10 +88,10 @@ class SessionStorage implements SessionStorageInterface {
public function exists(
string $id = SessionInterface::SESSION_ID_DEFAULT
): bool {
// Creating/deleting sessions should always happen through the interface
// provided by this storage. We therefore do not need to actually load the
// session from the storage.
return isset($this->cache[$id]);
// We don't check existing in the cache because we load sessions as
// requested. There may therefore exist sessions in the store that do not
// yet exist in the cache.
return $this->store->has($id);
}
/**
......@@ -106,10 +106,10 @@ class SessionStorage implements SessionStorageInterface {
* {@inheritdoc}
*/
public function getCount(): int {
// Creating/deleting sessions should always happen through the interface
// provided by this storage. We therefore do not need to actually load the
// sessions from the storage.
return count(array_filter($this->cache));
// We don't get the count from the cache because we load sessions as
// requested. There may therefore exist sessions in the store that do not
// yet exist in the cache.
return count($this->store->getAll());
}
/**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment