Closed
Description
When the yaml parser reads
foo: bar
foo: bar2
It will return an array with the first key. This is unfortunate for a couple of reasons.
- It is not to spec. The Yaml spec is clear that duplicate keys should be treated as an error - see http://yaml.org/spec/1.2/spec.html#id2759572
- The current behaviour of choosing the first key is pretty unique. See:
Psy Shell v0.7.0 (PHP 7.0.7 — cli) by Justin Hileman
>>> $a = ['a' => '1', 'a' => '2']
=> [
"a" => "2",
]
Also it is the opposite behaviour to the PECL yaml parser (which behaves like PHP) so allowing users to swap between implementations can have interesting affects.