summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemi Collet <remi@remirepo.net>2021-06-09 08:14:21 +0200
committerRemi Collet <remi@remirepo.net>2021-06-09 08:14:21 +0200
commit34f22f931a68ebf9273250d82d4d5614974a05f3 (patch)
treebc57e8f95c7cd41a6f2cadd3978d0506063bbc04
parent3ac16488ab5635275d9d8897356a9bcb45be32de (diff)
add upstream patch for PHP 8.1
-rw-r--r--mailparse-php81.patch112
-rw-r--r--php-pecl-mailparse.spec21
2 files changed, 125 insertions, 8 deletions
diff --git a/mailparse-php81.patch b/mailparse-php81.patch
new file mode 100644
index 0000000..a0d1a2a
--- /dev/null
+++ b/mailparse-php81.patch
@@ -0,0 +1,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;
+ }
+
diff --git a/php-pecl-mailparse.spec b/php-pecl-mailparse.spec
index f4ab3c6..1bf47b6 100644
--- a/php-pecl-mailparse.spec
+++ b/php-pecl-mailparse.spec
@@ -3,7 +3,7 @@
#
# Fedora spec file for php-pecl-mailparse
#
-# Copyright (c) 2008-2020 Remi Collet
+# Copyright (c) 2008-2021 Remi Collet
# Copyright (c) 2004-2007 Matthias Saou
#
# License: MIT
@@ -27,13 +27,16 @@
Summary: PHP PECL package for parsing and working with email messages
Name: %{?sub_prefix}php-pecl-mailparse
Version: 3.1.1
-Release: 2%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}}
+Release: 3%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}}
License: PHP
URL: https://pecl.php.net/package/mailparse
Source0: https://pecl.php.net/get/%{pecl_name}-%{version}.tgz
+Patch0: %{pecl_name}-php81.patch
+
+BuildRequires: make
BuildRequires: %{?dtsprefix}gcc
-BuildRequires: %{?scl_prefix}php-devel > 7
+BuildRequires: %{?scl_prefix}php-devel >= 7.0
BuildRequires: %{?scl_prefix}php-pear
BuildRequires: %{?scl_prefix}php-mbstring
# Required by phpize
@@ -67,12 +70,9 @@ Obsoletes: php74-pecl-%{pecl_name} <= %{version}
%if "%{php_version}" > "8.0"
Obsoletes: php80-pecl-%{pecl_name} <= %{version}
%endif
+%if "%{php_version}" > "8.1"
+Obsoletes: php81-pecl-%{pecl_name} <= %{version}
%endif
-
-%if 0%{?fedora} < 20 && 0%{?rhel} < 7
-# Filter shared private
-%{?filter_provides_in: %filter_provides_in %{_libdir}/.*\.so$}
-%{?filter_setup}
%endif
@@ -94,6 +94,8 @@ sed -e 's/role="test"/role="src"/' \
-i package.xml
cd NTS
+%patch0 -p1 -b .php81
+
extver=$(sed -n '/#define PHP_MAILPARSE_VERSION/{s/.* "//;s/".*$//;p}' php_mailparse.h)
if test "x${extver}" != "x%{version}"; then
: Error: Upstream version is ${extver}, expecting %{version}.
@@ -219,6 +221,9 @@ fi
%changelog
+* Wed Jun 9 2021 Remi Collet <remi@remirepo.net> - 3.1.1-3
+- add upstream patch for PHP 8.1
+
* Wed Sep 30 2020 Remi Collet <remi@remirepo.net> - 3.1.1-2
- rebuild for PHP 8.0.0RC1