diff options
-rw-r--r-- | redis.c | 4 | ||||
-rw-r--r-- | tests/TestRedis.php | 6 |
2 files changed, 9 insertions, 1 deletions
@@ -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() { |