diff options
author | michael-grunder <michael.grunder@gmail.com> | 2013-11-18 23:42:14 +0400 |
---|---|---|
committer | michael-grunder <michael.grunder@gmail.com> | 2013-11-18 23:42:14 +0400 |
commit | 49dce3b3729cb1f9e1ccf942c39d2dabaaf3d76d (patch) | |
tree | 42e6dfbdc5568c2cbe0176bfff51f6324eb2f8bb | |
parent | 504724b4167d744719f2b2c6b5fdb095f283ca26 (diff) | |
parent | 32837e06e92bd31c0866ee680aff78aa38c7145d (diff) |
Merge branch 'hotfix/allow_null_set_options'allow_null_set_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() { |