From d21d9f2894a9cc066b96045e314cf3b4ebc22f52 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Wed, 5 Oct 2022 12:02:46 +0200 Subject: add patch for PHP 8.2 from https://github.com/websupport-sk/pecl-memcache/pull/104 --- memcache-php82.patch | 64 ++++++++++++++++++++++++++++++++++++++++++++++++++ php-pecl-memcache.spec | 17 +++++++++++--- 2 files changed, 78 insertions(+), 3 deletions(-) create mode 100644 memcache-php82.patch diff --git a/memcache-php82.patch b/memcache-php82.patch new file mode 100644 index 0000000..c732b5c --- /dev/null +++ b/memcache-php82.patch @@ -0,0 +1,64 @@ +From 88178b8788c475bbc80c6df46ac8bda47cb1b983 Mon Sep 17 00:00:00 2001 +From: Remi Collet +Date: Wed, 5 Oct 2022 11:39:04 +0200 +Subject: [PATCH] trivial/minimal fix for PHP 8.2 + +--- + src/memcache.c | 6 ++++++ + tests/029.phpt | 2 +- + tests/045.phpt | 4 +++- + 3 files changed, 10 insertions(+), 2 deletions(-) + +diff --git a/src/memcache.c b/src/memcache.c +index c05105a..c43e48f 100644 +--- a/src/memcache.c ++++ b/src/memcache.c +@@ -733,9 +733,15 @@ PHP_MINIT_FUNCTION(memcache) + + INIT_CLASS_ENTRY(ce, "MemcachePool", php_memcache_pool_class_functions); + memcache_pool_ce = zend_register_internal_class(&ce); ++#if PHP_VERSION_ID >= 80200 ++ memcache_pool_ce->ce_flags |= ZEND_ACC_ALLOW_DYNAMIC_PROPERTIES; ++#endif + + INIT_CLASS_ENTRY(ce, "Memcache", php_memcache_class_functions); + memcache_ce = zend_register_internal_class_ex(&ce, memcache_pool_ce); ++#if PHP_VERSION_ID >= 80200 ++ memcache_ce->ce_flags |= ZEND_ACC_ALLOW_DYNAMIC_PROPERTIES; ++#endif + + le_memcache_pool = zend_register_list_destructors_ex(_mmc_pool_list_dtor, NULL, "memcache connection", module_number); + le_memcache_server = zend_register_list_destructors_ex(NULL, _mmc_server_list_dtor, "persistent memcache connection", module_number); +diff --git a/tests/029.phpt b/tests/029.phpt +index bcacf33..4427948 100644 +--- a/tests/029.phpt ++++ b/tests/029.phpt +@@ -44,7 +44,7 @@ if (is_array($result)) + sort($result); + var_dump($result); + +-$result = ini_set('memcache.allow_failover', "abc"); ++$result = @ini_set('memcache.allow_failover', "abc"); + var_dump($result); + + ?> +diff --git a/tests/045.phpt b/tests/045.phpt +index e1c10ec..ddc5531 100644 +--- a/tests/045.phpt ++++ b/tests/045.phpt +@@ -8,6 +8,8 @@ Nested get's in __wakeup() + include 'connect.inc'; + + class testclass { ++ public $result = null; ++ + function __wakeup() { + global $memcache; + $this->result = $memcache->get('_test_key3'); +@@ -48,4 +50,4 @@ array(2) { + [0]=> + int(123) + } +-} +\ No newline at end of file ++} diff --git a/php-pecl-memcache.spec b/php-pecl-memcache.spec index aaa1ff5..a26509a 100644 --- a/php-pecl-memcache.spec +++ b/php-pecl-memcache.spec @@ -1,6 +1,6 @@ # spec file for php-pecl-memcache # -# Copyright (c) 2007-2021 Remi Collet +# Copyright (c) 2007-2022 Remi Collet # License: CC-BY-SA # http://creativecommons.org/licenses/by-sa/4.0/ # @@ -21,12 +21,13 @@ Summary: Extension to work with the Memcached caching daemon Name: %{?scl_prefix}php-pecl-memcache Version: 8.0 -Release: 3%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}} +Release: 4%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}} Source0: https://pecl.php.net/get/%{pecl_name}-%{version}%{?prever}.tgz License: PHP URL: https://pecl.php.net/package/%{pecl_name} Patch0: %{pecl_name}-php81.patch +Patch1: %{pecl_name}-php82.patch BuildRequires: make BuildRequires: %{?dtsprefix}gcc @@ -100,6 +101,7 @@ sed -e 's/role="test"/role="src"/' \ pushd NTS %patch0 -p1 +%patch1 -p1 sed -e '/PHP_MEMCACHE_VERSION/s/4.0.5.2/%{version}/' -i src/php_memcache.h @@ -221,8 +223,13 @@ done %endif %if %{with tests} -: Configuration for tests cd NTS +: ignore test with erratic results +rm tests/040.phpt +rm tests/056.phpt +rm tests/100c.phpt + +: Configuration for tests sed -e "s:/var/run/memcached/memcached.sock:$PWD/memcached.sock:" \ -i tests/connect.inc @@ -283,6 +290,10 @@ fi %changelog +* Wed Oct 5 2022 Remi Collet - 8.0-4 +- add patch for PHP 8.2 from + https://github.com/websupport-sk/pecl-memcache/pull/104 + * Wed Sep 01 2021 Remi Collet - 8.0-3 - rebuild for 8.1.0RC1 -- cgit