summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ext/pdo_pgsql/pgsql_statement.c2
-rw-r--r--ext/pdo_pgsql/tests/bug62593.phpt11
2 files changed, 9 insertions, 4 deletions
diff --git a/ext/pdo_pgsql/pgsql_statement.c b/ext/pdo_pgsql/pgsql_statement.c
index e5c7032632..b9df24a09f 100644
--- a/ext/pdo_pgsql/pgsql_statement.c
+++ b/ext/pdo_pgsql/pgsql_statement.c
@@ -367,7 +367,7 @@ static int pgsql_stmt_param_hook(pdo_stmt_t *stmt, struct pdo_bound_param_data *
if (param->is_param) {
/* We need to manually convert to a pg native boolean value */
if (PDO_PARAM_TYPE(param->param_type) == PDO_PARAM_BOOL) {
- SEPARATE_ZVAL_IF_NOT_REF(&param->parameter);
+ SEPARATE_ZVAL(&param->parameter);
param->param_type = PDO_PARAM_STR;
ZVAL_STRINGL(param->parameter, Z_BVAL_P(param->parameter) ? "t" : "f", 1, 1);
}
diff --git a/ext/pdo_pgsql/tests/bug62593.phpt b/ext/pdo_pgsql/tests/bug62593.phpt
index 3caf30814a..9ad5ff7a0a 100644
--- a/ext/pdo_pgsql/tests/bug62593.phpt
+++ b/ext/pdo_pgsql/tests/bug62593.phpt
@@ -15,18 +15,22 @@ $db->setAttribute(PDO::ATTR_EMULATE_PREPARES, true);
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_SILENT);
$errors = array();
+$value = true;
$query = $db->prepare('SELECT :foo IS FALSE as val_is_false');
-$query->bindValue(':foo', true, PDO::PARAM_BOOL);
+$query->bindValue(':foo', $value, PDO::PARAM_BOOL);
$query->execute();
$errors[] = $query->errorInfo();
+var_dump($value);
$query->bindValue(':foo', 0, PDO::PARAM_BOOL);
$query->execute();
$errors[] = $query->errorInfo();
-$query->bindValue(':foo', false, PDO::PARAM_BOOL);
+$value = false;
+$query->bindParam(':foo', $value, PDO::PARAM_BOOL);
$query->execute();
$errors[] = $query->errorInfo();
+var_dump($value);
$expect = 'No errors found';
@@ -40,5 +44,6 @@ foreach ($errors as $error)
echo $expect;
?>
--EXPECTF--
-
+bool(true)
+bool(false)
No errors found