1--TEST--
2PDO MySQL PECL Bug #5802 (bindParam/bindValue retain the is_null flag)
3--EXTENSIONS--
4pdo
5pdo_mysql
6--SKIPIF--
7<?php
8require __DIR__ . '/config.inc';
9require __DIR__ . '/../../../ext/pdo/tests/pdo_test.inc';
10PDOTest::skip();
11?>
12--FILE--
13<?php
14require __DIR__ . '/../../../ext/pdo/tests/pdo_test.inc';
15$db = PDOTest::test_factory(__DIR__. '/common.phpt');
16
17$db->exec('create table test ( bar char(3) NULL )');
18$stmt = $db->prepare('insert into test (bar) values(:bar)') or var_dump($db->errorInfo());
19
20$bar = 'foo';
21$stmt->bindParam(':bar', $bar);
22$stmt->execute() or var_dump($stmt->errorInfo());
23
24$bar = null;
25$stmt->bindParam(':bar', $bar);
26$stmt->execute() or var_dump($stmt->errorInfo());
27
28$bar = 'qaz';
29$stmt->bindParam(':bar', $bar);
30$stmt->execute() or var_dump($stmt->errorInfo());
31
32$stmt = $db->prepare('select * from test') or var_dump($db->errorInfo());
33
34if($stmt) $stmt->execute();
35if($stmt) var_dump($stmt->fetchAll(PDO::FETCH_ASSOC));
36
37print "done!";
38?>
39--CLEAN--
40<?php
41require __DIR__ . '/mysql_pdo_test.inc';
42$db = MySQLPDOTest::factory();
43$db->exec('DROP TABLE IF EXISTS test');
44?>
45--EXPECT--
46array(3) {
47  [0]=>
48  array(1) {
49    ["bar"]=>
50    string(3) "foo"
51  }
52  [1]=>
53  array(1) {
54    ["bar"]=>
55    NULL
56  }
57  [2]=>
58  array(1) {
59    ["bar"]=>
60    string(3) "qaz"
61  }
62}
63done!
64