From: mark dot j dot wade at googlemail dot com Operating system: PHP version: 5.2.10 PHP Bug Type: Strings related Bug description: number_format returns invalid character with some charsets
Description: ------------ number_format will only accept a single character for the thousands separator and deliberately shortens longer input to one character. However, for some charsets (ru_RU.UTF8 was the one I discovered this on) the thousands separator as returned by localeconv is more than one character. Normally, this wouldn't be a problem, however, it seems when PHP tries to shorten this particular value to one character, it creates an invalid character and returns something like demonstrated in the reproduce code. Reproduce code: --------------- setlocale( L_ALL, 'ru_RU.UTF8' ); $locale = localeconv(); echo number_format( 9999, 0, $locale['decimal_point'], $locale['thousands_sep'] ); Expected result: ---------------- 9 999 Actual result: -------------- 9?999 -- Edit bug report at http://bugs.php.net/?id=49398&edit=1 -- Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=49398&r=trysnapshot52 Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=49398&r=trysnapshot53 Try a snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=49398&r=trysnapshot60 Fixed in SVN: http://bugs.php.net/fix.php?id=49398&r=fixed Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=49398&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=49398&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=49398&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=49398&r=needscript Try newer version: http://bugs.php.net/fix.php?id=49398&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=49398&r=support Expected behavior: http://bugs.php.net/fix.php?id=49398&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=49398&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=49398&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=49398&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=49398&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=49398&r=dst IIS Stability: http://bugs.php.net/fix.php?id=49398&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=49398&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=49398&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=49398&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=49398&r=mysqlcfg
