Browse Source

Don't write session cookie if headers have already been sent.

Taylor Otwell 13 years ago
parent
commit
4585f25092
1 changed files with 5 additions and 2 deletions
  1. 5 2
      system/session/cookie.php

+ 5 - 2
system/session/cookie.php

@@ -35,9 +35,12 @@ class Cookie implements Driver {
 	 */
 	public function save($session)
 	{
-		$c = \System\Config::get('session');
+		if ( ! headers_sent())
+		{
+			extract(Config::get('session'));
 
-		\System\Cookie::put('session_payload', Crypt::encrypt(serialize($session)), $c['lifetime'], $c['path'], $c['domain'], $c['https'], $c['http_only']);
+			\System\Cookie::put('session_payload', Crypt::encrypt(serialize($session)), $lifetime, $path, $domain, $https, $http_only);
+		}
 	}
 
 	/**