From 753f689f3d6fad9c8bb48eb8417f608a3036fc22 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Wed, 3 Nov 2021 12:18:00 +0100 Subject: add patch for PHP 8.1 from https://github.com/zeromq/php-zmq/pull/222 --- .gitignore | 2 ++ 222.patch | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++ php-pecl-zmq.spec | 27 ++++++++++++--------------- 3 files changed, 66 insertions(+), 15 deletions(-) create mode 100644 222.patch diff --git a/.gitignore b/.gitignore index 1ab5c4f..01f0400 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,7 @@ +clog package-*.xml *.tgz +*.tar.bz2 *.tar.gz *.tar.xz *.tar.xz.asc diff --git a/222.patch b/222.patch new file mode 100644 index 0000000..b19a86e --- /dev/null +++ b/222.patch @@ -0,0 +1,52 @@ +From 9af012efcfb256dd96b72ea8d1ac1b8498903118 Mon Sep 17 00:00:00 2001 +From: Remi Collet +Date: Wed, 3 Nov 2021 12:10:19 +0100 +Subject: [PATCH] Fix for PHP 8.1 + +--- + tests/053-z85.phpt | 6 +++--- + zmq_pollset.c | 7 ++++++- + 2 files changed, 9 insertions(+), 4 deletions(-) + +diff --git a/tests/053-z85.phpt b/tests/053-z85.phpt +index f486815..549fa5f 100644 +--- a/tests/053-z85.phpt ++++ b/tests/053-z85.phpt +@@ -41,12 +41,12 @@ for ($i = 4; $i <= 256; $i += 4) { + + // Incorrect length + test_z85_encode('1234567', null); +-test_z85_encode(null, null); ++test_z85_encode('', null); + + test_z85_decode('1234567', null); +-test_z85_decode(null, null); ++test_z85_decode('', null); + + echo "OK"; + + --EXPECT-- +-OK +\ No newline at end of file ++OK +diff --git a/zmq_pollset.c b/zmq_pollset.c +index 3e4ed15..0bf1098 100644 +--- a/zmq_pollset.c ++++ b/zmq_pollset.c +@@ -169,10 +169,15 @@ static + zend_string *s_create_key(zval *entry) + { + if (Z_TYPE_P(entry) == IS_RESOURCE) { +- return strpprintf(0, "r:%d", Z_RES_P(entry)->handle); ++ /* zend_long since 8.1.0 */ ++ return strpprintf(0, "r:%ld", (long)Z_RES_P(entry)->handle); + } + else { ++#if PHP_VERSION_ID >= 80100 ++ zend_string *hash = php_spl_object_hash(Z_OBJ_P(entry)); ++#else + zend_string *hash = php_spl_object_hash(entry); ++#endif + zend_string *key = strpprintf(0, "o:%s", hash->val); + zend_string_release(hash); + return key; diff --git a/php-pecl-zmq.spec b/php-pecl-zmq.spec index c82257d..bd79c65 100644 --- a/php-pecl-zmq.spec +++ b/php-pecl-zmq.spec @@ -3,7 +3,7 @@ # # Fedora spec file for php-pecl-zmq # -# Copyright (c) 2013-2020 Remi Collet +# Copyright (c) 2013-2021 Remi Collet # License: CC-BY-SA # http://creativecommons.org/licenses/by-sa/4.0/ # @@ -26,22 +26,19 @@ Summary: ZeroMQ messaging Name: %{?sub_prefix}php-pecl-%{pecl_name} Version: 1.1.3 -Release: 14%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}} +Release: 15%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}} License: BSD URL: https://pecl.php.net/package/%{pecl_name} Source0: https://pecl.php.net/get/%{pecl_name}-%{version}.tgz Patch0: https://patch-diff.githubusercontent.com/raw/zeromq/php-zmq/pull/216.patch +Patch1: https://patch-diff.githubusercontent.com/raw/zeromq/php-zmq/pull/222.patch +BuildRequires: make BuildRequires: %{?dtsprefix}gcc BuildRequires: %{?scl_prefix}php-devel BuildRequires: %{?scl_prefix}php-pear -%if 0%{?fedora} >= 22 || 0%{?rhel} >= 7 -# v4 in Fedora22+, EPEL-7, EPEL-8 BuildRequires: zeromq-devel >= 2.0.7 -%else -BuildRequires: zeromq3-devel -%endif BuildRequires: pkgconfig # BuildRequires: gdb php-debuginfo php-cli-debuginfo php-debugsource @@ -75,12 +72,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 @@ -103,6 +97,7 @@ mv %{pecl_name}-%{version} NTS cd NTS %patch0 -p1 -b .pr216 +%patch1 -p1 -b .pr222 if pkg-config libzmq --atleast-version=4 then @@ -210,9 +205,8 @@ cd NTS : upstream test suite for NTS extension export TEST_PHP_ARGS="-n -d extension=$PWD/modules/%{pecl_name}.so" export REPORT_EXIT_STATUS=1 -export NO_INTERACTION=1 export TEST_PHP_EXECUTABLE=%{__php} -%{__php} -n run-tests.php --show-diff +%{__php} -n run-tests.php -q --show-diff %endif %if %{with_zts} @@ -226,7 +220,7 @@ cd ../ZTS : upstream test suite for ZTS extension export TEST_PHP_ARGS="-n -d extension=$PWD/modules/%{pecl_name}.so" export TEST_PHP_EXECUTABLE=%{__ztsphp} -%{__ztsphp} -n run-tests.php --show-diff +%{__ztsphp} -n run-tests.php -q --show-diff %endif %endif @@ -246,6 +240,9 @@ export TEST_PHP_EXECUTABLE=%{__ztsphp} %changelog +* Wed Nov 3 2021 Remi Collet - 1.1.3-15 +- add patch for PHP 8.1 from https://github.com/zeromq/php-zmq/pull/222 + * Wed Sep 30 2020 Remi Collet - 1.1.3-14 - rebuild for PHP 8.0.0RC1 -- cgit