From 0ba01182029d13dfd02e90875f3b0da16eb3331c Mon Sep 17 00:00:00 2001 From: Michael Wallner Date: Sun, 28 Oct 2012 20:20:08 +0000 Subject: [PATCH] fix grabbing files from array --- php_http_env_request.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) 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; -- 2.30.2