Skip to content

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

Closed
@jaytaph

Description

@jaytaph

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions