xref: /php-src/ext/pdo_mysql/tests/bug75177.phpt (revision 4bb75d56)
1--TEST--
2PDO MySQL Bug #75177 Type 'bit' is fetched as unexpected string
3--EXTENSIONS--
4pdo_mysql
5--SKIPIF--
6<?php
7require_once __DIR__ . '/inc/mysql_pdo_test.inc';
8MySQLPDOTest::skip();
9MySQLPDOTest::skipNotMySQLnd();
10?>
11--FILE--
12<?php
13require_once __DIR__ . '/inc/mysql_pdo_test.inc';
14$pdo = MySQLPDOTest::factory();
15
16$pdo->query("CREATE TABLE test_75177 (`bit` BIT(8)) ENGINE=InnoDB");
17$pdo->query("INSERT INTO test_75177 (`bit`) VALUES (1), (0b011), (0b01100)");
18
19$pdo->setAttribute(PDO::ATTR_EMULATE_PREPARES, true);
20$ret = $pdo->query("SELECT * FROM test_75177")->fetchAll();
21foreach ($ret as $i) {
22    var_dump($i["bit"]);
23}
24
25$pdo->setAttribute(PDO::ATTR_EMULATE_PREPARES, false);
26$ret = $pdo->query("SELECT * FROM test_75177")->fetchAll();
27foreach ($ret as $i) {
28    var_dump($i["bit"]);
29}
30?>
31--CLEAN--
32<?php
33require_once __DIR__ . '/inc/mysql_pdo_test.inc';
34$db = MySQLPDOTest::factory();
35$db->exec('DROP TABLE IF EXISTS test_75177');
36?>
37--EXPECT--
38int(1)
39int(3)
40int(12)
41int(1)
42int(3)
43int(12)
44