Skip to content

Commit d22e7f5

Browse files
Unbreak php7 fix for php <= 7.0
1 parent 3410796 commit d22e7f5

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

cluster_library.h

+6
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,10 @@ typedef struct clusterFoldItem clusterFoldItem;
173173

174174
/* RedisCluster implementation structure */
175175
typedef struct redisCluster {
176+
#if (PHP_MAJOR_VERSION < 7)
177+
zend_object std;
178+
#endif
179+
176180
/* Timeout and read timeout (for normal operations) */
177181
double timeout;
178182
double read_timeout;
@@ -242,8 +246,10 @@ typedef struct redisCluster {
242246
unsigned short redir_slot;
243247
unsigned short redir_port;
244248

249+
#if (PHP_MAJOR_VERSION >= 7)
245250
/* Zend object handler */
246251
zend_object std;
252+
#endif
247253
} redisCluster;
248254

249255
/* RedisCluster response processing callback */

redis_cluster.c

+4
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,11 @@ create_cluster_context(zend_class_entry *class_type TSRMLS_DC) {
342342

343343
/* Helper to retrieve the redisCluster object from the zend_object member */
344344
static redisCluster *getClusterObject(zend_object *object) {
345+
#if (PHP_MAJOR_VERSION < 7)
346+
return (redisCluster*)object;
347+
#else
345348
return (redisCluster*)((char*)(object) - XtOffsetOf(redisCluster, std));
349+
#endif
346350
}
347351

348352
/* Free redisCluster context */

0 commit comments

Comments
 (0)