Skip to content

Commit e00b99d

Browse files
author
Jacob Christiansen
committed
Return null on key not found
1 parent bd5a1b4 commit e00b99d

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

lib/Store/Redis.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,10 @@ public function get($type, $key)
3737
$redisKey = "{$this->prefix}.$type.$key";
3838
$value = $this->redis->get($redisKey);
3939

40+
if (is_null($value)) {
41+
return null;
42+
}
43+
4044
return unserialize($value);
4145
}
4246

test/Store/RedisTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ public function testGetNonExistingKey()
126126
$res = $store->get('test', 'nokey');
127127

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

132132
public function testDeleteKey()

0 commit comments

Comments
 (0)