diff options
-rw-r--r-- | Changelog.md | 9 | ||||
-rw-r--r-- | cluster_library.c | 8 |
2 files changed, 14 insertions, 3 deletions
diff --git a/Changelog.md b/Changelog.md index 1e907db1..d42ef257 100644 --- a/Changelog.md +++ b/Changelog.md @@ -5,6 +5,15 @@ All changes to phpredis will be documented in this file. We're basing this format on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and PhpRedis adhears to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [Unreleased] + +### Fixed + +- RedisCluster segfaults after second connection with cache_slots enabled [f52cd237](https://github.com/phpredis/phpredis/pull/1592/commits/f52cd237) + ([Pavlo Yatsukhnenko](https://github.com/yatsukhnenko)) + +--- + ## [5.0.0] - 2019-07-02 ([GitHub](https://github.com/phpredis/phpredis/releases/tag/5.0.0), [PECL](https://pecl.php.net/package/redis/5.0.0)) This release contains important improvements and breaking changes. The most diff --git a/cluster_library.c b/cluster_library.c index 564629b5..a9205cf6 100644 --- a/cluster_library.c +++ b/cluster_library.c @@ -1266,9 +1266,11 @@ PHP_REDIS_API void cluster_disconnect(redisCluster *c, int force TSRMLS_DC) { /* We also want to disconnect any slave connections so they will be pooled * in the event we are using persistent connections and connection pooling. */ - ZEND_HASH_FOREACH_PTR(node->slaves, slave) { - redis_sock_disconnect(slave->sock, force TSRMLS_CC); - } ZEND_HASH_FOREACH_END(); + if (node->slaves) { + ZEND_HASH_FOREACH_PTR(node->slaves, slave) { + redis_sock_disconnect(slave->sock, force TSRMLS_CC); + } ZEND_HASH_FOREACH_END(); + } } ZEND_HASH_FOREACH_END(); } |