diff --git a/src/Symfony/Components/Yaml/Parser.php b/src/Symfony/Components/Yaml/Parser.php index 4ae02e31a27c4..c4ed38415a65f 100644 --- a/src/Symfony/Components/Yaml/Parser.php +++ b/src/Symfony/Components/Yaml/Parser.php @@ -206,8 +206,7 @@ public function parse($value) } else { - // 1-liner followed by newline - if (2 == count($this->lines) && empty($this->lines[1])) + if (1 == count($this->lines)) { $value = Inline::load($this->lines[0]); if (is_array($value)) @@ -555,10 +554,8 @@ protected function cleanup($value) { $value = str_replace(array("\r\n", "\r"), "\n", $value); - if (!preg_match("#\n$#", $value)) - { - $value .= "\n"; - } + // remove trailing newlines + $value = rtrim($value, "\n"); // strip YAML header $count = 0;