summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIlia Alshanetsky <iliaa@php.net>2003-08-14 14:36:38 +0000
committerIlia Alshanetsky <iliaa@php.net>2003-08-14 14:36:38 +0000
commite6b916cb1543c26d830a6818b012c5ace09b3139 (patch)
treeaebf11f010a5be92c491662144892972a5498a82
parent970371efa204d48a5fde32a3cdb7d258ccd51c27 (diff)
downloadphp-git-e6b916cb1543c26d830a6818b012c5ace09b3139.tar.gz
Fixed bug #25081 (odbc_fetch_array() may mangle numeric fields).
-rw-r--r--ext/odbc/php_odbc.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/ext/odbc/php_odbc.c b/ext/odbc/php_odbc.c
index 2aeebdf32c..0adcc7cad8 100644
--- a/ext/odbc/php_odbc.c
+++ b/ext/odbc/php_odbc.c
@@ -1457,8 +1457,13 @@ static void php_odbc_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, int result_type)
if (result_type & ODBC_NUM) {
zend_hash_index_update(Z_ARRVAL_P(return_value), i, &tmp, sizeof(pval *), NULL);
} else {
- zend_hash_update(Z_ARRVAL_P(return_value), result->values[i].name,
+ if (!*(result->values[i].name)) {
+ zend_hash_update(Z_ARRVAL_P(return_value), Z_STRVAL_P(tmp),
+ Z_STRLEN_P(tmp)+1, &tmp, sizeof(pval *), NULL);
+ } else {
+ zend_hash_update(Z_ARRVAL_P(return_value), result->values[i].name,
strlen(result->values[i].name)+1, &tmp, sizeof(pval *), NULL);
+ }
}
}
if (buf) efree(buf);