Skip to content

Commit

Permalink
PHP 7.3 compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
Jan-E authored and remicollet committed Jul 11, 2018
1 parent 720ed5b commit 13c2c42
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
13 changes: 13 additions & 0 deletions mailparse.c
Original file line number Diff line number Diff line change
Expand Up @@ -984,12 +984,21 @@ PHP_FUNCTION(mailparse_stream_encode)
buf = emalloc(bufsize);
RETVAL_TRUE;

#if PHP_VERSION_ID >= 70300
conv = mbfl_convert_filter_new(mbfl_no2encoding(mbfl_no_encoding_8bit),
mbfl_no2encoding(enc),
mailparse_stream_output,
mailparse_stream_flush,
deststream
);
#else
conv = mbfl_convert_filter_new(mbfl_no_encoding_8bit,
enc,
mailparse_stream_output,
mailparse_stream_flush,
deststream
);
#endif

if (enc == mbfl_no_encoding_qprint) {
/* If the qp encoded section is going to be digitally signed,
Expand Down Expand Up @@ -1165,9 +1174,13 @@ PHP_FUNCTION(mailparse_msg_get_structure)

mailparse_fetch_mimepart_resource(part, arg);

#if PHP_VERSION_ID >= 70300
array_init(return_value);
#else
if (array_init(return_value) == FAILURE) {
RETURN_FALSE;
}
#endif
php_mimepart_enum_parts(part, &get_structure_callback, return_value);
}
/* }}} */
Expand Down
9 changes: 9 additions & 0 deletions php_mailparse_mime.c
Original file line number Diff line number Diff line change
Expand Up @@ -906,12 +906,21 @@ PHP_MAILPARSE_API void php_mimepart_decoder_prepare(php_mimepart *part, int do_d
if (from == mbfl_no_encoding_8bit || from == mbfl_no_encoding_7bit) {
part->extract_filter = NULL;
} else {
#if PHP_VERSION_ID >= 70300
part->extract_filter = mbfl_convert_filter_new(
mbfl_no2encoding(from), mbfl_no2encoding(mbfl_no_encoding_8bit),
filter_into_work_buffer,
NULL,
part
);
#else
part->extract_filter = mbfl_convert_filter_new(
from, mbfl_no_encoding_8bit,
filter_into_work_buffer,
NULL,
part
);
#endif
}
}

Expand Down

0 comments on commit 13c2c42

Please sign in to comment.