#108663: Fix edge case for cookie domains (conform to RFC 2109)

5.x
Steven Wittens 2007-01-14 02:05:15 +00:00
parent 5790f43620
commit e9e4a3a446
1 changed files with 5 additions and 1 deletions

View File

@ -142,7 +142,11 @@ ini_set('url_rewriter.tags', '');
*/
if (isset($_SERVER['HTTP_HOST'])) {
$domain = '.'. preg_replace('`^www.`', '', $_SERVER['HTTP_HOST']);
// Per RFC 2109, cookie domains must contain at least one dot other than the
// first. For hosts such as 'localhost', we don't set a cookie domain.
if (count(explode('.', $domain)) > 2) {
ini_set('session.cookie_domain', $domain);
}
}
/**