#38099 [Asn->Fbk]: Float values being munged

From: Date: Thu, 13 Jul 2006 16:19:01 +0000
Subject: #38099 [Asn->Fbk]: Float values being munged
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-99420@lists.php.net to get a copy of this message
ID: 38099 Updated by: tony2001@php.net Reported By: justin at superglobals dot com -Status: Assigned +Status: Feedback Bug Type: PDO related Operating System: Debian (sid) PHP Version: 5.1.4 Assigned To: iliaa New Comment: Please try using this CVS snapshot: http://snaps.php.net/php5.2-latest.tar.gz For Windows: http://snaps.php.net/win32/php5.2-win32-latest.zip Works fine here. Previous Comments: ------------------------------------------------------------------------ [2006-07-13 16:11:36] justin at superglobals dot com 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 this bug report at http://bugs.php.net/?id=38099&edit=1

« previous php.bugs (#99420) next »