There's a case (reason unknown) when destroy() is called with empty session key.

Handle this case properly to prevent from PHP error: Memcache::delete(): Key cannot be empty.
pull/13/head
Aleksander Machniak 13 years ago
parent 5a927c7829
commit ef5f7fb13c

@ -218,13 +218,14 @@ class rcube_session
* Handler for session_destroy() * Handler for session_destroy()
* *
* @param string Session ID * @param string Session ID
*
* @return boolean True on success * @return boolean True on success
*/ */
public function db_destroy($key) public function db_destroy($key)
{ {
$this->db->query( if ($key) {
sprintf("DELETE FROM %s WHERE sess_id = ?", $this->db->table_name('session')), $this->db->query(sprintf("DELETE FROM %s WHERE sess_id = ?", $this->db->table_name('session')), $key);
$key); }
return true; return true;
} }
@ -305,11 +306,16 @@ class rcube_session
* Handler for session_destroy() with memcache backend * Handler for session_destroy() with memcache backend
* *
* @param string Session ID * @param string Session ID
*
* @return boolean True on success * @return boolean True on success
*/ */
public function mc_destroy($key) public function mc_destroy($key)
{ {
return $this->memcache->delete($key); if ($key) {
$this->memcache->delete($key);
}
return true;
} }

Loading…
Cancel
Save