Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[YAML] Issue #26065: leading spaces in YAML multi-line string literals #26067

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
wants to merge 2 commits into from

Conversation

tamc
Copy link
Contributor

@tamc tamc commented Feb 6, 2018

Q A
Branch? 3.4
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets #26065
License MIT
Doc PR no

Doing this:

Yaml::dump(
    ["text" => "  leading space in first line\nno leading space in last line\n"],
    2, 
    4, 
    Yaml::DUMP_MULTI_LINE_LITERAL_BLOCK
);

Will produce this:

text: |
       leading space in first line
     no leading space in last line

Which is invalid YAML because when the first line has leading spaces it needs a block indentation indicator like this:

text: |4
      leading space in first line
    no leading space in last line

This pull requests contains a test and a patch.

tamc added 2 commits February 6, 2018 17:30
…g literals

When dumping an object to YAML.

If the first line of a mult-line string literal starts with spaces then
the YAML spec says you need to use a [block indentation indicator][1].

[1]: http://www.yaml.org/spec/1.2/spec.html#id2793979
When dumping YAML: When the first line of a multi-line
string literal starts with a space, emit a block indentation
indicator.

As per spec at:
http://www.yaml.org/spec/1.2/spec.html#id2793979

Issue symfony#26065
@tamc tamc force-pushed the ticket_26065_yaml_multiline_bugfix branch from 21f23e6 to 272fe5a Compare February 6, 2018 17:30
@xabbuh xabbuh added this to the 3.4 milestone Feb 7, 2018
@nicolas-grekas
Copy link
Member

Thank you @tamc.

nicolas-grekas added a commit that referenced this pull request Feb 11, 2018
…ing literals (tamc)

This PR was squashed before being merged into the 3.4 branch (closes #26067).

Discussion
----------

[YAML] Issue #26065: leading spaces in YAML multi-line string literals

| Q             | A
| ------------- | ---
| Branch?       | 3.4
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #26065
| License       | MIT
| Doc PR        | no

Doing this:

    Yaml::dump(
        ["text" => "  leading space in first line\nno leading space in last line\n"],
        2,
        4,
        Yaml::DUMP_MULTI_LINE_LITERAL_BLOCK
    );

Will produce this:

    text: |
           leading space in first line
         no leading space in last line

Which is invalid YAML because when the first line has leading spaces it needs a [block indentation indicator](http://www.yaml.org/spec/1.2/spec.html#id2793979) like this:

    text: |4
          leading space in first line
        no leading space in last line

This pull requests contains a test and a patch.

Commits
-------

aa95663 [YAML] Issue #26065: leading spaces in YAML multi-line string literals
This was referenced Mar 1, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants
Morty Proxy This is a proxified and sanitized view of the page, visit original site.