From: Michael Wallner Date: Sun, 28 Oct 2012 20:20:08 +0000 (+0000) Subject: fix grabbing files from array X-Git-Tag: RELEASE_2_1_0_RC3~10^2^2~105 X-Git-Url: https://git.m6w6.name/?a=commitdiff_plain;h=0ba01182029d13dfd02e90875f3b0da16eb3331c;p=m6w6%2Fext-http fix grabbing files from array --- diff --git a/php_http_env_request.c b/php_http_env_request.c index e4e8eaf..4da183e 100644 --- a/php_http_env_request.c +++ b/php_http_env_request.c @@ -70,7 +70,7 @@ static int grab_file(void *zpp TSRMLS_DC, int argc, va_list argv, zend_hash_key && SUCCESS == zend_hash_index_find(Z_ARRVAL_PP(type), key->h, (void *) &ztype) && SUCCESS == zend_hash_index_find(Z_ARRVAL_PP(error), key->h, (void *) &zerror) ) { - zval *entry; + zval *entry, **array; MAKE_STD_ZVAL(entry); array_init(entry); @@ -86,7 +86,16 @@ static int grab_file(void *zpp TSRMLS_DC, int argc, va_list argv, zend_hash_key Z_ADDREF_PP(zerror); add_assoc_zval_ex(entry, ZEND_STRS("error"), *zerror); - zend_hash_quick_update(Z_ARRVAL_P(zfiles), file_key->arKey, file_key->nKeyLength, file_key->h, (void *) &entry, sizeof(zval *), NULL); + if (SUCCESS == zend_hash_quick_find(Z_ARRVAL_P(zfiles), file_key->arKey, file_key->nKeyLength, file_key->h, (void *) &array)) { + add_next_index_zval(*array, entry); + } else { + zval *tmp; + + MAKE_STD_ZVAL(tmp); + array_init(tmp); + add_next_index_zval(tmp, entry); + zend_hash_quick_update(Z_ARRVAL_P(zfiles), file_key->arKey, file_key->nKeyLength, file_key->h, (void *) &tmp, sizeof(zval *), NULL); + } } return ZEND_HASH_APPLY_KEEP;