#25246 [NEW]: broken locale support for decimal_point
| From: | david at boe dot es | Date: | Tue, 26 Aug 2003 10:04:05 +0000 |
| Subject: | #25246 [NEW]: broken locale support for decimal_point | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-46653@lists.php.net to get a copy of this message | ||
From: david at boe dot es
Operating system: linux
PHP version: 4.3.2
PHP Bug Type: Scripting Engine problem
Bug description: broken locale support for decimal_point
Description:
------------
As stated in http://bugs.php.net/bug.php?id=17079
and
http://news.php.net/article.php?group=php.dev&article=95211
, PHP always
resets decimal_point to "." besides your locale "decimal_point".
This breaks backward compatibility, at least with PHP 4.2.3
This is BAD as long as we use na Oracle database with
NLS_LANG=Spanish_Spain.WE8ISO8859P1 , needed to output regional chars like
ñ and áéíóú. This means that all operations with numerical values returned
by a database query (decimal part separated by ',') are broken now.
In my linux:
[root@farm2 root]# export LANG=es_ES
[root@farm2 root]# locale -k decimal_point
decimal_point=","
The script:
<?php
setlocale(LC_ALL, 'es_ES');
$locale_info = localeconv();
echo "decimal_point: {$locale_info["decimal_point"]}\n";
$value1="1.5";
$value2="1,5";
$res1=$value1*1;
$res2=$value2*1;
echo "Res 1 : $res1 \n";
echo "Res 2 : $res2 \n";
?>
outputs:
decimal_point: .
Res 1 : 1,5
Res 2 : 1
Reproduce code:
---------------
In my linux:
[root@farm2 root]# export LANG=es_ES
[root@farm2 root]# locale -k decimal_point
decimal_point=","
The script:
<?php
setlocale(LC_ALL, 'es_ES');
$locale_info = localeconv();
echo "decimal_point: {$locale_info["decimal_point"]}\n";
$value1="1.5";
$value2="1,5";
$res1=$value1*1;
$res2=$value2*1;
echo "Res 1 : $res1 \n";
echo "Res 2 : $res2 \n";
?>
outputs:
decimal_point: .
Res 1 : 1,5
Res 2 : 1
--
Edit bug report at http://bugs.php.net/?id=25246&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=25246&r=trysnapshot4
Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=25246&r=trysnapshot5
Fixed in CVS: http://bugs.php.net/fix.php?id=25246&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=25246&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=25246&r=needtrace
Try newer version: http://bugs.php.net/fix.php?id=25246&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=25246&r=support
Expected behavior: http://bugs.php.net/fix.php?id=25246&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=25246&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=25246&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=25246&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=25246&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=25246&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=25246&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=25246&r=gnused