#31026 [Opn->Csd]: Problem with type conversion
ID: 31026
Updated by: sniper@php.net
Reported By: tobi at knmm dot de
-Status: Open
+Status: Closed
Bug Type: Variables related
Operating System: Linux 2.6.8 (Debian sarge)
PHP Version: 4.3.10RC3-dev
New Comment:
Fixed -> closed.
Previous Comments:
------------------------------------------------------------------------
[2004-12-18 00:52:23] tobi at knmm dot de
Now, with the CVS version the script says '34,9' instead of 34.9 (with
4.3.9 it was only '34').
This solves my problem, which was that calculations with variables,
type-converted from string to float had gone wrong sometimes.
But it's still very strange.
I figured out that the problem only occurrs if the apache webserver
with php on it already ran for a few hours.
------------------------------------------------------------------------
[2004-12-08 21:37:43] derick@php.net
Please try using this CVS snapshot:
http://snaps.php.net/php4-STABLE-latest.tar.gz
For Windows:
http://snaps.php.net/win32/php4-win32-STABLE-latest.zip
------------------------------------------------------------------------
[2004-12-08 20:37:49] tobi at knmm dot de
Description:
------------
A very strange problem occurs on my webserver. If you run the provided
code via http://knmm.de/bug.php a few times, in about 1 out of
10 times
the second line of output is "$price is a double with value 34". This
shows up randomly.
Running the script on the commandline of the same machine doesn't show
this behaviour.
--
Tobi
Reproduce code:
---------------
$price = '34.90';
echo "\$price is a ".gettype($price)." with value $price\n";
settype($price,'double');
echo "\$price is a ".gettype($price)." with value $price\n";
(also available via http://knmm.de/bug.phps)
Expected result:
----------------
$price is a string with value 34.90
$price is a double with value 34.9
Actual result:
--------------
$price is a string with value 34.90
$price is a double with value 34
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=31026&edit=1
Thread (5 messages)