summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--NEWS2
-rw-r--r--ext/pgsql/pgsql.c9
2 files changed, 8 insertions, 3 deletions
diff --git a/NEWS b/NEWS
index c205d6e742..599f4c9073 100644
--- a/NEWS
+++ b/NEWS
@@ -16,7 +16,7 @@ PHP NEWS
- Fixed bug #32936 (http redirects URLs are not checked for control chars). (Ilia)
- Fixed bug #32932 (Oracle LDAP: ldap_get_entries(), invalid pointer). (Jani)
- Fixed bug #32930 (class extending DOMDocument doesn't clone properly). (Rob)
-- Fixed bug #32904 (pg_get_notify() ignores result_type parameter). (Antony)
+- Fixed bug #32904 (pg_get_notify() ignores result_type parameter). (Tony)
- Fixed bug #32852 (Crash with singleton and __destruct when
zend.ze1_compatibility_mode = On). (Dmitry)
- Fixed bug #32813 (parse_url() does not handle scheme-only urls properly). (Ilia)
diff --git a/ext/pgsql/pgsql.c b/ext/pgsql/pgsql.c
index 725ca4b108..904fb12888 100644
--- a/ext/pgsql/pgsql.c
+++ b/ext/pgsql/pgsql.c
@@ -3274,6 +3274,11 @@ PHP_FUNCTION(pg_get_notify)
}
ZEND_FETCH_RESOURCE2(pgsql, PGconn *, &pgsql_link, id, "PostgreSQL link", le_link, le_plink);
+
+ if (!(result_type & PGSQL_BOTH)) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid result type");
+ RETURN_FALSE;
+ }
PQconsumeInput(pgsql);
pgsql_notify = PQnotifies(pgsql);
@@ -3282,11 +3287,11 @@ PHP_FUNCTION(pg_get_notify)
RETURN_FALSE;
}
array_init(return_value);
- if (result_type == PGSQL_NUM || result_type == PGSQL_BOTH) {
+ if (result_type & PGSQL_NUM) {
add_index_string(return_value, 0, pgsql_notify->relname, 1);
add_index_long(return_value, 1, pgsql_notify->be_pid);
}
- if (result_type == PGSQL_ASSOC || result_type == PGSQL_BOTH) {
+ if (result_type & PGSQL_ASSOC) {
add_assoc_string(return_value, "message", pgsql_notify->relname, 1);
add_assoc_long(return_value, "pid", pgsql_notify->be_pid);
}