]> granicus.if.org Git - php/commitdiff
Fixed bug #36812 (pg_execute() modifies input array).
authorIlia Alshanetsky <iliaa@php.net>
Mon, 13 Nov 2006 22:10:37 +0000 (22:10 +0000)
committerIlia Alshanetsky <iliaa@php.net>
Mon, 13 Nov 2006 22:10:37 +0000 (22:10 +0000)
NEWS
ext/pgsql/pgsql.c

diff --git a/NEWS b/NEWS
index 3c930dc56e98d022ee528b388e3d5b13214581d4..513aa3f11eecae77bef87f962956b3cd3f2ddb3e 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -75,6 +75,7 @@ PHP                                                                        NEWS
 - Fixed bug #38456 (Apache2 segfaults when virtual() is called in .php
   ErrorDocument). (Ilia)
 - Fixed bug #36975 (natcasesort() causes array_pop() to misbehave). (Hannes)
+- Fixed bug #36812 (pg_execute() modifies input array). (Ilia)
 - Fixed bug #36644 (possible crash in variant_date_from_timestamp()). (Ilia)
 - Fixed bug #33282 (Re-assignment by reference does not clear the is_ref flag)
   (Ilia,Dmitry, Matt Wilmas)
index 7f069e2d06243f97ef4446a2cf43e98f6ffb3a61..0a6c7724078604dbfaa17cb4731844cb72b78f31 100644 (file)
@@ -1472,6 +1472,7 @@ PHP_FUNCTION(pg_execute)
                php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Found results on this connection. Use pg_get_result() to get these results first");
        }
 
+       SEPARATE_ZVAL(pv_param_arr);
        zend_hash_internal_pointer_reset(Z_ARRVAL_PP(pv_param_arr));
        num_params = zend_hash_num_elements(Z_ARRVAL_PP(pv_param_arr));
        if (num_params > 0) {
@@ -1486,7 +1487,8 @@ PHP_FUNCTION(pg_execute)
                        }
 
                        otype = (*tmp)->type;
-                       convert_to_string(*tmp);
+                       SEPARATE_ZVAL(tmp);
+                       convert_to_string_ex(tmp);
                        if (Z_TYPE_PP(tmp) != IS_STRING) {
                                php_error_docref(NULL TSRMLS_CC, E_WARNING,"Error converting parameter");
                                _php_pgsql_free_params(params, num_params);
@@ -1495,8 +1497,7 @@ PHP_FUNCTION(pg_execute)
 
                        if (otype == IS_NULL) {
                                params[i] = NULL;
-                       }
-                       else {
+                       } else {
                                params[i] = Z_STRVAL_PP(tmp);
                        }