diff options
author | Pavlo Yatsukhnenko <yatsukhnenko@gmail.com> | 2022-08-07 17:08:15 +0300 |
---|---|---|
committer | Michael Grunder <michael.grunder@gmail.com> | 2022-10-30 21:46:43 +0300 |
commit | f2bb2cdb5a8cc770d22b6d516e230d2cf544929b (patch) | |
tree | ae8bb029bc5f2deb468e40fd7950819a85954ea4 | |
parent | c4aef9567684e22fe5d72ecb43965140506c3953 (diff) |
Issue #2114
Redis Sentinel TLS support
-rw-r--r-- | redis_sentinel.c | 9 | ||||
-rw-r--r-- | redis_sentinel.stub.php | 2 | ||||
-rw-r--r-- | redis_sentinel_arginfo.h | 7 | ||||
-rw-r--r-- | redis_sentinel_legacy_arginfo.h | 3 |
4 files changed, 13 insertions, 8 deletions
diff --git a/redis_sentinel.c b/redis_sentinel.c index 55851f10..2d506bd2 100644 --- a/redis_sentinel.c +++ b/redis_sentinel.c @@ -47,12 +47,12 @@ PHP_METHOD(RedisSentinel, __construct) zend_long port = 26379, retry_interval = 0; redis_sentinel_object *obj; zend_string *host; - zval *auth = NULL, *zv = NULL; + zval *auth = NULL, *context = NULL, *zv = NULL; - if (zend_parse_parameters(ZEND_NUM_ARGS(), "S|ldz!ldz", + if (zend_parse_parameters(ZEND_NUM_ARGS(), "S|ldz!ldza", &host, &port, &timeout, &zv, &retry_interval, &read_timeout, - &auth) == FAILURE) { + &auth, &context) == FAILURE) { RETURN_FALSE; } @@ -92,6 +92,9 @@ PHP_METHOD(RedisSentinel, __construct) if (auth) { redis_sock_set_auth_zval(obj->sock, auth); } + if (context) { + redis_sock_set_stream_context(obj->sock, context); + } obj->sock->sentinel = 1; } diff --git a/redis_sentinel.stub.php b/redis_sentinel.stub.php index c3fc5a9e..304cd414 100644 --- a/redis_sentinel.stub.php +++ b/redis_sentinel.stub.php @@ -8,7 +8,7 @@ class RedisSentinel { - public function __construct(string $host, int $port = 26379, float $timeout = 0, mixed $persistent = NULL, int $retry_interval = 0, float $read_timeout = 0, #[\SensitiveParameter] mixed $auth = NULL); + public function __construct(string $host, int $port = 26379, float $timeout = 0, mixed $persistent = null, int $retry_interval = 0, float $read_timeout = 0, #[\SensitiveParameter] mixed $auth = null, array $context = null); /** @return bool|RedisSentinel */ public function ckquorum(string $master); diff --git a/redis_sentinel_arginfo.h b/redis_sentinel_arginfo.h index 58a5bc4c..7059560d 100644 --- a/redis_sentinel_arginfo.h +++ b/redis_sentinel_arginfo.h @@ -1,14 +1,15 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 946942bc5a7612650fc0416902778452f6860d13 */ + * Stub hash: 4055ace9f1cf20bef89bdb5d3219470b4c8915e6 */ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_RedisSentinel___construct, 0, 0, 1) ZEND_ARG_TYPE_INFO(0, host, IS_STRING, 0) ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, port, IS_LONG, 0, "26379") ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, timeout, IS_DOUBLE, 0, "0") - ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, persistent, IS_MIXED, 0, "NULL") + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, persistent, IS_MIXED, 0, "null") ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, retry_interval, IS_LONG, 0, "0") ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, read_timeout, IS_DOUBLE, 0, "0") - ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, auth, IS_MIXED, 0, "NULL") + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, auth, IS_MIXED, 0, "null") + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, context, IS_ARRAY, 0, "null") ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(arginfo_class_RedisSentinel_ckquorum, 0, 0, 1) diff --git a/redis_sentinel_legacy_arginfo.h b/redis_sentinel_legacy_arginfo.h index 30b58dff..16af15b6 100644 --- a/redis_sentinel_legacy_arginfo.h +++ b/redis_sentinel_legacy_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 946942bc5a7612650fc0416902778452f6860d13 */ + * Stub hash: 4055ace9f1cf20bef89bdb5d3219470b4c8915e6 */ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_RedisSentinel___construct, 0, 0, 1) ZEND_ARG_INFO(0, host) @@ -9,6 +9,7 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_RedisSentinel___construct, 0, 0, 1) ZEND_ARG_INFO(0, retry_interval) ZEND_ARG_INFO(0, read_timeout) ZEND_ARG_INFO(0, auth) + ZEND_ARG_INFO(0, context) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(arginfo_class_RedisSentinel_ckquorum, 0, 0, 1) |