Someone reopened an old issue and added this unrelated comment, so I'm filing this as a new issue. I have no opinion on the correctness, but here are the two comments from #140468: Make $cookie_domain comments match $base_url comments:

Posted by MiMe on October 25, 2010 at 6:14am:
[The suggested setting in settings.php for cookies ] should actually be '.example.com'

The documentation in the settings.php has an example of the cookie domain set to:
# $cookie_domain = 'example.com';

But the cookie domain must be replaced with .example.com since the . is Always added in the bootstrap.

So the correct documentation for cookie domain should be:
# $cookie_domain = '.example.com';

Posted by mooffie on January 3, 2011 at 6:10am:

@MiMe is right, I believe.

Do we need to put a dot in front? If so, we should fix that comment.

The php docs says "RFC 2109 requires it to be included". And our own code is:

// Per RFC 2109, cookie domains must contain at least one dot other than the
// first. For hosts such as 'localhost' or IP Addresses we don't set a cookie domain.
if (count(explode('.', $cookie_domain)) > 2 && !is_numeric(str_replace('.', '', $cookie_domain))) {
ini_set('session.cookie_domain', $cookie_domain);

and it seem "example.com" won't pass this.

Comments

Tor Arne Thune’s picture

Status: Active » Closed (duplicate)