From 08c3b75244aee6cbb1680552a75c3042b029fbe2 Mon Sep 17 00:00:00 2001 From: /dev/mach Date: Mon, 21 Jan 2013 15:21:10 +0100 Subject: [PATCH] Update src/Illuminate/Session/Store.php MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixing the issue #58 If session's lifetime parameter equals to 0 session should expire after browser closes. But it doesn't, it expires immediately. If lifetime is something like 30 mins, session class works as expected. This patch fixes the problem and improves our math knowledge. --- src/Illuminate/Session/Store.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Illuminate/Session/Store.php b/src/Illuminate/Session/Store.php index bf77ee3568ff..9da31a334fe9 100644 --- a/src/Illuminate/Session/Store.php +++ b/src/Illuminate/Session/Store.php @@ -159,7 +159,10 @@ protected function isInvalid($session) { if ( ! is_array($session)) return true; - return (time() - $session['last_activity']) > ($this->lifetime * 60); + return ( $this->lifetime === 0 + ? false + : (time() - $session['last_activity']) > ($this->lifetime * 60) + ); } /** @@ -623,4 +626,4 @@ public function offsetUnset($key) $this->forget($key); } -} \ No newline at end of file +}