From 488a1e73990b44b69f3f5b4265cdc0015b7ab3c1 Mon Sep 17 00:00:00 2001 From: Yasuo Ohgaki Date: Sat, 24 Aug 2002 07:18:15 +0000 Subject: 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) --- ext/pgsql/pgsql.c | 12 +++++++++--- 1 file 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); -- cgit v1.2.1