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