Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions mailparse.c
Original file line number Diff line number Diff line change
Expand Up @@ -1420,13 +1420,13 @@ static void add_attr_header_to_zval(char *valuelabel, char *attrprefix, zval *re

zend_hash_get_current_key_ex(Z_ARRVAL_P(&attr->attributes), &str_key, &num_index, &pos);

if (str_key) {
spprintf(&newkey, 0, "%s%s", attrprefix, ZSTR_VAL(str_key));
} else {
spprintf(&newkey, 0, "%s" ZEND_ULONG_FMT, attrprefix, num_index);
}
add_assoc_string(return_value, newkey, Z_STRVAL_P(val));
efree(newkey);
if (str_key) {
spprintf(&newkey, 0, "%s%s", attrprefix, ZSTR_VAL(str_key));
} else {
spprintf(&newkey, 0, "%s" ZEND_ULONG_FMT, attrprefix, num_index);
}
add_assoc_string(return_value, newkey, Z_STRVAL_P(val));
efree(newkey);

zend_hash_move_forward_ex(Z_ARRVAL_P(&attr->attributes), &pos);
}
Expand Down
4 changes: 2 additions & 2 deletions mailparse_encoding.c
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ static int mb_filt_conv_base64dec(int c, mb_convert_filter *filter)
} else if (c == 0x2f) { /* '/' */
n = 63;
} else {
/* Invalid character - output a marker but continue */
/* invalid character, ignored */
return 0;
}
n &= 0x3f;
Expand Down Expand Up @@ -246,7 +246,7 @@ static int mb_filt_conv_base64dec_flush(mb_convert_filter *filter)
* Quoted-Printable encoding/decoding
* ============================================================================= */

static int hex2code_map[] = {
static const int hex2code_map[] = {
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
Expand Down
6 changes: 0 additions & 6 deletions php_mailparse.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,7 @@ PHP_FUNCTION(mailparse_msg_extract_whole_part_file);
PHP_FUNCTION(mailparse_msg_create);
PHP_FUNCTION(mailparse_msg_free);
PHP_FUNCTION(mailparse_msg_parse);
PHP_FUNCTION(mailparse_msg_parse_file);

PHP_FUNCTION(mailparse_msg_find);
PHP_FUNCTION(mailparse_msg_getstructure);
PHP_FUNCTION(mailparse_msg_getinfo);
PHP_FUNCTION(mailparse_msg_extract);
PHP_FUNCTION(mailparse_msg_extract_file);
PHP_FUNCTION(mailparse_rfc822_parse_addresses);
PHP_FUNCTION(mailparse_determine_best_xfer_encoding);
PHP_FUNCTION(mailparse_stream_encode);
Expand Down
30 changes: 15 additions & 15 deletions php_mailparse_mime.c
Original file line number Diff line number Diff line change
Expand Up @@ -448,21 +448,21 @@ static int php_mimepart_process_header(php_mimepart *part)
efree(newstr);
} else {
if((zheaderval = zend_hash_find(Z_ARRVAL_P(&part->headerhash), header_zstring)) != NULL) {
if(Z_TYPE_P(zheaderval) == IS_ARRAY) {
add_next_index_string(zheaderval, header_val);
} else {
/* Create a nested array if there is more than one of the same header */
zval zarr;
array_init(&zarr);
Z_ADDREF_P(zheaderval);

add_next_index_zval(&zarr, zheaderval);
add_next_index_string(&zarr, header_val);
add_assoc_zval(&part->headerhash, header_key, &zarr);
}
} else {
add_assoc_string(&part->headerhash, header_key, header_val);
}
if (Z_TYPE_P(zheaderval) == IS_ARRAY) {
add_next_index_string(zheaderval, header_val);
} else {
/* Create a nested array if there is more than one of the same header */
zval zarr;
array_init(&zarr);
Z_ADDREF_P(zheaderval);

add_next_index_zval(&zarr, zheaderval);
add_next_index_string(&zarr, header_val);
add_assoc_zval(&part->headerhash, header_key, &zarr);
}
} else {
add_assoc_string(&part->headerhash, header_key, header_val);
}
}
zend_string_release(header_zstring);
/* if it is useful, keep a pointer to it in the mime part */
Expand Down
Loading