diff --git a/ext/pgsql/pgsql.c b/ext/pgsql/pgsql.c index 8b9da44a5b193..6e04848bdea0b 100644 --- a/ext/pgsql/pgsql.c +++ b/ext/pgsql/pgsql.c @@ -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 { diff --git a/ext/pgsql/tests/gh13354.phpt b/ext/pgsql/tests/gh13354.phpt new file mode 100644 index 0000000000000..1de84acae847d --- /dev/null +++ b/ext/pgsql/tests/gh13354.phpt @@ -0,0 +1,80 @@ +--TEST-- +GH-13354 (null-by-reference handling in pg_execute, pg_send_query_params, pg_send_execute) +--EXTENSIONS-- +pgsql +--SKIPIF-- + +--FILE-- + +--EXPECT-- +pg_execute, null value: t +pg_execute, null value by reference: t +pg_query_params, null value: t +pg_query_params, null value by reference: t +pg_send_query_params, null value: t +pg_send_query_params, null value by reference: t +pg_send_execute, null value: t +pg_send_execute, null value by reference: t