Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/phpredis/phpredis.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormichael-grunder <michael.grunder@gmail.com>2013-09-04 08:19:23 +0400
committermichael-grunder <michael.grunder@gmail.com>2013-09-04 08:19:23 +0400
commit59a2886d2b17881eed07e55a2c64ddf9827a9adc (patch)
treebb7d46ee51b3671a6fa4f6de1d311cde9c6ab7b8
parent19e6f315f24735a86a1deff67e99003d66df65e1 (diff)
parenta0e9b65d4ce16eb00a06ea579bf422b8f0493109 (diff)
Merge branch 'hotfix/hmget_no_valid_keys'
-rw-r--r--redis.c7
-rw-r--r--tests/TestRedis.php2
2 files changed, 9 insertions, 0 deletions
diff --git a/redis.c b/redis.c
index 38a01142..40c665c7 100644
--- a/redis.c
+++ b/redis.c
@@ -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');