Skip to content

Inline yaml comments broken after recent commit #59378

@alexpott

Description

@alexpott

Symfony version(s) affected

6.4

Description

The yaml parser errors on inline comments after 8a3a57d

How to reproduce

Parse the following yaml before and after 8a3a57d

calls:
  # This is a temporary measure. JSON:API should not need to be aware of the Content Moderation module.
  - [setLatestRevisionCheck, ['@?access_check.latest_revision']] # This is only injected when the service is available.

using the following code:

use Symfony\Component\Yaml\Yaml;

$a = <<<YML
calls:
  # This is a temporary measure. JSON:API should not need to be aware of the Content Moderation module.
  - [setLatestRevisionCheck, ['@?access_check.latest_revision']] # This is only injected when the service is available.
YML;

dump(Yaml::parse($a));

before this will output:

^ array:1 [
  "calls" => array:1 [
    0 => array:2 [
      0 => "setLatestRevisionCheck"
      1 => array:1 [
        0 => "@?access_check.latest_revision"
      ]
    ]
  ]
]

after this will output

PHP Fatal error:  Uncaught Symfony\Component\Yaml\Exception\ParseException: Unexpected token "# This is only injected when the service is available." at line 3 (near "- [setLatestRevisionCheck, ['@?access_check.latest_revision']] # This is only injected when the service is available."). in /Volumes/dev/symfony/src/Symfony/Component/Yaml/Parser.php:1210

Possible Solution

No response

Additional Context

No response

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

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy