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