diff options
author | Remi Collet <remi@remirepo.net> | 2021-01-18 16:59:44 +0100 |
---|---|---|
committer | Remi Collet <remi@remirepo.net> | 2021-01-18 16:59:44 +0100 |
commit | f2b045e6df0a7734146cc15b1215c1de0f44d0e4 (patch) | |
tree | 5200f5cefbb0314c0d87aa165e9ad68b5e570fe8 | |
parent | f9a74f77ea1bdce93dfe19fae9edd141bfe23b9b (diff) |
more patches for PHP 8 from
https://github.com/php-memcached-dev/php-memcached/pull/465
https://github.com/php-memcached-dev/php-memcached/pull/467
https://github.com/php-memcached-dev/php-memcached/pull/468
https://github.com/php-memcached-dev/php-memcached/pull/469
https://github.com/php-memcached-dev/php-memcached/pull/472
https://github.com/php-memcached-dev/php-memcached/pull/473
-rw-r--r-- | 465.patch | 67 | ||||
-rw-r--r-- | 467.patch | 162 | ||||
-rw-r--r-- | 468.patch | 70 | ||||
-rw-r--r-- | 469.patch | 86 | ||||
-rw-r--r-- | 472.patch | 123 | ||||
-rw-r--r-- | 473.patch | 37 | ||||
-rw-r--r-- | php-pecl-memcached.spec | 31 |
7 files changed, 569 insertions, 7 deletions
diff --git a/465.patch b/465.patch new file mode 100644 index 0000000..7738012 --- /dev/null +++ b/465.patch @@ -0,0 +1,67 @@ +From 5b525dafa6aa759801832c5fd10c3734c5dde808 Mon Sep 17 00:00:00 2001 +From: Remi Collet <remi@remirepo.net> +Date: Tue, 20 Oct 2020 09:42:14 +0200 +Subject: [PATCH] promote error "Memcached constructor was not called" to + exception with PHP 8 + +--- + php_memcached.c | 11 +++++++++++ + tests/bad_construct_8.phpt | 12 +++++++----- + 2 files changed, 18 insertions(+), 5 deletions(-) + +diff --git a/php_memcached.c b/php_memcached.c +index d49b7d5..1e218a0 100644 +--- a/php_memcached.c ++++ b/php_memcached.c +@@ -195,6 +195,7 @@ static inline php_memc_object_t *php_memc_fetch_object(zend_object *obj) { + php_memc_object_t* intern = NULL; \ + php_memc_user_data_t* memc_user_data = NULL; + ++#if PHP_VERSION_ID < 80000 + #define MEMC_METHOD_FETCH_OBJECT \ + intern = Z_MEMC_OBJ_P(object); \ + if (!intern->memc) { \ +@@ -203,6 +204,16 @@ static inline php_memc_object_t *php_memc_fetch_object(zend_object *obj) { + } \ + memc_user_data = (php_memc_user_data_t *) memcached_get_user_data(intern->memc); \ + (void)memc_user_data; /* avoid unused variable warning */ ++#else ++#define MEMC_METHOD_FETCH_OBJECT \ ++ intern = Z_MEMC_OBJ_P(object); \ ++ if (!intern->memc) { \ ++ zend_throw_error(NULL, "Memcached constructor was not called"); \ ++ RETURN_THROWS(); \ ++ } \ ++ memc_user_data = (php_memc_user_data_t *) memcached_get_user_data(intern->memc); \ ++ (void)memc_user_data; /* avoid unused variable warning */ ++#endif + + static + zend_bool s_memc_valid_key_binary(zend_string *key) +diff --git a/tests/bad_construct_8.phpt b/tests/bad_construct_8.phpt +index 81daa5a..10928cf 100644 +--- a/tests/bad_construct_8.phpt ++++ b/tests/bad_construct_8.phpt +@@ -20,15 +20,17 @@ class extended extends Memcached { + } + + error_reporting(E_ALL); +-$extended = new extended (); +-var_dump ($extended->setOption (Memcached::OPT_BINARY_PROTOCOL, true)); ++try { ++ $extended = new extended (); ++ var_dump ($extended->setOption (Memcached::OPT_BINARY_PROTOCOL, true)); ++} catch (Error $e) { ++ echo $e->getMessage() . PHP_EOL; ++} + + echo "OK" . PHP_EOL; + + --EXPECTF-- + Memcached::__construct(): Argument #1 ($persistent_id) must be of type ?string, stdClass given +- +-Warning: Memcached::setOption(): Memcached constructor was not called in %s +-NULL ++Memcached constructor was not called + OK + diff --git a/467.patch b/467.patch new file mode 100644 index 0000000..15c6621 --- /dev/null +++ b/467.patch @@ -0,0 +1,162 @@ +From 5f345d140294c3619791f0980090df3683ad805e Mon Sep 17 00:00:00 2001 +From: Michael Wallner <mike@php.net> +Date: Mon, 30 Nov 2020 13:50:36 +0100 +Subject: [PATCH] fix php8 arginfo + +--- + php_memcached.stub.php | 14 +++++++------- + php_memcached_arginfo.h | 28 ++++++++++++++-------------- + php_memcached_legacy_arginfo.h | 2 +- + 3 files changed, 22 insertions(+), 22 deletions(-) + +diff --git a/php_memcached.stub.php b/php_memcached.stub.php +index 4ba6d5b..e44ff4a 100644 +--- a/php_memcached.stub.php ++++ b/php_memcached.stub.php +@@ -35,16 +35,16 @@ public function cas(string $cas_token, string $key, mixed $value, int $expiratio + public function casByKey(string $cas_token, string $server_key, string $key, mixed $value, int $expiration=0): bool {} + public function add(string $key, mixed $value, int $expiration=0): bool {} + public function addByKey(string $server_key, string $key, mixed $value, int $expiration=0): bool {} +- public function append(string $key, string $value): bool {} +- public function appendByKey(string $server_key, string $key, string $value): bool {} +- public function prepend(string $key, string $value): bool {} +- public function prependByKey(string $server_key, string $key, string $value): bool {} ++ public function append(string $key, string $value): ?bool {} ++ public function appendByKey(string $server_key, string $key, string $value): ?bool {} ++ public function prepend(string $key, string $value): ?bool {} ++ public function prependByKey(string $server_key, string $key, string $value): ?bool {} + public function replace(string $key, mixed $value, int $expiration=0): bool {} + public function replaceByKey(string $server_key, string $key, mixed $value, int $expiration=0): bool {} + public function delete(string $key, int $time=0): bool {} +- public function deleteMulti(array $keys, int $time=0): bool {} ++ public function deleteMulti(array $keys, int $time=0): array {} + public function deleteByKey(string $server_key, string $key, int $time=0): bool {} +- public function deleteMultiByKey(string $server_key, array $keys, int $time=0): bool {} ++ public function deleteMultiByKey(string $server_key, array $keys, int $time=0): array {} + + public function increment(string $key, int $offset=1, int $initial_value=0, int $expiry=0): false|int {} + public function decrement(string $key, int $offset=1, int $initial_value=0, int $expiry=0): false|int {} +@@ -73,7 +73,7 @@ public function flush(int $delay=0): bool {} + public function getOption(int $option): mixed {} + public function setOption(int $option, mixed $value): bool {} + public function setOptions(array $options): bool {} +- public function setBucket(array $host_map, array $forward_map, int $replicas): bool {} ++ public function setBucket(array $host_map, ?array $forward_map, int $replicas): bool {} + #ifdef HAVE_MEMCACHED_SASL + public function setSaslAuthData(string $username, string $password): bool {} + #endif +diff --git a/php_memcached_arginfo.h b/php_memcached_arginfo.h +index 6729dd3..18b17cc 100644 +--- a/php_memcached_arginfo.h ++++ b/php_memcached_arginfo.h +@@ -1,10 +1,10 @@ + /* This is a generated file, edit the .stub.php file instead. +- * Stub hash: a33d23c6659922e98d3704879eb4bc820e1819df */ ++ * Stub hash: 3e5af769d67ce91bd713bb11b325a9ccaabbfb7a */ + + ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Memcached___construct, 0, 0, 0) +- ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, persistent_id, IS_STRING, 0, "NULL") +- ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, callback, IS_CALLABLE, 0, "NULL") +- ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, connection_str, IS_STRING, 0, "NULL") ++ ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, persistent_id, IS_STRING, 1, "NULL") ++ ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, callback, IS_CALLABLE, 1, "NULL") ++ ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, connection_str, IS_STRING, 1, "NULL") + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_Memcached_getResultCode, 0, 0, IS_LONG, 0) +@@ -15,14 +15,14 @@ ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_Memcached_get, 0, 1, IS_MIXED, 0) + ZEND_ARG_TYPE_INFO(0, key, IS_STRING, 0) +- ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, cache_cb, IS_CALLABLE, 0, "NULL") ++ ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, cache_cb, IS_CALLABLE, 1, "NULL") + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, get_flags, IS_LONG, 0, "0") + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_Memcached_getByKey, 0, 2, IS_MIXED, 0) + ZEND_ARG_TYPE_INFO(0, server_key, IS_STRING, 0) + ZEND_ARG_TYPE_INFO(0, key, IS_STRING, 0) +- ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, cache_cb, IS_CALLABLE, 0, "NULL") ++ ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, cache_cb, IS_CALLABLE, 1, "NULL") + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, get_flags, IS_LONG, 0, "0") + ZEND_END_ARG_INFO() + +@@ -40,14 +40,14 @@ ZEND_END_ARG_INFO() + ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_Memcached_getDelayed, 0, 1, _IS_BOOL, 0) + ZEND_ARG_TYPE_INFO(0, keys, IS_ARRAY, 0) + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, with_cas, _IS_BOOL, 0, "0") +- ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, value_cb, IS_CALLABLE, 0, "NULL") ++ ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, value_cb, IS_CALLABLE, 1, "NULL") + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_Memcached_getDelayedByKey, 0, 2, _IS_BOOL, 0) + ZEND_ARG_TYPE_INFO(0, server_key, IS_STRING, 0) + ZEND_ARG_TYPE_INFO(0, keys, IS_ARRAY, 0) + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, with_cas, _IS_BOOL, 0, "0") +- ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, value_cb, IS_CALLABLE, 0, "NULL") ++ ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, value_cb, IS_CALLABLE, 1, "NULL") + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_class_Memcached_fetch, 0, 0, MAY_BE_FALSE|MAY_BE_ARRAY) +@@ -109,12 +109,12 @@ ZEND_END_ARG_INFO() + + #define arginfo_class_Memcached_addByKey arginfo_class_Memcached_setByKey + +-ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_Memcached_append, 0, 2, _IS_BOOL, 0) ++ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_Memcached_append, 0, 2, _IS_BOOL, 1) + ZEND_ARG_TYPE_INFO(0, key, IS_STRING, 0) + ZEND_ARG_TYPE_INFO(0, value, IS_STRING, 0) + ZEND_END_ARG_INFO() + +-ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_Memcached_appendByKey, 0, 3, _IS_BOOL, 0) ++ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_Memcached_appendByKey, 0, 3, _IS_BOOL, 1) + ZEND_ARG_TYPE_INFO(0, server_key, IS_STRING, 0) + ZEND_ARG_TYPE_INFO(0, key, IS_STRING, 0) + ZEND_ARG_TYPE_INFO(0, value, IS_STRING, 0) +@@ -133,7 +133,7 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_Memcached_delete, 0, 1, _I + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, time, IS_LONG, 0, "0") + ZEND_END_ARG_INFO() + +-ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_Memcached_deleteMulti, 0, 1, _IS_BOOL, 0) ++ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_Memcached_deleteMulti, 0, 1, IS_ARRAY, 0) + ZEND_ARG_TYPE_INFO(0, keys, IS_ARRAY, 0) + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, time, IS_LONG, 0, "0") + ZEND_END_ARG_INFO() +@@ -144,7 +144,7 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_Memcached_deleteByKey, 0, + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, time, IS_LONG, 0, "0") + ZEND_END_ARG_INFO() + +-ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_Memcached_deleteMultiByKey, 0, 2, _IS_BOOL, 0) ++ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_Memcached_deleteMultiByKey, 0, 2, IS_ARRAY, 0) + ZEND_ARG_TYPE_INFO(0, server_key, IS_STRING, 0) + ZEND_ARG_TYPE_INFO(0, keys, IS_ARRAY, 0) + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, time, IS_LONG, 0, "0") +@@ -202,7 +202,7 @@ ZEND_END_ARG_INFO() + #define arginfo_class_Memcached_getLastDisconnectedServer arginfo_class_Memcached_fetch + + ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_class_Memcached_getStats, 0, 0, MAY_BE_FALSE|MAY_BE_ARRAY) +- ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, type, IS_STRING, 0, "NULL") ++ ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, type, IS_STRING, 1, "NULL") + ZEND_END_ARG_INFO() + + #define arginfo_class_Memcached_getVersion arginfo_class_Memcached_fetch +@@ -228,7 +228,7 @@ ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_Memcached_setBucket, 0, 3, _IS_BOOL, 0) + ZEND_ARG_TYPE_INFO(0, host_map, IS_ARRAY, 0) +- ZEND_ARG_TYPE_INFO(0, forward_map, IS_ARRAY, 0) ++ ZEND_ARG_TYPE_INFO(0, forward_map, IS_ARRAY, 1) + ZEND_ARG_TYPE_INFO(0, replicas, IS_LONG, 0) + ZEND_END_ARG_INFO() + +diff --git a/php_memcached_legacy_arginfo.h b/php_memcached_legacy_arginfo.h +index 6f21d2a..2c0b2de 100644 +--- a/php_memcached_legacy_arginfo.h ++++ b/php_memcached_legacy_arginfo.h +@@ -1,5 +1,5 @@ + /* This is a generated file, edit the .stub.php file instead. +- * Stub hash: a33d23c6659922e98d3704879eb4bc820e1819df */ ++ * Stub hash: 3e5af769d67ce91bd713bb11b325a9ccaabbfb7a */ + + ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Memcached___construct, 0, 0, 0) + ZEND_ARG_INFO(0, persistent_id) diff --git a/468.patch b/468.patch new file mode 100644 index 0000000..1b52707 --- /dev/null +++ b/468.patch @@ -0,0 +1,70 @@ +From d5b084479c74c33e054612fc6e7f969b6bab359e Mon Sep 17 00:00:00 2001 +From: Graham Campbell <GrahamCampbell@users.noreply.github.com> +Date: Thu, 17 Dec 2020 17:20:08 +0000 +Subject: [PATCH 1/3] Fixed ParseError in stub file + +--- + php_memcached.stub.php | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/php_memcached.stub.php b/php_memcached.stub.php +index e44ff4a..e813ae7 100644 +--- a/php_memcached.stub.php ++++ b/php_memcached.stub.php +@@ -17,7 +17,7 @@ public function get(string $key, callable $cache_cb=NULL, int $get_flags=0): mix + public function getByKey(string $server_key, string $key, callable $cache_cb=NULL, int $get_flags=0): mixed {} + public function getMulti(array $keys, int $get_flags=0): false|array {} + public function getMultiByKey(string $server_key, array $keys, int $get_flags=0): false|array {} +- public function getDelayed(array $keys, bool $with_cas=0, callable $value_cb=NULL): bool {} ++ public function getDelayed(array $keys, bool $with_cas=FALSE, callable $value_cb=NULL): bool {} + public function getDelayedByKey(string $server_key, array $keys, bool $with_cas=0, callable $value_cb=NULL): bool {} + public function fetch(): false|array {} + public function fetchAll(): false|array {} + +From 015d7c6705a2b0b26d539939cf792b4ef99c431a Mon Sep 17 00:00:00 2001 +From: Graham Campbell <GrahamCampbell@users.noreply.github.com> +Date: Thu, 17 Dec 2020 17:22:33 +0000 +Subject: [PATCH 2/3] Update php_memcached.stub.php + +--- + php_memcached.stub.php | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/php_memcached.stub.php b/php_memcached.stub.php +index e813ae7..836dff7 100644 +--- a/php_memcached.stub.php ++++ b/php_memcached.stub.php +@@ -18,7 +18,7 @@ public function getByKey(string $server_key, string $key, callable $cache_cb=NUL + public function getMulti(array $keys, int $get_flags=0): false|array {} + public function getMultiByKey(string $server_key, array $keys, int $get_flags=0): false|array {} + public function getDelayed(array $keys, bool $with_cas=FALSE, callable $value_cb=NULL): bool {} +- public function getDelayedByKey(string $server_key, array $keys, bool $with_cas=0, callable $value_cb=NULL): bool {} ++ public function getDelayedByKey(string $server_key, array $keys, bool $with_cas=FALSE, callable $value_cb=NULL): bool {} + public function fetch(): false|array {} + public function fetchAll(): false|array {} + + +From fafaf7fc6533cc5d48d784d0d2661338ab81b4c0 Mon Sep 17 00:00:00 2001 +From: Graham Campbell <graham@alt-three.com> +Date: Thu, 17 Dec 2020 17:24:51 +0000 +Subject: [PATCH 3/3] Match PHP 7 version of the file + +--- + php_memcached.stub.php | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/php_memcached.stub.php b/php_memcached.stub.php +index 836dff7..6b84c5b 100644 +--- a/php_memcached.stub.php ++++ b/php_memcached.stub.php +@@ -17,8 +17,8 @@ public function get(string $key, callable $cache_cb=NULL, int $get_flags=0): mix + public function getByKey(string $server_key, string $key, callable $cache_cb=NULL, int $get_flags=0): mixed {} + public function getMulti(array $keys, int $get_flags=0): false|array {} + public function getMultiByKey(string $server_key, array $keys, int $get_flags=0): false|array {} +- public function getDelayed(array $keys, bool $with_cas=FALSE, callable $value_cb=NULL): bool {} +- public function getDelayedByKey(string $server_key, array $keys, bool $with_cas=FALSE, callable $value_cb=NULL): bool {} ++ public function getDelayed(array $keys, bool $with_cas=NULL, callable $value_cb=NULL): bool {} ++ public function getDelayedByKey(string $server_key, array $keys, bool $with_cas=NULL, callable $value_cb=NULL): bool {} + public function fetch(): false|array {} + public function fetchAll(): false|array {} + diff --git a/469.patch b/469.patch new file mode 100644 index 0000000..9644ab5 --- /dev/null +++ b/469.patch @@ -0,0 +1,86 @@ +From 034d6e89121de79fd022bfef0ed2c273588fbfcf Mon Sep 17 00:00:00 2001 +From: Graham Campbell <graham@alt-three.com> +Date: Fri, 18 Dec 2020 19:25:59 +0000 +Subject: [PATCH] Re-generated .h files after stubs were modified + +--- + php_memcached_arginfo.h | 22 +++++++++++----------- + php_memcached_legacy_arginfo.h | 2 +- + 2 files changed, 12 insertions(+), 12 deletions(-) + +diff --git a/php_memcached_arginfo.h b/php_memcached_arginfo.h +index 18b17cc..6b05cf4 100644 +--- a/php_memcached_arginfo.h ++++ b/php_memcached_arginfo.h +@@ -1,10 +1,10 @@ + /* This is a generated file, edit the .stub.php file instead. +- * Stub hash: 3e5af769d67ce91bd713bb11b325a9ccaabbfb7a */ ++ * Stub hash: 8ce11ff45ccb2b1c765e5f313305f539ca3fa4f6 */ + + ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Memcached___construct, 0, 0, 0) +- ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, persistent_id, IS_STRING, 1, "NULL") +- ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, callback, IS_CALLABLE, 1, "NULL") +- ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, connection_str, IS_STRING, 1, "NULL") ++ ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, persistent_id, IS_STRING, 0, "NULL") ++ ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, callback, IS_CALLABLE, 0, "NULL") ++ ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, connection_str, IS_STRING, 0, "NULL") + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_Memcached_getResultCode, 0, 0, IS_LONG, 0) +@@ -15,14 +15,14 @@ ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_Memcached_get, 0, 1, IS_MIXED, 0) + ZEND_ARG_TYPE_INFO(0, key, IS_STRING, 0) +- ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, cache_cb, IS_CALLABLE, 1, "NULL") ++ ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, cache_cb, IS_CALLABLE, 0, "NULL") + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, get_flags, IS_LONG, 0, "0") + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_Memcached_getByKey, 0, 2, IS_MIXED, 0) + ZEND_ARG_TYPE_INFO(0, server_key, IS_STRING, 0) + ZEND_ARG_TYPE_INFO(0, key, IS_STRING, 0) +- ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, cache_cb, IS_CALLABLE, 1, "NULL") ++ ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, cache_cb, IS_CALLABLE, 0, "NULL") + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, get_flags, IS_LONG, 0, "0") + ZEND_END_ARG_INFO() + +@@ -39,15 +39,15 @@ ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_Memcached_getDelayed, 0, 1, _IS_BOOL, 0) + ZEND_ARG_TYPE_INFO(0, keys, IS_ARRAY, 0) +- ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, with_cas, _IS_BOOL, 0, "0") +- ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, value_cb, IS_CALLABLE, 1, "NULL") ++ ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, with_cas, _IS_BOOL, 0, "NULL") ++ ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, value_cb, IS_CALLABLE, 0, "NULL") + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_Memcached_getDelayedByKey, 0, 2, _IS_BOOL, 0) + ZEND_ARG_TYPE_INFO(0, server_key, IS_STRING, 0) + ZEND_ARG_TYPE_INFO(0, keys, IS_ARRAY, 0) +- ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, with_cas, _IS_BOOL, 0, "0") +- ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, value_cb, IS_CALLABLE, 1, "NULL") ++ ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, with_cas, _IS_BOOL, 0, "NULL") ++ ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, value_cb, IS_CALLABLE, 0, "NULL") + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_class_Memcached_fetch, 0, 0, MAY_BE_FALSE|MAY_BE_ARRAY) +@@ -202,7 +202,7 @@ ZEND_END_ARG_INFO() + #define arginfo_class_Memcached_getLastDisconnectedServer arginfo_class_Memcached_fetch + + ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_class_Memcached_getStats, 0, 0, MAY_BE_FALSE|MAY_BE_ARRAY) +- ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, type, IS_STRING, 1, "NULL") ++ ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, type, IS_STRING, 0, "NULL") + ZEND_END_ARG_INFO() + + #define arginfo_class_Memcached_getVersion arginfo_class_Memcached_fetch +diff --git a/php_memcached_legacy_arginfo.h b/php_memcached_legacy_arginfo.h +index 2c0b2de..c942616 100644 +--- a/php_memcached_legacy_arginfo.h ++++ b/php_memcached_legacy_arginfo.h +@@ -1,5 +1,5 @@ + /* This is a generated file, edit the .stub.php file instead. +- * Stub hash: 3e5af769d67ce91bd713bb11b325a9ccaabbfb7a */ ++ * Stub hash: 8ce11ff45ccb2b1c765e5f313305f539ca3fa4f6 */ + + ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Memcached___construct, 0, 0, 0) + ZEND_ARG_INFO(0, persistent_id) diff --git a/472.patch b/472.patch new file mode 100644 index 0000000..78afdf4 --- /dev/null +++ b/472.patch @@ -0,0 +1,123 @@ +From a92bf68eeed33392f0a117aec9750ad4c7b4358c Mon Sep 17 00:00:00 2001 +From: Michael Wallner <mike@php.net> +Date: Mon, 18 Jan 2021 14:24:28 +0100 +Subject: [PATCH] fix php8 arginfo + +--- + php_memcached.stub.php | 12 ++++++------ + php_memcached_arginfo.h | 22 +++++++++++----------- + php_memcached_legacy_arginfo.h | 2 +- + 3 files changed, 18 insertions(+), 18 deletions(-) + +diff --git a/php_memcached.stub.php b/php_memcached.stub.php +index 6b84c5b..5a735b5 100644 +--- a/php_memcached.stub.php ++++ b/php_memcached.stub.php +@@ -8,17 +8,17 @@ + + class Memcached { + +- public function __construct(string $persistent_id=NULL, callable $callback=NULL, string $connection_str=NULL) {} ++ public function __construct(string $persistent_id=null, callable $callback=null, string $connection_str=null) {} + + public function getResultCode(): int {} + public function getResultMessage(): string {} + +- public function get(string $key, callable $cache_cb=NULL, int $get_flags=0): mixed {} +- public function getByKey(string $server_key, string $key, callable $cache_cb=NULL, int $get_flags=0): mixed {} ++ public function get(string $key, callable $cache_cb=null, int $get_flags=0): mixed {} ++ public function getByKey(string $server_key, string $key, callable $cache_cb=null, int $get_flags=0): mixed {} + public function getMulti(array $keys, int $get_flags=0): false|array {} + public function getMultiByKey(string $server_key, array $keys, int $get_flags=0): false|array {} +- public function getDelayed(array $keys, bool $with_cas=NULL, callable $value_cb=NULL): bool {} +- public function getDelayedByKey(string $server_key, array $keys, bool $with_cas=NULL, callable $value_cb=NULL): bool {} ++ public function getDelayed(array $keys, bool $with_cas=false, callable $value_cb=null): bool {} ++ public function getDelayedByKey(string $server_key, array $keys, bool $with_cas=false, callable $value_cb=null): bool {} + public function fetch(): false|array {} + public function fetchAll(): false|array {} + +@@ -64,7 +64,7 @@ public function getLastErrorCode(): int {} + public function getLastErrorErrno(): int {} + public function getLastDisconnectedServer(): false|array {} + +- public function getStats(string $type=NULL): false|array {} ++ public function getStats(string $type=null): false|array {} + public function getVersion(): false|array {} + public function getAllKeys(): false|array {} + +diff --git a/php_memcached_arginfo.h b/php_memcached_arginfo.h +index 6b05cf4..4c8a684 100644 +--- a/php_memcached_arginfo.h ++++ b/php_memcached_arginfo.h +@@ -1,10 +1,10 @@ + /* This is a generated file, edit the .stub.php file instead. +- * Stub hash: 8ce11ff45ccb2b1c765e5f313305f539ca3fa4f6 */ ++ * Stub hash: 573d35c5c6b6c397943e0f8ab9c505e2f4ce9e34 */ + + ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Memcached___construct, 0, 0, 0) +- ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, persistent_id, IS_STRING, 0, "NULL") +- ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, callback, IS_CALLABLE, 0, "NULL") +- ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, connection_str, IS_STRING, 0, "NULL") ++ ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, persistent_id, IS_STRING, 1, "null") ++ ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, callback, IS_CALLABLE, 1, "null") ++ ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, connection_str, IS_STRING, 1, "null") + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_Memcached_getResultCode, 0, 0, IS_LONG, 0) +@@ -15,14 +15,14 @@ ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_Memcached_get, 0, 1, IS_MIXED, 0) + ZEND_ARG_TYPE_INFO(0, key, IS_STRING, 0) +- ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, cache_cb, IS_CALLABLE, 0, "NULL") ++ ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, cache_cb, IS_CALLABLE, 1, "null") + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, get_flags, IS_LONG, 0, "0") + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_Memcached_getByKey, 0, 2, IS_MIXED, 0) + ZEND_ARG_TYPE_INFO(0, server_key, IS_STRING, 0) + ZEND_ARG_TYPE_INFO(0, key, IS_STRING, 0) +- ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, cache_cb, IS_CALLABLE, 0, "NULL") ++ ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, cache_cb, IS_CALLABLE, 1, "null") + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, get_flags, IS_LONG, 0, "0") + ZEND_END_ARG_INFO() + +@@ -39,15 +39,15 @@ ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_Memcached_getDelayed, 0, 1, _IS_BOOL, 0) + ZEND_ARG_TYPE_INFO(0, keys, IS_ARRAY, 0) +- ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, with_cas, _IS_BOOL, 0, "NULL") +- ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, value_cb, IS_CALLABLE, 0, "NULL") ++ ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, with_cas, _IS_BOOL, 0, "false") ++ ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, value_cb, IS_CALLABLE, 1, "null") + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_Memcached_getDelayedByKey, 0, 2, _IS_BOOL, 0) + ZEND_ARG_TYPE_INFO(0, server_key, IS_STRING, 0) + ZEND_ARG_TYPE_INFO(0, keys, IS_ARRAY, 0) +- ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, with_cas, _IS_BOOL, 0, "NULL") +- ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, value_cb, IS_CALLABLE, 0, "NULL") ++ ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, with_cas, _IS_BOOL, 0, "false") ++ ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, value_cb, IS_CALLABLE, 1, "null") + ZEND_END_ARG_INFO() + + ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_class_Memcached_fetch, 0, 0, MAY_BE_FALSE|MAY_BE_ARRAY) +@@ -202,7 +202,7 @@ ZEND_END_ARG_INFO() + #define arginfo_class_Memcached_getLastDisconnectedServer arginfo_class_Memcached_fetch + + ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_class_Memcached_getStats, 0, 0, MAY_BE_FALSE|MAY_BE_ARRAY) +- ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, type, IS_STRING, 0, "NULL") ++ ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, type, IS_STRING, 1, "null") + ZEND_END_ARG_INFO() + + #define arginfo_class_Memcached_getVersion arginfo_class_Memcached_fetch +diff --git a/php_memcached_legacy_arginfo.h b/php_memcached_legacy_arginfo.h +index c942616..a615e3a 100644 +--- a/php_memcached_legacy_arginfo.h ++++ b/php_memcached_legacy_arginfo.h +@@ -1,5 +1,5 @@ + /* This is a generated file, edit the .stub.php file instead. +- * Stub hash: 8ce11ff45ccb2b1c765e5f313305f539ca3fa4f6 */ ++ * Stub hash: 573d35c5c6b6c397943e0f8ab9c505e2f4ce9e34 */ + + ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Memcached___construct, 0, 0, 0) + ZEND_ARG_INFO(0, persistent_id) diff --git a/473.patch b/473.patch new file mode 100644 index 0000000..d018942 --- /dev/null +++ b/473.patch @@ -0,0 +1,37 @@ +From 74c0e38fa5eb8d37e7789f46b8f9cf4ed37cd375 Mon Sep 17 00:00:00 2001 +From: Remi Collet <remi@remirepo.net> +Date: Mon, 18 Jan 2021 16:34:40 +0100 +Subject: [PATCH] missing header for inet_ntoa + +--- + config.m4 | 2 ++ + php_memcached_server.c | 3 +++ + 2 files changed, 5 insertions(+) + +diff --git a/config.m4 b/config.m4 +index c7a15f1..b54a12d 100644 +--- a/config.m4 ++++ b/config.m4 +@@ -392,6 +392,8 @@ if test "$PHP_MEMCACHED" != "no"; then + + CFLAGS="$ORIG_CFLAGS" + ++ AC_CHECK_HEADERS([arpa/inet.h]) ++ + export PKG_CONFIG_PATH="$ORIG_PKG_CONFIG_PATH" + PHP_SUBST(MEMCACHED_SHARED_LIBADD) + +diff --git a/php_memcached_server.c b/php_memcached_server.c +index 870209c..83bd15e 100644 +--- a/php_memcached_server.c ++++ b/php_memcached_server.c +@@ -17,6 +17,9 @@ + #include "php_memcached.h" + #include "php_memcached_private.h" + #include "php_memcached_server.h" ++#if HAVE_ARPA_INET_H ++#include <arpa/inet.h> ++#endif + + #include <event2/listener.h> + diff --git a/php-pecl-memcached.spec b/php-pecl-memcached.spec index 288a3a2..614c0d0 100644 --- a/php-pecl-memcached.spec +++ b/php-pecl-memcached.spec @@ -3,7 +3,7 @@ # # Fedora spec file for php-pecl-memcached # -# Copyright (c) 2009-2020 Remi Collet +# Copyright (c) 2009-2021 Remi Collet # License: CC-BY-SA # http://creativecommons.org/licenses/by-sa/4.0/ # @@ -31,7 +31,7 @@ Summary: Extension to work with the Memcached caching daemon Name: %{?sub_prefix}php-pecl-memcached Version: 3.1.5 -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;')}} License: PHP URL: https://pecl.php.net/package/%{pecl_name} @@ -39,6 +39,12 @@ Source0: https://pecl.php.net/get/%{pecl_name}-%{version}.tgz Patch0: https://patch-diff.githubusercontent.com/raw/php-memcached-dev/php-memcached/pull/461.patch Patch1: https://patch-diff.githubusercontent.com/raw/php-memcached-dev/php-memcached/pull/463.patch +Patch2: https://patch-diff.githubusercontent.com/raw/php-memcached-dev/php-memcached/pull/465.patch +Patch3: https://patch-diff.githubusercontent.com/raw/php-memcached-dev/php-memcached/pull/467.patch +Patch4: https://patch-diff.githubusercontent.com/raw/php-memcached-dev/php-memcached/pull/468.patch +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 BuildRequires: %{?dtsprefix}gcc BuildRequires: %{?scl_prefix}php-devel >= 7 @@ -58,7 +64,7 @@ BuildRequires: memcached %endif BuildRequires: pkgconfig(libevent) >= 2.0.2 -%if 0%{?rhel} == 6 || 0%{?rhel} == 7 +%if 0%{?rhel} == 7 %global move_to_opt 1 BuildRequires: libmemcached-opt-devel >= 1.0.18 Requires: fastlz%{?_isa} @@ -119,10 +125,6 @@ Obsoletes: php80-pecl-%{pecl_name} <= %{version} %endif %endif -%if 0%{?fedora} < 20 && 0%{?rhel} < 7 -# Filter private shared -%{?filter_provides_in: %filter_provides_in %{_libdir}/.*\.so$} -%endif %if %{move_to_opt} %{?filter_requires_in: %filter_requires_in %{_libdir}/.*\.so$} %endif @@ -155,6 +157,12 @@ cd NTS %if "%{php_version}" > "8.0" %patch0 -p1 -b .pr461 %patch1 -p1 -b .pr463 +%patch2 -p1 -b .pr465 +%patch3 -p1 -b .pr467 +%patch4 -p1 -b .pr468 +%patch5 -p1 -b .pr469 +%patch6 -p1 -b .pr472 +%patch7 -p1 -b .pr473 %endif %if %{with_fastlz} @@ -355,6 +363,15 @@ exit $ret %changelog * Thu Oct 8 2020 Remi Collet <remi@remirepo.net> - 3.1.5-3 +- more patches for PHP 8 from + https://github.com/php-memcached-dev/php-memcached/pull/465 + https://github.com/php-memcached-dev/php-memcached/pull/467 + https://github.com/php-memcached-dev/php-memcached/pull/468 + https://github.com/php-memcached-dev/php-memcached/pull/469 + https://github.com/php-memcached-dev/php-memcached/pull/472 + https://github.com/php-memcached-dev/php-memcached/pull/473 + +* Thu Oct 8 2020 Remi Collet <remi@remirepo.net> - 3.1.5-3 - add patches for PHP 8 from https://github.com/php-memcached-dev/php-memcached/pull/461 https://github.com/php-memcached-dev/php-memcached/pull/463 |