cvs: php4 /ext/pgsql pgsql.c

From: Date: Sat, 24 Aug 2002 07:18:15 +0000
Subject: cvs: php4 /ext/pgsql pgsql.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-13626@lists.php.net to get a copy of this message
yohgaki Sat Aug 24 03:18:15 2002 EDT Modified files: /php4/ext/pgsql pgsql.c Log: 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) Index: php4/ext/pgsql/pgsql.c diff -u php4/ext/pgsql/pgsql.c:1.214 php4/ext/pgsql/pgsql.c:1.215 --- php4/ext/pgsql/pgsql.c:1.214 Fri Aug 23 16:57:30 2002 +++ php4/ext/pgsql/pgsql.c Sat Aug 24 03:18:15 2002 @@ -19,7 +19,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: pgsql.c,v 1.214 2002/08/23 20:57:30 sniper Exp $ */ +/* $Id: pgsql.c,v 1.215 2002/08/24 07:18:15 yohgaki Exp $ */ #include <stdlib.h> @@ -2829,9 +2829,15 @@ 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);

« previous php.cvs (#13626) next »