diff --git a/core/lib/Drupal/Core/Config/Schema/Mapping.php b/core/lib/Drupal/Core/Config/Schema/Mapping.php index 0a975cf..a85fac4 100644 --- a/core/lib/Drupal/Core/Config/Schema/Mapping.php +++ b/core/lib/Drupal/Core/Config/Schema/Mapping.php @@ -50,7 +50,7 @@ public function get($property_name) { if (isset($elements[$root_key])) { $element = $elements[$root_key]; // If $property_name contained a dot recurse into the keys. - while ($element && $key = array_shift($parts)) { + while ($element && ($key = array_shift($parts)) !== NULL) { if (method_exists($element, 'get')) { $element = $element->get($key); } @@ -130,7 +130,7 @@ public function getPropertyDefinitions() { if (!isset($this->propertyDefinitions)) { $this->propertyDefinitions = array(); foreach ($this->getAllKeys() as $key) { - $definition = isset($this->definition['mapping'][$name]) ? $this->definition['mapping'][$name] : array(); + $definition = isset($this->definition['mapping'][$key]) ? $this->definition['mapping'][$key] : array(); $this->propertyDefinitions[$key] = $this->buildDataDefinition($definition, $this->value[$key], $key); } } diff --git a/core/modules/config/src/Tests/SchemaCheckTraitTest.php b/core/modules/config/src/Tests/SchemaCheckTraitTest.php index 3b5793a..5620422 100644 --- a/core/modules/config/src/Tests/SchemaCheckTraitTest.php +++ b/core/modules/config/src/Tests/SchemaCheckTraitTest.php @@ -64,12 +64,15 @@ public function testTrait() { $ret = $this->checkConfigSchema($this->typedConfig, 'config_test.types', $config_data); $this->assertIdentical($ret, TRUE); - // Add a new key and new array to test the error messages. + // Add a new key, a new array and overwrite boolean with array to test the + // error messages. $config_data = array('new_key' => 'new_value', 'new_array' => array()) + $config_data; + $config_data['boolean'] = array(); $ret = $this->checkConfigSchema($this->typedConfig, 'config_test.types', $config_data); $expected = array( - 'config_test.types:new_key' => 'Missing schema', - 'config_test.types:new_array' => 'Non-scalar value but not defined as an array (such as mapping or sequence)', + 'config_test.types:new_key' => 'Missing schema.', + 'config_test.types:new_array' => 'Missing schema.', + 'config_test.types:boolean' => 'Non-scalar value but not defined as an array (such as mapping or sequence).', ); $this->assertIdentical($ret, $expected); }