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