1--TEST--
2mysqli fetch bigint values (ok to fail with 4.1.x)
3--EXTENSIONS--
4mysqli
5--SKIPIF--
6<?php
7if (PHP_INT_SIZE == 8) {
8    echo 'skip test valid only for 32bit systems';
9    exit;
10}
11require_once dirname(__DIR__) . "/test_setup/test_helpers.inc";
12mysqli_check_skip_test();
13?>
14--FILE--
15<?php
16require_once dirname(__DIR__) . "/test_setup/test_helpers.inc";
17
18$link = default_mysqli_connect();
19
20// To get consistent result without depending on the DB version/setup
21mysqli_query($link, "SET sql_mode=''");
22
23mysqli_query(
24    $link,
25    "CREATE TABLE test_bind_fetch_integers_big(
26        c1 bigint default 5,
27        c2 bigint,
28        c3 bigint not NULL,
29        c4 bigint unsigned,
30        c5 bigint unsigned,
31        c6 bigint unsigned,
32        c7 bigint unsigned,
33        c8 bigint unsigned
34    ) ENGINE=" . get_default_db_engine()
35);
36
37mysqli_query($link, "INSERT INTO test_bind_fetch_integers_big (c2,c3,c4,c5,c6,c7,c8)
38    VALUES (-23,4.0,33333333333333,0,-333333333333,99.9,1234)");
39
40$stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch_integers_big");
41mysqli_stmt_bind_result($stmt, $c1, $c2, $c3, $c4, $c5, $c6, $c7, $c8);
42mysqli_stmt_execute($stmt);
43mysqli_stmt_fetch($stmt);
44
45$c8 = 4567;// change this to test how mysqli/mysqlnd handles is_ref changing
46$test = array($c1,$c2,$c3,$c4,$c5,$c6,$c7,$c8);
47
48var_dump($test);
49
50mysqli_stmt_close($stmt);
51mysqli_close($link);
52print "done!";
53?>
54--CLEAN--
55<?php
56require_once dirname(__DIR__) . "/test_setup/test_helpers.inc";
57tear_down_table_on_default_connection('test_bind_fetch_integers_big');
58?>
59--EXPECT--
60array(8) {
61  [0]=>
62  int(5)
63  [1]=>
64  int(-23)
65  [2]=>
66  int(4)
67  [3]=>
68  string(14) "33333333333333"
69  [4]=>
70  int(0)
71  [5]=>
72  int(0)
73  [6]=>
74  int(100)
75  [7]=>
76  int(4567)
77}
78done!
79