xref: /PHP-8.0/ext/pdo_mysql/tests/bug75177.phpt (revision f8d79582)
1--TEST--
2PDO MySQL Bug #75177 Type 'bit' is fetched as unexpected string
3--SKIPIF--
4<?php
5require_once(__DIR__ . DIRECTORY_SEPARATOR . 'skipif.inc');
6require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
7MySQLPDOTest::skip();
8?>
9--FILE--
10<?php
11require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
12$pdo = MySQLPDOTest::factory();
13
14$tbl = "tbl_bug75177";
15$pdo->query("DROP TABLE IF EXISTS $tbl");
16$pdo->query("CREATE TABLE $tbl (`bit` bit(8)) ENGINE=InnoDB");
17$pdo->query("INSERT INTO $tbl (`bit`) VALUES (1)");
18$pdo->query("INSERT INTO $tbl (`bit`) VALUES (0b011)");
19$pdo->query("INSERT INTO $tbl (`bit`) VALUES (0b01100)");
20
21$ret = $pdo->query("SELECT * FROM $tbl")->fetchAll();
22
23foreach ($ret as $i) {
24    var_dump($i["bit"]);
25}
26
27?>
28--EXPECT--
29string(1) "1"
30string(1) "3"
31string(2) "12"
32