Skip to content

Commit 80f2529

Browse files
yatsukhnenkomichael-grunder
authored andcommitted
Authenticate in redis_sock_server_open
1 parent 650ac05 commit 80f2529

9 files changed

+53
-60
lines changed

cluster_library.c

+1-12
Original file line numberDiff line numberDiff line change
@@ -260,17 +260,6 @@ cluster_read_sock_resp(RedisSock *redis_sock, REDIS_REPLY_TYPE type,
260260
return r;
261261
}
262262

263-
/* Helper to open connection and send AUTH if necessary */
264-
static zend_always_inline int
265-
cluster_sock_open(RedisSock *redis_sock)
266-
{
267-
zend_bool need_auth = (redis_sock->auth && redis_sock->status != REDIS_SOCK_STATUS_CONNECTED);
268-
if (!redis_sock_server_open(redis_sock) && (!need_auth || !redis_sock_auth(redis_sock ))) {
269-
return SUCCESS;
270-
}
271-
return FAILURE;
272-
}
273-
274263
/*
275264
* Helpers to send various 'control type commands to a specific node, e.g.
276265
* MULTI, ASKING, READONLY, READWRITE, etc
@@ -1138,7 +1127,7 @@ PHP_REDIS_API int cluster_map_keyspace(redisCluster *c) {
11381127
// Iterate over seeds until we can get slots
11391128
ZEND_HASH_FOREACH_PTR(c->seeds, seed) {
11401129
// Attempt to connect to this seed node
1141-
if (seed == NULL || cluster_sock_open(seed) != 0) {
1130+
if (seed == NULL || redis_sock_server_open(seed) != SUCCESS) {
11421131
continue;
11431132
}
11441133

cluster_library.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262

6363
/* Protected sending of data down the wire to a RedisSock->stream */
6464
#define CLUSTER_SEND_PAYLOAD(sock, buf, len) \
65-
(sock && !cluster_sock_open(sock) && sock->stream && !redis_check_eof(sock, 1 ) && \
65+
(sock && !redis_sock_server_open(sock) && sock->stream && !redis_check_eof(sock, 1 ) && \
6666
php_stream_write(sock->stream, buf, len)==len)
6767

6868
/* Macro to read our reply type character */

common.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@
2323
typedef enum {
2424
REDIS_SOCK_STATUS_FAILED = -1,
2525
REDIS_SOCK_STATUS_DISCONNECTED,
26-
REDIS_SOCK_STATUS_CONNECTED
26+
REDIS_SOCK_STATUS_CONNECTED,
27+
REDIS_SOCK_STATUS_READY
2728
} redis_sock_status;
2829

2930
#define _NL "\r\n"

library.c

+17-5
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,7 @@ redis_check_eof(RedisSock *redis_sock, int no_throw)
234234
errmsg = "AUTH failed while reconnecting";
235235
break;
236236
}
237+
redis_sock->status = REDIS_SOCK_STATUS_READY;
237238
/* If we're using a non-zero db, reselect it */
238239
if (redis_sock->dbNumber && reselect_db(redis_sock) != 0) {
239240
errmsg = "SELECT failed while reconnecting";
@@ -1890,7 +1891,7 @@ PHP_REDIS_API int redis_sock_connect(RedisSock *redis_sock)
18901891
zend_llist_remove_tail(&p->list);
18911892

18921893
if (redis_sock_check_liveness(redis_sock) == SUCCESS) {
1893-
redis_sock->status = REDIS_SOCK_STATUS_CONNECTED;
1894+
redis_sock->status = REDIS_SOCK_STATUS_READY;
18941895
return SUCCESS;
18951896
} else if (redis_sock->stream) {
18961897
php_stream_pclose(redis_sock->stream);
@@ -1974,12 +1975,23 @@ redis_sock_server_open(RedisSock *redis_sock)
19741975
{
19751976
if (redis_sock) {
19761977
switch (redis_sock->status) {
1977-
case REDIS_SOCK_STATUS_FAILED:
1978-
return FAILURE;
19791978
case REDIS_SOCK_STATUS_DISCONNECTED:
1980-
return redis_sock_connect(redis_sock);
1981-
default:
1979+
if (redis_sock_connect(redis_sock) != SUCCESS) {
1980+
break;
1981+
} else if (redis_sock->status == REDIS_SOCK_STATUS_READY) {
1982+
return SUCCESS;
1983+
}
1984+
// fall through
1985+
case REDIS_SOCK_STATUS_CONNECTED:
1986+
if (redis_sock->auth && redis_sock_auth(redis_sock) != SUCCESS) {
1987+
break;
1988+
}
1989+
redis_sock->status = REDIS_SOCK_STATUS_READY;
1990+
// fall through
1991+
case REDIS_SOCK_STATUS_READY:
19821992
return SUCCESS;
1993+
default:
1994+
return FAILURE;
19831995
}
19841996
}
19851997
return FAILURE;

redis.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -654,7 +654,7 @@ PHP_REDIS_API RedisSock *redis_sock_get_connected(INTERNAL_FUNCTION_PARAMETERS)
654654
if((zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "O",
655655
&object, redis_ce) == FAILURE) ||
656656
(redis_sock = redis_sock_get(object, 1)) == NULL ||
657-
redis_sock->status != REDIS_SOCK_STATUS_CONNECTED)
657+
redis_sock->status < REDIS_SOCK_STATUS_CONNECTED)
658658
{
659659
return NULL;
660660
}

redis_array.c

+7-7
Original file line numberDiff line numberDiff line change
@@ -417,7 +417,7 @@ ra_forward_call(INTERNAL_FUNCTION_PARAMETERS, RedisArray *ra, const char *cmd, i
417417

418418
/* multi/exec */
419419
if(ra->z_multi_exec) {
420-
ra_call_user_function(&redis_ce->function_table, ra->z_multi_exec, &z_fun, return_value, argc, z_callargs);
420+
call_user_function(&redis_ce->function_table, ra->z_multi_exec, &z_fun, return_value, argc, z_callargs);
421421
zval_dtor(return_value);
422422
zval_dtor(&z_fun);
423423
for (i = 0; i < argc; ++i) {
@@ -435,7 +435,7 @@ ra_forward_call(INTERNAL_FUNCTION_PARAMETERS, RedisArray *ra, const char *cmd, i
435435
/* add MULTI + SADD */
436436
ra_index_multi(redis_inst, MULTI);
437437
/* call using discarded temp value and extract exec results after. */
438-
ra_call_user_function(&redis_ce->function_table, redis_inst, &z_fun, return_value, argc, z_callargs);
438+
call_user_function(&redis_ce->function_table, redis_inst, &z_fun, return_value, argc, z_callargs);
439439
zval_dtor(return_value);
440440

441441
/* add keys to index. */
@@ -444,7 +444,7 @@ ra_forward_call(INTERNAL_FUNCTION_PARAMETERS, RedisArray *ra, const char *cmd, i
444444
/* call EXEC */
445445
ra_index_exec(redis_inst, return_value, 0);
446446
} else { /* call directly through. */
447-
ra_call_user_function(&redis_ce->function_table, redis_inst, &z_fun, return_value, argc, z_callargs);
447+
call_user_function(&redis_ce->function_table, redis_inst, &z_fun, return_value, argc, z_callargs);
448448

449449
if (!b_write_cmd) {
450450
/* check if we have an error. */
@@ -662,7 +662,7 @@ multihost_distribute_call(RedisArray *ra, zval *return_value, zval *z_fun, int a
662662
/* Iterate our RedisArray nodes */
663663
for (i = 0; i < ra->count; ++i) {
664664
/* Call each node in turn */
665-
ra_call_user_function(&redis_array_ce->function_table, &ra->redis[i], z_fun, &z_tmp, argc, argv);
665+
call_user_function(&redis_array_ce->function_table, &ra->redis[i], z_fun, &z_tmp, argc, argv);
666666

667667
/* Add the result for this host */
668668
add_assoc_zval_ex(return_value, ZSTR_VAL(ra->hosts[i]), ZSTR_LEN(ra->hosts[i]), &z_tmp);
@@ -975,7 +975,7 @@ PHP_METHOD(RedisArray, mget)
975975
/* prepare call */
976976
ZVAL_STRINGL(&z_fun, "MGET", 4);
977977
/* call MGET on the node */
978-
ra_call_user_function(&redis_ce->function_table, &ra->redis[n], &z_fun, &z_ret, 1, &z_argarray);
978+
call_user_function(&redis_ce->function_table, &ra->redis[n], &z_fun, &z_ret, 1, &z_argarray);
979979
zval_dtor(&z_fun);
980980

981981
/* cleanup args array */
@@ -1119,7 +1119,7 @@ PHP_METHOD(RedisArray, mset)
11191119
ZVAL_STRINGL(&z_fun, "MSET", 4);
11201120

11211121
/* call */
1122-
ra_call_user_function(&redis_ce->function_table, &ra->redis[n], &z_fun, &z_ret, 1, &z_argarray);
1122+
call_user_function(&redis_ce->function_table, &ra->redis[n], &z_fun, &z_ret, 1, &z_argarray);
11231123
zval_dtor(&z_fun);
11241124
zval_dtor(&z_ret);
11251125

@@ -1251,7 +1251,7 @@ static void ra_generic_del(INTERNAL_FUNCTION_PARAMETERS, char *kw, int kw_len) {
12511251
}
12521252

12531253
/* call */
1254-
ra_call_user_function(&redis_ce->function_table, &ra->redis[n], &z_fun, &z_ret, 1, &z_argarray);
1254+
call_user_function(&redis_ce->function_table, &ra->redis[n], &z_fun, &z_ret, 1, &z_argarray);
12551255

12561256
if(ra->index) {
12571257
zval_dtor(&z_ret);

redis_array.h

-2
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,4 @@ typedef struct RedisArray_ {
6969
zend_object *create_redis_array_object(zend_class_entry *ce);
7070
void free_redis_array_object(zend_object *object);
7171

72-
PHP_REDIS_API int ra_call_user_function(HashTable *function_table, zval *object, zval *function_name, zval *retval_ptr, uint32_t param_count, zval params[]);
73-
7472
#endif

redis_array_impl.c

+24-24
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ ra_load_hosts(RedisArray *ra, HashTable *hosts, zend_string *auth, long retry_in
7878
if (!b_lazy_connect)
7979
{
8080
/* connect */
81-
if (redis_sock_server_open(redis->sock) < 0 || (auth && redis_sock_auth(redis->sock ) < 0)) {
81+
if (redis_sock_server_open(redis->sock) < 0) {
8282
zval_dtor(&z_cons);
8383
ra->count = ++i;
8484
return NULL;
@@ -484,7 +484,7 @@ ra_call_extractor(RedisArray *ra, const char *key, int key_len)
484484
ZVAL_NULL(&z_ret);
485485
/* call extraction function */
486486
ZVAL_STRINGL(&z_argv, key, key_len);
487-
ra_call_user_function(EG(function_table), NULL, &ra->z_fun, &z_ret, 1, &z_argv);
487+
call_user_function(EG(function_table), NULL, &ra->z_fun, &z_ret, 1, &z_argv);
488488

489489
if (Z_TYPE(z_ret) == IS_STRING) {
490490
out = zval_get_string(&z_ret);
@@ -525,7 +525,7 @@ ra_call_distributor(RedisArray *ra, const char *key, int key_len)
525525
ZVAL_NULL(&z_ret);
526526
/* call extraction function */
527527
ZVAL_STRINGL(&z_argv, key, key_len);
528-
ra_call_user_function(EG(function_table), NULL, &ra->z_dist, &z_ret, 1, &z_argv);
528+
call_user_function(EG(function_table), NULL, &ra->z_dist, &z_ret, 1, &z_argv);
529529

530530
ret = (Z_TYPE(z_ret) == IS_LONG) ? Z_LVAL(z_ret) : -1;
531531

@@ -623,7 +623,7 @@ ra_index_multi(zval *z_redis, long multi_value) {
623623
/* run MULTI */
624624
ZVAL_STRINGL(&z_fun_multi, "MULTI", 5);
625625
ZVAL_LONG(&z_args[0], multi_value);
626-
ra_call_user_function(&redis_ce->function_table, z_redis, &z_fun_multi, &z_ret, 1, z_args);
626+
call_user_function(&redis_ce->function_table, z_redis, &z_fun_multi, &z_ret, 1, z_args);
627627
zval_dtor(&z_fun_multi);
628628
zval_dtor(&z_ret);
629629
}
@@ -653,7 +653,7 @@ ra_index_change_keys(const char *cmd, zval *z_keys, zval *z_redis) {
653653
}
654654

655655
/* run cmd */
656-
ra_call_user_function(&redis_ce->function_table, z_redis, &z_fun, &z_ret, argc, z_args);
656+
call_user_function(&redis_ce->function_table, z_redis, &z_fun, &z_ret, argc, z_args);
657657

658658
zval_dtor(&z_args[0]);
659659
zval_dtor(&z_fun);
@@ -709,7 +709,7 @@ ra_index_key(const char *key, int key_len, zval *z_redis) {
709709
ZVAL_STRINGL(&z_args[1], key, key_len);
710710

711711
/* run SADD */
712-
ra_call_user_function(&redis_ce->function_table, z_redis, &z_fun_sadd, &z_ret, 2, z_args);
712+
call_user_function(&redis_ce->function_table, z_redis, &z_fun_sadd, &z_ret, 2, z_args);
713713
zval_dtor(&z_fun_sadd);
714714
zval_dtor(&z_args[1]);
715715
zval_dtor(&z_args[0]);
@@ -723,7 +723,7 @@ ra_index_exec(zval *z_redis, zval *return_value, int keep_all) {
723723

724724
/* run EXEC */
725725
ZVAL_STRINGL(&z_fun_exec, "EXEC", 4);
726-
ra_call_user_function(&redis_ce->function_table, z_redis, &z_fun_exec, &z_ret, 0, NULL);
726+
call_user_function(&redis_ce->function_table, z_redis, &z_fun_exec, &z_ret, 0, NULL);
727727
zval_dtor(&z_fun_exec);
728728

729729
/* extract first element of exec array and put into return_value. */
@@ -750,7 +750,7 @@ ra_index_discard(zval *z_redis, zval *return_value) {
750750

751751
/* run DISCARD */
752752
ZVAL_STRINGL(&z_fun_discard, "DISCARD", 7);
753-
ra_call_user_function(&redis_ce->function_table, z_redis, &z_fun_discard, &z_ret, 0, NULL);
753+
call_user_function(&redis_ce->function_table, z_redis, &z_fun_discard, &z_ret, 0, NULL);
754754

755755
zval_dtor(&z_fun_discard);
756756
zval_dtor(&z_ret);
@@ -763,7 +763,7 @@ ra_index_unwatch(zval *z_redis, zval *return_value) {
763763

764764
/* run UNWATCH */
765765
ZVAL_STRINGL(&z_fun_unwatch, "UNWATCH", 7);
766-
ra_call_user_function(&redis_ce->function_table, z_redis, &z_fun_unwatch, &z_ret, 0, NULL);
766+
call_user_function(&redis_ce->function_table, z_redis, &z_fun_unwatch, &z_ret, 0, NULL);
767767

768768
zval_dtor(&z_fun_unwatch);
769769
zval_dtor(&z_ret);
@@ -803,14 +803,14 @@ ra_get_key_type(zval *z_redis, const char *key, int key_len, zval *z_from, long
803803
/* run TYPE */
804804
ZVAL_NULL(&z_ret);
805805
ZVAL_STRINGL(&z_fun, "TYPE", 4);
806-
ra_call_user_function(&redis_ce->function_table, z_redis, &z_fun, &z_ret, 1, &z_arg);
806+
call_user_function(&redis_ce->function_table, z_redis, &z_fun, &z_ret, 1, &z_arg);
807807
zval_dtor(&z_fun);
808808
zval_dtor(&z_ret);
809809

810810
/* run TYPE */
811811
ZVAL_NULL(&z_ret);
812812
ZVAL_STRINGL(&z_fun, "TTL", 3);
813-
ra_call_user_function(&redis_ce->function_table, z_redis, &z_fun, &z_ret, 1, &z_arg);
813+
call_user_function(&redis_ce->function_table, z_redis, &z_fun, &z_ret, 1, &z_arg);
814814
zval_dtor(&z_fun);
815815
zval_dtor(&z_ret);
816816

@@ -842,7 +842,7 @@ ra_remove_from_index(zval *z_redis, const char *key, int key_len) {
842842
ZVAL_STRINGL(&z_args[0], PHPREDIS_INDEX_NAME, sizeof(PHPREDIS_INDEX_NAME) - 1);
843843
ZVAL_STRINGL(&z_args[1], key, key_len);
844844

845-
ra_call_user_function(&redis_ce->function_table, z_redis, &z_fun_srem, &z_ret, 2, z_args);
845+
call_user_function(&redis_ce->function_table, z_redis, &z_fun_srem, &z_ret, 2, z_args);
846846

847847
/* cleanup */
848848
zval_dtor(&z_fun_srem);
@@ -864,7 +864,7 @@ ra_del_key(const char *key, int key_len, zval *z_from) {
864864
/* run DEL on source */
865865
ZVAL_STRINGL(&z_fun_del, "DEL", 3);
866866
ZVAL_STRINGL(&z_args[0], key, key_len);
867-
ra_call_user_function(&redis_ce->function_table, z_from, &z_fun_del, &z_ret, 1, z_args);
867+
call_user_function(&redis_ce->function_table, z_from, &z_fun_del, &z_ret, 1, z_args);
868868
zval_dtor(&z_fun_del);
869869
zval_dtor(&z_args[0]);
870870
zval_dtor(&z_ret);
@@ -889,7 +889,7 @@ ra_expire_key(const char *key, int key_len, zval *z_to, long ttl) {
889889
ZVAL_STRINGL(&z_fun_expire, "EXPIRE", 6);
890890
ZVAL_STRINGL(&z_args[0], key, key_len);
891891
ZVAL_LONG(&z_args[1], ttl);
892-
ra_call_user_function(&redis_ce->function_table, z_to, &z_fun_expire, &z_ret, 2, z_args);
892+
call_user_function(&redis_ce->function_table, z_to, &z_fun_expire, &z_ret, 2, z_args);
893893
zval_dtor(&z_fun_expire);
894894
zval_dtor(&z_args[0]);
895895
zval_dtor(&z_ret);
@@ -913,7 +913,7 @@ ra_move_zset(const char *key, int key_len, zval *z_from, zval *z_to, long ttl) {
913913
ZVAL_STRINGL(&z_args[1], "0", 1);
914914
ZVAL_STRINGL(&z_args[2], "-1", 2);
915915
ZVAL_BOOL(&z_args[3], 1);
916-
ra_call_user_function(&redis_ce->function_table, z_from, &z_fun_zrange, &z_ret, 4, z_args);
916+
call_user_function(&redis_ce->function_table, z_from, &z_fun_zrange, &z_ret, 4, z_args);
917917
zval_dtor(&z_fun_zrange);
918918
zval_dtor(&z_args[2]);
919919
zval_dtor(&z_args[1]);
@@ -951,7 +951,7 @@ ra_move_zset(const char *key, int key_len, zval *z_from, zval *z_to, long ttl) {
951951

952952
/* run ZADD on target */
953953
ZVAL_STRINGL(&z_fun_zadd, "ZADD", 4);
954-
ra_call_user_function(&redis_ce->function_table, z_to, &z_fun_zadd, &z_ret_dest, 1 + 2 * count, z_zadd_args);
954+
call_user_function(&redis_ce->function_table, z_to, &z_fun_zadd, &z_ret_dest, 1 + 2 * count, z_zadd_args);
955955

956956
/* Expire if needed */
957957
ra_expire_key(key, key_len, z_to, ttl);
@@ -978,7 +978,7 @@ ra_move_string(const char *key, int key_len, zval *z_from, zval *z_to, long ttl)
978978
/* run GET on source */
979979
ZVAL_STRINGL(&z_fun_get, "GET", 3);
980980
ZVAL_STRINGL(&z_args[0], key, key_len);
981-
ra_call_user_function(&redis_ce->function_table, z_from, &z_fun_get, &z_ret, 1, z_args);
981+
call_user_function(&redis_ce->function_table, z_from, &z_fun_get, &z_ret, 1, z_args);
982982
zval_dtor(&z_fun_get);
983983

984984
if(Z_TYPE(z_ret) != IS_STRING) { /* key not found or replaced */
@@ -994,14 +994,14 @@ ra_move_string(const char *key, int key_len, zval *z_from, zval *z_to, long ttl)
994994
ZVAL_LONG(&z_args[1], ttl);
995995
ZVAL_STRINGL(&z_args[2], Z_STRVAL(z_ret), Z_STRLEN(z_ret)); /* copy z_ret to arg 1 */
996996
zval_dtor(&z_ret); /* free memory from our previous call */
997-
ra_call_user_function(&redis_ce->function_table, z_to, &z_fun_set, &z_ret, 3, z_args);
997+
call_user_function(&redis_ce->function_table, z_to, &z_fun_set, &z_ret, 3, z_args);
998998
/* cleanup */
999999
zval_dtor(&z_args[2]);
10001000
} else {
10011001
ZVAL_STRINGL(&z_fun_set, "SET", 3);
10021002
ZVAL_STRINGL(&z_args[1], Z_STRVAL(z_ret), Z_STRLEN(z_ret)); /* copy z_ret to arg 1 */
10031003
zval_dtor(&z_ret); /* free memory from our previous return value */
1004-
ra_call_user_function(&redis_ce->function_table, z_to, &z_fun_set, &z_ret, 2, z_args);
1004+
call_user_function(&redis_ce->function_table, z_to, &z_fun_set, &z_ret, 2, z_args);
10051005
/* cleanup */
10061006
zval_dtor(&z_args[1]);
10071007
}
@@ -1019,7 +1019,7 @@ ra_move_hash(const char *key, int key_len, zval *z_from, zval *z_to, long ttl) {
10191019
/* run HGETALL on source */
10201020
ZVAL_STRINGL(&z_args[0], key, key_len);
10211021
ZVAL_STRINGL(&z_fun_hgetall, "HGETALL", 7);
1022-
ra_call_user_function(&redis_ce->function_table, z_from, &z_fun_hgetall, &z_args[1], 1, z_args);
1022+
call_user_function(&redis_ce->function_table, z_from, &z_fun_hgetall, &z_args[1], 1, z_args);
10231023
zval_dtor(&z_fun_hgetall);
10241024

10251025
if (Z_TYPE(z_args[1]) != IS_ARRAY) { /* key not found or replaced */
@@ -1031,7 +1031,7 @@ ra_move_hash(const char *key, int key_len, zval *z_from, zval *z_to, long ttl) {
10311031

10321032
/* run HMSET on target */
10331033
ZVAL_STRINGL(&z_fun_hmset, "HMSET", 5);
1034-
ra_call_user_function(&redis_ce->function_table, z_to, &z_fun_hmset, &z_ret_dest, 2, z_args);
1034+
call_user_function(&redis_ce->function_table, z_to, &z_fun_hmset, &z_ret_dest, 2, z_args);
10351035
zval_dtor(&z_fun_hmset);
10361036
zval_dtor(&z_ret_dest);
10371037

@@ -1066,7 +1066,7 @@ ra_move_collection(const char *key, int key_len, zval *z_from, zval *z_to,
10661066
ZVAL_STRING(&z_retrieve_args[i], cmd_list[i]);
10671067
}
10681068

1069-
ra_call_user_function(&redis_ce->function_table, z_from, &z_fun_retrieve, &z_ret, list_count, z_retrieve_args);
1069+
call_user_function(&redis_ce->function_table, z_from, &z_fun_retrieve, &z_ret, list_count, z_retrieve_args);
10701070

10711071
/* cleanup */
10721072
zval_dtor(&z_fun_retrieve);
@@ -1098,7 +1098,7 @@ ra_move_collection(const char *key, int key_len, zval *z_from, zval *z_to,
10981098
/* Clean up our input return value */
10991099
zval_dtor(&z_ret);
11001100

1101-
ra_call_user_function(&redis_ce->function_table, z_to, &z_fun_sadd, &z_ret, count, z_sadd_args);
1101+
call_user_function(&redis_ce->function_table, z_to, &z_fun_sadd, &z_ret, count, z_sadd_args);
11021102

11031103
/* cleanup */
11041104
zval_dtor(&z_fun_sadd);
@@ -1223,7 +1223,7 @@ ra_rehash_server(RedisArray *ra, zval *z_redis, zend_string *hostname, zend_bool
12231223
ZVAL_STRING(&z_argv, "*");
12241224
}
12251225
ZVAL_NULL(&z_ret);
1226-
ra_call_user_function(&redis_ce->function_table, z_redis, &z_fun, &z_ret, 1, &z_argv);
1226+
call_user_function(&redis_ce->function_table, z_redis, &z_fun, &z_ret, 1, &z_argv);
12271227
zval_dtor(&z_argv);
12281228
zval_dtor(&z_fun);
12291229

redis_session.c

-7
Original file line numberDiff line numberDiff line change
@@ -173,14 +173,7 @@ redis_pool_get_sock(redis_pool *pool, const char *key) {
173173

174174
for(i = 0; i < pool->totalWeight;) {
175175
if (pos >= i && pos < i + rpm->weight) {
176-
int needs_auth = 0;
177-
if (rpm->redis_sock->auth && rpm->redis_sock->status != REDIS_SOCK_STATUS_CONNECTED) {
178-
needs_auth = 1;
179-
}
180176
if (redis_sock_server_open(rpm->redis_sock) == 0) {
181-
if (needs_auth) {
182-
redis_sock_auth(rpm->redis_sock);
183-
}
184177
if (rpm->database >= 0) { /* default is -1 which leaves the choice to redis. */
185178
redis_pool_member_select(rpm);
186179
}

0 commit comments

Comments
 (0)