ID:               17079
 Comment by:       [EMAIL PROTECTED]
 Reported By:      [EMAIL PROTECTED]
 Status:           Closed
 Bug Type:         *Languages/Translation
 Operating System: Red Hat Linux 7.1
 PHP Version:      4.1.2
 Assigned To:      hholzgra
 New Comment:

This bug seems to be still available. Ąt least i can reproduce it with
4.3.0RC2 on Windows 2000 with locale set to 'ru'. 

<?php
setlocale (LC_ALL, 'en');
echo ('1.123'*'5').'<br>';
echo ('1,123'*'5').'<br>';
setlocale (LC_ALL, 'ru');
echo ('1.123'*'5').'<br>';
echo ('1,123'*'5').'<br>';
?>

Results are:
5.615
5
5
5,615


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

[2002-10-10 11:53:59] [EMAIL PROTECTED]

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.



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

[2002-08-28 21:14:36] [EMAIL PROTECTED]

one more locale bug..


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

[2002-05-23 10:44:35] [EMAIL PROTECTED]

I didn't hear anything anymore, so I am just curious if this was picked
up... Thanks, Jonathan

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

[2002-05-08 04:14:04] [EMAIL PROTECTED]

Hi somehow it has to do with converting 'numberic'-strings to floats as
the script below shows:

<?

$rate1 = 1.123;
$amount1 = 5;
$rate2 = "1.123";
$amount2 = "5";

// set locale to English to handle the floatingpoints correctly
// first calculation with floats
setlocale (LC_ALL, 'en_US');
echo "This should be correct:<br><br>";
echo $rate1." * ".$amount1." = ".($rate1*$amount1);

// second calculation with floats converted from strings
echo "<br><br>This should be correct as well:<br><br>";
echo $rate2." * ".$amount2." = ".($rate2*$amount2);


// set locale to Dutch to show misbehaviour
// first calculation with floats
setlocale (LC_ALL, 'nl_NL');
echo "<br><br>This should still be correct:<br><br>";
echo $rate1." * ".$amount1." = ".($rate1*$amount1);

// second calculation with floats converted from strings
echo "<br><br>This should be wrong:<br><br>";
echo $rate2." * ".$amount2." = ".($rate2*$amount2);

?>

Hope this shows the 'bug' correctly!

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

[2002-05-07 14:36:57] [EMAIL PROTECTED]

This is dangerous indeed. We've had already reports about this (forgot
#, or did it even only came up on php-dev@?).

Though It may sound trivial, please provide a short self-contained
script showing the (mis-)behaviour.

Marking as critical for now.

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

The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
    http://bugs.php.net/17079

-- 
Edit this bug report at http://bugs.php.net/?id=17079&edit=1

Reply via email to