xref: /PHP-8.4/ext/mysqli/tests/gh7837.phpt (revision a21edc52)
1--TEST--
2Bug GH-7837 (large bigints may be truncated)
3--EXTENSIONS--
4mysqli
5--SKIPIF--
6<?php
7require_once 'skipifconnectfailure.inc';
8?>
9--FILE--
10<?php
11require_once 'connect.inc';
12
13$mysql = new mysqli($host, $user, $passwd, $db, $port, $socket);
14$mysql->options(MYSQLI_OPT_INT_AND_FLOAT_NATIVE, true);
15$mysql->query("DROP TABLE IF EXISTS test");
16$mysql->query("CREATE TABLE test (`ubigint` bigint unsigned NOT NULL) ENGINE=InnoDB");
17$mysql->query("INSERT INTO test (`ubigint`) VALUES (18446744073709551615)");
18$mysql->query("INSERT INTO test (`ubigint`) VALUES (9223372036854775808)");
19$mysql->query("INSERT INTO test (`ubigint`) VALUES (1)");
20$result = $mysql->query("SELECT ubigint FROM test");
21var_dump($result->fetch_all());
22?>
23--CLEAN--
24<?php
25require_once 'clean_table.inc';
26?>
27--EXPECT--
28array(3) {
29  [0]=>
30  array(1) {
31    [0]=>
32    string(20) "18446744073709551615"
33  }
34  [1]=>
35  array(1) {
36    [0]=>
37    string(19) "9223372036854775808"
38  }
39  [2]=>
40  array(1) {
41    [0]=>
42    int(1)
43  }
44}
45