From: Alexander Ebert Date: Thu, 8 Nov 2012 18:38:00 +0000 (+0100) Subject: Do not send cookie domain if local domain (chrome breaks) X-Git-Tag: 2.0.0_Beta_1~790^2~2 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=ec920d2cab064e701f62126fe614b51f0b9a62e6;p=GitHub%2FWoltLab%2FWCF.git Do not send cookie domain if local domain (chrome breaks) --- 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); } /**