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
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/2.4@96681 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
8d7658109e
commit
6883c8e3c6
@ -22,7 +22,11 @@ class Cookie extends Object {
|
||||
if(!headers_sent($file, $line)) {
|
||||
$expiry = $expiryDays > 0 ? time()+(86400*$expiryDays) : 0;
|
||||
$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 {
|
||||
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