Skip to content

Yaml dumper unquotes string when using an ideographic space #39767

@jasonvarga

Description

@jasonvarga

Symfony version(s) affected: 5.2.1

Description

When the Yaml dumper encounters an ideographic space, the whole string becomes unquoted.

How to reproduce

Here's a unit test to go in src/Symfony/Component/Yaml/Tests/DumperTest.php.

public function testDumpIdeographicSpaces()
{
    $this->assertSame("{ alone: ' ', within_string: 'a b', regular_space: 'a b' }", $this->dumper->dump([
        'alone' => ' ',
        'within_string' => 'a b',
        'regular_space' => 'a b',
    ]));
}
Failed asserting that two strings are identical.
--- Expected
+++ Actual
@@ @@
-'{ alone: ' ', within_string: 'a b', regular_space: 'a b' }'
+'{ alone:  , within_string: a b, regular_space: 'a b' }'

Thanks!

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