Same name and namespace in other branches
  1. 7.x includes/bootstrap.inc \drupal_static_reset()
  2. 8.9.x core/includes/bootstrap.inc \drupal_static_reset()
  3. 9 core/includes/bootstrap.inc \drupal_static_reset()

Resets one or all centrally stored static variable(s).

Parameters

$name: Name of the static variable to reset. Omit to reset all variables. Resetting all variables should only be used, for example, for running unit tests with a clean environment.

17 calls to drupal_static_reset()
drupal_flush_all_caches in core/includes/common.inc
Rebuilds the container, flushes all persistent caches, resets all variables, and rebuilds all data structures.
FilterAPITest::testDependencyRemoval in core/modules/filter/tests/src/Kernel/FilterAPITest.php
Tests that filter format dependency removal works.
LocaleBuildTest::testBuildProjects in core/modules/locale/tests/src/Kernel/LocaleBuildTest.php
Checks if a list of translatable projects gets built.
LocalePluralFormatTest::testGetPluralFormat in core/modules/locale/tests/src/Functional/LocalePluralFormatTest.php
Tests locale_get_plural() and \Drupal::translation()->formatPlural().
LocaleUpdateCronTest::testUpdateCron in core/modules/locale/tests/src/Functional/LocaleUpdateCronTest.php
Tests interface translation update using cron.

... See full list

File

core/includes/bootstrap.inc, line 485
Functions that need to be loaded on every Drupal request.

Code

function drupal_static_reset($name = NULL) {
  switch ($name) {
    case 'system_get_module_admin_tasks':
      @trigger_error("Calling " . __FUNCTION__ . "() with 'system_get_module_admin_tasks' as an argument is deprecated in drupal:10.2.0 and is removed from drupal:11.0.0. There is no replacement for this usage. See https://www.drupal.org/node/3038972", E_USER_DEPRECATED);
    case 'shortcut_current_displayed_set':
      @trigger_error("Calling " . __FUNCTION__ . "() with 'shortcut_current_displayed_set' as an argument is deprecated in drupal:10.3.0 and is removed from drupal:11.0.0. There is no replacement for this usage. See https://www.drupal.org/node/3427050", E_USER_DEPRECATED);
      break;
  }
  drupal_static($name, NULL, TRUE);
}