8000 [yaml] #-sign inside string literals inside collections are seen as comments · Issue #12478 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content
< 8000 div class="clearfix new-discussion-timeline js-check-all-container container-xl px-3 px-md-4 px-lg-5 mt-4" data-pjax="" data-turbo-frame="">

[yaml] #-sign inside string literals inside collections are seen as comments #12478

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
jaytaph opened this issue Nov 14, 2014 · 2 comments
Closed

Comments

@jaytaph
Copy link
Contributor
jaytaph commented Nov 14, 2014

When using collections, string literals starting with # are still seen as comments, and are stripped. However, it works correctly in normal items.

  test: |
    foo
    # bar
    baz
  collection:
    - one: |
        foo
        # bar
        baz
    - two: |
        foo
        # bar
        baz

This will result in:

  Array(
      [collection] => Array (
              [0] => Array( [one] => foo\nbaz )
              [1] => Array( [two] => foo\nbaz )
      )
      [test] => foo\n#bar\nbaz
  )

while expected:

  Array(
      [collection] => Array (
              [0] => Array( [one] => foo\n#bar\nbaz )
              [1] => Array( [two] => foo\n#bar\nbaz )
      )
      [test] => foo\n#bar\nbaz
  )

I've checked with the yaml pecl extension, and this works as expected.

@jezhalford
Copy link

I'm seeing this issue too - a fix would be a wonderful thing.

@xabbuh
Copy link
Member
xabbuh commented Dec 5, 2015

see #16860

fabpot added a commit that referenced this issue Dec 18, 2015
This PR was merged into the 2.3 branch.

Discussion
----------

[Yaml] do not remove "comments" in scalar blocks

| Q             | A
| ------------- | ---
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #12478, #15857
| License       | MIT
| Doc PR        |

Inside scalar blocks, lines starting with a `#` character must be
treated like every other strings and must not be ignored as comments.

Commits
-------

3c72fcc [Yaml] do not remove "comments" in scalar blocks
@fabpot fabpot closed this as completed Dec 18, 2015
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

5 participants
2A77
0