php / pecl-file_formats-yaml

YAML-1.1 parser and emitter
https://pecl.php.net/package/yaml
MIT License
72 stars 33 forks source link

Remove support for non-scalar mapping keys #47

Closed bd808 closed 4 years ago

bd808 commented 4 years ago

The YAML 1.1 spec includes support for non-scalar keys in mappings. PHP does not support non-scalar keys in its native array constructs. Previously we handled this feature mismatch during YAML document parsing by converting non-scalar key values to strings before using them as keys. This approach provides some level of support for this 'interesting' part of the YAML specification, but it also leads to PHP structures which cannot be cleanly round tripped back to a YAML document matching the original input. It can also cause high runtime memory usage for perverse YAML input.

Non-scalar keys will now generate a warning and omit the value from the constructed array.

Bug: 64694 Bug: 77720

bd808 commented 4 years ago

I'm not sure why the bot didn't recognize this as being resolved by the merge of dc48e4a upstream.