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 6ca3cc2

Browse filesBrowse files
committed
a colon followed by spaces exclusively separates mapping keys and values
1 parent bde3e28 commit 6ca3cc2
Copy full SHA for 6ca3cc2

File tree

2 files changed

+17
-1
lines changed
Filter options

2 files changed

+17
-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
@@ -200,7 +200,7 @@ private function doParse(string $value, int $flags)
200200
array_pop($this->refsBeingParsed);
201201
}
202202
} elseif (
203-
self::preg_match('#^(?P<key>(?:![^\s]++\s++)?(?:'.Inline::REGEX_QUOTED_STRING.'|(?:!?!php/const:)?[^ \'"\[\{!].*?)) *\:(\s++(?P<value>.+))?$#u', rtrim($this->currentLine), $values)
203+
self::preg_match('#^(?P<key>(?:![^\s]++\s++)?(?:'.Inline::REGEX_QUOTED_STRING.'|(?:!?!php/const:)?[^ \'"\[\{!].*?)) *\:( ++(?P<value>.+))?$#u', rtrim($this->currentLine), $values)
204204
&& (false === strpos($values['key'], ' #') || \in_array($values['key'][0], ['"', "'"]))
205205
) {
206206
if ($context && 'sequence' == $context) {

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

Copy file name to clipboardExpand all lines: src/Symfony/Component/Yaml/Tests/ParserTest.php
+16Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2733,6 +2733,22 @@ public function testParsingMultipleDocuments()
27332733
// (before, there was no \n after row2)
27342734
$this->assertSame(['a' => ['b' => "row\nrow2\n"], 'c' => 'd'], $this->parser->parse($longDocument));
27352735
}
2736+
2737+
public function testParseIdeographicSpaces()
2738+
{
2739+
$expected = <<<YAML
2740+
unquoted: \u{3000}
2741+
quoted: '\u{3000}'
2742+
within_string: 'a b'
2743+
regular_space: 'a b'
2744+
YAML;
2745+
$this->assertSame([
2746+
'unquoted' => ' ',
2747+
'quoted' => ' ',
2748+
'within_string' => 'a b',
2749+
'regular_space' => 'a b',
2750+
], $this->parser->parse($expected));
2751+
}
27362752
}
27372753

27382754
class B

0 commit comments

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