mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
BUGFIX #2714 - Cookie::set doesn't operate correctly with expiryDays 0 (wakeless)
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/2.3@66196 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
e3298047c3
commit
4c81b8c3a5
@ -13,10 +13,11 @@ class Cookie extends Object {
|
|||||||
*/
|
*/
|
||||||
static function set($name, $value, $expiryDays = 90) {
|
static function set($name, $value, $expiryDays = 90) {
|
||||||
if(!headers_sent($file, $line)) {
|
if(!headers_sent($file, $line)) {
|
||||||
setcookie($name, $value, time()+(86400*$expiryDays), Director::baseURL());
|
$expiry = $expiryDays > 0 ? time()+(86400*$expiryDays) : 0;
|
||||||
|
setcookie($name, $value, $expiry, Director::baseURL());
|
||||||
$_COOKIE[$name] = $value;
|
$_COOKIE[$name] = $value;
|
||||||
} else {
|
} else {
|
||||||
// if(Director::isDevMode()) user_error("Cookie '$name' can't be set. The site started outputting was content at line $line in $file", E_USER_WARNING);
|
if(Director::isDev()) user_error("Cookie '$name' can't be set. The site started outputting was content at line $line in $file", E_USER_WARNING);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user