summaryrefslogtreecommitdiffstats
path: root/30.patch
diff options
context:
space:
mode:
Diffstat (limited to '30.patch')
-rw-r--r--30.patch187
1 files changed, 187 insertions, 0 deletions
diff --git a/30.patch b/30.patch
new file mode 100644
index 0000000..3d98af2
--- /dev/null
+++ b/30.patch
@@ -0,0 +1,187 @@
+From 82f7fa12daef81f4a9b3c923c848a53dcc1b3b23 Mon Sep 17 00:00:00 2001
+From: Remi Collet <remi@remirepo.net>
+Date: Fri, 22 Jun 2018 13:57:47 +0200
+Subject: [PATCH] fix for PHP 7.3 + fix build warnings
+
+---
+ php7/memcache.c | 14 +++++++++++++-
+ php7/memcache_binary_protocol.c | 9 ++-------
+ php7/memcache_pool.c | 2 --
+ php7/memcache_session.c | 19 ++++++++++++++++++-
+ 4 files changed, 33 insertions(+), 11 deletions(-)
+
+diff --git a/php7/memcache.c b/php7/memcache.c
+index f5b5c34..3a6c000 100644
+--- a/php7/memcache.c
++++ b/php7/memcache.c
+@@ -621,7 +621,6 @@ static void php_mmc_numeric(INTERNAL_FUNCTION_PARAMETERS, int deleted, int inver
+
+ if (Z_TYPE_P(keys) == IS_ARRAY) {
+ zval *key;
+- zend_ulong key_index;
+
+ if (deleted) {
+ /* changed to true/false by mmc_numeric_response_handler */
+@@ -728,7 +727,12 @@ mmc_t *mmc_find_persistent(const char *host, int host_len, unsigned short port,
+ mmc = mmc_server_new(host, host_len, port, udp_port, 1, timeout, retry_interval);
+ le->type = le_memcache_server;
+ le->ptr = mmc;
++#if PHP_VERSION_ID < 70300
+ GC_REFCOUNT(le) = 1;
++#else
++ GC_SET_REFCOUNT(le, 1);
++#endif
++
+
+ /* register new persistent connection */
+ if (zend_hash_str_update_mem(&EG(persistent_list), key, key_len, le, sizeof(*le)) == NULL) {
+@@ -786,7 +790,11 @@ static mmc_t *php_mmc_pool_addserver(
+ pool->failure_callback = &php_mmc_failure_callback;
+ list_res = zend_register_resource(pool, le_memcache_pool);
+ add_property_resource(mmc_object, "connection", list_res);
++#if PHP_VERSION_ID < 70300
+ GC_REFCOUNT(list_res)++;
++#else
++ GC_ADDREF(list_res);
++#endif
+ }
+ else {
+ pool = zend_fetch_resource_ex(connection, "connection", le_memcache_pool);
+@@ -870,7 +878,11 @@ static void php_mmc_connect(INTERNAL_FUNCTION_PARAMETERS, zend_bool persistent)
+ mmc_object = return_value;
+ object_init_ex(mmc_object, memcache_ce);
+ add_property_resource(mmc_object, "connection", list_res);
++#if PHP_VERSION_ID < 70300
+ GC_REFCOUNT(list_res)++;
++#else
++ GC_ADDREF(list_res);
++#endif
+ } else {
+ RETVAL_TRUE;
+ }
+diff --git a/php7/memcache_binary_protocol.c b/php7/memcache_binary_protocol.c
+index d1926cc..dfd8060 100644
+--- a/php7/memcache_binary_protocol.c
++++ b/php7/memcache_binary_protocol.c
+@@ -239,7 +239,6 @@ static int mmc_request_parse_response(mmc_t *mmc, mmc_request_t *request) /*
+ {
+ mmc_response_header_t *header;
+ mmc_binary_request_t *req = (mmc_binary_request_t *)request;
+- size_t size_header = sizeof(mmc_response_header_t);
+
+ header = (mmc_response_header_t *)mmc_stream_get(request->io, sizeof(mmc_response_header_t));
+
+@@ -564,7 +563,7 @@ static int mmc_binary_store(
+ return status;
+ }
+
+- header = (mmc_store_request_header_t *)(request->sendbuf.value.c + prevlen);
++ header = (mmc_store_append_header_t *)(request->sendbuf.value.c + prevlen);
+
+ mmc_pack_header(&(header->base), op, 0, key_len, sizeof(mmc_store_append_header_t) - sizeof(mmc_request_header_t), request->sendbuf.value.len - valuelen);
+ header->base.cas = htonll(cas);
+@@ -631,7 +630,6 @@ static void mmc_binary_mutate(mmc_request_t *request, zval *zkey, const char *ke
+ {
+ mmc_mutate_request_header_t header;
+ mmc_binary_request_t *req = (mmc_binary_request_t *)request;
+- const size_t request_header_size = sizeof(mmc_request_header_t);
+ uint8_t op;
+
+ request->parse = mmc_request_parse_response;
+@@ -720,12 +718,10 @@ static void mmc_binary_stats(mmc_request_t *request, const char *type, long slab
+
+ static void mmc_set_sasl_auth_data(mmc_pool_t *pool, mmc_request_t *request, const char *user, const char *password) /* {{{ */
+ {
+- const char *key = "PLAIN";
+ const unsigned int key_len = 5;
+- int prevlen, valuelen;
++ int prevlen;
+ mmc_sasl_request_header *header;
+ mmc_binary_request_t *req = (mmc_binary_request_t *)request;
+- unsigned int flags = 0;
+
+ request->parse = mmc_request_parse_response;
+ req->next_parse_handler = mmc_request_read_response;
+@@ -740,7 +736,6 @@ static void mmc_set_sasl_auth_data(mmc_pool_t *pool, mmc_request_t *request, con
+
+ /* append key and data */
+ smart_string_appendl(&(request->sendbuf.value), "PLAIN", 5);
+- valuelen = request->sendbuf.value.len;
+
+ /* initialize header */
+ header = (mmc_sasl_request_header *)(request->sendbuf.value.c + prevlen);
+diff --git a/php7/memcache_pool.c b/php7/memcache_pool.c
+index 3aea80c..f6e016b 100644
+--- a/php7/memcache_pool.c
++++ b/php7/memcache_pool.c
+@@ -44,7 +44,6 @@ ZEND_DECLARE_MODULE_GLOBALS(memcache)
+ MMC_POOL_INLINE void mmc_buffer_alloc(mmc_buffer_t *buffer, unsigned int size) /*
+ ensures space for an additional size bytes {{{ */
+ {
+- register size_t newlen;
+ smart_string_alloc((&(buffer->value)), size, 0);
+ }
+ /* }}} */
+@@ -432,7 +431,6 @@ int mmc_unpack_value(
+ {
+ char *data = NULL;
+ unsigned long data_len;
+- int rv;
+
+ zval object;
+
+diff --git a/php7/memcache_session.c b/php7/memcache_session.c
+index dd2434a..98cfde1 100644
+--- a/php7/memcache_session.c
++++ b/php7/memcache_session.c
+@@ -102,7 +102,11 @@ PS_OPEN_FUNC(memcache)
+ if (url->query != NULL) {
+ array_init(&params);
+
++#if PHP_VERSION_ID < 70300
+ sapi_module.treat_data(PARSE_STRING, estrdup(url->query), &params);
++#else
++ sapi_module.treat_data(PARSE_STRING, estrdup(ZSTR_VAL(url->query)), &params);
++#endif
+
+ if ((param = zend_hash_str_find(Z_ARRVAL(params), "persistent", sizeof("persistent")-1)) != NULL) {
+ convert_to_boolean_ex(param);
+@@ -132,9 +136,15 @@ PS_OPEN_FUNC(memcache)
+ zval_ptr_dtor(&params);
+ }
+
++#if PHP_VERSION_ID < 70300
+ if (url->scheme && url->path && !strcmp(url->scheme, "file")) {
+ char *host;
+ int host_len = spprintf(&host, 0, "unix://%s", url->path);
++#else
++ if (url->scheme && url->path && !strcmp(ZSTR_VAL(url->scheme), "file")) {
++ char *host;
++ int host_len = spprintf(&host, 0, "unix://%s", ZSTR_VAL(url->path));
++#endif
+
+ /* chop off trailing :0 port specifier */
+ if (!strcmp(host + host_len - 2, ":0")) {
+@@ -158,14 +168,21 @@ PS_OPEN_FUNC(memcache)
+ return FAILURE;
+ }
+
++#if PHP_VERSION_ID < 70300
+ if (persistent) {
+ mmc = mmc_find_persistent(url->host, strlen(url->host), url->port, udp_port, timeout, retry_interval);
+ }
+ else {
+ mmc = mmc_server_new(url->host, strlen(url->host), url->port, udp_port, 0, timeout, retry_interval);
+ }
++#else
++ if (persistent) {
++ mmc = mmc_find_persistent(ZSTR_VAL(url->host), ZSTR_LEN(url->host), url->port, udp_port, timeout, retry_interval);
++ } else {
++ mmc = mmc_server_new(ZSTR_VAL(url->host), ZSTR_LEN(url->host), url->port, udp_port, 0, timeout, retry_interval);
++ }
++#endif
+ }
+-
+ mmc_pool_add(pool, mmc, weight);
+ php_url_free(url);
+ }