]> granicus.if.org Git - php/commitdiff
Fixed bug #72028 (pg_query_params(): NULL converts to empty string)
authorXinchen Hui <laruence@gmail.com>
Sat, 16 Apr 2016 04:29:27 +0000 (21:29 -0700)
committerXinchen Hui <laruence@gmail.com>
Sat, 16 Apr 2016 04:29:27 +0000 (21:29 -0700)
I don't have a pgsql server by hand, so no test script, but the fix must
be right.

NEWS
ext/pgsql/pgsql.c

diff --git a/NEWS b/NEWS
index 20821fe0c0ed8cc0ca48d46070bb50d8519182db..493c6361d31c8bd00abddd41be5722c283974ae1 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -11,6 +11,8 @@ PHP                                                                        NEWS
     leads to fatal error). (Laruence)
 
 - Postgres:
+  . Fixed bug #72028 (pg_query_params(): NULL converts to empty string).
+    (Laruence)
   . Fixed bug #71062 (pg_convert() doesn't accept ISO 8601 for datatype
     timestamp). (denver at timothy dot io)
 
index 84a443e1b06050d241b6ad0067509f2694d9deef..c22a23eb02730ea1ffcc49a49ff9934704418a8b 100644 (file)
@@ -1968,7 +1968,7 @@ PHP_FUNCTION(pg_query_params)
                params = (char **)safe_emalloc(sizeof(char *), num_params, 0);
 
                ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(pv_param_arr), tmp) {
-
+                       ZVAL_DEREF(tmp);
                        if (Z_TYPE_P(tmp) == IS_NULL) {
                                params[i] = NULL;
                        } else {