bug_41698.phpt 929 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. --TEST--
  2. PDO MySQL Bug #41698 (float parameters truncated to integer in prepared statements)
  3. --EXTENSIONS--
  4. pdo
  5. pdo_mysql
  6. --SKIPIF--
  7. <?php
  8. require __DIR__ . '/config.inc';
  9. require __DIR__ . '/../../../ext/pdo/tests/pdo_test.inc';
  10. PDOTest::skip();
  11. ?>
  12. --FILE--
  13. <?php
  14. require __DIR__ . '/config.inc';
  15. require __DIR__ . '/../../../ext/pdo/tests/pdo_test.inc';
  16. $db = PDOTest::test_factory(__DIR__ . '/common.phpt');
  17. setlocale(LC_ALL, "de","de_DE","de_DE.ISO8859-1","de_DE.ISO_8859-1","de_DE.UTF-8");
  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));
  23. var_dump($db->query('SELECT * from test')->fetchAll(PDO::FETCH_ASSOC));
  24. ?>
  25. --EXPECT--
  26. array(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. }