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 3065764

Browse filesBrowse files
committed
Fixes #22967
1 parent 0a695a7 commit 3065764
Copy full SHA for 3065764

File tree

2 files changed

+15
-1
lines changed
Filter options

2 files changed

+15
-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 && !$this->isNextLineIndented()) {
424+
if (0 === $this->currentLineNb && (!$this->isCurrentLineBlank() || !$this->isCurrentLineLastLineInDocument()) && !$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
+14Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -824,6 +824,20 @@ public function testMultiLineStringLastResortParsingOnlyAffectSameIndentationLev
824824
$this->parser->parse($yaml);
825825
}
826826

827+
/**
828+
* @expectedException \Symfony\Component\Yaml\Exception\ParseException
829+
*/
830+
public function testMultiLineStringLastResortParsingOnlyAffectMultilineStrings()
831+
{
832+
$yaml = <<<'EOT'
833+
& * ! | > ' " % @ ` #, { asd a;sdasd }-@^qw3
834+
835+
# comment
836+
837+
EOT;
838+
$this->parser->parse($yaml);
839+
}
840+
827841
public function testMultiLineStringLastResortParsing()
828842
{
829843
$yaml = <<<'EOT'

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.