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-11-18 23:42:14 +0400
committermichael-grunder <michael.grunder@gmail.com>2013-11-18 23:42:14 +0400
commit49dce3b3729cb1f9e1ccf942c39d2dabaaf3d76d (patch)
tree42e6dfbdc5568c2cbe0176bfff51f6324eb2f8bb
parent504724b4167d744719f2b2c6b5fdb095f283ca26 (diff)
parent32837e06e92bd31c0866ee680aff78aa38c7145d (diff)
Merge branch 'hotfix/allow_null_set_options'allow_null_set_options
-rw-r--r--redis.c4
-rw-r--r--tests/TestRedis.php6
2 files changed, 9 insertions, 1 deletions
diff --git a/redis.c b/redis.c
index ec400b6a..c2a3d87c 100644
--- a/redis.c
+++ b/redis.c
@@ -836,7 +836,9 @@ PHP_METHOD(Redis, set) {
/* Our optional argument can either be a long (to support legacy SETEX */
/* redirection), or an array with Redis >= 2.6.12 set options */
- if(z_opts && Z_TYPE_P(z_opts) != IS_LONG && Z_TYPE_P(z_opts) != IS_ARRAY) {
+ if(z_opts && Z_TYPE_P(z_opts) != IS_LONG && Z_TYPE_P(z_opts) != IS_ARRAY
+ && Z_TYPE_P(z_opts) != IS_NULL)
+ {
RETURN_FALSE;
}
diff --git a/tests/TestRedis.php b/tests/TestRedis.php
index 65bc63ca..60f015f5 100644
--- a/tests/TestRedis.php
+++ b/tests/TestRedis.php
@@ -264,6 +264,12 @@ class Redis_Test extends TestSuite
$this->assertTrue($this->redis->set('foo','barbaz', Array('not-valid','nx','invalid','ex'=>200)));
$this->assertEquals($this->redis->ttl('foo'), 200);
$this->assertEquals($this->redis->get('foo'), 'barbaz');
+
+ /* Pass NULL as the optional arguments which should be ignored */
+ $this->redis->del('foo');
+ $this->redis->set('foo','bar', NULL);
+ $this->assertEquals($this->redis->get('foo'), 'bar');
+ $this->assertTrue($this->redis->ttl('foo')<0);
}
public function testGetSet() {