Skip to content

[YAML] Line breaks in folded blocks are handled incorrectly #15477

@teohhanhui

Description

@teohhanhui

Test:

diff --git a/src/Symfony/Component/Yaml/Tests/Fixtures/sfTests.yml b/src/Symfony/Component/Yaml/Tests/Fixtures/sfTests.yml
index 7a54f16..962e021 100644
--- a/src/Symfony/Component/Yaml/Tests/Fixtures/sfTests.yml
+++ b/src/Symfony/Component/Yaml/Tests/Fixtures/sfTests.yml
@@ -51,9 +51,9 @@ php: |
       '~',
     )
 ---
-test: Empty lines in folded blocks
+test: Empty lines in literal blocks
 brief: >
-  Empty lines in folded blocks
+  Empty lines in literal blocks
 yaml: |
   foo:
     bar: |
@@ -65,6 +65,19 @@ yaml: |
 php: |
   array('foo' => array('bar' => "foo\n\n\n  \nbar\n"))
 ---
+test: Empty lines in folded blocks
+brief: >
+  Empty lines in folded blocks
+yaml: |
+  foo:
+    bar: >
+
+      foo
+
+      bar
+php: |
+  array('foo' => array('bar' => "\nfoo\nbar\n"))
+---
 test: IP addresses
 brief: >
   IP addresses

Refer to YAML 1.2 spec or even YAML 1.0 spec

(Also, what you were calling "folded blocks" are actually "literal blocks")

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions