core/lib/Drupal/Core/Cache/Cache.php | 9 ++++----- core/modules/views/src/Plugin/CacheablePluginInterface.php | 3 +-- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/core/lib/Drupal/Core/Cache/Cache.php b/core/lib/Drupal/Core/Cache/Cache.php index d12d538..bc93ea3 100644 --- a/core/lib/Drupal/Core/Cache/Cache.php +++ b/core/lib/Drupal/Core/Cache/Cache.php @@ -66,9 +66,7 @@ public static function validateContexts(array $context_tokens) { return; } - // The set of existing (thus valid) cache contexts is stored on the - // container; it's safe to statically cache this because it cannot change - // during the request. Initialize the set of valid context tokens with this. + // Initialize the set of valid context tokens with the container's contexts. if (!isset(static::$validContextTokens)) { static::$validContextTokens = array_flip(\Drupal::getContainer()->getParameter('cache_contexts')); } @@ -88,8 +86,9 @@ public static function validateContexts(array $context_tokens) { // throw an exception, otherwise cache it, including the parameter, to // minimize the amount of work in future ::validateContexts() calls. $context_id = $context_token; - if (strpos($context_id, ':') !== FALSE) { - $context_id = substr($context_id, 0, strpos($context_id, ':')); + $colon_pos = strpos($context_id, ':'); + if ($colon_pos !== FALSE) { + $context_id = substr($context_id, 0, $colon_pos); } if (isset(static::$validContextTokens[$context_id])) { static::$validContextTokens[$context_token] = TRUE; diff --git a/core/modules/views/src/Plugin/CacheablePluginInterface.php b/core/modules/views/src/Plugin/CacheablePluginInterface.php index cca8c08..f14cad5 100644 --- a/core/modules/views/src/Plugin/CacheablePluginInterface.php +++ b/core/modules/views/src/Plugin/CacheablePluginInterface.php @@ -10,8 +10,7 @@ /** * Provides caching information about the result cacheability of views plugins. * - * For caaching on the render level we rely on cache bubbling of the cache - * contexts. + * For caching on the render level ,we rely on bubbling of the cache contexts. */ interface CacheablePluginInterface {