php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #76880 Documentation shows case that cannot be used
Submitted: 2018-09-14 08:47 UTC Modified: 2018-09-14 11:45 UTC
From: kaisa dot lehikoinen at bromangroup dot fi Assigned: cmb (profile)
Status: Closed Package: intl (PECL)
PHP Version: 7.2.10 OS:
Private report: No CVE-ID: None
 [2018-09-14 08:47 UTC] kaisa dot lehikoinen at bromangroup dot fi
Description:
------------
---
From manual page: http://www.php.net/messageformatter.geterrorcode
---

The example error in documentation does not exist anymore (as of http://au1.php.net/manual/en/migration55.changed-functions.php). There is no possible way of catching the case when insufficient number of arguments is given with MessageFormatter

Test script:
---------------
$locale='fi_FI';
$pattern="{gender, select, female { Hello Missis {name}! } male { Hello Mister {name}! } other {Hello {name}!}}";
$params=array();
$MessageFormatter= new \MessageFormatter($locale, $pattern);
$phrase= $MessageFormatter->format($params);
if(!$phrase) { //this part does not catch insufficient  number of arguments error
$error=$MessageFormatter->getErrorMessage();
 echo 'error:'.$error;
}
return $phrase;


Expected result:
----------------
error: not enough parameters: U_ILLEGAL_ARGUMENT_ERROR (1)

Actual result:
--------------
Hello {name}!

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2018-09-14 10:51 UTC] cmb@php.net
-Status: Open +Status: Verified -Package: *Languages/Translation +Package: intl
 [2018-09-14 10:51 UTC] cmb@php.net
Confirmed: <https://3v4l.org/8oJsn>.
 [2018-09-14 11:44 UTC] cmb@php.net
Automatic comment from SVN on behalf of cmb
Revision: http://svn.php.net/viewvc/?view=revision&amp;revision=345633
Log: Fix #76880: Documentation shows case that cannot be used

The example is invalid as of PHP 5.5.0, so we remove it.
Anybody with a working example?
 [2018-09-14 11:45 UTC] cmb@php.net
-Status: Verified +Status: Closed -Assigned To: +Assigned To: cmb
 [2018-09-14 11:45 UTC] cmb@php.net
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.

Thank you for the report, and for helping us make our documentation better.
 [2020-02-07 06:05 UTC] phpdocbot@php.net
Automatic comment on behalf of cmb
Revision: http://git.php.net/?p=doc/en.git;a=commit;h=de9a87ad3f14a8dac161ed2997d227426b62ff4d
Log: Fix #76880: Documentation shows case that cannot be used
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 12:01:31 2024 UTC