Fixed bug #25081 (odbc_fetch_array() may mangle numeric fields).
authorIlia Alshanetsky <iliaa@php.net>
Thu, 14 Aug 2003 14:36:38 +0000 (14:36 +0000)
committerIlia Alshanetsky <iliaa@php.net>
Thu, 14 Aug 2003 14:36:38 +0000 (14:36 +0000)
ext/odbc/php_odbc.c

index 2aeebdf32cb8083a5cd7d0d6571622b3dd652bb1..0adcc7cad8098105d1fa71cdfeae3727bcaab478 100644 (file)
@@ -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);