summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--includes/bootstrap.inc14
1 files changed, 7 insertions, 7 deletions
diff --git a/includes/bootstrap.inc b/includes/bootstrap.inc
index 1dffb08c2..15ff5af10 100644
--- a/includes/bootstrap.inc
+++ b/includes/bootstrap.inc
@@ -598,15 +598,15 @@ function drupal_settings_initialize() {
// in drupal_settings_initialize().
if (!empty($_SERVER['HTTP_HOST'])) {
$cookie_domain = $_SERVER['HTTP_HOST'];
+ // Strip leading periods, www., and port numbers from cookie domain.
+ $cookie_domain = ltrim($cookie_domain, '.');
+ if (strpos($cookie_domain, 'www.') === 0) {
+ $cookie_domain = substr($cookie_domain, 4);
+ }
+ $cookie_domain = explode(':', $cookie_domain);
+ $cookie_domain = '.' . $cookie_domain[0];
}
}
- // Strip leading periods, www., and port numbers from cookie domain.
- $cookie_domain = ltrim($cookie_domain, '.');
- if (strpos($cookie_domain, 'www.') === 0) {
- $cookie_domain = substr($cookie_domain, 4);
- }
- $cookie_domain = explode(':', $cookie_domain);
- $cookie_domain = '.' . $cookie_domain[0];
// 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))) {