ID: 28057
Updated by: [EMAIL PROTECTED]
Reported By: bublavas at ecetra dot com
-Status: Open
+Status: Analyzed
Bug Type: Strings related
Operating System: 2.4.21-9.EL GNU/Linux
PHP Version: 4.3.6
New Comment:
No, the problem is in setlocale().
When you set LC_NUMERIC or LC_ALL and the decimal point is not '.',
then LC_NUMERIC is set back to "C" again.
This hack is required for serialize() when handling floating point
numbers.
Previous Comments:
------------------------------------------------------------------------
[2004-04-19 14:28:22] bublavas at ecetra dot com
Description:
------------
nl_langinfo returns wrong values for THOUSEP and RADIXCHAR after
setting the locale to 'de_DE'. Using localeconv() returns the same
wrong values.
An equivalent C program returns correct results.
PHP 4.3.4 returns the same results as 4.3.6; executing the script from
the command line vs. using HTTP (Apache 2.0.48) makes no difference as
well.
Reproduce code:
---------------
if ( setlocale(LC_ALL, 'de_DE') )
{
echo "thousands separator: ", nl_langinfo(THOUSEP), "\n";
echo "decimal point: ", nl_langinfo(RADIXCHAR), "\n";
}
else
{
echo "cannot set locale to de_DE", "\n";
}
Expected result:
----------------
thousands separator: .
decimal point: ,
Actual result:
--------------
thousands separator:
decimal point: .
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=28057&edit=1