Bug #52042 [Nab->Csd]: Error creating MessageFormatter object with nested tags
| From: | danack@php.net | Date: | Tue, 16 Jun 2015 11:36:36 +0000 |
| Subject: | Bug #52042 [Nab->Csd]: Error creating MessageFormatter object with nested tags | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-193554@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=52042&edit=1
ID: 52042
Updated by: danack@php.net
Reported by: zabruska at tugamail dot pt
Summary: Error creating MessageFormatter object with nested
tags
-Status: Not a bug
+Status: Closed
Type: Bug
Package: *Languages/Translation
Operating System: Ubuntu 9.10
PHP Version: 5.3.2
Assigned To: stas
Block user comment: N
Private report: N
New Comment:
This is fixed in PHP 7.
Previous Comments:
------------------------------------------------------------------------
[2010-06-16 09:40:04] zabruska at tugamail dot pt
I can understand if msgfmt_create(...) or MessageFormatter::create(...) return NULL
on invalid patterns, but attempting to create any object using "new" should
throw an exception.
Imagine this:
class MyMessageFormatter {
function __construct($pattern) {
if($this->badPattern($pattern)) {
unset($this);
return null;
}
}
// ...
}
The above code makes no sense at all!!! PHP itself will compile the code, but will still
give me an object.
I insist that returning NULL from a constructor is a BUG, sorry...
------------------------------------------------------------------------
[2010-06-15 23:53:51] 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
------------------------------------------------------------------------
[2010-06-15 23:53:36] stas@php.net
Use quotes to quote { inside the format string, since { is a special char for message formats.
Like this:
$f1 = new MessageFormatter('en_US', '\'{\'what is wrong {0} with this
pattern ???\'}\'');
------------------------------------------------------------------------
[2010-06-11 08:15:19] mike@php.net
Constructors definitely should throw an Exception.
------------------------------------------------------------------------
[2010-06-11 01:56:48] zabruska at tugamail dot pt
Escaping the tags makes no difference either
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
https://bugs.php.net/bug.php?id=52042
--
Edit this bug report at https://bugs.php.net/bug.php?id=52042&edit=1