Skip to content

Commit

Permalink
Merge pull request #1965 from phpredis/issue-1894-client-info
Browse files Browse the repository at this point in the history
[WIP] Issue #1894
  • Loading branch information
yatsukhnenko committed Apr 27, 2021
2 parents 37a9025 + 3c40582 commit a95384f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
6 changes: 6 additions & 0 deletions redis.c
Expand Up @@ -3489,6 +3489,7 @@ PHP_METHOD(Redis, getAuth) {

/*
* $redis->client('list');
* $redis->client('info');
* $redis->client('kill', <ip:port>);
* $redis->client('setname', <name>);
* $redis->client('getname');
Expand Down Expand Up @@ -3529,6 +3530,11 @@ PHP_METHOD(Redis, client) {
redis_client_list_reply(INTERNAL_FUNCTION_PARAM_PASSTHRU,redis_sock, NULL, NULL);
}
REDIS_PROCESS_RESPONSE(redis_client_list_reply);
} else if (!strncasecmp(opt, "info", 4)) {
if (IS_ATOMIC(redis_sock)) {
redis_string_response(INTERNAL_FUNCTION_PARAM_PASSTHRU, redis_sock, NULL, NULL);
}
REDIS_PROCESS_RESPONSE(redis_string_response);
} else {
if (IS_ATOMIC(redis_sock)) {
redis_read_variant_reply(INTERNAL_FUNCTION_PARAM_PASSTHRU,
Expand Down
5 changes: 5 additions & 0 deletions tests/RedisTest.php
Expand Up @@ -1971,8 +1971,13 @@ public function testClient() {
/* CLIENT GETNAME */
$this->assertTrue($this->redis->client('getname'), 'phpredis_unit_tests');

if (version_compare($this->version, "6.2.0") >= 0) {
$this->assertFalse(empty($this->redis->client('info')));
}

/* CLIENT KILL -- phpredis will reconnect, so we can do this */
$this->assertTrue($this->redis->client('kill', $str_addr));

}

public function testSlowlog() {
Expand Down

0 comments on commit a95384f

Please sign in to comment.