Skip to content

Commit 5cdc184

Browse files
committed
Merge branch '4.4' into 5.2
* 4.4: [HttpClient][PHPDoc] Fix 2 remaining return mixed [Cache] [FrameworkBundle] Fix logging for TagAwareAdapter [Route] Better inline requirements and defaults parsing Simplified condition and removed unused code from AbstractSessionListener::onKernelRequest [PhpUnitBridge] Fix phpunit symlink on Windows [Yaml] Fixed infinite loop when parser goes through an additional and invalid closing tag
2 parents 7e46b52 + bcef62d commit 5cdc184

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

Parser.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1233,6 +1233,10 @@ private function lexUnquotedString(int &$cursor): string
12331233
$offset = $cursor;
12341234
$cursor += strcspn($this->currentLine, '[]{},: ', $cursor);
12351235

1236+
if ($cursor === $offset) {
1237+
throw new ParseException('Malformed unquoted YAML string.');
1238+
}
1239+
12361240
return substr($this->currentLine, $offset, $cursor - $offset);
12371241
}
12381242

Tests/ParserTest.php

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2675,6 +2675,25 @@ public function testParseValueWithNegativeModifiers()
26752675
);
26762676
}
26772677

2678+
public function testThrowExceptionIfInvalidAdditionalClosingTagOccurs()
2679+
{
2680+
$yaml = '{
2681+
"object": {
2682+
"array": [
2683+
"a",
2684+
"b",
2685+
"c"
2686+
]
2687+
],
2688+
}
2689+
}';
2690+
2691+
$this->expectException(ParseException::class);
2692+
$this->expectExceptionMessage('Malformed unquoted YAML string at line 8 (near " ],").');
2693+
2694+
$this->parser->parse($yaml);
2695+
}
2696+
26782697
public function testWhitespaceAtEndOfLine()
26792698
{
26802699
$yaml = "\nfoo:\n arguments: [ '@bar' ] \n";

0 commit comments

Comments
 (0)