diff --git a/includes/common.inc b/includes/common.inc index c23c80b..2fbb820 100644 --- a/includes/common.inc +++ b/includes/common.inc @@ -3900,7 +3900,7 @@ function drupal_clean_css_identifier($identifier, $filter = array(' ' => '-', '_ } $allow_css_double_underscores = &$drupal_static_fast['allow_css_double_underscores']; if (!isset($allow_css_double_underscores)) { - $allow_css_double_underscores = variable_get('allow_css_double_underscores'); + $allow_css_double_underscores = variable_get('allow_css_double_underscores', FALSE); } // Preserve BEM-style double-underscores depending on custom setting. diff --git a/modules/simpletest/tests/common.test b/modules/simpletest/tests/common.test index 61f4912..7aca10c 100644 --- a/modules/simpletest/tests/common.test +++ b/modules/simpletest/tests/common.test @@ -956,12 +956,22 @@ class DrupalHTMLIdentifierTestCase extends DrupalUnitTestCase { // Mock a variable_set of allow_css_double_underscores to TRUE. $original = isset($GLOBALS['conf']['allow_css_double_underscores']) ? $GLOBALS['conf']['allow_css_double_underscores'] : NULL; $GLOBALS['conf']['allow_css_double_underscores'] = TRUE; + $this->resetDrupalCleanCSSIdentifierCache(); // Now, verify that double underscores are preserved in the identifier. $this->assertIdentical(drupal_clean_css_identifier($identifier), $identifier, 'Verify double underscores are preserved.'); - // Revert the overridden value above. + // To avoid affecting other test cases, revert the overridden value above + // and reset the cache. $GLOBALS['conf']['allow_css_double_underscores'] = $original; + $this->resetDrupalCleanCSSIdentifierCache(); + } + + /** + * reset the cache in drupal_clean_css_identifier(). + */ + function resetDrupalCleanCSSIdentifierCache() { + drupal_static_reset('drupal_clean_css_identifier:allow_css_double_underscores'); } /**