From 98b544482e82f5da3bcea6fc45957d3f3776a046 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Fri, 8 Jan 2021 15:50:31 +0100 Subject: add upstream patch for PHP 8 --- ea17b8cb1c7ecca5af3ece4420c4b2880984b41a.patch | 61 ++++++++++++++++++++++++++ php-pecl-xxtea.spec | 50 ++++++--------------- 2 files changed, 75 insertions(+), 36 deletions(-) create mode 100644 ea17b8cb1c7ecca5af3ece4420c4b2880984b41a.patch diff --git a/ea17b8cb1c7ecca5af3ece4420c4b2880984b41a.patch b/ea17b8cb1c7ecca5af3ece4420c4b2880984b41a.patch new file mode 100644 index 0000000..c8d4eaa --- /dev/null +++ b/ea17b8cb1c7ecca5af3ece4420c4b2880984b41a.patch @@ -0,0 +1,61 @@ +From ea17b8cb1c7ecca5af3ece4420c4b2880984b41a Mon Sep 17 00:00:00 2001 +From: Jan Ehrhardt +Date: Thu, 3 Dec 2020 17:40:24 +0100 +Subject: [PATCH] Add PHP8 compatibility + +The first change deal with the issue that win32/php_stdint.h does not exist anymore in PHP8, but the VS16 compiler does provide a inttypes.h. So we check if we are using a MSVC compiler and if it is a lower version than Visual Studio 2019 (or VS16). + +The other chages deal with the fact that the TSRMLS macros have been removed in PHP8. They already did not do anything at all in PHP7, but they are gone completely now +--- + php_xxtea.c | 14 +++++++++++++- + 1 file changed, 13 insertions(+), 1 deletion(-) + +diff --git a/php_xxtea.c b/php_xxtea.c +index 7001270..c0cf743 100644 +--- a/php_xxtea.c ++++ b/php_xxtea.c +@@ -16,7 +16,7 @@ + #include "php_xxtea.h" + #include "ext/standard/info.h" /* for phpinfo() functions */ + +-#if defined(_MSC_VER) ++#if defined(_MSC_VER) && _MSC_VER < 1920 + #include "win32/php_stdint.h" + #elif defined(__FreeBSD__) && __FreeBSD__ < 5 + /* FreeBSD 4 doesn't have stdint.h file */ +@@ -281,7 +281,11 @@ ZEND_FUNCTION(xxtea_encrypt) { + size_t i, ret_length; + uint8_t fixed_key[16]; + ++#ifdef TSRMLS_CC + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", &data, &data_len, &key, &key_len) == FAILURE) { ++#else ++ if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss", &data, &data_len, &key, &key_len) == FAILURE) { ++#endif + return; + } + if (data_len == 0) { +@@ -314,7 +318,11 @@ ZEND_FUNCTION(xxtea_decrypt) { + size_t i, ret_length; + uint8_t fixed_key[16]; + ++#ifdef TSRMLS_CC + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", &data, &data_len, &key, &key_len) == FAILURE) { ++#else ++ if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss", &data, &data_len, &key, &key_len) == FAILURE) { ++#endif + return; + } + if (data_len == 0) { +@@ -346,7 +354,11 @@ static zend_function_entry xxtea_method[] = { + ZEND_MINIT_FUNCTION(xxtea) { + zend_class_entry ce; + INIT_CLASS_ENTRY(ce, "XXTEA", xxtea_method); ++#ifdef TSRMLS_CC + xxtea_ce = zend_register_internal_class(&ce TSRMLS_CC); ++#else ++ xxtea_ce = zend_register_internal_class(&ce); ++#endif + return SUCCESS; + } + diff --git a/php-pecl-xxtea.spec b/php-pecl-xxtea.spec index 932e4a9..cfa827c 100644 --- a/php-pecl-xxtea.spec +++ b/php-pecl-xxtea.spec @@ -1,6 +1,6 @@ # remirepo spec file for php-pecl-xxtea # -# Copyright (c) 2013-2018 Remi Collet +# Copyright (c) 2013-2021 Remi Collet # License: CC-BY-SA # http://creativecommons.org/licenses/by-sa/4.0/ # @@ -22,11 +22,14 @@ Summary: XXTEA encryption algorithm extension for PHP Name: %{?sub_prefix}php-pecl-%{pecl_name} Version: 1.0.11 -Release: 8%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}} +Release: 9%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}} License: MIT -URL: http://pecl.php.net/package/%{pecl_name} -Source0: http://pecl.php.net/get/%{pecl_name}-%{version}.tgz +URL: https://pecl.php.net/package/%{pecl_name} +Source0: https://pecl.php.net/get/%{pecl_name}-%{version}.tgz +Patch0: https://github.com/xxtea/xxtea-pecl/commit/ea17b8cb1c7ecca5af3ece4420c4b2880984b41a.patch + +BuildRequires: make BuildRequires: %{?dtsprefix}gcc BuildRequires: %{?scl_prefix}php-devel BuildRequires: %{?scl_prefix}php-pear @@ -42,46 +45,17 @@ Provides: %{?scl_prefix}php-pecl(%{pecl_name})%{?_isa} = %{version} Provides: %{?scl_prefix}php-pecl-%{pecl_name} = %{version}-%{release} Provides: %{?scl_prefix}php-pecl-%{pecl_name}%{?_isa} = %{version}-%{release} -%if "%{?vendor}" == "Remi Collet" && 0%{!?scl:1} && 0%{?rhel} +%if "%{?packager}" == "Remi Collet" && 0%{!?scl:1} && 0%{?rhel} # Other third party repo stuff -Obsoletes: php53-pecl-%{pecl_name} <= %{version} -Obsoletes: php53u-pecl-%{pecl_name} <= %{version} -Obsoletes: php54-pecl-%{pecl_name} <= %{version} -Obsoletes: php54w-pecl-%{pecl_name} <= %{version} -%if "%{php_version}" > "5.5" -Obsoletes: php55u-pecl-%{pecl_name} <= %{version} -Obsoletes: php55w-pecl-%{pecl_name} <= %{version} -%endif -%if "%{php_version}" > "5.6" -Obsoletes: php56u-pecl-%{pecl_name} <= %{version} -Obsoletes: php56w-pecl-%{pecl_name} <= %{version} -%endif -%if "%{php_version}" > "7.0" -Obsoletes: php70u-pecl-%{pecl_name} <= %{version} -Obsoletes: php70w-pecl-%{pecl_name} <= %{version} -%endif -%if "%{php_version}" > "7.1" -Obsoletes: php71u-pecl-%{pecl_name} <= %{version} -Obsoletes: php71w-pecl-%{pecl_name} <= %{version} -%endif -%if "%{php_version}" > "7.2" -Obsoletes: php72u-pecl-%{pecl_name} <= %{version} -Obsoletes: php72w-pecl-%{pecl_name} <= %{version} -%endif %if "%{php_version}" > "7.3" Obsoletes: php73-pecl-%{pecl_name} <= %{version} -Obsoletes: php73w-pecl-%{pecl_name} <= %{version} %endif %if "%{php_version}" > "7.4" Obsoletes: php74-pecl-%{pecl_name} <= %{version} -Obsoletes: php74w-pecl-%{pecl_name} <= %{version} %endif +%if "%{php_version}" > "8.0" +Obsoletes: php80-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 @@ -107,6 +81,7 @@ sed -e 's/role="test"/role="src"/' \ -i package.xml cd NTS +%patch0 -p1 -b .up # Sanity check, really often broken extver=$(sed -n '/#define PHP_XXTEA_VERSION/{s/.* "//;s/".*$//;p}' php_xxtea.h) @@ -241,6 +216,9 @@ REPORT_EXIT_STATUS=1 \ %changelog +* Fri Jan 8 2021 Remi Collet - 1.0.11-9 +- add upstream patch for PHP 8 + * Tue Sep 03 2019 Remi Collet - 1.0.11-8 - rebuild for 7.4.0RC1 -- cgit