mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
BUGFIX: alternative function for versions of PHP prior to version 5.2 (from r96681)
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@102333 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
c29cf7d302
commit
5c6f3d59d7
@ -22,7 +22,11 @@ class Cookie extends Object {
|
|||||||
if(!headers_sent($file, $line)) {
|
if(!headers_sent($file, $line)) {
|
||||||
$expiry = $expiryDays > 0 ? time()+(86400*$expiryDays) : 0;
|
$expiry = $expiryDays > 0 ? time()+(86400*$expiryDays) : 0;
|
||||||
$path = ($path) ? $path : Director::baseURL();
|
$path = ($path) ? $path : Director::baseURL();
|
||||||
setcookie($name, $value, $expiry, $path, $domain, $secure, $httpOnly);
|
// Versions of PHP prior to 5.2 do not support the $httpOnly value
|
||||||
|
if(version_compare(phpversion(), 5.2, '<'))
|
||||||
|
setcookie($name, $value, $expiry, $path, $domain, $secure);
|
||||||
|
else
|
||||||
|
setcookie($name, $value, $expiry, $path, $domain, $secure, $httpOnly);
|
||||||
} else {
|
} else {
|
||||||
if(self::$report_errors) user_error("Cookie '$name' can't be set. The site started outputting was content at line $line in $file", E_USER_WARNING);
|
if(self::$report_errors) 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