-
-
Notifications
You must be signed in to change notification settings - Fork 9.7k
Closed
Closed
Copy link
Labels
Description
Q | A |
---|---|
Bug report? | yes |
Feature request? | no |
BC Break report? | no |
RFC? | yes |
Symfony version | 2.8.15 |
The Yaml::parse()
seems to have problems if an element of a sequence contains a multiline string containg an empty line:
$raw = <<<YAML
---
foo:
bar:
- field1: value
field2: |
bla
bla
bla
YAML;
try {
\Symfony\Component\Yaml\Yaml::parse($raw);
} catch (\Symfony\Component\Yaml\Exception\ParseException $e) {
// Exception is thrown
$e->getMessage();
}
This example results in a ParseException
with the message Unable to parse at line 8 (near " bla").
.
If empty lines are used outside the sequence, Yaml::parse()
does not throw the Exception
. F.e. this example works fine:
$raw = <<<YAML
---
foo:
bar:
- field1: value
field2: |
bla
bla
bla
bar2: |
bla
bla
bla
YAML;
\Symfony\Component\Yaml\Yaml::parse($raw);
try {
\Symfony\Component\Yaml\Yaml::parse($raw);
} catch (\Symfony\Component\Yaml\Exception\ParseException $e) {
// Exception is thrown
$e->getMessage();
}