diff options
| author | Antony Dovgal <tony2001@php.net> | 2005-05-10 23:12:31 +0000 |
|---|---|---|
| committer | Antony Dovgal <tony2001@php.net> | 2005-05-10 23:12:31 +0000 |
| commit | fcf14f179527b9301a72d5e9b4a8fa707c3dff4e (patch) | |
| tree | f5a028581c89919dea7cb33f116f7e20a5240305 /ext/pgsql/pgsql.c | |
| parent | 38a7ef5fe613a254d048faf1204e15e80d37b4f6 (diff) | |
| download | php-git-fcf14f179527b9301a72d5e9b4a8fa707c3dff4e.tar.gz | |
use & and check for the right value of result_type
Diffstat (limited to 'ext/pgsql/pgsql.c')
| -rw-r--r-- | ext/pgsql/pgsql.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/ext/pgsql/pgsql.c b/ext/pgsql/pgsql.c index cb16ff936f..2fa3657b25 100644 --- a/ext/pgsql/pgsql.c +++ b/ext/pgsql/pgsql.c @@ -4137,6 +4137,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); if (!pgsql_notify) { @@ -4144,11 +4149,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); } |
