[Yaml] Fix error handling in parser
This commit is contained in:
parent
3495b35e4f
commit
71cec8203f
@ -341,7 +341,7 @@ class Parser
|
||||
try {
|
||||
$parsedLine = Inline::parse($line, $flags, $this->refs);
|
||||
|
||||
if (!is_string($value)) {
|
||||
if (!is_string($parsedLine)) {
|
||||
$parseError = true;
|
||||
break;
|
||||
}
|
||||
|
@ -1687,6 +1687,21 @@ YAML;
|
||||
$this->parser->parse($yaml);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Symfony\Component\Yaml\Exception\ParseException
|
||||
* @expectedExceptionMessage Unable to parse at line 1 (near "[parameters]").
|
||||
*/
|
||||
public function testParsingIniThrowsException()
|
||||
{
|
||||
$ini = <<<INI
|
||||
[parameters]
|
||||
foo = bar
|
||||
bar = %foo%
|
||||
INI;
|
||||
|
||||
$this->parser->parse($ini);
|
||||
}
|
||||
|
||||
private function loadTestsFromFixtureFiles($testsFile)
|
||||
{
|
||||
$parser = new Parser();
|
||||
|
Reference in New Issue
Block a user