Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f2bb2cd

Browse files
yatsukhnenkomichael-grunder
authored andcommitted
Issue #2114
Redis Sentinel TLS support
1 parent c4aef95 commit f2bb2cd

4 files changed

Lines changed: 13 additions & 8 deletions

File tree

redis_sentinel.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,12 @@ PHP_METHOD(RedisSentinel, __construct)
4747
zend_long port = 26379, retry_interval = 0;
4848
redis_sentinel_object *obj;
4949
zend_string *host;
50-
zval *auth = NULL, *zv = NULL;
50+
zval *auth = NULL, *context = NULL, *zv = NULL;
5151

52-
if (zend_parse_parameters(ZEND_NUM_ARGS(), "S|ldz!ldz",
52+
if (zend_parse_parameters(ZEND_NUM_ARGS(), "S|ldz!ldza",
5353
&host, &port, &timeout, &zv,
5454
&retry_interval, &read_timeout,
55-
&auth) == FAILURE) {
55+
&auth, &context) == FAILURE) {
5656
RETURN_FALSE;
5757
}
5858

@@ -92,6 +92,9 @@ PHP_METHOD(RedisSentinel, __construct)
9292
if (auth) {
9393
redis_sock_set_auth_zval(obj->sock, auth);
9494
}
95+
if (context) {
96+
redis_sock_set_stream_context(obj->sock, context);
97+
}
9598
obj->sock->sentinel = 1;
9699
}
97100

redis_sentinel.stub.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
class RedisSentinel {
1010

11-
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);
11+
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);
1212

1313
/** @return bool|RedisSentinel */
1414
public function ckquorum(string $master);

redis_sentinel_arginfo.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
/* This is a generated file, edit the .stub.php file instead.
2-
* Stub hash: 946942bc5a7612650fc0416902778452f6860d13 */
2+
* Stub hash: 4055ace9f1cf20bef89bdb5d3219470b4c8915e6 */
33

44
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_RedisSentinel___construct, 0, 0, 1)
55
ZEND_ARG_TYPE_INFO(0, host, IS_STRING, 0)
66
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, port, IS_LONG, 0, "26379")
77
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, timeout, IS_DOUBLE, 0, "0")
8-
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, persistent, IS_MIXED, 0, "NULL")
8+
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, persistent, IS_MIXED, 0, "null")
99
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, retry_interval, IS_LONG, 0, "0")
1010
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, read_timeout, IS_DOUBLE, 0, "0")
11-
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, auth, IS_MIXED, 0, "NULL")
11+
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, auth, IS_MIXED, 0, "null")
12+
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, context, IS_ARRAY, 0, "null")
1213
ZEND_END_ARG_INFO()
1314

1415
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_RedisSentinel_ckquorum, 0, 0, 1)

redis_sentinel_legacy_arginfo.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* This is a generated file, edit the .stub.php file instead.
2-
* Stub hash: 946942bc5a7612650fc0416902778452f6860d13 */
2+
* Stub hash: 4055ace9f1cf20bef89bdb5d3219470b4c8915e6 */
33

44
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_RedisSentinel___construct, 0, 0, 1)
55
ZEND_ARG_INFO(0, host)
@@ -9,6 +9,7 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_RedisSentinel___construct, 0, 0, 1)
99
ZEND_ARG_INFO(0, retry_interval)
1010
ZEND_ARG_INFO(0, read_timeout)
1111
ZEND_ARG_INFO(0, auth)
12+
ZEND_ARG_INFO(0, context)
1213
ZEND_END_ARG_INFO()
1314

1415
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_RedisSentinel_ckquorum, 0, 0, 1)

0 commit comments

Comments
 (0)