Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/phpredis/phpredis.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPavlo Yatsukhnenko <yatsukhnenko@gmail.com>2016-11-01 15:35:18 +0300
committerPavlo Yatsukhnenko <yatsukhnenko@gmail.com>2016-11-01 17:05:07 +0300
commit88301fa1f7e1f0857fe588afe766fe973d7ce1e3 (patch)
tree5d4d5bf1d0e8ea1aa8611c78bbe6b98a03b4a15b /redis_cluster.c
parent228521cf44a437b5da9668a14217961dbabf516c (diff)
WIP: php7 compatibility
Redefine zend_hash_get_current_key + wrap zend_hash_get_current_key_ex
Diffstat (limited to 'redis_cluster.c')
-rw-r--r--redis_cluster.c23
1 files changed, 15 insertions, 8 deletions
diff --git a/redis_cluster.c b/redis_cluster.c
index a39eed3d..5ff2c875 100644
--- a/redis_cluster.c
+++ b/redis_cluster.c
@@ -599,20 +599,27 @@ static int get_key_val_ht(redisCluster *c, HashTable *ht, HashPosition *ptr,
clusterKeyValHT *kv TSRMLS_DC)
{
zval *z_val;
- unsigned int key_len;
- ulong idx;
+ zend_ulong idx;
// Grab the key, convert it to a string using provided kbuf buffer if it's
// a LONG style key
- switch(zend_hash_get_current_key_ex(ht, &(kv->key), &key_len, &idx, 0, ptr))
- {
+#if (PHP_MAJOR_VERSION < 7)
+ int key_len;
+ switch(zend_hash_get_current_key_ex(ht, &(kv->key), &key_len, &idx, 0, ptr)) {
+ case HASH_KEY_IS_STRING:
+ kv->key_len = (int)(key_len-1);
+#else
+ zend_string *zkey;
+ switch (zend_hash_get_current_key_ex(ht, &zkey, &idx, ptr)) {
+ case HASH_KEY_IS_STRING:
+ kv->key_len = zkey->len;
+ kv->key = zkey->val;
+#endif
+ break;
case HASH_KEY_IS_LONG:
kv->key_len = snprintf(kv->kbuf,sizeof(kv->kbuf),"%ld",(long)idx);
kv->key = kv->kbuf;
break;
- case HASH_KEY_IS_STRING:
- kv->key_len = (int)(key_len-1);
- break;
default:
zend_throw_exception(redis_cluster_exception_ce,
"Internal Zend HashTable error", 0 TSRMLS_CC);
@@ -2150,7 +2157,7 @@ PHP_METHOD(RedisCluster, watch) {
// Iterate over each node we'll be sending commands to
for(zend_hash_internal_pointer_reset(ht_dist);
- zend_hash_get_current_key(ht_dist,NULL,&slot, 0)==HASH_KEY_IS_LONG;
+ zend_hash_get_current_key(ht_dist, NULL, &slot) == HASH_KEY_IS_LONG;
zend_hash_move_forward(ht_dist))
{
// Grab the clusterDistList pointer itself