1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
|
From ae960dba8cb607296b7f85ca23f9d0a2462607d5 Mon Sep 17 00:00:00 2001
From: Remi Collet <remi@php.net>
Date: Tue, 8 Jun 2021 08:00:37 +0200
Subject: [PATCH] fix for 8.1
---
mailparse.c | 29 ++++++++++++++++++++++++++++-
package.xml | 2 +-
2 files changed, 29 insertions(+), 2 deletions(-)
diff --git a/mailparse.c b/mailparse.c
index 104ab38..d4b0804 100644
--- a/mailparse.c
+++ b/mailparse.c
@@ -413,7 +413,11 @@ static void mailparse_mimemessage_extract(int flags, INTERNAL_FUNCTION_PARAMETER
if (part->source.kind == mpSTRING)
+#if PHP_VERSION_ID < 80100
srcstream = php_stream_memory_open(TEMP_STREAM_READONLY, Z_STRVAL_P(&part->source.zval), Z_STRLEN_P(&part->source.zval));
+#else
+ srcstream = php_stream_memory_open(TEMP_STREAM_READONLY, Z_STR(part->source.zval));
+#endif
else
php_stream_from_zval(srcstream, &part->source.zval);
@@ -430,11 +434,15 @@ static void mailparse_mimemessage_extract(int flags, INTERNAL_FUNCTION_PARAMETER
if (SUCCESS == extract_part(part, flags, srcstream, callback_data, callback)) {
if (mode == MAILPARSE_EXTRACT_RETURN) {
+#if PHP_VERSION_ID < 80100
size_t len;
char *buf;
buf = php_stream_memory_get_buffer(deststream, &len);
RETVAL_STRINGL(buf, len);
+#else
+ RETVAL_STR(php_stream_memory_get_buffer(deststream));
+#endif
} else {
RETVAL_TRUE;
}
@@ -502,7 +510,11 @@ PHP_METHOD(mimemessage, extract_uue)
}
if (part->source.kind == mpSTRING)
+#if PHP_VERSION_ID < 80100
srcstream = php_stream_memory_open(TEMP_STREAM_READONLY, Z_STRVAL_P(&part->source.zval), Z_STRLEN_P(&part->source.zval));
+#else
+ srcstream = php_stream_memory_open(TEMP_STREAM_READONLY, Z_STR(part->source.zval));
+#endif
else
php_stream_from_zval(srcstream, &part->source.zval);
@@ -535,11 +547,15 @@ PHP_METHOD(mimemessage, extract_uue)
if (nparts == index) {
mailparse_do_uudecode(srcstream, deststream);
if (mode == MAILPARSE_EXTRACT_RETURN) {
+#if PHP_VERSION_ID < 80100
size_t len;
char *buf;
buf = php_stream_memory_get_buffer(deststream, &len);
RETVAL_STRINGL(buf, len);
+#else
+ RETVAL_STR(php_stream_memory_get_buffer(deststream));
+#endif
} else {
RETVAL_TRUE;
}
@@ -584,7 +600,11 @@ PHP_METHOD(mimemessage, enum_uue)
return;
if (part->source.kind == mpSTRING)
+#if PHP_VERSION_ID < 80100
instream = php_stream_memory_open(TEMP_STREAM_READONLY, Z_STRVAL_P(&part->source.zval), Z_STRLEN_P(&part->source.zval));
+#else
+ instream = php_stream_memory_open(TEMP_STREAM_READONLY, Z_STR(part->source.zval));
+#endif
else
php_stream_from_zval(instream, &part->source.zval);
@@ -1308,7 +1328,11 @@ static void mailparse_do_extract(INTERNAL_FUNCTION_PARAMETERS, int decode, int i
close_src_stream = 1;
} else {
/* filename is the actual data */
+#if PHP_VERSION_ID < 80100
srcstream = php_stream_memory_open(TEMP_STREAM_READONLY, Z_STRVAL_P(filename), Z_STRLEN_P(filename));
+#else
+ srcstream = php_stream_memory_open(TEMP_STREAM_READONLY, Z_STR_P(filename));
+#endif
close_src_stream = 1;
}
@@ -1339,12 +1363,15 @@ static void mailparse_do_extract(INTERNAL_FUNCTION_PARAMETERS, int decode, int i
if (SUCCESS == extract_part(part, decode, srcstream, cbdata, cbfunc)) {
if (deststream != NULL) {
+#if PHP_VERSION_ID < 80100
/* return it's contents as a string */
char *membuf = NULL;
size_t memlen = 0;
membuf = php_stream_memory_get_buffer(deststream, &memlen);
RETVAL_STRINGL(membuf, memlen);
-
+#else
+ RETVAL_STR(php_stream_memory_get_buffer(deststream));
+#endif
} else {
RETVAL_TRUE;
}
|