Index: includes/common.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/common.inc,v
retrieving revision 1.874
diff -u -p -r1.874 common.inc
--- includes/common.inc	30 Mar 2009 05:13:45 -0000	1.874
+++ includes/common.inc	3 Apr 2009 16:39:13 -0000
@@ -49,7 +49,7 @@ define('JS_THEME', 100);
  *   Content to be set.
  */
 function drupal_set_content($region = NULL, $data = NULL) {
-  static $content = array();
+  $content = &drupal_static(__FUNCTION__, array());
 
   if (!is_null($region) && !is_null($data)) {
     $content[$region][] = $data;
@@ -91,7 +91,7 @@ function drupal_get_content($region = NU
  *   the current page.
  */
 function drupal_set_breadcrumb($breadcrumb = NULL) {
-  static $stored_breadcrumb;
+  $stored_breadcrumb = &drupal_static(__FUNCTION__);
 
   if (!is_null($breadcrumb)) {
     $stored_breadcrumb = $breadcrumb;
@@ -131,7 +131,7 @@ function drupal_get_rdf_namespaces() {
  * This function can be called as long the headers aren't sent.
  */
 function drupal_set_html_head($data = NULL) {
-  static $stored_head = '';
+  $stored_head = &drupal_static(__FUNCTION__, '');
 
   if (!is_null($data)) {
     $stored_head .= $data . "\n";
@@ -164,7 +164,7 @@ function drupal_set_header($header = NUL
   // We use an array to guarantee there are no leading or trailing delimiters.
   // Otherwise, header('') could get called when serving the page later, which
   // ends HTTP headers prematurely on some PHP versions.
-  static $stored_headers = array();
+  $stored_headers = &drupal_static(__FUNCTION__, array());
 
   if (strlen($header)) {
     header($header);
@@ -191,7 +191,7 @@ function drupal_get_headers() {
  *   The title of the feed.
  */
 function drupal_add_feed($url = NULL, $title = '') {
-  static $stored_feed_links = array();
+  $stored_feed_links = &drupal_static(__FUNCTION__, array());
 
   if (!is_null($url) && !isset($stored_feed_links[$url])) {
     $stored_feed_links[$url] = theme('feed_icon', $url, $title);
@@ -788,7 +788,7 @@ function _drupal_log_error($error, $fata
   // When running inside the testing framework, we relay the errors
   // to the tested site by the way of HTTP headers.
   if (preg_match("/^simpletest\d+/", $_SERVER['HTTP_USER_AGENT']) && !headers_sent() && (!defined('SIMPLETEST_COLLECT_ERRORS') || SIMPLETEST_COLLECT_ERRORS)) {
-    static $number = 0;
+    $number = &drupal_static(__FUNCTION__, 0);
     $assertion = array(
       $error['%message'],
       $error['%type'],
@@ -898,7 +898,7 @@ function _fix_gpc_magic_files(&$item, $k
  * Fix double-escaping problems caused by "magic quotes" in some PHP installations.
  */
 function fix_gpc_magic() {
-  static $fixed = FALSE;
+  $fixed = &drupal_static(__FUNCTION__, FALSE);
   if (!$fixed && ini_get('magic_quotes_gpc')) {
     array_walk($_GET, '_fix_gpc_magic');
     array_walk($_POST, '_fix_gpc_magic');
@@ -1104,7 +1104,7 @@ function fix_gpc_magic() {
  */
 function t($string, $args = array(), $langcode = NULL) {
   global $language;
-  static $custom_strings;
+  $custom_strings = &drupal_static(__FUNCTION__);
 
   if (!isset($langcode)) {
     $langcode = isset($language->language) ? $language->language : 'en';
@@ -1535,7 +1535,7 @@ function format_interval($timestamp, $gr
  *   A translated date string in the requested format.
  */
 function format_date($timestamp, $type = 'medium', $format = '', $timezone = NULL, $langcode = NULL) {
-  static $timezones = array();
+  $timezones = &drupal_static(__FUNCTION__, array());
   if (!isset($timezone)) {
     global $user;
     if (variable_get('configurable_timezones', 1) && $user->uid && $user->timezone) {
@@ -1688,7 +1688,7 @@ function url($path = NULL, array $option
   }
 
   global $base_url;
-  static $script;
+  $script = &drupal_static(__FUNCTION__);
 
   if (!isset($script)) {
     // On some web servers, such as IIS, we can't omit "index.php". So, we
@@ -2039,7 +2039,7 @@ function drupal_add_link($attributes) {
  *   An array of queued cascading stylesheets.
  */
 function drupal_add_css($data = NULL, $options = NULL) {
-  static $css = array();
+  $css = &drupal_static(__FUNCTION__, array());
   global $language;
 
   // Construct the options, taking the defaults into consideration.
@@ -2238,7 +2238,7 @@ function drupal_build_css_cache($types, 
  * This function will prefix all paths within a CSS file.
  */
 function _drupal_build_css_path($matches, $base = NULL) {
-  static $_base;
+  $_base = &drupal_static(__FUNCTION__);
   // Store base path for preg_replace_callback.
   if (isset($base)) {
     $_base = $base;
@@ -2448,7 +2448,7 @@ function drupal_clear_css_cache() {
  * @see drupal_get_js()
  */
 function drupal_add_js($data = NULL, $options = NULL) {
-  static $javascript = array();
+  $javascript = &drupal_static(__FUNCTION__, array());
 
   // Construct the options, taking the defaults into consideration.
   if (isset($options)) {
@@ -2461,11 +2461,6 @@ function drupal_add_js($data = NULL, $op
   }
   $options += drupal_js_defaults($data);
 
-  if ($options['type'] == 'reset') {
-    // Request made to reset the JavaScript added so far
-    return $javascript = array();
-  }
-
   // Preprocess can only be set if caching is enabled.
   $options['preprocess'] = $options['cache'] ? $options['preprocess'] : FALSE;
 
@@ -2762,7 +2757,7 @@ function drupal_get_js($scope = 'header'
  * @see theme_menu_overview_form()
  */
 function drupal_add_tabledrag($table_id, $action, $relationship, $group, $subgroup = NULL, $source = NULL, $hidden = TRUE, $limit = 0) {
-  static $js_added = FALSE;
+  $js_added = &drupal_static(__FUNCTION__, FALSE);
   if (!$js_added) {
     // Add the table drag JavaScript to the page before the module JavaScript
     // to ensure that table drag behaviors are registered before any module
@@ -2895,7 +2890,7 @@ function drupal_urlencode($text) {
  *   The number of characters (bytes) to return in the string.
  */
 function drupal_random_bytes($count)  {
-  static $random_state;
+  $random_state = &drupal_static(__FUNCTION__);
   // We initialize with the somewhat random PHP process ID on the first call.
   if (empty($random_state)) {
     $random_state = getmypid();
@@ -2994,7 +2989,7 @@ function xmlrpc($url) {
 }
 
 function _drupal_bootstrap_full() {
-  static $called;
+  $called = &drupal_static(__FUNCTION__);
 
   if ($called) {
     return;
@@ -3445,10 +3440,10 @@ function element_sort($a, $b) {
 /**
  * Retrieve the default properties for the defined element type.
  */
-function element_info($type, $refresh = NULL) {
-  static $cache;
+function element_info($type) {
+  $cache = &drupal_static(__FUNCTION__);
 
-  if (!isset($cache) || $refresh) {
+  if (!isset($cache)) {
     $basic_defaults = element_basic_defaults();
     $cache = array();
     foreach (module_implements('elements') as $module) {
