Problem/Motivation
We want to deprecate drupal_static() and drupal_static_reset(): #1577902: [META] Remove all usages of drupal_static() & drupal_static_reset()
However, for backwards compatibility, we have to turn drupal_static_reset() into a special case that does not call @trigger_error().
In general, code that calls drupal_static_reset() without calling drupal_static() is very likely needed for BC.
Examples of this include drupal_flush_all_caches() and \Drupal\Core\Test\FunctionalTestSetupTrait::prepareEnvironment().
Proposed resolution
Formally deprecate drupal_static_reset() without calling @trigger_error(), along with documentation explaining why we don't call it.
Find all these usages necessary for BC.
Add @todo and @see for these usages, pointing to the change record: https://www.drupal.org/node/2661204
Comments
Comment #2
andypostI think it needs better CR about how to prevent using static cos it brings state to services
Comment #3
claudiu.cristea\Drupal\migrate\MigrateExecutable::attemptMemoryReclaim()needs this call too.Comment #9
berdir> \Drupal\migrate\MigrateExecutable::attemptMemoryReclaim() needs this call too.
I'd argue it's fine to drop that without replacement as the chances that there's any memory worth reclaiming is lower and lower.
I'd argue we could just close this and use the approach that you proposed in the main issue for the few calls like this that must still call it.
Comment #15
nicxvan commentedI think this is actually not as hard as it initially seems.
Once we deprecate all other instances in core we introduce a special key
clear_all.Then we do this:
Then the two remaining calls we call with
clear_allas the argument and won't trigger the deprecation and all other calls will.