From: walterquez at yahoo dot com Operating system: Windows 2003 PHP version: 5.2.6 PHP Bug Type: Strings related Bug description: Number in string conversion with comma separator
Description: ------------ When numbers in a string containing comma separators are converted to any numeric type, it strips any number to the right of the commas. Reproduce code: --------------- <?php $a = '200'; $b = '1,000'; if ($a > $b) echo 'A is bigger'; else echo 'B is bigger'; ?> For some reason, because $b has a comma, it converts $b to 1, not 1000. If you remove the comma, it works fine. To prove it, check the following. $b = (int) $b; // same with (float), (double) or (real) echo $b; // it prints 1, not 1000. I even included, setlocale(LC_ALL, 'en'); but no luck. Expected result: ---------------- B is bigger Actual result: -------------- A is bigger -- Edit bug report at http://bugs.php.net/?id=45221&edit=1 -- Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=45221&r=trysnapshot52 Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=45221&r=trysnapshot53 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=45221&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=45221&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=45221&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=45221&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=45221&r=needscript Try newer version: http://bugs.php.net/fix.php?id=45221&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=45221&r=support Expected behavior: http://bugs.php.net/fix.php?id=45221&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=45221&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=45221&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=45221&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=45221&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=45221&r=dst IIS Stability: http://bugs.php.net/fix.php?id=45221&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=45221&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=45221&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=45221&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=45221&r=mysqlcfg