From 89ec544e70120c6f93f979b01cb4ea97b20dae77 Mon Sep 17 00:00:00 2001 From: Louis Charette Date: Mon, 17 Oct 2016 17:46:17 -0400 Subject: [PATCH 1/3] Fix session_write_close(): Session callback expects true/false return value https://github.com/laravel/framework/issues/15717 --- src/Illuminate/Session/CookieSessionHandler.php | 1 + src/Illuminate/Session/DatabaseSessionHandler.php | 1 + src/Illuminate/Session/FileSessionHandler.php | 2 +- 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Illuminate/Session/CookieSessionHandler.php b/src/Illuminate/Session/CookieSessionHandler.php index 0f1a55787b8a..93f68ba87fc1 100755 --- a/src/Illuminate/Session/CookieSessionHandler.php +++ b/src/Illuminate/Session/CookieSessionHandler.php @@ -84,6 +84,7 @@ public function write($sessionId, $data) 'data' => $data, 'expires' => Carbon::now()->addMinutes($this->minutes)->getTimestamp(), ]), $this->minutes); + return true; } /** diff --git a/src/Illuminate/Session/DatabaseSessionHandler.php b/src/Illuminate/Session/DatabaseSessionHandler.php index 5fc61f13629c..1baed84cbf7a 100644 --- a/src/Illuminate/Session/DatabaseSessionHandler.php +++ b/src/Illuminate/Session/DatabaseSessionHandler.php @@ -120,6 +120,7 @@ public function write($sessionId, $data) } $this->exists = true; + return true; } /** diff --git a/src/Illuminate/Session/FileSessionHandler.php b/src/Illuminate/Session/FileSessionHandler.php index 8b86ede24044..df0a7056eee9 100644 --- a/src/Illuminate/Session/FileSessionHandler.php +++ b/src/Illuminate/Session/FileSessionHandler.php @@ -80,7 +80,7 @@ public function read($sessionId) */ public function write($sessionId, $data) { - $this->files->put($this->path.'/'.$sessionId, $data, true); + return ($this->files->put($this->path.'/'.$sessionId, $data, true) ? true : false); } /** From f2ce52f1abf6650f6ac0735b23de26bcc5a32b1d Mon Sep 17 00:00:00 2001 From: Louis Charette Date: Mon, 17 Oct 2016 17:50:17 -0400 Subject: [PATCH 2/3] Fix Styling --- src/Illuminate/Session/CookieSessionHandler.php | 1 + src/Illuminate/Session/DatabaseSessionHandler.php | 1 + src/Illuminate/Session/FileSessionHandler.php | 2 +- 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Illuminate/Session/CookieSessionHandler.php b/src/Illuminate/Session/CookieSessionHandler.php index 93f68ba87fc1..34bf3a6e879e 100755 --- a/src/Illuminate/Session/CookieSessionHandler.php +++ b/src/Illuminate/Session/CookieSessionHandler.php @@ -84,6 +84,7 @@ public function write($sessionId, $data) 'data' => $data, 'expires' => Carbon::now()->addMinutes($this->minutes)->getTimestamp(), ]), $this->minutes); + return true; } diff --git a/src/Illuminate/Session/DatabaseSessionHandler.php b/src/Illuminate/Session/DatabaseSessionHandler.php index 1baed84cbf7a..1457ebe4cdd6 100644 --- a/src/Illuminate/Session/DatabaseSessionHandler.php +++ b/src/Illuminate/Session/DatabaseSessionHandler.php @@ -120,6 +120,7 @@ public function write($sessionId, $data) } $this->exists = true; + return true; } diff --git a/src/Illuminate/Session/FileSessionHandler.php b/src/Illuminate/Session/FileSessionHandler.php index df0a7056eee9..e65b42e683c1 100644 --- a/src/Illuminate/Session/FileSessionHandler.php +++ b/src/Illuminate/Session/FileSessionHandler.php @@ -80,7 +80,7 @@ public function read($sessionId) */ public function write($sessionId, $data) { - return ($this->files->put($this->path.'/'.$sessionId, $data, true) ? true : false); + return $this->files->put($this->path.'/'.$sessionId, $data, true) ? true : false; } /** From 2ee8631a6b6dfc1f82962348ee89ef9e781fe18a Mon Sep 17 00:00:00 2001 From: Louis Charette Date: Mon, 17 Oct 2016 19:50:41 -0400 Subject: [PATCH 3/3] Fixed same error with `session_destroy` --- src/Illuminate/Session/CookieSessionHandler.php | 2 ++ src/Illuminate/Session/DatabaseSessionHandler.php | 2 ++ src/Illuminate/Session/FileSessionHandler.php | 6 +++++- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/Illuminate/Session/CookieSessionHandler.php b/src/Illuminate/Session/CookieSessionHandler.php index 34bf3a6e879e..95b7bcc02a84 100755 --- a/src/Illuminate/Session/CookieSessionHandler.php +++ b/src/Illuminate/Session/CookieSessionHandler.php @@ -94,6 +94,8 @@ public function write($sessionId, $data) public function destroy($sessionId) { $this->cookie->queue($this->cookie->forget($sessionId)); + + return true; } /** diff --git a/src/Illuminate/Session/DatabaseSessionHandler.php b/src/Illuminate/Session/DatabaseSessionHandler.php index 1457ebe4cdd6..412a2121fabe 100644 --- a/src/Illuminate/Session/DatabaseSessionHandler.php +++ b/src/Illuminate/Session/DatabaseSessionHandler.php @@ -159,6 +159,8 @@ protected function getDefaultPayload($data) public function destroy($sessionId) { $this->getQuery()->where('id', $sessionId)->delete(); + + return true; } /** diff --git a/src/Illuminate/Session/FileSessionHandler.php b/src/Illuminate/Session/FileSessionHandler.php index e65b42e683c1..e206d9ddfe89 100644 --- a/src/Illuminate/Session/FileSessionHandler.php +++ b/src/Illuminate/Session/FileSessionHandler.php @@ -80,7 +80,9 @@ public function read($sessionId) */ public function write($sessionId, $data) { - return $this->files->put($this->path.'/'.$sessionId, $data, true) ? true : false; + $this->files->put($this->path.'/'.$sessionId, $data, true); + + return true; } /** @@ -89,6 +91,8 @@ public function write($sessionId, $data) public function destroy($sessionId) { $this->files->delete($this->path.'/'.$sessionId); + + return true; } /**