Skip to content

Commit 9c84776

Browse files
committed
bug symfony#23752 Ignore memcached missing key error on session destroy (jderusse)
This PR was merged into the 2.7 branch. Discussion ---------- Ignore memcached missing key error on session destroy | Q | A | ------------- | --- | Branch? | 2.7 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | symfony#18574 | License | MIT | Doc PR | NA Since PHP 7 session_regenerate_id triggers a warning when the session is not started. This PR, changes the behaviours of session_destroy in the `MemcachedSessionHandler` by returning true when the user try to delete a non-existing session. Other handler: - LegacyPdoSessionHandler => don't check if key exists - MongoDbSessionHandler => don't check if key exists - NullSessionHandler => always true - PdoSessionHandler => don't check if key exists Commits ------- 29538b6 Ignore memcached missing key error on dession destroy
2 parents 5fad797 + 29538b6 commit 9c84776

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/Symfony/Component/HttpFoundation/Session/Storage/Handler/MemcacheSessionHandler.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,9 @@ public function write($sessionId, $data)
9595
*/
9696
public function destroy($sessionId)
9797
{
98-
return $this->memcache->delete($this->prefix.$sessionId);
98+
$this->memcache->delete($this->prefix.$sessionId);
99+
100+
return true;
99101
}
100102

101103
/**

src/Symfony/Component/HttpFoundation/Session/Storage/Handler/MemcachedSessionHandler.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,9 @@ public function write($sessionId, $data)
101101
*/
102102
public function destroy($sessionId)
103103
{
104-
return $this->memcached->delete($this->prefix.$sessionId);
104+
$result = $this->memcached->delete($this->prefix.$sessionId);
105+
106+
return $result || $this->memcached->getResultCode() == \Memcached::RES_NOTFOUND;
105107
}
106108

107109
/**

0 commit comments

Comments
 (0)