From e1d4dc7d6e37749e4642cbcaf236f26d01c9a0bc Mon Sep 17 00:00:00 2001 From: Angie Byron Date: Sun, 15 Nov 2009 21:41:06 +0000 Subject: #620688 follow-up by chx and effulgentsia: Fixed drupal_static_reset() is broken, with expanded test coverage. --- includes/bootstrap.inc | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'includes') diff --git a/includes/bootstrap.inc b/includes/bootstrap.inc index 81598b5c9..bc13133ca 100644 --- a/includes/bootstrap.inc +++ b/includes/bootstrap.inc @@ -2100,8 +2100,12 @@ function registry_rebuild() { function &drupal_static($name, $default_value = NULL, $reset = FALSE) { static $data = array(), $default = array(); if (!isset($name)) { - // All variables are reset. - $data = $default; + // All variables are reset. This needs to be done one at a time so that + // references returned by earlier invocations of drupal_static() also get + // reset. + foreach ($default as $name => $value) { + $data[$name] = $value; + } // As the function returns a reference, the return should always be a // variable. return $data; -- cgit v1.2.3