Index: ctools.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/ctools/ctools.module,v
retrieving revision 1.27
diff -u -p -r1.27 ctools.module
--- ctools.module	21 Aug 2009 16:47:46 -0000	1.27
+++ ctools.module	22 Sep 2009 19:55:19 -0000
@@ -116,6 +116,56 @@ function ctools_init() {
 }
 
 /**
+ * Central static variable storage. Modeled after Drupal 7's drupal_static().
+ * 
+ * @param $name
+ *   Globally unique name for the variable. For a function with only one static,
+ *   variable, the function name (e.g. via the PHP magic __FUNCTION__ constant) 
+ *   is recommended. For a function with multiple static variables add a 
+ *   distinguishing suffix to the function name for each one.
+ * @param $default_value 
+ *   Optional default value.
+ * @return $reset 
+ *   TRUE to reset a specific named variable, or all variables if $name is NULL. 
+ *   Resetting every variable should only be used, for example, for running unit 
+ *   tests with a clean environment. Should be used only though via function 
+ *   ctools_static_reset().
+ */
+function &ctools_static($name, $default_value = NULL, $reset = FALSE) {
+  static $data = array();
+
+  // Reset a single value, or all values.
+  if ($reset) {
+    if (isset($name)) {
+      unset($data[$name]);
+    }
+    else {
+      $data = array();
+    }
+    // We must return a reference to a variable.
+    $dummy = NULL;
+    return $dummy;
+  }
+
+  if (!isset($data[$name])) {
+    $data[$name] = $default_value;
+  }
+
+  return $data[$name];
+}
+
+/**
+ * Reset one or all centrally stored static variable(s).
+ * Modeled after Drupal 7's drupal_static_reset().
+ * 
+ * @param $name 
+ *   Name of the static variable to reset. Omit to reset all variables.
+ */
+function ctools_static_reset($name) {
+  ctools_static($name, NULL, TRUE);
+}
+
+/**
  * Provide a hook passthrough to included files.
  *
  * To organize things neatly, each CTools tool gets its own toolname.$type.inc
Index: includes/export.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/ctools/includes/export.inc,v
retrieving revision 1.19
diff -u -p -r1.19 export.inc
--- includes/export.inc	17 Aug 2009 18:41:04 -0000	1.19
+++ includes/export.inc	22 Sep 2009 19:55:19 -0000
@@ -80,8 +80,8 @@ define('EXPORT_IN_CODE', 0x02);
  *   An array of arguments whose actual use is defined by the $type argument.
  */
 function ctools_export_load_object($table, $type = 'all', $args = array()) {
-  static $cache = array();
-  static $cached_database = array();
+  $cache = &ctools_static(__FUNCTION__);
+  $cached_database = &ctools_static('ctools_export_load_object_all');
 
   $schema = ctools_export_get_schema($table);
   $export = $schema['export'];
