Commit:    646c0e57387664f56dcf0a3aaa3e8305e887000d
Author:    Will Fitch <willfi...@php.net>         Tue, 25 Sep 2012 15:18:12 
-0400
Committer: David Soria Parra <d...@php.net>      Tue, 30 Oct 2012 14:32:22 +0100
Parents:   f0835c002d473a50d13d0fd7366224ffbd1431ab
Branches:  PHP-5.3 PHP-5.4 master

Link:       
http://git.php.net/?p=php-src.git;a=commitdiff;h=646c0e57387664f56dcf0a3aaa3e8305e887000d

Log:
Bug #62593 Updated to always treat zval by value

Bugs:
https://bugs.php.net/62593

Changed paths:
  M  ext/pdo_pgsql/pgsql_statement.c
  M  ext/pdo_pgsql/tests/bug62593.phpt


Diff:
diff --git a/ext/pdo_pgsql/pgsql_statement.c b/ext/pdo_pgsql/pgsql_statement.c
index e5c7032..b9df24a 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 3caf308..9ad5ff7 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


--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to