1--TEST-- 2PDO MySQL Bug #41698 (float parameters truncated to integer in prepared statements) 3--SKIPIF-- 4<?php 5if (!extension_loaded('pdo') || !extension_loaded('pdo_mysql')) die('skip not loaded'); 6require dirname(__FILE__) . '/config.inc'; 7require dirname(__FILE__) . '/../../../ext/pdo/tests/pdo_test.inc'; 8PDOTest::skip(); 9?> 10--FILE-- 11<?php 12require dirname(__FILE__) . '/config.inc'; 13require dirname(__FILE__) . '/../../../ext/pdo/tests/pdo_test.inc'; 14$db = PDOTest::test_factory(dirname(__FILE__) . '/common.phpt'); 15 16setlocale(LC_ALL, "de","de_DE","de_DE.ISO8859-1","de_DE.ISO_8859-1","de_DE.UTF-8"); 17 18$db->exec('CREATE TABLE test(floatval DECIMAL(8,6))'); 19$db->exec('INSERT INTO test VALUES(2.34)'); 20$value=4.56; 21$stmt = $db->prepare('INSERT INTO test VALUES(?)'); 22$stmt->execute(array($value)); 23var_dump($db->query('SELECT * from test')->fetchAll(PDO::FETCH_ASSOC)); 24?> 25--EXPECTF-- 26array(2) { 27 [0]=> 28 array(1) { 29 ["floatval"]=> 30 string(8) "2.340000" 31 } 32 [1]=> 33 array(1) { 34 ["floatval"]=> 35 string(8) "4.560000" 36 } 37} 38