Skip to content

Commit

Permalink
Fix session_write_close on php7 (#15968)
Browse files Browse the repository at this point in the history
* Fix session_write_close(): Session callback expects true/false return value

laravel/framework#15717

* Fix Styling

* Fixed same error with `session_destroy`
  • Loading branch information
lcharette authored and taylorotwell committed Oct 18, 2016
1 parent bd3272b commit e7eb764
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
4 changes: 4 additions & 0 deletions CookieSessionHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ public function write($sessionId, $data)
'data' => $data,
'expires' => Carbon::now()->addMinutes($this->minutes)->getTimestamp(),
]), $this->minutes);

return true;
}

/**
Expand All @@ -92,6 +94,8 @@ public function write($sessionId, $data)
public function destroy($sessionId)
{
$this->cookie->queue($this->cookie->forget($sessionId));

return true;
}

/**
Expand Down
4 changes: 4 additions & 0 deletions DatabaseSessionHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,8 @@ public function write($sessionId, $data)
}

$this->exists = true;

return true;
}

/**
Expand Down Expand Up @@ -157,6 +159,8 @@ protected function getDefaultPayload($data)
public function destroy($sessionId)
{
$this->getQuery()->where('id', $sessionId)->delete();

return true;
}

/**
Expand Down
4 changes: 4 additions & 0 deletions FileSessionHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ public function read($sessionId)
public function write($sessionId, $data)
{
$this->files->put($this->path.'/'.$sessionId, $data, true);

return true;
}

/**
Expand All @@ -89,6 +91,8 @@ public function write($sessionId, $data)
public function destroy($sessionId)
{
$this->files->delete($this->path.'/'.$sessionId);

return true;
}

/**
Expand Down

0 comments on commit e7eb764

Please sign in to comment.