xref: /PHP-8.0/ext/mysqli/tests/bug67983.phpt (revision 315f3f8d)
1--TEST--
2Bug #67983: mysqlnd with MYSQLI_OPT_INT_AND_FLOAT_NATIVE fails to interpret bit columns
3--SKIPIF--
4<?php
5require_once('skipif.inc');
6require_once('skipifconnectfailure.inc');
7if (!$IS_MYSQLND) {
8    die("skip mysqlnd only test");
9}
10?>
11--FILE--
12<?php
13
14require_once("connect.inc");
15
16$connection = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
17
18mysqli_options($connection, MYSQLI_OPT_INT_AND_FLOAT_NATIVE, true);
19
20mysqli_set_charset($connection, 'utf8');
21mysqli_query($connection, 'DROP TABLE IF EXISTS test');
22mysqli_query($connection, 'CREATE TABLE test (id BIT(8))');
23mysqli_query($connection, 'INSERT INTO test VALUES (0), (1), (42)');
24
25$res = mysqli_query($connection, 'SELECT * FROM test');
26
27while ($result = mysqli_fetch_assoc($res)) {
28    var_dump($result['id']);
29}
30
31?>
32--EXPECT--
33int(0)
34int(1)
35int(42)
36