xref: /php-src/ext/pdo_mysql/tests/bug79596.phpt (revision 4bb75d56)
1--TEST--
2Bug #79596 (MySQL FLOAT truncates to int some locales)
3--EXTENSIONS--
4pdo_mysql
5--SKIPIF--
6<?php
7require_once __DIR__ . '/inc/mysql_pdo_test.inc';
8MySQLPDOTest::skip();
9MySQLPDOTest::skipNotMySQLnd('skip libmysql returns result as string');
10if (!setlocale(LC_ALL, 'de_DE', 'de-DE')) die('skip German locale not available');
11?>
12--FILE--
13<?php
14require_once __DIR__ . '/inc/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__ . '/inc/mysql_pdo_test.inc';
27$pdo = MySQLPDOTest::factory();
28$pdo->exec("DROP TABLE IF EXISTS bug79596");
29?>
30--EXPECT--
31float(4.9)
32