php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #65920 MessageFormatter replaces pattern placeholder with {0} when no args provided
Submitted: 2013-10-16 20:33 UTC Modified: 2016-04-11 13:20 UTC
Votes:3
Avg. Score:3.0 ± 0.0
Reproduced:3 of 3 (100.0%)
Same Version:1 (33.3%)
Same OS:2 (66.7%)
From: sam at rmcreative dot ru Assigned: ab (profile)
Status: Closed Package: intl (PECL)
PHP Version: 5.5.4 OS: All
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
36 - 13 = ?
Subscribe to this entry?

 
 [2013-10-16 20:33 UTC] sam at rmcreative dot ru
Description:
------------
When no parameters are supplied to MessageFormatter::formatMessage or $messageFormatter->format all placeholders are replaced with {0}. If at least one argument is supplied it works as expected.

Test script:
---------------
$pattern = 'Let us do {test} now!';
echo MessageFormatter::formatMessage('en_US', $pattern, array());

$formatter = new MessageFormatter('en_US', $pattern);
echo $formatter->format(array());

Expected result:
----------------
Let us do {test} now!

Actual result:
--------------
Let us do {0} now!

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2016-04-11 13:20 UTC] ab@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: ab
 [2016-04-11 13:20 UTC] ab@php.net
I don't reproduce this with the latest versions of PHP 5 or 7 and latest ICU. 5.5 can receive security patches only. Thus, marking as fixed.

Thanks.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Apr 24 02:01:30 2024 UTC