Skip to content

Commit

Permalink
Don't call Redis::__constructor while initilizing RedisArray (#1777)
Browse files Browse the repository at this point in the history
  • Loading branch information
yatsukhnenko committed Jun 2, 2020
1 parent 5bf8812 commit e41e19a
Showing 1 changed file with 1 addition and 11 deletions.
12 changes: 1 addition & 11 deletions redis_array_impl.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,12 @@ ra_load_hosts(RedisArray *ra, HashTable *hosts, zend_string *auth, long retry_in
int i = 0, host_len;
char *host, *p;
short port;
zval *zpData, z_cons, z_ret;
zval *zpData;
redis_object *redis;

/* function calls on the Redis object */
ZVAL_STRINGL(&z_cons, "__construct", 11);

/* init connections */
ZEND_HASH_FOREACH_VAL(hosts, zpData) {
if (Z_TYPE_P(zpData) != IS_STRING) {
zval_dtor(&z_cons);
return NULL;
}

Expand All @@ -64,9 +60,6 @@ ra_load_hosts(RedisArray *ra, HashTable *hosts, zend_string *auth, long retry_in

/* create Redis object */
object_init_ex(&ra->redis[i], redis_ce);
call_user_function(&redis_ce->function_table, &ra->redis[i], &z_cons, &z_ret, 0, NULL);
zval_dtor(&z_ret);

redis = PHPREDIS_ZVAL_GET_OBJECT(redis_object, &ra->redis[i]);

/* create socket */
Expand All @@ -79,7 +72,6 @@ ra_load_hosts(RedisArray *ra, HashTable *hosts, zend_string *auth, long retry_in
{
/* connect */
if (redis_sock_server_open(redis->sock) < 0) {
zval_dtor(&z_cons);
ra->count = ++i;
return NULL;
}
Expand All @@ -88,8 +80,6 @@ ra_load_hosts(RedisArray *ra, HashTable *hosts, zend_string *auth, long retry_in
ra->count = ++i;
} ZEND_HASH_FOREACH_END();

zval_dtor(&z_cons);

return ra;
}

Expand Down

0 comments on commit e41e19a

Please sign in to comment.