[php-src] Issue #9421: ValueError: NumberFormatter::format(): Argument #3 must be a NumberFormatter::TYPE_* constant
| From: | bobmagicii | Date: | Wed, 24 Aug 2022 23:15:34 +0000 |
| Subject: | [php-src] Issue #9421: ValueError: NumberFormatter::format(): Argument #3 must be a NumberFormatter::TYPE_* constant | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-242304@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/9421
Author: bobmagicii
### Description
from the php manual
> public NumberFormatter::format(int|float $num, int $type = NumberFormatter::TYPE_DEFAULT):
> string|false
not quite sure about this mystical argument # 3.
```php
$Fmt = new NumberFormatter('en_US', NumberFormatter::CURRENCY);
var_dump($Fmt->format(1234.45, NumberFormatter::TYPE_CURRENCY));
```
Resulted in this output:
```
Output for 8.0.1 - 8.0.22, 8.1.0 - 8.1.9
Fatal error: Uncaught ValueError: NumberFormatter::format(): Argument #3 must be a
NumberFormatter::TYPE_* constant in /in/mc4XU:4
Stack trace:
#0 /in/mc4XU(4): NumberFormatter->format(1234.45, 4)
#1 {main}
thrown in /in/mc4XU on line 4
Process exited with code 255.
```
But I expected this output instead:
```
pretty much anything except saying it needs a third argument that isn't documented.
```
### PHP Version
PHP 8+
### Operating System
_No response_