Changeset ef5f7fb in github


Ignore:
Timestamp:
Jul 6, 2012 4:10:30 AM (11 months ago)
Author:
Aleksander Machniak <alec@…>
Children:
7794ae1
Parents:
5a927c7
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • program/include/rcube_session.php

    r4d708e6 ref5f7fb  
    219219   * 
    220220   * @param string Session ID 
     221   * 
    221222   * @return boolean True on success 
    222223   */ 
    223224  public function db_destroy($key) 
    224225  { 
    225     $this->db->query( 
    226       sprintf("DELETE FROM %s WHERE sess_id = ?", $this->db->table_name('session')), 
    227       $key); 
     226    if ($key) { 
     227      $this->db->query(sprintf("DELETE FROM %s WHERE sess_id = ?", $this->db->table_name('session')), $key); 
     228    } 
    228229 
    229230    return true; 
     
    306307   * 
    307308   * @param string Session ID 
     309   * 
    308310   * @return boolean True on success 
    309311   */ 
    310312  public function mc_destroy($key) 
    311313  { 
    312     return $this->memcache->delete($key); 
     314    if ($key) { 
     315      $this->memcache->delete($key); 
     316    } 
     317 
     318    return true; 
    313319  } 
    314320 
Note: See TracChangeset for help on using the changeset viewer.