8000 [Yaml] Fix regression when trying to parse multiline · symfony/symfony@9e198cf · GitHub
[go: up one dir, main page]

Skip to content

Commit 9e198cf

Browse files
committed
[Yaml] Fix regression when trying to parse multiline
1 parent d6fd579 commit 9e198cf

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

src/Symfony/Component/Yaml/Parser.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -421,7 +421,7 @@ private function doParse($value, $flags)
421421
}
422422

423423
// try to parse the value as a multi-line string as a last resort
424-
if (0 === $this->currentLineNb) {
424+
if (0 === $this->currentLineNb && !$this->isNextLineIndented()) {
425425
$previousLineWasNewline = false;
426426
$previousLineWasTerminatedWithBackslash = false;
427427
$value = '';

src/Symfony/Component/Yaml/Tests/ParserTest.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -812,6 +812,18 @@ public function testNonStringFollowedByCommentEmbeddedInMapping()
812812
$this->assertSame($expected, $this->parser->parse($yaml));
813813
}
814814

815+
/**
816+
* @expectedException \Symfony\Component\Yaml\Exception\ParseException
817+
*/
818+
public function testMultiLineStringLastResortParsingOnlyAffectSameIndentationLevel()
819+
{
820+
$yaml = <<<'EOT'
821+
parse
822+
error:
823+
EOT;
824+
$this->parser->parse($yaml);
825+
}
826+
815827
public function testMultiLineStringLastResortParsing()
816828
{
817829
$yaml = <<<'EOT'

0 commit comments

Comments
 (0)
0