bug #21084 [Yaml] handle empty lines inside unindented collection (xabbuh)
This PR was merged into the 2.7 branch.
Discussion
----------
[Yaml] handle empty lines inside unindented collection
| Q | A
| ------------- | ---
| Branch? | 2.7
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #21005
| License | MIT
| Doc PR |
Commits
-------
bbfe6f73b5
handle empty lines inside unindented collection
This commit is contained in:
commit
942e0c1706
|
@ -423,7 +423,7 @@ class Parser
|
|||
|
||||
$previousLineIndentation = $indent;
|
||||
|
||||
if ($isItUnindentedCollection && !$this->isStringUnIndentedCollectionItem() && $newIndent === $indent) {
|
||||
if ($isItUnindentedCollection && !$this->isCurrentLineEmpty() && !$this->isStringUnIndentedCollectionItem() && $newIndent === $indent) {
|
||||
$this->moveToPreviousLine();
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -189,6 +189,22 @@ EOF;
|
|||
);
|
||||
$tests['Literal block chomping clip with multiple trailing newlines'] = array($expected, $yaml);
|
||||
|
||||
$yaml = <<<'EOF'
|
||||
foo:
|
||||
- bar: |
|
||||
one
|
||||
|
||||
two
|
||||
EOF;
|
||||
$expected = array(
|
||||
'foo' => array(
|
||||
array(
|
||||
'bar' => "one\n\ntwo",
|
||||
),
|
||||
),
|
||||
);
|
||||
$tests['Literal block chomping clip with embedded blank line inside unindented collection'] = array($expected, $yaml);
|
||||
|
||||
$yaml = <<<'EOF'
|
||||
foo: |
|
||||
one
|
||||
|
|
Reference in New Issue