Sitelet https://github.com/phpredis/phpredis/commit/327cf0bd
Skip to content

Commit 327cf0b

Browse files
committed
Issue #1591 (#1592)
1 parent a5dfff3 commit 327cf0b

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

‎cluster_library.c‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1266,9 +1266,11 @@ PHP_REDIS_API void cluster_disconnect(redisCluster *c, int force TSRMLS_DC) {
12661266

12671267
/* We also want to disconnect any slave connections so they will be pooled
12681268
* in the event we are using persistent connections and connection pooling. */
1269-
ZEND_HASH_FOREACH_PTR(node->slaves, slave) {
1270-
redis_sock_disconnect(slave->sock, force TSRMLS_CC);
1271-
} ZEND_HASH_FOREACH_END();
1269+
if (node->slaves) {
1270+
ZEND_HASH_FOREACH_PTR(node->slaves, slave) {
1271+
redis_sock_disconnect(slave->sock, force TSRMLS_CC);
1272+
} ZEND_HASH_FOREACH_END();
1273+
}
12721274
} ZEND_HASH_FOREACH_END();
12731275
}
12741276

0 commit comments

Comments
 (0)