#31026 [NEW]: Problem with type conversion
| From: | tobi at knmm dot de | Date: | Wed, 08 Dec 2004 19:37:57 +0000 |
| Subject: | #31026 [NEW]: Problem with type conversion | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-69942@lists.php.net to get a copy of this message | ||
From: tobi at knmm dot de
Operating system: Linux 2.6.8 (Debian sarge)
PHP version: 4.3.9
PHP Bug Type: Variables related
Bug description: Problem with type conversion
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 bug report at http://bugs.php.net/?id=31026&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=31026&r=trysnapshot4
Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=31026&r=trysnapshot50
Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=31026&r=trysnapshot51
Fixed in CVS: http://bugs.php.net/fix.php?id=31026&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=31026&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=31026&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=31026&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=31026&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=31026&r=support
Expected behavior: http://bugs.php.net/fix.php?id=31026&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=31026&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=31026&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=31026&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=31026&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=31026&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=31026&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=31026&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=31026&r=float
MySQL Configuration Error: http://bugs.php.net/fix.php?id=31026&r=mysqlcfg