Skip to content

Commit

Permalink
Fixed bugs with the native session driver
Browse files Browse the repository at this point in the history
  • Loading branch information
michaeljennings committed Apr 11, 2015
1 parent 035ee1a commit 4086326
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/Notifier/Session/Native.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,15 @@ public function __construct(array $config)
{
$this->config = $config;

if ( ! isset($_SESSION)) {
session_start();
}

if ($this->initialLoad) {
if (isset($_SESSION[$this->config['sessionPrefix']]['flash'])) {
if (
isset($_SESSION[$this->config['sessionPrefix']]) &&
isset($_SESSION[$this->config['sessionPrefix']]['flash'])
) {
$this->flash = $_SESSION[$this->config['sessionPrefix']]['flash'];
unset($_SESSION[$this->config['sessionPrefix']]['flash']);
}
Expand Down Expand Up @@ -114,7 +121,7 @@ public function flash($key, $value)
*/
protected function getSessionData()
{
$data = $_SESSION[$this->config['sessionPrefix']];
$data = isset($_SESSION[$this->config['sessionPrefix']]) ? $_SESSION[$this->config['sessionPrefix']] : [];

return array_merge($data, $this->flash);
}
Expand Down

0 comments on commit 4086326

Please sign in to comment.