From 3f57bd80f68fdff067b45f3d717dcf340b972635 Mon Sep 17 00:00:00 2001 From: ddv Date: Fri, 24 Nov 2023 14:39:07 +0500 Subject: [PATCH] Fix phpGH-12763: PGSQL pg_untrace(): Argument #1 ($connection) must be of type resource or null, PgSql\Connection given. --- NEWS | 3 +++ ext/pgsql/pgsql.c | 2 +- ext/pgsql/tests/gh12763.phpt | 23 +++++++++++++++++++++++ 3 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 ext/pgsql/tests/gh12763.phpt diff --git a/NEWS b/NEWS index d0cb95eee4a..aaf852a8ad2 100644 --- a/NEWS +++ b/NEWS @@ -30,6 +30,9 @@ PHP NEWS - PCRE: . Fixed bug GH-12628 (The gh11374 test fails on Alpinelinux). (nielsdos) +- PGSQL: + . Fixed bug GH-12763 wrong argument type for pg_untrace. (degtyarov) + - PHPDBG: . Fixed bug GH-12675 (MEMORY_LEAK in phpdbg_prompt.c). (nielsdos) diff --git a/ext/pgsql/pgsql.c b/ext/pgsql/pgsql.c index 66f09382fc3..9f04f2c843b 100644 --- a/ext/pgsql/pgsql.c +++ b/ext/pgsql/pgsql.c @@ -2286,7 +2286,7 @@ PHP_FUNCTION(pg_untrace) PGconn *pgsql; pgsql_link_handle *link; - if (zend_parse_parameters(ZEND_NUM_ARGS(), "|r!", &pgsql_link) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS(), "|O!", &pgsql_link, pgsql_link_ce) == FAILURE) { RETURN_THROWS(); } diff --git a/ext/pgsql/tests/gh12763.phpt b/ext/pgsql/tests/gh12763.phpt new file mode 100644 index 00000000000..a9bc0d18cfe --- /dev/null +++ b/ext/pgsql/tests/gh12763.phpt @@ -0,0 +1,23 @@ +--TEST-- +Bug #GH12763 (pg_untrace(): Argument #1 ($connection) must be of type resource or null, PgSql\Connection given) +--EXTENSIONS-- +pgsql +--SKIPIF-- + +--FILE-- + +--EXPECT-- +OK