summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--22.patch255
-rw-r--r--php-pecl-couchbase2.spec10
2 files changed, 264 insertions, 1 deletions
diff --git a/22.patch b/22.patch
new file mode 100644
index 0000000..26b7574
--- /dev/null
+++ b/22.patch
@@ -0,0 +1,255 @@
+From 0c4210361cbc3fa1e36f24943a98d1c92a58874c Mon Sep 17 00:00:00 2001
+From: Remi Collet <remi@remirepo.net>
+Date: Fri, 22 Jun 2018 14:42:58 +0200
+Subject: [PATCH 1/2] fix for 7.3
+
+---
+ src/couchbase/pool.c | 32 ++++++++++++++++++++++++++++++++
+ 1 file changed, 32 insertions(+)
+
+diff --git a/src/couchbase/pool.c b/src/couchbase/pool.c
+index 825b81e..157731a 100644
+--- a/src/couchbase/pool.c
++++ b/src/couchbase/pool.c
+@@ -161,11 +161,19 @@ static lcb_error_t pcbc_normalize_connstr(lcb_type_t type, char *connstr, const
+ // rebuild connection string with username as the bucket
+ smart_str buf = {0};
+ if (url->scheme) {
++#if PHP_VERSION_ID < 70300
+ smart_str_appends(&buf, url->scheme);
++#else
++ smart_str_appendl(&buf, ZSTR_VAL(url->scheme), ZSTR_LEN(url->scheme));
++#endif
+ smart_str_appendl(&buf, "://", 3);
+ }
+ if (url->host) {
++#if PHP_VERSION_ID < 70300
+ smart_str_appends(&buf, url->host);
++#else
++ smart_str_appendl(&buf, ZSTR_VAL(url->host), ZSTR_LEN(url->host));
++#endif
+ }
+ if (url->port) {
+ smart_str_appendc(&buf, ':');
+@@ -175,7 +183,11 @@ static lcb_error_t pcbc_normalize_connstr(lcb_type_t type, char *connstr, const
+ smart_str_appends(&buf, bucketname);
+ if (url->query) {
+ smart_str_appendc(&buf, '?');
++#if PHP_VERSION_ID < 70300
+ smart_str_appends(&buf, url->query);
++#else
++ smart_str_appendl(&buf, ZSTR_VAL(url->query), ZSTR_LEN(url->query));
++#endif
+ }
+ smart_str_0(&buf);
+ PCBC_SMARTSTR_DUP(buf, *normalized);
+@@ -186,15 +198,27 @@ static lcb_error_t pcbc_normalize_connstr(lcb_type_t type, char *connstr, const
+ }
+ break;
+ case LCB_TYPE_CLUSTER:
++#if PHP_VERSION_ID < 70300
+ if (url->path != NULL && url->path[0] != '\0') {
++#else
++ if (url->path != NULL && ZSTR_VAL(url->path)[0] != '\0') {
++#endif
+ // strip bucket from the connection string
+ smart_str buf = {0};
+ if (url->scheme) {
++#if PHP_VERSION_ID < 70300
+ smart_str_appends(&buf, url->scheme);
++#else
++ smart_str_appendl(&buf, ZSTR_VAL(url->scheme), ZSTR_LEN(url->scheme));
++#endif
+ smart_str_appendl(&buf, "://", 3);
+ }
+ if (url->host) {
++#if PHP_VERSION_ID < 70300
+ smart_str_appends(&buf, url->host);
++#else
++ smart_str_appendl(&buf, ZSTR_VAL(url->host), ZSTR_LEN(url->host));
++#endif
+ }
+ if (url->port) {
+ smart_str_appendc(&buf, ':');
+@@ -202,7 +226,11 @@ static lcb_error_t pcbc_normalize_connstr(lcb_type_t type, char *connstr, const
+ }
+ if (url->query) {
+ smart_str_appendc(&buf, '?');
++#if PHP_VERSION_ID < 70300
+ smart_str_appends(&buf, url->query);
++#else
++ smart_str_appendl(&buf, ZSTR_VAL(url->query), ZSTR_LEN(url->query));
++#endif
+ }
+ smart_str_0(&buf);
+ PCBC_SMARTSTR_DUP(buf, *normalized);
+@@ -257,7 +285,11 @@ static lcb_error_t pcbc_connection_cache(smart_str *plist_key, pcbc_connection_t
+ zend_resource res;
+ res.type = pcbc_res_couchbase;
+ res.ptr = conn;
++#if PHP_VERSION_ID < 70300
+ GC_REFCOUNT(&res) = 1;
++#else
++ GC_SET_REFCOUNT(&res, 1);
++#endif
+
+ if (zend_hash_str_update_mem(&EG(persistent_list), PCBC_SMARTSTR_VAL(*plist_key), PCBC_SMARTSTR_LEN(*plist_key),
+ &res, sizeof(res)) == NULL) {
+
+From a46f448465b93fc8585f4bdc2ebc17dc9f4f33fd Mon Sep 17 00:00:00 2001
+From: Remi Collet <remi@remirepo.net>
+Date: Fri, 22 Jun 2018 14:50:55 +0200
+Subject: [PATCH 2/2] fix -Wformat issue raised with 7.3
+
+---
+ src/couchbase/bucket_manager.c | 8 ++++----
+ src/couchbase/cluster_manager.c | 14 +++++++-------
+ src/couchbase/mutation_state.c | 2 +-
+ src/couchbase/n1ql_query.c | 8 ++++----
+ 4 files changed, 16 insertions(+), 16 deletions(-)
+
+diff --git a/src/couchbase/bucket_manager.c b/src/couchbase/bucket_manager.c
+index 165b410..4c17f0c 100644
+--- a/src/couchbase/bucket_manager.c
++++ b/src/couchbase/bucket_manager.c
+@@ -117,7 +117,7 @@ PHP_METHOD(BucketManager, insertDesignDocument)
+ return;
+ }
+
+- path_len = spprintf(&path, 0, "/_design/%*s", name_len, name);
++ path_len = spprintf(&path, 0, "/_design/%*s", (int)name_len, name);
+
+ cmd.type = LCB_HTTP_TYPE_VIEW;
+ cmd.method = LCB_HTTP_METHOD_GET;
+@@ -187,7 +187,7 @@ PHP_METHOD(BucketManager, upsertDesignDocument)
+
+ cmd.type = LCB_HTTP_TYPE_VIEW;
+ cmd.method = LCB_HTTP_METHOD_PUT;
+- path_len = spprintf(&path, 0, "/_design/%*s", name_len, name);
++ path_len = spprintf(&path, 0, "/_design/%*s", (int)name_len, name);
+ LCB_CMD_SET_KEY(&cmd, path, path_len);
+ cmd.content_type = PCBC_CONTENT_TYPE_JSON;
+
+@@ -239,7 +239,7 @@ PHP_METHOD(BucketManager, removeDesignDocument)
+
+ cmd.type = LCB_HTTP_TYPE_VIEW;
+ cmd.method = LCB_HTTP_METHOD_DELETE;
+- path_len = spprintf(&path, 0, "/_design/%*s", name_len, name);
++ path_len = spprintf(&path, 0, "/_design/%*s", (int)name_len, name);
+ LCB_CMD_SET_KEY(&cmd, path, path_len);
+ cmd.content_type = PCBC_CONTENT_TYPE_FORM;
+ pcbc_http_request(return_value, obj->conn->lcb, &cmd, 1 TSRMLS_CC);
+@@ -264,7 +264,7 @@ PHP_METHOD(BucketManager, getDesignDocument)
+
+ cmd.type = LCB_HTTP_TYPE_VIEW;
+ cmd.method = LCB_HTTP_METHOD_GET;
+- path_len = spprintf(&path, 0, "/_design/%*s", name_len, name);
++ path_len = spprintf(&path, 0, "/_design/%*s", (int)name_len, name);
+ LCB_CMD_SET_KEY(&cmd, path, path_len);
+ cmd.content_type = PCBC_CONTENT_TYPE_FORM;
+ pcbc_http_request(return_value, obj->conn->lcb, &cmd, 1 TSRMLS_CC);
+diff --git a/src/couchbase/cluster_manager.c b/src/couchbase/cluster_manager.c
+index f782358..ffb0ff8 100644
+--- a/src/couchbase/cluster_manager.c
++++ b/src/couchbase/cluster_manager.c
+@@ -124,7 +124,7 @@ PHP_METHOD(ClusterManager, removeBucket)
+ if (rv == FAILURE) {
+ return;
+ }
+- path_len = spprintf(&path, 0, "/pools/default/buckets/%*s", name_len, name);
++ path_len = spprintf(&path, 0, "/pools/default/buckets/%*s", (int)name_len, name);
+ cmd.type = LCB_HTTP_TYPE_MANAGEMENT;
+ cmd.method = LCB_HTTP_METHOD_DELETE;
+ LCB_CMD_SET_KEY(&cmd, path, path_len);
+@@ -208,10 +208,10 @@ PHP_METHOD(ClusterManager, getUser)
+ }
+ switch (domain) {
+ case PCBC_CLUSTER_MANAGER_RBAC_DOMAIN_LOCAL:
+- path_len = spprintf(&path, 0, "/settings/rbac/users/local/%*s", name_len, name);
++ path_len = spprintf(&path, 0, "/settings/rbac/users/local/%*s", (int)name_len, name);
+ break;
+ case PCBC_CLUSTER_MANAGER_RBAC_DOMAIN_EXTERNAL:
+- path_len = spprintf(&path, 0, "/settings/rbac/users/external/%*s", name_len, name);
++ path_len = spprintf(&path, 0, "/settings/rbac/users/external/%*s", (int)name_len, name);
+ break;
+ default:
+ throw_pcbc_exception("Invalid arguments.", LCB_EINVAL);
+@@ -244,10 +244,10 @@ PHP_METHOD(ClusterManager, removeUser)
+ }
+ switch (domain) {
+ case PCBC_CLUSTER_MANAGER_RBAC_DOMAIN_LOCAL:
+- path_len = spprintf(&path, 0, "/settings/rbac/users/local/%*s", name_len, name);
++ path_len = spprintf(&path, 0, "/settings/rbac/users/local/%*s", (int)name_len, name);
+ break;
+ case PCBC_CLUSTER_MANAGER_RBAC_DOMAIN_EXTERNAL:
+- path_len = spprintf(&path, 0, "/settings/rbac/users/external/%*s", name_len, name);
++ path_len = spprintf(&path, 0, "/settings/rbac/users/external/%*s", (int)name_len, name);
+ break;
+ default:
+ throw_pcbc_exception("Invalid arguments.", LCB_EINVAL);
+@@ -293,10 +293,10 @@ PHP_METHOD(ClusterManager, upsertUser)
+ user = Z_USER_SETTINGS_OBJ_P(settings);
+ switch (domain) {
+ case PCBC_CLUSTER_MANAGER_RBAC_DOMAIN_LOCAL:
+- path_len = spprintf(&path, 0, "/settings/rbac/users/local/%*s", name_len, name);
++ path_len = spprintf(&path, 0, "/settings/rbac/users/local/%*s", (int)name_len, name);
+ break;
+ case PCBC_CLUSTER_MANAGER_RBAC_DOMAIN_EXTERNAL:
+- path_len = spprintf(&path, 0, "/settings/rbac/users/external/%*s", name_len, name);
++ path_len = spprintf(&path, 0, "/settings/rbac/users/external/%*s", (int)name_len, name);
+ break;
+ default:
+ throw_pcbc_exception("Invalid arguments.", LCB_EINVAL);
+diff --git a/src/couchbase/mutation_state.c b/src/couchbase/mutation_state.c
+index 5f0921e..b397149 100644
+--- a/src/couchbase/mutation_state.c
++++ b/src/couchbase/mutation_state.c
+@@ -205,7 +205,7 @@ void pcbc_mutation_state_export_for_n1ql(pcbc_mutation_state_t *obj, zval *scan_
+ add_next_index_long(PCBC_P(pair), PCBC_MUTATION_TOKEN_SEQ(token));
+ snprintf(buf, 21, "%llu", (unsigned long long)PCBC_MUTATION_TOKEN_ID(token));
+ ADD_NEXT_INDEX_STRING(PCBC_P(pair), buf);
+- snprintf(buf, 21, "%d\0", (int)PCBC_MUTATION_TOKEN_VB(token));
++ snprintf(buf, 21, "%d", (int)PCBC_MUTATION_TOKEN_VB(token));
+ #if PHP_VERSION_ID >= 70000
+ zend_hash_str_update(Z_ARRVAL_P(bucket_group), buf, strlen(buf), PCBC_P(pair) TSRMLS_CC);
+ #else
+diff --git a/src/couchbase/n1ql_query.c b/src/couchbase/n1ql_query.c
+index 0dcf906..de9cf41 100644
+--- a/src/couchbase/n1ql_query.c
++++ b/src/couchbase/n1ql_query.c
+@@ -174,7 +174,7 @@ PHP_METHOD(N1qlQuery, scanCap)
+ }
+
+ PCBC_READ_PROPERTY(options, pcbc_n1ql_query_ce, getThis(), "options", 0);
+- spprintf(&val, 0, "%d", scan_cap);
++ spprintf(&val, 0, "%ld", scan_cap);
+ ADD_ASSOC_STRING(options, "scan_cap", val);
+ efree(val);
+
+@@ -195,7 +195,7 @@ PHP_METHOD(N1qlQuery, pipelineBatch)
+ }
+
+ PCBC_READ_PROPERTY(options, pcbc_n1ql_query_ce, getThis(), "options", 0);
+- spprintf(&val, 0, "%d", pipeline_batch);
++ spprintf(&val, 0, "%ld", pipeline_batch);
+ ADD_ASSOC_STRING(options, "pipeline_batch", val);
+ efree(val);
+
+@@ -216,7 +216,7 @@ PHP_METHOD(N1qlQuery, pipelineCap)
+ }
+
+ PCBC_READ_PROPERTY(options, pcbc_n1ql_query_ce, getThis(), "options", 0);
+- spprintf(&val, 0, "%d", pipeline_cap);
++ spprintf(&val, 0, "%ld", pipeline_cap);
+ ADD_ASSOC_STRING(options, "pipeline_cap", val);
+ efree(val);
+
+@@ -237,7 +237,7 @@ PHP_METHOD(N1qlQuery, maxParallelism)
+ }
+
+ PCBC_READ_PROPERTY(options, pcbc_n1ql_query_ce, getThis(), "options", 0);
+- spprintf(&val, 0, "%d", max_parallelism);
++ spprintf(&val, 0, "%ld", max_parallelism);
+ ADD_ASSOC_STRING(options, "max_parallelism", val);
+ efree(val);
+
diff --git a/php-pecl-couchbase2.spec b/php-pecl-couchbase2.spec
index 3966d3b..f961906 100644
--- a/php-pecl-couchbase2.spec
+++ b/php-pecl-couchbase2.spec
@@ -26,11 +26,13 @@
Summary: Couchbase Server PHP extension
Name: %{?sub_prefix}php-pecl-couchbase2
Version: 2.4.7
-Release: 1%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}}
+Release: 2%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}}
License: PHP
URL: http://pecl.php.net/package/couchbase
Source0: http://pecl.php.net/get/%{pecl_name}-%{version}%{?prever}.tgz
+Patch0: https://patch-diff.githubusercontent.com/raw/couchbase/php-couchbase/pull/22.patch
+
BuildRequires: %{?dtsprefix}gcc
BuildRequires: %{?scl_prefix}php-devel >= 5.6
BuildRequires: %{?scl_prefix}php-pear
@@ -108,6 +110,8 @@ mv %{pecl_name}-%{version}%{?prever} NTS
%{?_licensedir:sed -e '/LICENSE/s/role="doc"/role="src"/' -i package.xml}
cd NTS
+%patch0 -p1 -b .pr22
+
# Drop bundled library
sed -e '/fastlz/d' -i ../package.xml
rm -r fastlz
@@ -242,6 +246,10 @@ fi
%changelog
+* Fri Jun 22 2018 Remi Collet <remi@remirepo.net> - 2.4.7-2
+- add patch for PHP 7.3 from
+ https://github.com/couchbase/php-couchbase/pull/22
+
* Fri Jun 8 2018 Remi Collet <remi@remirepo.net> - 2.4.7-1
- update to 2.4.7
- raise dependency on libcouchbase 2.9.0