diff --git a/core/lib/Drupal/Core/Config/TypedConfigManager.php b/core/lib/Drupal/Core/Config/TypedConfigManager.php index 0a8f8f4..98e8417 100644 --- a/core/lib/Drupal/Core/Config/TypedConfigManager.php +++ b/core/lib/Drupal/Core/Config/TypedConfigManager.php @@ -302,7 +302,7 @@ public function hasConfigSchema($name) { protected function alterDefintions(&$definitions) { $discovered_schema = array_keys($definitions); parent::alterDefintions($definitions); - if ($discovered_schema !== array_keys($definitions)) { + if ($discovered_schema != array_keys($definitions)) { throw new ConfigSchemaAlterException('Invoking hook_config_schema_info_alter() has added or removed schema definitions'); } } diff --git a/core/modules/config/tests/config_schema_test/config_schema_test.module b/core/modules/config/tests/config_schema_test/config_schema_test.module index e697f9c..3962cf4 100644 --- a/core/modules/config/tests/config_schema_test/config_schema_test.module +++ b/core/modules/config/tests/config_schema_test/config_schema_test.module @@ -12,7 +12,9 @@ function config_schema_test_config_schema_info_alter(&$definitions) { if (\Drupal::state()->get('config_schema_test_exception')) { unset($definitions['config_schema_test.hook']); } - else { + + // Since code can not be unloaded only alter the definition if it exists. + if (isset($definitions['config_schema_test.hook'])) { $definitions['config_schema_test.hook']['additional_metadata'] = 'new schema info'; } }