From 9546d22c67fda4cbc4a9141dca11944e885ce8a7 Mon Sep 17 00:00:00 2001
From: Thomas Bruederli <thomas@roundcube.net>
Date: Mon, 15 Oct 2012 08:35:56 -0400
Subject: [PATCH] Avoid unnecessary strtoupper() calls but validate target charset if specified

---
 program/include/rcube_cache.php |   13 ++++++++-----
 1 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/program/include/rcube_cache.php b/program/include/rcube_cache.php
index 17a8859..4e60dea 100644
--- a/program/include/rcube_cache.php
+++ b/program/include/rcube_cache.php
@@ -254,7 +254,7 @@
             }
             else if ($this->type == 'apc') {
                 $data = apc_fetch($this->ckey($key));
-	        }
+            }
 
             if ($data) {
                 $md5sum = md5($data);
@@ -294,7 +294,7 @@
                 }
 
                 $this->cache[$key]      = $data;
-	            $this->cache_sums[$key] = $md5sum;
+                $this->cache_sums[$key] = $md5sum;
             }
             else {
                 $this->cache[$key] = null;
@@ -463,10 +463,13 @@
      */
     private function delete_record($key, $index=true)
     {
-        if ($this->type == 'memcache')
-            $this->db->delete($this->ckey($key));
-        else
+        if ($this->type == 'memcache') {
+            // #1488592: use 2nd argument
+            $this->db->delete($this->ckey($key), 0);
+        }
+        else {
             apc_delete($this->ckey($key));
+        }
 
         if ($index) {
             if (($idx = array_search($key, $this->index)) !== false) {

--
Gitblit v1.9.1