minor #22105 [Yaml] Fix error handling on ini file parsing (chalasr)
This PR was merged into the 3.3-dev branch.
Discussion
----------
[Yaml] Fix error handling on ini file parsing
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | n/a
| License | MIT
| Doc PR | n/a
Should make travis green again on master.
/cc @xabbuh
Commits
-------
71cec82
[Yaml] Fix error handling in parser
This commit is contained in:
commit
daac6c2449
@ -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