ID: 38590 User updated by: mark-phpbugs at vectrex dot org dot uk Reported By: mark-phpbugs at vectrex dot org dot uk -Status: Feedback +Status: Closed Bug Type: PDO related Operating System: Linux PHP Version: 5.1.5 New Comment:
I think this is caused by the MySQL client library and server being (somewhat) incompatible versions. I've upgraded the MySQL client and server to 5.0.24 and the problem has gone away. Previous Comments: ------------------------------------------------------------------------ [2006-08-25 08:47:21] [EMAIL PROTECTED] 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 Can't reproduce both with 5.2 and 5.1.5. ------------------------------------------------------------------------ [2006-08-25 08:37:28] mark-phpbug at vectrex dot org dot uk Using MySQL 5.0.20 and PDO Driver for MySQL, client library version 5.0.22 ------------------------------------------------------------------------ [2006-08-25 08:33:40] mark-phpbugs at vectrex dot org dot uk Description: ------------ When selecting from a FLOAT column, PDO returns garbage instead of the right value. Tested in PHP 5.1.2 and 5.1.6; both fail in similar ways. Reproduce code: --------------- <?php error_reporting(E_ALL); $db = new PDO("mysql:host=localhost;dbname=test", 'root', '', array()); $db->setAttribute(PDO::ATTR_ERRMODE,PDO::ERRMODE_EXCEPTION); $db->exec("CREATE TEMPORARY TABLE test ( num FLOAT NOT NULL)"); $db->exec("INSERT INTO test VALUES (1.5)"); $st = $db->query("SELECT * FROM test"); $row = $st->fetch(PDO::FETCH_ASSOC); var_dump($row); ?> Expected result: ---------------- array(1) { ["num"]=> string(12) "1.5" } Actual result: -------------- array(1) { ["num"]=> string(12) "-2.87989e-05" } Also other incorrect values; it seems nondeterministic. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=38590&edit=1