Skip to content

YAML DUMP_MULTI_LINE_LITERAL_BLOCK question, possible bug #20706

@lauradean

Description

@lauradean

In outputting an array to YAML, my multi-line strings were not being output as literals, but I found that if I changed the line in Dumper.php from

if ($inline > 1 && Yaml::DUMP_MULTI_LINE_LITERAL_BLOCK
    & $flags && is_string($value) && false !== strpos($value, "\n")) {

to

if ($inline >= 1 && Yaml::DUMP_MULTI_LINE_LITERAL_BLOCK
    & $flags && is_string($value) && false !== strpos($value, "\n")) {

then it works perfectly.

Is there a reason for checking for $inline > 1?

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