Permalink
Browse files

Fix for bug when destroying a session with a domain cookie. See http:…

  • Loading branch information...
1 parent d30b4b1 commit 77f5ea733b8435b719e170d7fcc0ca91b2b9781c @joaosantos81 joaosantos81 committed Nov 14, 2011
Showing with 11 additions and 1 deletion.
  1. +11 −1 control/Session.php
View
@@ -448,7 +448,17 @@ public static function start($sid = null) {
public static function destroy($removeCookie = true) {
if(session_id()) {
if($removeCookie) {
- setcookie(session_name(), '');
+ $path = self::get_cookie_path();
+ $domain = self::get_cookie_domain();
+ $secure = self::get_cookie_secure();
+
+ if($domain) {
+ setcookie(session_name(), '', null, $path, $domain, $secure, true);
+ }
+ else {
+ setcookie(session_name(), '', null, $path, null, $secure, true);
+ }
+
unset($_COOKIE[session_name()]);
}
session_destroy();

0 comments on commit 77f5ea7

Please sign in to comment.