8000 [Yaml] CRLF multiline strings not dumpped as scalar blocks · Issue #38171 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[Yaml] CRLF multiline strings not dumpped as scalar blocks #38171

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
occanowey opened this issue Sep 13, 2020 · 2 comments
Closed

[Yaml] CRLF multiline strings not dumpped as scalar blocks #38171

occanowey opened this issue Sep 13, 2020 · 2 comments

Comments

@occanowey
Copy link

Symfony version(s) affected: 3.4.37+, 4.3.10+, 4.4.2+, 5.0.2+

Description
As of #34449 when using Yaml::DUMP_MULTI_LINE_LITERAL_BLOCK any multiline string with CRLF new lines will be encoded as a single line quoted string instead of a scalar block.

How to reproduce
Try to dump a string with CRLF new lines.

e.g.

$strings = [
    "lf" => "multi\nline\nstring",
    "crlf" => "multi\r\nline\r\nstring",
    "mixed" => "multi\r\nline\nstring",
];

$yaml = Yaml::dump($strings, 2, 2, Yaml::DUMP_MULTI_LINE_LITERAL_BLOCK);
print($yaml);

produces:

lf: |
  multi
  line
  string
crlf: "multi\r\nline\r\nstring"
mixed: "multi\r\nline\nstring"

Possible Solution
Change explode back to preg_split, but I'm unsure it explode was used for a specific reason.

@occanowey occanowey added the Bug label Sep 13, 2020
@occanowey occanowey changed the title CRLF multiline strings not dumpped as scalar blocks [Yaml] CRLF multiline strings not dumpped as scalar blocks Sep 13, 2020
@xabbuh xabbuh added the Yaml label Sep 13, 2020
@xabbuh
Copy link
Member
xabbuh commented Sep 14, 2020

What result did you get before #34449?

@occanowey
Copy link
Author
occanowey commented Sep 16, 2020

Yeah, That's my bad I should have tested beforehand. #34449 was the most recent commit that looked like it was the cause, after some more research it looks like it was done on purpose in #25864

I'm not sure I'm happy with that solution as the root cause appears to be this but it is working as intended so I'm going to close this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants
0