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