Doc #76880 [Opn->Ver]: Documentation shows case that cannot be used
| From: | cmb@php.net | Date: | Fri, 14 Sep 2018 10:51:47 +0000 |
| Subject: | Doc #76880 [Opn->Ver]: Documentation shows case that cannot be used | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-15993@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=76880&edit=1
ID: 76880
Updated by: cmb@php.net
Reported by: kaisa dot lehikoinen at bromangroup dot fi
Summary: Documentation shows case that cannot be used
-Status: Open
+Status: Verified
Type: Documentation Problem
-Package: *Languages/Translation
+Package: intl
PHP Version: 7.2.10
Block user comment: N
Private report: N
New Comment:
Confirmed: <https://3v4l.org/8oJsn>.
Previous Comments:
------------------------------------------------------------------------
[2018-09-14 08:47:16] 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}!
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=76880&edit=1