Skip to content

Commit

Permalink
Return null on key not found
Browse files Browse the repository at this point in the history
  • Loading branch information
Jacob Christiansen committed Mar 27, 2015
1 parent bd5a1b4 commit e00b99d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions lib/Store/Redis.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ public function get($type, $key)
$redisKey = "{$this->prefix}.$type.$key";
$value = $this->redis->get($redisKey);

if (is_null($value)) {
return null;
}

return unserialize($value);
}

Expand Down
2 changes: 1 addition & 1 deletion test/Store/RedisTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ public function testGetNonExistingKey()
$res = $store->get('test', 'nokey');

$this->assertEquals('simpleSAMLphp.test.nokey', Predis\Client::$getKey);
$this->assertFalse($res);
$this->assertNull($res);
}

public function testDeleteKey()
Expand Down

0 comments on commit e00b99d

Please sign in to comment.