xref: /PHP-8.3/ext/pdo/tests/bug_39398.phpt (revision 74859783)
1--TEST--
2PDO Common: Bug #39398 (Booleans are not automatically translated to integers)
3--EXTENSIONS--
4pdo
5--SKIPIF--
6<?php
7$dir = getenv('REDIR_TEST_DIR');
8if (false == $dir) die('skip no driver');
9require_once $dir . 'pdo_test.inc';
10PDOTest::skip();
11?>
12--FILE--
13<?php
14if (getenv('REDIR_TEST_DIR') === false) putenv('REDIR_TEST_DIR='.__DIR__ . '/../../pdo/tests/');
15require_once getenv('REDIR_TEST_DIR') . 'pdo_test.inc';
16
17$db = PDOTest::factory();
18$db->exec("CREATE TABLE test (test INT)");
19
20$boolean = 1;
21$stmt = $db->prepare('INSERT INTO test VALUES (:boolean)');
22$stmt->bindValue(':boolean', isset($boolean), PDO::PARAM_INT);
23$stmt->execute();
24
25var_dump($db->query("SELECT * FROM test")->fetchAll(PDO::FETCH_ASSOC));
26?>
27--EXPECT--
28array(1) {
29  [0]=>
30  array(1) {
31    ["test"]=>
32    string(1) "1"
33  }
34}
35