File tree Expand file tree Collapse file tree 2 files changed +15
-1
lines changed
src/Symfony/Component/Yaml Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -421,7 +421,7 @@ private function doParse($value, $flags)
421
421
}
422
422
423
423
// 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 ()) {
425
425
$ previousLineWasNewline = false ;
426
426
$ previousLineWasTerminatedWithBackslash = false ;
427
427
$ value = '' ;
Original file line number Diff line number Diff line change @@ -824,6 +824,20 @@ public function testMultiLineStringLastResortParsingOnlyAffectSameIndentationLev
824
824
$ this ->parser ->parse ($ yaml );
825
825
}
826
826
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
+
827
841
public function testMultiLineStringLastResortParsing ()
828
842
{
829
843
$ yaml = <<<'EOT'
You can’t perform that action at this time.
0 commit comments