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