Bug #79212 [NEW]: NumberFormatter::format() may detect wrong type
| From: | cmb@php.net | Date: | Sun, 02 Feb 2020 10:44:16 +0000 |
| Subject: | Bug #79212 [NEW]: NumberFormatter::format() may detect wrong type | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-225304@lists.php.net to get a copy of this message | ||
From: cmb
Operating system: *
PHP version: 7.3Git-2020-02-02 (Git)
Package: I18N and L10N related
Bug Type: Bug
Bug description:NumberFormatter::format() may detect wrong type
Description:
------------
If ::format() is called with ::TYPE_DEFAULT, but the value is an
object which implements cast to number, the type is erroneously
assumed to be ::TYPE_INT32.
This issue has been reported by googleguy@php.net in r11.
Test script:
---------------
<?php
$fmt = new NumberFormatter('en_US', NumberFormatter::SPELLOUT);
var_dump($fmt->format(gmp_init('823749273428379492374')));
?>
Expected result:
----------------
string(157) "eighteen quadrillion fourteen trillion three hundred
ninety-eight billion five hundred nine million four hundred eighty-one
thousand nine hundred eighty-four"
Actual result:
--------------
string(108) "minus one billion one hundred twenty-nine million four
hundred forty-seven thousand four hundred twenty-four"
--
Edit bug report at https://bugs.php.net/bug.php?id=79212&edit=1
--
Fix committed: https://bugs.php.net/fix.php?id=79212&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=79212&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=79212&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=79212&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=79212&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=79212&r=support
Expected behavior: https://bugs.php.net/fix.php?id=79212&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=79212&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=79212&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=79212&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=79212&r=phptooold
Daylight Savings: https://bugs.php.net/fix.php?id=79212&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=79212&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=79212&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=79212&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=79212&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=79212&r=mysqlcfg