From ec920d2cab064e701f62126fe614b51f0b9a62e6 Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Thu, 8 Nov 2012 19:38:00 +0100 Subject: [PATCH] Do not send cookie domain if local domain (chrome breaks) --- wcfsetup/install/files/lib/util/HeaderUtil.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/wcfsetup/install/files/lib/util/HeaderUtil.class.php b/wcfsetup/install/files/lib/util/HeaderUtil.class.php index ce5537c05e..e6f850c46f 100644 --- a/wcfsetup/install/files/lib/util/HeaderUtil.class.php +++ b/wcfsetup/install/files/lib/util/HeaderUtil.class.php @@ -20,7 +20,8 @@ final class HeaderUtil { */ public static function setCookie($name, $value = '', $expire = 0) { $application = ApplicationHandler::getInstance()->getActiveApplication(); - @header('Set-Cookie: '.rawurlencode(COOKIE_PREFIX.$name).'='.rawurlencode($value).($expire ? '; expires='.gmdate('D, d-M-Y H:i:s', $expire).' GMT' : '').'; path='.$application->cookiePath.'; domain='.$application->cookieDomain.(RouteHandler::secureConnection() ? '; secure' : '').'; HttpOnly', false); + $addDomain = (StringUtil::indexOf($application->cookieDomain, '.') === false || StringUtil::endsWith($application->cookieDomain, '.lan') || StringUtil::endsWith($application->cookieDomain, '.local')) ? false : true; + @header('Set-Cookie: '.rawurlencode(COOKIE_PREFIX.$name).'='.rawurlencode($value).($expire ? '; expires='.gmdate('D, d-M-Y H:i:s', $expire).' GMT' : '').'; path='.$application->cookiePath.($addDomain ? '; domain='.$application->cookieDomain : '').(RouteHandler::secureConnection() ? '; secure' : '').'; HttpOnly', false); } /** -- 2.20.1