From ed4205a1cbef7f8d0be0e79ac8412e9eb240c571 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Wed, 9 Jun 2021 15:11:39 +0200 Subject: add patch got PHP 8.1 from https://github.com/php-memcached-dev/php-memcached/pull/486 switch to bcond and add option to disable msgpack usage --- 486.patch | 105 ++++++++++++++++++++++++++++++++++++++++++++++++ Makefile | 3 ++ php-pecl-memcached.spec | 42 +++++++++++++------ 3 files changed, 138 insertions(+), 12 deletions(-) create mode 100644 486.patch diff --git a/486.patch b/486.patch new file mode 100644 index 0000000..d98d572 --- /dev/null +++ b/486.patch @@ -0,0 +1,105 @@ +From b473c220a367360e821c23434456d4011909ba8d Mon Sep 17 00:00:00 2001 +From: Remi Collet +Date: Wed, 9 Jun 2021 14:29:34 +0200 +Subject: [PATCH 1/2] fix parameter count + +--- + php_memcached.c | 12 ++++++------ + 1 file changed, 6 insertions(+), 6 deletions(-) + +diff --git a/php_memcached.c b/php_memcached.c +index 1e218a00..ba2459c0 100644 +--- a/php_memcached.c ++++ b/php_memcached.c +@@ -1875,16 +1875,16 @@ static void php_memc_setMulti_impl(INTERNAL_FUNCTION_PARAMETERS, zend_bool by_ke + MEMC_METHOD_INIT_VARS; + + if (by_key) { +- /* "Sa|ll" */ +- ZEND_PARSE_PARAMETERS_START(2, 4) ++ /* "Sa|l" */ ++ ZEND_PARSE_PARAMETERS_START(2, 3) + Z_PARAM_STR(server_key) + Z_PARAM_ARRAY(entries) + Z_PARAM_OPTIONAL + Z_PARAM_LONG(expiration) + ZEND_PARSE_PARAMETERS_END(); + } else { +- /* "a|ll" */ +- ZEND_PARSE_PARAMETERS_START(1, 3) ++ /* "a|l" */ ++ ZEND_PARSE_PARAMETERS_START(1, 2) + Z_PARAM_ARRAY(entries) + Z_PARAM_OPTIONAL + Z_PARAM_LONG(expiration) +@@ -2090,7 +2090,7 @@ static void php_memc_cas_impl(INTERNAL_FUNCTION_PARAMETERS, zend_bool by_key) + + if (by_key) { + /* "zSSz|ll" */ +- ZEND_PARSE_PARAMETERS_START(4, 6) ++ ZEND_PARSE_PARAMETERS_START(4, 4) + Z_PARAM_ZVAL(zv_cas) + Z_PARAM_STR(server_key) + Z_PARAM_STR(key) +@@ -2100,7 +2100,7 @@ static void php_memc_cas_impl(INTERNAL_FUNCTION_PARAMETERS, zend_bool by_key) + ZEND_PARSE_PARAMETERS_END(); + } else { + /* "zSz|ll" */ +- ZEND_PARSE_PARAMETERS_START(3, 5) ++ ZEND_PARSE_PARAMETERS_START(3, 4) + Z_PARAM_ZVAL(zv_cas) + Z_PARAM_STR(key) + Z_PARAM_ZVAL(value) + +From 6971eea88a6b9c0797d70c0dd4b0491acbb825eb Mon Sep 17 00:00:00 2001 +From: Remi Collet +Date: Wed, 9 Jun 2021 14:30:12 +0200 +Subject: [PATCH 2/2] fix test for PHP 8.1 + +--- + tests/undefined_set.phpt | 21 ++++++++------------- + 1 file changed, 8 insertions(+), 13 deletions(-) + +diff --git a/tests/undefined_set.phpt b/tests/undefined_set.phpt +index caeda19d..581c9406 100644 +--- a/tests/undefined_set.phpt ++++ b/tests/undefined_set.phpt +@@ -10,30 +10,25 @@ $m = memc_get_instance (); + $key = 'foobarbazDEADC0DE'; + $value = array('foo' => 'bar'); + +-$rv = $m->set($no_key, $value, 360); ++// silent to hide: ++// Warning: Undefined variable ++// Deprecated: Memcached::set(): Passing null to parameter (PHP 8.1) ++ ++$rv = @$m->set($no_key, $value, 360); + var_dump($rv); + + +-$rv = $m->set($key, $no_value, 360); ++$rv = @$m->set($key, $no_value, 360); + var_dump($rv); + +-$rv = $m->set($no_key, $no_value, 360); ++$rv = @$m->set($no_key, $no_value, 360); + var_dump($rv); + +-$rv = $m->set($key, $value, $no_time); ++$rv = @$m->set($key, $value, $no_time); + var_dump($rv); + ?> + --EXPECTF-- +-%s: Undefined variable%sno_key in %s + bool(false) +- +-%s: Undefined variable%sno_value in %s + bool(true) +- +-%s: Undefined variable%sno_key in %s +- +-%s: Undefined variable%sno_value in %s + bool(false) +- +-%s: Undefined variable%sno_time in %s + bool(true) diff --git a/Makefile b/Makefile index 13af741..cd129ff 100644 --- a/Makefile +++ b/Makefile @@ -2,3 +2,6 @@ SRCDIR := $(shell pwd) NAME := $(shell basename $(SRCDIR)) include ../../../common/Makefile +php81build: + time rpmbuild $(RPMDEFINES) --define "scl php81" --define "php_version 8.1.0" --without igbinary --without msgpack --without zts -bb $(NAME).spec ; \ + diff --git a/php-pecl-memcached.spec b/php-pecl-memcached.spec index 614c0d0..26283d7 100644 --- a/php-pecl-memcached.spec +++ b/php-pecl-memcached.spec @@ -20,10 +20,12 @@ %global _root_prefix %{_prefix} %endif -%global with_fastlz 1 -%global with_igbin 1 +%bcond_without fastlz +%bcond_without igbinary +%bcond_without msgpack +%bcond_without tests + %global with_zts 0%{!?_without_zts:%{?__ztsphp:1}} -%global with_tests 0%{!?_without_tests:1} %global pecl_name memcached # After 40-igbinary, 40-json, 40-msgpack %global ini_name 50-%{pecl_name}.ini @@ -31,7 +33,7 @@ Summary: Extension to work with the Memcached caching daemon Name: %{?sub_prefix}php-pecl-memcached Version: 3.1.5 -Release: 4%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}} +Release: 5%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}} License: PHP URL: https://pecl.php.net/package/%{pecl_name} @@ -45,21 +47,24 @@ Patch4: https://patch-diff.githubusercontent.com/raw/php-memcached-dev/php Patch5: https://patch-diff.githubusercontent.com/raw/php-memcached-dev/php-memcached/pull/469.patch Patch6: https://patch-diff.githubusercontent.com/raw/php-memcached-dev/php-memcached/pull/472.patch Patch7: https://patch-diff.githubusercontent.com/raw/php-memcached-dev/php-memcached/pull/473.patch +Patch8: https://patch-diff.githubusercontent.com/raw/php-memcached-dev/php-memcached/pull/486.patch BuildRequires: %{?dtsprefix}gcc BuildRequires: %{?scl_prefix}php-devel >= 7 BuildRequires: %{?scl_prefix}php-pear BuildRequires: %{?scl_prefix}php-json -%if %{with_igbin} +%if %{with igbinary} BuildRequires: %{?sub_prefix}php-pecl-igbinary-devel %endif +%if %{with msgpack} BuildRequires: %{?sub_prefix}php-pecl-msgpack-devel +%endif BuildRequires: zlib-devel BuildRequires: cyrus-sasl-devel -%if %{with_fastlz} +%if %{with fastlz} BuildRequires: fastlz-devel %endif -%if %{with_tests} +%if %{with tests} BuildRequires: memcached %endif @@ -78,10 +83,12 @@ BuildRequires: pkgconfig(libmemcached) >= 1.0.18 Requires: %{?scl_prefix}php(zend-abi) = %{php_zend_api} Requires: %{?scl_prefix}php(api) = %{php_core_api} Requires: %{?scl_prefix}php-json%{?_isa} -%if %{with_igbin} +%if %{with igbinary} Requires: %{?sub_prefix}php-pecl-igbinary%{?_isa} %endif +%if %{with msgpack} Requires: %{?sub_prefix}php-pecl-msgpack%{?_isa} +%endif %{?_sclreq:Requires: %{?scl_prefix}runtime%{?_sclreq}%{?_isa}} Provides: %{?scl_prefix}php-%{pecl_name} = %{version} @@ -123,6 +130,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 %endif %if %{move_to_opt} @@ -163,9 +173,10 @@ cd NTS %patch5 -p1 -b .pr469 %patch6 -p1 -b .pr472 %patch7 -p1 -b .pr473 +%patch8 -p1 -b .pr486 %endif -%if %{with_fastlz} +%if %{with fastlz} rm -r fastlz sed -e '/name=.fastlz/d' -i ../package.xml %endif @@ -216,18 +227,20 @@ export PKG_CONFIG_PATH=/opt/libmemcached/%{_lib}/pkgconfig peclconf() { %configure \ -%if %{with_igbin} +%if %{with igbinary} --enable-memcached-igbinary \ %endif --enable-memcached-json \ --enable-memcached-sasl \ +%if %{with msgpack} --enable-memcached-msgpack \ +%endif %if 0 --disable-memcached-protocol \ %else --enable-memcached-protocol \ %endif -%if %{with_fastlz} +%if %{with fastlz} --with-system-fastlz \ %endif --with-php-config=$1 @@ -309,7 +322,7 @@ OPT="-n" --modules | grep %{pecl_name} %endif -%if %{with_tests} +%if %{with tests} ret=0 : Launch the Memcached service @@ -362,6 +375,11 @@ exit $ret %changelog +* Wed Jun 9 2021 Remi Collet - 3.1.5-4 +- add patch got PHP 8.1 from + https://github.com/php-memcached-dev/php-memcached/pull/486 +- switch to bcond and add option to disable msgpack usage + * Thu Oct 8 2020 Remi Collet - 3.1.5-3 - more patches for PHP 8 from https://github.com/php-memcached-dev/php-memcached/pull/465 -- cgit