xref: /PHP-8.4/ext/mysqli/tests/bug67983.phpt (revision a21edc52)
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';
8?>
9--FILE--
10<?php
11
12require_once 'connect.inc';
13
14$connection = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
15
16mysqli_options($connection, MYSQLI_OPT_INT_AND_FLOAT_NATIVE, true);
17
18mysqli_set_charset($connection, 'utf8');
19mysqli_query($connection, 'DROP TABLE IF EXISTS test');
20mysqli_query($connection, 'CREATE TABLE test (id BIT(8))');
21mysqli_query($connection, 'INSERT INTO test VALUES (0), (1), (42)');
22
23$res = mysqli_query($connection, 'SELECT * FROM test');
24
25while ($result = mysqli_fetch_assoc($res)) {
26    var_dump($result['id']);
27}
28
29?>
30--EXPECT--
31int(0)
32int(1)
33int(42)
34