diff options
author | michael-grunder <michael.grunder@gmail.com> | 2013-09-04 08:19:23 +0400 |
---|---|---|
committer | michael-grunder <michael.grunder@gmail.com> | 2013-09-04 08:19:23 +0400 |
commit | 59a2886d2b17881eed07e55a2c64ddf9827a9adc (patch) | |
tree | bb7d46ee51b3671a6fa4f6de1d311cde9c6ab7b8 | |
parent | 19e6f315f24735a86a1deff67e99003d66df65e1 (diff) | |
parent | a0e9b65d4ce16eb00a06ea579bf422b8f0493109 (diff) |
Merge branch 'hotfix/hmget_no_valid_keys'
-rw-r--r-- | redis.c | 7 | ||||
-rw-r--r-- | tests/TestRedis.php | 2 |
2 files changed, 9 insertions, 0 deletions
@@ -4993,6 +4993,13 @@ PHP_METHOD(Redis, hMget) { } } + // This is a failure if none of the keys were valid + if(i == 0) { + efree(cmd); + efree(z_keys); + RETURN_FALSE; + } + REDIS_PROCESS_REQUEST(redis_sock, cmd, cmd_len); IF_ATOMIC() { redis_sock_read_multibulk_reply_assoc(INTERNAL_FUNCTION_PARAM_PASSTHRU, redis_sock, NULL, z_keys); diff --git a/tests/TestRedis.php b/tests/TestRedis.php index d19f9e0b..27ff047d 100644 --- a/tests/TestRedis.php +++ b/tests/TestRedis.php @@ -2282,6 +2282,8 @@ class Redis_Test extends TestSuite $this->assertFalse(array(123 => 'x') === $this->redis->hMget('h', array(123))); $this->assertTrue(array(123 => FALSE) === $this->redis->hMget('h', array(123))); + // Test with an array populated with things we can't use as keys + $this->assertTrue($this->redis->hmget('h', Array(false,NULL,false)) === FALSE); // hmget/hmset with numeric fields $this->redis->del('h'); |