mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
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:
parent
690f1c1570
commit
4ef83a2895
@ -541,7 +541,7 @@ class Session {
|
|||||||
// Modify the timeout behaviour so it's the *inactive* time before the session expires.
|
// Modify the timeout behaviour so it's the *inactive* time before the session expires.
|
||||||
// By default it's the total session lifetime
|
// By default it's the total session lifetime
|
||||||
if($timeout && !headers_sent()) {
|
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');
|
$secure = Config::inst()->get('Session', 'cookie_secure');
|
||||||
|
|
||||||
if($domain) {
|
if($domain) {
|
||||||
setcookie(session_name(), '', null, $path, $domain, $secure, true);
|
Cookie::set(session_name(), '', null, $path, $domain, $secure, true);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
setcookie(session_name(), '', null, $path, null, $secure, true);
|
Cookie::set(session_name(), '', null, $path, null, $secure, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
unset($_COOKIE[session_name()]);
|
unset($_COOKIE[session_name()]);
|
||||||
|
Loading…
Reference in New Issue
Block a user