diff --git a/src/pubsub.c b/src/pubsub.c index 720cd5185..d6cfbdf3c 100644 --- a/src/pubsub.c +++ b/src/pubsub.c @@ -358,7 +358,7 @@ void pubsubCommand(redisClient *c) { list *l = dictFetchValue(server.pubsub_channels,c->argv[j]); addReplyBulk(c,c->argv[j]); - addReplyBulkLongLong(c,l ? listLength(l) : 0); + addReplyLongLong(c,l ? listLength(l) : 0); } } else if (!strcasecmp(c->argv[1]->ptr,"numpat") && c->argc == 2) { /* PUBSUB NUMPAT */ diff --git a/tests/unit/pubsub.tcl b/tests/unit/pubsub.tcl index 18033bdf2..9c7a43bf0 100644 --- a/tests/unit/pubsub.tcl +++ b/tests/unit/pubsub.tcl @@ -196,6 +196,10 @@ start_server {tags {"pubsub"}} { $rd1 close } + test "NUMSUB returns numbers, not strings (#1561)" { + r pubsub numsub abc def + } {abc 0 def 0} + test "Mix SUBSCRIBE and PSUBSCRIBE" { set rd1 [redis_deferring_client] assert_equal {1} [subscribe $rd1 {foo.bar}]