diff options
Diffstat (limited to 'mailparse-php83.patch')
-rw-r--r-- | mailparse-php83.patch | 106 |
1 files changed, 0 insertions, 106 deletions
diff --git a/mailparse-php83.patch b/mailparse-php83.patch deleted file mode 100644 index 06c8443..0000000 --- a/mailparse-php83.patch +++ /dev/null @@ -1,106 +0,0 @@ -From a0d99d637281753f62a28842aad716352dc0e5a3 Mon Sep 17 00:00:00 2001 -From: Remi Collet <remi@php.net> -Date: Tue, 30 May 2023 15:22:05 +0200 -Subject: [PATCH] drop usage of removed mbfl APIs in PHP 8.3 - ---- - mailparse.c | 19 ++++++++++--------- - package.xml | 2 +- - php_mailparse_mime.c | 7 +++++-- - 3 files changed, 16 insertions(+), 12 deletions(-) - -diff --git a/mailparse.c b/mailparse.c -index dde0f18..315bfee 100644 ---- a/mailparse.c -+++ b/mailparse.c -@@ -942,17 +942,15 @@ PHP_FUNCTION(mailparse_determine_best_xfer_encoding) - else if (++linelen > 200) - longline = 1; - } -- if (longline) -+ if (longline) { - bestenc = mbfl_no_encoding_qprint; -+ } - php_stream_rewind(stream); - -- name = (char *)mbfl_no2preferred_mime_name(bestenc); -- if (name) -- { -+ name = mbfl_encoding_preferred_mime_name(mbfl_no2encoding(bestenc)); -+ if (name) { - RETVAL_STRING(name); -- } -- else -- { -+ } else { - RETVAL_FALSE; - } - } -@@ -980,6 +978,7 @@ PHP_FUNCTION(mailparse_stream_encode) - char *buf; - size_t len; - size_t bufsize = 2048; -+ const mbfl_encoding *encoding; - enum mbfl_no_encoding enc; - mbfl_convert_filter *conv = NULL; - -@@ -997,8 +996,10 @@ PHP_FUNCTION(mailparse_stream_encode) - php_stream_from_zval(srcstream, srcfile); - php_stream_from_zval(deststream, destfile); - -- enc = mbfl_name2no_encoding(ZSTR_VAL(encod)); -- if (enc == mbfl_no_encoding_invalid) { -+ encoding = mbfl_name2encoding(ZSTR_VAL(encod)); -+ if (encoding) { -+ enc = encoding->no_encoding; -+ } else { - zend_error(E_WARNING, "%s(): unknown encoding \"%s\"", - get_active_function_name(), - ZSTR_VAL(encod) -diff --git a/php_mailparse_mime.c b/php_mailparse_mime.c -index fdf5862..49934f1 100644 ---- a/php_mailparse_mime.c -+++ b/php_mailparse_mime.c -@@ -913,11 +913,14 @@ static int filter_into_work_buffer(int c, void *dat) - - PHP_MAILPARSE_API void php_mimepart_decoder_prepare(php_mimepart *part, int do_decode, php_mimepart_extract_func_t decoder, void *ptr) - { -+ const mbfl_encoding *encoding; - enum mbfl_no_encoding from = mbfl_no_encoding_8bit; - - if (do_decode && part->content_transfer_encoding) { -- from = mbfl_name2no_encoding(part->content_transfer_encoding); -- if (from == mbfl_no_encoding_invalid) { -+ encoding = mbfl_name2encoding(part->content_transfer_encoding); -+ if (encoding) { -+ from = encoding->no_encoding; -+ } else { - if (strcasecmp("binary", part->content_transfer_encoding) != 0) { - zend_error(E_WARNING, "%s(): mbstring doesn't know how to decode %s transfer encoding!", - get_active_function_name(), -From 59e040beacaa93626343bd440c4172bbc4aaef03 Mon Sep 17 00:00:00 2001 -From: Remi Collet <remi@php.net> -Date: Tue, 30 May 2023 15:39:31 +0200 -Subject: [PATCH] fix regression for PHP < 8.1 - ---- - mailparse.c | 6 +++++- - 1 file changed, 5 insertions(+), 1 deletion(-) - -diff --git a/mailparse.c b/mailparse.c -index 315bfee..0f177ce 100644 ---- a/mailparse.c -+++ b/mailparse.c -@@ -947,7 +947,11 @@ PHP_FUNCTION(mailparse_determine_best_xfer_encoding) - } - php_stream_rewind(stream); - -- name = mbfl_encoding_preferred_mime_name(mbfl_no2encoding(bestenc)); -+#if PHP_VERSION_ID < 80100 -+ name = (char *)mbfl_no2preferred_mime_name(bestenc); -+#else -+ name = (char *)mbfl_encoding_preferred_mime_name(mbfl_no2encoding(bestenc)); -+#endif - if (name) { - RETVAL_STRING(name); - } else { |