summaryrefslogtreecommitdiffstats
path: root/32.patch
diff options
context:
space:
mode:
Diffstat (limited to '32.patch')
-rw-r--r--32.patch134
1 files changed, 134 insertions, 0 deletions
diff --git a/32.patch b/32.patch
new file mode 100644
index 0000000..d21d44f
--- /dev/null
+++ b/32.patch
@@ -0,0 +1,134 @@
+From 0c905da0d119291f0ce33379e7360a160c9e1699 Mon Sep 17 00:00:00 2001
+From: Remi Collet <remi@remirepo.net>
+Date: Mon, 7 Dec 2020 08:06:16 +0100
+Subject: [PATCH] restore compatibility with PHP 7.2
+
+---
+ src/couchbase/cluster.c | 4 ++++
+ src/couchbase/pool.c | 32 ++++++++++++++++++++++++++++++++
+ src/couchbase/result.c | 8 ++++++++
+ 3 files changed, 44 insertions(+)
+
+diff --git a/src/couchbase/cluster.c b/src/couchbase/cluster.c
+index 478cc3a..0c64366 100644
+--- a/src/couchbase/cluster.c
++++ b/src/couchbase/cluster.c
+@@ -63,7 +63,11 @@ static void pcbc_cluster_connection_init(zval *return_value, pcbc_cluster_t *clu
+ if (PCBCG(allow_fallback_to_bucket)) {
+ url = php_url_parse(cluster->connstr);
+ if (url && url->path) {
++#if PHP_VERSION_ID < 70300
++ bucket = url->path;
++#else
+ bucket = ZSTR_VAL(url->path);
++#endif
+ while (*bucket == '/') {
+ bucket++;
+ }
+diff --git a/src/couchbase/pool.c b/src/couchbase/pool.c
+index 9dfac11..3f5d8bd 100644
+--- a/src/couchbase/pool.c
++++ b/src/couchbase/pool.c
+@@ -151,11 +151,19 @@ static lcb_STATUS pcbc_normalize_connstr(lcb_INSTANCE_TYPE type, char *connstr,
+ // 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, ':');
+@@ -165,7 +173,11 @@ static lcb_STATUS pcbc_normalize_connstr(lcb_INSTANCE_TYPE type, char *connstr,
+ 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);
+@@ -176,15 +188,27 @@ static lcb_STATUS pcbc_normalize_connstr(lcb_INSTANCE_TYPE type, char *connstr,
+ }
+ 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, ':');
+@@ -192,7 +216,11 @@ static lcb_STATUS pcbc_normalize_connstr(lcb_INSTANCE_TYPE type, char *connstr,
+ }
+ 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);
+@@ -246,7 +274,11 @@ static lcb_STATUS 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) {
+diff --git a/src/couchbase/result.c b/src/couchbase/result.c
+index 506a1d8..015c286 100644
+--- a/src/couchbase/result.c
++++ b/src/couchbase/result.c
+@@ -18,6 +18,14 @@
+
+ #include <ext/date/php_date.h>
+
++/* PHP_VERSION_ID < 70300 */
++#ifndef ZVAL_COPY_DEREF
++#define ZVAL_COPY_DEREF(z,v) do { \
++ ZVAL_DEREF(v); \
++ ZVAL_COPY(z, v); \
++ } while (0)
++#endif
++
+ // clang-format off
+ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO(ai_MutationToken_partitionId, IS_LONG, 1)
+ ZEND_END_ARG_INFO()