From b74826b326fdf9ad4a4ccdc85256f80c86dc405b Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Thu, 8 Oct 2020 12:45:55 +0200 Subject: 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 --- 461.patch | 25 + 463.patch | 1651 +++++++++++++++++++++++++++++++++++++++++++++++ php-pecl-memcached.spec | 35 +- 3 files changed, 1698 insertions(+), 13 deletions(-) create mode 100644 461.patch create mode 100644 463.patch diff --git a/461.patch b/461.patch new file mode 100644 index 0000000..859907d --- /dev/null +++ b/461.patch @@ -0,0 +1,25 @@ +From 1b68fe77b9674e1f1da4fa0e8706e3a35f1eda03 Mon Sep 17 00:00:00 2001 +From: Dmitriy +Date: Fri, 2 Oct 2020 10:53:28 +0300 +Subject: [PATCH] fix php 8.0 build + +fci.no_separation removed on php 8.0. +https://github.com/php/php-src/commit/302933daea77663f5759b10accd1d0231393b24c +--- + php_memcached_server.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/php_memcached_server.c b/php_memcached_server.c +index 4c0080e..870209c 100644 +--- a/php_memcached_server.c ++++ b/php_memcached_server.c +@@ -63,7 +63,9 @@ long s_invoke_php_callback (php_memc_server_cb_t *cb, zval *params, ssize_t para + cb->fci.retval = retval; + cb->fci.params = params; + cb->fci.param_count = param_count; ++#if PHP_VERSION_ID < 80000 + cb->fci.no_separation = 1; ++#endif + + if (zend_call_function(&(cb->fci), &(cb->fci_cache)) == FAILURE) { + char *buf = php_memc_printable_func(&(cb->fci), &(cb->fci_cache)); diff --git a/463.patch b/463.patch new file mode 100644 index 0000000..756880e --- /dev/null +++ b/463.patch @@ -0,0 +1,1651 @@ +From e8f53777d3f578586f2a32f1b3bdcc3f53e74b39 Mon Sep 17 00:00:00 2001 +From: Remi Collet +Date: Thu, 8 Oct 2020 11:58:43 +0200 +Subject: [PATCH 1/2] generate arginfo from stub for PHP 7 and 8 + +--- + php_memcached.c | 404 +------------------------------- + php_memcached.stub.php | 94 ++++++++ + php_memcached_arginfo.h | 411 +++++++++++++++++++++++++++++++++ + php_memcached_legacy_arginfo.h | 407 ++++++++++++++++++++++++++++++++ + tests/bad_construct.phpt | 5 +- + tests/bad_construct_8.phpt | 34 +++ + tests/expire.phpt | 1 + + tests/undefined_set.phpt | 10 +- + tests/vbucket.phpt | 20 -- + tests/vbucket_error_7.phpt | 40 ++++ + tests/vbucket_error_8.phpt | 41 ++++ + 11 files changed, 1044 insertions(+), 423 deletions(-) + create mode 100644 php_memcached.stub.php + create mode 100644 php_memcached_arginfo.h + create mode 100644 php_memcached_legacy_arginfo.h + create mode 100644 tests/bad_construct_8.phpt + create mode 100644 tests/vbucket_error_7.phpt + create mode 100644 tests/vbucket_error_8.phpt + +diff --git a/php_memcached.c b/php_memcached.c +index 5063695..147cb4a 100644 +--- a/php_memcached.c ++++ b/php_memcached.c +@@ -1853,7 +1853,7 @@ static void php_memc_setMulti_impl(INTERNAL_FUNCTION_PARAMETERS, zend_bool by_ke + { + zval *entries; + zend_string *server_key = NULL; +- zend_long expiration = 0, ignored; ++ zend_long expiration = 0; + zval *value; + zend_string *skey; + zend_ulong num_key; +@@ -1867,7 +1867,6 @@ static void php_memc_setMulti_impl(INTERNAL_FUNCTION_PARAMETERS, zend_bool by_ke + Z_PARAM_ARRAY(entries) + Z_PARAM_OPTIONAL + Z_PARAM_LONG(expiration) +- Z_PARAM_LONG(ignored) + ZEND_PARSE_PARAMETERS_END(); + } else { + /* "a|ll" */ +@@ -1875,7 +1874,6 @@ static void php_memc_setMulti_impl(INTERNAL_FUNCTION_PARAMETERS, zend_bool by_ke + Z_PARAM_ARRAY(entries) + Z_PARAM_OPTIONAL + Z_PARAM_LONG(expiration) +- Z_PARAM_LONG(ignored) + ZEND_PARSE_PARAMETERS_END(); + } + +@@ -2071,7 +2069,6 @@ static void php_memc_cas_impl(INTERNAL_FUNCTION_PARAMETERS, zend_bool by_key) + zend_string *server_key = NULL; + zval *value; + zend_long expiration = 0; +- zend_long ignored; + zend_string *payload; + uint32_t flags = 0; + memcached_return status; +@@ -2086,7 +2083,6 @@ static void php_memc_cas_impl(INTERNAL_FUNCTION_PARAMETERS, zend_bool by_key) + Z_PARAM_ZVAL(value) + Z_PARAM_OPTIONAL + Z_PARAM_LONG(expiration) +- Z_PARAM_LONG(ignored) + ZEND_PARSE_PARAMETERS_END(); + } else { + /* "zSz|ll" */ +@@ -2096,7 +2092,6 @@ static void php_memc_cas_impl(INTERNAL_FUNCTION_PARAMETERS, zend_bool by_key) + Z_PARAM_ZVAL(value) + Z_PARAM_OPTIONAL + Z_PARAM_LONG(expiration) +- Z_PARAM_LONG(ignored) + ZEND_PARSE_PARAMETERS_END(); + } + +@@ -3862,395 +3857,10 @@ PHP_METHOD(MemcachedServer, on) + + #endif + +-/* {{{ methods arginfo */ +-ZEND_BEGIN_ARG_INFO_EX(arginfo___construct, 0, 0, 0) +- ZEND_ARG_INFO(0, persistent_id) +- ZEND_ARG_INFO(0, callback) +-ZEND_END_ARG_INFO() +- +-ZEND_BEGIN_ARG_INFO(arginfo_getResultCode, 0) +-ZEND_END_ARG_INFO() +- +-ZEND_BEGIN_ARG_INFO(arginfo_getResultMessage, 0) +-ZEND_END_ARG_INFO() +- +-ZEND_BEGIN_ARG_INFO_EX(arginfo_get, 0, 0, 1) +- ZEND_ARG_INFO(0, key) +- ZEND_ARG_INFO(0, cache_cb) +- ZEND_ARG_INFO(0, get_flags) +-ZEND_END_ARG_INFO() +- +-ZEND_BEGIN_ARG_INFO_EX(arginfo_getByKey, 0, 0, 2) +- ZEND_ARG_INFO(0, server_key) +- ZEND_ARG_INFO(0, key) +- ZEND_ARG_INFO(0, cache_cb) +- ZEND_ARG_INFO(0, get_flags) +-ZEND_END_ARG_INFO() +- +-ZEND_BEGIN_ARG_INFO_EX(arginfo_getMulti, 0, 0, 1) +- ZEND_ARG_ARRAY_INFO(0, keys, 0) +- ZEND_ARG_INFO(0, get_flags) +-ZEND_END_ARG_INFO() +- +-ZEND_BEGIN_ARG_INFO_EX(arginfo_getMultiByKey, 0, 0, 2) +- ZEND_ARG_INFO(0, server_key) +- ZEND_ARG_ARRAY_INFO(0, keys, 0) +- ZEND_ARG_INFO(0, get_flags) +-ZEND_END_ARG_INFO() +- +-ZEND_BEGIN_ARG_INFO_EX(arginfo_getDelayed, 0, 0, 1) +- ZEND_ARG_ARRAY_INFO(0, keys, 0) +- ZEND_ARG_INFO(0, with_cas) +- ZEND_ARG_INFO(0, value_cb) +-ZEND_END_ARG_INFO() +- +-ZEND_BEGIN_ARG_INFO_EX(arginfo_getDelayedByKey, 0, 0, 2) +- ZEND_ARG_INFO(0, server_key) +- ZEND_ARG_ARRAY_INFO(0, keys, 0) +- ZEND_ARG_INFO(0, with_cas) +- ZEND_ARG_INFO(0, value_cb) +-ZEND_END_ARG_INFO() +- +-ZEND_BEGIN_ARG_INFO(arginfo_fetch, 0) +-ZEND_END_ARG_INFO() +- +-ZEND_BEGIN_ARG_INFO(arginfo_fetchAll, 0) +-ZEND_END_ARG_INFO() +- +-ZEND_BEGIN_ARG_INFO_EX(arginfo_set, 0, 0, 2) +- ZEND_ARG_INFO(0, key) +- ZEND_ARG_INFO(0, value) +- ZEND_ARG_INFO(0, expiration) +-ZEND_END_ARG_INFO() +- +-ZEND_BEGIN_ARG_INFO_EX(arginfo_setByKey, 0, 0, 3) +- ZEND_ARG_INFO(0, server_key) +- ZEND_ARG_INFO(0, key) +- ZEND_ARG_INFO(0, value) +- ZEND_ARG_INFO(0, expiration) +-ZEND_END_ARG_INFO() +- +-ZEND_BEGIN_ARG_INFO_EX(arginfo_touch, 0, 0, 2) +- ZEND_ARG_INFO(0, key) +- ZEND_ARG_INFO(0, expiration) +-ZEND_END_ARG_INFO() +- +-ZEND_BEGIN_ARG_INFO_EX(arginfo_touchByKey, 0, 0, 3) +- ZEND_ARG_INFO(0, server_key) +- ZEND_ARG_INFO(0, key) +- ZEND_ARG_INFO(0, expiration) +-ZEND_END_ARG_INFO() +- +-ZEND_BEGIN_ARG_INFO_EX(arginfo_setMulti, 0, 0, 1) +- ZEND_ARG_ARRAY_INFO(0, items, 0) +- ZEND_ARG_INFO(0, expiration) +-ZEND_END_ARG_INFO() +- +-ZEND_BEGIN_ARG_INFO_EX(arginfo_setMultiByKey, 0, 0, 2) +- ZEND_ARG_INFO(0, server_key) +- ZEND_ARG_ARRAY_INFO(0, items, 0) +- ZEND_ARG_INFO(0, expiration) +-ZEND_END_ARG_INFO() +- +-ZEND_BEGIN_ARG_INFO_EX(arginfo_add, 0, 0, 2) +- ZEND_ARG_INFO(0, key) +- ZEND_ARG_INFO(0, value) +- ZEND_ARG_INFO(0, expiration) +-ZEND_END_ARG_INFO() +- +-ZEND_BEGIN_ARG_INFO_EX(arginfo_addByKey, 0, 0, 3) +- ZEND_ARG_INFO(0, server_key) +- ZEND_ARG_INFO(0, key) +- ZEND_ARG_INFO(0, value) +- ZEND_ARG_INFO(0, expiration) +-ZEND_END_ARG_INFO() +- +-ZEND_BEGIN_ARG_INFO_EX(arginfo_replace, 0, 0, 2) +- ZEND_ARG_INFO(0, key) +- ZEND_ARG_INFO(0, value) +- ZEND_ARG_INFO(0, expiration) +-ZEND_END_ARG_INFO() +- +-ZEND_BEGIN_ARG_INFO_EX(arginfo_replaceByKey, 0, 0, 3) +- ZEND_ARG_INFO(0, server_key) +- ZEND_ARG_INFO(0, key) +- ZEND_ARG_INFO(0, value) +- ZEND_ARG_INFO(0, expiration) +-ZEND_END_ARG_INFO() +- +-ZEND_BEGIN_ARG_INFO_EX(arginfo_append, 0, 0, 2) +- ZEND_ARG_INFO(0, key) +- ZEND_ARG_INFO(0, value) +-ZEND_END_ARG_INFO() +- +-ZEND_BEGIN_ARG_INFO_EX(arginfo_appendByKey, 0, 0, 3) +- ZEND_ARG_INFO(0, server_key) +- ZEND_ARG_INFO(0, key) +- ZEND_ARG_INFO(0, value) +-ZEND_END_ARG_INFO() +- +-ZEND_BEGIN_ARG_INFO_EX(arginfo_prepend, 0, 0, 2) +- ZEND_ARG_INFO(0, key) +- ZEND_ARG_INFO(0, value) +-ZEND_END_ARG_INFO() +- +-ZEND_BEGIN_ARG_INFO_EX(arginfo_prependByKey, 0, 0, 3) +- ZEND_ARG_INFO(0, server_key) +- ZEND_ARG_INFO(0, key) +- ZEND_ARG_INFO(0, value) +-ZEND_END_ARG_INFO() +- +-ZEND_BEGIN_ARG_INFO_EX(arginfo_cas, 0, 0, 3) +- ZEND_ARG_INFO(0, cas_token) +- ZEND_ARG_INFO(0, key) +- ZEND_ARG_INFO(0, value) +- ZEND_ARG_INFO(0, expiration) +-ZEND_END_ARG_INFO() +- +-ZEND_BEGIN_ARG_INFO_EX(arginfo_casByKey, 0, 0, 4) +- ZEND_ARG_INFO(0, cas_token) +- ZEND_ARG_INFO(0, server_key) +- ZEND_ARG_INFO(0, key) +- ZEND_ARG_INFO(0, value) +- ZEND_ARG_INFO(0, expiration) +-ZEND_END_ARG_INFO() +- +-ZEND_BEGIN_ARG_INFO_EX(arginfo_delete, 0, 0, 1) +- ZEND_ARG_INFO(0, key) +- ZEND_ARG_INFO(0, time) +-ZEND_END_ARG_INFO() +- +-ZEND_BEGIN_ARG_INFO_EX(arginfo_deleteMulti, 0, 0, 1) +- ZEND_ARG_INFO(0, keys) +- ZEND_ARG_INFO(0, time) +-ZEND_END_ARG_INFO() +- +-ZEND_BEGIN_ARG_INFO_EX(arginfo_deleteByKey, 0, 0, 2) +- ZEND_ARG_INFO(0, server_key) +- ZEND_ARG_INFO(0, key) +- ZEND_ARG_INFO(0, time) +-ZEND_END_ARG_INFO() +- +-ZEND_BEGIN_ARG_INFO_EX(arginfo_deleteMultiByKey, 0, 0, 2) +- ZEND_ARG_INFO(0, server_key) +- ZEND_ARG_INFO(0, keys) +- ZEND_ARG_INFO(0, time) +-ZEND_END_ARG_INFO() +- +-ZEND_BEGIN_ARG_INFO_EX(arginfo_increment, 0, 0, 1) +- ZEND_ARG_INFO(0, key) +- ZEND_ARG_INFO(0, offset) +- ZEND_ARG_INFO(0, initial_value) +- ZEND_ARG_INFO(0, expiry) +-ZEND_END_ARG_INFO() +- +-ZEND_BEGIN_ARG_INFO_EX(arginfo_decrement, 0, 0, 1) +- ZEND_ARG_INFO(0, key) +- ZEND_ARG_INFO(0, offset) +- ZEND_ARG_INFO(0, initial_value) +- ZEND_ARG_INFO(0, expiry) +-ZEND_END_ARG_INFO() +- +-ZEND_BEGIN_ARG_INFO_EX(arginfo_incrementByKey, 0, 0, 2) +- ZEND_ARG_INFO(0, server_key) +- ZEND_ARG_INFO(0, key) +- ZEND_ARG_INFO(0, offset) +- ZEND_ARG_INFO(0, initial_value) +- ZEND_ARG_INFO(0, expiry) +-ZEND_END_ARG_INFO() +- +-ZEND_BEGIN_ARG_INFO_EX(arginfo_decrementByKey, 0, 0, 2) +- ZEND_ARG_INFO(0, server_key) +- ZEND_ARG_INFO(0, key) +- ZEND_ARG_INFO(0, offset) +- ZEND_ARG_INFO(0, initial_value) +- ZEND_ARG_INFO(0, expiry) +-ZEND_END_ARG_INFO() +- +-ZEND_BEGIN_ARG_INFO_EX(arginfo_flush, 0, 0, 0) +- ZEND_ARG_INFO(0, delay) +-ZEND_END_ARG_INFO() +- +-ZEND_BEGIN_ARG_INFO_EX(arginfo_addServer, 0, 0, 2) +- ZEND_ARG_INFO(0, host) +- ZEND_ARG_INFO(0, port) +- ZEND_ARG_INFO(0, weight) +-ZEND_END_ARG_INFO() +- +-ZEND_BEGIN_ARG_INFO_EX(arginfo_getStats, 0, 0, 0) +- ZEND_ARG_INFO(0, type) +-ZEND_END_ARG_INFO() +- +-ZEND_BEGIN_ARG_INFO(arginfo_addServers, 0) +- ZEND_ARG_ARRAY_INFO(0, servers, 0) +-ZEND_END_ARG_INFO() +- +-ZEND_BEGIN_ARG_INFO(arginfo_getServerList, 0) +-ZEND_END_ARG_INFO() +- +-ZEND_BEGIN_ARG_INFO(arginfo_resetServerList, 0) +-ZEND_END_ARG_INFO() +- +-ZEND_BEGIN_ARG_INFO(arginfo_quit, 0) +-ZEND_END_ARG_INFO() +- +-ZEND_BEGIN_ARG_INFO(arginfo_flushBuffers, 0) +-ZEND_END_ARG_INFO() +- +-ZEND_BEGIN_ARG_INFO(arginfo_getServerByKey, 0) +- ZEND_ARG_INFO(0, server_key) +-ZEND_END_ARG_INFO() +- +-ZEND_BEGIN_ARG_INFO(arginfo_getLastErrorMessage, 0) +-ZEND_END_ARG_INFO() +- +-ZEND_BEGIN_ARG_INFO(arginfo_getLastErrorCode, 0) +-ZEND_END_ARG_INFO() +- +-ZEND_BEGIN_ARG_INFO(arginfo_getLastErrorErrno, 0) +-ZEND_END_ARG_INFO() +- +-ZEND_BEGIN_ARG_INFO(arginfo_getLastDisconnectedServer, 0) +-ZEND_END_ARG_INFO() +- +-ZEND_BEGIN_ARG_INFO(arginfo_getOption, 0) +- ZEND_ARG_INFO(0, option) +-ZEND_END_ARG_INFO() +- +-#ifdef HAVE_MEMCACHED_SASL +-ZEND_BEGIN_ARG_INFO(arginfo_setSaslAuthData, 0) +- ZEND_ARG_INFO(0, username) +- ZEND_ARG_INFO(0, password) +-ZEND_END_ARG_INFO() +-#endif +- +-#ifdef HAVE_MEMCACHED_SET_ENCODING_KEY +-ZEND_BEGIN_ARG_INFO(arginfo_setEncodingKey, 0) +- ZEND_ARG_INFO(0, key) +-ZEND_END_ARG_INFO() +-#endif +- +-ZEND_BEGIN_ARG_INFO(arginfo_setOption, 0) +- ZEND_ARG_INFO(0, option) +- ZEND_ARG_INFO(0, value) +-ZEND_END_ARG_INFO() +- +-ZEND_BEGIN_ARG_INFO(arginfo_setOptions, 0) +- ZEND_ARG_INFO(0, options) +-ZEND_END_ARG_INFO() +- +-ZEND_BEGIN_ARG_INFO(arginfo_setBucket, 3) +- ZEND_ARG_INFO(0, host_map) +- ZEND_ARG_INFO(0, forward_map) +- ZEND_ARG_INFO(0, replicas) +-ZEND_END_ARG_INFO() +- +-ZEND_BEGIN_ARG_INFO(arginfo_getVersion, 0) +-ZEND_END_ARG_INFO() +- +-ZEND_BEGIN_ARG_INFO(arginfo_isPersistent, 0) +-ZEND_END_ARG_INFO() +- +-ZEND_BEGIN_ARG_INFO(arginfo_isPristine, 0) +-ZEND_END_ARG_INFO() +- +-ZEND_BEGIN_ARG_INFO(arginfo_getAllKeys, 0) +-ZEND_END_ARG_INFO() +-/* }}} */ +- +-/* {{{ memcached_class_methods */ +-#define MEMC_ME(name, args) PHP_ME(Memcached, name, args, ZEND_ACC_PUBLIC) +-static zend_function_entry memcached_class_methods[] = { +- MEMC_ME(__construct, arginfo___construct) +- +- MEMC_ME(getResultCode, arginfo_getResultCode) +- MEMC_ME(getResultMessage, arginfo_getResultMessage) +- +- MEMC_ME(get, arginfo_get) +- MEMC_ME(getByKey, arginfo_getByKey) +- MEMC_ME(getMulti, arginfo_getMulti) +- MEMC_ME(getMultiByKey, arginfo_getMultiByKey) +- MEMC_ME(getDelayed, arginfo_getDelayed) +- MEMC_ME(getDelayedByKey, arginfo_getDelayedByKey) +- MEMC_ME(fetch, arginfo_fetch) +- MEMC_ME(fetchAll, arginfo_fetchAll) +- +- MEMC_ME(set, arginfo_set) +- MEMC_ME(setByKey, arginfo_setByKey) +- +- MEMC_ME(touch, arginfo_touch) +- MEMC_ME(touchByKey, arginfo_touchByKey) +- +- MEMC_ME(setMulti, arginfo_setMulti) +- MEMC_ME(setMultiByKey, arginfo_setMultiByKey) +- +- MEMC_ME(cas, arginfo_cas) +- MEMC_ME(casByKey, arginfo_casByKey) +- MEMC_ME(add, arginfo_add) +- MEMC_ME(addByKey, arginfo_addByKey) +- MEMC_ME(append, arginfo_append) +- MEMC_ME(appendByKey, arginfo_appendByKey) +- MEMC_ME(prepend, arginfo_prepend) +- MEMC_ME(prependByKey, arginfo_prependByKey) +- MEMC_ME(replace, arginfo_replace) +- MEMC_ME(replaceByKey, arginfo_replaceByKey) +- MEMC_ME(delete, arginfo_delete) +- MEMC_ME(deleteMulti, arginfo_deleteMulti) +- MEMC_ME(deleteByKey, arginfo_deleteByKey) +- MEMC_ME(deleteMultiByKey, arginfo_deleteMultiByKey) +- +- MEMC_ME(increment, arginfo_increment) +- MEMC_ME(decrement, arginfo_decrement) +- MEMC_ME(incrementByKey, arginfo_incrementByKey) +- MEMC_ME(decrementByKey, arginfo_decrementByKey) +- +- MEMC_ME(addServer, arginfo_addServer) +- MEMC_ME(addServers, arginfo_addServers) +- MEMC_ME(getServerList, arginfo_getServerList) +- MEMC_ME(getServerByKey, arginfo_getServerByKey) +- MEMC_ME(resetServerList, arginfo_resetServerList) +- MEMC_ME(quit, arginfo_quit) +- MEMC_ME(flushBuffers, arginfo_flushBuffers) +- +- MEMC_ME(getLastErrorMessage, arginfo_getLastErrorMessage) +- MEMC_ME(getLastErrorCode, arginfo_getLastErrorCode) +- MEMC_ME(getLastErrorErrno, arginfo_getLastErrorErrno) +- MEMC_ME(getLastDisconnectedServer, arginfo_getLastDisconnectedServer) +- +- MEMC_ME(getStats, arginfo_getStats) +- MEMC_ME(getVersion, arginfo_getVersion) +- MEMC_ME(getAllKeys, arginfo_getAllKeys) +- +- MEMC_ME(flush, arginfo_flush) +- +- MEMC_ME(getOption, arginfo_getOption) +- MEMC_ME(setOption, arginfo_setOption) +- MEMC_ME(setOptions, arginfo_setOptions) +- MEMC_ME(setBucket, arginfo_setBucket) +-#ifdef HAVE_MEMCACHED_SASL +- MEMC_ME(setSaslAuthData, arginfo_setSaslAuthData) +-#endif +-#ifdef HAVE_MEMCACHED_SET_ENCODING_KEY +- MEMC_ME(setEncodingKey, arginfo_setEncodingKey) +-#endif +- MEMC_ME(isPersistent, arginfo_isPersistent) +- MEMC_ME(isPristine, arginfo_isPristine) +- { NULL, NULL, NULL } +-}; +-#undef MEMC_ME +-/* }}} */ +- +-#ifdef HAVE_MEMCACHED_PROTOCOL +-/* {{{ */ +-#define MEMC_SE_ME(name, args) PHP_ME(MemcachedServer, name, args, ZEND_ACC_PUBLIC) +-static +-zend_function_entry memcached_server_class_methods[] = { +- MEMC_SE_ME(run, NULL) +- MEMC_SE_ME(on, NULL) +- { NULL, NULL, NULL } +-}; +-#undef MEMC_SE_ME +-/* }}} */ ++#if PHP_VERSION_ID < 80000 ++#include "php_memcached_legacy_arginfo.h" ++#else ++#include "php_memcached_arginfo.h" + #endif + + /* {{{ memcached_module_entry +@@ -4592,7 +4202,7 @@ PHP_MINIT_FUNCTION(memcached) + + le_memc = zend_register_list_destructors_ex(NULL, php_memc_dtor, "Memcached persistent connection", module_number); + +- INIT_CLASS_ENTRY(ce, "Memcached", memcached_class_methods); ++ INIT_CLASS_ENTRY(ce, "Memcached", class_Memcached_methods); + memcached_ce = zend_register_internal_class(&ce); + memcached_ce->create_object = php_memc_object_new; + +@@ -4602,7 +4212,7 @@ PHP_MINIT_FUNCTION(memcached) + memcached_server_object_handlers.clone_obj = NULL; + memcached_server_object_handlers.free_obj = php_memc_server_free_storage; + +- INIT_CLASS_ENTRY(ce, "MemcachedServer", memcached_server_class_methods); ++ INIT_CLASS_ENTRY(ce, "MemcachedServer", class_MemcachedServer_methods); + memcached_server_ce = zend_register_internal_class(&ce); + memcached_server_ce->create_object = php_memc_server_new; + #endif +diff --git a/php_memcached.stub.php b/php_memcached.stub.php +new file mode 100644 +index 0000000..4ba6d5b +--- /dev/null ++++ b/php_memcached.stub.php +@@ -0,0 +1,94 @@ ++ ++= 80000) die("skip PHP 7 only"); ++?> + --FILE-- + ++--FILE-- ++getMessage() . PHP_EOL; ++} ++ ++class extended extends Memcached { ++ public function __construct () { ++ } ++} ++ ++error_reporting(E_ALL); ++$extended = new extended (); ++var_dump ($extended->setOption (Memcached::OPT_BINARY_PROTOCOL, true)); ++ ++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 ++OK ++ +diff --git a/tests/expire.phpt b/tests/expire.phpt +index eac0240..4fb49c5 100644 +--- a/tests/expire.phpt ++++ b/tests/expire.phpt +@@ -7,6 +7,7 @@ https://code.google.com/p/memcached/issues/detail?id=275 + $min_version = "1.4.8"; + include dirname(__FILE__) . "/skipif.inc"; + if (!method_exists("memcached", "touch")) die ("skip memcached::touch is not available"); ++if (getenv("SKIP_SLOW_TESTS")) die('skip slow test'); + ?> + --FILE-- + set($key, $value, $no_time); + var_dump($rv); + ?> + --EXPECTF-- +-Notice: Undefined variable: no_key in %s ++%s: Undefined variable%sno_key in %s + bool(false) + +-Notice: Undefined variable: no_value in %s ++%s: Undefined variable%sno_value in %s + bool(true) + +-Notice: Undefined variable: no_key in %s ++%s: Undefined variable%sno_key in %s + +-Notice: Undefined variable: no_value in %s ++%s: Undefined variable%sno_value in %s + bool(false) + +-Notice: Undefined variable: no_time in %s ++%s: Undefined variable%sno_time in %s + bool(true) +diff --git a/tests/vbucket.phpt b/tests/vbucket.phpt +index f17eb94..a691680 100644 +--- a/tests/vbucket.phpt ++++ b/tests/vbucket.phpt +@@ -18,14 +18,6 @@ var_dump ($m->setBucket (array (1,2,2), array (1,2,2), 2)); + + var_dump ($m->setBucket (array ('a', 'b', 'c'), null, 2)); + +-var_dump ($m->setBucket (array (), null, 2)); +- +-var_dump ($m->setBucket (array (), array (), -1)); +- +-var_dump ($m->setBucket (null, array (), -1)); +- +-var_dump ($m->setBucket (array (-1), array (-1), 1)); +- + echo "OK\n"; + + ?> +@@ -33,16 +25,4 @@ echo "OK\n"; + bool(true) + bool(true) + bool(true) +- +-Warning: Memcached::setBucket(): server map cannot be empty in %s on line %d +-bool(false) +- +-Warning: Memcached::setBucket(): server map cannot be empty in %s on line %d +-bool(false) +- +-Warning: Memcached::setBucket() expects parameter 1 to be array, null given in %s on line %d +-NULL +- +-Warning: Memcached::setBucket(): the map must contain positive integers in %s on line %d +-bool(false) + OK +diff --git a/tests/vbucket_error_7.phpt b/tests/vbucket_error_7.phpt +new file mode 100644 +index 0000000..286534a +--- /dev/null ++++ b/tests/vbucket_error_7.phpt +@@ -0,0 +1,40 @@ ++--TEST-- ++Memcached virtual buckets ++--SKIPIF-- ++= 80000) die("skip PHP 7 only"); ++?> ++--FILE-- ++ Memcached::DISTRIBUTION_VIRTUAL_BUCKET ++ )); ++ ++var_dump ($m->setBucket (array (), null, 2)); ++ ++var_dump ($m->setBucket (array (), array (), -1)); ++ ++var_dump ($m->setBucket (null, array (), -1)); ++ ++var_dump ($m->setBucket (array (-1), array (-1), 1)); ++ ++echo "OK\n"; ++ ++?> ++--EXPECTF-- ++ ++Warning: Memcached::setBucket(): server map cannot be empty in %s on line %d ++bool(false) ++ ++Warning: Memcached::setBucket(): server map cannot be empty in %s on line %d ++bool(false) ++ ++Warning: Memcached::setBucket() expects parameter 1 to be array, null given in %s on line %d ++NULL ++ ++Warning: Memcached::setBucket(): the map must contain positive integers in %s on line %d ++bool(false) ++OK +diff --git a/tests/vbucket_error_8.phpt b/tests/vbucket_error_8.phpt +new file mode 100644 +index 0000000..c8af231 +--- /dev/null ++++ b/tests/vbucket_error_8.phpt +@@ -0,0 +1,41 @@ ++--TEST-- ++Memcached virtual buckets ++--SKIPIF-- ++ ++--FILE-- ++ Memcached::DISTRIBUTION_VIRTUAL_BUCKET ++ )); ++ ++var_dump ($m->setBucket (array (), null, 2)); ++ ++var_dump ($m->setBucket (array (), array (), -1)); ++ ++try { ++ var_dump ($m->setBucket (null, array (), -1)); ++} catch (TypeError $e) { ++ echo $e->getMessage() . PHP_EOL; ++} ++ ++var_dump ($m->setBucket (array (-1), array (-1), 1)); ++ ++echo "OK\n"; ++ ++?> ++--EXPECTF-- ++Warning: Memcached::setBucket(): server map cannot be empty in %s on line %d ++bool(false) ++ ++Warning: Memcached::setBucket(): server map cannot be empty in %s on line %d ++bool(false) ++Memcached::setBucket(): Argument #1 ($host_map) must be of type array, null given ++ ++Warning: Memcached::setBucket(): the map must contain positive integers in %s on line %d ++bool(false) ++OK + + diff --git a/php-pecl-memcached.spec b/php-pecl-memcached.spec index f15807d..3061fcd 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-2019 Remi Collet +# Copyright (c) 2009-2020 Remi Collet # License: CC-BY-SA # http://creativecommons.org/licenses/by-sa/4.0/ # @@ -31,11 +31,14 @@ Summary: Extension to work with the Memcached caching daemon Name: %{?sub_prefix}php-pecl-memcached Version: 3.1.5 -Release: 1%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}} +Release: 2%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}} License: PHP -URL: http://pecl.php.net/package/%{pecl_name} +URL: https://pecl.php.net/package/%{pecl_name} -Source0: http://pecl.php.net/get/%{pecl_name}-%{version}.tgz +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 BuildRequires: %{?dtsprefix}gcc BuildRequires: %{?scl_prefix}php-devel >= 7 @@ -44,9 +47,7 @@ BuildRequires: %{?scl_prefix}php-json %if %{with_igbin} BuildRequires: %{?sub_prefix}php-pecl-igbinary-devel %endif -%ifnarch ppc64 BuildRequires: %{?sub_prefix}php-pecl-msgpack-devel -%endif BuildRequires: zlib-devel BuildRequires: cyrus-sasl-devel %if %{with_fastlz} @@ -74,9 +75,7 @@ Requires: %{?scl_prefix}php-json%{?_isa} %if %{with_igbin} Requires: %{?sub_prefix}php-pecl-igbinary%{?_isa} %endif -%ifnarch ppc64 Requires: %{?sub_prefix}php-pecl-msgpack%{?_isa} -%endif %{?_sclreq:Requires: %{?scl_prefix}runtime%{?_sclreq}%{?_isa}} Provides: %{?scl_prefix}php-%{pecl_name} = %{version} @@ -88,7 +87,7 @@ Provides: %{?scl_prefix}php-pecl-%{pecl_name} = %{version}-%{releas Provides: %{?scl_prefix}php-pecl-%{pecl_name}%{?_isa} = %{version}-%{release} %endif -%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} @@ -114,7 +113,9 @@ 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 %endif @@ -151,6 +152,11 @@ sed -e 's/role="test"/role="src"/' \ -i package.xml cd NTS +%if "%{php_version}" > "8.0" +%patch0 -p1 -b .pr461 +%patch1 -p1 -b .pr463 +%endif + %if %{with_fastlz} rm -r fastlz sed -e '/name=.fastlz/d' -i ../package.xml @@ -207,9 +213,7 @@ peclconf() { %endif --enable-memcached-json \ --enable-memcached-sasl \ -%ifnarch ppc64 --enable-memcached-msgpack \ -%endif %if 0 --disable-memcached-protocol \ %else @@ -304,7 +308,7 @@ rm ?TS/tests/expire.phpt ret=0 : Launch the Memcached service -port=$(%{__php} -r 'echo 10000 + PHP_MAJOR_VERSION*100 + PHP_MINOR_VERSION*10 + PHP_INT_SIZE;') +port=$(%{__php} -r 'echo 10000 + PHP_MAJOR_VERSION*100 + PHP_MINOR_VERSION*10 + PHP_INT_SIZE + 0%{?scl:1};') memcached -p $port -U $port -d -P $PWD/memcached.pid sed -e "s/11211/$port/" -i ?TS/tests/* @@ -354,6 +358,11 @@ exit $ret %changelog +* Thu Oct 8 2020 Remi Collet - 3.1.5-2 +- 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 + * Wed Dec 4 2019 Remi Collet - 3.1.5-1 - update to 3.1.5 -- cgit