Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Symfony/Component/Yaml/Parser.php
Original file line number Diff line number Diff line change
Expand Up @@ -1158,7 +1158,7 @@ private function lexInlineQuotedString(int &$cursor = 0): string
private function lexUnquotedString(int &$cursor): string
{
$offset = $cursor;
$cursor += strcspn($this->currentLine, '[]{},: ', $cursor);
$cursor += strcspn($this->currentLine, '[]{},:', $cursor);

if ($cursor === $offset) {
throw new ParseException('Malformed unquoted YAML string.');
Expand Down
27 changes: 27 additions & 0 deletions src/Symfony/Component/Yaml/Tests/ParserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -1710,6 +1710,33 @@ public function testBackslashInQuotedMultiLineString()
$this->assertSame($expected, $this->parser->parse($yaml));
}

/**
* @dataProvider wrappedUnquotedStringsProvider
*/
public function testWrappedUnquotedStringWithMultipleSpacesInValue(string $yaml, array $expected)
{
$this->assertSame($expected, $this->parser->parse($yaml));
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please add a blank line after the closing curly brace


public static function wrappedUnquotedStringsProvider() {
return [
'mapping' => [
'{ foo: bar bar, fiz: cat cat }',
[
'foo' => 'bar bar',
'fiz' => 'cat cat',
]
],
'sequence' => [
'[ bar bar, cat cat ]',
[
'bar bar',
'cat cat',
]
],
];
}

public function testParseMultiLineUnquotedString()
{
$yaml = <<<EOT
Expand Down