Closed
Closed
Copy link
Description
Symfony version(s) affected: 3.4.41 (and probably master too)
Description
Yaml::parse(Yaml::dump("a\nb")) === "a\nb\n"
In other words, multiline YML does not roundtrip, it seems to always get a trailing newline.
How to reproduce
# In my Drupal/Drush env:
$ drush ev 'print json_encode(\Symfony\Component\Yaml\Yaml::parse(\Symfony\Component\Yaml\Yaml::dump(["a\nb"],2,4, \Symfony\Component\Yaml\Yaml::DUMP_MULTI_LINE_LITERAL_BLOCK))) . "\n";'
["a\nb\n"]
Possible Solution
Add such test and fix code.
Additional context
- Raised this already in Yaml::DUMP_MULTI_LINE_LITERAL_BLOCK breaks dump #25842, but witn "\r\n", and in the heat of the battle, the problem was just hidden by un-multilining "\r\n".
- This is strongly wanted for Drupal config dump here