Skip to content

\Magento\Framework\Phrase\Renderer\Placeholder::render() can't handle more than 9 placeholders #1374

Closed
@riconeitzel

Description

@riconeitzel

Using the code fragment

<?= 
__(
    '%1<br>%2<br>%3<br>%4<br>%5<br>%6<br>%7<br>%8<br>%9<br>%10',
    'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'ten'
); 
?>

in a phtml file will result in the following wrong output:

one
two
three
four
five
six
seven
eight
nine
one0

because Placeholder Renderer uses str_replace which replaces %10 in the first place.

Question: What exactly was wrong with the old sprintf rendering?!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue: Ready for WorkGate 4. Acknowledged. Issue is added to backlog and ready for developmentbug report

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions