From 33d7423950cb69ed7e75e9a26e42262dba383824 Mon Sep 17 00:00:00 2001 From: Ilia Alshanetsky Date: Thu, 14 Aug 2003 14:37:33 +0000 Subject: [PATCH] MFH: Fixed bug #25081 (odbc_fetch_array() may mangle numeric fields). --- NEWS | 1 + ext/odbc/php_odbc.c | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index 7fb9112983..b7fab7a5fe 100644 --- a/NEWS +++ b/NEWS @@ -2,6 +2,7 @@ PHP 4 NEWS ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| ?? Aug 2003, Version 4.3.3RC4 - Fixed bug #25084 (Make refer check not dependant on register_globals). (Ilia) +- Fixed bug #25081 (odbc_fetch_array() may mangle numeric fields). (Ilia) - Fixed bug #25044 (header("Location:") changing HTTP status). (Marcus) - Fixed bug #25037 (Possible infinite loop inside SendText()). (Ilia) - Fixed bug #25007 (rand() & mt_rand() seed RNG every call). (Jani) diff --git a/ext/odbc/php_odbc.c b/ext/odbc/php_odbc.c index b8c5a031e6..49d40e55e2 100644 --- a/ext/odbc/php_odbc.c +++ b/ext/odbc/php_odbc.c @@ -1459,8 +1459,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); -- 2.40.0