diff --git a/core/lib/Drupal/Component/Serialization/Yaml.php b/core/lib/Drupal/Component/Serialization/Yaml.php index 1f6d304..53f4c41 100644 --- a/core/lib/Drupal/Component/Serialization/Yaml.php +++ b/core/lib/Drupal/Component/Serialization/Yaml.php @@ -36,7 +36,9 @@ public static function encode($data) { public static function decode($raw) { try { $yaml = new Parser(); - return $yaml->parse($raw, TRUE, FALSE); + // Make sure we have a single trailing newline. A very simple config like + // 'foo: bar' with no newline will fail to parse otherwise. + return $yaml->parse(rtrim($raw, "\n") . "\n", TRUE, FALSE); } catch (\Exception $e) { throw new InvalidDataTypeException($e->getMessage(), $e->getCode(), $e);