Skip to content
Permalink
Browse files

Return empty string on non-existent session read()

  • Loading branch information...
JoeBiellik committed Dec 17, 2015
1 parent 268dfa3 commit 1b0b4fc0625a6b0bda8cb92f6bdf8db6672a8b9a
Showing with 10 additions and 4 deletions.
  1. +8 −2 src/Network/Session/CacheSession.php
  2. +2 −2 src/Network/Session/DatabaseSession.php
@@ -78,11 +78,17 @@ public function close()
* Method used to read from a cache session.
*
* @param string $id The key of the value to read
* @return mixed The value of the key or false if it does not exist
* @return string The value of the key or empty if it does not exist
*/
public function read($id)
{
return Cache::read($id, $this->_options['config']);
$value = Cache::read($id, $this->_options['config']);
if (empty($value)) {
return '';
}
return $value;
}
/**
@@ -89,7 +89,7 @@ public function close()
* Method used to read from a database session.
*
* @param int|string $id The key of the value to read
* @return mixed The value of the key or false if it does not exist
* @return string The value of the key or empty if it does not exist
*/
public function read($id)
{
@@ -101,7 +101,7 @@ public function read($id)
->first();
if (empty($result)) {
return false;
return '';
}
if (is_string($result['data'])) {

0 comments on commit 1b0b4fc

Please sign in to comment.
You can’t perform that action at this time.