ID: 14349
Updated by: yohgaki
Reported By: [EMAIL PROTECTED]
Old Status: Open
Status: Closed
Bug Type: XML related
Operating System: Debian GNU/Linux 2.2
PHP Version: 4.0.6
New Comment:

User reported fixed in 4.1.0.
Closed

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

[2001-12-05 13:06:16] [EMAIL PROTECTED]

The problem does not occur "always" and probably not on the first "run" of the script. 
So if you just run the script one time, everything might look good. Try to reload the 
script many times to see the bug. It seems like a heavy system load exploits the bug.

I reproduced the bug on five different (i386) systems with Linux, running different 
versions of the Linux Kernel and Apache, using versions of PHP ranging from 4.0.3 to 
4.0.6. The bug occurs on every system.

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

[2001-12-05 08:47:23] [EMAIL PROTECTED]

Hi,

Please take a look at this PHP script.

<?php

for($j=0; $j<1000; $j++) {
  $result=71.95;
  $price=utf8_encode($result);
  $price = $price * 2.2 / 2.2;
  echo "$price<br>\n";

}

?>

This script should just output 1000x exactly the same but as you can see, the script 
sometimes returns "71" instead of "71.95".

Seems to have to do something with type juggling. If we explecitly cast price to a 
float, ["$price=(float)utf8_encode($result);"] the script returns only the correct 
value.

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



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


-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to