Skip to content

Commit

Permalink
Merge pull request #1980 from codeigniter4/sessionhandlers
Browse files Browse the repository at this point in the history
Corrected return value for Session/RedisHandler::read to string, per PHP specs
  • Loading branch information
lonnieezell authored May 2, 2019
2 parents c74ae90 + 512ba4a commit b56dac9
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions system/Session/Handlers/RedisHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -178,22 +178,22 @@ public function open($save_path, $name): bool
*
* @return string|false Serialized session data
*/
public function read($sessionID)
public function read($sessionID): string
{
if (isset($this->redis) && $this->lockSession($sessionID))
{
// Needed by write() to detect session_regenerate_id() calls
$this->sessionID = $sessionID;

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

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

return $session_data;
}

return false;
return '';
}

//--------------------------------------------------------------------
Expand Down

0 comments on commit b56dac9

Please sign in to comment.