The new settings.php’s comments for $cookie_domain should be using the same format as the $base_url comment above it.

Specifically:

 * cross between your various domains.
*/

#$cookie_domain = 'example.com';

should be:

 * cross between your various domains.
 */
# $cookie_domain = 'example.com';

…to make it clearer that you should remove just the # and not the #$.

Comments

johnalbin’s picture

Status: Active » Needs review
StatusFileSize
new1.19 KB

Re-rolled for default.settings.php. Again, only the spacing is changed; no comment or code changes.

forngren’s picture

Status: Needs review » Reviewed & tested by the community

Nice one.

dries’s picture

Status: Reviewed & tested by the community » Fixed

Committed to CVS HEAD. Thanks John.

Anonymous’s picture

Status: Fixed » Closed (fixed)
MiMe’s picture

It 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';

mooffie’s picture

Version: 6.x-dev » 7.x-dev
Component: user system » documentation
Category: feature » bug
Priority: Minor » Normal
Status: Closed (fixed) » Active

@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.

jhodgdon’s picture

This is a totally separate issue than the original, and is not a documentation issue. Please file as a separate issue.

jhodgdon’s picture

Version: 7.x-dev » 6.x-dev
Component: documentation » user system
Status: Active » Closed (fixed)

Actually, I'll go ahead and file it, and close this one back up:
#1013560: Cookie domain suggestion in settings.php is wrong (maybe)