From 3a2f49b39a3bdddca907bf3cab4be6956905a4aa Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Mon, 7 Mar 2022 14:54:07 +0100 Subject: update to 3.1.6-dev (2022-03-02) --- 452.patch | 39 ++ 461.patch | 25 - 463.patch | 1713 ----------------------------------------------- 465.patch | 67 -- 467.patch | 162 ----- 468.patch | 70 -- 469.patch | 86 --- 472.patch | 123 ---- 473.patch | 37 - 474.patch | 1402 -------------------------------------- 486.patch | 105 --- 487.patch | 33 - PHPINFO | 2 +- REFLECTION | 41 +- php-pecl-memcached.spec | 57 +- 15 files changed, 93 insertions(+), 3869 deletions(-) create mode 100644 452.patch delete mode 100644 461.patch delete mode 100644 463.patch delete mode 100644 465.patch delete mode 100644 467.patch delete mode 100644 468.patch delete mode 100644 469.patch delete mode 100644 472.patch delete mode 100644 473.patch delete mode 100644 474.patch delete mode 100644 486.patch delete mode 100644 487.patch diff --git a/452.patch b/452.patch new file mode 100644 index 0000000..499bcd4 --- /dev/null +++ b/452.patch @@ -0,0 +1,39 @@ +From 5921cdaad46356750e6a0cdaec474a6de55960e5 Mon Sep 17 00:00:00 2001 +From: git-hulk +Date: Sun, 23 Feb 2020 20:31:16 +0800 +Subject: [PATCH] FIX: store_retry_count shouldn't be set implicitly + +It's wired that store commands would be auto-retry implicitly while the default value of store_retry_count was 2, as well as the timeout, would be 3 times in those store commands which may confuse users. IMHO, the retry should be set explicitly instead of implicitly. +--- + memcached.ini | 4 ++-- + php_memcached.c | 2 +- + 2 files changed, 3 insertions(+), 3 deletions(-) + +diff --git a/memcached.ini b/memcached.ini +index 5ed79bdb..79c7ef7b 100644 +--- a/memcached.ini ++++ b/memcached.ini +@@ -131,8 +131,8 @@ + ; This mechanism allows transparent fail-over to secondary servers when + ; set/increment/decrement/setMulti operations fail on the desired server in a multi-server + ; environment. +-; the default is 2 +-;memcached.store_retry_count = 2 ++; the default is 0 ++;memcached.store_retry_count = 0 + + ; Sets the default for consistent hashing for new connections. + ; (To configure consistent hashing for session connections, +diff --git a/php_memcached.c b/php_memcached.c +index 50636952..272ec381 100644 +--- a/php_memcached.c ++++ b/php_memcached.c +@@ -401,7 +401,7 @@ PHP_INI_BEGIN() + MEMC_INI_ENTRY("compression_factor", "1.3", OnUpdateReal, compression_factor) + MEMC_INI_ENTRY("compression_threshold", "2000", OnUpdateLong, compression_threshold) + MEMC_INI_ENTRY("serializer", SERIALIZER_DEFAULT_NAME, OnUpdateSerializer, serializer_name) +- MEMC_INI_ENTRY("store_retry_count", "2", OnUpdateLong, store_retry_count) ++ MEMC_INI_ENTRY("store_retry_count", "0", OnUpdateLong, store_retry_count) + + MEMC_INI_BOOL ("default_consistent_hash", "0", OnUpdateBool, default_behavior.consistent_hash_enabled) + MEMC_INI_BOOL ("default_binary_protocol", "0", OnUpdateBool, default_behavior.binary_protocol_enabled) diff --git a/461.patch b/461.patch deleted file mode 100644 index 859907d..0000000 --- a/461.patch +++ /dev/null @@ -1,25 +0,0 @@ -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 deleted file mode 100644 index 37bb169..0000000 --- a/463.patch +++ /dev/null @@ -1,1713 +0,0 @@ -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 - - -From baa6bfda6fbf4c1c75b5a7492db4cc40e6aa81f3 Mon Sep 17 00:00:00 2001 -From: Remi Collet -Date: Thu, 8 Oct 2020 13:45:49 +0200 -Subject: [PATCH] cleanup HAVE_SPL, removed in 8 as always there - ---- - php_memcached.c | 13 ++++--------- - 1 file changed, 4 insertions(+), 9 deletions(-) - -diff --git a/php_memcached.c b/php_memcached.c -index 147cb4a..8d9040e 100644 ---- a/php_memcached.c -+++ b/php_memcached.c -@@ -55,6 +55,8 @@ - # include "ext/msgpack/php_msgpack.h" - #endif - -+# include "ext/spl/spl_exceptions.h" -+ - static int le_memc; - - static int php_memc_list_entry(void) { -@@ -251,10 +253,6 @@ static zend_class_entry *memcached_ce = NULL; - static zend_class_entry *memcached_exception_ce = NULL; - static zend_object_handlers memcached_object_handlers; - --#ifdef HAVE_SPL --static zend_class_entry *spl_ce_RuntimeException = NULL; --#endif -- - ZEND_DECLARE_MODULE_GLOBALS(php_memcached) - - #ifdef COMPILE_DL_MEMCACHED -@@ -3764,7 +3762,6 @@ zend_class_entry *php_memc_get_exception(void) - PHP_MEMCACHED_API - zend_class_entry *php_memc_get_exception_base(int root) - { --#ifdef HAVE_SPL - if (!root) { - if (!spl_ce_RuntimeException) { - zend_class_entry *pce; -@@ -3781,7 +3778,7 @@ zend_class_entry *php_memc_get_exception_base(int root) - return spl_ce_RuntimeException; - } - } --#endif -+ - return zend_exception_get_default(); - } - -@@ -3877,10 +3874,8 @@ static const zend_module_dep memcached_deps[] = { - #ifdef HAVE_MEMCACHED_MSGPACK - ZEND_MOD_REQUIRED("msgpack") - #endif --#ifdef HAVE_SPL - ZEND_MOD_REQUIRED("spl") --#endif -- {NULL, NULL, NULL} -+ ZEND_MOD_END - }; - #endif - diff --git a/465.patch b/465.patch deleted file mode 100644 index 7738012..0000000 --- a/465.patch +++ /dev/null @@ -1,67 +0,0 @@ -From 5b525dafa6aa759801832c5fd10c3734c5dde808 Mon Sep 17 00:00:00 2001 -From: Remi Collet -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 deleted file mode 100644 index 15c6621..0000000 --- a/467.patch +++ /dev/null @@ -1,162 +0,0 @@ -From 5f345d140294c3619791f0980090df3683ad805e Mon Sep 17 00:00:00 2001 -From: Michael Wallner -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 deleted file mode 100644 index 1b52707..0000000 --- a/468.patch +++ /dev/null @@ -1,70 +0,0 @@ -From d5b084479c74c33e054612fc6e7f969b6bab359e Mon Sep 17 00:00:00 2001 -From: Graham Campbell -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 -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 -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 deleted file mode 100644 index 9644ab5..0000000 --- a/469.patch +++ /dev/null @@ -1,86 +0,0 @@ -From 034d6e89121de79fd022bfef0ed2c273588fbfcf Mon Sep 17 00:00:00 2001 -From: Graham Campbell -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 deleted file mode 100644 index 78afdf4..0000000 --- a/472.patch +++ /dev/null @@ -1,123 +0,0 @@ -From a92bf68eeed33392f0a117aec9750ad4c7b4358c Mon Sep 17 00:00:00 2001 -From: Michael Wallner -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 deleted file mode 100644 index d018942..0000000 --- a/473.patch +++ /dev/null @@ -1,37 +0,0 @@ -From 74c0e38fa5eb8d37e7789f46b8f9cf4ed37cd375 Mon Sep 17 00:00:00 2001 -From: Remi Collet -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 -+#endif - - #include - diff --git a/474.patch b/474.patch deleted file mode 100644 index 6f109e6..0000000 --- a/474.patch +++ /dev/null @@ -1,1402 +0,0 @@ -From 2096982a8022527e2820ab9cc78a238cc07f4289 Mon Sep 17 00:00:00 2001 -From: Michael Wallner -Date: Tue, 19 Jan 2021 16:16:30 +0100 -Subject: [PATCH 01/16] fix MemcachedServer - -related: #418, m6w6/libmemcached#94 ---- - php_memcached.c | 3 ++ - php_memcached_server.c | 80 +++++++++++++++++++++++------------ - server-example/run-server.php | 2 +- - 3 files changed, 56 insertions(+), 29 deletions(-) - -diff --git a/php_memcached.c b/php_memcached.c -index 1e218a00..adf2348d 100644 ---- a/php_memcached.c -+++ b/php_memcached.c -@@ -3502,6 +3502,8 @@ static - void php_memc_server_free_storage(zend_object *object) - { - php_memc_server_t *intern = php_memc_server_fetch_object(object); -+ -+ php_memc_proto_handler_destroy(&intern->handler); - zend_object_std_dtor(&intern->zo); - } - -@@ -3515,6 +3517,7 @@ zend_object *php_memc_server_new(zend_class_entry *ce) - object_properties_init(&intern->zo, ce); - - intern->zo.handlers = &memcached_server_object_handlers; -+ intern->handler = php_memc_proto_handler_new(); - - return &intern->zo; - } -diff --git a/php_memcached_server.c b/php_memcached_server.c -index 870209c1..e816b90d 100644 ---- a/php_memcached_server.c -+++ b/php_memcached_server.c -@@ -17,13 +17,16 @@ - #include "php_memcached.h" - #include "php_memcached_private.h" - #include "php_memcached_server.h" -+#include "php_network.h" - - #include - --#undef NDEBUG --#undef _NDEBUG - #include - -+#if HAVE_ARPA_INET_H -+# include -+#endif -+ - #define MEMC_GET_CB(cb_type) (MEMC_SERVER_G(callbacks)[cb_type]) - #define MEMC_HAS_CB(cb_type) (MEMC_GET_CB(cb_type).fci.size > 0) - -@@ -58,9 +61,9 @@ typedef struct { - static - long s_invoke_php_callback (php_memc_server_cb_t *cb, zval *params, ssize_t param_count) - { -- zval *retval = NULL; -+ zval retval; - -- cb->fci.retval = retval; -+ cb->fci.retval = &retval; - cb->fci.params = params; - cb->fci.param_count = param_count; - #if PHP_VERSION_ID < 80000 -@@ -73,7 +76,7 @@ long s_invoke_php_callback (php_memc_server_cb_t *cb, zval *params, ssize_t para - efree (buf); - } - -- return retval == NULL ? PROTOCOL_BINARY_RESPONSE_UNKNOWN_COMMAND : zval_get_long(retval); -+ return Z_ISUNDEF(retval) ? PROTOCOL_BINARY_RESPONSE_UNKNOWN_COMMAND : zval_get_long(&retval); - } - - // memcached protocol callbacks -@@ -96,6 +99,7 @@ protocol_binary_response_status s_add_handler(const void *cookie, const void *ke - ZVAL_LONG(&zflags, flags); - ZVAL_LONG(&zexptime, exptime); - ZVAL_NULL(&zresult_cas); -+ ZVAL_MAKE_REF(&zresult_cas); - - ZVAL_COPY(¶ms[0], &zcookie); - ZVAL_COPY(¶ms[1], &zkey); -@@ -142,6 +146,7 @@ protocol_binary_response_status s_append_prepend_handler (php_memc_event_t event - ZVAL_STRINGL(&zvalue, data, data_len); - ZVAL_DOUBLE(&zcas, cas); - ZVAL_NULL(&zresult_cas); -+ ZVAL_MAKE_REF(&zresult_cas); - - ZVAL_COPY(¶ms[0], &zcookie); - ZVAL_COPY(¶ms[1], &zkey); -@@ -198,11 +203,13 @@ protocol_binary_response_status s_incr_decr_handler (php_memc_event_t event, con - MEMC_MAKE_ZVAL_COOKIE(zcookie, cookie); - - ZVAL_STRINGL(&zkey, key, key_len); -- ZVAL_LONG(&zdelta, (long) delta); -- ZVAL_LONG(&zinital, (long) initial); -- ZVAL_LONG(&zexpiration, (long) expiration); -+ ZVAL_LONG(&zdelta, (zend_long) delta); -+ ZVAL_LONG(&zinital, (zend_long) initial); -+ ZVAL_LONG(&zexpiration, (zend_long) expiration); - ZVAL_LONG(&zresult, 0); -+ ZVAL_MAKE_REF(&zresult); - ZVAL_NULL(&zresult_cas); -+ ZVAL_MAKE_REF(&zresult_cas); - - ZVAL_COPY(¶ms[0], &zcookie); - ZVAL_COPY(¶ms[1], &zkey); -@@ -322,6 +329,13 @@ protocol_binary_response_status s_get_handler (const void *cookie, const void *k - } - - MEMC_MAKE_ZVAL_COOKIE(zcookie, cookie); -+ ZVAL_STRINGL(&zkey, key, key_len); -+ ZVAL_NULL(&zvalue); -+ ZVAL_MAKE_REF(&zvalue); -+ ZVAL_NULL(&zflags); -+ ZVAL_MAKE_REF(&zflags); -+ ZVAL_NULL(&zresult_cas); -+ ZVAL_MAKE_REF(&zresult_cas); - - ZVAL_COPY(¶ms[0], &zcookie); - ZVAL_COPY(¶ms[1], &zkey); -@@ -436,11 +450,12 @@ protocol_binary_response_status s_set_replace_handler (php_memc_event_t event, c - MEMC_MAKE_ZVAL_COOKIE(zcookie, cookie); - - ZVAL_STRINGL(&zkey, key, key_len); -- ZVAL_STRINGL(&zdata, ((char *) data), (int) data_len); -- ZVAL_LONG(&zflags, (long) flags); -- ZVAL_LONG(&zexpiration, (long) expiration); -+ ZVAL_STRINGL(&zdata, data, data_len); -+ ZVAL_LONG(&zflags, (zend_long) flags); -+ ZVAL_LONG(&zexpiration, (zend_long) expiration); - ZVAL_DOUBLE(&zcas, (double) cas); - ZVAL_NULL(&zresult_cas); -+ ZVAL_MAKE_REF(&zresult_cas); - - ZVAL_COPY(¶ms[0], &zcookie); - ZVAL_COPY(¶ms[1], &zkey); -@@ -504,6 +519,7 @@ protocol_binary_response_status s_stat_handler (const void *cookie, const void * - - ZVAL_STRINGL(&zkey, key, key_len); - ZVAL_NULL(&zbody); -+ ZVAL_MAKE_REF(&zbody); - - ZVAL_COPY(¶ms[0], &zcookie); - ZVAL_COPY(¶ms[1], &zkey); -@@ -584,17 +600,27 @@ void s_handle_memcached_event (evutil_socket_t fd, short what, void *arg) - zval zremoteip, zremoteport; - zval params[2]; - protocol_binary_response_status retval; -- -- struct sockaddr_in addr_in; -- socklen_t addr_in_len = sizeof(addr_in); -- -- if (getpeername (fd, (struct sockaddr *) &addr_in, &addr_in_len) == 0) { -- ZVAL_STRING(&zremoteip, inet_ntoa (addr_in.sin_addr)); -- ZVAL_LONG(&zremoteport, ntohs (addr_in.sin_port)); -+ struct sockaddr_storage ss; -+ socklen_t ss_len = sizeof(ss); -+ -+ ZVAL_NULL(&zremoteip); -+ ZVAL_NULL(&zremoteport); -+ -+ if (getpeername (fd, (struct sockaddr *) &ss, &ss_len) == 0) { -+ char addr_buf[0x100]; -+ -+ switch (ss.ss_family) { -+ case AF_INET6: -+ ZVAL_STRING(&zremoteip, inet_ntop(ss.ss_family, &((struct sockaddr_in6 *) &ss)->sin6_addr, addr_buf, sizeof(addr_buf))); -+ ZVAL_LONG(&zremoteport, ntohs(((struct sockaddr_in6 *) &ss)->sin6_port)); -+ break; -+ case AF_INET: -+ ZVAL_STRING(&zremoteip, inet_ntop(ss.ss_family, &((struct sockaddr_in *) &ss)->sin_addr, addr_buf, sizeof(addr_buf))); -+ ZVAL_LONG(&zremoteport, ntohs(((struct sockaddr_in *) &ss)->sin_port)); -+ break; -+ } - } else { - php_error_docref(NULL, E_WARNING, "getpeername failed: %s", strerror (errno)); -- ZVAL_NULL(&zremoteip); -- ZVAL_NULL(&zremoteport); - } - - ZVAL_COPY(¶ms[0], &zremoteip); -@@ -714,22 +740,20 @@ php_memc_proto_handler_t *php_memc_proto_handler_new () - } - - static --evutil_socket_t s_create_listening_socket (const char *spec) -+evutil_socket_t s_create_listening_socket (const zend_string *spec) - { - evutil_socket_t sock; - struct sockaddr_storage addr; -- int addr_len; -- -+ socklen_t addr_len; - int rc; - - addr_len = sizeof (struct sockaddr); -- rc = evutil_parse_sockaddr_port (spec, (struct sockaddr *) &addr, &addr_len); -- if (rc != 0) { -- php_error_docref(NULL, E_WARNING, "Failed to parse bind address"); -+ if (SUCCESS != php_network_parse_network_address_with_port(spec->val, spec->len, (struct sockaddr *) &addr, &addr_len)) { -+ php_error_docref(NULL, E_WARNING, "Failed to parse bind address: %s", spec->val); - return -1; - } - -- sock = socket (AF_INET, SOCK_STREAM, 0); -+ sock = socket (addr.ss_family, SOCK_STREAM, 0); - if (sock < 0) { - php_error_docref(NULL, E_WARNING, "socket failed: %s", strerror (errno)); - return -1; -@@ -770,7 +794,7 @@ evutil_socket_t s_create_listening_socket (const char *spec) - zend_bool php_memc_proto_handler_run (php_memc_proto_handler_t *handler, zend_string *address) - { - struct event *accept_event; -- evutil_socket_t sock = s_create_listening_socket (address->val); -+ evutil_socket_t sock = s_create_listening_socket (address); - - if (sock == -1) { - return 0; -From 277ce3b20ec9753b994d63f4e99c2506ca2cdd5f Mon Sep 17 00:00:00 2001 -From: Michael Wallner -Date: Tue, 19 Jan 2021 16:32:52 +0100 -Subject: [PATCH 02/16] use php_network_get_peer_name - ---- - php_memcached_server.c | 38 ++++++++++------------------------- - server-example/run-server.php | 4 ++-- - 2 files changed, 13 insertions(+), 29 deletions(-) - -diff --git a/php_memcached_server.c b/php_memcached_server.c -index e816b90d..fee8d28d 100644 ---- a/php_memcached_server.c -+++ b/php_memcached_server.c -@@ -597,41 +597,25 @@ void s_handle_memcached_event (evutil_socket_t fd, short what, void *arg) - - if (!client->on_connect_invoked) { - if (MEMC_HAS_CB(MEMC_SERVER_ON_CONNECT)) { -- zval zremoteip, zremoteport; -- zval params[2]; -+ zend_string *zremoteaddr_str; -+ zval zremoteaddr; -+ zval params[1]; - protocol_binary_response_status retval; -- struct sockaddr_storage ss; -- socklen_t ss_len = sizeof(ss); -- -- ZVAL_NULL(&zremoteip); -- ZVAL_NULL(&zremoteport); -- -- if (getpeername (fd, (struct sockaddr *) &ss, &ss_len) == 0) { -- char addr_buf[0x100]; -- -- switch (ss.ss_family) { -- case AF_INET6: -- ZVAL_STRING(&zremoteip, inet_ntop(ss.ss_family, &((struct sockaddr_in6 *) &ss)->sin6_addr, addr_buf, sizeof(addr_buf))); -- ZVAL_LONG(&zremoteport, ntohs(((struct sockaddr_in6 *) &ss)->sin6_port)); -- break; -- case AF_INET: -- ZVAL_STRING(&zremoteip, inet_ntop(ss.ss_family, &((struct sockaddr_in *) &ss)->sin_addr, addr_buf, sizeof(addr_buf))); -- ZVAL_LONG(&zremoteport, ntohs(((struct sockaddr_in *) &ss)->sin_port)); -- break; -- } -+ -+ ZVAL_NULL(&zremoteaddr); -+ -+ if (SUCCESS == php_network_get_peer_name (fd, &zremoteaddr_str, NULL, NULL)) { -+ ZVAL_STR(&zremoteaddr, zremoteaddr_str); - } else { - php_error_docref(NULL, E_WARNING, "getpeername failed: %s", strerror (errno)); - } - -- ZVAL_COPY(¶ms[0], &zremoteip); -- ZVAL_COPY(¶ms[1], &zremoteport); -+ ZVAL_COPY(¶ms[0], &zremoteaddr); - -- retval = s_invoke_php_callback (&MEMC_GET_CB(MEMC_SERVER_ON_CONNECT), params, 2); -+ retval = s_invoke_php_callback (&MEMC_GET_CB(MEMC_SERVER_ON_CONNECT), params, 1); - - zval_ptr_dtor(¶ms[0]); -- zval_ptr_dtor(¶ms[1]); -- zval_ptr_dtor(&zremoteip); -- zval_ptr_dtor(&zremoteport); -+ zval_ptr_dtor(&zremoteaddr); - - if (retval != PROTOCOL_BINARY_RESPONSE_SUCCESS) { - memcached_protocol_client_destroy (client->protocol_client); -From f7731bfe65c9f9312e11018035e7a560e7dde702 Mon Sep 17 00:00:00 2001 -From: Michael Wallner -Date: Tue, 19 Jan 2021 16:34:08 +0100 -Subject: [PATCH 03/16] remove unused include again - ---- - php_memcached_server.c | 4 ---- - 1 file changed, 4 deletions(-) - -diff --git a/php_memcached_server.c b/php_memcached_server.c -index fee8d28d..ce93a2bf 100644 ---- a/php_memcached_server.c -+++ b/php_memcached_server.c -@@ -23,10 +23,6 @@ - - #include - --#if HAVE_ARPA_INET_H --# include --#endif -- - #define MEMC_GET_CB(cb_type) (MEMC_SERVER_G(callbacks)[cb_type]) - #define MEMC_HAS_CB(cb_type) (MEMC_GET_CB(cb_type).fci.size > 0) - - -From c7a2084ac958e93a094866889b56a7b37698ef40 Mon Sep 17 00:00:00 2001 -From: Michael Wallner -Date: Tue, 19 Jan 2021 16:57:39 +0100 -Subject: [PATCH 04/16] as per - https://github.com/php-memcached-dev/php-memcached/pull/474#issuecomment-762934191 - ---- - php_memcached_server.c | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/php_memcached_server.c b/php_memcached_server.c -index ce93a2bf..1f28d936 100644 ---- a/php_memcached_server.c -+++ b/php_memcached_server.c -@@ -299,6 +299,7 @@ protocol_binary_response_status s_flush_handler(const void *cookie, uint32_t whe - } - - MEMC_MAKE_ZVAL_COOKIE(zcookie, cookie); -+ ZVAL_LONG(&zwhen, when); - - ZVAL_COPY(¶ms[0], &zcookie); - ZVAL_COPY(¶ms[1], &zwhen); - -From 09d0f27b6298e525e0bae45db8d915fa1d140466 Mon Sep 17 00:00:00 2001 -From: Remi Collet -Date: Wed, 20 Jan 2021 10:54:13 +0100 -Subject: [PATCH 05/16] add 1 test for MemcachedServer - ---- - tests/memcachedserver.phpt | 58 +++++++++++++++++++++++ - tests/server.inc | 78 +++++++++++++++++++++++++++++++ - tests/server.php | 94 ++++++++++++++++++++++++++++++++++++++ - 3 files changed, 230 insertions(+) - create mode 100644 tests/memcachedserver.phpt - create mode 100644 tests/server.inc - create mode 100644 tests/server.php - -diff --git a/tests/memcachedserver.phpt b/tests/memcachedserver.phpt -new file mode 100644 -index 00000000..54b7fe45 ---- /dev/null -+++ b/tests/memcachedserver.phpt -@@ -0,0 +1,58 @@ -+--TEST-- -+Memcached::get() with cache callback -+--SKIPIF-- -+ -+--FILE-- -+setOption(Memcached::OPT_BINARY_PROTOCOL, true); -+$cache->setOption(Memcached::OPT_COMPRESSION, false); -+$cache->addServer('127.0.0.1', 3434); -+ -+$cache->add("add_key", "hello", 500); -+$cache->append("append_key", "world"); -+$cache->prepend("prepend_key", "world"); -+ -+$cache->increment("incr", 2, 1, 500); -+$cache->decrement("decr", 2, 1, 500); -+ -+$cache->delete("delete_k"); -+$cache->flush(1); -+ -+var_dump($cache->get('get_this')); -+ -+$cache->set ('set_key', 'value 1', 100); -+$cache->replace ('replace_key', 'value 2', 200); -+ -+var_dump($cache->getStats()); -+ -+$cache->quit(); -+ -+memcached_server_stop($server); -+?> -+Done -+--EXPECTF-- -+Listening on 127.0.0.1:3434 -+Incoming connection from 127.0.0.1:%s -+Incoming connection from 127.0.0.1:%s -+client_id=[%s]: Add key=[add_key], value=[hello], flags=[0], expiration=[500] -+client_id=[%s]: Append key=[append_key], value=[world], cas=[0] -+client_id=[%s]: Prepend key=[prepend_key], value=[world], cas=[0] -+client_id=[%s]: Incrementing key=[incr], delta=[2], initial=[1], expiration=[500] -+client_id=[%s]: Decrementing key=[decr], delta=[2], initial=[1], expiration=[500] -+client_id=[%s]: Delete key=[delete_k], cas=[0] -+client_id=[%s]: Flush when=[1] -+client_id=[%s]: Get key=[get_this] -+client_id=[%s]: Noop -+string(20) "Hello to you client!" -+client_id=[%s]: Set key=[set_key], value=[value 1], flags=[0], expiration=[100], cas=[0] -+client_id=[%s]: Replace key=[replace_key], value=[value 2], flags=[0], expiration=[200], cas=[0] -+bool(false) -+Done -diff --git a/tests/server.inc b/tests/server.inc -new file mode 100644 -index 00000000..96cc942f ---- /dev/null -+++ b/tests/server.inc -@@ -0,0 +1,78 @@ -+ STDIN, -+ 1 => STDOUT, -+ 2 => STDERR, -+ ); -+ -+ $cmd = "{$php_executable} {$php_args} {$code} {$host}:{$port} "; -+ if (substr(PHP_OS, 0, 3) == 'WIN') { -+ $cmd = "{$php_executable} {$php_args} {$code} {$host}:{$port} "; -+ -+ $handle = proc_open(addslashes($cmd), $descriptorspec, $pipes, __DIR__, NULL, array("bypass_shell" => true, "suppress_errors" => true)); -+ } else { -+ $cmd = "exec {$cmd} 2>/dev/null"; -+ -+ $handle = proc_open($cmd, $descriptorspec, $pipes, __DIR__); -+ } -+ -+ // note: even when server prints 'Listening on localhost:8964...Press Ctrl-C to quit.' -+ // it might not be listening yet...need to wait until fsockopen() call returns -+ $error = "Unable to connect to server\n"; -+ for ($i=0; $i < 60; $i++) { -+ usleep(50000); // 50ms per try -+ $status = proc_get_status($handle); -+ $fp = @fsockopen($host, $port); -+ // Failure, the server is no longer running -+ if (!($status && $status['running'])) { -+ $error = "Server is not running\n"; -+ break; -+ } -+ // Success, Connected to servers -+ if ($fp) { -+ $error = ''; -+ break; -+ } -+ } -+ -+ if ($fp) { -+ fclose($fp); -+ } -+ -+ if ($error) { -+ echo $error; -+ proc_terminate($handle); -+ exit(1); -+ } -+ -+ register_shutdown_function( -+ function($handle) { -+ proc_terminate($handle); -+ }, -+ $handle -+ ); -+ -+ return $handle; -+} -+ -+function memcached_server_stop($handle) { -+ $success = FALSE; -+ if ($handle) { -+ proc_terminate($handle); -+ /* Wait for server to shutdown */ -+ for ($i = 0; $i < 60; $i++) { -+ $status = proc_get_status($handle); -+ if (!($status && $status['running'])) { -+ $success = TRUE; -+ break; -+ } -+ usleep(50000); -+ } -+ } -+ return $success; -+} -+ -diff --git a/tests/server.php b/tests/server.php -new file mode 100644 -index 00000000..674f91ac ---- /dev/null -+++ b/tests/server.php -@@ -0,0 +1,94 @@ -+on (Memcached::ON_CONNECT, -+ function ($remote_addr) { -+ echo "Incoming connection from {$remote_addr}" . PHP_EOL; -+ return Memcached::RESPONSE_SUCCESS; -+ }); -+ -+$server->on (Memcached::ON_ADD, -+ function ($client_id, $key, $value, $flags, $expiration, &$cas) { -+ echo "client_id=[$client_id]: Add key=[$key], value=[$value], flags=[$flags], expiration=[$expiration]" . PHP_EOL; -+ $cas = 15; -+ return Memcached::RESPONSE_SUCCESS; -+ }); -+ -+$server->on (Memcached::ON_APPEND, -+ function ($client_id, $key, $value, $cas, &$result_cas) { -+ echo "client_id=[$client_id]: Append key=[$key], value=[$value], cas=[$cas]" . PHP_EOL; -+ return Memcached::RESPONSE_SUCCESS; -+ }); -+ -+$server->on (Memcached::ON_PREPEND, -+ function ($client_id, $key, $value, $cas, &$result_cas) { -+ echo "client_id=[$client_id]: Prepend key=[$key], value=[$value], cas=[$cas]" . PHP_EOL; -+ return Memcached::RESPONSE_SUCCESS; -+ }); -+ -+$server->on (Memcached::ON_INCREMENT, -+ function ($client_id, $key, $delta, $initial, $expiration, &$result, &$result_cas) { -+ echo "client_id=[$client_id]: Incrementing key=[$key], delta=[$delta], initial=[$initial], expiration=[$expiration]" . PHP_EOL; -+ return Memcached::RESPONSE_SUCCESS; -+ }); -+ -+$server->on (Memcached::ON_DECREMENT, -+ function ($client_id, $key, $delta, $initial, $expiration, &$result, &$result_cas) { -+ echo "client_id=[$client_id]: Decrementing key=[$key], delta=[$delta], initial=[$initial], expiration=[$expiration]" . PHP_EOL; -+ return Memcached::RESPONSE_SUCCESS; -+ }); -+ -+$server->on (Memcached::ON_DELETE, -+ function ($client_id, $key, $cas) { -+ echo "client_id=[$client_id]: Delete key=[$key], cas=[$cas]" . PHP_EOL; -+ return Memcached::RESPONSE_SUCCESS; -+ }); -+ -+$server->on (Memcached::ON_FLUSH, -+ function ($client_id, $when) { -+ echo "client_id=[$client_id]: Flush when=[$when]" . PHP_EOL; -+ return Memcached::RESPONSE_SUCCESS; -+ }); -+ -+$server->on (Memcached::ON_GET, -+ function ($client_id, $key, &$value, &$flags, &$cas) { -+ echo "client_id=[$client_id]: Get key=[$key]" . PHP_EOL; -+ $value = "Hello to you client!"; -+ return Memcached::RESPONSE_SUCCESS; -+ }); -+ -+$server->on (Memcached::ON_NOOP, -+ function ($client_id) { -+ echo "client_id=[$client_id]: Noop" . PHP_EOL; -+ return Memcached::RESPONSE_SUCCESS; -+ }); -+ -+$server->on (Memcached::ON_REPLACE, -+ function ($client_id, $key, $value, $flags, $expiration, $cas, &$result_cas) { -+ echo "client_id=[$client_id]: Replace key=[$key], value=[$value], flags=[$flags], expiration=[$expiration], cas=[$cas]" . PHP_EOL; -+ return Memcached::RESPONSE_SUCCESS; -+ }); -+ -+$server->on (Memcached::ON_SET, -+ function ($client_id, $key, $value, $flags, $expiration, $cas, &$result_cas) { -+ echo "client_id=[$client_id]: Set key=[$key], value=[$value], flags=[$flags], expiration=[$expiration], cas=[$cas]" . PHP_EOL; -+ return Memcached::RESPONSE_SUCCESS; -+ }); -+ -+$server->on (Memcached::ON_STAT, -+ function ($client_id, $key, &$value) { -+ echo "client_id=[$client_id]: Stat key=[$key]" . PHP_EOL; -+ $value = "Stat reply"; -+ return Memcached::RESPONSE_SUCCESS; -+ }); -+ -+$server->on (Memcached::ON_QUIT, -+ function ($client_id) { -+ echo "client_id=[$client_id]: Client quit" . PHP_EOL; -+ return Memcached::RESPONSE_SUCCESS; -+ }); -+ -+$addr = ($_SERVER['argv'][1] ?? "127.0.0.1:3434"); -+echo "Listening on $addr" . PHP_EOL; -+$server->run($addr); - -From 2b32140d08acb64bc087de37ea17c8ba2d99092a Mon Sep 17 00:00:00 2001 -From: Remi Collet -Date: Wed, 20 Jan 2021 12:08:53 +0100 -Subject: [PATCH 06/16] minor fix for version handler - ---- - php_memcached_server.c | 1 + - tests/memcachedserver.phpt | 5 +++-- - tests/server.php | 7 +++++++ - 3 files changed, 11 insertions(+), 2 deletions(-) - -diff --git a/php_memcached_server.c b/php_memcached_server.c -index 1f28d936..57cb749b 100644 ---- a/php_memcached_server.c -+++ b/php_memcached_server.c -@@ -560,6 +560,7 @@ protocol_binary_response_status s_version_handler (const void *cookie, - MEMC_MAKE_ZVAL_COOKIE(zcookie, cookie); - - ZVAL_NULL(&zversion); -+ ZVAL_MAKE_REF(&zversion); - - ZVAL_COPY(¶ms[0], &zcookie); - ZVAL_COPY(¶ms[1], &zversion); -diff --git a/tests/memcachedserver.phpt b/tests/memcachedserver.phpt -index 54b7fe45..6d4abb9d 100644 ---- a/tests/memcachedserver.phpt -+++ b/tests/memcachedserver.phpt -@@ -31,7 +31,8 @@ var_dump($cache->get('get_this')); - $cache->set ('set_key', 'value 1', 100); - $cache->replace ('replace_key', 'value 2', 200); - --var_dump($cache->getStats()); -+// TODO var_dump($cache->getVersion()); -+// TODO var_dump($cache->getStats()); - - $cache->quit(); - -@@ -54,5 +55,5 @@ client_id=[%s]: Noop - string(20) "Hello to you client!" - client_id=[%s]: Set key=[set_key], value=[value 1], flags=[0], expiration=[100], cas=[0] - client_id=[%s]: Replace key=[replace_key], value=[value 2], flags=[0], expiration=[200], cas=[0] --bool(false) -+client_id=[%s]: Client quit - Done -diff --git a/tests/server.php b/tests/server.php -index 674f91ac..c39b04e8 100644 ---- a/tests/server.php -+++ b/tests/server.php -@@ -79,6 +79,13 @@ function ($client_id, $key, $value, $flags, $expiration, $cas, &$result_cas) { - $server->on (Memcached::ON_STAT, - function ($client_id, $key, &$value) { - echo "client_id=[$client_id]: Stat key=[$key]" . PHP_EOL; -+ $value = "Stat reply for $key"; -+ return Memcached::RESPONSE_SUCCESS; -+ }); -+ -+$server->on (Memcached::ON_VERSION, -+ function ($client_id, &$value) { -+ echo "client_id=[$client_id]: Version" . PHP_EOL; - $value = "Stat reply"; - return Memcached::RESPONSE_SUCCESS; - }); - -From 7562317131d7ef75cf35abf982ca3efa44c5e495 Mon Sep 17 00:00:00 2001 -From: Michael Wallner -Date: Wed, 20 Jan 2021 16:43:57 +0100 -Subject: [PATCH 07/16] handle empty STATS key - ---- - php_memcached_server.c | 7 +++++-- - 1 file changed, 5 insertions(+), 2 deletions(-) - -diff --git a/php_memcached_server.c b/php_memcached_server.c -index 57cb749b..d1e903a1 100644 ---- a/php_memcached_server.c -+++ b/php_memcached_server.c -@@ -514,7 +514,11 @@ protocol_binary_response_status s_stat_handler (const void *cookie, const void * - - MEMC_MAKE_ZVAL_COOKIE(zcookie, cookie); - -- ZVAL_STRINGL(&zkey, key, key_len); -+ if (key && key_len) { -+ ZVAL_STRINGL(&zkey, key, key_len); -+ } else { -+ ZVAL_NULL(&zkey); -+ } - ZVAL_NULL(&zbody); - ZVAL_MAKE_REF(&zbody); - -@@ -566,7 +570,6 @@ protocol_binary_response_status s_version_handler (const void *cookie, - ZVAL_COPY(¶ms[1], &zversion); - - retval = s_invoke_php_callback (&MEMC_GET_CB(MEMC_SERVER_ON_VERSION), params, 2); -- - if (retval == PROTOCOL_BINARY_RESPONSE_SUCCESS) { - if (Z_TYPE(zversion) != IS_STRING) { - convert_to_string(&zversion); - -From a3f9b928b65abc3daa743c709b6404e038b5af7b Mon Sep 17 00:00:00 2001 -From: Michael Wallner -Date: Wed, 20 Jan 2021 16:51:34 +0100 -Subject: [PATCH 08/16] fix running the server from command line - ---- - tests/server.inc | 7 +++---- - 1 file changed, 3 insertions(+), 4 deletions(-) - -diff --git a/tests/server.inc b/tests/server.inc -index 96cc942f..5700a9d2 100644 ---- a/tests/server.inc -+++ b/tests/server.inc -@@ -1,7 +1,7 @@ - STDIN, -@@ -29,7 +29,7 @@ function memcached_server_start($code = 'server.php', $host = "127.0.0.1", $port - $fp = @fsockopen($host, $port); - // Failure, the server is no longer running - if (!($status && $status['running'])) { -- $error = "Server is not running\n"; -+ $error = "Server is not running {$status['command']}\n"; - break; - } - // Success, Connected to servers -@@ -75,4 +75,3 @@ function memcached_server_stop($handle) { - } - return $success; - } -- - -From c18e8bb36ff634f1dc9f6927fd98b1a20029f50f Mon Sep 17 00:00:00 2001 -From: Michael Wallner -Date: Wed, 20 Jan 2021 16:52:31 +0100 -Subject: [PATCH 09/16] add stats/version tests - ---- - tests/memcachedserver.phpt | 31 ++++++++++++++++++++++++++++--- - tests/server.php | 2 +- - 2 files changed, 29 insertions(+), 4 deletions(-) - -diff --git a/tests/memcachedserver.phpt b/tests/memcachedserver.phpt -index 6d4abb9d..82601e12 100644 ---- a/tests/memcachedserver.phpt -+++ b/tests/memcachedserver.phpt -@@ -1,10 +1,13 @@ - --TEST-- --Memcached::get() with cache callback -+MemcachedServer - --SKIPIF-- - - --FILE-- - get('get_this')); - $cache->set ('set_key', 'value 1', 100); - $cache->replace ('replace_key', 'value 2', 200); - --// TODO var_dump($cache->getVersion()); --// TODO var_dump($cache->getStats()); -+var_dump($cache->getVersion()); -+var_dump($cache->getStats()); -+var_dump($cache->getStats("foobar")); - - $cache->quit(); - -@@ -55,5 +59,26 @@ client_id=[%s]: Noop - string(20) "Hello to you client!" - client_id=[%s]: Set key=[set_key], value=[value 1], flags=[0], expiration=[100], cas=[0] - client_id=[%s]: Replace key=[replace_key], value=[value 2], flags=[0], expiration=[200], cas=[0] -+client_id=[%s]: Version -+array(1) { -+ ["127.0.0.1:3434"]=> -+ string(5) "1.1.1" -+} -+client_id=[%s]: Stat key=[] -+array(1) { -+ ["127.0.0.1:3434"]=> -+ array(1) { -+ [""]=> -+ string(15) "Stat reply for " -+ } -+} -+client_id=[%s]: Stat key=[foobar] -+array(1) { -+ ["127.0.0.1:3434"]=> -+ array(1) { -+ ["foobar"]=> -+ string(21) "Stat reply for foobar" -+ } -+} - client_id=[%s]: Client quit - Done -diff --git a/tests/server.php b/tests/server.php -index c39b04e8..b6ab1cf6 100644 ---- a/tests/server.php -+++ b/tests/server.php -@@ -86,7 +86,7 @@ function ($client_id, $key, &$value) { - $server->on (Memcached::ON_VERSION, - function ($client_id, &$value) { - echo "client_id=[$client_id]: Version" . PHP_EOL; -- $value = "Stat reply"; -+ $value = "1.1.1"; - return Memcached::RESPONSE_SUCCESS; - }); - - -From 4cb3b015e05018fccc17d4e40e065ab307e35f22 Mon Sep 17 00:00:00 2001 -From: Michael Wallner -Date: Wed, 20 Jan 2021 17:42:58 +0100 -Subject: [PATCH 10/16] expect an array as STATS value and reply foreach - key/value - ---- - php_memcached_server.c | 36 +++++++++++++++++++++++++----------- - tests/memcachedserver.phpt | 16 ++++++++++------ - tests/server.php | 7 +++++-- - 3 files changed, 40 insertions(+), 19 deletions(-) - -diff --git a/php_memcached_server.c b/php_memcached_server.c -index d1e903a1..a166051e 100644 ---- a/php_memcached_server.c -+++ b/php_memcached_server.c -@@ -506,7 +506,7 @@ protocol_binary_response_status s_stat_handler (const void *cookie, const void * - { - zval params[3]; - protocol_binary_response_status retval = PROTOCOL_BINARY_RESPONSE_UNKNOWN_COMMAND; -- zval zcookie, zkey, zbody; -+ zval zcookie, zkey, zstats; - - if (!MEMC_HAS_CB(MEMC_SERVER_ON_STAT)) { - return retval; -@@ -519,24 +519,38 @@ protocol_binary_response_status s_stat_handler (const void *cookie, const void * - } else { - ZVAL_NULL(&zkey); - } -- ZVAL_NULL(&zbody); -- ZVAL_MAKE_REF(&zbody); -+ ZVAL_NULL(&zstats); -+ ZVAL_MAKE_REF(&zstats); - - ZVAL_COPY(¶ms[0], &zcookie); - ZVAL_COPY(¶ms[1], &zkey); -- ZVAL_COPY(¶ms[2], &zbody); -+ ZVAL_COPY(¶ms[2], &zstats); - - retval = s_invoke_php_callback (&MEMC_GET_CB(MEMC_SERVER_ON_STAT), params, 3); - - if (retval == PROTOCOL_BINARY_RESPONSE_SUCCESS) { -- if (Z_TYPE(zbody) == IS_NULL) { -+ if (Z_ISNULL(zstats)) { - retval = response_handler(cookie, NULL, 0, NULL, 0); -- } -- else { -- if (Z_TYPE(zbody) != IS_STRING) { -- convert_to_string(&zbody); -+ } else { -+ zval *zarray = &zstats; -+ zend_string *key; -+ zval *val; -+ -+ ZVAL_DEREF(zarray); -+ if (Z_TYPE_P(zarray) != IS_ARRAY) { -+ convert_to_array(zarray); -+ } -+ -+ ZEND_HASH_FOREACH_STR_KEY_VAL(Z_ARRVAL_P(zarray), key, val) -+ { -+ zend_string *val_str = zval_get_string(val); -+ retval = response_handler(cookie, key->val, key->len, val_str->val, val_str->len); -+ if (retval != PROTOCOL_BINARY_RESPONSE_SUCCESS) { -+ break; -+ } -+ zend_string_release(val_str); - } -- retval = response_handler(cookie, key, key_len, Z_STRVAL(zbody), (uint32_t) Z_STRLEN(zbody)); -+ ZEND_HASH_FOREACH_END(); - } - } - -@@ -545,7 +559,7 @@ protocol_binary_response_status s_stat_handler (const void *cookie, const void * - zval_ptr_dtor(¶ms[2]); - zval_ptr_dtor (&zcookie); - zval_ptr_dtor (&zkey); -- zval_ptr_dtor (&zbody); -+ zval_ptr_dtor (&zstats); - return retval; - } - -diff --git a/tests/memcachedserver.phpt b/tests/memcachedserver.phpt -index 82601e12..d47dd73b 100644 ---- a/tests/memcachedserver.phpt -+++ b/tests/memcachedserver.phpt -@@ -67,17 +67,21 @@ array(1) { - client_id=[%s]: Stat key=[] - array(1) { - ["127.0.0.1:3434"]=> -- array(1) { -- [""]=> -- string(15) "Stat reply for " -+ array(2) { -+ ["key"]=> -+ string(0) "" -+ ["foo"]=> -+ string(3) "bar" - } - } - client_id=[%s]: Stat key=[foobar] - array(1) { - ["127.0.0.1:3434"]=> -- array(1) { -- ["foobar"]=> -- string(21) "Stat reply for foobar" -+ array(2) { -+ ["key"]=> -+ string(6) "foobar" -+ ["foo"]=> -+ string(3) "bar" - } - } - client_id=[%s]: Client quit -diff --git a/tests/server.php b/tests/server.php -index b6ab1cf6..f5ff2f6a 100644 ---- a/tests/server.php -+++ b/tests/server.php -@@ -77,9 +77,12 @@ function ($client_id, $key, $value, $flags, $expiration, $cas, &$result_cas) { - }); - - $server->on (Memcached::ON_STAT, -- function ($client_id, $key, &$value) { -+ function ($client_id, $key, array &$values = null) { - echo "client_id=[$client_id]: Stat key=[$key]" . PHP_EOL; -- $value = "Stat reply for $key"; -+ $values = [ -+ "key" => $key, -+ "foo" => "bar", -+ ]; - return Memcached::RESPONSE_SUCCESS; - }); - - -From 3de2b4d7e27c61be0e4f0017b0b5528d0500b56c Mon Sep 17 00:00:00 2001 -From: Michael Wallner -Date: Wed, 20 Jan 2021 18:00:52 +0100 -Subject: [PATCH 11/16] valgrind - ---- - php_memcached.c | 5 ++++- - tests/server.inc | 9 +++++++-- - 2 files changed, 11 insertions(+), 3 deletions(-) - -diff --git a/php_memcached.c b/php_memcached.c -index adf2348d..8f464283 100644 ---- a/php_memcached.c -+++ b/php_memcached.c -@@ -3907,7 +3907,6 @@ static - PHP_GINIT_FUNCTION(php_memcached) - { - #ifdef HAVE_MEMCACHED_SESSION -- - php_memcached_globals->session.lock_enabled = 0; - php_memcached_globals->session.lock_wait_max = 150; - php_memcached_globals->session.lock_wait_min = 150; -@@ -3926,8 +3925,12 @@ PHP_GINIT_FUNCTION(php_memcached) - php_memcached_globals->session.persistent_enabled = 0; - php_memcached_globals->session.sasl_username = NULL; - php_memcached_globals->session.sasl_password = NULL; -+#endif - -+#ifdef HAVE_MEMCACHED_PROTOCOL -+ memset(&php_memcached_globals->server, 0, sizeof(php_memcached_globals->server)); - #endif -+ - php_memcached_globals->memc.serializer_name = NULL; - php_memcached_globals->memc.serializer_type = SERIALIZER_DEFAULT; - php_memcached_globals->memc.compression_name = NULL; -diff --git a/tests/server.inc b/tests/server.inc -index 5700a9d2..9678f043 100644 ---- a/tests/server.inc -+++ b/tests/server.inc -@@ -23,7 +23,7 @@ function memcached_server_start($code = 'server.php', $host = "127.0.0.1", $port - // note: even when server prints 'Listening on localhost:8964...Press Ctrl-C to quit.' - // it might not be listening yet...need to wait until fsockopen() call returns - $error = "Unable to connect to server\n"; -- for ($i=0; $i < 60; $i++) { -+ for ($i=0; $i < getenv("VALGRIND") ? 1000 : 60; $i++) { - usleep(50000); // 50ms per try - $status = proc_get_status($handle); - $fp = @fsockopen($host, $port); -@@ -46,12 +46,16 @@ function memcached_server_start($code = 'server.php', $host = "127.0.0.1", $port - if ($error) { - echo $error; - proc_terminate($handle); -+ proc_close($handle); - exit(1); - } - - register_shutdown_function( - function($handle) { -- proc_terminate($handle); -+ if (is_resource($handle)) { -+ proc_terminate($handle); -+ proc_close($handle); -+ } - }, - $handle - ); -@@ -72,6 +76,7 @@ function memcached_server_stop($handle) { - } - usleep(50000); - } -+ proc_close($handle); - } - return $success; - } - -From cebd8513bd1cb0a5a67642072cc4dad1907a2e5e Mon Sep 17 00:00:00 2001 -From: Michael Wallner -Date: Mon, 25 Jan 2021 14:45:03 +0100 -Subject: [PATCH 13/16] implement stats callback suggestions by Remi - ---- - php_memcached_server.c | 45 +++++++++++++++++++++----------------- - tests/memcachedserver.phpt | 22 +++++++++++++++++++ - tests/server.php | 19 ++++++++++------ - 3 files changed, 59 insertions(+), 27 deletions(-) - -diff --git a/php_memcached_server.c b/php_memcached_server.c -index a166051e..24c328f8 100644 ---- a/php_memcached_server.c -+++ b/php_memcached_server.c -@@ -519,7 +519,7 @@ protocol_binary_response_status s_stat_handler (const void *cookie, const void * - } else { - ZVAL_NULL(&zkey); - } -- ZVAL_NULL(&zstats); -+ array_init(&zstats); - ZVAL_MAKE_REF(&zstats); - - ZVAL_COPY(¶ms[0], &zcookie); -@@ -529,29 +529,34 @@ protocol_binary_response_status s_stat_handler (const void *cookie, const void * - retval = s_invoke_php_callback (&MEMC_GET_CB(MEMC_SERVER_ON_STAT), params, 3); - - if (retval == PROTOCOL_BINARY_RESPONSE_SUCCESS) { -- if (Z_ISNULL(zstats)) { -- retval = response_handler(cookie, NULL, 0, NULL, 0); -- } else { -- zval *zarray = &zstats; -- zend_string *key; -- zval *val; -- -- ZVAL_DEREF(zarray); -- if (Z_TYPE_P(zarray) != IS_ARRAY) { -- convert_to_array(zarray); -- } -+ zval *zarray = &zstats; -+ zend_string *key; -+ zend_long idx; -+ zval *val; -+ -+ ZVAL_DEREF(zarray); -+ if (Z_TYPE_P(zarray) != IS_ARRAY) { -+ convert_to_array(zarray); -+ } - -- ZEND_HASH_FOREACH_STR_KEY_VAL(Z_ARRVAL_P(zarray), key, val) -- { -- zend_string *val_str = zval_get_string(val); -+ ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(zarray), idx, key, val) -+ { -+ zend_string *val_str = zval_get_string(val); -+ -+ if (key) { - retval = response_handler(cookie, key->val, key->len, val_str->val, val_str->len); -- if (retval != PROTOCOL_BINARY_RESPONSE_SUCCESS) { -- break; -- } -- zend_string_release(val_str); -+ } else { -+ char buf[0x20], *ptr, *end = &buf[sizeof(buf) - 1]; -+ ptr = zend_print_long_to_buf(end, idx); -+ retval = response_handler(cookie, ptr, end - ptr, val_str->val, val_str->len); -+ } -+ zend_string_release(val_str); -+ -+ if (retval != PROTOCOL_BINARY_RESPONSE_SUCCESS) { -+ break; - } -- ZEND_HASH_FOREACH_END(); - } -+ ZEND_HASH_FOREACH_END(); - } - - zval_ptr_dtor(¶ms[0]); -diff --git a/tests/memcachedserver.phpt b/tests/memcachedserver.phpt -index d47dd73b..8d6bf222 100644 ---- a/tests/memcachedserver.phpt -+++ b/tests/memcachedserver.phpt -@@ -37,6 +37,8 @@ $cache->replace ('replace_key', 'value 2', 200); - var_dump($cache->getVersion()); - var_dump($cache->getStats()); - var_dump($cache->getStats("foobar")); -+var_dump($cache->getStats("scalar")); -+var_dump($cache->getStats("numeric array")); - - $cache->quit(); - -@@ -84,5 +86,25 @@ array(1) { - string(3) "bar" - } - } -+client_id=[%s]: Stat key=[scalar] -+array(1) { -+ ["127.0.0.1:3434"]=> -+ array(1) { -+ [0]=> -+ string(%d) "you want it, you get it" -+ } -+} -+client_id=[%s]: Stat key=[numeric array] -+array(1) { -+ ["127.0.0.1:3434"]=> -+ array(3) { -+ [-1]=> -+ string(3) "one" -+ [0]=> -+ string(3) "two" -+ [1]=> -+ string(5) "three" -+ } -+} - client_id=[%s]: Client quit - Done -diff --git a/tests/server.php b/tests/server.php -index f5ff2f6a..bce4c0bf 100644 ---- a/tests/server.php -+++ b/tests/server.php -@@ -77,13 +77,18 @@ function ($client_id, $key, $value, $flags, $expiration, $cas, &$result_cas) { - }); - - $server->on (Memcached::ON_STAT, -- function ($client_id, $key, array &$values = null) { -- echo "client_id=[$client_id]: Stat key=[$key]" . PHP_EOL; -- $values = [ -- "key" => $key, -- "foo" => "bar", -- ]; -- return Memcached::RESPONSE_SUCCESS; -+ function ($client_id, $key, array &$values) { -+ echo "client_id=[$client_id]: Stat key=[$key]" . PHP_EOL; -+ -+ if ($key === "scalar") { -+ $values = "you want it, you get it"; -+ } elseif ($key === "numeric array") { -+ $values = [-1 => "one", "two", "three"]; -+ } else { -+ $values["key"] = $key; -+ $values["foo"] = "bar"; -+ } -+ return Memcached::RESPONSE_SUCCESS; - }); - - $server->on (Memcached::ON_VERSION, - -From af7ffcf0a11d653e427d3b2dacd4fdef1623daa6 Mon Sep 17 00:00:00 2001 -From: Michael Wallner -Date: Mon, 25 Jan 2021 14:54:24 +0100 -Subject: [PATCH 14/16] skip test with libmemcached < 1.1.0 - ---- - tests/memcachedserver.phpt | 4 ++++ - 1 file changed, 4 insertions(+) - -diff --git a/tests/memcachedserver.phpt b/tests/memcachedserver.phpt -index 8d6bf222..145acfba 100644 ---- a/tests/memcachedserver.phpt -+++ b/tests/memcachedserver.phpt -@@ -8,6 +8,10 @@ if (!extension_loaded("memcached")) { - if (!class_exists("MemcachedServer")) { - die("skip memcached not built with libmemcachedprotocol support\n"); - } -+ -+if (Memcached::LIBMEMCACHED_VERSION_HEX < 0x1001000) { -+ die("skip needs at least libmemcached 1.1.0\n"); -+} - ?> - --FILE-- - -Date: Tue, 26 Jan 2021 11:38:12 +0100 -Subject: [PATCH 15/16] add IPv6 test - ---- - tests/memcachedserver.phpt | 4 ++ - tests/memcachedserver6.phpt | 114 ++++++++++++++++++++++++++++++++++++ - tests/server.php | 2 + - 3 files changed, 120 insertions(+) - create mode 100644 tests/memcachedserver6.phpt - -diff --git a/tests/memcachedserver.phpt b/tests/memcachedserver.phpt -index 8d6bf222..c4fdd7c6 100644 ---- a/tests/memcachedserver.phpt -+++ b/tests/memcachedserver.phpt -@@ -36,6 +36,7 @@ $cache->replace ('replace_key', 'value 2', 200); - - var_dump($cache->getVersion()); - var_dump($cache->getStats()); -+var_dump($cache->getStats("empty")); - var_dump($cache->getStats("foobar")); - var_dump($cache->getStats("scalar")); - var_dump($cache->getStats("numeric array")); -@@ -76,6 +77,9 @@ array(1) { - string(3) "bar" - } - } -+client_id=[%s]: Stat key=[empty] -+array(0) { -+} - client_id=[%s]: Stat key=[foobar] - array(1) { - ["127.0.0.1:3434"]=> -diff --git a/tests/memcachedserver6.phpt b/tests/memcachedserver6.phpt -new file mode 100644 -index 00000000..8ae0b362 ---- /dev/null -+++ b/tests/memcachedserver6.phpt -@@ -0,0 +1,114 @@ -+--TEST-- -+MemcachedServer -+--SKIPIF-- -+ -+--FILE-- -+setOption(Memcached::OPT_BINARY_PROTOCOL, true); -+$cache->setOption(Memcached::OPT_COMPRESSION, false); -+$cache->addServer('[::1]', 3434); -+ -+$cache->add("add_key", "hello", 500); -+$cache->append("append_key", "world"); -+$cache->prepend("prepend_key", "world"); -+ -+$cache->increment("incr", 2, 1, 500); -+$cache->decrement("decr", 2, 1, 500); -+ -+$cache->delete("delete_k"); -+$cache->flush(1); -+ -+var_dump($cache->get('get_this')); -+ -+$cache->set ('set_key', 'value 1', 100); -+$cache->replace ('replace_key', 'value 2', 200); -+ -+var_dump($cache->getVersion()); -+var_dump($cache->getStats()); -+var_dump($cache->getStats("empty")); -+var_dump($cache->getStats("foobar")); -+var_dump($cache->getStats("scalar")); -+var_dump($cache->getStats("numeric array")); -+ -+$cache->quit(); -+ -+memcached_server_stop($server); -+?> -+Done -+--EXPECTF-- -+Listening on [::1]:3434 -+Incoming connection from [::1]:%s -+Incoming connection from [::1]:%s -+client_id=[%s]: Add key=[add_key], value=[hello], flags=[0], expiration=[500] -+client_id=[%s]: Append key=[append_key], value=[world], cas=[0] -+client_id=[%s]: Prepend key=[prepend_key], value=[world], cas=[0] -+client_id=[%s]: Incrementing key=[incr], delta=[2], initial=[1], expiration=[500] -+client_id=[%s]: Decrementing key=[decr], delta=[2], initial=[1], expiration=[500] -+client_id=[%s]: Delete key=[delete_k], cas=[0] -+client_id=[%s]: Flush when=[1] -+client_id=[%s]: Get key=[get_this] -+client_id=[%s]: Noop -+string(20) "Hello to you client!" -+client_id=[%s]: Set key=[set_key], value=[value 1], flags=[0], expiration=[100], cas=[0] -+client_id=[%s]: Replace key=[replace_key], value=[value 2], flags=[0], expiration=[200], cas=[0] -+client_id=[%s]: Version -+array(1) { -+ ["[::1]:3434"]=> -+ string(5) "1.1.1" -+} -+client_id=[%s]: Stat key=[] -+array(1) { -+ ["[::1]:3434"]=> -+ array(2) { -+ ["key"]=> -+ string(0) "" -+ ["foo"]=> -+ string(3) "bar" -+ } -+} -+client_id=[%s]: Stat key=[empty] -+array(0) { -+} -+client_id=[%s]: Stat key=[foobar] -+array(1) { -+ ["[::1]:3434"]=> -+ array(2) { -+ ["key"]=> -+ string(6) "foobar" -+ ["foo"]=> -+ string(3) "bar" -+ } -+} -+client_id=[%s]: Stat key=[scalar] -+array(1) { -+ ["[::1]:3434"]=> -+ array(1) { -+ [0]=> -+ string(%d) "you want it, you get it" -+ } -+} -+client_id=[%s]: Stat key=[numeric array] -+array(1) { -+ ["[::1]:3434"]=> -+ array(3) { -+ [-1]=> -+ string(3) "one" -+ [0]=> -+ string(3) "two" -+ [1]=> -+ string(5) "three" -+ } -+} -+client_id=[%s]: Client quit -+Done -diff --git a/tests/server.php b/tests/server.php -index bce4c0bf..9a50eb06 100644 ---- a/tests/server.php -+++ b/tests/server.php -@@ -84,6 +84,8 @@ function ($client_id, $key, array &$values) { - $values = "you want it, you get it"; - } elseif ($key === "numeric array") { - $values = [-1 => "one", "two", "three"]; -+ } elseif ($key === "empty") { -+ $values = []; - } else { - $values["key"] = $key; - $values["foo"] = "bar"; - -From abf4add8a1761a319e533197cf65b9b6abdc028a Mon Sep 17 00:00:00 2001 -From: Remi Collet -Date: Tue, 26 Jan 2021 11:42:37 +0100 -Subject: [PATCH 16/16] small sleep to avoid loosing message from subprocess - ---- - tests/memcachedserver.phpt | 1 + - tests/memcachedserver6.phpt | 1 + - 2 files changed, 2 insertions(+) - -diff --git a/tests/memcachedserver.phpt b/tests/memcachedserver.phpt -index c4fdd7c6..c46a4ccd 100644 ---- a/tests/memcachedserver.phpt -+++ b/tests/memcachedserver.phpt -@@ -42,6 +42,7 @@ var_dump($cache->getStats("scalar")); - var_dump($cache->getStats("numeric array")); - - $cache->quit(); -+usleep(50000); - - memcached_server_stop($server); - ?> -diff --git a/tests/memcachedserver6.phpt b/tests/memcachedserver6.phpt -index 8ae0b362..a2277b4a 100644 ---- a/tests/memcachedserver6.phpt -+++ b/tests/memcachedserver6.phpt -@@ -42,6 +42,7 @@ var_dump($cache->getStats("scalar")); - var_dump($cache->getStats("numeric array")); - - $cache->quit(); -+usleep(50000); - - memcached_server_stop($server); - ?> diff --git a/486.patch b/486.patch deleted file mode 100644 index d98d572..0000000 --- a/486.patch +++ /dev/null @@ -1,105 +0,0 @@ -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/487.patch b/487.patch deleted file mode 100644 index 97761f4..0000000 --- a/487.patch +++ /dev/null @@ -1,33 +0,0 @@ -From 70ec7c2717deeeb03c8ca49fa36860b7f2476eb3 Mon Sep 17 00:00:00 2001 -From: Remi Collet -Date: Fri, 23 Jul 2021 12:00:19 +0200 -Subject: [PATCH] fix zend_dtoa API change in 8.1.0beta1 - ---- - g_fmt.c | 9 +++++++-- - 1 file changed, 7 insertions(+), 2 deletions(-) - -diff --git a/g_fmt.c b/g_fmt.c -index 73f82fd0..f456790c 100644 ---- a/g_fmt.c -+++ b/g_fmt.c -@@ -27,12 +27,17 @@ - * // Teddy Grenman , 2010-05-18. - */ - --#include -+#include - - char *php_memcached_g_fmt(register char *b, double x) { - register int i, k; - register char *s; -- int decpt, j, sign; -+ int decpt, j; -+#if PHP_VERSION_ID < 80100 -+ int sign; -+#else -+ bool sign; -+#endif - char *b0, *s0, *se; - - b0 = b; diff --git a/PHPINFO b/PHPINFO index 02d2609..c3645a9 100644 --- a/PHPINFO +++ b/PHPINFO @@ -2,7 +2,7 @@ memcached memcached support => enabled -Version => 3.1.5 +Version => 3.1.6-dev libmemcached-awesome version => 1.1.1 SASL support => yes Session support => yes diff --git a/REFLECTION b/REFLECTION index d3d40e1..22de408 100644 --- a/REFLECTION +++ b/REFLECTION @@ -1,4 +1,4 @@ -Extension [ extension #113 memcached version 3.1.5 ] { +Extension [ extension #113 memcached version 3.1.6-dev ] { - Dependencies { Dependency [ session (Required) ] @@ -94,7 +94,7 @@ Extension [ extension #113 memcached version 3.1.5 ] { - Classes [3] { Class [ class Memcached ] { - - Constants [133] { + - Constants [146] { Constant [ public int LIBMEMCACHED_VERSION_HEX ] { 16781313 } Constant [ public int OPT_COMPRESSION ] { -1001 } Constant [ public int OPT_COMPRESSION_TYPE ] { -1004 } @@ -152,31 +152,44 @@ Extension [ extension #113 memcached version 3.1.5 ] { Constant [ public int RES_SUCCESS ] { 0 } Constant [ public int RES_FAILURE ] { 1 } Constant [ public int RES_HOST_LOOKUP_FAILURE ] { 2 } + Constant [ public int RES_CONNECTION_FAILURE ] { 3 } + Constant [ public int RES_CONNECTION_BIND_FAILURE ] { 4 } + Constant [ public int RES_WRITE_FAILURE ] { 5 } + Constant [ public int RES_READ_FAILURE ] { 6 } Constant [ public int RES_UNKNOWN_READ_FAILURE ] { 7 } Constant [ public int RES_PROTOCOL_ERROR ] { 8 } Constant [ public int RES_CLIENT_ERROR ] { 9 } Constant [ public int RES_SERVER_ERROR ] { 10 } - Constant [ public int RES_WRITE_FAILURE ] { 5 } Constant [ public int RES_DATA_EXISTS ] { 12 } + Constant [ public int RES_DATA_DOES_NOT_EXIST ] { 13 } Constant [ public int RES_NOTSTORED ] { 14 } + Constant [ public int RES_STORED ] { 15 } Constant [ public int RES_NOTFOUND ] { 16 } Constant [ public int RES_PARTIAL_READ ] { 18 } Constant [ public int RES_SOME_ERRORS ] { 19 } Constant [ public int RES_NO_SERVERS ] { 20 } Constant [ public int RES_END ] { 21 } - Constant [ public int RES_ERRNO ] { 26 } - Constant [ public int RES_BUFFERED ] { 32 } - Constant [ public int RES_TIMEOUT ] { 31 } - Constant [ public int RES_BAD_KEY_PROVIDED ] { 33 } - Constant [ public int RES_STORED ] { 15 } Constant [ public int RES_DELETED ] { 22 } + Constant [ public int RES_VALUE ] { 23 } Constant [ public int RES_STAT ] { 24 } Constant [ public int RES_ITEM ] { 25 } + Constant [ public int RES_ERRNO ] { 26 } + Constant [ public int RES_FAIL_UNIX_SOCKET ] { 27 } Constant [ public int RES_NOT_SUPPORTED ] { 28 } + Constant [ public int RES_NO_KEY_PROVIDED ] { 29 } Constant [ public int RES_FETCH_NOTFINISHED ] { 30 } + Constant [ public int RES_TIMEOUT ] { 31 } + Constant [ public int RES_BUFFERED ] { 32 } + Constant [ public int RES_BAD_KEY_PROVIDED ] { 33 } + Constant [ public int RES_INVALID_HOST_PROTOCOL ] { 34 } Constant [ public int RES_SERVER_MARKED_DEAD ] { 35 } Constant [ public int RES_UNKNOWN_STAT_KEY ] { 36 } - Constant [ public int RES_INVALID_HOST_PROTOCOL ] { 34 } + Constant [ public int RES_INVALID_ARGUMENTS ] { 38 } + Constant [ public int RES_PARSE_ERROR ] { 43 } + Constant [ public int RES_PARSE_USER_ERROR ] { 44 } + Constant [ public int RES_DEPRECATED ] { 45 } + Constant [ public int RES_IN_PROGRESS ] { 46 } + Constant [ public int RES_MAXIMUM_RETURN ] { 49 } Constant [ public int RES_MEMORY_ALLOCATION_FAILURE ] { 17 } Constant [ public int RES_CONNECTION_SOCKET_CREATE_FAILURE ] { 11 } Constant [ public int RES_E2BIG ] { 37 } @@ -239,7 +252,7 @@ Extension [ extension #113 memcached version 3.1.5 ] { - Properties [0] { } - - Methods [58] { + - Methods [59] { Method [ public method __construct ] { - Parameters [3] { @@ -761,6 +774,14 @@ Extension [ extension #113 memcached version 3.1.5 ] { } - Return [ bool ] } + + Method [ public method checkKey ] { + + - Parameters [1] { + Parameter #0 [ string $key ] + } + - Return [ bool ] + } } } diff --git a/php-pecl-memcached.spec b/php-pecl-memcached.spec index ba83ab9..3713f27 100644 --- a/php-pecl-memcached.spec +++ b/php-pecl-memcached.spec @@ -30,27 +30,26 @@ # After 40-igbinary, 40-json, 40-msgpack %global ini_name 50-%{pecl_name}.ini +%global upstream_version 3.1.6 +%global upstream_prever dev +# upstream use dev => alpha => beta => RC +# make RPM happy DEV => alpha => beta => rc +%global upstream_lower DEV + + Summary: Extension to work with the Memcached caching daemon Name: %{?sub_prefix}php-pecl-memcached -Version: 3.1.5 -Release: 13%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}} +Version: %{upstream_version}%{?upstream_prever:~%{upstream_lower}} +Release: 1%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}} License: PHP 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/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 -Patch8: https://patch-diff.githubusercontent.com/raw/php-memcached-dev/php-memcached/pull/486.patch -Patch9: https://patch-diff.githubusercontent.com/raw/php-memcached-dev/php-memcached/pull/487.patch +Source0: https://pecl.php.net/get/%{pecl_name}-%{upstream_version}%{?upstream_prever}.tgz + +# revert change store_retry_count default (keep 3.1.5 behavior) +Patch0: https://patch-diff.githubusercontent.com/raw/php-memcached-dev/php-memcached/pull/452.patch +# improve phpinfo Patch10: https://patch-diff.githubusercontent.com/raw/php-memcached-dev/php-memcached/pull/488.patch -Patch11: https://patch-diff.githubusercontent.com/raw/php-memcached-dev/php-memcached/pull/474.patch BuildRequires: %{?dtsprefix}gcc BuildRequires: %{?scl_prefix}php-devel >= 7.0 @@ -161,7 +160,7 @@ Package built for PHP %(%{__php} -r 'echo PHP_MAJOR_VERSION.".".PHP_MINOR_VERSIO %prep %setup -c -q -mv %{pecl_name}-%{version} NTS +mv %{pecl_name}-%{upstream_version}%{?upstream_prever} NTS # Don't install/register tests sed -e 's/role="test"/role="src"/' \ @@ -169,23 +168,8 @@ 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 -%patch2 -p1 -b .pr465 -%patch3 -p1 -b .pr467 -%patch4 -p1 -b .pr468 -%patch5 -p1 -b .pr469 -%patch6 -p1 -b .pr472 -%patch8 -p1 -b .pr486 -%patch9 -p1 -b .pr486 -%endif +%patch0 -p1 -R -b .pr452 %patch10 -p1 -b .pr488 -%if "%{php_version}" > "8.0" -%patch11 -p1 -b .pr474 -%else -%patch7 -p1 -b .pr473 -%endif %if %{with fastlz} rm -r fastlz @@ -194,9 +178,9 @@ sed -e '/name=.fastlz/d' -i ../package.xml # Check version as upstream often forget to update this extver=$(sed -n '/#define PHP_MEMCACHED_VERSION/{s/.* "//;s/".*$//;p}' php_memcached.h) -if test "x${extver}" != "x%{version}%{?gh_date:-dev}%{?intver}"; then - : Error: Upstream HTTP version is now ${extver}, expecting %{version}%{?prever}%{?gh_date:-dev}. - : Update the pdover macro and rebuild. +if test "x${extver}" != "x%{upstream_version}%{?upstream_prever:-%{upstream_prever}}"; then + : Error: Upstream extension version is ${extver}, expecting %{upstream_version}%{?upstream_prever:-%{upstream_prever}}. + : Update the macro and rebuild. exit 1 fi cd .. @@ -386,6 +370,9 @@ exit $ret %changelog +* Thu Mar 3 2022 Remi Collet - 3.1.6~DEV-1 +- update to 3.1.6-dev (2022-03-02) + * Fri Feb 25 2022 Remi Collet - 3.1.5-13 - rebuild using remi-libmemcached-awesome -- cgit