diff options
author | Antony Dovgal <tony2001@php.net> | 2005-05-10 23:15:24 +0000 |
---|---|---|
committer | Antony Dovgal <tony2001@php.net> | 2005-05-10 23:15:24 +0000 |
commit | d9918485df45fb82866b99b47a04aa8187ca0446 (patch) | |
tree | cb8f5ed094f2c43c317bcbffbd46cb12ee74b3ff | |
parent | 2f8f30a9d16b147fefdc9a9f58174afb5a353fc9 (diff) | |
download | php-git-d9918485df45fb82866b99b47a04aa8187ca0446.tar.gz |
use & and check for the right value of result_type
-rw-r--r-- | NEWS | 2 | ||||
-rw-r--r-- | ext/pgsql/pgsql.c | 9 |
2 files changed, 8 insertions, 3 deletions
@@ -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); } |