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
Closed
@occanowey

Description

@occanowey

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0