summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorWez Furlong <wez@php.net>2005-10-29 02:41:50 +0000
committerWez Furlong <wez@php.net>2005-10-29 02:41:50 +0000
commitc28a9a4e5c602cba0b79b52fdb872813abda77e8 (patch)
tree57082daab5ce518552045bbaa2cb1642d47777cb /ext
parente0924b74510dc66f10093898697abdd7b4b7522d (diff)
downloadphp-git-c28a9a4e5c602cba0b79b52fdb872813abda77e8.tar.gz
Closes PECL Bug #5802
Diffstat (limited to 'ext')
-rwxr-xr-xext/pdo_mysql/mysql_statement.c1
-rw-r--r--ext/pdo_mysql/tests/pecl_bug_5802.phpt52
2 files changed, 53 insertions, 0 deletions
diff --git a/ext/pdo_mysql/mysql_statement.c b/ext/pdo_mysql/mysql_statement.c
index 7dc70a42ec..5842fdde32 100755
--- a/ext/pdo_mysql/mysql_statement.c
+++ b/ext/pdo_mysql/mysql_statement.c
@@ -311,6 +311,7 @@ static int pdo_mysql_stmt_param_hook(pdo_stmt_t *stmt, struct pdo_bound_param_da
case PDO_PARAM_EVT_EXEC_PRE:
b = (MYSQL_BIND*)param->driver_data;
+ *b->is_null = 0;
if (PDO_PARAM_TYPE(param->param_type) == PDO_PARAM_NULL ||
Z_TYPE_P(param->parameter) == IS_NULL) {
*b->is_null = 1;
diff --git a/ext/pdo_mysql/tests/pecl_bug_5802.phpt b/ext/pdo_mysql/tests/pecl_bug_5802.phpt
new file mode 100644
index 0000000000..70bd461635
--- /dev/null
+++ b/ext/pdo_mysql/tests/pecl_bug_5802.phpt
@@ -0,0 +1,52 @@
+--TEST--
+PDO MySQL PECL Bug #5802
+--SKIPIF--
+<?php # vim:ft=php:
+if (!extension_loaded('pdo') || !extension_loaded('pdo_mysql')) die('skip not loaded');
+require dirname(__FILE__) . '/config.inc';
+require dirname(__FILE__) . '/../../../ext/pdo/tests/pdo_test.inc';
+PDOTest::skip();
+?>
+--FILE--
+<?php
+require dirname(__FILE__) . '/../../../ext/pdo/tests/pdo_test.inc';
+$db = PDOTest::test_factory(dirname(__FILE__). '/common.phpt');
+
+$db->exec('create table test ( bar char(3) NULL )');
+$stmt = $db->prepare('insert into test (bar) values(:bar)') or var_dump($db->errorInfo());
+
+$bar = 'foo';
+$stmt->bindParam(':bar', $bar);
+$stmt->execute() or var_dump($stmt->errorInfo());
+
+$bar = null;
+$stmt->bindParam(':bar', $bar);
+$stmt->execute() or var_dump($stmt->errorInfo());
+
+$bar = 'qaz';
+$stmt->bindParam(':bar', $bar);
+$stmt->execute() or var_dump($stmt->errorInfo());
+
+$stmt = $db->prepare('select * from test') or var_dump($db->errorInfo());
+
+if($stmt) $stmt->execute();
+if($stmt) var_dump($stmt->fetchAll(PDO::FETCH_ASSOC));
+
+--EXPECT--
+array(3) {
+ [0]=>
+ array(1) {
+ ["bar"]=>
+ string(3) "foo"
+ }
+ [1]=>
+ array(1) {
+ ["bar"]=>
+ NULL
+ }
+ [2]=>
+ array(1) {
+ ["bar"]=>
+ string(3) "qaz"
+ }
+}