| modification, are permitted provided that the conditions mentioned |
| in the accompanying LICENSE file are met. |
+--------------------------------------------------------------------+
- | Copyright (c) 2004-2006, Michael Wallner <mike@php.net> |
+ | Copyright (c) 2004-2007, Michael Wallner <mike@php.net> |
+--------------------------------------------------------------------+
*/
PHP_HTTP_API http_request_body *_http_request_body_fill(http_request_body *body, HashTable *fields, HashTable *files ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC TSRMLS_DC)
{
if (files && (zend_hash_num_elements(files) > 0)) {
- char *key = NULL;
- ulong idx;
+ HashKey key = initHashKey(0);
zval **data;
HashPosition pos;
struct curl_httppost *http_post_data[2] = {NULL, NULL};
/* normal data */
if (fields) {
- FOREACH_HASH_KEYVAL(pos, fields, key, idx, data) {
- if (key) {
+ FOREACH_HASH_KEYVAL(pos, fields, key, data) {
+ if (key.type == HASH_KEY_IS_STRING) {
CURLcode err;
zval *orig = *data;
convert_to_string_ex(data);
err = curl_formadd(&http_post_data[0], &http_post_data[1],
- CURLFORM_COPYNAME, key,
+ CURLFORM_COPYNAME, key.str,
CURLFORM_COPYCONTENTS, Z_STRVAL_PP(data),
CURLFORM_CONTENTSLENGTH, (long) Z_STRLEN_PP(data),
CURLFORM_END
curl_formfree(http_post_data[0]);
return NULL;
}
-
- /* reset */
- key = NULL;
}
}
}