#33988 [NEW]: Locales - convert a string to float

From: Date: Wed, 03 Aug 2005 20:53:14 +0000
Subject: #33988 [NEW]: Locales - convert a string to float
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-82919@lists.php.net to get a copy of this message
From: tpc at klub dot chip dot pl Operating system: Linux / Windows PHP version: 4.3.11 PHP Bug Type: Feature/Change Request Bug description: Locales - convert a string to float Description: ------------ When I use locales and convert a string to float, I get a truncated value, eg: // comma as a decimal separator setlocale(LC_ALL,'pl_PL'); $b = "1,2"; $c = $b*2; echo $c; // php 4.2 >>> 2,4 // php >= 4.3 >>> 2 (without any warning) In php 4.2 (5.x) you used a strtod function. Now you use our zend_strtod function which ignores locales. This truncating should be reported as a warning. My suggest is: Zend/zend_strtod.c, line: 1290: if (c == ',') zend_error(E_WARNING, "Convert string to double: wrong decimal point, only . (truncate number %s)", s00); Thanks in advance for adding this feature in the new version. Expected result: ---------------- Loging warning or notice if lose precision. -- Edit bug report at http://bugs.php.net/?id=33988&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=33988&r=trysnapshot4 Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=33988&r=trysnapshot50 Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=33988&r=trysnapshot51 Fixed in CVS: http://bugs.php.net/fix.php?id=33988&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=33988&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=33988&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=33988&r=needscript Try newer version: http://bugs.php.net/fix.php?id=33988&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=33988&r=support Expected behavior: http://bugs.php.net/fix.php?id=33988&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=33988&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=33988&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=33988&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=33988&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=33988&r=dst IIS Stability: http://bugs.php.net/fix.php?id=33988&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=33988&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=33988&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=33988&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=33988&r=mysqlcfg

« previous php.bugs (#82919) next »