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 d1b42e2

Browse filesBrowse files
committed
fix parsing comments not prefixed by a space
1 parent 6b8857c commit d1b42e2
Copy full SHA for d1b42e2

File tree

Expand file treeCollapse file tree

2 files changed

+6
-1
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+6
-1
lines changed

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

Copy file name to clipboardExpand all lines: src/Symfony/Component/Yaml/Inline.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ public static function parse($value, $flags = 0, $references = [])
127127
}
128128

129129
// some comments are allowed at the end
130-
if (preg_replace('/\s+#.*$/A', '', substr($value, $i))) {
130+
if (preg_replace('/\s*#.*$/A', '', substr($value, $i))) {
131131
throw new ParseException(sprintf('Unexpected characters near "%s".', substr($value, $i)), self::$parsedLineNumber + 1, $value, self::$parsedFilename);
132132
}
133133

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

Copy file name to clipboardExpand all lines: src/Symfony/Component/Yaml/Tests/InlineTest.php
+5Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -860,4 +860,9 @@ public function testParseNegativeOctalNumberContainingInvalidDigits()
860860
{
861861
self::assertSame('-0123456789', Inline::parse('-0123456789'));
862862
}
863+
864+
public function testParseCommentNotPrefixedBySpaces()
865+
{
866+
self::assertSame('foo', Inline::parse('"foo"#comment'));
867+
}
863868
}

0 commit comments

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