Index: filter.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/filter/filter.module,v
retrieving revision 1.160.2.6
diff -u -F^f -r1.160.2.6 filter.module
--- filter.module	22 Jan 2008 08:43:34 -0000	1.160.2.6
+++ filter.module	20 Mar 2008 17:52:12 -0000
@@ -760,8 +760,15 @@ function check_markup($text, $format = F
 
     // Check for a cached version of this piece of text.
     $id = $format .':'. md5($text);
-    if ($cached = cache_get($id, 'cache_filter')) {
-      return $cached->data;
+    static $cache = array();
+    
+    // Prevent duplicate cache looks up for same filter id.
+    if (!isset($cache[$id])) {
+      $cached = cache_get($id, 'cache_filter');
+      $cache[$id] = $cached;
+    }
+    if ($cache[$id]) {
+      return $cache[$id]->data;
     }
 
     // See if caching is allowed for this format.
