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
 [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-2019 The PHP Group
All rights reserved.
Last updated: Sun Dec 08 08:01:24 2019 UTC