diff --git a/system/libraries/Cache/drivers/Cache_redis.php b/system/libraries/Cache/drivers/Cache_redis.php index d84437b591..da5bec6c96 100644 --- a/system/libraries/Cache/drivers/Cache_redis.php +++ b/system/libraries/Cache/drivers/Cache_redis.php @@ -157,7 +157,9 @@ public function __construct() * Get cache * * @param string $key Cache ID - * @return mixed + * @return mixed Cached value, NULL for a missing key, unsupported type or failed conversion; + * FALSE if unserialization fails or the legacy Redis GET fallback returns FALSE + * @throws ValueError If settype() is given an invalid type (PHP 8+) */ public function get($key) { @@ -180,10 +182,10 @@ public function get($key) case 'NULL': return settype($data['__ci_value'], $data['__ci_type']) ? $data['__ci_value'] - : FALSE; + : NULL; case 'resource': default: - return FALSE; + return NULL; } }