1--TEST--
2Bug GH-7837 (large bigints may be truncated)
3--EXTENSIONS--
4pdo_mysql
5mysqlnd
6--SKIPIF--
7<?php
8require_once __DIR__ . '/inc/mysql_pdo_test.inc';
9MySQLPDOTest::skip();
10MySQLPDOTest::skipNotMySQLnd();
11?>
12--FILE--
13<?php
14require_once __DIR__ . '/inc/mysql_pdo_test.inc';
15$pdo = MySQLPDOTest::factory();
16
17$tbl = "unsigned_bigint_pdo_mysql";
18$pdo->query("CREATE TABLE $tbl (`ubigint` bigint unsigned NOT NULL) ENGINE=InnoDB");
19$pdo->query("INSERT INTO $tbl (`ubigint`) VALUES (18446744073709551615)");
20$pdo->query("INSERT INTO $tbl (`ubigint`) VALUES (9223372036854775808)");
21$pdo->query("INSERT INTO $tbl (`ubigint`) VALUES (1)");
22$result = $pdo->query("SELECT ubigint FROM $tbl")->fetchAll(PDO::FETCH_ASSOC);
23var_dump($result);
24?>
25--CLEAN--
26<?php
27require_once __DIR__ . '/inc/mysql_pdo_test.inc';
28$db = MySQLPDOTest::factory();
29$db->exec('DROP TABLE IF EXISTS unsigned_bigint_pdo_mysql');
30?>
31--EXPECT--
32array(3) {
33  [0]=>
34  array(1) {
35    ["ubigint"]=>
36    string(20) "18446744073709551615"
37  }
38  [1]=>
39  array(1) {
40    ["ubigint"]=>
41    string(19) "9223372036854775808"
42  }
43  [2]=>
44  array(1) {
45    ["ubigint"]=>
46    int(1)
47  }
48}
49