10000 Yaml::DUMP_MULTI_LINE_LITERAL_BLOCK creates invalid YAMl if first line has leading spaces · Issue #26065 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

Yaml::DUMP_MULTI_LINE_LITERAL_BLOCK creates invalid YAMl if first line has leading spaces #26065

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
tamc opened this issue Feb 6, 2018 · 0 comments

Comments

@tamc
Copy link
Contributor
tamc commented Feb 6, 2018
Q A
Bug report? yes
Feature request? no
BC Break report? no
RFC? no
Symfony version 3.4.4

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
tamc added a commit to eyfs/symfony that referenced this issue Feb 6, 2018
…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
tamc added a commit to eyfs/symfony that referenced this issue Feb 6, 2018
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 added a commit to eyfs/symfony that referenced this issue Feb 6, 2018
…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
tamc added a commit to eyfs/symfony that referenced this issue Feb 6, 2018
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
nicolas-grekas added a commit that referenced this issue 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 
8000
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
nicolas-grekas added a commit that referenced this issue Feb 11, 2018
* 3.4:
  [YAML] Issue #26065: leading spaces in YAML multi-line string literals
  [Bridge\PhpUnit] Exit as late as possible
  [Bridge\PhpUnit] Cleanup BC layer
  [PhpBridge] add PHPUnit 7 support to SymfonyTestsListener
  [Lock] Log already-locked errors as "notice" instead of "warning"
  add context to serialize and deserialize
  Update Repository Symlink Helper
  Document explicitly that dotfiles and vcs files are ignored by default
  [HttpKernel] don't try to wire Request argument with controller.service_arguments
  Make kernel build time optionally deterministic
  Use 0 for unlimited expiry
  [Routing] fix typo
  Bump default PHPUnit version from 6.3 to 6.5
  do not mock the container builder in tests
  [Cache][WebProfiler] fix collecting cache stats with sub-requests + allow clearing calls
nicolas-grekas added a commit that referenced this issue Feb 11, 2018
* 4.0:
  [YAML] Issue #26065: leading spaces in YAML multi-line string literals
  [Bridge\PhpUnit] Exit as late as possible
  [Bridge\PhpUnit] Cleanup BC layer
  [PhpBridge] add PHPUnit 7 support to SymfonyTestsListener
  [Lock] Log already-locked errors as "notice" instead of "warning"
  add context to serialize and deserialize
  Update Repository Symlink Helper
  isCsrfTokenValid() replace string  by ?string
  Document explicitly that dotfiles and vcs files are ignored by default
  [HttpKernel] don't try to wire Request argument with controller.service_arguments
  Make kernel build time optionally deterministic
  Use 0 for unlimited expiry
  [Routing] fix typo
  Bump default PHPUnit version from 6.3 to 6.5
  do not mock the container builder in tests
  [Cache][WebProfiler] fix collecting cache stats with sub-requests + allow clearing calls
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

No branches or pull requests

4 participants
0