Fix GH-13354: ext/pgsql: pg_execute, pg_send_query_params and_send_execute null value by reference.

For these, when passing null values by refence, queries return erroneous values unlike
pg_query_params behaving as expected.

close GH-13355.
This commit is contained in:
George Barbarosie 2024-02-08 18:16:57 +00:00 committed by David Carlier
parent 7096eff91d
commit 452e008f4f
3 changed files with 87 additions and 3 deletions

View file

@ -1288,7 +1288,7 @@ PHP_FUNCTION(pg_execute)
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 {
@ -3653,7 +3653,7 @@ PHP_FUNCTION(pg_send_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 {
@ -3820,7 +3820,7 @@ PHP_FUNCTION(pg_send_execute)
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 {