8000 minor #22105 [Yaml] Fix error handling on ini file parsing (chalasr) · symfony/symfony@daac6c2 · GitHub
[go: up one dir, main page]

Skip to content

Commit daac6c2

Browse files
committed
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
2 parents 3495b35 + 71cec82 commit daac6c2

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

src/Symfony/Component/Yaml/Parser.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,7 @@ public function parse($value, $flags = 0)
341341
try {
342342
$parsedLine = Inline::parse($line, $flags, $this->refs);
343343

344-
if (!is_string($value)) {
344+
if (!is_string($parsedLine)) {
345345
$parseError = true;
346346
break;
347347
}

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

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1687,6 +1687,21 @@ public function testComplexMappingNestedInSequenceThrowsParseException()
16871687
$this->parser->parse($yaml);
16881688
}
16891689

1690+
/**
1691+
* @expectedException \Symfony\Component\Yaml\Exception\ParseException
1692+
* @expectedExceptionMessage Unable to parse at line 1 (near "[parameters]").
1693+
*/
1694+
public function testParsingIniThrowsException()
1695+
{
1696+
$ini = <<<INI
1697+
[parameters]
1698+
foo = bar
1699+
bar = %foo%
1700+
INI;
1701+
1702+
$this->parser->parse($ini);
1703+
}
1704+
16901705
private function loadTestsFromFixtureFiles($testsFile)
16911706
{
16921707
$parser = new Parser();

0 commit comments

Comments
 (0)
0