From: Dan Kalowsky Date: Mon, 12 Aug 2002 16:17:18 +0000 (+0000) Subject: Umm forgot to clean up the error messages, and add a stop for looping. X-Git-Tag: php-4.3.0dev_zend2_alpha3~120 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=8d2d105cff9c02276e718c52cbe80da8c70c7aa0;p=php Umm forgot to clean up the error messages, and add a stop for looping. --- diff --git a/ext/odbc/php_odbc.c b/ext/odbc/php_odbc.c index 886abd6d00..65e8c0613d 100644 --- a/ext/odbc/php_odbc.c +++ b/ext/odbc/php_odbc.c @@ -1128,14 +1128,14 @@ PHP_FUNCTION(odbc_data_source) int num_args = ZEND_NUM_ARGS(); UCHAR server_name[100], desc[200]; - SQLSMALLINT len1, len2, fetch_type; + SQLSMALLINT len1=0, len2=0, fetch_type; if (num_args != 2) { WRONG_PARAM_COUNT; } if (zend_get_parameters_ex(2, &zv_conn, &zv_fetch_type) == FAILURE) { - php_error(E_WARNING, "Unable to get parameters"); + php_error(E_WARNING, "%s(): Unable to get parameters", get_active_function_name(TSRMLS_C)); } convert_to_long_ex(zv_fetch_type); @@ -1143,7 +1143,7 @@ PHP_FUNCTION(odbc_data_source) if (!(fetch_type == SQL_FETCH_FIRST || fetch_type == SQL_FETCH_NEXT)) { - php_error(E_WARNING, "odbc_data_source: Invalid fetch type (%d)", fetch_type); + php_error(E_WARNING, "%s(): Invalid fetch type (%d)", get_active_function_name(TSRMLS_C), fetch_type); RETURN_FALSE; } @@ -1165,6 +1165,11 @@ PHP_FUNCTION(odbc_data_source) RETURN_FALSE; } + if (len1 == 0 || len2 == 0) { + /* we have a non-valid entry... so stop the looping */ + RETURN_FALSE; + } + array_init(return_value); add_assoc_stringl_ex(return_value, "server", sizeof("server"), server_name, len1, 1);