Skip to content

Single quoting in MessageFormatter #17335

@naturefund-falk

Description

@naturefund-falk

Description

The following code:

<?php declare(strict_types=1);

$formatter = new \MessageFormatter('en', "Quoting problem '{replace}'\n");
echo $formatter->format(['replace' => 'REPLACEMENT']);

Resulted in this output:

Quoting problem {replace}

But I expected this output instead:

Quoting problem 'REPLACEMENT'

Whats also not working is "Quoting problem '{replace}\n"

It works with "Quoting problem {replace}'\n" or with no or double quotes.

PHP Version

PHP 8.2.26, ICU version 72.1

Operating System

Debian 12

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