ID:               25246
 User updated by:  david at boe dot es
 Reported By:      david at boe dot es
 Status:           Bogus
 Bug Type:         Scripting Engine problem
 Operating System: linux
 PHP Version:      4.3.2
 New Comment:

Hi!

I'm sorry about the bogus status of my recent submission, but i think
that you are not carefully considering this problem. The problem was
not considered a bug sometime ago, but that doesn't mean it isn't.

I've read severak times the reasons you mention, and i think the
solution is not correct. The reason given a year ago was:

You should not use ',' to represent floats ALWAYS use '.' regardless
of
locale.

This is not a genuine reason, just because, databases returns their
values in locale format (1,5 instead of 1.5). There is not a workaround
solution for applications manipulating those values (maybe an oci8
function returning floats always with ".").

Please, consider this problem as a real one, because, it will make us
stick with older versions of php that respect the locale output
returned from Oracle.

Thanks for any help.

Yours,
David.


Previous Comments:
------------------------------------------------------------------------

[2003-08-26 05:08:05] [EMAIL PROTECTED]

For the same reason as stated before in the urls you gave.


------------------------------------------------------------------------

[2003-08-26 05:04:05] david at boe dot es

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:

[EMAIL PROTECTED] root]# export LANG=es_ES
[EMAIL PROTECTED] 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:

[EMAIL PROTECTED] root]# export LANG=es_ES
[EMAIL PROTECTED] 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 this bug report at http://bugs.php.net/?id=25246&edit=1

Reply via email to