[php-src] Issue #14489: msgfmt_format_message() can't parses body contains a key starting with &
| From: | erickmcarvalho | Date: | Thu, 06 Jun 2024 15:56:32 +0000 |
| Subject: | [php-src] Issue #14489: msgfmt_format_message() can't parses body contains a key starting with & | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-247048@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/14489
Author: erickmcarvalho
### Description
## Description
Hello everyone.
We noticed the intl message formatter couldn't parse a string containing keys (
{,
}) and then & character, e.g. blah blah blah {&foo} blah
blah blah.
Strings containing only keys, like {foo} it's okay, but when following any special
characters like #, $, %, &, @,
etc., isn't possible to parse it.
I'm not sure if it's an expected behavior, so if you guys can confirm to me if it's a
bug or it's ok, in this case, we should treat it on our codebase.
The following code:
```php
<?php
var_dump(MessageFormatter::formatMessage('en', '{&quality}"', []));
var_dump(MessageFormatter::formatMessage('en', '{@quality}"', []));
var_dump(MessageFormatter::formatMessage('en', '{#quality}"', []));
var_dump(MessageFormatter::formatMessage('en', '{$quality}"', []));
```
Resulted in this output:
```
bool(false)
bool(false)
bool(false)
bool(false)
```
But I expected this output instead:
```
string(10) "{&quality}""
string(10) "{@quality}""
string(10) "{#quality}""
string(10) "{$quality}""
```
Thanks.
### PHP Version
PHP 8.1.28
### Operating System
Docker php:8.1-fpm