#17105 [Ana->Csd]: floating point numbers truncated due to locale
| From: | iliaa@php.net | Date: | Thu, 10 Oct 2002 16:53:55 +0000 |
| Subject: | #17105 [Ana->Csd]: floating point numbers truncated due to locale | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-22085@lists.php.net to get a copy of this message | ||
ID: 17105
Updated by: iliaa@php.net
Reported By: acm@tweakers.net
-Status: Analyzed
+Status: Closed
Bug Type: Scripting Engine problem
Operating System: multiple linux versions
PHP Version: 4.2.0
Assigned To: hholzgra
New Comment:
This bug has been fixed in CVS.
In case this was a PHP problem, snapshots of the sources are packaged
every three hours; this change will be in the next snapshot. You can
grab the snapshot at http://snaps.php.net/.
In case this was a documentation problem, the fix will show up soon at
http://www.php.net/manual/.
In case this was a PHP.net website problem, the change will show
up on the PHP.net site and on the mirror sites in short time.
Thank you for the report, and for helping us make PHP better.
Previous Comments:
------------------------------------------------------------------------
[2002-06-23 13:57:37] ludovic.langeNOSPAM@free.fr
Same problem with version 4.2.1
Setting the LC_NUMERIC locale category is enough to trigger (or
workaround) the bug :
Workaround :
$locale = setlocale( LC_NUMERIC, 0 );
setlocale( LC_NUMERIC, "C" );
// include / include_once / require / require_once...
setlocale( LC_NUMERIC, $locale );
unset( $locale );
------------------------------------------------------------------------
[2002-06-17 08:50:32] hholzgra@php.net
yet another setlocale() related issue :(
------------------------------------------------------------------------
[2002-05-08 18:42:32] acm@tweakers.net
Using the code below results into truncation of the floating point
numbers if the code is included after the setlocale call.
I saw some old reports of this problem, but the developers claimt to
have fixed this.
Tested it on 3 servers, one running php4.2.0 with apache 1.3.24 on
gentoo linux 1.1a, the second using apache-1.3.24 with php4.1.2 on
redhat 7.1 and the third running apache-1.3.24 with php4.1.2 on
slackware 7.
<?
include('class1.php');
$test = new class1();
setlocale(LC_ALL,"nl_NL");
$test = new class1();
include('class2.php');
$test = new class2();
?>
class1.php
<?
class class1
{
function class1()
{
$float = 1.1;
var_dump($float);
}
}
$float = 1.1;
var_dump($float);
?>
class2.php
<?
class class2
{
function class2()
{
$float = 1.1;
var_dump($float);
}
}
$float = 1.1;
var_dump($float);
?>
If you need any extra information, I'll supply you with that :)
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=17105&edit=1