Using Cookie class in Session::destroy()

It allows us to suppress "headers sent" errors, which is particularly
important in phpunit test runs.
This commit is contained in:
Ingo Schommer 2013-06-18 23:06:22 +02:00
parent 690f1c1570
commit 4ef83a2895

View File

@ -541,7 +541,7 @@ class Session {
// Modify the timeout behaviour so it's the *inactive* time before the session expires.
// By default it's the total session lifetime
if($timeout && !headers_sent()) {
setcookie(session_name(), session_id(), time()+$timeout, $path, $domain ? $domain : null, $secure, true);
Cookie::set(session_name(), session_id(), time()+$timeout, $path, $domain ? $domain : null, $secure, true);
}
}
@ -559,10 +559,10 @@ class Session {
$secure = Config::inst()->get('Session', 'cookie_secure');
if($domain) {
setcookie(session_name(), '', null, $path, $domain, $secure, true);
Cookie::set(session_name(), '', null, $path, $domain, $secure, true);
}
else {
setcookie(session_name(), '', null, $path, null, $secure, true);
Cookie::set(session_name(), '', null, $path, null, $secure, true);
}
unset($_COOKIE[session_name()]);