Skip to content

Commit b56dac9

Browse files
authored
Merge pull request #1980 from codeigniter4/sessionhandlers
Corrected return value for Session/RedisHandler::read to string, per PHP specs
2 parents c74ae90 + 512ba4a commit b56dac9

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

system/Session/Handlers/RedisHandler.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -178,22 +178,22 @@ public function open($save_path, $name): bool
178178
*
179179
* @return string|false Serialized session data
180180
*/
181-
public function read($sessionID)
181+
public function read($sessionID): string
182182
{
183183
if (isset($this->redis) && $this->lockSession($sessionID))
184184
{
185185
// Needed by write() to detect session_regenerate_id() calls
186186
$this->sessionID = $sessionID;
187187

188-
$session_data = $this->redis->get($this->keyPrefix . $sessionID);
188+
$session_data = $this->redis->get($this->keyPrefix . $sessionID);
189189
is_string($session_data) ? $this->keyExists = true : $session_data = '';
190190

191191
$this->fingerprint = md5($session_data);
192192

193193
return $session_data;
194194
}
195195

196-
return false;
196+
return '';
197197
}
198198

199199
//--------------------------------------------------------------------

0 commit comments

Comments
 (0)