Index: modules/filter/filter.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/filter/filter.module,v
retrieving revision 1.262
diff -u -p -r1.262 filter.module
--- modules/filter/filter.module	5 Jul 2009 18:00:08 -0000	1.262
+++ modules/filter/filter.module	9 Jul 2009 20:47:24 -0000
@@ -290,14 +290,12 @@ function filter_filter_tips($delta, $for
  */
 function filter_formats($index = NULL) {
   global $user;
-  static $formats;
+  $formats = &drupal_static(__FUNCTION__, array());
 
   // Administrators can always use all text formats.
   $all = user_access('administer filters');
 
-  if (!isset($formats)) {
-    $formats = array();
-
+  if (empty($formats)) {
     $query = db_select('filter_format', 'f');
     $query->addField('f', 'format', 'format');
     $query->addField('f', 'name', 'name');
@@ -361,7 +359,7 @@ function filter_resolve_format($format) 
  * Check if text in a certain text format is allowed to be cached.
  */
 function filter_format_allowcache($format) {
-  static $cache = array();
+  $cache = &drupal_static(__FUNCTION__, array());
   $format = filter_resolve_format($format);
   if (!isset($cache[$format])) {
     $cache[$format] = db_query('SELECT cache FROM {filter_format} WHERE format = :format', array(':format' => $format))->fetchField();
@@ -373,7 +371,7 @@ function filter_format_allowcache($forma
  * Retrieve a list of filters for a certain format.
  */
 function filter_list_format($format) {
-  static $filters = array();
+  $filters = &drupal_static(__FUNCTION__, array());
 
   if (!isset($filters[$format])) {
     $filters[$format] = array();
@@ -757,15 +755,10 @@ function _filter_url($text, $format) {
  * Scan input and make sure that all HTML tags are properly closed and nested.
  */
 function _filter_htmlcorrector($text) {
-  // Prepare tag lists.
-  static $no_nesting, $single_use;
-  if (!isset($no_nesting)) {
-    // Tags which cannot be nested but are typically left unclosed.
-    $no_nesting = drupal_map_assoc(array('li', 'p'));
-
-    // Single use tags in HTML4
-    $single_use = drupal_map_assoc(array('base', 'meta', 'link', 'hr', 'br', 'param', 'img', 'area', 'input', 'col', 'frame'));
-  }
+  // Tags which cannot be nested but are typically left unclosed.
+  $no_nesting = &drupal_static(__FUNCTION__, drupal_map_assoc(array('li', 'p')));
+  // Single use tags in HTML4
+  $single_use = &drupal_static(__FUNCTION__ . ':single_use', drupal_map_assoc(array('base', 'meta', 'link', 'hr', 'br', 'param', 'img', 'area', 'input', 'col', 'frame')));
 
   // Properly entify angles.
   $text = preg_replace('!<([^a-zA-Z/])!', '&lt;\1', $text);
@@ -851,7 +844,7 @@ function _filter_url_parse_partial_links
  * Shortens long URLs to http://www.example.com/long/url...
  */
 function _filter_url_trim($text, $length = NULL) {
-  static $_length;
+  $_length = &drupal_static(__FUNCTION__);
   if ($length !== NULL) {
     $_length = $length;
   }
