moriyoshi Mon Dec 1 18:25:06 2003 EDT Modified files: /php-src/ext/iconv iconv.c Log: Allow iconv_mime_decode_headers() to handle multiple occurence of a header. Index: php-src/ext/iconv/iconv.c diff -u php-src/ext/iconv/iconv.c:1.100 php-src/ext/iconv/iconv.c:1.101 --- php-src/ext/iconv/iconv.c:1.100 Mon Dec 1 17:46:44 2003 +++ php-src/ext/iconv/iconv.c Mon Dec 1 18:25:06 2003 @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: iconv.c,v 1.100 2003/12/01 22:46:44 moriyoshi Exp $ */ +/* $Id: iconv.c,v 1.101 2003/12/01 23:25:06 moriyoshi Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -2051,7 +2051,26 @@ } if (header_name != NULL) { - add_assoc_stringl_ex(return_value, header_name, header_name_len, header_value, header_value_len, 1); + zval **elem; + + if (zend_hash_find(Z_ARRVAL_P(return_value), header_name, header_name_len, (void **)&elem) == SUCCESS) { + if (Z_TYPE_PP(elem) != IS_ARRAY) { + zval *new_elem; + + MAKE_STD_ZVAL(new_elem); + array_init(new_elem); + + ZVAL_ADDREF(*elem); + add_next_index_zval(new_elem, *elem); + + zend_hash_update(Z_ARRVAL_P(return_value), header_name, header_name_len, (void *)&new_elem, sizeof(new_elem), NULL); + + elem = &new_elem; + } + add_next_index_stringl(*elem, header_value, header_value_len, 1); + } else { + add_assoc_stringl_ex(return_value, header_name, header_name_len, header_value, header_value_len, 1); + } } encoded_str_len -= next_pos - encoded_str; encoded_str = next_pos;
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php