diff --git a/core/lib/Drupal/Core/Cache/Cache.php b/core/lib/Drupal/Core/Cache/Cache.php index 718f616..1521d4b 100644 --- a/core/lib/Drupal/Core/Cache/Cache.php +++ b/core/lib/Drupal/Core/Cache/Cache.php @@ -81,7 +81,7 @@ public static function validateTags(array $tags) { * A prefix string. * @param array $suffixes * An array of suffixes. Will be cast to strings. - * @param $glue + * @param string $glue * A string to be used as glue for concatenation. Defaults to a colon. * * @return string[] diff --git a/core/modules/contact/src/Access/ContactPageAccess.php b/core/modules/contact/src/Access/ContactPageAccess.php index 7b5ad48..97d6b06 100644 --- a/core/modules/contact/src/Access/ContactPageAccess.php +++ b/core/modules/contact/src/Access/ContactPageAccess.php @@ -95,7 +95,7 @@ public function access(UserInterface $user, AccountInterface $account) { // configured default is disabled. $contact_settings = $this->configFactory->get('contact.settings'); $access->cacheUntilConfigurationChanges($contact_settings); - if (!$contact_settings->get('user_default_enabled')) { + if (!isset($account_data) && !$contact_settings->get('user_default_enabled')) { return $access; } diff --git a/core/modules/system/src/EventSubscriber/ThemeSettingsCacheTag.php b/core/modules/system/src/EventSubscriber/ThemeSettingsCacheTag.php index 844df16..a6a6b7c 100644 --- a/core/modules/system/src/EventSubscriber/ThemeSettingsCacheTag.php +++ b/core/modules/system/src/EventSubscriber/ThemeSettingsCacheTag.php @@ -29,7 +29,7 @@ class ThemeSettingsCacheTag implements EventSubscriberInterface { * Constructs a ThemeSettingsCacheTag object. * * @param \Drupal\Core\Extension\ThemeHandlerInterface $theme_handler - * The theme handler + * The theme handler. */ public function __construct(ThemeHandlerInterface $theme_handler) { $this->themeHandler = $theme_handler; @@ -47,11 +47,12 @@ public function onSave(ConfigCrudEvent $event) { Cache::invalidateTags(['rendered']); } - // Theme-specific settings. - $matches = []; - if (preg_match('/(.*)\.settings$/', $event->getConfig()->getName(), $matches)) { - if (in_array($matches[1], array_keys($this->themeHandler->listInfo()))) { + // Theme-specific settings, check if this matches a theme settings + // configuration object, in that case, clear the rendered cache tag. + foreach (array_keys($this->themeHandler->listInfo()) as $theme_name) { + if ($theme_name == $event->getConfig()->getName()) { Cache::invalidateTags(['rendered']); + break; } } } diff --git a/core/tests/Drupal/Tests/Core/Access/AccessResultTest.php b/core/tests/Drupal/Tests/Core/Access/AccessResultTest.php index add45c2..da5651c 100644 --- a/core/tests/Drupal/Tests/Core/Access/AccessResultTest.php +++ b/core/tests/Drupal/Tests/Core/Access/AccessResultTest.php @@ -449,7 +449,7 @@ public function testCacheTags() { $verify($b, $tags); $this->assertEquals($a, $b); - // ::cacheUntilEntityChanges() convenience method. + // ::cacheUntilConfigurationChanges() convenience method. $configuration = $this->getMock('\Drupal\Core\Config\ConfigBase'); $configuration->expects($this->any()) ->method('getCacheTags') diff --git a/core/tests/Drupal/Tests/Core/Cache/CacheTest.php b/core/tests/Drupal/Tests/Core/Cache/CacheTest.php index a425572..1ef83a0 100644 --- a/core/tests/Drupal/Tests/Core/Cache/CacheTest.php +++ b/core/tests/Drupal/Tests/Core/Cache/CacheTest.php @@ -105,6 +105,8 @@ public function buildTagsProvider() { ['node', [5 => NULL], ['node:']], ['node', ['a' => NULL], ['node:']], ['node', ['a' => TRUE], ['node:1']], + // Test the $glue parameter. + ['config:system.menu', ['menu_name'], ['config:system.menu.menu_name'], '.'], ]; } @@ -113,8 +115,8 @@ public function buildTagsProvider() { * * @dataProvider buildTagsProvider */ - public function testBuildTags($prefix, array $suffixes, array $expected) { - $this->assertEquals($expected, Cache::buildTags($prefix, $suffixes)); + public function testBuildTags($prefix, array $suffixes, array $expected, $glue = ':') { + $this->assertEquals($expected, Cache::buildTags($prefix, $suffixes, $glue)); } /**