diff options
author | Yasuo Ohgaki <yohgaki@php.net> | 2002-08-24 07:18:15 +0000 |
---|---|---|
committer | Yasuo Ohgaki <yohgaki@php.net> | 2002-08-24 07:18:15 +0000 |
commit | 488a1e73990b44b69f3f5b4265cdc0015b7ab3c1 (patch) | |
tree | d010c8dd65591f0b450da81ce0a740e0d3508754 | |
parent | 149ad05b4f35b595f281b6be2cb3521c4726e553 (diff) | |
download | php-git-488a1e73990b44b69f3f5b4265cdc0015b7ab3c1.tar.gz |
Make pg_result_status() a little more useufl by ignoring invalid
parameter and return FALSE.
(i.e. pg_query() may return FALSE instead of result resource)
-rw-r--r-- | ext/pgsql/pgsql.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/ext/pgsql/pgsql.c b/ext/pgsql/pgsql.c index 71fdc1e9d5..fa004f8a81 100644 --- a/ext/pgsql/pgsql.c +++ b/ext/pgsql/pgsql.c @@ -2829,9 +2829,15 @@ PHP_FUNCTION(pg_result_status) PGresult *pgsql_result; pgsql_result_handle *pg_result; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|l", - &result, &result_type) == FAILURE) { - return; + if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "r|l", + &result, &result_type) == SUCCESS) { + } + else { + if (Z_TYPE_P(result) != IS_RESOURCE) + RETURN_FALSE; + php_error(E_WARNING,"%s expects parameter 1 to be resource and 2 to be integer", + get_active_function_name(TSRMLS_C)); + RETURN_FALSE; } ZEND_FETCH_RESOURCE(pg_result, pgsql_result_handle *, &result, -1, "PostgreSQL result", le_result); |