diff options
| author | Dan Kalowsky <kalowsky@php.net> | 2001-06-14 15:02:17 +0000 | 
|---|---|---|
| committer | Dan Kalowsky <kalowsky@php.net> | 2001-06-14 15:02:17 +0000 | 
| commit | f2ec3fa6e5056ca541dcf4b6a03a3b39536aa91d (patch) | |
| tree | 3d80f6605267b08f6cfdaa51c459f1b87f43ffbc /ext/odbc/php_odbc.c | |
| parent | e4a2620d8046ae7f0cfd462b10db8a8652ebc16e (diff) | |
| download | php-git-f2ec3fa6e5056ca541dcf4b6a03a3b39536aa91d.tar.gz | |
adding in some error checking for parameter counts, and some thread safety for
functions
Diffstat (limited to 'ext/odbc/php_odbc.c')
| -rw-r--r-- | ext/odbc/php_odbc.c | 28 | 
1 files changed, 17 insertions, 11 deletions
| diff --git a/ext/odbc/php_odbc.c b/ext/odbc/php_odbc.c index 60ba594ce1..bca98d26b8 100644 --- a/ext/odbc/php_odbc.c +++ b/ext/odbc/php_odbc.c @@ -778,6 +778,7 @@ PHP_FUNCTION(odbc_prepare)  #ifdef HAVE_SQL_EXTENDED_FETCH  	UDWORD      scrollopts;  #endif +	ODBCLS_FETCH();  	if (zend_get_parameters_ex(2, &pv_conn, &pv_query) == FAILURE) {  		WRONG_PARAM_COUNT; @@ -882,20 +883,25 @@ PHP_FUNCTION(odbc_execute)     	odbc_result   *result;  	int numArgs, i, ne;  	RETCODE rc; +	ODBCLS_FETCH();  	numArgs = ZEND_NUM_ARGS(); -	if (numArgs == 1) { -		if (zend_get_parameters_ex(1, &pv_res) == FAILURE) -			WRONG_PARAM_COUNT; -	} else { -		if (zend_get_parameters_ex(2, &pv_res, &pv_param_arr) == FAILURE) +	switch(numArgs) { +		case 1: +			if (zend_get_parameters_ex(1, &pv_res) == FAILURE) +				WRONG_PARAM_COUNT; +			break; +		case 2: +			if (zend_get_parameters_ex(2, &pv_res, &pv_param_arr) == FAILURE) +				WRONG_PARAM_COUNT; +			if ((*pv_param_arr)->type != IS_ARRAY) { +				php_error(E_WARNING, "No array passed to odbc_execute()"); +				return; +			} +			break; +		default:  			WRONG_PARAM_COUNT; - -        if ((*pv_param_arr)->type != IS_ARRAY) { -            php_error(E_WARNING, "No array passed to odbc_execute()"); -            return; -        } -    } +	}  	ZEND_FETCH_RESOURCE(result, odbc_result *, pv_res, -1, "ODBC result", le_result); | 
