Bug #49161 [Nab->Csd]: Got null upon the MessageFormatter() class instantiation with empty pattern.
| From: | danack@php.net | Date: | Tue, 16 Jun 2015 11:37:01 +0000 |
| Subject: | Bug #49161 [Nab->Csd]: Got null upon the MessageFormatter() class instantiation with empty pattern. | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-193555@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=49161&edit=1
ID: 49161
Updated by: danack@php.net
Reported by: maximgb at yandex dot ru
Summary: Got null upon the MessageFormatter() class
instantiation with empty pattern.
-Status: Not a bug
+Status: Closed
Type: Bug
Package: *Languages/Translation
Operating System: *
PHP Version: 5.*, 6 (2009-08-05)
Assigned To: stas
Block user comment: N
Private report: N
New Comment:
This is fixed in PHP 7.
Previous Comments:
------------------------------------------------------------------------
[2009-08-10 18:40:32] maximgb at yandex dot ru
That's of course for you to decide, but as for me getting NULL as new
operator result is a bug.
------------------------------------------------------------------------
[2009-08-10 17:21:07] stas@php.net
BTW, you can use intl_get_error_message() to see what's wrong.
------------------------------------------------------------------------
[2009-08-10 17:20:06] stas@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
ICU considers empty patterns to be invalid, so we do so too.
------------------------------------------------------------------------
[2009-08-05 07:48:44] jani@php.net
Apparently you must pass it at least 1 char pattern. Empty string isn't one. Not sure if this
is intentional, Stas?
------------------------------------------------------------------------
[2009-08-05 00:29:02] maximgb at yandex dot ru
Description:
------------
I've tryed to create the MessageFormatter class, from intl extension,
passing an empty string for the constructor's second argument and I was
pretty surprised to get NULL instead of object instance :)
Reproduce code:
---------------
$f = new MessageFormatter(Locale::getDefault(), '');
var_dump($f, is_object($f));
$f = MessageFormatter::create(Locale::getDefault(), '');
var_dump($f, is_object($f));
Expected result:
----------------
object(MessageFormatter)#1 (0) {
}
bool(true)
object(MessageFormatter)#2 (0) {
}
bool(true)
Actual result:
--------------
NULL
bool(false)
NULL
bool(false)
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=49161&edit=1