#35889 [NEW]: setlocale / Get money-field will remove the digits after the point/comma

From: Date: Tue, 03 Jan 2006 23:55:47 +0000
Subject: #35889 [NEW]: setlocale / Get money-field will remove the digits after the point/comma
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-91425@lists.php.net to get a copy of this message
From:             prohm at strato-rz dot de
Operating system: Linux
PHP version:      4.4.1
PHP Bug Type:     Sybase-ct (ctlib) related
Bug description:  setlocale / Get money-field will remove the digits after the point/comma

Description:
------------
When I set the locale to de_DE@euro at the start of the script and read a
money-value from the database, he remove all after the point, because
after the setlocal he match at a comma, but the database reply ever an
point.

I I make the setlocal(LC_ALL,"de_DE@euro") after the sybase_query, it work
fine.

Reproduce code:
---------------
  setlocale(LC_NUMERIC,"de_DE@euro");
  print "<pre>\n";
  $conn = sybase_connect(XXX,XXX,XXX");
  $sql = " select kosten from artikel";
  $result=sybase_query($sql,$conn);
  while (list($kosten) = sybase_fetch_row($result)) {
    echo sprintf("%.2f",$kosten)."\n";
  }
  print "</pre>\n";


Expected result:
----------------
0,00
0,00
0,69
0,99
0,99
0,99
0,99
0,99
1,99
5,99
5,99



Actual result:
--------------
0,00
0,00
0,00
0,00
0,00
0,00
0,00
0,00
1,00
5,00
5,00


-- 
Edit bug report at http://bugs.php.net/?id=35889&edit=1
-- 
Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=35889&r=trysnapshot44
Try a CVS snapshot (PHP 5.1): http://bugs.php.net/fix.php?id=35889&r=trysnapshot51
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=35889&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=35889&r=fixedcvs
Fixed in release:             http://bugs.php.net/fix.php?id=35889&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=35889&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=35889&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=35889&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=35889&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=35889&r=notwrong
Not enough info:              http://bugs.php.net/fix.php?id=35889&r=notenoughinfo
Submitted twice:              http://bugs.php.net/fix.php?id=35889&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=35889&r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=35889&r=php3
Daylight Savings:             http://bugs.php.net/fix.php?id=35889&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=35889&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=35889&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=35889&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=35889&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=35889&r=mysqlcfg


Thread (2 messages)

« previous php.bugs (#91425) next »