summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemi Collet <remi@remirepo.net>2018-07-18 07:03:22 +0200
committerRemi Collet <remi@remirepo.net>2018-07-18 07:03:22 +0200
commit3111f47a12506b30b4cc38b33869379581fb86e3 (patch)
treef470ed7ccde07cbc9662593f52dde8c5b746b8fc
parente434f22bb8fed093b53b7860abd0e036db1fda0a (diff)
rebuild for 7.3.0alpha4 new ABI
-rw-r--r--26.patch (renamed from memcache-session.patch)9
-rw-r--r--30.patch187
-rw-r--r--php-pecl-memcache.spec35
3 files changed, 218 insertions, 13 deletions
diff --git a/memcache-session.patch b/26.patch
index eec0bd1..5081b6c 100644
--- a/memcache-session.patch
+++ b/26.patch
@@ -1,3 +1,12 @@
+From 4a9e4ab0d12150805feca3012854de9fd4e5a721 Mon Sep 17 00:00:00 2001
+From: Remi Collet <remi@remirepo.net>
+Date: Fri, 6 Oct 2017 12:08:28 +0200
+Subject: [PATCH] Fix #23 Failed to read session data with 7.1/7.2
+
+---
+ php7/memcache_session.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
diff --git a/php7/memcache_session.c b/php7/memcache_session.c
index dd2434a..45ba97d 100644
--- a/php7/memcache_session.c
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);
+ }
diff --git a/php-pecl-memcache.spec b/php-pecl-memcache.spec
index a3098c8..0a0bffd 100644
--- a/php-pecl-memcache.spec
+++ b/php-pecl-memcache.spec
@@ -31,19 +31,19 @@ Summary: Extension to work with the Memcached caching daemon
Name: %{?scl_prefix}php-pecl-memcache
Version: 3.0.9
%if 0%{?gh_date:1}
-Release: 0.9.%{gh_date}.%{gh_short}%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}}
+Release: 0.11.%{gh_date}.%{gh_short}%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}}
Source0: https://github.com/%{gh_owner}/%{gh_project}/archive/%{gh_commit}/%{pecl_name}-%{version}-%{gh_short}.tar.gz
%else
-Release: 3%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}}
+Release: 4%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}}
Source0: http://pecl.php.net/get/%{pecl_name}-%{version}.tgz
%endif
License: PHP
-Group: Development/Languages
URL: http://pecl.php.net/package/%{pecl_name}
-Patch0: %{pecl_name}-session.patch
+Patch0: https://patch-diff.githubusercontent.com/raw/websupport-sk/pecl-memcache/pull/26.patch
+Patch1: https://patch-diff.githubusercontent.com/raw/websupport-sk/pecl-memcache/pull/30.patch
-BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
+BuildRequires: %{?dtsprefix}gcc
BuildRequires: %{?scl_prefix}php-devel
BuildRequires: %{?scl_prefix}php-pear
BuildRequires: zlib-devel
@@ -90,6 +90,10 @@ Obsoletes: php71w-pecl-%{pecl_name} <= %{version}
Obsoletes: php72u-pecl-%{pecl_name} <= %{version}
Obsoletes: php72w-pecl-%{pecl_name} <= %{version}
%endif
+%if "%{php_version}" > "7.3"
+Obsoletes: php73u-pecl-%{pecl_name} <= %{version}
+Obsoletes: php73w-pecl-%{pecl_name} <= %{version}
+%endif
%endif
%if 0%{?fedora} < 20 && 0%{?rhel} < 7
@@ -134,8 +138,9 @@ sed -e 's/role="test"/role="src"/' \
pushd NTS
%if "%{php_version}" > "7.1"
-%patch0 -p1 -b .gh23
+%patch0 -p1 -b .gh26
%endif
+%patch1 -p1 -b .gh30
# Chech version as upstream often forget to update this
dir=php$(%{__php} -r 'echo PHP_MAJOR_VERSION;')
@@ -195,6 +200,8 @@ cp -r NTS ZTS
%build
+%{?dtsenable}
+
cd NTS
%{_bindir}/phpize
%configure --with-php-config=%{_bindir}/php-config
@@ -208,7 +215,7 @@ make %{?_smp_mflags}
%endif
%install
-rm -rf %{buildroot}
+%{?dtsenable}
make -C NTS install INSTALL_ROOT=%{buildroot}
@@ -273,11 +280,7 @@ exit $ret
%endif
-%clean
-rm -rf %{buildroot}
-
-
-%if 0%{?fedora} < 24
+%if 0%{?fedora} < 24 && 0%{?rhel} < 8
# when pear installed alone, after us
%triggerin -- %{?scl_prefix}php-pear
if [ -x %{__pecl} ] ; then
@@ -298,7 +301,6 @@ fi
%files
-%defattr(-, root, root, -)
%{?_licensedir:%license NTS/LICENSE}
%doc %{pecl_docdir}/%{pecl_name}
%{pecl_xmldir}/%{name}.xml
@@ -313,6 +315,13 @@ fi
%changelog
+* Wed Jul 18 2018 Remi Collet <remi@remirepo.net> - 3.0.9-0.11.20170802.e702b5f
+- rebuild for 7.3.0alpha4 new ABI
+
+* Fri Jun 22 2018 Remi Collet <remi@remirepo.net> - 3.0.9-0.10.20170802.e702b5f
+- add patch for PHP 7.3 from
+ https://github.com/websupport-sk/pecl-memcache/pull/30
+
* Fri Oct 6 2017 Remi Collet <remi@remirepo.net> - 3.0.9-0.9.20170802.e702b5f
- refresh to more recent snapshot
- add patch from https://github.com/websupport-sk/pecl-memcache/issues/23