Bug #52042 [Asn->Bgs]: Error creating MessageFormatter object with nested tags
| From: | stas@php.net | Date: | Tue, 15 Jun 2010 21:53:52 +0000 |
| Subject: | Bug #52042 [Asn->Bgs]: Error creating MessageFormatter object with nested tags | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-151513@lists.php.net to get a copy of this message | ||
Edit report at http://bugs.php.net/bug.php?id=52042&edit=1
ID: 52042
Updated by: stas@php.net
Reported by: zabruska at tugamail dot pt
Summary: Error creating MessageFormatter object with nested
tags
-Status: Assigned
+Status: Bogus
Type: Bug
Package: *Languages/Translation
Operating System: Ubuntu 9.10
PHP Version: 5.3.2
Assigned To: stas
New Comment:
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
Previous Comments:
------------------------------------------------------------------------
[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
------------------------------------------------------------------------
[2010-06-11 01:52:14] zabruska at tugamail dot pt
Description:
------------
Calling msgfmt_create(...) or new MessageFormatter(...) with patterns
having nested tags will return null.
Apparently the same happens with empty patterns, but returning NULL from
an object constructor is a SERIOUS bug.
Test script:
---------------
$f1 = new MessageFormatter('en_US', '{what is wrong {0} with this
pattern ???}');
echo 'f1 is ', gettype($f1), PHP_EOL;
$f2 = MessageFormatter::create('en_US', '{what is wrong {0} with this
pattern ???}');
echo 'f2 is ', gettype($f2), PHP_EOL;
$f3 = msgfmt_create('en_US', '{what is wrong {0} with this pattern
???}');
echo 'f3 is ', gettype($f3), PHP_EOL;
Expected result:
----------------
f1 is object
f2 is object
f3 is object
Actual result:
--------------
f1 is NULL
f2 is NULL
f3 is NULL
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/bug.php?id=52042&edit=1