Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Symfony YAML parsing yaml results are incorrect #59299

Closed
@vibbow

Description

@vibbow

Symfony version(s) affected

7.2.0

Description

As demo below, there are 2 spaces between letter "A" and "B".
But Symfony Yaml only parsed as 1 space.

How to reproduce

<?php

include __DIR__ . '/vendor/autoload.php';

use Symfony\Component\Yaml\Yaml;

$payload = <<<EOF
names:
  - {name: A  B}
EOF;

// Using Symfony Yaml
$content1 = Yaml::parse($payload);
var_dump($content1['names'][0]['name']);
// string(3) "A B"

// Using yaml pecl extension
$content2 = yaml_parse($payload);
var_dump($content2['names'][0]['name']);
// string(4) "A  B"

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