Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 0a695a7

Browse filesBrowse files
committed
[Yaml] Fix regression when trying to parse multiline
1 parent cfb243e commit 0a695a7
Copy full SHA for 0a695a7

File tree

2 files changed

+13
-1
lines changed
Filter options

2 files changed

+13
-1
lines changed

‎src/Symfony/Component/Yaml/Parser.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Yaml/Parser.php
+1-1Lines 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

Copy file name to clipboardExpand all lines: src/Symfony/Component/Yaml/Tests/ParserTest.php
+12Lines 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)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.