From: sehh at altered dot com Operating system: Fedora Core Linux PHP version: 5.2.0 PHP Bug Type: Math related Bug description: is_numeric with currency values
Description: ------------ The function is_numeric() fails when the input is a value with thousand and decimal separators. For example: 4.000,56 or 4,000.56. We had a short discussion about this in #php irc channel and found out the following: "4,000.56" = is USA notation "4.000,56" = is European notation They are perfectly valid numeric values, used in currency/weight/cubic centimeters/etc. Suggested solutions: 1) Both notations should be accepted. 2) Only one notation should be accepted and PHP will decide which one, based on the Locale of the server/setup. Any other suggestion is welcome. Reproduce code: --------------- Reproduction code: <?php $dolars = "4,000.56"; $euros = "4.000,56"; $rc = is_numeric($dolars); var_dump($rc); $rc = is_numeric($euros); var_dump($rc); ?> Expected result: ---------------- is_numeric should have returned TRUE in both cases. Actual result: -------------- is_numeric returns false for both. -- Edit bug report at http://bugs.php.net/?id=40174&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=40174&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=40174&r=trysnapshot52 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=40174&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=40174&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=40174&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=40174&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=40174&r=needscript Try newer version: http://bugs.php.net/fix.php?id=40174&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=40174&r=support Expected behavior: http://bugs.php.net/fix.php?id=40174&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=40174&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=40174&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=40174&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=40174&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=40174&r=dst IIS Stability: http://bugs.php.net/fix.php?id=40174&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=40174&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=40174&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=40174&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=40174&r=mysqlcfg