#38099 [NEW]: Float values being munged

From: Date: Thu, 13 Jul 2006 16:11:36 +0000
Subject: #38099 [NEW]: Float values being munged
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-99418@lists.php.net to get a copy of this message
From: justin at superglobals dot com Operating system: Debian (sid) PHP version: 5.1.4 PHP Bug Type: PDO related Bug description: Float values being munged Description: ------------ Debian (sid) PHP 5.1.4-0.1 PDO 1.0.3 PDO_MYSQL 1.0.2 MySQL 5.0.22 When I fetch float values from a PDOStatement, the results are completely wrong. The mysql_*() functions work correctly however. Reproduce code: --------------- SQL: CREATE DATABASE pdo_error DEFAULT CHARACTER SET latin1 COLLATE latin1_general_ci; USE pdo_error; CREATE TABLE pdo_error ( test float(4,2) NOT NULL, test2 float(7,3) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci; INSERT INTO pdo_error VALUES (1.26, 2841.274); PHP: <?php $hostname = 'localhost'; $username = 'root'; $password = ''; $database = 'test'; $sql = "SELECT * FROM test"; $pdo = new PDO("mysql:host={$hostname};dbname={$database}", $username, $password); print_r($pdo->query($sql)->fetch(PDO::FETCH_ASSOC)); mysql_connect($hostname, $username, $password); mysql_select_db($database); print_r(mysql_fetch_assoc(mysql_query($sql))); ?> Expected result: ---------------- Array ( [test] => 1.26 [test2] => 2841.274 ) Array ( [test] => 1.26 [test2] => 2841.274 ) Actual result: -------------- Array ( [test] => 0.00 [test2] => 1.260 ) Array ( [test] => 1.26 [test2] => 2841.274 ) -- Edit bug report at http://bugs.php.net/?id=38099&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=38099&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=38099&r=trysnapshot52 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=38099&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=38099&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=38099&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=38099&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=38099&r=needscript Try newer version: http://bugs.php.net/fix.php?id=38099&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=38099&r=support Expected behavior: http://bugs.php.net/fix.php?id=38099&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=38099&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=38099&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=38099&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=38099&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=38099&r=dst IIS Stability: http://bugs.php.net/fix.php?id=38099&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=38099&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=38099&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=38099&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=38099&r=mysqlcfg

« previous php.bugs (#99418) next »