Re: Bug #14349: UTF8_ENCODE conflicts with Type Juggling

From: Date: Wed, 05 Dec 2001 22:00:26 +0000
Subject: Re: Bug #14349: UTF8_ENCODE conflicts with Type Juggling
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-72676@lists.php.net to get a copy of this message
I cannot reproduce with 4.1.0RC5 and 4.2.0-dev (cgi). I suggest to test against 4.1.0RC5 http://www.php.net/~zeev and 4.2.0-dev http://snaps.php.net Regards, -- Yasuo Ohgaki ruud@stress.utwente.nl wrote:
From:             ruud@stress.utwente.nl
Operating system: Debian GNU/Linux 2.2
PHP version:      4.0.6
PHP Bug Type:     XML related
Bug description: UTF8_ENCODE conflicts with Type Juggling 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.
-- Yasuo Ohgaki

« previous php.dev (#72676) next »