0f56497cac
This PR was merged into the 2.3 branch.
Discussion
----------
[Yaml] Nested merge keys
When trying to use nested merge keys in Yaml, the ref sometimes had the wrong value
eg, with:
```yaml
taz: &taz
a: Steve
w:
p: 1234
nested:
<<: *taz
d: Doug
w: &nestedref
p: 12345
z:
<<: *nestedref
```
in this case, the ref `nestedref` had the value "Doug", which cause this error :
Symfony\Component\Yaml\Exception\ParseException: YAML merge keys used with a scalar value instead of an array at line 38 (near "<<: *nestedref").
It now works as expected
| Q | A
| ------------- | ---
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets |
| License | MIT
| Doc PR |
note: this PR replace #15241
Commits
-------
|
||
---|---|---|
.. | ||
Exception | ||
Tests | ||
.gitignore | ||
CHANGELOG.md | ||
composer.json | ||
Dumper.php | ||
Escaper.php | ||
Inline.php | ||
LICENSE | ||
Parser.php | ||
phpunit.xml.dist | ||
README.md | ||
Unescaper.php | ||
Yaml.php |
Yaml Component
YAML implements most of the YAML 1.2 specification.
use Symfony\Component\Yaml\Yaml;
$array = Yaml::parse(file_get_contents(filename));
print Yaml::dump($array);
Resources
You can run the unit tests with the following command:
$ cd path/to/Symfony/Component/Yaml/
$ composer install
$ phpunit