xref: /PHP-8.2/ext/pdo_mysql/tests/bug79596.phpt (revision b5a14e6c)
1--TEST--
2Bug #79596 (MySQL FLOAT truncates to int some locales)
3--EXTENSIONS--
4pdo_mysql
5--SKIPIF--
6<?php
7require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
8MySQLPDOTest::skip();
9if (!setlocale(LC_ALL, 'de_DE', 'de-DE')) die('skip German locale not available');
10if (!MySQLPDOTest::isPDOMySQLnd()) die('skip libmysql returns result as string');
11?>
12--FILE--
13<?php
14require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
15
16setlocale(LC_ALL, 'de_DE', 'de-DE');
17
18$pdo = MySQLPDOTest::factory();
19$pdo->setAttribute(\PDO::ATTR_EMULATE_PREPARES, false);
20$pdo->query('CREATE TABLE bug79596 (broken FLOAT(2,1))');
21$pdo->query('INSERT INTO bug79596 VALUES(4.9)');
22var_dump($pdo->query('SELECT broken FROM bug79596')->fetchColumn(0));
23?>
24--CLEAN--
25<?php
26require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
27
28$pdo = MySQLPDOTest::factory();
29$pdo->exec("DROP TABLE IF EXISTS bug79596");
30?>
31--EXPECT--
32float(4.9)
33